2013-07-02 09:53:23 +02:00
|
|
|
#ifndef _GTARENDERER_HPP_
|
|
|
|
#define _GTARENDERER_HPP_
|
2013-07-03 10:46:07 +02:00
|
|
|
|
|
|
|
#define GLEW_STATIC
|
|
|
|
#include <GL/glew.h>
|
2013-07-04 03:40:47 +02:00
|
|
|
#include <memory>
|
2013-12-20 14:43:12 +01:00
|
|
|
#include <vector>
|
2013-07-03 10:46:07 +02:00
|
|
|
|
|
|
|
#include <renderwure/render/ViewCamera.hpp>
|
2013-07-02 09:53:23 +02:00
|
|
|
|
2013-07-04 03:40:47 +02:00
|
|
|
class Model;
|
2013-07-02 09:53:23 +02:00
|
|
|
class GTAEngine;
|
2013-07-24 02:44:08 +02:00
|
|
|
class GTAObject;
|
2013-09-11 01:26:13 +02:00
|
|
|
class Animator;
|
2013-07-22 05:39:58 +02:00
|
|
|
|
2013-07-02 09:53:23 +02:00
|
|
|
class GTARenderer
|
|
|
|
{
|
2013-07-24 01:42:50 +02:00
|
|
|
GTAEngine* engine;
|
2013-12-20 14:43:12 +01:00
|
|
|
|
|
|
|
struct RQueueEntry {
|
|
|
|
Model* model;
|
|
|
|
size_t g;
|
|
|
|
size_t sg;
|
|
|
|
glm::mat4 matrix;
|
|
|
|
GTAObject* object;
|
|
|
|
};
|
|
|
|
|
|
|
|
// 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-24 01:42:50 +02:00
|
|
|
|
2013-07-02 09:53:23 +02:00
|
|
|
public:
|
|
|
|
|
2013-07-24 01:42:50 +02:00
|
|
|
GTARenderer(GTAEngine*);
|
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;
|
2013-07-03 10:46:07 +02:00
|
|
|
|
2013-07-05 03:15:29 +02:00
|
|
|
GLint uniModel, uniProj, uniView, uniCol, uniAmbientCol, uniSunDirection, uniDynamicCol;
|
|
|
|
GLint uniMatDiffuse, uniMatAmbient, uniFogStart, uniFogEnd;
|
|
|
|
GLint posAttrib, normalAttrib, texAttrib, colourAttrib;
|
2013-07-03 10:46:07 +02:00
|
|
|
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
|
|
|
|
2013-07-06 02:39:54 +02:00
|
|
|
/// Internal VAO to avoid clobbering global state.
|
2013-07-30 17:59:44 +02:00
|
|
|
GLuint vao, debugVAO;
|
2013-07-06 02:39:54 +02:00
|
|
|
|
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
|
|
|
/**
|
|
|
|
* @brief renderWorld renders the world.
|
|
|
|
*/
|
2013-07-24 01:42:50 +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-07-24 01:42:50 +02:00
|
|
|
|
2013-09-11 01:26:13 +02:00
|
|
|
void renderGeometry(Model*, size_t geom, const glm::mat4& modelMatrix, GTAObject* = nullptr);
|
2013-07-22 05:39:58 +02:00
|
|
|
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief renderPaths renders the AI paths.
|
|
|
|
*/
|
|
|
|
void renderPaths();
|
2013-07-02 09:53:23 +02:00
|
|
|
};
|
|
|
|
|
2013-07-22 05:39:58 +02:00
|
|
|
#endif
|