geWorld

Description: Code to render the world, and distribute work to other modules

Source file: ...\genesis3d\OpenSource\Source\World\World.h, and also ..\genesis3d\OpenSource\Source\GENESIS.H.


Contents:

Functions: AddActor, AddBitmap, AddFog, AddLight, AddPoly, AddPolyOnce, BitmapIsVisible, Collision, Create, Free, GetBitmapByName, GetContents, GetEntitySet, GetLeaf, GetModelRotationalCenter, GetModelXForm, GetNextModel, HasBitmap, IsActorPotentiallyVisible, LeafMightSeeLeaf, MightSeeLeaf, ModelCollision, ModelGetBBox, ModelGetFlags, ModelGetMotion, ModelGetUserData, ModelSetFlags, ModelSetUserData, OpenModel, RemoveActor, RemoveBitmap, RemoveFog, RemoveLight, RemovePoly, SetActorFlags, SetLightAttributes, SetLTypeTable, SetModelXForm, TestModelMove

Constants: Actor Flags, GE_COLLIDE... Flags, GE_CONTENTS... Flags, gePoly_Type, Rendering Flags, Model flags, Sprite flags, Miscellaneous

Types: geWorld, geWorld_Model , geWorld_Leaf, geWorld_FogData, World_BSP, World_SkyBox, geWorld_SkyBoxTData, World_Actor, geWorld_EntClassSet, geWorld_DebugInfo, GE_Collision, GE_Contents, GE_CollisionCB, GE_PLANE

Changes in Genesis3D v1.6:  TYPES: World_Sprite. FUNCTIONS: ModelGetCenter, AddSprite, RemoveSprite, SetSpriteFlags, IsSpritePotentiallyVisible

 Types:

geWorld_Model

typedef struct geWorld_Model {
     char                   Name[64];                // Model's name
     int32                  GFXModelNum;      // Model number in disk tree structure
     geXForm3d       XForm;                    // Models transform (Object Space)
     geVec3d            Mins, Maxs;             // Model BBox (World Space)
     geVec3d            TMins, TMaxs;        // Translated Model BBox (World Space)
     geVec3d            Pivot;                       // Center of rotation (World Space)
     geVec3d            RealCenter;
     int32                  VisFrame;                // == World->CurFrame if visible
     void *                 UserData;                // Place for client to store data
     GFX_Model *   BSPModel;             // Oh, this is terrible.
     geBoolean          Open;                     // Model Open/Closed (Set by API, used for area vising)
     uint32                Flags;                      // GE_MODEL_RENDER_NORMAL, etc... (getypes.h)
     uint32                ChangedFlags;
} geWorld_Model;
Return to Contents
 

geWorld_Leaf

typedef struct geWorld_Leaf {
     int32                  VisFrame;
     int32                  Parent;                   // Parent nodes of all leafs
     gePoly*             PolyList;                 // List of poly fragments to render for this leaf (geWorld_AddPoly)
} geWorld_Leaf;
 Return to Contents
 

geWorld_FogData

typedef struct {
     int32                  Leaf;
     geVec3d            Mins;                    // - Radius
     geVec3d            Maxs;                   // + Radius
     int32                  VisFrame;             // == World->CurFrameDynamic when visible
     geWorld*          World;
} geWorld_FogData;

 Return to Contents

 

World_BSP

typedef struct World_BSP {
     char                        FileName[200];
     GBSP_BSPData    BSPData;        // Info in the BSP loaded directly off disk
  
     //           Extra info thats not in the disk bsp structure
     Surf_SurfInfo*        SurfInfo;         // Valid when GE_SetGBSPFile is called
     Surf_TexVert*        TexVerts;       //
     geWBitmap_Pool*  WBitmapPool;
     geWorld_Model      Models[MAX_MODELS];     // Extra info about models not in disk structure
     geWorld_Leaf*       LeafData;
     int32*                     ClusterVisFrame;
     int32*                     NodeVisFrame;
     int32*                     AreaVisFrame;
     uint8                       AreaConnections[256][256];
     int32*                     NodeParents;      // Parent nodes of all leafs
} World_BSP;

Return to Contents

 

World_SkyBox

typedef struct {
     //  Untransformed original data
     geVec3d             Verts[6][4];
     Surf_TexVert      TexVerts[6][4];  
     geVec3d             Axis;                 // Rotation axis
     float                    Dpm;                 // Degres per minute //Type is geFloat in Genesis3d v1.6
     float                    DrawScale;       // Texture drawscale //Type is geFloat in Genesis3d v1.6
     int32                   Textures[6];
     float                    Angle;                // Current rotation angle around roation axis //Type is geFloat in Genesis3d v1.6
} World_SkyBox;

Return to Contents

 

geWorld_SkyBoxTData

typedef struct {
     //  Transformed data
     uint32             SkyFlags;
     geVec3d         TransformedVecs[6][2];
     GFX_Plane     TransformedPlanes[6];
     int32                NumTransformed;                     // Num transformed and clipped
     geVec3d          TransformedVerts[6][10];         // Transformed verts
     Surf_TexVert   TransformedTexVerts[6][10];   // Transformed tex verts
     int32                NumTransformedVerts[6];        // Number of transformed verts/texverts
     int32                OriginalFaces[6];                      // Indexes to original bitmap
} geWorld_SkyBoxTData;

Return to Contents

 

World_Sprite

Note: This is available only in Genesis3D v1.6

     typedef struct World_Sprite {
          geSprite* Sprite;
          uint32 Flags; //Should be one of these flags.
          uint32 UserFlags;
          //int32 Leaf; // Current leaf the sprite is in (currently used for PVS occlusion)
} World_Sprite;

Return to Contents

 

World_Actor

typedef struct World_Actor {
     geActor*        Actor;
     uint32             Flags;         // GE_ACTOR_RENDER_NORMAL, GE_ACTOR_RENDER_MIRRORS, GE_ACTOR_COLLIDE
     uint32             UserFlags;
     //int32    Leaf;                 // Current leaf the actor is in (currently used for PVS occlusion)
} World_Actor;

Return to Contents

 

geWorld_EntClassSet

typedef struct {
     const char *               ClassName;                    // NULL for main set
     geEntity_EntitySet*   Set;
} geWorld_EntClassSet;

Return to Contents

 

geWorld_DebugInfo
typedef struct {
     int32            NumNodesTraversed1;
     int32            NumNodesTraversed2;
     int32            NumLeafsHit1;
     int32            NumLeafsHit2;
     int32            NumLeafsWithUserPolys;
     int32            NumUserPolys;
} geWorld_DebugInfo;

Return to Contents

 

geWorld

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

  typedef struct geWorld {
     int32                      CurFrameStatic;               // World CurrentFrame
     int32                      CurFrameDynamic;          // World CurrentFrame
     float                       CurTime;                          // World CurrentTime //type is geFloat in Genesis3D v1.6
     int32                      CurrentLeaf;
     geBoolean             ForceVis;
     geBoolean             VisInfo;
     //           Info that each respective module fills in...
     World_BSP*        CurrentBSP;                    // Valid when geWorld_SetGBSP is called
     World_SkyBox     SkyBox;
     Frustum_Info*       FrustumInfo;
     Light_LightInfo*    LightInfo;                        // Info that the light module fills in
     Mesh_MeshInfo*  MeshInfo;                       // Info that the mesh module fills in
     int32                     ActorCount;                    // Number of actors in world
     World_Actor*      ActorArray;                    // Array of actors
     int32  SpriteCount; // Number of sprites in world //Present only in Genesis3D v1.6
     World_Sprite*   SpriteArray; // Array of sprites // Present only in Genesis3D v1.6
     geWorld_EntClassSet           EntClassSets[MAX_WORLD_ENT_CLASS_SETS];
     int32                    NumEntClassSets;
     User_Info*          UserInfo;
     //           Debug info
     int32                   ActiveUserPolys;
     geWorld_DebugInfo DebugInfo;
     geFog*               FogList;                            // Linked list of fog in the world currently
      
     geFog*               VisibleFog[MAX_VISIBLE_FOG];  // List of visible fog for this frame
     int32                    NumVisibleFog;
     BitmapList*         AttachedBitmaps;      
     geXForm3d         LastCameraXForm;
     int32                    RefCount;
     geBoolean            Changed;                        // GE_TRUE if this world has changed
} geWorld;

Return to Contents

 

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 (0 to 1.0) how far along the line for the impact point
   GE_Plane Plane;    // Impact Plane
} GE_Collision;

Return to Contents

 

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;

Return to Contents

 

GE_CollisionCB

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

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.

Return to Contents

 

GE_Plane

// Collision
typedef struct {
  
geVec3d Normal; // Orientation of plane
  
float   Dist;   // Distance from origin
} GE_Plane;

Return to Contents

Constants:

Actor Flags, GE_COLLIDE_..., GE_CONTENTS_..., gePoly_Type, Rendering Flags, Model flags, Sprite flags, Miscellaneous

Return to Contents

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

Return to Contents

 

GE_COLLIDE_... FLAGS

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)

Return to Contents


GE_CONTENTS_... FLAGS

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)

Return to Constants


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;

Return to Constants

 

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.

Return to Contents

 

Model flags (geWorld_ModelSetFlags)

#define GE_MODEL_RENDER_NORMAL   (1<<0)  // Render in normal views
#define GE_MODEL_RENDER_MIRRORS   (1<<1)  // Render in mirror views
#define GE_MODEL_RENDER_ALWAYS   (1<<2)  // Render always, skipping all visibility tests
#define GE_MODEL_COLLIDE    (1<<3)  // Collide when calling geWorld_Collision

Return to Contents

 

Sprite flags (used for geWorld_AddSprite and geWorld_SetSpriteFlags)

Note: This is available only in Genesis3D v1.6

#define GE_SPRITE_RENDER_NORMAL (1<<0) // Render in normal views
#define GE_SPRITE_RENDER_MIRRORS (1<<1) // Render in mirror views
#define GE_SPRITE_RENDER_ALWAYS (1<<2) // Render always, skipping all visibility tests
#define GE_SPRITE_COLLIDE (1<<3) // Collide when calling geWorld_Collision

Return to Contents

 

Miscellaneous

#define MODEL_CHANGED_XFORM    (1<<0)  
#define MAX_VISIBLE_FOG  12 // Hope to God there is not this much visible at a time!!!
#define MAX_WORLD_ENT_CLASS_SETS 256

Return to Contents

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.

Note from Jeff: The geWorld_AddActor() function will increase the reference count of the geActor and copy a reference to the world's actor array. This array is used to keep track of all the actors in the world.

Return to Contents


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.

Return to Contents


GENESISAPI geFog* geWorld_AddFog(geWorld* World);

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

Notes from wxb1: "...Fog kills framerate .... I think regular fog does slow frame rate a little but "fog lights" really kill frame rate... fog lights are really dynamic lights which require another pass to render (this is why they kill frame rate)..."

Note from kdtop: Another method of creating fog, that doesn't affect framerate much is to use geEngine_SetFogEnable (version 1.6). This appears to fill the whole world with fog (which may affect sky visibility)

See also geFog functions

Returns: the geFog object.

Return to Contents


GENESISAPI geLight* geWorld_AddLight(geWorld* World);

This function adds a new geLight object to the geWorld World and returns it. Use AddLight first to create the light, then call geWorld_SetLightAttributes() to set the light properties.

Note from kdtop: This adds a dynamic light to the world. Be aware, however, that dynamic lights can slow down frame rate significantly.

Returns: the geLight object.


Return to Contents

 

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.

Return to Contents


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.

Return to Contents


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.

Return to Contents


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. 
Checks for collision of the world against either a simply ray (defined by starting point Front to ending point Back), or against a volume of space (with dimensions defined by Mins, Maxs, Front, and Back).

World: The geWorld object representing the world geometry to be tested against. 
Mins:
Mins (in object-space) of axial-aligned bounding box for checking collision with against World. (e.g. &ExtBox.Min) Values should be RELATIVE (i.e. -20,-20, -20). May be NULL if a simple ray collision wanted. .
Maxs:
Maxs (in object-space) of axial-aligned bounding box for checking collision with against World. (e.g. &ExtBox.Max) Values should be RELATIVE (i.e. 20, 20, 20). May be NULL if a simple ray collision wanted.
Front:
Front (or beginning) of the ray (or volume) to test collision against. (e.g. &CurrentPosition)
Back: Back (or end) of the ray (or volume) to test collision againts. (e.g. &TentitiveNewPosition)
Contents: Types of surfaces in the world to test against, use the GE_CONTENTS_ flags constants to specify. 
CollideFlags:
Types of objects (actors, etc.) to test against. Use GE_COLLIDE_ constants. (Used to mask out certain object types.)
UserFlags:
Mask to be tested against for the user-definable flags as set in AddActor. (Use to mask out certain actors.)
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
Col:
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!!!).

Return to Contents


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.

Note from Jeff: The geWorld_Create() function will create a world from a .BSP file or create a NULL world if the passed parameter is NULL. The return value is a pointer to a geWorld structure.

Return to Contents


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.

Note from Jeff: The geWorld_Free() function will check to see if there are multiple references to the geWorld, if so then it decreases the reference count and returns. If there is only one reference then it removes the geWorld from memory. This includes calling geActor_Destroy() for every geActor in the world's actor array.

Return to Contents


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.

Note: This will return only bitmaps that were added as part of a loading a world. It will not return bitmaps that have been added by geWorld_AddBitmap


Return to Contents

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.

Return to Contents


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.

Return to Contents


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.

Return to Contents


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.

Return to Contents


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.

Return to Contents


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.

Return to Contents


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

Return to Contents


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.

Return to Contents


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...

Return to Contents


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.

Return to Contents


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.

Return to Contents


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.

Return to Contents


GENESISAPI void geWorld_ModelGetCenter(geWorld_Model* Model, geVec3d*Center);

Added in Genesis3D v1.6

  • Puts the center of Model, which is the center of its bounding box, into Center

    Returns: nothing

    Return to Contents


  • 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.

    Return to Contents


    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.

    Return to Contents


    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.

    Return to Contents


    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.

    Return to Contents


    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.

    Return to Contents


    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.

    Return to Contents


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

    This function removes geActor Actor from geWorld World.

    Returns: GE_TRUE on success, GE_FALSE otherwise.

    Note from Jeff: The geWorld_RemoveActor() function will decrease the reference to the geActor and remove it from the world's actor array.

    Return to Contents


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

    This function removes geBitmap Bitmap from geWorld World.

    Returns: GE_TRUE on success, GE_FALSE otherwise.

    Return to Contents


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

    This function removes geFog Fog from geWorld World.

    See also geFog functions

    Returns: GE_TRUE on success, GE_FALSE otherwise.

    Return to Contents


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

    This function removes geLight Light from geWorld World.

    Returns: GE_TRUE on success, GE_FALSE otherwise.

    Return to Contents


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

    This function removes gePoly Poly from geWorld World.

    Returns: GE_TRUE on success, GE_FALSE otherwise.

    Return to Contents


    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.

    Return to Contents


    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.

    ContentsReturn to Contents


    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.

    ContentsReturn to Contents


    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.

    Return to Contents


    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.

    Return to Contents

    GENESISAPI geBoolean geWorld_RemoveSprite(geWorld* World, geSprite* Sprite);

    Added in Genesis3D v1.6

    Removes and destroys Sprite from World.

    Return to Contents

    GENESISAPI geBoolean geWorld_AddSprite(geWorld* World, geSprite* Sprite, uint32 Flags, uint32 UserFlags);

    Added in Genesis3D v1.6

    Adds Sprite to World.

    Sprite must be a valid geSprite, created by geSprite_Create().
    Flags should be one of these flags.
    UserFlags
    to be set to any user-defined value.

    Return to Contents

    GENESISAPI geBoolean geWorld_SetSpriteFlags(geWorld* World, geSprite* Sprite, uint32 Flags);

    Added in Genesis3D v1.6

    Changes rendering flags for sprite.

    Flags should be one of these flags.

    Return to Contents

    GENESISAPI geBoolean GENESISCC geWorld_IsSpritePotentiallyVisible(const geWorld* World, const geSprite* Sprite, const geCamera* Camera);

    Added in Genesis3D v1.6

  • Determines whether a Sprite may be potentially visible, based on Camera.

    Note: Mirrors aren't checked, and function doesn't check the extents of the sprite, just the center point.


    Return to Contents

  •  

    Notes:

    Notes from the Genesis3d forum (author was Jeff):

    The geWorld_Create() function will create a world from a .BSP file or create a NULL world if the passed parameter is NULL. The return value is a pointer to a geWorld structure.

    The geEngine_AddWorld() function will increase the reference count of the geWorld and copy a reference to the engine's world array. This array is used to keep track of all the worlds in the engine.

    The geEngine_RemoveWorld() function will check to see if there are multiple references to the geWorld, if so then it decreases the reference count and returns GE_TRUE. If there is only one reference then it removes the geWorld from the engine's world array and calls the geWorld_Free() function.

    The geWorld_Free() function will check to see if there are multiple references to the geWorld, if so then it decreases the reference count and returns. If there is only one reference then it removes the geWorld from memory. This includes calling geActor_Destroy() for every geActor in the world's actor array.