More XML attributes (patch), and wire frame state problem

Hi,



Patch for more missing attributes (thanks cep2 for adding in the other missing attributes) in XMLtoBinary, ‘index’ attribute “trap” added, and a wire state bug in jmeBinaryWriter found, patch follows patch change summary :



(Applies to CVS 19-2-2005 18:00 GMT, patch tested with NetBeans 4.0 and Larry Wall’s UNIX patch (patch -p1 < XMLtoBinaryPatch19-2-2005) ).



Missing attributes :



For <wirestate>

Added in ‘width’ and ‘facetype’



For <stobj>

Added in ‘parnum’ and ‘obnum’



For <spatialtransformer>

Added in ‘numobjects’



For <sptrot>

Added in ‘rotvalues’



‘index’ attribute :



For <sptscale>,<sptrot>,<spttrans> (part of <spatialtransformer>).

Trapped ‘index’ attribute (same idea as for ‘data’ attribute), wrote out as DATA_INTARRAY.



Tidy up :



Grouped together ‘texnum’ and ‘wrap’, together with ‘parnum’, ‘obnum’, ‘facetype’ and ‘numobjects’.



Patch :



XMLtoBinaryPatch19-2-2005



Onto the wireframe state problem :



Objects are being rendered in wireframe, when loaded in from previous binary to XML exports, which contained the <wireframe> tag. This has led me to jmeBinaryWriter where I have discovered a flaw :



When writing out a simple scene to binary and loading it back in, without any conversion, all mesh objects are rendered in wireframe and SimpleGame’s wireframe user state switch ( T key), is disabled.



I tracked the problem down to jmeBinaryWriter.writeWireframeState() :



Basically writeWireframeState() does not write out the enabled/disabled state of the wireframe state object. So there is no way of knowing the enable/disable state of the object, Therefore jmeBinaryReader simply reads in the object, and assumes it is enabled.



Hope I’ve been of help, unfortunately I cannot help any further with this problem, since it would mean altering the design to both jmeBinaryReader and jmeBinaryWriter (adding in a new attribute or removing the exporting of this state, all together).



Cheers.

(!) Don’t apply the patch just yet (!)



I have found something more drastically wrong with spatial transformer and XMLtoBinary, I need to check my patch is correct (the problem does not exist in the binary file, therefor there is something wrong in XMLtoBinary) and hasn’t broken anything.



I will be back in contact !

Found it !!



There is a mistake in writeQuatArray(), the information index multiplier is wrong :



myOut.writeFloat(Float.parseFloat(information[i*3+0]));
myOut.writeFloat(Float.parseFloat(information[i*3+1]));
myOut.writeFloat(Float.parseFloat(information[i*3+2]));
myOut.writeFloat(Float.parseFloat(information[i*3+3]));



Should be :


myOut.writeFloat(Float.parseFloat(information[i*4+0]));
myOut.writeFloat(Float.parseFloat(information[i*4+1]));
myOut.writeFloat(Float.parseFloat(information[i*4+2]));
myOut.writeFloat(Float.parseFloat(information[i*4+3]));



I have tested this modification, it produces the correct results, I will post an amended patch shortly.

Patch (contains previous changes + modified writeQuatArray() ) :



XMLtoBinaryPatch14-2-2005

I’ve hand applied the patch (wasn’t working in eclipse for some reason) and checked it in. Please verify. Thanks for your fixes. Maybe cep can address the enabled/disabled states issue.



Regards.

Hi,

Sorry for not getting back sooner, I attempted to upgrade GTK on my system and annihilated it !! :frowning:



I’ve checked out the latest CVS, and tested out the changes, they are working fine, thank you for incorporating them.



Thanks.

good to hear all is well now. Thanks again!