18#ifndef HEADER_SP_MESH_HPP
19#define HEADER_SP_MESH_HPP
23#include <IAnimatedMeshSceneNode.h>
24#include <ISkinnedMesh.h>
45friend class ::B3DMeshLoader;
46friend class ::SPMeshLoader;
48 std::vector<SPMeshBuffer*> m_buffer;
50 core::aabbox3d<f32> m_bounding_box;
54 unsigned m_bind_frame, m_total_joints, m_joint_using, m_frame_count;
56 std::vector<GE::Armature> m_all_armatures;
64 virtual u32 getFrameCount()
const {
return m_frame_count; }
66 virtual f32 getAnimationSpeed()
const {
return m_fps; }
68 virtual void setAnimationSpeed(f32 fps) { m_fps = fps; }
70 virtual IMesh* getMesh(s32 frame, s32 detailLevel=255,
71 s32 startFrameLoop=-1, s32 endFrameLoop=-1)
74 virtual void animateMesh(f32 frame, f32 blend) {}
76 virtual void skinMesh(f32 strength = 1.0f) {}
78 virtual u32 getMeshBufferCount()
const
79 {
return (
unsigned)m_buffer.size(); }
81 virtual IMeshBuffer* getMeshBuffer(u32 nr)
const;
83 virtual IMeshBuffer* getMeshBuffer(
const video::SMaterial &material)
const;
85 virtual const core::aabbox3d<f32>& getBoundingBox()
const
86 {
return m_bounding_box; }
88 virtual void setBoundingBox(
const core::aabbox3df& box)
89 { m_bounding_box = box; }
91 virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag,
bool newvalue) {}
93 virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint,
94 E_BUFFER_TYPE buffer) {}
96 virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) {}
98 virtual E_ANIMATED_MESH_TYPE getMeshType()
const {
return EAMT_SKINNED; }
100 virtual u32 getJointCount()
const {
return m_joint_using; }
102 virtual const c8* getJointName(u32 number)
const;
104 virtual s32 getJointNumber(
const c8* name)
const
110 virtual bool useAnimationFrom(
const ISkinnedMesh *mesh) {
return true; }
112 virtual void updateNormalsWhenAnimating(
bool on) {}
114 virtual void setInterpolationMode(E_INTERPOLATION_MODE mode) {}
116 virtual bool isStatic() {
return m_all_armatures.empty(); }
118 virtual bool setHardwareSkinning(
bool on) {
return true; }
120 virtual core::array<SSkinMeshBuffer*>& getMeshBuffers()
123 static auto unused = core::array<SSkinMeshBuffer*>();
127 virtual core::array<SJoint*>& getAllJoints()
130 static auto unused = core::array<SJoint*>();
134 virtual const core::array<SJoint*>& getAllJoints()
const
137 static auto unused = core::array<SJoint*>();
141 virtual void finalize();
143 virtual SSkinMeshBuffer *addMeshBuffer() {
return NULL; }
145 virtual SJoint *addJoint(SJoint *parent) {
return NULL; }
147 virtual SPositionKey *addPositionKey(SJoint *joint) {
return NULL; }
149 virtual SRotationKey *addRotationKey(SJoint *joint) {
return NULL; }
151 virtual SScaleKey *addScaleKey(SJoint *joint) {
return NULL; }
153 virtual SWeight *addWeight(SJoint *joint) {
return NULL; }
155 virtual void updateBoundingBox(
void);
157 std::vector<GE::Armature>& getArmatures() {
return m_all_armatures; }
159 void getSkinningMatrices(f32 frame, std::vector<core::matrix4>& dest,
160 float frame_interpolating = -1.0f,
float rate = -1.0f);
162 s32 getJointIDWithArm(
const c8* name,
unsigned* arm_id)
const;
164 void addSPMeshBuffer(
SPMeshBuffer* spmb) { m_buffer.push_back(spmb); }
Definition: b3d_mesh_loader.hpp:25
Definition: sp_mesh_loader.hpp:35
Definition: sp_mesh_buffer.hpp:48
Definition: sp_mesh.hpp:44