Пример #1
0
 private SharpDX.Direct3D11.InputElement[] ConvertElements( VertexElement [] elements )
 {
     SharpDX.Direct3D11.InputElement [] e = new SharpDX.Direct3D11.InputElement [ elements.Length ];
     int offset = 0;
     for ( int i = 0; i < e.Length; ++i )
     {
         e [ i ] = new SharpDX.Direct3D11.InputElement ( ConvertUsage ( elements [ i ].Type ),
             elements [ i ].UsageIndex, ConvertType ( elements[i].Size ), offset, 0 );
         offset += ConvertRealSize ( elements [ i ].Size );
     }
     return e;
 }
Пример #2
0
        public VertexDeclaration( IGraphicsDevice graphicsDevice, VertexElement [] elements )
        {
            this.elements = elements.GetEnumerator ();
            SharpDX.Direct3D9.Device device = graphicsDevice.Handle as SharpDX.Direct3D9.Device;

            SharpDX.Direct3D9.VertexElement [] convedElements = new SharpDX.Direct3D9.VertexElement [ elements.Length + 1 ];
            for ( int i = 0, offset = 0; i < elements.Length; ++i )
            {
                convedElements [ i ] = new SharpDX.Direct3D9.VertexElement ( 0, ( short ) offset,
                    ConvertType ( elements [ i ].Size ), SharpDX.Direct3D9.DeclarationMethod.Default,
                    ConvertType ( elements [ i ].Type ), ( byte ) elements [ i ].UsageIndex );
                offset += ElementSizeToRealSize ( elements [ i ].Size );
            }
            convedElements [ elements.Length ] = SharpDX.Direct3D9.VertexElement.VertexDeclarationEnd;

            vertexDeclaration = new SharpDX.Direct3D9.VertexDeclaration ( device, convedElements );
        }
Пример #3
0
 public VertexDeclaration( IGraphicsDevice graphicsDevice, VertexElement [] elements )
 {
     e = ConvertElements ( elements );
     this.elements = elements;
 }