My Project
BMaxObject.h
1 #pragma once
2 #include "MeshEntity.h"
3 #include "ParaXEntity.h"
4 #include "TileObject.h"
5 namespace ParaEngine
6 {
7  class CParaXModel;
8  class BMaxModel;
9  struct SceneState;
10  struct IParaPhysicsActor;
11  class CPhysicsWorld;
12 
13  /* render with color and material. */
14  class BMaxObject : public CTileObject
15  {
16  public:
17  BMaxObject(void);
18  virtual ~BMaxObject(void);
19 
20  ATTRIBUTE_DEFINE_CLASS(BMaxObject);
21  ATTRIBUTE_SUPPORT_CREATE_FACTORY(BMaxObject);
22 
24  virtual int InstallFields(CAttributeClass* pClass, bool bOverride);
25 
27  virtual int GetChildAttributeObjectCount(int nColumnIndex = 0);
29  virtual int GetChildAttributeColumnCount();
30  virtual IAttributeFields* GetChildAttributeObject(int nRowIndex, int nColumnIndex = 0);
31 
32  ATTRIBUTE_METHOD(BMaxObject, UpdateModel_s) { cls->UpdateModel(); return S_OK; }
33  public:
34  IAttributeFields* GetAnimInstanceFields();
35 
36  virtual HRESULT Draw(SceneState * sceneState);
37 
38  void ApplyBlockLighting(SceneState * sceneState);
39 
40  virtual AssetEntity* GetPrimaryAsset();
41  virtual void SetAssetFileName(const std::string& sFilename);
42 
43  virtual Matrix4* GetAttachmentMatrix(Matrix4& pOut, int nAttachmentID = 0, int nRenderNumber = 0);
44 
45  virtual void GetLocalTransform(Matrix4* localTransform);
46  virtual void UpdateGeometry();
47 
50  virtual void SetScaling(float s);
51 
53  virtual float GetScaling();
54 
61  virtual Matrix4* GetRenderMatrix(Matrix4& out, int nRenderNumber = 0);
62 
64  virtual bool CanHasPhysics();
65  virtual void LoadPhysics();
69  virtual void SetAlwaysLoadPhysics(bool bEnable);
70  virtual void UnloadPhysics();
71  virtual void SetPhysicsGroup(int nGroup);
72  virtual int GetPhysicsGroup();
73  virtual void EnablePhysics(bool bEnable);
74  virtual bool IsPhysicsEnabled();
75  virtual TextureEntity* GetReplaceableTexture(int ReplaceableTextureID)override;
76  virtual bool SetReplaceableTexture(int ReplaceableTextureID,TextureEntity* pTextureEntity)override;
77 
79  virtual void EnableAnim(bool bAnimated);
80  virtual bool IsAnimEnabled();
81 
83  virtual int GetTime();
84  virtual void SetTime(int nTime);
85 
89  virtual void SetAnimFrame(int nFrame);
90 
92  virtual int GetAnimFrame();
93 
95  int GetStaticActorCount();
96 
98  bool UpdateModel(SceneState * sceneState = NULL);
99 
125 
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
virtual void SetPhysicsGroup(int nGroup)
set the physics group ID to which this object belongs to default to 0, must be smaller than 32...
Definition: BMaxObject.cpp:472
virtual void SetAlwaysLoadPhysics(bool bEnable)
by default physics is lazy-load when player walk into its bounding box, setting this to false will al...
Definition: BMaxObject.cpp:447
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
It's used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
virtual int GetPhysicsGroup()
Get the physics group ID to which this object belongs to default to 0, must be smaller than 32...
Definition: BMaxObject.cpp:482
virtual int GetTime()
get the current local time in case it is animated in milli seconds frames.
Definition: BMaxObject.cpp:516
virtual Matrix4 * GetAttachmentMatrix(Matrix4 &pOut, int nAttachmentID=0, int nRenderNumber=0)
Get the specified attachment matrix of the current model.
Definition: BMaxObject.cpp:155
different physics engine has different winding order.
Definition: EventBinding.h:32
virtual void EnableAnim(bool bAnimated)
whether animation is enabled.
Definition: BMaxObject.cpp:506
int GetStaticActorCount()
get the number of physics actors.
Definition: BMaxObject.cpp:562
virtual int GetAnimFrame()
get the current animation frame number relative to the beginning of current animation.
Definition: BMaxObject.cpp:545
virtual void LoadPhysics()
load the physics objects.
Definition: BMaxObject.cpp:422
virtual TextureEntity * GetReplaceableTexture(int ReplaceableTextureID) override
get the current replaceable texture by its ID.
Definition: BMaxObject.cpp:550
Definition: BMaxObject.h:14
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: BMaxObject.cpp:567
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
virtual void GetLocalTransform(Matrix4 *localTransform)
get local transform
Definition: BMaxObject.cpp:241
A common interface for all classes implementing IAttributeFields By implementing this class's virtual...
Definition: IAttributeFields.h:59
virtual AssetEntity * GetPrimaryAsset()
Set scaling.
Definition: BMaxObject.cpp:179
bool UpdateModel(SceneState *sceneState=NULL)
update model according to current animation data and time
Definition: BMaxObject.cpp:254
virtual bool SetReplaceableTexture(int ReplaceableTextureID, TextureEntity *pTextureEntity) override
set the replaceable texture at the given index with a new texture.
Definition: BMaxObject.cpp:556
virtual void SetScaling(float s)
set the scale of the object.
Definition: BMaxObject.cpp:134
virtual float GetScaling()
get the scaling.
Definition: BMaxObject.cpp:74
virtual bool CanHasPhysics()
if the object may contain physics
Definition: BMaxObject.cpp:129
Tile Object have position and bounding rect and can usually be attached to quad-tree terrain tile...
Definition: TileObject.h:10
virtual Matrix4 * GetRenderMatrix(Matrix4 &out, int nRenderNumber=0)
return the world matrix of the object for rendering
Definition: BMaxObject.cpp:79
virtual HRESULT Draw(SceneState *sceneState)
only for drawable objects
Definition: BMaxObject.cpp:280
virtual int GetChildAttributeObjectCount(int nColumnIndex=0)
get the number of child objects (row count) in the given column.
Definition: BMaxObject.cpp:38
virtual void SetAssetFileName(const std::string &sFilename)
set asset file name
Definition: BMaxObject.cpp:143
virtual void UnloadPhysics()
load the physics object
Definition: BMaxObject.cpp:459
virtual void SetAnimFrame(int nFrame)
set the current animation frame number relative to the beginning of current animation.
Definition: BMaxObject.cpp:526
virtual void UpdateGeometry()
this function is usually called after asset file has changed.
Definition: BMaxObject.cpp:184
virtual int GetChildAttributeColumnCount()
we support multi-dimensional child object.
Definition: BMaxObject.cpp:49
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
virtual void EnablePhysics(bool bEnable)
this function will turn on or off the physics of the object.
Definition: BMaxObject.cpp:487