Exemplo n.º 1
0
void Actor::addBone(int parentType, const Vector3 &localPosition, const Quaternion &localRotation, const Vector3 &localScale,
        string name, int type)
{
    // 본을 생성
    Bone *parentBone = null;
	if (boneMap.find(parentType) != boneMap.end())
        parentBone = boneMap[parentType];
	Bone *bone = new Bone(parentBone, name, (Bone::BoneType)type);

	// 상대 위치 설정
	bone->setLocalEndPosition(localPosition);

    // 본의 부모상대 변환행렬 설정
	Matrix transMat, rotMat, scaleMat, localTransform;
	transMat.setTranslate(localPosition);
	rotMat.setRotate(localRotation);
	scaleMat.setScale(localScale);
	localTransform.multiply(transMat, rotMat);
	localTransform.multiply(scaleMat);
	bone->setTransformFromParent(localTransform);

    // 리스트와 맵에 추가
	boneList.push_back(bone);
	boneMap[bone->getBoneType()] = bone;
}