2 #ifndef KJY_ANIM_ENGINE_SKINNED_MESH_HPP_ 3 #define KJY_ANIM_ENGINE_SKINNED_MESH_HPP_ 7 #include <OOOGL/MidLevel/Geometry.hpp> 8 #include "EntitiesBase.hpp" 9 #include "MeshEntity.hpp" 10 #include "Skeleton.hpp" 11 #include <components/attachable/SkeletonAnimator.hpp> 13 using namespace OOOGL;
27 const std::vector<glm::vec3>& vertices,
const std::vector<GLuint> elements,
28 const std::vector<glm::vec3>& normals,
const std::vector<glm::vec2>& texcoords,
29 const std::vector<glm::uvec4>& joints,
const std::vector<glm::vec4>& weights,
bool skip_gpu_upload =
false 32 virtual const std::vector<glm::uvec4>& getJoints()
const {
return(cpu_joints_buffer_);}
33 virtual std::vector<glm::uvec4>& getMutableJoints() {
return(cpu_joints_buffer_); sync_status_ = GpuSyncStatus::GPU_STALE;}
34 virtual void replaceJoints(
const std::vector<glm::uvec4>& new_buffer) {cpu_joints_buffer_ = new_buffer; sync_status_ = GpuSyncStatus::GPU_STALE;}
36 virtual const std::vector<glm::vec4>& getVertexWeights()
const {
return(cpu_weights_buffer_);}
37 virtual std::vector<glm::vec4>& getMutableVertexWeights() {
return(cpu_weights_buffer_); sync_status_ = GpuSyncStatus::GPU_STALE;}
38 virtual void replaceVertexWeights(
const std::vector<glm::vec4>& new_buffer) {cpu_weights_buffer_ = new_buffer; sync_status_ = GpuSyncStatus::GPU_STALE;}
44 std::vector<MaterialInterface*> materials;
45 std::vector<int> material_indices;
49 virtual void _uploadData()
override;
51 std::vector<glm::uvec4> cpu_joints_buffer_;
52 std::vector<glm::vec4> cpu_weights_buffer_;
57 virtual void draw(
const MVPset& MVP,
Program* shader =
nullptr)
override;
58 virtual bool canOverrideShader()
const override {
return(
true);}
59 virtual bool requiresOverrideShader()
const override {
return(
false);}
60 virtual const Pose& getPose()
const override;
61 virtual Pose& getMutablePose();
62 virtual void setPose(
const Pose& pose)
override;
63 virtual void assignSkeleton(
Skeleton* skeleton);
64 virtual size_t numBones() {
return(_skeleton !=
nullptr ? _skeleton->numBones() : 0);}
66 virtual void setAllAnimatorsTime(key_time_t time);
67 virtual void updatePoseFromAnimators();
68 virtual void updatePoseFromSingleAnimator(
int index);
70 std::vector<SkinnedTriangleMesh> geometry;
71 std::vector<SkinKeyframeAnimator> skin_animators;
Definition: SkinnedMeshEntity.hpp:23
Definition: drawable.hpp:8
Definition: SkinnedMeshEntity.hpp:55
Definition: MeshEntity.hpp:14
Definition: Geometry.hpp:89
Definition: Core_Utilities.cpp:3
Definition: Buffers.hpp:106
Definition: Skeleton.hpp:72