Пример #1
0
 /// <summary>
 ///     Renders a given mesh at the given position.
 ///		Color, scale, rotation and offset all effect the rendering of an mesh.
 /// </summary>
 /// <param name="mesh">Mesh to render.</param>
 /// <param name="x">Position on the x-axis to render mesh.</param>
 /// <param name="y">Position on the y-axis to render mesh.</param>
 /// <param name="z">Position on the z-axis to render mesh.</param>
 public static void RenderMesh(Mesh mesh, float x, float y, float z)
 {
     _driver.RenderMesh(mesh, x, y, z);
 }
Пример #2
0
 /// <summary>
 ///		Saves the given mesh to an mesh file.
 /// </summary>
 /// <param name="url">Location to save the mesh to.</param>
 /// <param name="mesh">Mesh to save to file.</param>
 /// <param name="flags">Bitmask of flags describing how to save the mesh.</param>
 public static bool SaveMesh(object url, Mesh mesh, VertexMapSaveFlags flags)
 {
     return VertexMapFactory.SaveVertexMap(url, mesh.VertexMap, flags);
 }
Пример #3
0
        /// <summary>
        ///		Loads an mesh as renderable data.
        /// </summary>
        /// <param name="path">Memory location (or url) of mesh file to load.</param>
        /// <param name="cache">If set to true this image is added to the resource cache to save loading
        ///                     time when this image is requested again.</param>
        /// <param name="flags">Describes how this image should be loaded, rendered and stored.</param>
        /// <returns>A new instance of the Image class if the image file can be loaded.</returns>
        public static Mesh LoadMesh(object path, MeshFlags flags, bool cache)
        {
            if (ResourceManager.ResourceIsCached(path.ToString()) == true)
            {
                DebugLogger.WriteLog("Loading mesh " + path.ToString() + " from cache.");
                return (Mesh)ResourceManager.RetrieveResource(path.ToString());
            }

            DebugLogger.WriteLog("Loading mesh from " + path.ToString() + ".");
            Mesh mesh = new Mesh(path, flags);
            if (cache == true)
            {
                if ((flags & MeshFlags.Dynamic) != 0)
                    throw new Exception("Dynamic meshs cannot be cached.");
                ResourceManager.CacheResource(path.ToString(), mesh);
            }
            return mesh;
        }