source: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshSaver.h @ 774

Revision 774, 2.7 KB checked in by gumbau, 18 years ago (diff)

GTGeometry and GeoTool? initial imports

Line 
1/*      ==========================================================================
2 *      (C) 2005 Universitat Jaume I
3 *      ==========================================================================
4 *      PROYECT:        GAME TOOLS
5 *      =========================================================================*/
6/**     CONTENT:       
7        *
8        *
9        *       @file   GeoMeshSaver.h
10/*===========================================================================*/
11#ifndef __GEO_MESH_SAVER__
12#define __GEO_MESH_SAVER__
13
14#include        <GeoMeshLoader.h>
15
16namespace Geometry
17{
18        //      Saves a Mesh.
19        class   GeoMeshSaver
20        {
21                private:
22                        //      The mesh to write.
23                        Mesh    *mGeoMesh;
24                       
25                        //      Mesh Bounds.
26                        GeometryBounds  mMeshBounds;
27                       
28                        //      Write in the file.
29                        Serializer      *mSerializer;
30
31                        //      Flag that indicate if the mesh
32                        //      is skeletally animated or not.
33                        bool    mSkeletallyAnimated;
34                       
35                        //      Material of the mesh.
36                        String  mMaterialName;
37                       
38                        //      Write the main mesh.
39                        void    writeMesh(Mesh  *geoMesh);
40
41                        //      Write a submesh.
42                        void    writeSubMesh(SubMesh    *geoSubMesh);
43
44                        // Operation type
45                        void    writeSubMeshOperation(const     SubMesh *geoSubMesh);
46                       
47                        //      Write geometry.
48                        void    writeGeometry(VertexBuffer      *vertexBuffer);
49
50                        //      TODO: Write Mesh Bounds.
51                        void    writeMeshBounds(GeometryBounds bounds);
52                       
53                        //      Calc the mesh size in bytes.
54                        size_t  calcMeshSize(const Mesh *geoMesh);
55
56                        //      Calc the size in bytes for the submesh.
57                        size_t  calcSubMeshSize(const SubMesh   *geoSubMesh);
58
59                        //      Calc the geometry size in bytes.
60                        size_t  calcGeometrySize(const VertexBuffer* vertexBuffer);
61
62                        //      Write the file header.
63                        void    writeFileHeader(void);
64
65                        //      Write a header chunk given.
66                        void    writeChunkHeader(       unsigned short  id,
67                                                                                                                        unsigned long           count);
68
69                        //      Write integers into the file.
70                        void    writeInts(unsigned long id,
71                                                                                        unsigned long   size);
72
73                        //      Write shorts into the file
74                        void    writeShorts(unsigned short      id,
75                                                                                                unsigned long           count);
76
77                        //      Write float into the file.
78                        void    writeFloats(float                                               id,
79                                                                                                unsigned long           count);
80
81                        //      Write a string into the file.
82                        void    writeString(const       String  &string);
83
84                        //      Write booleans into the file.
85                        void    writeBools(     const bool id,
86                                                                                                unsigned        long            count);
87                public:
88
89                        //      Constructors.
90                        GeoMeshSaver();
91
92                        GeoMeshSaver(GeometryBounds bounds);
93
94                        //      Destroyer.
95                        ~GeoMeshSaver();
96
97                        //      Sets the material of the mesh.
98                        void    setMaterialName(String  materialName);
99
100                        //      Gets the material of the mesh.
101                        String  getMaterialName();
102
103                        //      Set Mesh Bounds.
104                        void    setMeshBounds(GeometryBounds    bounds);
105
106                        //      Saves a Mesh into a file.
107                        int     save(Mesh       *geoMesh,       const   char    *fileNameMesh);
108        };
109}
110#endif
111
Note: See TracBrowser for help on using the repository browser.