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

pathpt.h File Reference

#include "Genesis.h"

Go to the source code of this file.

Compounds

struct  PathPoint

Typedefs

typedef PathPoint PathPoint

Functions

geBoolean PathPt_Startup (geWorld *World, geVFile *Fs)
geBoolean PathPt_Reset (geWorld *World)
geBoolean PathPt_Frame (geWorld *World, const geXForm3d *ViewPoint, geFloat Time)
geBoolean PathPt_Shutdown (void)


Typedef Documentation

typedef struct PathPoint PathPoint
 

Definition at line 9 of file pathpt.h.


Function Documentation

geBoolean PathPt_Frame geWorld World,
const geXForm3d ViewPoint,
geFloat  Time
 

Definition at line 295 of file PathPt.c.

References GE_TRUE, geBoolean, geEntity_EntitySetGetNextEntity(), geEntity_GetUserData(), geVec3d_Add(), geVec3d_Subtract(), geWorld_GetEntitySet(), geWorld_GetModelRotationalCenter(), geWorld_GetModelXForm(), geXForm3d_Transform(), PathPoint::MoveWithModel, MultiPathLight, NULL, PathPoint::origin, PathLight, PathPoint_Frame2(), PathPoint_Frame3(), and PathPoint::Pos.

00296 {
00297         geEntity_EntitySet *    Set;
00298         geEntity *                              Entity;
00299 
00300         PathPoint *     P;
00301         geVec3d         Pos;
00302         geVec3d Center;
00303         extern geBoolean PathLight;
00304         extern geBoolean MultiPathLight;
00305 
00306         if      (!World)
00307                 return GE_TRUE;
00308  
00309         Set = geWorld_GetEntitySet(World, "PathPoint");
00310 
00311         if      (Set == NULL)
00312                 return GE_TRUE;
00313 
00314         Entity = NULL;
00315 
00316         while   (1)
00317         {
00318                 Entity = geEntity_EntitySetGetNextEntity(Set, Entity);
00319 
00320                 if (!Entity)
00321                         break;
00322 
00323                 P = geEntity_GetUserData(Entity);
00324 
00325                 if      (P->MoveWithModel)
00326                 {
00327                         geXForm3d       XForm;
00328 
00329                         geWorld_GetModelXForm(World, P->MoveWithModel, &XForm);
00330 
00331                         Pos = P->origin;
00332 
00333                         geWorld_GetModelRotationalCenter(World, P->MoveWithModel, &Center);
00334                         geVec3d_Subtract(&Pos, &Center, &Pos);
00335                         geXForm3d_Transform(&XForm, &Pos, &Pos);
00336                         geVec3d_Add(&Pos, &Center, &P->Pos);
00337                 }
00338         }
00339 
00340         if (XForm)
00341         {
00342                 if (PathLight)
00343                         PathPoint_Frame2(World, XForm, DeltaTime);
00344                 if (MultiPathLight)
00345                         PathPoint_Frame3(World, XForm, DeltaTime);
00346         }
00347 
00348 
00349         return GE_TRUE;
00350 }

geBoolean PathPt_Reset geWorld World  ) 
 

Definition at line 92 of file PathPt.c.

References GE_TRUE, geBoolean, MAX_TRACKS, TrackCount, and TrackList.

Referenced by PathPt_Startup().

00093 {
00094         if      (!World)
00095                 return GE_TRUE;
00096 
00097         memset(TrackList,0,sizeof(TrackList[0])*MAX_TRACKS);
00098         TrackCount = 0;
00099 
00100         return GE_TRUE;
00101 }

geBoolean PathPt_Shutdown void   ) 
 

Definition at line 282 of file PathPt.c.

References GE_TRUE, geBitmap_Destroy(), geBoolean, NULL, and PathPointTexture.

Referenced by ShutdownWorldCB().

00283 {
00284         if (PathPointTexture)
00285         {
00286                 // NOTE - We really should remove it from the world, but when the world is destroyed
00287                 // it removes all leftover bitmaps, so we are free to just let that happen...
00288                 geBitmap_Destroy(&PathPointTexture);
00289                 PathPointTexture = NULL;
00290         }
00291 
00292         return GE_TRUE;
00293 }

geBoolean PathPt_Startup geWorld World,
geVFile Fs
 

Definition at line 166 of file PathPt.c.

References TrackPt::Action, TrackPt::ActionDir, PathPoint::ActionType, BIT, PathPoint::Direction, PathPoint::Dist, TrackPt::Dist, TrackPt::Flags, GE_FALSE, GE_TRUE, geBoolean, geEntity_EntitySetGetNextEntity(), geEntity_GetUserData(), geWorld_GetEntitySet(), MAX_TRACK_POINTS, MAX_TRACKS, PathPoint::Next, NULL, PathPoint::origin, PathPoint_SetTexture(), PathPt_Reset(), PathPoint::PathType, POINT_TYPE_WAIT_POINT_VISIBLE, TrackPt::Pos, PathPoint::Pos, SET, PathPoint::Time, TrackPt::Time, Track_LinkTracks(), TRACK_TYPE_TRAVERSE_DOOR, TrackCount, TrackList, PathPoint::VelocityScale, TrackPt::VelocityScale, PathPoint::WatchPoint, and TrackPt::WatchPos.

Referenced by SetupWorldCB().

00167 {
00168         void                            *ClassData;
00169         geEntity_EntitySet      *ClassSet;
00170         geEntity                        *Entity;
00171         PathPoint                       *Point;
00172         
00173         int pointnum=0;
00174         TrackPt *track_pt;
00175 
00176         if      (!World)
00177                 return GE_TRUE;
00178 
00179         PathPt_Reset(World);
00180 
00181         // Look for the class name in the world
00182         ClassSet = geWorld_GetEntitySet(World, "PathPoint");
00183 
00184     if (!ClassSet)
00185         return GE_TRUE;
00186 
00187         Entity = NULL;
00188 
00189         while (1)
00190         {
00191                 Entity = geEntity_EntitySetGetNextEntity(ClassSet, Entity);
00192 
00193                 if (!Entity)
00194                         break;
00195 
00196                 ClassData = geEntity_GetUserData(Entity);
00197                 Point = (PathPoint*)ClassData;
00198 
00199                 assert(Point);
00200 
00201                 // initialize translated position
00202                 Point->Pos = Point->origin;
00203 
00204                 if (Point->PathType <= 0)
00205                         continue;
00206 
00207                 //save off header info
00208                 TrackList[TrackCount].Type = Point->PathType;
00209         pointnum = 0;
00210 
00211                 //move through points setting up the list
00212                 do
00213                 {
00214                         //save off point info
00215                         track_pt = &TrackList[TrackCount].PointList[pointnum];
00216                         // initialize translated position
00217                         Point->Pos = Point->origin;
00218                         track_pt->Pos = &Point->Pos;
00219                         if (Point->WatchPoint)
00220                                 track_pt->WatchPos = &Point->WatchPoint->origin;
00221 
00222                         track_pt->Action = Point->ActionType;
00223                         track_pt->Time = Point->Time;
00224             track_pt->ActionDir = Point->Direction;
00225                         track_pt->Dist = Point->Dist;
00226                         track_pt->VelocityScale = Point->VelocityScale;
00227 
00228                         // automatic setup for doors
00229                         if (TrackList[TrackCount].Type == TRACK_TYPE_TRAVERSE_DOOR)
00230                                 {
00231                                 if (pointnum == 0)
00232                                         {
00233                                         track_pt->ActionDir = 1;
00234                                         track_pt->Action = POINT_TYPE_WAIT_POINT_VISIBLE;
00235                                         track_pt->WatchPos = &Point->Next->origin;
00236                                         }
00237                                 else
00238                                 if (pointnum == 1)
00239                                         {
00240                                         track_pt->ActionDir = -1;
00241                                         track_pt->Action = POINT_TYPE_WAIT_POINT_VISIBLE;
00242                                         track_pt->WatchPos = (track_pt-1)->Pos;
00243                                         }
00244                                 }
00245 
00246                         pointnum++;
00247                         TrackList[TrackCount].PointCount = pointnum;
00248 
00249             assert(pointnum < MAX_TRACK_POINTS);
00250 
00251                         Point = Point->Next;
00252 
00253                         // Found a type
00254                         if (Point && Point->PathType >= 0)
00255                                 {
00256                                 track_pt = &TrackList[TrackCount].PointList[pointnum];
00257                                 SET(track_pt->Flags, BIT(0));
00258                                 }
00259 
00260                 }while(Point && Point != (PathPoint*)ClassData);
00261 
00262                 TrackCount++;
00263                 assert(TrackCount < MAX_TRACKS);
00264         }
00265 
00266         Entity = NULL;
00267 
00268         {
00269                 void Track_LinkTracks(geWorld *World);
00270                 Track_LinkTracks(World);
00271         }
00272 
00273         if (Fs)
00274         {
00275                 if (!PathPoint_SetTexture(World, Fs))
00276                         return GE_FALSE;
00277         }
00278 
00279         return GE_TRUE;
00280 }


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