geWorld

Types:

geWorld;

The geWorld object contains information about the "World" including the "unchanging" world geometry and the lists of entities and actors in the world.


GE_Collision;

This structure is used to return information about detected collisions from collision detections calls.
typedef struct{
    geWorld_Model *Model;       // Pointer to what model was hit (if any)
    geMesh *Mesh;               // Pointer to what mesh was hit (if any)
    geActor *Actor;             // Pointer to what actor was hit (if any)
    geVec3d Impact;             // Impact Point
    float Ratio;                // Percent from 0 to 1.0, how far along the line for the impact point
    GE_Plane Plane;             // Impact Plane
} GE_Collision;


GE_CollisionCB;

This is a function type used to allow the user to accept or decline a collision that has been detected.  One (but not both) of Model or Actor will be non-NULL.  *Context can be used to maintain state information between calls to your GE_CollisionCB function.  Basically if you will except the collision with the specified model or actor, then return GE_TRUE, if you don't want the collision to succeed, return GE_FALSE.

typedef geBoolean GE_CollisionCB(geWorld_Model *Model, geActor *Actor, void *Context);
 

GE_Contents;
This structure is used to return information from about the contained contents found in a call to geWorld_GetContents.

typedef struct{
    geMesh *Mesh;
    geWorld_Model *Model;
    geActor *Actor;
    int32 Contents;
} GE_Contents;


Constants:

Actor Flags

These are used for the Flags argument of the geWorld_AddActor call and may be combined.
#define GE_ACTOR_RENDER_NORMAL    // Render in normal views
#define GE_ACTOR_RENDER_MIRRORS   // Render in mirror views
#define GE_ACTOR_RENDER_ALWAYS    // Render always, skipping all visibility tests
#define GE_ACTOR_COLLIDE          // Collide when calling geWorld_Collision


GE_COLLIDE_

These constants are used to specify the types of geWorld objects to test against for collisions.
#define GE_COLLIDE_MESHES (1<<0)
#define GE_COLLIDE_MODELS (1<<1)
#define GE_COLLIDE_ACTORS (1<<2)
#define GE_COLLIDE_NO_SUB_MODELS (1<<3)

#define GE_COLLIDE_ALL (GE_COLLIDE_MESHES | GE_COLLIDE_MODELS | GE_COLLIDE_ACTORS)


GE_CONTENTS_

These constants are used to partition geWorld contents into specific types.  This is used for geWorld_Collision calls to specify the geWorld contents to test against, for example.  They can be combined.

#define GE_CONTENTS_SOLID (1<<0)          // Solid (Visible)
#define GE_CONTENTS_WINDOW (1<<1)         // Window (Visible)
#define GE_CONTENTS_EMPTY (1<<2)          // Empty but Visible (water, lava, etc...)

#define GE_CONTENTS_TRANSLUCENT (1<<3)    // Vis will see through it
#define GE_CONTENTS_WAVY (1<<4)           // Wavy (Visible)
#define GE_CONTENTS_DETAIL (1<<5)         // Won't be included in vis oclusion

#define GE_CONTENTS_CLIP (1<<6)           // Structural but not visible
#define GE_CONTENTS_HINT (1<<7)           // Primary splitter (Non-Visible)
#define GE_CONTENTS_AREA (1<<8)           // Area seperator leaf (Non-Visible)

#define GE_CONTENTS_FLOCKING (1<<9)
#define GE_CONTENTS_SHEET (1<<10)
#define GE_CONTENTS_AIR (1<<11)           // No brush lives in this leaf
#define GE_RESERVED4 (1<<12)
#define GE_RESERVED5 (1<<13)
#define GE_RESERVED6 (1<<14)
#define GE_RESERVED7(1<<15)

// 16-31 reserved for user contents
#define GE_CONTENTS_USER1 (1<<16)
#define GE_CONTENTS_USER2 (1<<17)
#define GE_CONTENTS_USER3 (1<<18)
#define GE_CONTENTS_USER4 (1<<19)
#define GE_CONTENTS_USER5 (1<<20)
#define GE_CONTENTS_USER6 (1<<21)
#define GE_CONTENTS_USER7 (1<<22)
#define GE_CONTENTS_USER8 (1<<23)
#define GE_CONTENTS_USER9 (1<<24)
#define GE_CONTENTS_USER10 (1<<25)
#define GE_CONTENTS_USER11 (1<<26)
#define GE_CONTENTS_USER12 (1<<27)
#define GE_CONTENTS_USER13 (1<<28)
#define GE_CONTENTS_USER14 (1<<29)
#define GE_CONTENTS_USER15 (1<<30)
#define GE_CONTENTS_USER16 (1<<31)

// These contents are all solid types
#define GE_CONTENTS_SOLID_CLIP (GE_CONTENTS_SOLID | GE_CONTENTS_WINDOW | GE_CONTENTS_CLIP)
#define GE_CONTENTS_CANNOT_OCCUPY GE_CONTENTS_SOLID_CLIP

// These contents are all visible types
#define GE_VISIBLE_CONTENTS (GE_CONTENTS_SOLID | GE_CONTENTS_EMPTY | GE_CONTENTS_WINDOW | GE_CONTENTS_WAVY)


gePoly_Type;

typedef enum{
    GE_TEXTURED_POLY,  // The Polygon is textured, Bitmap must be a valid geBitmap.
    GE_GOURAUD_POLY,   // The Polygon is Gouraud shaded, Bitmap must be NULL.
    GE_TEXTURED_POINT  // This renders a 3d sprite.  The vertices list must contain only one vertex which specifies the center of the rendered sprite.  Bitmap must be a valid geBitmap object. The bitmap is always rendered perpendicular to the camera and the dimensions of it are specified by the Scale argument.
} gePoly_Type;
Rendering Flags
#define GE_RENDER_DO_NOT_OCCLUDE_OTHERS    // Poly will not occlude others
#define GE_RENDER_DO_NOT_OCCLUDE_SELF      // Renders under any condition.  Useful for halos, etc...
#define GE_RENDER_BACKFACED                // Poly should be backfaced from the Camera's Pov
#define GE_RENDER_DEPTH_SORT_BF            // Sorts relative to camera position, from back to front
#define GE_RENDER_CLAMP_UV                 // Clamp UV's in both directions

These flags can be combined.

Functions:

GENESISAPI geBoolean geWorld_AddActor(geWorld *World, geActor *Actor, uint32 Flags, uint32 UserFlags);

This function adds geActor Actor to geWorld World setting the Actor Flags to Flags and the user-definable flags to UserFlags.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_AddBitmap(geWorld *World, geBitmap *Bitmap);

This function adds geBitmap Bitmap to geWorld World making it available for use.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geFog *geWorld_AddFog(geWorld *World);

This function adds a new geFog object to the geWorld World and returns it.

Returns: the geFog object.


GENESISAPI geLight *geWorld_AddLight(geWorld *World);

This function adds a new geLight object to the geWorld World and returns it.

Returns: the geLight object.


GENESISAPI gePoly *geWorld_AddPoly(geWorld *World, GE_LVertex *Verts, int32 NumVerts, geBitmap *Bitmap, gePoly_Type Type, uint32 RenderFlags, float Scale);

This function adds a polygon to geWorld World.  *Verts should be a pointer to a list of NumVerts vertices.  Bitmap specifies the geBitmap for the new polygon, Type specifies the gePoly_Type, RenderFlags specifies the Rendering Flags, and Scale is used to scale the geBitmap if Type is set to GE_TEXTURED_POINT.

Returns: the newly created gePoly object.


GENESISAPI gePoly *geWorld_AddPolyOnce(geWorld *World, GE_LVertex *Verts, int32 NumVerts, geBitmap *Bitmap, gePoly_Type Type, uint32 RenderFlags, float Scale);

This function adds a polygon for the next rendered frame ONLY.  See details of geWorld_AddPoly for arguments.

Returns: the newly created gePoly object.


GENESISAPI geBoolean geWorld_BitmapIsVisible(geWorld *World, const geBitmap *Bitmap);

This function tests whether the geBitmap Bitmap was rendered in geWorld World during the last frame.

Returns: the result.


GENESISAPI geBoolean geWorld_Collision(geWorld *World, const geVec3d *Mins, const geVec3d *Maxs, const geVec3d *Front, const geVec3d *Back, uint32 Contents, uint32 CollideFlags, uint32 UserFlags, GE_CollisionCB *CollisionCB, void *Context, GE_Collision *Col);

This function tests for bounding box and linear collisions with the world geometry.  World is the geWorld object representing the world geometry to be tested against.  Contents specifies the types of surfaces in the world to test against, use the GE_CONTENTS_ flags constants to specify.  CollideFlags specifies the types of objects (actors, etc.) to test against, it should be specified using the GE_COLLIDE_ constants.  UserFlags specifies the mask to be tested against for the user-definable flags as set in geWorld_AddActor. *CollisionCB can be set to a callback function of type GE_CollisionCB that will be called for each model or actor in geWorld World for which a collision is detected.  If you want to accept the collision, then your callback function should return GE_TRUE otherwise return GE_FALSE.  Context can be used to pass data to your callback function.  If you want to test a collision with an axial-aligned bounding box, pass the minimum and maximum corners in with Mins and Maxs and set Front and Back to NULL.  If you want to test the collision with a line pass the starting and ending points in Front and Back and set Mins and Maxs to NULL.  If a collision occurs, information about the collision is returned in GE_Collision Col.

Returns: GE_TRUE on collision, GE_FALSE otherwise.

Notes:
    from GENESIS.H: NOTE - Mins/Maxs CAN be NULL.  If you are just testing a point, then use NULL (it's faster!!!).


GENESISAPI geWorld *geWorld_Create(geVFile *File);

This function creates a new geWorld object from the information stored in File which should be a BSP file like that generated by the Genesis Editor.

Returns: the newly created geWorld object.


GENESISAPI void geWorld_Free(geWorld *World);

This function decreases the reference count for geWorld World by one.  If World's reference count goes to zero then all of its resources are freed.

Returns: nothing.


GENESISAPI geBitmap *geWorld_GetBitmapByName(geWorld *World, const char *BitmapName);

This function returns a pointer to the geBitmap with named BitmapName in geWorld World.

Returns: the geBitmap or NULL if there is no geBitmap with the specified name.


GENESISAPI geBoolean geWorld_GetContents(geWorld *World, const geVec3d *Pos, const geVec3d *Mins, const geVec3d *Maxs, uint32 Flags, uint32 UserFlags, GE_CollisionCB *CollisionCB, void *Context, GE_Contents *Contents);

This function returns information about a point or volume of the geWorld World.  If you want to check for what is found at a point, then pass the point as Pos and set Mins and Maxs to NULL.  If you want to check for what is contained within an-axial aligned bounding box, pass the minimums and maximums of the box in Mins and Maxs respectively and set Pos to NULL.  Flags specifies what type of world objects you want to know about, use the GE_COLLIDE_ constants to specify this.  UserFlags specifies the mask to be tested against for the user-definable flags as set in geWorld_AddActor.  *CollisionCB can be set to a callback function of type GE_CollisionCB that will be called for each model or actor in geWorld World which is detected.  If you want to accept the detection, then your callback function should return GE_TRUE otherwise return GE_FALSE.  Context can be used to pass data to your callback function.  If something is detected then GE_Contents Contents contains information about what was found.

Returns: GE_TRUE if anything was found, GE_FALSE otherwise.


GENESISAPI geEntity_EntitySet *geWorld_GetEntitySet(geWorld *World, const char *ClassName);

This function returns the geEntity_EntitySet named ClassName from geWorld World.

Returns: the specified geEntity_EntitySet.


GENESISAPI geBoolean geWorld_GetLeaf(const geWorld *World, const geVec3d *Pos, int32 *Leaf);

This function returns the main world leaf from the BSP tree in geWorld World at point Pos if there is one in Leaf.

Returns: GE_TRUE if a leaf is found, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_GetModelRotationalCenter(const geWorld *World, const geWorld_Model *Model, geVec3d *Center);

This function returns the rotational center of geWorld_Model Model of geWorld World in Center.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_GetModelXForm(const geWorld *World, const geWorld_Model *Model, geXForm3d *XForm);

This function returns the current transform of geWorld_Model Model of geWorld World in XForm.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geWorld_Model *geWorld_GetNextModel(geWorld *World, geWorld_Model *Start);

This function iterates through the list of geWorld_Models in geWorld World.  If Start is NULL, then the first geWorld_Model is returned, otherwise Start should be one of the geWorld_Models of World in which case the next geWorld_Model of World will be returned.

Returns: the geWorld_Model.


GENESISAPI geBoolean geWorld_HasBitmap(const geWorld *World, const geBitmap *Bitmap);

This function tests whether Bitmap has been added to geWorld World.

Returns: GE_TRUE if World


GENESISAPI geBoolean GENESISCC geWorld_IsActorPotentiallyVisible(const geWorld *World, const geActor *Actor, const geCamera *Camera);

This function does simple testing to see if geActor Actor of geWorld World is visible to geCamera Camera.  If there is no renderhintbox set for Actor this function does no testing and returns GE_TRUE.  Only the center point of the renderhintbox is tested.  Mirrors are NOT accounted for.   Note that this function refers to the next frame, not the last rendered frame.  I believe this function does account for geWorld geometry and is not simply a test against the geCamera frustrum.  Please correct me if this is wrong.

Returns: GE_TRUE if Actor is visible or if there is no renderhintbox defined, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_LeafMightSeeLeaf(const geWorld *World, int32 Leaf1, int32 Leaf2, uint32 VisFlags);

This function checks whether Leaf1 can "see" Leaf2 in geWorld World.  VisFlags is not currently used.  I translate this to mean that there exists a line that intersects the front (visible) side of Leaf1 and Leaf2 without intersecting any other world geometry in between.  This test uses vis data and does not account for actors or models. If vis data has not been calculated this function always returns GE_TRUE.  I'm assuming here that "leaf"s are one-sided objects.

Returns: GE_TRUE if Leaf1 can see Leaf2, GE_FALSE otherwise.

Notes:
    from GENESIS.H: Checks to see if Leaf1 can see Leaf2. Currently VisFlags is not used yet.  It could be used for checking against areas, etc... Eventually you could also pass in a VisObject, that is manipulated with a camera...


GENESISAPI geBoolean geWorld_MightSeeLeaf(const geWorld *World, int32 Leaf);

This function checks to see if Leaf of geWorld World might possibly render during the next frame.  I notice this doesn't refer to a geCamera.  Wouldn't that have an effect?

Returns:  GE_TRUE if Leaf is visible, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_ModelCollision(geWorld *World, geWorld_Model *Model, const geXForm3d *DXForm, GE_Collision *Collision);

This function checks to see if geWorld_Model Model of geWorld World would collide with the something in World if transform DXForm were applied to Model.  The results of a collision, if any, are returned in Collision.

Returns: GE_TRUE if a collision occurs, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_ModelGetBBox(const geWorld *World, const geWorld_Model *Model, geVec3d *Mins, geVec3d *Maxs);

This function returns the axial-aligned bounding box of geWorld_Model Model of geWorld World in Mins and Maxs.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI uint32 geWorld_ModelGetFlags(geWorld_Model *Model);

This function returns the flags set for geWorld_Model Model.  I believe these are user-definable flags, maybe something from the editor?

Returns: the flags.


GENESISAPI geMotion *geWorld_ModelGetMotion(geWorld_Model *Model);

This function returns the geMotion set for geWorld_Model Model.  How is this motion set?  Where did it come from?

Returns: the geMotion object.


GENESISAPI void *geWorld_ModelGetUserData(const geWorld_Model *Model);

This function returns a pointer to user defined data that has been assigned to geWorld_Model Model.

Returns: the pointer.


GENESISAPI void geWorld_ModelSetFlags(geWorld_Model *Model, uint32 ModelFlags);

This function sets the flags for geWorld_Model Model to ModelFlags.  I assume that this is user-defined.

Returns: nothing.


GENESISAPI void geWorld_ModelSetUserData(geWorld_Model *Model, void *UserData);

This function assigns a pointer for user-definable data for geWorld_Model model to UserData.

Returns: nothing.


GENESISAPI geBoolean  geWorld_OpenModel(geWorld *World, geWorld_Model *Model, geBoolean Open);

This function is used to disable or enable the vis blocking capabilites of geWorld_Model Model of geWorld World.  If Open is GE_TRUE then Model is capable of blocking visibility, if GE_FALSE then it doesn't.  Basically this is used for doors.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_RemoveActor(geWorld *World, geActor *Actor);

This function removes geActor Actor from geWorld World.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_RemoveBitmap(geWorld *World, geBitmap *Bitmap);

This function removes geBitmap Bitmap from geWorld World.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_RemoveFog(geWorld *World, geFog *Fog);

This function removes geFog Fog from geWorld World.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI void geWorld_RemoveLight(geWorld *World, geLight *Light);

This function removes geLight Light from geWorld World.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI void geWorld_RemovePoly(geWorld *World, gePoly *Poly);

This function removes gePoly Poly from geWorld World.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_SetActorFlags(geWorld *World, geActor *Actor, uint32 Flags);

This function sets the Actor Flags for geActor Actor of geWorld World to Flags.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_SetLightAttributes(geWorld *World, geLight *Light, const  geVec3d *Pos, const  GE_RGBA *RGBA, float Radius, geBoolean CastShadow);

This function sets the attributes of geLight Light of geWorld World including it position (Pos), color (RGBA), effect radius (Radius), and whether it casts shadows (CastShadow).  I've got to assume that changing this during runtime would only affect runtime lit objects like geActors.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_SetLTypeTable(geWorld *World, int32 LType, const char *Table);

This creates "light type" numberd LType in geWorld World that is defined by the string Table.  Table should be a '\0' terminated string of lowercase letters.  Basically 'a' sets a light to "off", 'z' sets it to "full on", and all the letters in between are variations in between.  When you create a static light in the editor, you can specify the "light type" number that matches the LType you define with this API call.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean  geWorld_SetModelXForm(geWorld *World, geWorld_Model *Model, const geXForm3d *XForm);

This function transforms geWorld_Model Model of geWorld World by the transform XForm.

Returns: GE_TRUE on success, GE_FALSE otherwise.


GENESISAPI geBoolean geWorld_TestModelMove(geWorld *World, geWorld_Model *Model, const geXForm3d *DXForm, const geVec3d *Mins, const geVec3d *Maxs, const geVec3d *In, geVec3d *Out);

This function returns the result axial-aligned bounding box (Mins, Maxs) and In and Out vectors for geWorld_Model Model of geWorld World if transform DXForm were applied to Model.  It does not however actually transform the model.  This is basically used to check for possible collisions, etc.

Returns: GE_TRUE on success, GE_FALSE otherwise.