PixelLightAPI  .
ChunkLoaderPL.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: ChunkLoaderPL.h                                *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLCORE_CHUNKLOADER_PL_H__
00024 #define __PLCORE_CHUNKLOADER_PL_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/Tools/ChunkLoader.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLCore {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Classes                                               ]
00042 //[-------------------------------------------------------]
00043 /**
00044 *  @brief
00045 *    Chunk loader implementation for the PixelLight binary (Little-Endian) chunk file format
00046 *
00047 *  @remarks
00048 *    PixelLight mesh format description:
00049 *    - uint32: Magic number
00050 *    - uint32: Version
00051 *      - uint32: The total size of the following chunk (header + data) in bytes
00052 *      - uint32: Semantic
00053 *      - uint32: Element type
00054 *      - uint32: Components per element
00055 *      - uint32: Number of elements
00056 *      -         Data
00057 */
00058 class ChunkLoaderPL : public ChunkLoader {
00059 
00060 
00061     //[-------------------------------------------------------]
00062     //[ Public constants                                      ]
00063     //[-------------------------------------------------------]
00064     public:
00065         static PLCORE_API const uint32 MAGIC;   /**< Magic number of the file format */
00066         static PLCORE_API const uint32 VERSION; /**< File format version */
00067 
00068 
00069     //[-------------------------------------------------------]
00070     //[ RTTI interface                                        ]
00071     //[-------------------------------------------------------]
00072     pl_class(PLCORE_RTTI_EXPORT, ChunkLoaderPL, "PLCore", PLCore::ChunkLoader, "Chunk loader implementation for the PixelLight binary (Little-Endian) chunk file format")
00073         // Properties
00074         pl_properties
00075             pl_property("Formats",  "chunk,CHUNK")
00076             pl_property("Load",     "1")
00077             pl_property("Save",     "1")
00078         pl_properties_end
00079         // Constructors
00080         pl_constructor_0(DefaultConstructor,    "Default constructor",  "")
00081         // Methods
00082         pl_method_2(Load,   pl_ret_type(bool),  Chunk&,         File&,  "Load method",  "")
00083         pl_method_2(Save,   pl_ret_type(bool),  const Chunk&,   File&,  "Save method",  "")
00084     pl_class_end
00085 
00086 
00087     //[-------------------------------------------------------]
00088     //[ Public RTTI methods                                   ]
00089     //[-------------------------------------------------------]
00090     public:
00091         PLCORE_API bool Load(Chunk &cChunk, File &cFile);
00092         PLCORE_API bool Save(const Chunk &cChunk, File &cFile);
00093 
00094 
00095     //[-------------------------------------------------------]
00096     //[ Public functions                                      ]
00097     //[-------------------------------------------------------]
00098     public:
00099         /**
00100         *  @brief
00101         *    Default constructor
00102         */
00103         PLCORE_API ChunkLoaderPL();
00104 
00105         /**
00106         *  @brief
00107         *    Destructor
00108         */
00109         PLCORE_API virtual ~ChunkLoaderPL();
00110 
00111 
00112     //[-------------------------------------------------------]
00113     //[ Private functions                                     ]
00114     //[-------------------------------------------------------]
00115     private:
00116         /**
00117         *  @brief
00118         *    Loader implementation for format version 1
00119         *
00120         *  @param[in] cChunk
00121         *    Chunk to load into
00122         *  @param[in] cFile
00123         *    Chunk file to read the data from
00124         *
00125         *  @return
00126         *    'true' if all went fine, else 'false'
00127         */
00128         bool LoadV1(Chunk &cChunk, File &cFile) const;
00129 
00130 
00131 };
00132 
00133 
00134 //[-------------------------------------------------------]
00135 //[ Namespace                                             ]
00136 //[-------------------------------------------------------]
00137 } // PLCore
00138 
00139 
00140 #endif // __PLCORE_CHUNKLOADER_PL_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:52
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported