-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgl_cityview.h
108 lines (96 loc) · 4.17 KB
/
gl_cityview.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/************************************************************************
* Copyright (c) 2005-2007 [email protected] *
* *
* 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 {
class BlockAnimCtrl;
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();
bool getDrawTextured();
bool getDrawLines();
bool getDrawLinesBlockColor();
void setDrawTextured(bool v);
void setDrawLines(bool v);
void setDrawLinesBlockColor(bool v);
void resetTextures();
const SDL_Rect & getActiveRect() { return activeRect; }
const SDL_Rect & getOnScreenRect() { return drawnRect; }
BlockAnimCtrl* blockAnims;
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;
OpenGL::TextureCache<uint8_t>* auxCache;
Map* loadedMap;
OpenGTA::GraphicsBase* style;
GLfloat zoomLevel;
GLfloat camPos[3];
GLfloat camVec[3];
int visibleRange;
bool topDownView;
bool drawTextured;
bool drawLines;
bool drawLinesBlockType;
bool drawHeadingMarkers;
uint8_t aboveBlockType;
SDL_Rect activeRect;
SDL_Rect drawnRect;
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