The feature I am adding now is serialization on all element of the engine.
I just completed teh serialization of collision (pending scene, and softbody collision with are incomplete still)
I am adding world serialization, Bopdy seralization and Joint serilazation.
wit thsi options, teh cline application can for get stuff straing form teh SDK demo and pate into they code.
say for example I complete the car, the I call
NewtonSerializeBody (...)
NewtonSerializeJoint (...)
and this will save the dat to a pice of memory, or a file all determened by the end client.
then in theo applicationb the application can call the derialization founstion for that feature, and
badabin badabum, the feature will be imported into the game. all teh application have to do is set up a cople of pointer for teh use data, and the callbacks.
this is sthe glue code for serialization of an entire world
- Code: Select all
//static char* MAGIC_NUMBER = "serialize data";
static void SerializeFile (void* const serializeHandle, const void* const buffer, int size)
{
// check that each chunk is a multiple of 4 bytes, this is useful for easy little to big Indian conversion
_ASSERTE ((size & 0x03) == 0);
fwrite (buffer, size, 1, (FILE*) serializeHandle);
}
static void DeSerializeFile (void* const serializeHandle, void* const buffer, int size)
{
// check that each chunk is a multiple of 4 bytes, this is useful for easy little to big Indian conversion
_ASSERTE ((size & 0x03) == 0);
fread (buffer, size, 1, (FILE*) serializeHandle);
}
static void BodySerialization (NewtonBody* const body, void* const serializeHandle, NewtonSerializeCallback serializecallback)
{
// here the use can save information of this body, ex:
// a string naming the body,
// serialize the visual mesh, or save a link to the visual mesh
// save labels for looking up the body call backs
}
void SerializationWorld (const char* const name, NewtonWorld* const world)
{
char fullPathName[2048];
GetWorkingFileName (name, fullPathName);
FILE* file = fopen (fullPathName, "wb");
NewtonSerialize (world, BodySerialization, SerializeFile, file);
fclose (file);
}