Exemplo n.º 1
0
 public IDxGeometry GetByPrimitiveType(string ptype, Dictionary <string, object> properties)
 {
     if (this.primitivecreator.ContainsKey(ptype))
     {
         AbstractPrimitiveDescriptor descriptor = this.primitivecreator[ptype]();
         descriptor.Initialize(properties);
         return(descriptor.GetGeometry(this.device));
     }
     else
     {
         throw new Exception("Unknown Primitive Type");
     }
 }
Exemplo n.º 2
0
        private DX11IndexedGeometry FromAppender(AbstractPrimitiveDescriptor descriptor, ListGeometryAppender appender, PrimitiveInfo info)
        {
            DX11IndexedGeometry geom = new DX11IndexedGeometry(device);

            geom.Tag            = descriptor;
            geom.PrimitiveType  = descriptor.PrimitiveType;
            geom.VertexBuffer   = DX11VertexBuffer.CreateImmutable(device, appender.Vertices.ToArray());
            geom.IndexBuffer    = DX11IndexBuffer.CreateImmutable(device, appender.Indices.ToArray());
            geom.InputLayout    = Pos4Norm3Tex2Vertex.Layout;
            geom.Topology       = PrimitiveTopology.TriangleList;
            geom.HasBoundingBox = info.IsBoundingBoxKnown;
            geom.BoundingBox    = info.BoundingBox;
            return(geom);
        }