Started using texture atlas instead of many small meshes.

This commit is contained in:
David Williams
2007-12-03 22:24:48 +00:00
parent ee060d85d3
commit 31656cb68b
11 changed files with 317 additions and 43 deletions

View File

@ -4,15 +4,16 @@
#include <set>
#include <list>
#include "AbstractSurfacePatch.h"
#include "Constants.h"
#include "IntegralVector3.h"
#include "SurfaceTypes.h"
#include "SurfaceVertex.h"
#include "VolumeIterator.h"
namespace Ogre
{
class IndexedSurfacePatch : public AbstractSurfacePatch
class IndexedSurfacePatch
{
public:
IndexedSurfacePatch();
@ -21,8 +22,11 @@ namespace Ogre
void addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2);
void fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<ushort>& vecIndices);
private:
std::vector<SurfaceVertexIterator> m_vecTriangleIndices;
//private:
std::vector<uint> m_vecTriangleIndices;
std::vector<SurfaceVertex> m_vecVertices;
long int vertexIndices[OGRE_REGION_SIDE_LENGTH*2+1][OGRE_REGION_SIDE_LENGTH*2+1][OGRE_REGION_SIDE_LENGTH*2+1];
};
}

View File

@ -23,10 +23,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "OgreSceneManager.h"
#include "Constants.h"
#include "IndexedSurfacePatch.h"
#include "MaterialMap.h"
#include "SurfacePatchRenderable.h"
#include "SurfaceTriangle.h"
#include "AbstractSurfacePatch.h"
//#include "AbstractSurfacePatch.h"
#include "TypeDef.h"
#include "Volume.h"
#include "SurfaceVertex.h"
@ -81,7 +82,7 @@ namespace Ogre
void generateLevelVolume(void);
std::map<uchar, AbstractSurfacePatch*> generateMeshDataForRegion(uint regionX, uint regionY, uint regionZ) const;
std::map<uchar, IndexedSurfacePatch*> generateMeshDataForRegion(uint regionX, uint regionY, uint regionZ) const;
void doRegionGrowing(uint xStart, uint yStart, uint zStart, uchar value);

View File

@ -4,10 +4,12 @@
#include "Ogre.h"
#include <vector>
#include "AbstractSurfacePatch.h"
//#include "AbstractSurfacePatch.h"
//#include "SurfaceTriangle.h"
//#include "SurfaceVertex.h"
#include "IndexedSurfacePatch.h"
namespace Ogre
{
//IDEA - If profiling identifies this class as a bottleneck, we could implement a memory pooling system.
@ -16,11 +18,11 @@ namespace Ogre
class SurfacePatchRenderable : public SimpleRenderable
{
public:
SurfacePatchRenderable(AbstractSurfacePatch* patchToRender, const String& material = "BaseWhiteNoLighting");
SurfacePatchRenderable(IndexedSurfacePatch* patchToRender, const String& material = "BaseWhiteNoLighting");
~SurfacePatchRenderable(void);
void updateWithNewSurfacePatch(AbstractSurfacePatch* patchToRender);
void setGeometry(AbstractSurfacePatch* patchToRender);
void updateWithNewSurfacePatch(IndexedSurfacePatch* patchToRender);
void setGeometry(IndexedSurfacePatch* patchToRender);
Real getSquaredViewDepth(const Camera *cam) const;
Real getBoundingRadius(void) const;