Ejemplo n.º 1
0
        /// <summary>
        ///		Initilizes a new mesh from a file.
        /// </summary>
        /// <param name="path">Memory location (or url) of mesh file to load.</param>
        public Mesh(object path, MeshFlags flags)
        {
            if ((path is VertexMap) == false)
            {
                if (path is string)
                {
                    _url = (string)path;
                }
                _vertexMap = VertexMapFactory.LoadVertexMap(path);
            }
            else
            {
                _vertexMap = (path as VertexMap).Copy();
            }

            if (_vertexMap == null)
            {
                return;
            }

            _flags      = flags;
            _driverMesh = GraphicsManager.CreateDriverMesh(_vertexMap);

            // Are we dynamic? If not we don't need the full vertexmaps data so lets destroy it and
            // free up a bit of memory.
            //if ((_flags & MeshFlags.Dynamic) == 0 && _vertexMap != null)
            //{
            //    _vertexMap.Data = null;
            //}
        }
Ejemplo n.º 2
0
        /// <summary>
        ///		Creates an exact copy of this VertexMap and returns it.
        /// </summary>
        /// <returns>The newly copied VertexMap.</returns>
        public VertexMap Copy()
        {
            VertexMap vertexMap = new VertexMap(_vertexs.Length);

            vertexMap.Data    = (Vertex[])_vertexs.Clone();
            vertexMap._width  = _width;
            vertexMap._height = _height;
            vertexMap._depth  = _depth;
            return(vertexMap);
        }
Ejemplo n.º 3
0
 /// <summary>
 ///     This method is called when a VertexMap save is requested, it illiterates through all
 ///     the registered VertexMapFactory instances to see if there is one capable to saving the
 ///     given format.
 /// </summary>
 /// <param name="path">File path to save vertex map to.</param>
 /// <param name="flags">Bitmask of flags to define how the vertex map should be saved.</param>
 /// <returns>True if save was successfull else false.</returns>
 public static bool SaveVertexMap(object path, VertexMap vertexMap, VertexMapSaveFlags flags)
 {
     foreach (VertexMapFactory factory in _loaderList)
     {
         if (factory.RequestSave(path, vertexMap, flags) == true)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     This method is called when a VertexMap load is requested, it illiterates through all
 ///     the registered VertexMapFactory instances to see if there is one capable to loading the
 ///     given format.
 /// </summary>
 /// <param name="path">File path or object of the mesh to load.</param>
 /// <returns>A VertexMap or NULL if it can't find a factory able to load the given mesh format.</returns>
 public static VertexMap LoadVertexMap(object path)
 {
     foreach (VertexMapFactory factory in _loaderList)
     {
         VertexMap vertexMap = factory.RequestLoad(path);
         if (vertexMap != null)
         {
             return(vertexMap);
         }
     }
     return(null);
 }
Ejemplo n.º 5
0
 /// <summary>
 ///		Disposes of all resources used by this image.
 /// </summary>
 public void Dispose()
 {
     _vertexMap  = null;
     _driverMesh = null;
 }
Ejemplo n.º 6
0
 /// <summary>
 ///     This method is called when VertexMap save is requested, if it returns true
 ///		the calling method will stop illiterating through the VertexMapFactorys and 
 ///		return success to the user.
 /// </summary>
 /// <param name="path">File path or object of the image to load.</param>
 /// <param name="pixelMap">VertexMap to save.</param>
 /// <param name="flags">Bitmask of flags defining how the vertex map should be saved.</param>
 /// <returns>True if the save was successfull else false.</returns>
 protected abstract bool RequestSave(object path, VertexMap vertexMap, VertexMapSaveFlags flags);
Ejemplo n.º 7
0
 public static void SaveVertexMap(object path, VertexMap vertexMap)
 {
     SaveVertexMap(path, vertexMap, 0);
 }
Ejemplo n.º 8
0
 /// <summary>
 ///     This method is called when a VertexMap save is requested, it illiterates through all
 ///     the registered VertexMapFactory instances to see if there is one capable to saving the
 ///     given format.
 /// </summary>
 /// <param name="path">File path to save vertex map to.</param>
 /// <param name="flags">Bitmask of flags to define how the vertex map should be saved.</param>
 /// <returns>True if save was successfull else false.</returns>
 public static bool SaveVertexMap(object path, VertexMap vertexMap, VertexMapSaveFlags flags)
 {
     foreach (VertexMapFactory factory in _loaderList)
     {
         if (factory.RequestSave(path, vertexMap, flags) == true) return true;
     }
     return false;
 }
Ejemplo n.º 9
0
 /// <summary>
 ///		Creates an exact copy of this VertexMap and returns it.
 /// </summary>
 /// <returns>The newly copied VertexMap.</returns>
 public VertexMap Copy()
 {
     VertexMap vertexMap = new VertexMap(_vertexs.Length);
     vertexMap.Data = (Vertex[])_vertexs.Clone();
     vertexMap._width = _width;
     vertexMap._height = _height;
     vertexMap._depth = _depth;
     return vertexMap;
 }
Ejemplo n.º 10
0
 /// <summary>
 ///		Creates a new valid driver mesh from a vertex map.
 /// </summary>
 /// <param name="vertexMap">Vertexmap to create new mesh from.</param>
 public static IDriverMesh CreateDriverMesh(VertexMap vertexMap)
 {
     return(_driver.CreateDriverMesh(vertexMap));
 }
Ejemplo n.º 11
0
 /// <summary>
 ///		Creates a new valid driver mesh from a vertex map.
 /// </summary>
 /// <param name="vertexMap">Vertexmap to create new mesh from.</param>
 public static IDriverMesh CreateDriverMesh(VertexMap vertexMap)
 {
     return _driver.CreateDriverMesh(vertexMap);
 }
Ejemplo n.º 12
0
        /// <summary>
        ///		Initilizes a new mesh from a file.
        /// </summary>
        /// <param name="path">Memory location (or url) of mesh file to load.</param>
        public Mesh(object path, MeshFlags flags)
        {
            if ((path is VertexMap) == false)
            {
                if (path is string) _url = (string)path;
                _vertexMap = VertexMapFactory.LoadVertexMap(path);
            }
            else
                _vertexMap = (path as VertexMap).Copy();

            if (_vertexMap == null)
                return;

            _flags = flags;
            _driverMesh = GraphicsManager.CreateDriverMesh(_vertexMap);

            // Are we dynamic? If not we don't need the full vertexmaps data so lets destroy it and
            // free up a bit of memory.
            //if ((_flags & MeshFlags.Dynamic) == 0 && _vertexMap != null)
            //{
            //    _vertexMap.Data = null;
            //}
        }
Ejemplo n.º 13
0
 /// <summary>
 ///		Disposes of all resources used by this image.
 /// </summary>
 public void Dispose()
 {
     _vertexMap = null;
     _driverMesh = null;
 }
Ejemplo n.º 14
0
 public static void SaveVertexMap(object path, VertexMap vertexMap)
 {
     SaveVertexMap(path, vertexMap, 0);
 }
Ejemplo n.º 15
0
 /// <summary>
 ///     This method is called when VertexMap save is requested, if it returns true
 ///		the calling method will stop illiterating through the VertexMapFactorys and
 ///		return success to the user.
 /// </summary>
 /// <param name="path">File path or object of the image to load.</param>
 /// <param name="pixelMap">VertexMap to save.</param>
 /// <param name="flags">Bitmask of flags defining how the vertex map should be saved.</param>
 /// <returns>True if the save was successfull else false.</returns>
 protected abstract bool RequestSave(object path, VertexMap vertexMap, VertexMapSaveFlags flags);