|
|
@ -80,9 +80,6 @@ public class BillboardControl extends AbstractControl { |
|
|
|
AxialZ; |
|
|
|
AxialZ; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BillboardControl() { |
|
|
|
public BillboardControl() { |
|
|
|
super(); |
|
|
|
super(); |
|
|
|
orient = new Matrix3f(); |
|
|
|
orient = new Matrix3f(); |
|
|
@ -108,6 +105,18 @@ public class BillboardControl extends AbstractControl { |
|
|
|
rotateBillboard(cam); |
|
|
|
rotateBillboard(cam); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void fixRefreshFlags(){ |
|
|
|
|
|
|
|
// force transforms to update below this node
|
|
|
|
|
|
|
|
spatial.updateGeometricState(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// force world bound to update
|
|
|
|
|
|
|
|
Spatial rootNode = spatial; |
|
|
|
|
|
|
|
while (rootNode.getParent() != null){ |
|
|
|
|
|
|
|
rootNode = rootNode.getParent(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
rootNode.getWorldBound(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* rotate the billboard based on the type set |
|
|
|
* rotate the billboard based on the type set |
|
|
|
* |
|
|
|
* |
|
|
@ -168,7 +177,7 @@ public class BillboardControl extends AbstractControl { |
|
|
|
// The billboard must be oriented to face the camera before it is
|
|
|
|
// The billboard must be oriented to face the camera before it is
|
|
|
|
// transformed into the world.
|
|
|
|
// transformed into the world.
|
|
|
|
spatial.setLocalRotation(orient); |
|
|
|
spatial.setLocalRotation(orient); |
|
|
|
spatial.updateGeometricState(); |
|
|
|
fixRefreshFlags(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -188,10 +197,10 @@ public class BillboardControl extends AbstractControl { |
|
|
|
Quaternion rot=new Quaternion().fromRotationMatrix(orient); |
|
|
|
Quaternion rot=new Quaternion().fromRotationMatrix(orient); |
|
|
|
if ( parent != null ) { |
|
|
|
if ( parent != null ) { |
|
|
|
rot = parent.getWorldRotation().inverse().multLocal(rot); |
|
|
|
rot = parent.getWorldRotation().inverse().multLocal(rot); |
|
|
|
rot.normalize(); |
|
|
|
rot.normalizeLocal(); |
|
|
|
} |
|
|
|
} |
|
|
|
spatial.setLocalRotation(rot); |
|
|
|
spatial.setLocalRotation(rot); |
|
|
|
spatial.updateGeometricState(); |
|
|
|
fixRefreshFlags(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -256,7 +265,7 @@ public class BillboardControl extends AbstractControl { |
|
|
|
// The billboard must be oriented to face the camera before it is
|
|
|
|
// The billboard must be oriented to face the camera before it is
|
|
|
|
// transformed into the world.
|
|
|
|
// transformed into the world.
|
|
|
|
spatial.setLocalRotation(orient); |
|
|
|
spatial.setLocalRotation(orient); |
|
|
|
spatial.updateGeometricState(); |
|
|
|
fixRefreshFlags(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|