newspeoplefor developersdocumentationdownloads

actorgraphicsproperty.h

Go to the documentation of this file.
00001 #ifndef PROPERTIES_ACTORGRAPHICSPROPERTY_H
00002 #define PROPERTIES_ACTORGRAPHICSPROPERTY_H
00003 //------------------------------------------------------------------------------
00013 #include "properties/graphicsproperty.h"
00014 #include "graphics/charentity.h"
00015 
00016 //------------------------------------------------------------------------------
00017 namespace Properties
00018 {
00019 class ActorGraphicsProperty : public GraphicsProperty
00020 {
00021     DeclareRtti;
00022     DeclareFactory(ActorGraphicsProperty);
00023 
00024 public:
00026     virtual ~ActorGraphicsProperty();
00027 
00029     virtual void OnDeactivate();
00031     virtual void OnRender();
00032 
00034     virtual bool Accepts(Message::Msg* msg);
00036     virtual void HandleMessage(Message::Msg* msg);
00037 
00039     virtual void SetupDefaultAttributes();
00040 
00041 protected:
00043     Graphics::CharEntity* GetGraphicsEntity() const;
00045     virtual void SetupGraphicsEntities();
00047     void SetAnimation(const nString& baseAnim, const nString& overlayAnim, float baseAnimTimeOffset);
00049     void AddAttachment(const nString& jointName, const nString& gfxResName, const matrix44& offset);
00051     void RemAttachment(const nString& jointName); 
00053     int FindAttachment(const nString& jointName);
00055     void UpdateAttachments();
00057     void AddSkin(const nString& skinName);
00059     void RemSkin(const nString& skinName);
00060 
00061     struct Attachment
00062     {
00063         int jointIndex;
00064         Ptr<Graphics::Entity> graphicsEntity;
00065         matrix44 offsetMatrix;
00066     };
00067 
00068     nArray<Attachment> attachments;
00069 };
00070 
00071 RegisterFactory(ActorGraphicsProperty);
00072 
00073 //------------------------------------------------------------------------------
00076 inline
00077 Graphics::CharEntity*
00078 ActorGraphicsProperty::GetGraphicsEntity() const
00079 {
00080     n_assert(this->graphicsEntities[0]->IsA(Graphics::CharEntity::RTTI));
00081     return (Graphics::CharEntity*) this->graphicsEntities[0].get();
00082 }
00083 
00084 }; // namespace Properties
00085 //------------------------------------------------------------------------------
00086 #endif

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.