hi,
i am using lights in my "world"
but one of the objects i really dont want lighteffects in it…
i need his true color…
inside object:
{
MaterialState mat = Main.disp.getRenderer().createMaterialState();
mat.setDiffuse(ColorRGBA.blue);
mat.setSpecular(ColorRGBA.blue);
mat.setAmbient(ColorRGBA.blue);
setRenderState(mat);
}
tried without setAmbient… and with setLightCombineMode(LightState.OFF); but it becomes all black…
i just want a pure blue Sphere… in an ambient with lights…
thanks =]
If its a jme.shape.sphere, then you could just call
sphere.setDefaultColor( ColorRGBA.blue.clone() );
If its not, then you itterate through the node children and find the mesh and call the above method on it...
OR, you could set up a blue light ONLY for that object...
didnt work…
well that is my Sphere class now
public class Lago extends Sphere {
public Lago(int x, int z) {
super("Lago",5,10,20f,1f);
setLocalTranslation(x,0.5f,z);
setDefaultColor( ColorRGBA.blue.clone() );
}
}
to add there is a rootNode receiving…
node.attachChild(new Lago(x,z));
stills black =[
i think you also need to disable the lightState (or set a new, disabled lightstate) on the sphere or its node to see the vertex colors.
tried:
Node n = new Node();
n.attachChild(new Lago(x,z));
LightState lightState = Main.disp.getRenderer().createLightState();
lightState.setEnabled( true );
PointLight dl = new PointLight();
dl.setDiffuse(ColorRGBA.blue);
dl.setAmbient(ColorRGBA.blue);
//dl.setDirection(new Vector3f(0, -0.5f, -1));
dl.setEnabled(true);
lightState.attach(dl);
n.setRenderState( lightState );
attachChild(n);
doesnt work =[
with Point or Directional light…
damn =[
Actually setting a DefaultColor and lightCombineMode to off should be enough.
No need for a new Lightstate at all.
Node n1 = new Node();
Sphere s = new Sphere("c", 15, 15, 0.5f);
s.setModelBound(new BoundingBox());
s.setDefaultColor(ColorRGBA.yellow.clone());
s.updateModelBound();
n1.attachChild(s);
n1.setLightCombineMode(LightCombineMode.Off); // jme2
// n1.setLightCombineMode(LightState.OFF); jme1
rootNode.attachChild(n1);