Implorer / jmonkeyengine

Automatically exported from code.google.com/p/jmonkeyengine
0 stars 0 forks source link

sign error in com.jme3.scene.shape.Dome normals #615

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As discussed in the forum 
(http://hub.jmonkeyengine.org/forum/topic/pyramid-dome-gets-point-light-in-wrong
-sides/), the Dome class generates outward-facing normal vectors when 
insideView is true and inward-facing normal vectors when insideView is false.

Here is a two-line fix:
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -250,7 +250,7 @@
                 BufferUtils.populateFromBuffer(tempVa, vb, i);
                 kNormal = tempVa.subtractLocal(center);
                 kNormal.normalizeLocal();
-                if (insideView) {
+                if (!insideView) {
                     nb.put(kNormal.x).put(kNormal.y).put(kNormal.z);
                 } else {
                     nb.put(-kNormal.x).put(-kNormal.y).put(-kNormal.z);
@@ -267,7 +267,7 @@

         // pole
         vb.put(center.x).put(center.y + radius).put(center.z);
-        nb.put(0).put(insideView ? 1 : -1).put(0);
\ No newline at end of file
+        nb.put(0).put(insideView ? -1 : 1).put(0);
\ No newline at end of file
         tb.put(0.5f).put(1.0f);

         // allocate connectivity

Original issue reported on code.google.com by sg...@sonic.net on 19 Dec 2013 at 3:00

GoogleCodeExporter commented 9 years ago
Thanks stephen for fixing it
https://code.google.com/p/jmonkeyengine/source/detail?r=11076
and 11075

Original comment by remy.bou...@gmail.com on 12 Mar 2014 at 9:18