Bones used in skeletal animation Thread safety - This class is thread safe.
Example #1
0
File: Bone.cs Project: tpb3d/TPB3D
		public Bone(string name, Bone parent, Matrix4 localRotationMatrix, Matrix4 localTranslationMatrix, KeyFrame[] keyFrames)
		{
			this.name = name;
			this.parent = parent;
			
			this.localRotationMatrix = localRotationMatrix;
			this.localTranslationMatrix = localTranslationMatrix;
			this.localTransformationMatrix = localRotationMatrix * localTranslationMatrix;

			this.globalTransformationMatrix = this.GetGlobalTransformationMatrix();
			
			this.keyFrames = keyFrames;			
		}
Example #2
0
File: Model.cs Project: tpb3d/TPB3D
		public Model(ShaderProgram shader, Group[] groups, Bone[] bones, Sample[] samples)
		{
			this.shader = shader;
			this.groups = groups;
			this.bones = bones;
            this.samples = samples;
			
			this.vertexTransformations = new Matrix4[maxBones];
			for (int i = 0; i < maxBones ; i++ ) 
			{
				this.vertexTransformations[i] = Matrix4.Identity;
			}
			
			Console.WriteLine(string.Format("Model created with {0} bones and {1} groups.", bones.Length, groups.Length));
			
			shader.Use();
			shader.SetSamplerUniform(sampler0UniformName, 0);
			this.boneAttribIndex = shader.FindAttribIndex(boneAttributeName);
		}