public Bone(GraphicsDevice graphicsDevice, Bone parent, string name, BoneType type, Vector3 size, Vector3 center) { this.parent = parent; this.name = name; this.type = type; cube = new CubePrimitive(graphicsDevice, size, center); transform = Matrix.CreateScale(new Vector3(1f)) * Matrix.CreateFromQuaternion(Quaternion.Identity) * Matrix.CreateTranslation(Vector3.Zero); localTransform = transform; }
private void addBone(GraphicsDevice graphicsDevice, Bone.BoneType parentType, Vector3 localPosition, Quaternion localRotation, Vector3 localScale, string name, Bone.BoneType type, Vector3 size, Vector3 center) { // 본을 생성 Bone parentBone = null; if (boneMap.ContainsKey(parentType)) parentBone = boneMap[parentType]; Bone bone = new Bone(graphicsDevice, parentBone, name, type, size, center); // 본의 부모상대 변환행렬 설정 Matrix localTransform = Matrix.CreateScale(localScale) * Matrix.CreateFromQuaternion(localRotation) * Matrix.CreateTranslation(localPosition); bone.LocalTransform = localTransform; // 리스트와 맵에 추가 boneList.Add(bone); boneMap[bone.Type] = bone; }