25 #ifndef __I6ENGINE_MODULES_COMPONENTS_MESHCOMPONENT_H__
26 #define __I6ENGINE_MODULES_COMPONENTS_MESHCOMPONENT_H__
53 class BoundingBoxComponent;
54 class GraphicsManager;
83 Ogre::SceneNode * _sceneNode;
88 Ogre::AnimationState * _animationState;
90 double _animationSpeed;
93 uint64_t _lastFrameTime;
95 std::vector<int64_t> _movableTextObservers;
96 std::vector<int64_t> _boundingBoxObservers;
98 std::map<GraphicsNode *, std::string> _attachedNodes;
99 struct sortFrameFunctions {
100 bool operator()(
const std::pair<uint64_t, std::function<
void(
void)>> & a,
const std::pair<uint64_t, std::function<
void(
void)>> & b)
const {
101 return !(a.first < b.first);
105 std::priority_queue<std::pair<uint64_t, std::function<void(void)>>, std::vector<std::pair<uint64_t, std::function<void(void)>>>, sortFrameFunctions> _queueA;
106 std::priority_queue<std::pair<uint64_t, std::function<void(void)>>, std::vector<std::pair<uint64_t, std::function<void(void)>>>, sortFrameFunctions> _queueB;
114 MeshComponent(GraphicsManager * manager,
GraphicsNode * parent,
const int64_t goid,
const int64_t coid,
const std::string & meshName,
const bool visible,
const Vec3 & position,
const Quaternion & rotation,
const Vec3 & scale);
121 void updateMeshComponent(
const std::string & meshName,
const bool visible);
123 void setVisibility(
bool visible);
125 void setShadowCasting(
bool enabled);
134 void setMaterial(
const std::string & materialName);
145 void setCustomParameter(uint32_t num,
const Vec4 & value);
150 void playAnimation(
const std::string & anim,
bool looping,
double offsetPercent);
155 void setAnimationSpeed(
double animationSpeed) {
156 _animationSpeed = animationSpeed;
162 void stopAnimation();
168 void addAnimationFrameEvent(uint64_t frameTime,
const std::function<
void(
void)> & func);
172 void addMovableTextObserver(int64_t coid) {
173 _movableTextObservers.push_back(coid);
176 void removeMovableTextObserver(int64_t coid);
178 void addBoundingBoxObserver(int64_t coid) {
179 _boundingBoxObservers.push_back(coid);
182 void removeBoundingBoxObserver(int64_t coid);
184 Ogre::Entity * getEntity()
const;
186 void attachToBone(
GraphicsNode * otherNode,
const std::string & boneName);
193 MeshComponent(
const MeshComponent &) =
delete;
198 const MeshComponent & operator=(
const MeshComponent &) =
delete;
Implements 4-dimensional vectors.
Saves all graphics-related data associated with one GameObject.
Class describing a 3d rotation.
Handles all light related functionality.
Implements 3-dimensional vectors.
Handles all light related functionality.
friend class GraphicsNode
#define ASSERT_THREAD_SAFETY_HEADER
Handles all light related functionality.