Problem with Normals!

Hi All,



I was working on some networking code for creating my own Metaverse  :stuck_out_tongue: and ran into a problem when receiving objects on the client side.



I get this error output:

[pre]TriMesh Received server sphere (com.jme.scene.shape.Sphere)

Exception in thread "Thread-3" java.lang.NullPointerException

at com.jme.util.geom.BufferUtils.getVector3Array(Unknown Source)

at com.jme.util.geom.GeometryCreator.<init>(Unknown Source)

at com.jme.util.geom.GeometryInfo.<init>(Unknown Source)

at JMESetup.run(JMESetup.java:55)

at java.lang.Thread.run(Thread.java:595)

[/pre]



from the following code:



[pre]if( s instanceof TriMesh ) {

MaterialState ms = display.getRenderer().createMaterialState();

ms.setAmbient( ColorRGBA.blue );

TriMesh tm = (TriMesh)s;

tm.setLocalTranslation( new Vector3f(0.0f,0.0f,0.0f) );

System.err.println("TriMesh Received " + tm );

GeometryInfo gi = new GeometryInfo™;

gi.recalculateSmoothGroupNormals();



tm.setRenderState( ms );

tm.updateGeometricState(0,true);

tm.updateRenderState();



rootNode.attachChild™;

}[/pre]



Any help would be appreciated!



Thanks in advance!

Sorry for posting again so soon but I just tried something different using the GeomtryCreator



code:

[pre]

if( s instanceof TriMesh ) {

MaterialState ms = display.getRenderer().createMaterialState();

ms.setAmbient( ColorRGBA.blue );

TriMesh tm = (TriMesh)s;

tm.setLocalTranslation( new Vector3f(0.0f,0.0f,0.0f) );

System.err.println("TriMesh Received " + tm );

GeometryCreator gc = new GeometryCreator™;

GeometryInfo gi = new GeometryInfo();

gc.fillGeometryInfo(gi);

gi.recalculateSmoothGroupNormals();



tm.setRenderState( ms );

tm.updateGeometricState(0,true);

tm.updateRenderState();



rootNode.attachChild™;

}[/pre]



The error I got was this:



TriMesh Received server sphere (com.jme.scene.shape.Sphere)

Exception in thread "Thread-3" java.lang.IllegalArgumentException: Number of texture coordinates (2450) differs from number of textureSets defined(1)

at com.jme.util.geom.GeometryCreator.addTexCoords(Unknown Source)

at com.jme.util.geom.GeometryCreator.<init>(Unknown Source)

at JMESetup.run(JMESetup.java:56)

at java.lang.Thread.run(Thread.java:595)

I think these classes don't even exist anymore in the development version of jME…

Ok, I updated to using the Nightly Builds instead of what I was using which I think was a very old version.



Your right those classes I was trying to use no longer exist. Though I have no idea what the current equivalent would be or if there is one.



But I still have the same problem with the normals not transfering across a Serialized stream.







I’m wondering why this might be or how I can resolve this problem!

You can use the jME Savable framework (like BinaryImporter does, or maybe you can even use BinaryImporter itself, with some minor changes maybe) instead of serialization. It's faster too.



I think you'll have to find and fix serialization bugs yourself, since noone else uses it anymore.

Alright, Thanks for the help I'll try using the BinaryImporter.