"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSEngine/Src/Entity/LSEActor.h

00001 
00017 #ifndef __LSE_ACTOR_H__
00018 #define __LSE_ACTOR_H__
00019 
00020 #include "../LSEEngine.h"
00021 #include "CriticalSection/LSHCriticalSection.h"
00022 #include "LSEEntity.h"
00023 #include "Orientation/LSMOrientation.h"
00024 #include "SharedPtr/LSTLSharedPtr.h"
00025 
00026 namespace lse {
00027 
00035         class CActor : public CEntity {
00036         public :
00037                 // == Various constructors.
00038                 LSE_CALLCTOR                                                    CActor();
00039                 virtual LSE_CALLCTOR                                    ~CActor();
00040 
00041 
00042                 // == Functions.
00048                 virtual LSUINT32 LSE_CALL                               EntityType() const;
00049 
00055                 virtual LSVOID LSE_CALL                                 SetEntityParent( CEntity * _peParent );
00056 
00062                 LSE_INLINE LSUINT32 LSE_CALL                    ActorId() const;
00063 
00069                 LSE_INLINE const CMatrix4x4 & LSE_CALL  LocalTrans() const;
00070 
00076                 LSE_INLINE const CMatrix4x4 & LSE_CALL  WorldTrans() const;
00077 
00083                 LSE_INLINE const COrientation & LSE_CALL
00084                                                                                                 Orientation() const;
00085 
00091                 LSE_INLINE COrientation & LSE_CALL              Orientation();
00092 
00096                 LSVOID LSE_CALL                                                 Propagate() const;
00097 
00103                 LSE_INLINE LSBOOL LSE_CALL                              IsWorldDirty() const;
00104 
00105 
00106         protected :
00107                 // == Members.
00111                 mutable CMatrix4x4                                              m_mLocalTrans;
00112 
00116                 mutable CMatrix4x4                                              m_mWorldTrans;
00117 
00121                 COrientation                                                    m_oOrientation;
00122 
00126                 mutable LSBOOL                                                  m_bWorldDirty;
00127 
00132                 LSBOOL                                                                  m_bInheritsTrans;
00133 
00137                 LSUINT32                                                                m_ui32ActorId;
00138 
00142                 static LSUINT32                                                 m_ui32ActorIdCounter;
00143 
00147                 static LSUINT32                                                 m_ui32ActorCounter;
00148 
00152                 static CCriticalSection                                 m_csCrit;
00153 
00154 
00155                 // == Functions.
00159                 virtual LSVOID LSE_CALL                                 UndirtyLocal() const;
00160 
00164                 virtual LSVOID LSE_CALL                                 LocalWillChange() const;
00165 
00169                 virtual LSVOID LSE_CALL                                 LocalDidChange() const;
00170 
00174                 LSVOID LSE_CALL                                                 UndirtyWorld() const;
00175 
00179                 virtual LSVOID LSE_CALL                                 WorldWillChange() const;
00180 
00184                 virtual LSVOID LSE_CALL                                 WorldDidChange() const;
00185 
00189                 LSVOID LSE_CALL                                                 DirtyChildrenWorldTrans() const;
00190 
00191 
00192         private :
00193                 typedef CEntity                                                 Parent;
00194         };
00195 
00196 
00197         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00198         // DEFINITIONS
00199         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00200         // == Types.
00204         typedef CSharedPtr<CActor>                                      CActorPtr;
00205 
00206         // == Functions.
00212         LSE_INLINE LSUINT32 LSE_CALL CActor::ActorId() const {
00213                 return m_ui32ActorId;
00214         }
00215 
00221         LSE_INLINE const CMatrix4x4 & LSE_CALL CActor::LocalTrans() const {
00222                 UndirtyLocal();
00223                 return m_mLocalTrans;
00224         }
00225 
00231         LSE_INLINE const CMatrix4x4 & LSE_CALL CActor::WorldTrans() const {
00232                 if ( m_bInheritsTrans ) {
00233                         UndirtyWorld();
00234                         return m_mWorldTrans;
00235                 }
00236                 return LocalTrans();
00237         }
00238 
00244         LSE_INLINE const COrientation & LSE_CALL CActor::Orientation() const {
00245                 return m_oOrientation;
00246         }
00247         
00253         LSE_INLINE COrientation & LSE_CALL CActor::Orientation() {
00254                 m_bWorldDirty = true;
00255                 return m_oOrientation;
00256         }
00257 
00263         LSE_INLINE LSBOOL LSE_CALL CActor::IsWorldDirty() const {
00264                 return m_bWorldDirty;
00265         }
00266 
00267 }       // namespace lse
00268 
00269 #endif  // __LSE_ACTOR_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator