zterrain/ZSystem.cpp
C++ source for ZSystem, 166 lines. Raw file
//---- IDEAS -----------------------------------------------------------------//
//---- ZSYSTEM TYPES ---------------------------------------------------------//
typedef struct _ZSYSTEM_ADDRESS {
DWORD length;
DWORD index[1];
} ZSYSTEM_ADDRESS;
typedef struct _ZSYSTEM_PARAM {
} ZSYSTEM_PARAM;
typdef struct _ZSYSTEM_PARAMLIST {
} ZSYSTEM_PARAMLIST;
typedef struct _ZSYSTEM_CACHE {
} ZSYSTEM_CACHE;
typedef struct _ZSYSTEM {
ZSYSTEM_CACHE *cache; // The cache for this ZSYSTEM
ZSYSTEM_PARAMLIST *paramlist; // The paramlist for the current object
ZSYSTEM_ADDRESS *address; // The address of the current object
} ZSYSTEM;
typedef void (*ZSYSTEM_OBJECT)(ZSYSTEM *zs);
//---- ZSYSTEM MAIN CODE -----------------------------------------------------//
//---- ZSystem_Create --------------------------------------------------------//
ZSYSTEM *ZSystem_Create(ZSYSTEM_OBJECTPROC uniproc)
{
ZSYSTEM *zs = (ZSYSTEM *)calloc(1, sizeof(ZSYSTEM));
if(!zs) return NULL;
zs->uniproc = uniproc;
return zs;
}
//---- ZSystem_Delete --------------------------------------------------------//
void ZSystem_Delete(ZSYSTEM *zs)
{
if(!zs) return;
//- Free any caches
//- Free structure
free(zs);
}
//---- ZSystem_Render --------------------------------------------------------//
void ZSystem_Render(ZSYSTEM *zs)
{
//- Set up parameters
//- Render universal object
Render_Object_Recurse(zs, zs->uniproc);
}
//---- ZSystem_Param ---------------------------------------------------------//
void ZSystem_Param(char *name, DWORD value)
{
}
//---- ZSystem_Object --------------------------------------------------------//
// Creates a sub-object with the current parameters
void ZSystem_Object(ZSYSTEM_OBJECTPROC objproc)
{
}
//---- PRIVATE FUNCTIONS -----------------------------------------------------//
//---- ZSystem_Render_Recurse ------------------------------------------------//
void ZSystem_Render_Recurse(ZSYSTEM *zs, ZSYSTEM_OBJECTPROC objproc)
{
//- Check if this object is still cached
if(!cached) {
//- Set environment for rendering this object
//- Call object function
objproc(zs);
}
//- Render each subobject if it passes a cull test
ZSystem_Render_Recurse(...);
}
//---- ZSystem_Cache_Create --------------------------------------------------//
ZSYSTEM_CACHE *ZSystem_Cache_Create()
{
}
//---- ZSystem_Cache_Add -----------------------------------------------------//
void ZSystem_Cache_Add()
{
}
//---- END OF FILE -----------------------------------------------------------//