AddIndexData() public method

Add a set of index geometry data to the edge builder.
You must add at least one set of index data to the builder before invoking the method.
public AddIndexData ( IndexData indexData ) : void
indexData IndexData The index information which describes the triangles.
return void
Beispiel #1
0
		/// <summary>
		///    Adds the vertex and index sets necessary for a builder instance
		///    to iterate over the triangles in a mesh
		/// </summary>
		public void AddVertexAndIndexSets( AnyBuilder builder, int lodIndex )
		{
			var vertexSetCount = 0;

			if ( this._sharedVertexData != null )
			{
				builder.AddVertexData( this._sharedVertexData );
				vertexSetCount++;
			}

			// Prepare the builder using the submesh information
			for ( var i = 0; i < this._subMeshList.Count; i++ )
			{
				var sm = this._subMeshList[ i ];

				if ( sm.useSharedVertices )
				{
					// Use shared vertex data, index as set 0
					if ( lodIndex == 0 )
					{
						// Use shared vertex data, index as set 0
						builder.AddIndexData( sm.indexData, 0, sm.operationType );
					}
					else
					{
						builder.AddIndexData( sm.lodFaceList[ lodIndex - 1 ], 0, sm.operationType );
					}
				}
				else
				{
					// own vertex data, add it and reference it directly
					builder.AddVertexData( sm.vertexData );

					if ( lodIndex == 0 )
					{
						// base index data
						builder.AddIndexData( sm.indexData, vertexSetCount++, sm.operationType );
					}
					else
					{
						// LOD index data
						builder.AddIndexData( sm.lodFaceList[ lodIndex - 1 ], vertexSetCount++, sm.operationType );
					}
				}
			}
		}