Tweaks any enums that use uint_max values so that they have hard types to avoid any...
[Torque-3d.git] / Engine / source / scene / simPath.h
blob9c31ac507c6b3ec21350d489be66cf3af3df4ffb
1 //-----------------------------------------------------------------------------
2 // Copyright (c) 2012 GarageGames, LLC
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy
5 // of this software and associated documentation files (the "Software"), to
6 // deal in the Software without restriction, including without limitation the
7 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 // sell copies of the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 // IN THE SOFTWARE.
21 //-----------------------------------------------------------------------------
23 #ifndef _SIMPATH_H_
24 #define _SIMPATH_H_
26 #ifndef _SCENEOBJECT_H_
27 #include "scene/sceneObject.h"
28 #endif
29 #ifndef _GFXSTATEBLOCK_H_
30 #include "gfx/gfxStateBlock.h"
31 #endif
32 #ifndef _GFXVERTEXBUFFER_H_
33 #include "gfx/gfxVertexBuffer.h"
34 #endif
35 #ifndef _GFXPRIMITIVEBUFFER_H_
36 #include "gfx/gfxPrimitiveBuffer.h"
37 #endif
39 class BaseMatInstance;
42 namespace SimPath
45 //--------------------------------------------------------------------------
46 /// A path!
47 class Path : public SimGroup
49 typedef SimGroup Parent;
51 public:
52 enum : U32
54 NoPathIndex = 0xFFFFFFFF
58 private:
59 U32 mPathIndex;
60 bool mIsLooping;
62 protected:
63 bool onAdd();
64 void onRemove();
66 public:
67 Path();
68 ~Path();
70 void addObject(SimObject*);
71 void removeObject(SimObject*);
73 void sortMarkers();
74 void updatePath();
75 bool isLooping() { return mIsLooping; }
76 U32 getPathIndex() const;
78 DECLARE_CONOBJECT(Path);
79 static void initPersistFields();
82 //--------------------------------------------------------------------------
83 //--------------------------------------------------------------------------
84 inline U32 Path::getPathIndex() const
86 return mPathIndex;
89 } // Namespace
92 //--------------------------------------------------------------------------
93 class Marker : public SceneObject
95 typedef SceneObject Parent;
96 friend class Path;
98 public:
99 enum SmoothingType
101 SmoothingTypeLinear,
102 SmoothingTypeSpline,
103 SmoothingTypeAccelerate,
106 enum KnotType
108 KnotTypeNormal,
109 KnotTypePositionOnly,
110 KnotTypeKink,
114 U32 mSeqNum;
115 U32 mSmoothingType;
116 U32 mKnotType;
118 U32 mMSToNext;
120 // Rendering
121 protected:
122 void prepRenderImage(SceneRenderState *state);
123 void renderObject(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance* overrideMat);
125 protected:
126 bool onAdd();
127 void onRemove();
128 void onGroupAdd();
130 void onEditorEnable();
131 void onEditorDisable();
133 static void initGFXResources();
135 static GFXStateBlockRef smStateBlock;
136 static GFXVertexBufferHandle<GFXVertexPCT> smVertexBuffer;
137 static GFXPrimitiveBufferHandle smPrimitiveBuffer;
139 public:
140 Marker();
141 ~Marker();
143 DECLARE_CONOBJECT(Marker);
144 static void initPersistFields();
145 void inspectPostApply();
147 U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream);
148 void unpackUpdate(NetConnection *conn, BitStream *stream);
151 typedef Marker::SmoothingType MarkerSmoothingType;
152 typedef Marker::KnotType MarkerKnotType;
154 DefineEnumType( MarkerSmoothingType );
155 DefineEnumType( MarkerKnotType );
157 #endif // _H_PATH