예제 #1
0
        //
        //ORIGINAL LINE: Ogre::MeshPtr transformToMesh(const string& name, const Ogre::String& group = "General") const
        //
        public MeshPtr transformToMesh(string name, string group)
        {
            //Mogre.SceneManager sceneMgr = Root.Singleton.GetSceneManagerIterator().Current;
            Mogre.SceneManagerEnumerator.SceneManagerIterator item = Root.Singleton.GetSceneManagerIterator();
            item.MoveNext();
            Mogre.SceneManager sceneMgr = item.Current;
            item.Dispose();
            Mogre.ManualObject manual = sceneMgr.CreateManualObject(name);
            manual.Begin("BaseWhiteNoLighting", RenderOperation.OperationTypes.OT_TRIANGLE_LIST);

            foreach (var it in mVertices)
            {
                manual.Position(it.mPosition);
                manual.TextureCoord(it.mUV);
                manual.Normal(it.mNormal);
            }
            foreach (var it in mIndices)
            {
                manual.Index((ushort)it);
            }
            manual.End();

            Mogre.MeshPtr mesh = manual.ConvertToMesh(name, group);

            sceneMgr.DestroyManualObject(manual);

            return(mesh);
        }
예제 #2
0
        MeshPtr CreateMesh(string Name, string Group, IndexData IndexDataArg, VertexData VertexDataArg, AxisAlignedBox BoundingBox)
        {
            Mogre.MeshPtr mMesh   = Mogre.MeshManager.Singleton.CreateManual(Name, Group);
            SubMesh       SubMesh = mMesh.CreateSubMesh();

            //Shallow copy the IndexBuffer argument into the SubMesh's indexData property
            SubMesh.indexData.indexBuffer = IndexDataArg.indexBuffer;
            SubMesh.indexData.indexCount  = IndexDataArg.indexCount;

            //Deep copy the VertexData argument into the Mesh's sharedVertexData
            SubMesh.useSharedVertices = true;
            mMesh.sharedVertexData    = new VertexData();
            mMesh.sharedVertexData.vertexBufferBinding.SetBinding(0, VertexDataArg.vertexBufferBinding.GetBuffer(0));
            VertexDeclaration vdc = new VertexDeclaration();

            VertexDataArg.vertexDeclaration.CopyTo(vdc);
            mMesh.sharedVertexData.vertexDeclaration = vdc;
            mMesh.sharedVertexData.vertexCount       = VertexDataArg.vertexCount;

            mMesh._setBounds(BoundingBox);

            mMesh.Load();

            return(mMesh);
        }
예제 #3
0
        //
        //ORIGINAL LINE: Ogre::MeshPtr realizeMesh(const string& name = "") const
        //
        public MeshPtr realizeMesh(string name)
        {
            SceneManagerEnumerator.SceneManagerIterator item = Root.Singleton.GetSceneManagerIterator();
            item.MoveNext();//
            Mogre.SceneManager smgr = item.Current;
            item.Dispose();
            Mogre.ManualObject manual = smgr.CreateManualObject(name);
            manual.Begin("BaseWhiteNoLighting", RenderOperation.OperationTypes.OT_LINE_STRIP);

            foreach (var itPos in mPoints)
            {
                manual.Position(itPos);
            }
            if (mClosed)
            {
                manual.Position(mPoints[0]);
            }
            manual.End();

            Mogre.MeshPtr mesh = MeshManager.Singleton.CreateManual(name, "General");
            if (name == "")
            {
                mesh = manual.ConvertToMesh(Utils.getName("mesh_procedural_"));
            }
            else
            {
                mesh = manual.ConvertToMesh(name);
            }

            return(mesh);
        }