00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __SCENECOMPONENT_H__
00017 #define __SCENECOMPONENT_H__
00018
00019
00020 #include "../../dependencies.h"
00021 #include "../../core/EntityComponent.h"
00022
00023
00024
00033 class SceneComponent : public EntityComponent
00034 {
00035 public:
00036
00037
00039 SceneComponent(Entity *parent);
00041 ~SceneComponent();
00042
00043
00046 ISceneNode* getSceneNode();
00049 IMetaTriangleSelector* getMetaSelector() const;
00052 ITriangleSelector* getTriangleSelector() const;
00053
00057 void addAnimator(ISceneNodeAnimator *animator);
00058
00081 void addCollisionResponseAnimator(const vector3df &ellipsoidRadius = vector3df(30, 60, 30),
00082 const vector3df &gravityPerSecond = vector3df(0, -10, 0),
00083 const vector3df &ellipsoidTranslation = vector3df(0, 0, 0),
00084 f32 slidingValue = 0.0005f);
00085
00103 void addFlyCircleAnimator(const vector3df ¢er = vector3df(0, 0, 0), f32 radius = 100,
00104 f32 speed = 0.001f, const vector3df &direction = vector3df(0, 0, 0));
00105
00125 void addFlyStraightAnimator(const vector3df &startPoint, const vector3df &endPoint,
00126 u32 timeForWay, bool loop = false);
00127
00131 void addToMetaSelector(Entity *entity);
00135 void addToMetaSelector(SceneComponent *component);
00139 void addToMetaSelector(ITriangleSelector *selector);
00140
00142 vector3df getAbsolutePosition() const;
00144 E_CULLING_TYPE getAutomaticCulling() const;
00146 virtual const aabbox3df& getBoundingBox() const;
00148 u32 getMaterialCount() const;
00150 matrix4 getRelativeTransformation() const;
00152 const vector3df getPosition() const;
00154 const vector3df& getRotation() const;
00156 const vector3df& getScale() const;
00157
00159 void removeAnimators();
00160
00169 void setAbsolutePosition(const vector3df &position);
00178 void setAutomaticCulling(E_CULLING_TYPE state);
00190 void setCanAffectParent(bool value);
00193 void setDebugDataVisible(s32 state);
00203 void setMaterialFlag(E_MATERIAL_FLAG flag, bool value);
00214 void setMaterialTexture(u32 layer, const std::string &fileName);
00220 void setMaterialTexture(u32 layer, ITexture *texture);
00229 void setMaterialType(E_MATERIAL_TYPE type);
00238 void setPosition(const vector3df &position);
00247 virtual void setRotation(const vector3df &rotation);
00256 void setScale(const vector3df &scale);
00265 void setVisible(bool value);
00266
00267
00270 void onPositionChange(void *p);
00273 void onRotationChange(void *p);
00276 void onUpdate(void *p);
00279 void onPause(void *p);
00282 void onUnPause(void *p);
00285 void onTexture(void *p);
00286
00287
00290 static bool parseXML(IXMLReader *file, Entity *entity);
00293 static void parseBaseXML(IXMLReader *file, SceneComponent *component);
00294
00295 protected:
00296
00297
00299 SceneComponent(Entity *parent, bool isDerived);
00300
00301
00302 ISceneNode *mSceneNode;
00303 IMetaTriangleSelector *mMetaSelector;
00304 ITriangleSelector *mTriSelector;
00305
00306 private:
00307
00308
00310 void init();
00311
00312
00313 vector3df mLastPos;
00314 vector3df mLastRot;
00315 bool mCanAffectParent;
00316
00317 bool mEvokedParentChange;
00318 bool mWasVisible;
00319
00320 std::map<u32, std::string> mTextureFileNames;
00321 };
00322
00323 #endif