Bug in BillboardNode

I was creating a BillboardNode without a name and kept running into a nullpointer error, turned out the default constructor didn't instantiate the node's fields. Kinda a simple oversight I guess.


Index: BillboardNode.java
===================================================================
--- BillboardNode.java   (revision 4561)
+++ BillboardNode.java   (working copy)
@@ -86,7 +86,12 @@
     public static final int AXIAL_Z = 3;
 
    
-    public BillboardNode() {}
+    public BillboardNode() {
+        orient = new Matrix3f();
+        look = new Vector3f();
+        left = new Vector3f();
+        alignment = SCREEN_ALIGNED;
+    }
     /**
      * Constructor instantiates a new <code>BillboardNode</code>. The name of
      * the node is supplied during construction.


For scene graph objects, you should always use the constructor that takes a name, the empty constructor is only for serialization purposes and is empty for all scene graph classes (not just BillboardNode).

Momoko_Fan said:

For scene graph objects, you should always use the constructor that takes a name, the empty constructor is only for serialization purposes and is empty for all scene graph classes (not just BillboardNode).


Ahh, well sometimes I've been naughty then, but only now has it caught up with me ;)