Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

X:/dropbox/visualizationlibrary/src/vlGraphics/plugins/ioVLX.hpp

Go to the documentation of this file.
00001 /**************************************************************************************/
00002 /*                                                                                    */
00003 /*  Visualization Library                                                             */
00004 /*  http://www.visualizationlibrary.org                                               */
00005 /*                                                                                    */
00006 /*  Copyright (c) 2005-2010, Michele Bosi                                             */
00007 /*  All rights reserved.                                                              */
00008 /*                                                                                    */
00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
00010 /*  are permitted provided that the following conditions are met:                     */
00011 /*                                                                                    */
00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
00013 /*  list of conditions and the following disclaimer.                                  */
00014 /*                                                                                    */
00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
00017 /*  other materials provided with the distribution.                                   */
00018 /*                                                                                    */
00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
00029 /*                                                                                    */
00030 /**************************************************************************************/
00031 
00032 #ifndef LoadWriterVLX_INCLUDE_ONCE
00033 #define LoadWriterVLX_INCLUDE_ONCE
00034 
00035 #include <vlCore/VLXClassWrapper.hpp>
00036 #include <vlCore/VLXRegistry.hpp>
00037 #include <vlCore/VLXSerializer.hpp>
00038 #include <vlCore/VLXValue.hpp>
00039 #include <vlCore/vlxutils.hpp>
00040 #include <vlCore/LoadWriterManager.hpp>
00041 #include <vlGraphics/Actor.hpp>
00042 #include <vlGraphics/Effect.hpp>
00043 #include <vlGraphics/Shader.hpp>
00044 #include <vlGraphics/Geometry.hpp>
00045 #include <vlGraphics/Light.hpp>
00046 #include <vlGraphics/ClipPlane.hpp>
00047 #include <vlGraphics/Camera.hpp>
00048 #include <vlGraphics/DrawElements.hpp>
00049 #include <vlGraphics/MultiDrawElements.hpp>
00050 #include <vlGraphics/DrawArrays.hpp>
00051 #include <vlGraphics/SceneManagerActorTree.hpp>
00052 #include <vlGraphics/DistanceLODEvaluator.hpp>
00053 #include <vlGraphics/PixelLODEvaluator.hpp>
00054 #include <vlGraphics/DepthSortCallback.hpp>
00055 #include <vlGraphics/GLSL.hpp>
00056 #include <vlCore/ResourceDatabase.hpp>
00057 #include <vlCore/DiskFile.hpp>
00058 
00059 namespace vl
00060 {
00061   //-----------------------------------------------------------------------------
00062 
00063   VLGRAPHICS_EXPORT ref<ResourceDatabase> loadVLT(VirtualFile* file);
00064   VLGRAPHICS_EXPORT ref<ResourceDatabase> loadVLT(const String& path);
00065   VLGRAPHICS_EXPORT ref<ResourceDatabase> loadVLB(VirtualFile* file);
00066   VLGRAPHICS_EXPORT ref<ResourceDatabase> loadVLB(const String& path);
00067   VLGRAPHICS_EXPORT bool saveVLT(VirtualFile* file, const ResourceDatabase*);
00068   VLGRAPHICS_EXPORT bool saveVLT(const String& file, const ResourceDatabase*);
00069   VLGRAPHICS_EXPORT bool saveVLB(VirtualFile* file, const ResourceDatabase*);
00070   VLGRAPHICS_EXPORT bool saveVLB(const String& file, const ResourceDatabase*);
00071   VLGRAPHICS_EXPORT bool isVLT(VirtualFile* file);
00072   VLGRAPHICS_EXPORT bool isVLT(const String& file);
00073   VLGRAPHICS_EXPORT bool isVLB(VirtualFile* file);
00074   VLGRAPHICS_EXPORT bool isVLB(const String& file);
00075 
00076   //---------------------------------------------------------------------------
00077   // LoadWriterVLX
00078   //---------------------------------------------------------------------------
00082   class LoadWriterVLX: public ResourceLoadWriter
00083   {
00084     VL_INSTRUMENT_CLASS(vl::LoadWriterVLX, ResourceLoadWriter)
00085 
00086   public:
00087     LoadWriterVLX(): ResourceLoadWriter("|vlt|vlb|", "|vlt|vlb|") {}
00088 
00089     ref<ResourceDatabase> loadResource(const String& path) const 
00090     {
00091       if (isVLT(path))
00092         return loadVLT(path);
00093       else
00094       if (isVLB(path))
00095         return loadVLB(path);
00096       else
00097         return NULL;
00098     }
00099 
00100     ref<ResourceDatabase> loadResource(VirtualFile* file) const
00101     {
00102       if (isVLT(file))
00103         return loadVLT(file);
00104       else
00105       if (isVLB(file))
00106         return loadVLB(file);
00107       else
00108         return NULL;
00109     }
00110 
00111     bool writeResource(const String& path, ResourceDatabase* res_db) const
00112     {
00113       if (path.extractFileExtension().toLowerCase() == "vlt")
00114         return saveVLT(path, res_db);
00115       else
00116       if (path.extractFileExtension().toLowerCase() == "vlb")
00117         return saveVLB(path, res_db);
00118       else
00119         return false;
00120     }
00121 
00122     bool writeResource(VirtualFile* file, ResourceDatabase* res_db) const
00123     {
00124       if (file->path().extractFileExtension().toLowerCase() == "vlt")
00125         return saveVLT(file, res_db);
00126       else
00127       if (file->path().extractFileExtension().toLowerCase() == "vlb")
00128         return saveVLB(file, res_db);
00129       else
00130         return false;
00131     }
00132   };
00133 //-----------------------------------------------------------------------------
00134 }
00135 
00136 #endif

Visualization Library 2011.09.1160 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 2 2013 13:40:39.
Permission is granted to use this page to write and publish articles regarding Visualization Library.