MercuryModel.h

Go to the documentation of this file.
00001 #ifndef MERCURYMODEL_H
00002 #define MERCURYMODEL_H
00003 
00004 #include "MercuryFiles.h"
00005 #include "MercuryMesh.h"
00006 
00007 #if defined(_MSC_VER) && (_MSC_VER > 1100)
00008     #pragma warning (disable : 4786) //char truncation dealing with MStrings
00009 #endif
00010 
00011 using namespace std;
00012 
00014 class MercuryModel : public MercuryObject
00015 {
00016 public:
00017     MercuryModel();
00018     virtual ~MercuryModel();
00019 
00020     void AddMesh(MercuryMesh* mesh);
00021     inline unsigned int NumMeshes() const { return m_meshes.size(); }
00022     inline MercuryMesh* GetMesh(unsigned int i) const { return m_meshes[i]; }
00023 
00024     void AddMaterial(MercuryMaterial* material);
00025 
00026     unsigned int NumMaterials() const { return m_materials.size(); }
00027     inline MercuryMaterial* GetMaterial(unsigned int i) { return m_materials[i]; }
00028 
00029     void Load(MString path);
00030 
00031     virtual bool Command( PStack & ret, const char * command, PStack & args );
00032     virtual void EnumerateCommands( MVector< MString > & toAdd );
00033 
00034     bool ReadLine();
00035     CLASS_RTTI( MercuryModel, MercuryObject );
00036 protected:
00037     void OpenFile(const MString& path);
00038     void CloseFile() { SAFE_DELETE( m_file ); }
00039 
00040     virtual void LoadModel() = 0;
00041 
00042     MercuryFile* m_file;
00043 
00044     MString m_path;
00045     MString m_filename;
00046     MString m_line;
00047 
00048     MVector< MAutoPtr<MercuryMaterial> > m_materials;
00049     MVector<MercuryMesh*> m_meshes;
00050 };
00051 
00052 #endif
00053 
00054 /* 
00055  * Copyright (c) 2005-2006 Joshua Allen
00056  * All rights reserved.
00057  *
00058  * Redistribution and use in source and binary forms, with or
00059  * without modification, are permitted provided that the following
00060  * conditions are met:
00061  *  -   Redistributions of source code must retain the above
00062  *      copyright notice, this list of conditions and the following disclaimer.
00063  *  -   Redistributions in binary form must reproduce the above copyright
00064  *      notice, this list of conditions and the following disclaimer in
00065  *      the documentation and/or other materials provided with the distribution.
00066  *  -   Neither the name of the Mercury Engine nor the names of its
00067  *      contributors may be used to endorse or promote products derived from
00068  *      this software without specific prior written permission.
00069  *
00070  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00071  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00072  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00073  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00074  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00075  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00076  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00077  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00078  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00079  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00080  */

Hosted by SourceForge.net Logo