Exemple #1
0
        void loadCellMesh()
        {
            MeshManipulator s = m_device.SceneManager.MeshManipulator;
            VideoDriver     d = m_device.VideoDriver;

            m_meshCell = m_device.SceneManager.GetMesh("cell.obj");
            s.FlipSurfaces(m_meshCell);             // i don't know why, but somehow this one OBJ exported by Blender has flipped faces when opened by Irrlicht
            fitMesh(m_meshCell);

            s.SetVertexColors(m_meshCell, Color.SolidWhite);
            s.MakePlanarTextureMapping(m_meshCell, 0.10f);

            Material m = new Material();

            m.Type = MaterialType.Reflection2Layer;
            m.SetTexture(0, d.GetTexture("TEXTURE-unk.jpg"));
            m.SetTexture(1, d.GetTexture("TEXTURE-ref.jpg"));
            m_meshCell.MeshBuffers[0].SetMaterial(m);

            s.Transform(m_meshCell, new Matrix(new Vector3Df(0), new Vector3Df(0, -90, 180)));
            s.RecalculateNormals(m_meshCell);
        }