Effect of Light over a Trimesh

Hi!



What I have is a Box (Class Box) on the right and 2 surfaces of Trimesh on the left (see pictures).



What I'm trying to do is to create a Box (of Trimesh) with the same aspects (including Light and color effect) of a Box from the class Box…



In the picture you can see the difference between both. The 2 surfaces Trimesh has no effect related to color and light on the surfaces.



The code that I use to create a surface Trismesh is:


           TriMesh m=new TriMesh("My Mesh");

           Vector3f[] vertexes={
               new Vector3f(0,0,0),
               new Vector3f(10,0,0),
               new Vector3f(0,10,0),
               new Vector3f(10,10,0)
           };

           Vector3f[] normals={
               new Vector3f(0,0,1),
               new Vector3f(0,0,1),
               new Vector3f(0,0,1),
               new Vector3f(0,0,1)
           };

           ColorRGBA[] colors={
               new ColorRGBA(1,0,0,1),
               new ColorRGBA(1,0,0,1),
               new ColorRGBA(0,1,0,1),
               new ColorRGBA(0,1,0,1)
           };

           Vector2f[] texCoords={
               new Vector2f(0,0),
               new Vector2f(1,0),
               new Vector2f(0,1),
               new Vector2f(1,1),
               new Vector2f(1,0),
               new Vector2f(0,1)
           };

           int[] indexes={
               0,2,1,1,2,3
           };

           m.reconstruct(BufferUtils.createFloatBuffer(vertexes), BufferUtils.createFloatBuffer(normals),
                   BufferUtils.createFloatBuffer(colors), TexCoords.makeNew(texCoords), BufferUtils.createIntBuffer(indexes));
          
           m.setModelBound(new BoundingBox());
           m.updateModelBound();

           node.attachChild(m);




Thanks in advance!

The solution is to set (calculate) for every face of the Trimesh the Normal coordinates…