1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-10-05 08:37:20 +02:00
openrw/rwengine/include/render/GTARenderer.hpp

89 lines
2.1 KiB
C++
Raw Normal View History

2013-07-02 09:53:23 +02:00
#ifndef _GTARENDERER_HPP_
#define _GTARENDERER_HPP_
#define GLEW_STATIC
#include <GL/glew.h>
2013-07-04 03:40:47 +02:00
#include <memory>
#include <vector>
#include <render/ViewCamera.hpp>
2013-07-02 09:53:23 +02:00
2013-07-04 03:40:47 +02:00
class Model;
2014-02-09 04:14:43 +01:00
class ModelFrame;
2013-12-20 17:02:46 +01:00
class GameWorld;
class GTAObject;
2013-09-11 01:26:13 +02:00
class Animator;
2014-02-13 11:55:11 +01:00
/**
* Renderer
*
* Handles low level rendering of Models, as well as high level rendering of
* objects in the world.
*/
2013-07-02 09:53:23 +02:00
class GTARenderer
{
2013-12-20 17:02:46 +01:00
GameWorld* engine;
struct RQueueEntry {
Model* model;
size_t g;
size_t sg;
glm::mat4 matrix;
GTAObject* object;
};
2014-02-09 04:14:43 +01:00
bool renderFrame(Model* m, ModelFrame* f, const glm::mat4& matrix, GTAObject* object, bool queueTransparent = true);
// Internal method for processing sub-geometry
bool renderSubgeometry(Model* model, size_t g, size_t sg, const glm::mat4& matrix, GTAObject* object, bool queueTransparent = true);
/// Queue of sub-geometry to post-render
/// With a faster occulusion culling stage
/// This could be replaced with a 2nd draw pass.
std::vector<RQueueEntry> transparentDrawQueue;
2013-07-02 09:53:23 +02:00
public:
2013-12-20 17:02:46 +01:00
GTARenderer(GameWorld*);
2013-07-02 09:53:23 +02:00
ViewCamera camera;
2013-07-02 10:58:01 +02:00
/// The numer of things rendered by the last renderWorld
size_t rendered;
size_t culled;
2014-02-13 11:55:11 +01:00
/* TODO clean up all these variables */
2013-07-05 03:15:29 +02:00
GLint uniModel, uniProj, uniView, uniCol, uniAmbientCol, uniSunDirection, uniDynamicCol;
GLint uniMatDiffuse, uniMatAmbient, uniFogStart, uniFogEnd;
GLuint worldProgram;
2013-07-05 03:15:29 +02:00
GLuint skyProgram;
GLint skyUniView, skyUniProj, skyUniTop, skyUniBottom;
2013-07-02 10:58:01 +02:00
/// Internal VAO to avoid clobbering global state.
2013-07-30 17:59:44 +02:00
GLuint vao, debugVAO;
2013-08-18 23:06:13 +02:00
GLuint planeVBO, skydomeVBO, skydomeIBO, debugVBO;
2013-07-30 17:59:44 +02:00
GLuint debugTex;
2013-07-04 12:43:28 +02:00
2013-07-30 17:59:44 +02:00
/**
2014-02-13 11:55:11 +01:00
* Renders the current World.
2013-07-30 17:59:44 +02:00
*/
void renderWorld();
2013-07-30 17:59:44 +02:00
2013-09-09 05:04:21 +02:00
void renderNamedFrame(Model*, const glm::mat4& matrix, const std::string& name);
2013-09-11 01:26:13 +02:00
void renderGeometry(Model*, size_t geom, const glm::mat4& modelMatrix, GTAObject* = nullptr);
2014-02-13 11:55:11 +01:00
/**
* Renders a model (who'd have thought)
*/
2013-09-11 01:26:13 +02:00
void renderModel(Model*, const glm::mat4& modelMatrix, GTAObject* = nullptr, Animator* animator = nullptr);
2013-07-30 17:59:44 +02:00
/**
2014-02-13 11:55:11 +01:00
* Debug method renders all AI paths
2013-07-30 17:59:44 +02:00
*/
void renderPaths();
2013-07-02 09:53:23 +02:00
};
#endif