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

77 lines
1.8 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 <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;
class GTAObject;
2013-09-11 01:26:13 +02:00
class Animator;
2013-07-02 09:53:23 +02:00
class GTARenderer
{
GTAEngine* engine;
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-02 09:53:23 +02:00
public:
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-05 03:15:29 +02:00
GLint uniModel, uniProj, uniView, uniCol, uniAmbientCol, uniSunDirection, uniDynamicCol;
GLint uniMatDiffuse, uniMatAmbient, uniFogStart, uniFogEnd;
GLint posAttrib, normalAttrib, texAttrib, colourAttrib;
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
/**
* @brief renderWorld renders the world.
*/
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);
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
};
#endif