Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }