mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +02:00
Merging with master to be able connect to dev domains and it works. fixing shaders for gles compile errors and disabling material textures by default
This commit is contained in:
parent
df0660f823
commit
57f1ba2412
5 changed files with 85 additions and 19 deletions
|
@ -150,6 +150,10 @@ void GLBackend::resetUniformStage() {
|
|||
|
||||
void GLBackend::do_setUniformBuffer(const Batch& batch, size_t paramOffset) {
|
||||
GLuint slot = batch._params[paramOffset + 3]._uint;
|
||||
if (slot >(GLuint)MAX_NUM_UNIFORM_BUFFERS) {
|
||||
qCDebug(gpugllogging) << "GLBackend::do_setUniformBuffer: Trying to set a uniform Buffer at slot #" << slot << " which doesn't exist. MaxNumUniformBuffers = " << getMaxNumUniformBuffers();
|
||||
return;
|
||||
}
|
||||
BufferPointer uniformBuffer = batch._buffers.get(batch._params[paramOffset + 2]._uint);
|
||||
GLintptr rangeStart = batch._params[paramOffset + 1]._uint;
|
||||
GLsizeiptr rangeSize = batch._params[paramOffset + 0]._uint;
|
||||
|
|
|
@ -96,7 +96,7 @@ protected:
|
|||
|
||||
float enableObscurance{ 1.0f };
|
||||
|
||||
float enableMaterialTexturing { 1.0f };
|
||||
float enableMaterialTexturing { 0.0f };
|
||||
float enableWireframe { 0.0f }; // false by default
|
||||
|
||||
Parameters() {}
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
bool enableSpecular{ true };
|
||||
|
||||
bool enableAlbedo{ true };
|
||||
bool enableMaterialTexturing { true };
|
||||
bool enableMaterialTexturing { false };
|
||||
|
||||
bool enableAmbientLight{ true };
|
||||
bool enableDirectionalLight{ true };
|
||||
|
|
|
@ -39,12 +39,12 @@ mat4 dualQuatToMat4(vec4 real, vec4 dual) {
|
|||
twoRealXZ - twoRealYW,
|
||||
0.0);
|
||||
vec4 col1 = vec4(twoRealXY - twoRealZW,
|
||||
1 - twoRealXSq - twoRealZSq,
|
||||
1.0 - twoRealXSq - twoRealZSq,
|
||||
twoRealYZ + twoRealXW,
|
||||
0.0);
|
||||
vec4 col2 = vec4(twoRealXZ + twoRealYW,
|
||||
twoRealYZ - twoRealXW,
|
||||
1 - twoRealXSq - twoRealYSq,
|
||||
1.0 - twoRealXSq - twoRealYSq,
|
||||
0.0);
|
||||
vec4 col3 = vec4(2.0 * (-dual.w * real.x + dual.x * real.w - dual.y * real.z + dual.z * real.y),
|
||||
2.0 * (-dual.w * real.y + dual.x * real.z + dual.y * real.w - dual.z * real.x),
|
||||
|
@ -72,7 +72,7 @@ void skinPosition(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPositio
|
|||
|
||||
// to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity.
|
||||
float dqClusterWeight = clusterWeight;
|
||||
if (dot(real, polarityReference) < 0) {
|
||||
if (dot(real, polarityReference) < 0.0) {
|
||||
dqClusterWeight = -clusterWeight;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ void skinPositionNormal(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inP
|
|||
|
||||
// to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity.
|
||||
float dqClusterWeight = clusterWeight;
|
||||
if (dot(real, polarityReference) < 0) {
|
||||
if (dot(real, polarityReference) < 0.0) {
|
||||
dqClusterWeight = -clusterWeight;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void skinPositionNormalTangent(ivec4 skinClusterIndex, vec4 skinClusterWeight, v
|
|||
|
||||
// to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity.
|
||||
float dqClusterWeight = clusterWeight;
|
||||
if (dot(real, polarityReference) < 0) {
|
||||
if (dot(real, polarityReference) < 0.0) {
|
||||
dqClusterWeight = -clusterWeight;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,17 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include ForwardBufferWrite.slh@>
|
||||
|
||||
<!<@include ForwardBufferWrite.slh@> !>
|
||||
|
||||
<@include ForwardGlobalLight.slh@>
|
||||
<$declareEvalSkyboxGlobalColor()$>
|
||||
|
||||
<@include model/Material.slh@>
|
||||
|
||||
<@include gpu/Transform.slh@>
|
||||
<$declareStandardCameraTransform()$>
|
||||
|
||||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$>
|
||||
|
||||
|
@ -26,6 +33,8 @@ in vec3 _normal;
|
|||
in vec3 _tangent;
|
||||
in vec3 _color;
|
||||
|
||||
out vec4 _fragColor;
|
||||
|
||||
void main(void) {
|
||||
Material mat = getMaterial();
|
||||
int matKey = getMaterialKey(mat);
|
||||
|
@ -51,16 +60,32 @@ void main(void) {
|
|||
|
||||
float metallic = getMaterialMetallic(mat);
|
||||
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||
vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value
|
||||
if (metallic <= 0.5) {
|
||||
metallic = 0.0;
|
||||
}
|
||||
else {
|
||||
fresnel = albedo;
|
||||
metallic = 1.0;
|
||||
}
|
||||
vec3 fragPosition = _position.xyz;
|
||||
|
||||
float scattering = getMaterialScattering(mat);
|
||||
TransformCamera cam = getTransformCamera();
|
||||
|
||||
packForwardFragment(
|
||||
normalize(viewNormal.xyz),
|
||||
opacity,
|
||||
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
1.0,
|
||||
fragPosition,
|
||||
viewNormal,
|
||||
albedo,
|
||||
roughness,
|
||||
fresnel,
|
||||
metallic,
|
||||
emissive,
|
||||
occlusionTex,
|
||||
scattering);
|
||||
roughness),
|
||||
opacity);
|
||||
|
||||
color.rgb += emissive * isEmissiveEnabled();
|
||||
|
||||
// _fragColor = vec4(albedo, opacity);
|
||||
_fragColor = color;
|
||||
}
|
||||
|
|
|
@ -12,10 +12,17 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include ForwardBufferWrite.slh@>
|
||||
|
||||
<!<@include ForwardBufferWrite.slh@> !>
|
||||
|
||||
<@include ForwardGlobalLight.slh@>
|
||||
<$declareEvalSkyboxGlobalColor()$>
|
||||
|
||||
<@include model/Material.slh@>
|
||||
|
||||
<@include gpu/Transform.slh@>
|
||||
<$declareStandardCameraTransform()$>
|
||||
|
||||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$>
|
||||
|
||||
|
@ -25,12 +32,13 @@ in vec2 _texCoord1;
|
|||
in vec3 _normal;
|
||||
in vec3 _color;
|
||||
|
||||
out vec4 _fragColor;
|
||||
|
||||
void main(void) {
|
||||
Material mat = getMaterial();
|
||||
int matKey = getMaterialKey(mat);
|
||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$>
|
||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
||||
<! <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> !>
|
||||
|
||||
float opacity = 1.0;
|
||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||
|
@ -48,7 +56,14 @@ void main(void) {
|
|||
|
||||
float metallic = getMaterialMetallic(mat);
|
||||
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||
|
||||
vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value
|
||||
if (metallic <= 0.5) {
|
||||
metallic = 0.0;
|
||||
}
|
||||
else {
|
||||
fresnel = albedo;
|
||||
metallic = 1.0;
|
||||
}/*
|
||||
float scattering = getMaterialScattering(mat);
|
||||
|
||||
packForwardFragment(
|
||||
|
@ -60,4 +75,26 @@ void main(void) {
|
|||
emissive,
|
||||
occlusionTex,
|
||||
scattering);
|
||||
*/
|
||||
vec3 fragPosition = _position.xyz;
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragNormal;
|
||||
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>
|
||||
|
||||
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
1.0,
|
||||
fragPosition,
|
||||
fragNormal,
|
||||
albedo,
|
||||
fresnel,
|
||||
metallic,
|
||||
roughness),
|
||||
opacity);
|
||||
color.rgb += emissive * isEmissiveEnabled();
|
||||
|
||||
// _fragColor = vec4(albedo, opacity);
|
||||
_fragColor = color;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue