Hey,
I am curious how to make compiled dynamic objects with custom vertex controller. I haven't found any example on forum or wiki about it, but documentation says that compile(true) method must be used to be able to modify vertexes and touch() method needs to be called everytime when they are changed.
I have created object in following way:
public Ray()
{
super(4);
for (int i = 0; i < VERTEXES.length; ++i)
vertexes[i] = new SimpleVector(VERTEXES[i]);
addTriangle(VERTEXES[HF1], 1, 1, VERTEXES[HT1], 1, 0, VERTEXES[HT2], 0, 0);
addTriangle(VERTEXES[HT2], 0, 0, VERTEXES[HF2], 0, 1, VERTEXES[HF1], 1, 1);
addTriangle(VERTEXES[VF1], 1, 1, VERTEXES[VT1], 1, 0, VERTEXES[VT2], 0, 0);
addTriangle(VERTEXES[VT2], 0, 0, VERTEXES[VF2], 0, 1, VERTEXES[VF1], 1, 1);
setCulling(Object3D.CULLING_DISABLED);
setLighting(Object3D.LIGHTING_NO_LIGHTS);
setTransparency(0);
build();
getMesh().setVertexController(new RayVertexController(),
IVertexController.PRESERVE_SOURCE_MESH);
compile(true);
}
and run periodically following method to change its shape:
public void initialize(SimpleVector from, SimpleVector to, double scale, Color color,
int transparencyMode)
{
setVertexes(from, to, (float) scale);
setAdditionalColor(color);
setTransparencyMode(transparencyMode);
getMesh().applyVertexController();
touch();
setCenter(SimpleVector.ORIGIN);
setOrigin(SimpleVector.ORIGIN);
getRotationMatrix().setIdentity();
setRotationPivot(SimpleVector.ORIGIN);
}
Unfortunatelly I do not see any change on screen, ie. object is always displayed at it initial place (ie. first position that was set).
Is there anything more that needs to be set?
Thanks,
Wojtek