Axiom.Core.BillboardChain.SetupVertexDeclaration C# (CSharp) Method

SetupVertexDeclaration() protected method

protected SetupVertexDeclaration ( ) : void
return void
		protected virtual void SetupVertexDeclaration()
		{
			if ( this.vertexDeclDirty )
			{
				VertexDeclaration decl = this.vertexData.vertexDeclaration;
				decl.RemoveAllElements();

				int offset = 0;
				// Add a description for the buffer of the positions of the vertices
				decl.AddElement( 0, offset, VertexElementType.Float3, VertexElementSemantic.Position );
				offset += VertexElement.GetTypeSize( VertexElementType.Float3 );

				if ( this.useVertexColor )
				{
					decl.AddElement( 0, offset, VertexElementType.Color, VertexElementSemantic.Diffuse );
					offset += VertexElement.GetTypeSize( VertexElementType.Color );
				}

				if ( this.useTexCoords )
				{
					decl.AddElement( 0, offset, VertexElementType.Float2, VertexElementSemantic.TexCoords );
					offset += VertexElement.GetTypeSize( VertexElementType.Float2 );
				}

				if ( !this.useTexCoords && !this.useVertexColor )
				{
					LogManager.Instance.Write( "Error - BillboardChain '{0}' is using neither texture " +
											   "coordinates or vertex colors; it will not be visible " +
											   "on some rendering API's so you should change this so you " +
											   "use one or the other." );
				}
				this.vertexDeclDirty = false;
			}
		}