Exemple #1
0
        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;
            }
        }
Exemple #2
0
 public void UpdateGeometry(GeometryDescriptor geometryDescriptor)
 {
     if (geometryDescriptor != GeometryDescriptor)
     {
         DisposeGeometry();
         GeometryDescriptor = geometryDescriptor;
     }
 }
Exemple #3
0
 public DrawDescription(GeometryDescriptor geometryDescriptor,
                        Matrix transformation,
                        Color4 color,
                        string texturePath,
                        IReadOnlyList <Matrix> instanceTransformations,
                        IReadOnlyList <Color4> instanceColors)
     : this(geometryDescriptor)
 {
     Update(transformation, color, texturePath, instanceTransformations, instanceColors);
 }
Exemple #4
0
 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);
 }
Exemple #5
0
 public DrawGeometryDescription(GeometryDescriptor geometryDescriptor)
 {
     GeometryDescriptor = geometryDescriptor ?? new BoxDescriptor();
 }
Exemple #6
0
        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;
            }
        }