OpenGTA/gl_cityview.h

109 lines
4.2 KiB
C
Raw Normal View History

2015-12-03 00:37:02 +00:00
/************************************************************************
2015-12-03 00:37:37 +00:00
* Copyright (c) 2005-2007 tok@openlinux.org.uk *
2015-12-03 00:37:02 +00:00
* *
* This software is provided as-is, without any express or implied *
* warranty. In no event will the authors be held liable for any *
* damages arising from the use of this software. *
* *
* Permission is granted to anyone to use this software for any purpose, *
* including commercial applications, and to alter it and redistribute *
* it freely, subject to the following restrictions: *
* *
* 1. The origin of this software must not be misrepresented; you must *
* not claim that you wrote the original software. If you use this *
* software in a product, an acknowledgment in the product documentation *
* would be appreciated but is not required. *
* *
* 2. Altered source versions must be plainly marked as such, and must *
* not be misrepresented as being the original software. *
* *
* 3. This notice may not be removed or altered from any source *
* distribution. *
************************************************************************/
#ifndef GL_CITYVIEW_H
#define GL_CITYVIEW_H
#include "opengta.h"
#include "navdata.h"
#include "gl_texturecache.h"
#include "gl_frustum.h"
#include "gl_pagedtexture.h"
namespace OpenGTA {
2015-12-03 00:37:37 +00:00
class BlockAnimCtrl;
2015-12-03 00:37:02 +00:00
class CityView {
public:
CityView();
~CityView();
void loadMap(const std::string &map, const std::string &style);
void createLevelObject(OpenGTA::Map::ObjectPosition *obj);
void setPosition(const GLfloat & x, const GLfloat & y, const GLfloat & z);
void setTopDownView(const GLfloat & height);
//void setCamVector(const GLfloat & x, const GLfloat & y, const GLfloat & z);
void setZoom(const GLfloat zoom);
void setViewMode(bool topDown);
bool getViewMode() { return topDownView; }
void setDrawHeadingArrows(bool yes) { drawHeadingMarkers = yes; }
void setTexFlipTest(int v) { texFlipTest = v; }
GLfloat* getCamPos() { return (GLfloat*)&camPos; }
void setVisibleRange(int);
int getVisibleRange();
void getTerrainHeight(GLfloat & x, GLfloat & y, GLfloat & z);
void draw(Uint32 ticks);
NavData::Sector* getCurrentSector();
OpenGL::PagedTexture renderMap2Texture();
2015-12-03 00:38:22 +00:00
bool getDrawTextured();
bool getDrawLines();
bool getDrawLinesBlockColor();
void setDrawTextured(bool v);
void setDrawLines(bool v);
void setDrawLinesBlockColor(bool v);
2015-12-03 00:37:02 +00:00
void resetTextures();
2015-12-03 00:37:37 +00:00
const SDL_Rect & getActiveRect() { return activeRect; }
const SDL_Rect & getOnScreenRect() { return drawnRect; }
BlockAnimCtrl* blockAnims;
2015-12-03 00:37:02 +00:00
protected:
void setNull();
void cleanup();
void drawBlock(OpenGTA::Map::BlockInfo* bi);
void drawObject(OpenGTA::Map::ObjectPosition*);
//OpenGL::PagedTexture createSprite(size_t sprNum, GraphicsBase::SpriteInfo* info);
Util::CFrustum frustum;
OpenGL::TextureCache<uint8_t>* sideCache;
OpenGL::TextureCache<uint8_t>* lidCache;
2015-12-03 00:37:37 +00:00
OpenGL::TextureCache<uint8_t>* auxCache;
2015-12-03 00:37:02 +00:00
Map* loadedMap;
OpenGTA::GraphicsBase* style;
GLfloat zoomLevel;
GLfloat camPos[3];
GLfloat camVec[3];
int visibleRange;
bool topDownView;
bool drawTextured;
bool drawLines;
2015-12-03 00:38:22 +00:00
bool drawLinesBlockType;
bool drawHeadingMarkers;
uint8_t aboveBlockType;
2015-12-03 00:37:02 +00:00
2015-12-03 00:37:37 +00:00
SDL_Rect activeRect;
SDL_Rect drawnRect;
2015-12-03 00:37:02 +00:00
int scene_rendered_vertices;
int scene_rendered_blocks;
GLuint scene_display_list;
bool scene_is_dirty;
int texFlipTest;
Uint32 lastCacheEmptyTicks;
NavData::Sector *current_sector;
};
}
#endif