Exemple #1
0
        /// <summary>
        /// Prepares mesh to be "cell fit":
        /// 1) uniform scale the mesh to fit to SIZE_OF_MESH x SIZE_OF_MESH on XZ plane;
        /// 2) translates mesh to align its bounding box to center of coordiantes (0,0,0);
        /// </summary>
        void fitMesh(Mesh mesh)
        {
            MeshManipulator s = m_device.SceneManager.MeshManipulator;

            float f = Math.Max(mesh.BoundingBox.Extent.X, mesh.BoundingBox.Extent.Z);

            s.Scale(mesh, new Vector3Df(SIZE_OF_MESH / f));
            s.Transform(mesh, new Matrix(mesh.BoundingBox.MinEdge * -1));
            s.RecalculateNormals(mesh);
        }