Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

ModelCtl.h File Reference

#include "genesis.h"

Go to the source code of this file.

Compounds

struct  ModelController

Typedefs

typedef ModelController ModelController

Functions

geBoolean ModelCtl_Init (void)
geBoolean ModelCtl_Reset (geWorld *World)
geBoolean ModelCtl_Frame (geWorld *World, const geXForm3d *ViewPoint, geFloat Time)
geBoolean ModelCtl_Shutdown (void)


Typedef Documentation

typedef struct ModelController ModelController
 


Function Documentation

geBoolean ModelCtl_Frame geWorld World,
const geXForm3d ViewPoint,
geFloat  Time
 

Definition at line 48 of file ModelCtl.c.

References GE_FALSE, GE_TRUE, geBoolean, geEntity_EntitySetGetNextEntity(), geEntity_GetName(), geEntity_GetUserData(), geErrorLog_AddString, geFloat, geMotion_GetPath(), gePath_GetTimeExtents(), gePath_Sample(), geWorld_GetEntitySet(), geWorld_ModelGetMotion(), geWorld_SetModelXForm(), ModelController::LastTime, ModelController::Model, and NULL.

Referenced by RenderWorld().

00049 {
00050         geEntity_EntitySet *    Set;
00051         geEntity *                              Entity;
00052  
00053         if      (World == NULL)
00054                 return GE_TRUE;
00055 
00056         Set = geWorld_GetEntitySet(World, "ModelController");
00057         if      (Set == NULL)
00058                 return GE_TRUE;
00059 
00060         Entity = geEntity_EntitySetGetNextEntity(Set, NULL);
00061         while   (Entity)
00062         {
00063                 ModelController *       Controller;
00064                 geMotion *                      Motion;
00065                 gePath *                        Path;
00066                 geFloat                         StartTime;
00067                 geFloat                         EndTime;
00068                 geXForm3d                       XForm;
00069 
00070                 #define MAX_NAME 200
00071                 char    EntityName[MAX_NAME];
00072 
00073                 geEntity_GetName(Entity, EntityName, MAX_NAME-1);
00074                 EntityName[MAX_NAME-1]=0;
00075 
00076                 Controller = geEntity_GetUserData(Entity);
00077                 if (Controller->Model==NULL)
00078                         {
00079                                 geErrorLog_AddString(0,"ModelCtl_Frame: Model controller has no model:",EntityName);
00080                                 return GE_FALSE;
00081                         }
00082                 Motion = geWorld_ModelGetMotion(Controller->Model);
00083                 if (Motion == NULL)
00084                         {
00085                                 geErrorLog_AddString(0,"ModelCtl_Frame: Model controller has no motion:",EntityName);
00086                                 return GE_FALSE;
00087                         }
00088                 Path = geMotion_GetPath(Motion, 0);
00089                 if (Path == NULL)
00090                         {
00091                                 geErrorLog_AddString(0,"ModelCtl_Frame: Model controller has no path in its motion:",EntityName);
00092                                 return GE_FALSE;
00093                         }
00094                 gePath_GetTimeExtents(Path, &StartTime, &EndTime);
00095                 gePath_Sample(Path, StartTime + Controller->LastTime, &XForm);
00096 
00097                 geWorld_SetModelXForm(World, Controller->Model, &XForm);
00098                 
00099                 Controller->LastTime = (geFloat)fmod(Controller->LastTime + DeltaTime, EndTime - StartTime);
00100 
00101                 Entity = geEntity_EntitySetGetNextEntity(Set, Entity);
00102         }
00103 
00104         return GE_TRUE;
00105 }

geBoolean ModelCtl_Init void   ) 
 

Definition at line 12 of file ModelCtl.c.

References GE_TRUE, and geBoolean.

Referenced by GameMgr_SetWorld().

00013 {
00014         return GE_TRUE;
00015 }

geBoolean ModelCtl_Reset geWorld World  ) 
 

Definition at line 17 of file ModelCtl.c.

References GE_TRUE, geBoolean, geEntity_EntitySetGetNextEntity(), geEntity_GetUserData(), geWorld_GetEntitySet(), ModelController::LastTime, and NULL.

00018 {
00019         geEntity_EntitySet *    Set;
00020         geEntity *                              Entity;
00021  
00022         if      (World == NULL)
00023                 return GE_TRUE;
00024 
00025         Set = geWorld_GetEntitySet(World, "ModelController");
00026         if      (Set == NULL)
00027                 return GE_TRUE;
00028 
00029         Entity = geEntity_EntitySetGetNextEntity(Set, NULL);
00030         while   (Entity)
00031         {
00032                 ModelController *               Controller;
00033 
00034                 Controller = geEntity_GetUserData(Entity);
00035                 Controller->LastTime = 0.0f;
00036 
00037                 Entity = geEntity_EntitySetGetNextEntity(Set, Entity);
00038         }
00039 
00040         return GE_TRUE;
00041 }

geBoolean ModelCtl_Shutdown void   ) 
 

Definition at line 43 of file ModelCtl.c.

References GE_TRUE, and geBoolean.

00044 {
00045         return GE_TRUE;
00046 }


Generated on Tue Sep 30 12:37:47 2003 for GTestAndEngine by doxygen 1.3.2