public static IDX11Geometry GetGeometry(DX11RenderContext context, GeometryDescriptor descriptor) { switch (descriptor.Type) { case PrimitiveType.Quad: return(context.Primitives.QuadNormals(((QuadDescriptor)descriptor).Settings)); break; case PrimitiveType.RoundQuad: return(context.Primitives.RoundRect(((RoundQuadDescriptor)descriptor).Settings)); break; case PrimitiveType.Box: return(context.Primitives.Box(((BoxDescriptor)descriptor).Settings)); break; case PrimitiveType.Disc: return(context.Primitives.Segment(((DiscDescriptor)descriptor).Settings)); break; case PrimitiveType.Sphere: return(context.Primitives.Sphere(((SphereDescriptor)descriptor).Settings)); break; case PrimitiveType.Cylinder: return(context.Primitives.Cylinder(((CylinderDescriptor)descriptor).Settings)); break; case PrimitiveType.Tube: return(context.Primitives.SegmentZ(((TubeDescriptor)descriptor).Settings)); break; case PrimitiveType.Line: return(context.Primitives.LineStrip3d(((LineDescriptor)descriptor).Settings, false)); break; case PrimitiveType.Sprites: return(CreateNullGeometry(context)); break; default: var settings = new Quad() { Size = new SlimDX.Vector2(1) }; return(context.Primitives.QuadNormals(settings)); break; } }
public void UpdateGeometry(GeometryDescriptor geometryDescriptor) { if (geometryDescriptor != GeometryDescriptor) { DisposeGeometry(); GeometryDescriptor = geometryDescriptor; } }
public DrawDescription(GeometryDescriptor geometryDescriptor, Matrix transformation, Color4 color, string texturePath, IReadOnlyList <Matrix> instanceTransformations, IReadOnlyList <Color4> instanceColors) : this(geometryDescriptor) { Update(transformation, color, texturePath, instanceTransformations, instanceColors); }
public DrawGeometryDescription(GeometryDescriptor geometryDescriptor, Matrix transformation, Color4 color, string texturePath, BlendMode blendMode, ShadingType shading, IReadOnlyCollection <Matrix> instanceTransformations, IReadOnlyCollection <Color4> instanceColors) : this(geometryDescriptor) { Update(transformation, color, texturePath, blendMode, shading, instanceTransformations, instanceColors); }
public DrawGeometryDescription(GeometryDescriptor geometryDescriptor) { GeometryDescriptor = geometryDescriptor ?? new BoxDescriptor(); }
public static IDX11Geometry GetGeometry(DX11RenderContext context, GeometryDescriptor descriptor) { switch (descriptor.Type) { case PrimitiveType.Quad: return(context.Primitives.QuadNormals(((QuadDescriptor)descriptor).Settings)); break; case PrimitiveType.RoundQuad: return(context.Primitives.RoundRect(((RoundQuadDescriptor)descriptor).Settings)); break; case PrimitiveType.Box: return(context.Primitives.Box(((BoxDescriptor)descriptor).Settings)); break; case PrimitiveType.Disc: return(context.Primitives.Segment(((DiscDescriptor)descriptor).Settings)); break; case PrimitiveType.Polygon: return(Polygon2D(context, ((PolygonDescriptor)descriptor).Positions)); break; case PrimitiveType.Sphere: return(context.Primitives.Sphere(((SphereDescriptor)descriptor).Settings)); break; case PrimitiveType.Cylinder: return(context.Primitives.Cylinder(((CylinderDescriptor)descriptor).Settings)); break; case PrimitiveType.Tube: return(context.Primitives.SegmentZ(((TubeDescriptor)descriptor).Settings)); break; case PrimitiveType.Line: var lineDesc = (LineDescriptor)descriptor; return(LineStrip3d(context, lineDesc.Positions, lineDesc.Directions, lineDesc.IsClosed)); break; case PrimitiveType.MeshJoin: var meshDesc = (MeshJoinDescriptor)descriptor; if (meshDesc.Topology == MeshTopology.TriangleList || meshDesc.Topology == MeshTopology.Undefined) { return(CreateIndexedGeometry(context, meshDesc.Positions, meshDesc.Directions, meshDesc.Tex, meshDesc.Indices)); } else { return(CreateVertexGeometry(context, meshDesc.Positions, meshDesc.Directions, meshDesc.Tex, meshDesc.Topology)); } break; case PrimitiveType.Sprites: return(CreateNullGeometry(context)); break; case PrimitiveType.Text: var textDesc = (TextDescriptor)descriptor; return(Text3d(context, textDesc.Text, textDesc.FontName, textDesc.FontSize, textDesc.Extrude, (TextAlignment)textDesc.TextAlignment, (ParagraphAlignment)textDesc.ParagraphAlignment)); break; default: var settings = new Quad() { Size = new SlimDX.Vector2(1) }; return(context.Primitives.QuadNormals(settings)); break; } }