com.threed.jpct
Class DeSerializer

java.lang.Object
  extended bycom.threed.jpct.DeSerializer

public class DeSerializer
extends java.lang.Object

A class that allows for serialization and deserialization of Object3Ds in a compacted format that loads very fast. The main purpose of this class is to create serialized objects that can be loaded by the Android version of jPCT, because using the normal loaders from Loader on an Android device can be very slow and consumes more memory, which is limited on such a device.


Constructor Summary
DeSerializer()
          Creates a new DeSerializer.
 
Method Summary
 Object3D deserialize(java.io.InputStream is)
          Deserializes an Object3D from an InputStream
 Object3D[] deserializeArray(java.io.InputStream is)
          Deserializes an Object3D-array from an InputStream
 void serialize(Object3D obj, java.io.OutputStream os, boolean reduced)
          Serialize an Object3D.
 void serializeArray(Object3D[] objs, java.io.OutputStream os, boolean reduced)
          Serialize an Object3D-array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeSerializer

public DeSerializer()
Creates a new DeSerializer.

Method Detail

serialize

public void serialize(Object3D obj,
                      java.io.OutputStream os,
                      boolean reduced)
Serialize an Object3D. If you are using this class to create resources for jPCT-AE (i.e. the Android version), make sure that textures have been assigned and build() has been called on that Object3D.
Only the object's geometry will be serialized. That includes vertices, polygons, texture informations, normals etc. It doesn't include other object properties like rotations, transformations and such.

Parameters:
obj - the Object3D
os - the output stream for write the serialized object into
reduced - should be true, if the content is used on Android only and false otherwise.

serializeArray

public void serializeArray(Object3D[] objs,
                           java.io.OutputStream os,
                           boolean reduced)
Serialize an Object3D-array. If you are using this class to create resources for jPCT-AE (i.e. the Android version), make sure that textures have been assigned and build() has been called on that Object3D.
Only the object's geometry will be serialized. That includes vertices, polygons, texture informations, normals etc. It doesn't include other object properties like rotations, transformations and such.

Parameters:
objs - the Object3D-array
os - the output stream for write the serialized objects into
reduced - should be true, if the content is used on Android only and false otherwise.

deserialize

public Object3D deserialize(java.io.InputStream is)
Deserializes an Object3D from an InputStream

Parameters:
is - the stream
Returns:
the Object3D or null in case of an error that isn't promoted by the Logger anyway.

deserializeArray

public Object3D[] deserializeArray(java.io.InputStream is)
Deserializes an Object3D-array from an InputStream

Parameters:
is - the stream
Returns:
the Object3D-arry or null in case of an error that isn't promoted by the Logger anyway.