Exemple #1
0
        public DemoMesh(Demo demo)
        {
            this.demo = demo;

            Render = new RenderMeshDeferredPNT();

            meshVertexBuffer = -1;
            meshIndexBuffer  = -1;
            meshVertices     = null;
            meshIndices16Bit = null;
            meshIndices32Bit = null;
            meshIndicesType  = 0;
            meshCullMode     = CullFaceMode.Back;
            dynamic          = false;
            scaleNormals     = false;

            SetTexture(null);
        }
Exemple #2
0
        public DemoMesh(Demo demo, Shape shape, DemoTexture texture, Vector2 textureScale, bool indices, bool indices16Bit, bool flipTriangles, bool flipNormals, bool smoothNormals, CullFaceMode cullMode, bool dynamic, bool scaleNormals)
        {
            this.demo = demo;

            Render = new RenderMeshDeferredPNT();

            meshVertexBuffer  = -1;
            meshIndexBuffer   = -1;
            meshVertices      = null;
            meshIndices16Bit  = null;
            meshIndices32Bit  = null;
            meshIndicesType   = 0;
            this.dynamic      = dynamic;
            this.scaleNormals = scaleNormals;

            SetCullMode(cullMode);
            SetTexture(texture);

            if (indices)
            {
                meshVertices = new VertexPositionNormalTexture[shape.VertexCount];
                shape.GetMeshVertices(textureScale.X, textureScale.Y, flipNormals, smoothNormals, meshVertices);
                CreateVertexBuffer(meshVertices, dynamic);

                if (indices16Bit)
                {
                    meshIndices16Bit = new ushort[shape.IndexCount];
                    shape.GetMesh16BitIndices(flipTriangles, meshIndices16Bit);
                    CreateIndexBuffer(meshIndices16Bit, false);
                }
                else
                {
                    meshIndices32Bit = new int[shape.IndexCount];
                    shape.GetMesh32BitIndices(flipTriangles, meshIndices32Bit);
                    CreateIndexBuffer(meshIndices32Bit, false);
                }
            }
            else
            {
                meshVertices = new VertexPositionNormalTexture[shape.TriangleVertexCount];
                shape.GetMesh(textureScale.X, textureScale.Y, flipTriangles, flipNormals, smoothNormals, meshVertices);
                CreateVertexBuffer(meshVertices, dynamic);
            }
        }
Exemple #3
0
        public DemoMesh(Demo demo, TriangleMesh triangleMesh, DemoTexture texture, Vector2 textureScale, bool indices, bool indices16Bit, bool flipTriangles, bool flipNormals, bool smoothNormals, CullFaceMode cullMode, bool dynamic, bool scaleNormals)
        {
            this.demo = demo;

            Render = new RenderMeshDeferredPNT();

            meshVertexBuffer  = -1;
            meshIndexBuffer   = -1;
            meshVertices      = null;
            meshIndices16Bit  = null;
            meshIndices32Bit  = null;
            meshIndicesType   = 0;
            this.dynamic      = dynamic;
            this.scaleNormals = scaleNormals;

            SetCullMode(cullMode);
            SetTexture(texture);

            if (indices)
            {
                triangleMesh.GetMeshVertices(flipNormals, smoothNormals, out meshVertices);
                CreateVertexBuffer(meshVertices, dynamic);

                if (indices16Bit)
                {
                    triangleMesh.GetMesh16BitIndices(flipTriangles, out meshIndices16Bit);
                    CreateIndexBuffer(meshIndices16Bit, false);
                }
                else
                {
                    triangleMesh.GetMesh32BitIndices(flipTriangles, out meshIndices32Bit);
                    CreateIndexBuffer(meshIndices32Bit, false);
                }
            }
            else
            {
                triangleMesh.GetMesh(textureScale, flipTriangles, flipNormals, smoothNormals, out meshVertices);
                CreateVertexBuffer(meshVertices, dynamic);
            }
        }