Skip to content

Instantly share code, notes, and snippets.

@o11c
Created October 30, 2016 19:37
Show Gist options
  • Select an option

  • Save o11c/4524a20f53aab8554d6e265d5fcfcb99 to your computer and use it in GitHub Desktop.

Select an option

Save o11c/4524a20f53aab8554d6e265d5fcfcb99 to your computer and use it in GitHub Desktop.
Bug in OpenClonk
diff --git a/planet/Graphics.ocg/LandscapeShader.glsl b/planet/Graphics.ocg/LandscapeShader.glsl
index fd26967..45bc358 100644
--- a/planet/Graphics.ocg/LandscapeShader.glsl
+++ b/planet/Graphics.ocg/LandscapeShader.glsl
@@ -100,6 +100,8 @@ slice(texture+4)
slice(material)
{
+ float fix1 = 0.5;
+ float fix2 = 0.5;
// Get material properties from material map
int matMapIx = f2i(landscapePx.r);
@@ -111,8 +113,8 @@ slice(material)
float matAngle = matMapX.a;
// Query material texture pixels
- vec4 materialPx = texture(materialTex, vec3(materialCoo, materialIx));
- vec4 normalPx = texture(materialTex, vec3(materialCoo, materialIx+0.5 * materialDepth));
+ vec4 materialPx = texture(materialTex, vec3(materialCoo, materialIx + fix1));
+ vec4 normalPx = texture(materialTex, vec3(materialCoo, materialIx+0.5 * materialDepth + fix1));
// Same for second pixel
int matMapIx2 = f2i(landscapePx2.r);
vec4 matMap2 = queryMatMap(2*matMapIx2);
@@ -123,8 +125,8 @@ slice(material)
float matAngle2 = matMapX2.a;
// Query material texture pixels
- vec4 materialPx2 = texture(materialTex, vec3(materialCoo, materialIx2));
- vec4 normalPx2 = texture(materialTex, vec3(materialCoo, materialIx2+0.5 * materialDepth));
+ vec4 materialPx2 = texture(materialTex, vec3(materialCoo, materialIx2 + fix2));
+ vec4 normalPx2 = texture(materialTex, vec3(materialCoo, materialIx2+0.5 * materialDepth + fix2));
}
slice(normal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment