Преглед на файлове

Bugfix for vegetation shader and instancing.

hdunderscore преди 8 години
родител
ревизия
25612d6e72
променени са 2 файла, в които са добавени 6 реда и са изтрити 6 реда
  1. 4 4
      bin/CoreData/Shaders/GLSL/Vegetation.glsl
  2. 2 2
      bin/CoreData/Shaders/HLSL/Vegetation.hlsl

+ 4 - 4
bin/CoreData/Shaders/GLSL/Vegetation.glsl

@@ -48,7 +48,7 @@ void VS()
 {
 {
     mat4 modelMatrix = iModelMatrix;
     mat4 modelMatrix = iModelMatrix;
     vec3 worldPos = GetWorldPos(modelMatrix);
     vec3 worldPos = GetWorldPos(modelMatrix);
-    float height = worldPos.y - cModel[1][3];
+    float height = worldPos.y - modelMatrix[1][3];
 
 
     float windStrength = max(height - cWindHeightPivot, 0.0) * cWindHeightFactor;
     float windStrength = max(height - cWindHeightPivot, 0.0) * cWindHeightFactor;
     float windPeriod = cElapsedTime * cWindPeriod + dot(worldPos.xz, cWindWorldSpacing);
     float windPeriod = cElapsedTime * cWindPeriod + dot(worldPos.xz, cWindWorldSpacing);
@@ -86,7 +86,7 @@ void VS()
             // Spotlight projection: transform from world space to projector texture coordinates
             // Spotlight projection: transform from world space to projector texture coordinates
             vSpotPos = projWorldPos * cLightMatrices[0];
             vSpotPos = projWorldPos * cLightMatrices[0];
         #endif
         #endif
-    
+
         #ifdef POINTLIGHT
         #ifdef POINTLIGHT
             vCubeMaskVec = (worldPos - cLightPos.xyz) * mat3(cLightMatrices[0][0].xyz, cLightMatrices[0][1].xyz, cLightMatrices[0][2].xyz);
             vCubeMaskVec = (worldPos - cLightPos.xyz) * mat3(cLightMatrices[0][0].xyz, cLightMatrices[0][1].xyz, cLightMatrices[0][2].xyz);
         #endif
         #endif
@@ -100,12 +100,12 @@ void VS()
         #else
         #else
             vVertexLight = GetAmbient(GetZonePos(worldPos));
             vVertexLight = GetAmbient(GetZonePos(worldPos));
         #endif
         #endif
-        
+
         #ifdef NUMVERTEXLIGHTS
         #ifdef NUMVERTEXLIGHTS
             for (int i = 0; i < NUMVERTEXLIGHTS; ++i)
             for (int i = 0; i < NUMVERTEXLIGHTS; ++i)
                 vVertexLight += GetVertexLight(i, worldPos, vNormal) * cVertexLights[i * 3].rgb;
                 vVertexLight += GetVertexLight(i, worldPos, vNormal) * cVertexLights[i * 3].rgb;
         #endif
         #endif
-        
+
         vScreenPos = GetScreenPos(gl_Position);
         vScreenPos = GetScreenPos(gl_Position);
 
 
         #ifdef ENVCUBEMAP
         #ifdef ENVCUBEMAP

+ 2 - 2
bin/CoreData/Shaders/HLSL/Vegetation.hlsl

@@ -95,7 +95,7 @@ void VS(float4 iPos : POSITION,
 
 
     float4x3 modelMatrix = iModelMatrix;
     float4x3 modelMatrix = iModelMatrix;
     float3 worldPos = GetWorldPos(modelMatrix);
     float3 worldPos = GetWorldPos(modelMatrix);
-    float height = worldPos.y - cModel._m31;
+    float height = worldPos.y - modelMatrix._m31;
 
 
     float windStrength = max(height - cWindHeightPivot, 0.0) * cWindHeightFactor;
     float windStrength = max(height - cWindHeightPivot, 0.0) * cWindHeightFactor;
     float windPeriod = cElapsedTime * cWindPeriod + dot(worldPos.xz, cWindWorldSpacing);
     float windPeriod = cElapsedTime * cWindPeriod + dot(worldPos.xz, cWindWorldSpacing);
@@ -155,7 +155,7 @@ void VS(float4 iPos : POSITION,
             for (int i = 0; i < NUMVERTEXLIGHTS; ++i)
             for (int i = 0; i < NUMVERTEXLIGHTS; ++i)
                 oVertexLight += GetVertexLight(i, worldPos, oNormal) * cVertexLights[i * 3].rgb;
                 oVertexLight += GetVertexLight(i, worldPos, oNormal) * cVertexLights[i * 3].rgb;
         #endif
         #endif
-        
+
         oScreenPos = GetScreenPos(oPos);
         oScreenPos = GetScreenPos(oPos);
 
 
         #ifdef ENVCUBEMAP
         #ifdef ENVCUBEMAP