2 fegdk: FE Game Development Kit
3 Copyright (C) 2001-2008 Alexey "waker" Yakovenko
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 waker@users.sourceforge.net
29 #include "f_sceneobject.h"
30 #include "f_material.h"
41 ushort f1
, f2
; // faces forming the edge
42 ushort v1
, v2
; // verts forming the edge
50 struct modelTriangles_t
52 // this stuff is loaded externally
58 // this stuff is build load-time
60 ushort
* silIndexes
; // not using duplicated verts (ignoring texcoords, etc)
63 silEdge_t
* silEdges
; // size must be at least [numVerts*2] (not including duplicates)
64 // FIXME find a way to cache results for static light/mesh combos
66 shadowVertex_t
*shadowVerts
; // this is NULL when using vertex shaders
67 int32 numShadowVolumeIndexes
;
68 ushort
* shadowVolumeIndexes
; // size at least equal to silEdges
70 ushort
* dupVerts
; // pairs {vertex, dupvertex}
75 modelTriangles_t
* tris
;
81 baseTexturePtr lightmap
;
87 class FE_API model
: public geomSource
89 friend class modelData
;
92 // !!! moved to meshData_t !!! (see geomSource)
93 // unsigned mbLightmaps : 1;
94 // unsigned mbTangents : 1;
95 // unsigned mbColors : 1;
96 // modelTriangles_t mTris;
97 // std::vector <modelSubset_t> mSurfaces;
100 // smartPtr <modelData> mpData;
102 sceneObject
* load (file
*f
, mtlBlock
*mtls
= NULL
, sceneObject
*parent
= NULL
);
105 * @brief builds all data which is not being loaded from file/memory storage.
106 * @brief initializes mTris, obb, builds tangents, etc.
113 sceneObject
* load (const char *fname
);
114 void loadMesh (file
*f
, int majorver
, int minorver
, std::vector
<materialPtr
> &mtls
, int numSubsets
, renderable
*rend
);
119 * @brief ctor used to create model from data in memory.
120 * @brief may be used for e.g. procedural geometry or testing purposes
121 * @brief which require better performance
122 * @param verts vertices
123 * @param inds indexes
124 * @param subs subsets
125 * @parms mtls material list, used in creation of mtlBlock
127 // model (const char *name, model *parent, const matrix4 &mtx, const std::vector <drawVertex_t> &verts, std::vector <ushort> &inds, const std::vector <modelSubset_t> &subs, const std::vector <materialPtr> &mtls);
131 typedef smartPtr
<model
> modelPtr
;
135 #endif // __F_MODEL_H