12#define ERRORTIME -2321.51
38 std::vector<std::shared_ptr<ModelObject>>
child;
39 std::vector<std::shared_ptr<ModelObject>>
parent;
207 printf(
"********** step: %d ***********\n%f,%f,%f,%f\n%f,%f,%f,%f\n%f,%f,%f,%f\n%f,%f,%f,%f\n ***********************\n\n",
209 c(0, 0), c(0, 1), c(0, 2), c(0, 3),
210 c(1, 0), c(1, 1), c(1, 2), c(1, 3),
211 c(2, 0), c(2, 1), c(2, 2), c(2, 3),
212 c(3, 0), c(3, 1), c(3, 2), c(3, 3)
218 template<
typename Vec3f,
typename Mat4f>
228 template<
typename Vec3f,
typename Mat4f>
239 template<
typename Vec3f,
typename u
int>
253 for (
auto obj : objects)
255 maxId = maxId >= obj->id ? maxId : obj->id;
257 std::vector<Mat4f> meshWorldMatrix(maxId + 1);
259 for (
auto obj : objects)
262 meshWorldMatrix[obj->id] = obj->worldTransform;
264 return meshWorldMatrix;
268 std::vector<std::shared_ptr<Shape>>& shapes,
280 void buildTree(std::string& str,
const std::vector<std::shared_ptr<ModelObject>>& child,
uint level)
284 for (
auto chi : child)
286 for (
size_t i = 0; i < level; i++)
291 str.append(chi->name);
301 std::vector<std::shared_ptr<MeshInfo>>
mMeshes;
302 std::vector<std::shared_ptr<Bone>>
mBones;
Implementation of quaternion.
void getVerticesNormalInBindPose(DArray< Vec3f > &initialNormal, DArray< Mat4f > &joint_inverseBindMatrix, DArray< Mat4f > &WorldMatrix, DArrayList< int > &point2Vertice, DArray< Vec4f > &bind_joints_0, DArray< Vec4f > &bind_joints_1, DArray< Vec4f > &bind_joints_2, DArray< Vec4f > &weights_0, DArray< Vec4f > &weights_1, DArray< Vec4f > &weights_2, Vec2u range)
std::vector< Mat4f > mBoneLocalMatrix
void skinVerticesAnimation(DArray< Vec3f > &intialVertices, DArray< Vec3f > &Vertices, DArray< Mat4f > &joint_inverseBindMatrix, DArray< Mat4f > &WorldMatrix, DArrayList< int > &point2Vertice, DArray< Vec4f > &bind_joints_0, DArray< Vec4f > &bind_joints_1, DArray< Vec4f > &bind_joints_2, DArray< Vec4f > &weights_0, DArray< Vec4f > &weights_1, DArray< Vec4f > &weights_2, Mat4f transform, bool isNormal, Vec2u range)
Real lerp(Real v0, Real v1, float weight)
void c_skinVerticesAnimation(DArray< Vec3f > &intialVertices, DArray< Vec3f > &Vertices, DArray< Mat4f > &joint_inverseBindMatrix, DArray< Mat4f > &WorldMatrix, DArrayList< int > &point2Vertice, DArray< Vec4f > &bind_joints_0, DArray< Vec4f > &bind_joints_1, DArray< Vec4f > &bind_joints_2, DArray< Vec4f > &weights_0, DArray< Vec4f > &weights_1, DArray< Vec4f > &weights_2, Mat4f transform, bool isNormal, Vec2u range)
std::shared_ptr< JointAnimationInfo > mJointAnimationData
std::shared_ptr< SkinInfo > mSkinData
void updateInverseBindMatrix()
int findMeshIndexByName(std::string name)
void buildTree(std::string &str, const std::vector< std::shared_ptr< ModelObject > > &child, uint level)
std::vector< Mat4f > mBoneWorldMatrix
void shapeTransform(DArray< Vec3f > &intialPosition, DArray< Vec3f > &worldPosition, DArray< Vec3f > &intialNormal, DArray< Vec3f > &Normal, DArray< Mat4f > &WorldMatrix, DArray< uint > &vertexId_shape, DArray< int > &shapeId_MeshId)
void skinAnimation(DArray< Vec3f > &intialPosition, DArray< Vec3f > &worldPosition, DArray< Mat4f > &joint_inverseBindMatrix, DArray< Mat4f > &WorldMatrix, DArray< Vec4f > &bind_joints_0, DArray< Vec4f > &bind_joints_1, DArray< Vec4f > &bind_joints_2, DArray< Vec4f > &weights_0, DArray< Vec4f > &weights_1, DArray< Vec4f > &weights_2, Mat4f transform, bool isNormal, Vec2u range)
void flipNormal(DArray< Vec3f > &Normal)
std::vector< std::shared_ptr< MeshInfo > > mMeshes
std::shared_ptr< ModelObject > getObjectByName(std::string name)
void coutMatrix(int id, Mat4f c)
std::vector< Mat4f > mBoneInverseBindMatrix
std::vector< std::shared_ptr< Bone > > mBones
void computeTexMeshVerticesNormal(std::vector< std::shared_ptr< Shape > > &shapes, DArray< Vec3f > &Position, DArray< Vec3f > &Normal, DArray< int > *vertices2Point=nullptr)
void updateBoneWorldMatrix()
void shapeToCenter(DArray< Vec3f > &iniPos, DArray< Vec3f > &finalPos, DArray< uint > &shapeId, DArray< Vec3f > &t)
int findObjectIndexByName(std::string name)
std::shared_ptr< JointAnimationInfo > & getJointAnimation()
int getObjIndexByName(std::string name)
std::vector< Vec3f > mBoneScales
std::vector< Vec3f > mBoneRotations
int findMaxSmallerIndex(const std::vector< float > &arr, float v)
void textureMeshTransform(DArray< Vec3f > &intialPosition, DArray< Vec3f > &worldPosition, DArray< Vec3f > &intialNormal, DArray< Vec3f > &Normal, Mat4f &WorldMatrix)
std::shared_ptr< JointInfo > mJointData
void updateSkinData(std::shared_ptr< TextureMesh > texMesh)
void updatePoint2Vertice(DArrayList< int > &d_p2v, DArray< int > &d_v2p)
Mat4f createLocalTransform(std::shared_ptr< ModelObject > object)
Real getVectorDataByTime(std::vector< Real > data, std::vector< Real > timeCode, Real time)
std::vector< std::shared_ptr< ModelObject > > mModelObjects
std::vector< std::shared_ptr< MeshInfo > > & getMeshes()
void updateWorldTransformByKeyFrame(Real time)
void pushBackMesh(std::shared_ptr< MeshInfo > mesh)
void pushBackBone(std::shared_ptr< Bone > bone)
void coutBoneHierarchial()
int getBoneIndexByName(std::string name)
void updateMeshWorldMatrix()
std::vector< Vec3f > mBoneTranslations
std::vector< std::shared_ptr< Bone > > & getBones()
std::vector< Mat4f > getObjectWorldMatrix()
void resizeSkin(int size)
std::vector< Vec3f > normals
std::vector< Vec4f > boneIndices0
std::vector< Vec3f > vertices
std::vector< CArrayList< uint > > facegroup_polygons
std::map< int, std::vector< int > > pointId_verticeId
std::vector< Vec4f > boneIndices2
std::vector< Vec2f > texcoords
std::vector< Vec4f > boneWeights2
std::vector< std::vector< TopologyModule::Triangle > > facegroup_triangles
std::vector< Vec4f > boneWeights0
std::vector< Vec4f > boneWeights1
std::vector< std::shared_ptr< Material > > materials
std::vector< std::vector< TopologyModule::Triangle > > facegroup_normalIndex
std::vector< int > verticeId_pointId
std::vector< Vec4f > boneIndices1
std::vector< Vec3f > verticesColor
std::vector< Vec3f > points
std::vector< Transform3f > boundingTransform
std::vector< TAlignedBox3D< Real > > boundingBox
bool operator==(const ModelObject &model)
std::vector< std::shared_ptr< ModelObject > > parent
std::vector< std::shared_ptr< ModelObject > > child
This is an implementation of AdditiveCCD based on peridyno.
Array< T, DeviceType::GPU > DArray
Vector< uint32_t, 2 > Vec2u
ArrayList< ElementType, DeviceType::GPU > DArrayList
SquareMatrix< float, 4 > Mat4f