예제 #1
0
        public static Model New(DirectXDevice device, float diameter = 1.0f, int tessellation = 4, float tileX = 1.0f,
                                float tileY = 1.0f, PrimitiveTopology primitiveTopology       = PrimitiveTopology.TriangleList, ModelOperation modelOperations = ModelOperation.None)
        {
            var geoSphere = new GeoSphere(diameter, tessellation, tileX, tileY);

            VertexPositionNormalTexture[] vertices;
            int[] indices;
            geoSphere.Create(out vertices, out indices);
            return(GeometricPrimitive.New(device, "GeoSphere", vertices, indices, primitiveTopology, modelOperations));
        }
예제 #2
0
        public static Model New(DirectXDevice device, Vector3 topLeftVertex, float width, float height, float tileX = 1.0f, float tileY = 1.0f,
                                PrimitiveTopology primitiveTopology = PrimitiveTopology.TriangleList, ModelOperation modelOperations    = ModelOperation.None)
        {
            var quad = new QuadMesh(topLeftVertex, width, height, tileX, tileY);

            VertexPositionNormalTexture[] vertices;
            int[] indices;
            quad.GenerateMesh(out vertices, out indices);
            return(GeometricPrimitive.New(device, Key, vertices, indices, primitiveTopology, modelOperations));
        }
예제 #3
0
        public static Model New(DirectXDevice device, float width = 1.0f, float height = 1.0f, float depth = 1.0f, float tileX = 1.0f, float tileY = 1.0f, float tileZ = 1.0f, PrimitiveTopology primitiveTopology = PrimitiveTopology.TriangleList,
                                ModelOperation modelOperations    = ModelOperation.None)
        {
            BoxCubeMapMesh cube = new BoxCubeMapMesh(width, height, depth, tileX, tileY, tileZ);

            VertexPositionNormalTextureCube[] vertices;
            int[] indices;
            cube.GenerateMesh(out vertices, out indices);

            return(GeometricPrimitive <VertexPositionNormalTextureCube> .New(device, "CubeUVW", vertices, indices, primitiveTopology, modelOperations));
        }
예제 #4
0
        public static Model New(DirectXDevice device, int points, ModelOperation modelOperations = ModelOperation.None)
        {
            var pointCloud = new PointCloud(points);

            VertexPositionNormalTexture[] vertices;
            int[] indices;

            pointCloud.GenerateMesh(out vertices, out indices);
            return(GeometricPrimitive.New(device, "PointCloud", vertices, indices, PrimitiveTopology.PointList,
                                          modelOperations));
        }
예제 #5
0
        /// <summary>
        /// Creates a sphere primitive.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="diameter">The diameter.</param>
        /// <param name="tessellation">The tessellation.</param>
        /// <returns>A sphere primitive.</returns>
        /// <exception cref="System.ArgumentOutOfRangeException">tessellation;Must be >= 3</exception>
        public static Model New(DirectXDevice device, float diameter = 2.0f, int tessellation = 16, float tileX = 1.0f,
                                float tileY = 1.0f, ModelOperation modelOperations            = ModelOperation.None)
        {
            Contract.Requires <ArgumentException>(tessellation >= 3, "tessellation must be >= 3");
            SphereMesh sphere = new SphereMesh(tileX, tileY, tessellation, diameter);

            VertexPositionNormalTexture[] vertices;
            int[] indices;
            sphere.GenerateMesh(out vertices, out indices);

            return(GeometricPrimitive.New(device, "Sphere", vertices, indices, PrimitiveTopology.TriangleList, modelOperations));
        }
예제 #6
0
        public static Model New(DirectXDevice device, float semiMajorAxis = 1.0f, float semiMinorAxis = 1.0f, int tessellation = 64, float innerRadiusRatio = 0f, float tileX = 1.0f,
                                float tileY = 1.0f, ModelOperation modelOperations = ModelOperation.None)
        {
            Contract.Requires <ArgumentException>(tessellation >= 3, "tessellation must be >= 3");
            var ellipse = new EllipseMesh(semiMajorAxis, semiMinorAxis, tessellation, innerRadiusRatio, tileX, tileY);

            VertexPositionNormalTexture[] vertices;
            int[] indices;
            ellipse.GenerateMesh(out vertices, out indices);

            return(GeometricPrimitive.New(device, "Ellipse", vertices, indices, PrimitiveTopology.TriangleList, modelOperations));
        }
예제 #7
0
        public static Model New(DirectXDevice device, float tileX = 1.0f, float tileY = 1.0f, float tileZ = 1.0f, PrimitiveTopology primitiveTopology = PrimitiveTopology.TriangleList,
                                ModelOperation modelOperations    = ModelOperation.None)
        {
            VertexPositionNormalTextureCube[] vertices;
            int[] indices;
            var   skybox = new SkyboxMesh(tileX, tileY, tileZ);

            skybox.GenerateMesh(out vertices, out indices);

            return(GeometricPrimitive <VertexPositionNormalTextureCube> .New(device, "SkyBoxMesh",
                                                                             vertices, indices, primitiveTopology, modelOperations));
        }
예제 #8
0
        /// <summary>
        ///     Creates a cone primitive.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="height">The height.</param>
        /// <param name="baseRadius">The radius of the base.</param>
        /// <param name="tessellationH">The horizontal tessellation.</param>
        /// <param name="tessellationV">The vertical tessellation.</param>
        /// <param name="tileX">Horizontal texture coordinate scale factor.</param>
        /// <param name="tileY">Vertical texture coordinate scale factor.</param>
        /// <param name="modelOperations">Operations to perform on the model.</param>
        /// <returns>A cone primitive.</returns>
        public static Model New(DirectXDevice device,
                                float baseRadius, float height, float topRadius = 0,
                                int tessellationH = 8, int tessellationV = 8,
                                float tileX       = 1.0f, float tileY    = 1.0f,
                                ModelOperation modelOperations = ModelOperation.None)
        {
            var cylinder = new ConeMesh(baseRadius, topRadius, height, tessellationH, tessellationV, tileX, tileY);

            VertexPositionNormalTexture[] vertices;
            int[] indices;
            cylinder.GenerateMesh(out vertices, out indices);

            return(GeometricPrimitive.New(device, "Cone", vertices, indices, PrimitiveTopology.TriangleList, modelOperations));
        }