/*
|
* To change this template, choose Tools | Templates
|
* and open the template in the editor.
|
*/
|
|
/**
|
*
|
* @author nbriere
|
*/
|
public class BillboardNode extends Composite implements java.io.Serializable
|
{
|
static final long serialVersionUID = 0;
|
|
BillboardNode()
|
{
|
super("Billboard");
|
|
toParent = LA.newMatrix();
|
fromParent = LA.newMatrix();
|
}
|
|
cVector pos = new cVector();
|
|
void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
|
{
|
cVector eye = display.EyeCamera().location;
|
|
GlobalTransformInv();
|
|
pos.x = parent.globalTransform[3][0];
|
pos.y = parent.globalTransform[3][1];
|
pos.z = parent.globalTransform[3][2];
|
|
pos.x -= eye.x;
|
pos.y -= eye.y;
|
pos.z -= eye.z;
|
|
double angle = Math.atan2(pos.x, pos.z);
|
|
LA.matIdentity(toParent);
|
LA.matIdentity(fromParent);
|
LA.matYRotate(toParent, angle);
|
LA.matYRotate(fromParent, -angle);
|
|
super.draw(display, root, selected, blocked);
|
}
|
|
Object3D deepCopy()
|
{
|
Composite comp = new BillboardNode();
|
deepCopySelf(comp);
|
return comp;
|
}
|
}
|