A pose is a linked set of vertex offsets applying to one set of vertex data.
The target index referred to by the pose has a meaning set by the user of this class; but for example when used by Mesh it refers to either the Mesh shared geometry (0) or a SubMesh dedicated geometry (1+). Pose instances can be referred to by keyframes in VertexAnimationTrack in order to animate based on blending poses together.
示例#1
0
		/// <summary>
		///     Create a new Pose for this mesh or one of its submeshes.
		/// </summary>
		/// <param name="target">
		///     The target geometry index; 0 is the shared Mesh geometry, 1+ is the
		///    	dedicated SubMesh geometry belonging to submesh index + 1.
		/// </param>
		/// <param name="name">Name to give the pose, which is optional</param>
		/// <returns>A new Pose ready for population</returns>
		public Pose CreatePose( ushort target, string name )
		{
			var retPose = new Pose( target, name );
			PoseList.Add( retPose );
			return retPose;
		}
示例#2
0
		protected void WritePose( BinaryWriter writer, Pose pose )
		{
			var start_offset = writer.Seek( 0, SeekOrigin.Current );
			WriteChunk( writer, MeshChunkID.Pose, 0 );

			WriteString( writer, pose.Name );
			WriteUShort( writer, pose.Target );
			foreach ( var kvp in pose.VertexOffsetMap )
			{
				WritePoseVertex( writer, kvp.Key, kvp.Value );
			}

			var end_offset = writer.Seek( 0, SeekOrigin.Current );
			writer.Seek( (int)start_offset, SeekOrigin.Begin );
			WriteChunk( writer, MeshChunkID.Pose, (int)( end_offset - start_offset ) );
			writer.Seek( (int)end_offset, SeekOrigin.Begin );
		}
示例#3
0
		/// <summary> Utility method for applying pose animation </summary>
		public void ApplyPoseToVertexData( Pose pose, VertexData data, float influence )
		{
			if ( targetMode == VertexAnimationTargetMode.Hardware )
			{
				// Hardware
				// If target mode is hardware, need to bind our pose buffer
				// to a target texcoord
				Debug.Assert( data.HWAnimationDataList.Count == 0,
							 "Haven't set up hardware vertex animation elements!" );
				// no use for TempBlendedBufferInfo here btw
				// Set pose target as required
				int hwIndex = data.HWAnimDataItemsUsed++;
				// If we try to use too many poses, ignore extras
				if ( hwIndex < data.HWAnimationDataList.Count )
				{
					HardwareAnimationData animData = data.HWAnimationDataList[ hwIndex ];
					data.vertexBufferBinding.SetBinding( animData.TargetVertexElement.Source,
														pose.GetHardwareVertexBuffer( data.vertexCount ) );
					// save final influence in parametric
					animData.Parametric = influence;
				}
			}
			else
			{
				// Software
				Mesh.SoftwareVertexPoseBlend( influence, pose.VertexOffsetMap, data );
			}
		}