Struct used to hold hardware morph / pose vertex data information
Exemple #1
0
        /// <summary>
        ///     Allocate elements to serve a holder of morph / pose target data
        ///	    for hardware morphing / pose blending.
        /// </summary>
        /// <remarks>
        ///		This method will allocate the given number of 3D texture coordinate
        ///		sets for use as a morph target or target pose offset (3D position).
        ///		These elements will be saved in hwAnimationDataList.
        ///		It will also assume that the source of these new elements will be new
        ///		buffers which are not bound at this time, so will start the sources to
        ///		1 higher than the current highest binding source. The caller is
        ///		expected to bind these new buffers when appropriate. For morph animation
        ///		the original position buffer will be the 'from' keyframe data, whilst
        ///		for pose animation it will be the original vertex data.
        /// </remarks>
        public void AllocateHardwareAnimationElements(ushort count)
        {
            // Find first free texture coord set
            short texCoord = 0;

            for (var i = 0; i < this.vertexDeclaration.ElementCount; i++)
            {
                var element = this.vertexDeclaration.GetElement(i);
                if (element.Semantic == VertexElementSemantic.TexCoords)
                {
                    ++texCoord;
                }
            }
            Debug.Assert(texCoord <= Config.MaxTextureCoordSets);

            // Increase to correct size
            for (var c = this.HWAnimationDataList.Count; c < count; ++c)
            {
                // Create a new 3D texture coordinate set
                var data = new HardwareAnimationData();
                data.TargetVertexElement = this.vertexDeclaration.AddElement(this.vertexBufferBinding.NextIndex, 0,
                                                                             VertexElementType.Float3,
                                                                             VertexElementSemantic.TexCoords, texCoord++);

                this.HWAnimationDataList.Add(data);
                // Vertex buffer will not be bound yet, we expect this to be done by the
                // caller when it becomes appropriate (e.g. through a VertexAnimationTrack)
            }
        }
Exemple #2
0
		/// <summary>
		///     Allocate elements to serve a holder of morph / pose target data
		///	    for hardware morphing / pose blending.
		/// </summary>
		/// <remarks>
		///		This method will allocate the given number of 3D texture coordinate
		///		sets for use as a morph target or target pose offset (3D position).
		///		These elements will be saved in hwAnimationDataList.
		///		It will also assume that the source of these new elements will be new
		///		buffers which are not bound at this time, so will start the sources to
		///		1 higher than the current highest binding source. The caller is
		///		expected to bind these new buffers when appropriate. For morph animation
		///		the original position buffer will be the 'from' keyframe data, whilst
		///		for pose animation it will be the original vertex data.
		/// </remarks>
		public void AllocateHardwareAnimationElements( ushort count )
		{
			// Find first free texture coord set
			short texCoord = 0;
			for ( int i = 0; i < vertexDeclaration.ElementCount; i++ )
			{
				VertexElement element = vertexDeclaration.GetElement( i );
				if ( element.Semantic == VertexElementSemantic.TexCoords )
					++texCoord;
			}
			Debug.Assert( texCoord <= Config.MaxTextureCoordSets );

			// Increase to correct size
			for ( int c = HWAnimationDataList.Count; c < count; ++c )
			{
				// Create a new 3D texture coordinate set
				HardwareAnimationData data = new HardwareAnimationData();
				data.TargetVertexElement = vertexDeclaration.AddElement( vertexBufferBinding.NextIndex, 0, VertexElementType.Float3, VertexElementSemantic.TexCoords, texCoord++ );

				HWAnimationDataList.Add( data );
				// Vertex buffer will not be bound yet, we expect this to be done by the
				// caller when it becomes appropriate (e.g. through a VertexAnimationTrack)
			}
		}