Hi.
I load .j3o scene, it have some objects with textures and I’m trying to make these objects transparent.
I have this code (found it at the forum):
public void updateMaterial(Spatial spatial)
{
try
{
if (spatial instanceof Node)
{
Node node = (Node) spatial;
for (int i = 0; i < node.getQuantity(); i++)
{
Spatial child = node.getChild(i);
System.out.println("Name (" + i + ") [" + node.getName() + "] : " + child.getName());//debug
updateMaterial(child);
}
} else if (spatial instanceof Geometry)
{
Geometry geo = (Geometry) spatial;
geo.getMaterial().setTransparent(true);
//geo.getMaterial().setColor("Color", new ColorRGBA(1, 0, 0, 0.4f));
geo.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
geo.setQueueBucket(Bucket.Transparent);
System.out.println(" GEO: " + geo.getName());//debug
}
} catch (Exception err)
{
System.out.println("Exception ExtNode::updateMaterial() err: " + err + " | " + err.getLocalizedMessage() + " | " + err.getMessage() + " | " + err.toString());
}
}
updateMaterial(rootNode);
But scene is still opaque.
And second question: How to change object’s color, line
geo.getMaterial().setColor(“Color”, new ColorRGBA(1, 0, 0, 1f)); // red
didnt change it.