Skip to content

Commit

Permalink
Fixed issue #1031.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed May 28, 2024
1 parent 302b5eb commit 71e30c2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/de/matthiasmann/twl/util/PNGSizeDeterminer.java
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ private void skip(long amount) throws IOException {
throw new EOFException();
}
amount -= skipped;
size += skipped;
// this downcast should(tm) work
size += (int) skipped;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/org/nschmidt/ldparteditor/helper/Teapot.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,21 @@ public static void fastSolidTeapot(int grid, float scale) {
q[j][k][l] = cpdata[patchdata[i][j * 4 + 3 - k]][l];

if (l == 1)
q[j][k][l] *= -1.0;
q[j][k][l] *= -1.0f;

if (i < 6) {
r[j][k][l] = cpdata[patchdata[i][j * 4 + 3 - k]][l];

if (l == 0)
r[j][k][l] *= -1.0;
r[j][k][l] *= -1.0f;

s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];

if (l == 0)
s[j][k][l] *= -1.0;
s[j][k][l] *= -1.0f;

if (l == 1)
s[j][k][l] *= -1.0;
s[j][k][l] *= -1.0f;
}
}
}
Expand Down
32 changes: 16 additions & 16 deletions src/org/nschmidt/ldparteditor/opengl/OpenGLRenderer20.java
Original file line number Diff line number Diff line change
Expand Up @@ -801,11 +801,11 @@ else if (zoom > 1.0E-2)
// attenuation and light direction
// ambient + diffuse
light = 0.09f; // Ambient
light += 0.80f * .6f * Math.max(Vector3f.dot(normal, lightDir1), 0.0);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir2), 0.0);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir3), 0.0);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir4), 0.0);
lightSpecular += Math.pow(Math.max(Vector3f.dot(normal, ray3f2), 0.0), 128f);
light += 0.80f * .6f * Math.max(Vector3f.dot(normal, lightDir1), 0f);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir2), 0f);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir3), 0f);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir4), 0f);
lightSpecular += (float) Math.pow(Math.max(Vector3f.dot(normal, ray3f2), 0.0), 128.0);
}
float colourR = ze[12];
float colourG = ze[13];
Expand Down Expand Up @@ -1030,11 +1030,11 @@ else if (zoom > 1.0E-2)
// attenuation and light direction
// ambient + diffuse
float light = 0.09f; // Ambient
light += 0.80f * .6f * Math.max(Vector3f.dot(normal, lightDir1), 0.0);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir2), 0.0);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir3), 0.0);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir4), 0.0);
lightSpecular += Math.pow(Math.max(Vector3f.dot(normal, ray3f2), 0.0), 128f);
light += 0.80f * .6f * Math.max(Vector3f.dot(normal, lightDir1), 0f);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir2), 0f);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir3), 0f);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir4), 0f);
lightSpecular += (float) Math.pow(Math.max(Vector3f.dot(normal, ray3f2), 0.0), 128.0);
// compute final color
colourR = colourR + light;
colourG = colourG + light;
Expand All @@ -1048,7 +1048,7 @@ else if (zoom > 1.0E-2)
} else {
float lightSpecular = 0f;
Vector3f normal = new Vector3f(ze[9], ze[10], ze[11]);
lightSpecular += Math.pow(Math.max(Vector3f.dot(normal, ray3f2), 0.0), 128f);
lightSpecular += (float) Math.pow(Math.max(Vector3f.dot(normal, ray3f2), 0.0), 128.0);
point[0] = (rT + lightSpecular) * colourA + point[0] * oneMinusAlpha;
point[1] = (gT + lightSpecular) * colourA + point[1] * oneMinusAlpha;
point[2] = (bT + lightSpecular) * colourA + point[2] * oneMinusAlpha;
Expand All @@ -1072,11 +1072,11 @@ else if (zoom > 1.0E-2)
// attenuation and light direction
// ambient + diffuse
light = 0.09f; // Ambient
light += 0.80f * .6f * Math.max(Vector3f.dot(normal, lightDir1), 0.0);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir2), 0.0);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir3), 0.0);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir4), 0.0);
lightSpecular += Math.pow(Math.max(Vector3f.dot(normal, ray3f2), 0.0), 128f);
light += 0.80f * .6f * Math.max(Vector3f.dot(normal, lightDir1), 0f);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir2), 0f);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir3), 0f);
light += 0.25f * .6f * Math.max(Vector3f.dot(normal, lightDir4), 0f);
lightSpecular += (float) Math.pow(Math.max(Vector3f.dot(normal, ray3f2), 0.0), 128.0);
}
switch (ct.type()) {
case PEARL:
Expand Down

0 comments on commit 71e30c2

Please sign in to comment.