Exemple #1
0
 /// <summary>
 /// 创建一个mesh对象,不使用索引缓冲
 /// </summary>
 /// <param name="pt"></param>
 /// <param name="vb"></param>
 /// <param name="vd"></param>
 public Mesh(PrimitiveType pt, VertexBuffer vb, VertexDeclaration vd)
 {
     this.is_visible = true;
     this.vertices_count = vb.SizeInBytes / vd.GetVertexStrideSize(0);
     this.draw_mode = DrawMode.Primitive;
     this.primitive_type = pt;
     this.vb = vb;
     this.vd = vd;
     this.primitive_count = CalcPrimitiveCount();
 }
Exemple #2
0
 internal ModelMeshPart(int streamOffset, int baseVertex, int numVertices, int startIndex, int primitiveCount, VertexBuffer vertexBuffer, IndexBuffer indexBuffer, VertexDeclaration vertexDeclaration, object tag)
 {
     this.vertexBuffer      = vertexBuffer;
     this.indexBuffer       = indexBuffer;
     this.streamOffset      = streamOffset;
     this.baseVertex        = baseVertex;
     this.numVertices       = numVertices;
     this.startIndex        = startIndex;
     this.primitiveCount    = primitiveCount;
     this.vertexDeclaration = vertexDeclaration;
     this.tag          = tag;
     this.vertexStride = vertexDeclaration.GetVertexStrideSize(0);
 }
Exemple #3
0
 public c0001a1(int p0, int p1, int p2, int p3, int p4, VertexBuffer p5, IndexBuffer p6, VertexDeclaration p7, object p8)
 {
     this.f000095 = p5;
     this.f0001c1 = p6;
     this.f000016 = p0;
     this.f00000b = p1;
     this.f00000f = p2;
     this.f000011 = p3;
     this.f000010 = p4;
     this.f000098 = p7;
     this.f00000e = p8;
     this.f000020 = p7.GetVertexStrideSize(0);
 }
Exemple #4
0
 internal ModelMeshPart(int streamOffset, int baseVertex, int numVertices, int startIndex, int primitiveCount, VertexBuffer vertexBuffer, IndexBuffer indexBuffer, VertexDeclaration vertexDeclaration, object tag)
 {
     this.vertexBuffer = vertexBuffer;
     this.indexBuffer = indexBuffer;
     this.streamOffset = streamOffset;
     this.baseVertex = baseVertex;
     this.numVertices = numVertices;
     this.startIndex = startIndex;
     this.primitiveCount = primitiveCount;
     this.vertexDeclaration = vertexDeclaration;
     this.tag = tag;
     this.vertexStride = vertexDeclaration.GetVertexStrideSize(0);
 }
 void CreateBuffers()
 {
     vertexDecl = new VertexDeclaration(graphics.GraphicsDevice, VertexElements);
     VertexPositionIndexTexture[] vertexData = new VertexPositionIndexTexture[256 * 6];
     for (int i = 0; i < 256; i++)
     {
         vertexData[i * 6 + 0].Position = new Vector3(1, 1, 0);
         vertexData[i * 6 + 1].Position = new Vector3(1, -1, 0);
         vertexData[i * 6 + 2].Position = new Vector3(-1, -1, 0);
         vertexData[i * 6 + 3].Position = new Vector3(-1, -1, 0);
         vertexData[i * 6 + 4].Position = new Vector3(-1, 1, 0);
         vertexData[i * 6 + 5].Position = new Vector3(1, 1, 0);
         vertexData[i * 6 + 0].TexCoo = new GameVector(1, 1);
         vertexData[i * 6 + 1].TexCoo = new GameVector(1, 0);
         vertexData[i * 6 + 2].TexCoo = new GameVector(0, 0);
         vertexData[i * 6 + 3].TexCoo = new GameVector(0, 0);
         vertexData[i * 6 + 4].TexCoo = new GameVector(0, 1);
         vertexData[i * 6 + 5].TexCoo = new GameVector(1, 1);
         vertexData[i * 6 + 0].Index = i;
         vertexData[i * 6 + 1].Index = i;
         vertexData[i * 6 + 2].Index = i;
         vertexData[i * 6 + 3].Index = i;
         vertexData[i * 6 + 4].Index = i;
         vertexData[i * 6 + 5].Index = i;
     }
     vertexBuffer = new VertexBuffer(graphics.GraphicsDevice, vertexData.Length * vertexDecl.GetVertexStrideSize(0),
         BufferUsage.None);
     vertexBuffer.SetData<VertexPositionIndexTexture>(vertexData);
     indexBuffer = new IndexBuffer(graphics.GraphicsDevice, 16 * vertexData.Length,
          BufferUsage.None, IndexElementSize.SixteenBits);
     UInt16[] indexData = new ushort[vertexData.Length];
     for (ushort i = 0; i < indexData.Length; i++)
         indexData[i] = i;
     indexBuffer.SetData<UInt16>(indexData);
 }