Exemplo n.º 1
0
 public void PrimitiveBegin(string name)
 {
     // Set primitive
     if (name == null)
     {
         devicemesh = new G3DMesh();
     }
     else
     {
         deviceprimitive = ((G3DPrimitive)primitivelist[name]);
     }
 }
Exemplo n.º 2
0
        public void MakePrimitive(string name, CustomVertex.PositionNormalTextured[] vertices, int[] indices)
        {
            // Create Primitive
            G3DPrimitive g3dprimitive = new G3DPrimitive();

            g3dprimitive.Vertices = vertices.Length;
            g3dprimitive.Indices  = indices.Length / 3;

            // Vertices
            g3dprimitive.VertexBuffer = new VertexBuffer(vertices[0].GetType(), vertices.Length, device, Usage.WriteOnly, CustomVertex.PositionNormalTextured.Format, Pool.Default);
            g3dprimitive.VertexBuffer.SetData(vertices, 0, LockFlags.None);

            //Indices
            g3dprimitive.IndexBuffer = new IndexBuffer(indices[0].GetType(), indices.Length, device, Usage.WriteOnly, Pool.Default);
            g3dprimitive.IndexBuffer.SetData(indices, 0, LockFlags.None);

            // Add to list
            primitivelist.Add(name, g3dprimitive);
        }