GlistEngine
Loading...
Searching...
No Matches
gRenderer.h
Go to the documentation of this file.
1/*
2 * gRenderManager.h
3 *
4 * Created on: 4 Ara 2020
5 * Author: Acer
6 */
7
8#pragma once
9
10#ifndef CORE_GRENDERER_H_
11#define CORE_GRENDERER_H_
12
13#include "gObject.h"
14
15#if defined(WIN32) || defined(LINUX)
16//#include <GL/glext.h>
17#include <GL/glew.h>
18#include <GL/gl.h>
19#include <GL/glu.h>
20#endif
21#if defined(EMSCRIPTEN)
22#include <GLES3/gl3.h>
23#include <GLES3/gl2ext.h> // well, okay?
24#include <GLES3/gl3platform.h>
25#endif
26#if defined(ANDROID)
27#include <GLES3/gl3.h>
28#include <GLES3/gl3ext.h>
29#include <GLES3/gl3platform.h>
30#endif
31#if TARGET_OS_OSX
32#include <GL/glew.h>
33#include <OpenGL/gl.h>
34#include <OpenGL/glu.h>
35#endif
36#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
37# include <OpenGLES/ES3/gl.h>
38# include <OpenGLES/ES3/glext.h>
39# include <OpenGLES/gltypes.h>
40#endif
41#define GLM_ENABLE_EXPERIMENTAL
42#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
43#include <glm/glm.hpp>
44#include <glm/gtc/matrix_inverse.hpp>
45#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
46#include <glm/gtx/quaternion.hpp>
47
48#include "gColor.h"
49#include "gConstants.h"
50#include <deque>
51#include <memory>
52#include <vector>
53
54#ifndef GLIST_MAX_LIGHTS
55// amount of maximum lights, this is used to allocate memory for the light uniform buffer
56#define GLIST_MAX_LIGHTS 8
57#endif
58
59// You can define ENGINE_OPENGL_CHECKS to enable OpenGL checks
60// without debugging.
61#if defined(DEBUG) || defined(ENGINE_OPENGL_CHECKS)
62#define G_CHECK_GL(a) gCheckGLErrorAndPrint("Previously Unhandled ", __PRETTY_FUNCTION__, __LINE__); a; gCheckGLErrorAndPrint("", __PRETTY_FUNCTION__, __LINE__)
63#define G_CHECK_GL2(value, fn) gCheckGLErrorAndPrint("Previously Unhandled ", __PRETTY_FUNCTION__, __LINE__); value = fn; gCheckGLErrorAndPrint("", __PRETTY_FUNCTION__, __LINE__)
64#else
65#define G_CHECK_GL(fn) fn
66#define G_CHECK_GL2(value, fn) value = fn
67#endif
68
69void gCheckGLErrorAndPrint(const std::string& prefix, const std::string& func, int line);
70
74void gCullFace(int cullingFace);
76void gSetCullingDirection(int cullingDirection);
78
79void gDrawLine(float x1, float y1, float x2, float y2, float thickness = 1.0f);
80void gDrawLine(float x1, float y1, float z1, float x2, float y2, float z2, float thickness = 1.0f);
81void gDrawTriangle(float px, float py, float qx, float qy, float rx, float ry, bool is_filled = true);
82void gDrawCircle(float xCenter, float yCenter, float radius, bool isFilled = false, float numberOfSides = 64.0f);
83void gDrawCross(float x, float y, float width, float height, float thickness, bool isFilled);
84void gDrawArc(float xCenter, float yCenter, float radius, bool isFilled = true, int numberOfSides = 60, float degree = 360.0f, float rotate = 360.0f);
85void gDrawArrow(float x1, float y1, float length, float angle, float tipLength, float tipAngle);
86void gDrawRectangle(float x, float y, float w, float h, bool isFilled = false);
87void gDrawRoundedRectangle(float x, float y, float w, float h, int radius, bool isFilled);
88void gDrawBox(float x, float y, float z, float w = 1.0f, float h = 1.0f, float d = 1.0f, bool isFilled = true);
89void gDrawBox(glm::mat4 transformationMatrix, bool isFilled = true);
90void gDrawSphere(float xPos, float yPos, float zPos, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int xSegmentNum = 64, int ySegmentNum = 32, bool isFilled = true);
91void gDrawCylinder(float x, float y, float z, int r, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
92void gDrawCylinderOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
93void gDrawCylinderTrapezodial(float x, float y, float z, int r1, int r2, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
94void gDrawCylinderObliqueTrapezodial(float x, float y, float z, int r1, int r2, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0, 1.0, 1.0), int segmentnum = 32, bool isFilled = true);
95void gDrawCone(float x, float y, float z, int r, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
96void gDrawConeOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
97void gDrawPyramid(float x, float y, float z, int r, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int numberofsides = 4, bool isFilled = true);
98void gDrawPyramidOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int numberofsides = 4, bool isFilled = true);
99void gDrawTube(float x, float y, float z, int outerradius,int innerradious, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
100void gDrawTubeOblique(float x, float y, float z, int outerradius,int innerradious, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
101void gDrawTubeTrapezodial(float x, float y, float z, int topouterradius,int topinnerradious, int buttomouterradious, int buttominnerradious, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
102void gDrawTubeObliqueTrapezodial(float x, float y, float z, int topouterradius,int topinnerradious, int buttomouterradious, int buttominnerradious, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
103
104class gVbo;
105class gFbo;
106
107template<typename T>
108class gUbo;
109class gLight;
110class gImage;
111class gShader;
112class gCamera;
113class gGrid;
114class gLine;
115class gTriangle;
116class gCircle;
117class gCross;
118class gArc;
119class gRectangle;
121class gBox;
122
123class gRenderer : public gObject {
124public:
127 static const int FOGMODE_LINEAR, FOGMODE_EXP;
128 struct alignas(16) gSceneLightData {
129 alignas(4) int type;
130 alignas(16) glm::vec3 position;
131 alignas(16) glm::vec3 direction;
132 alignas(16) glm::vec4 ambient;
133 alignas(16) glm::vec4 diffuse;
134 alignas(16) glm::vec4 specular;
135
136 alignas(4) float constant;
137 alignas(4) float linear;
138 alignas(4) float quadratic;
139
140 alignas(4) float spotcutoffangle;
141 alignas(4) float spotoutercutoffangle;
142 };
143
144 struct alignas(16) gSceneLights {
145 alignas(4) int lightnum = 0;
146 // bitwise enabled lights, 1 means enabled, 0 means disabled, 32-bit integer
147 // supports only 32 max lights, make sure to change this if max lights is changed to be something above 32
148 alignas(4) int enabledlights;
149 alignas(16) glm::vec4 globalambientcolor;
151 };
152
154 ENABLE_SSAO = 0b0001,
155 ENABLE_FOG = 0b0010,
156 ENABLE_GAMMA = 0b0100,
157 ENABLE_HDR = 0b1000,
158 ENABLE_SOFT_SHADOWS = 0b10000
159 };
160
161 struct alignas(16) gSceneFogData {
162 alignas(16) glm::vec3 color;
163 alignas(4) float linearStart;
164 alignas(4) float linearEnd;
165 alignas(4) float density;
166 alignas(4) float gradient;
167 alignas(4) int mode;
168 };
169 struct alignas(16) gSceneData {
170 alignas(16) gColor rendercolor;
171 alignas(16) glm::vec3 viewpos;
172 alignas(16) glm::mat4 viewmatrix;
173 alignas(4) unsigned int flags;
175 };
176
177 gRenderer() = default;
178 virtual ~gRenderer();
179
180 static void setScreenSize(int screenWidth, int screenHeight);
181 static void setUnitScreenSize(int unitWidth, int unitHeight);
182 static void setScreenScaling(int screenScaling);
183
184 int getWidth();
190 static int getScreenScaling();
191 unsigned int getFullscreenQuadVAO() const;
192
193 static void setCurrentResolution(int resolution);
194 static void setCurrentResolution(int screenWidth, int screenHeight);
195 static void setUnitResolution(int resolution);
196 static void setUnitResolution(int screenWidth, int screenHeight);
197 static int getResolution(int screenWidth, int screenHeight);
200 static float getScaleMultiplier();
201 static int scaleX(int x);
202 static int scaleY(int y);
203 static int unscaleX(int x);
204 static int unscaleY(int y);
205
206 //grid
207 void drawGrid();
213 void setGridEnableAxis(bool xy, bool yz, bool xz);
214 void setGridEnableXY(bool xy);
215 void setGridEnableYZ(bool yz);
216 void setGridEnableXZ(bool xz);
217 void setGridColorofAxisXZ(int r, int g, int b, int a);
218 void setGridColorofAxisYZ(int r, int g, int b, int a);
219 void setGridColorofAxisXY(int r, int g, int b, int a);
223 void setGridColorofAxisWireFrameXZ(int r, int g, int b, int a);
224 void setGridColorofAxisWireFrameYZ(int r, int g, int b, int a);
225 void setGridColorofAxisWireFrameXY(int r, int g, int b, int a);
233 void setGridMaxLength(float length);
235 void setGridLineInterval(float intervalvalue);
237
238 gGrid* getGrid() const;
239 void setGrid(gGrid* newgrid);
240
241 void setColor(int r, int g, int b, int a = 255);
242 void setColor(float r, float g, float b, float a = 1.0f);
243 void setColor(const gColor& color);
244 void setColor(gColor* color);
246
247 virtual void clear() = 0;
248 virtual void clearColor(int r, int g, int b, int a = 255) = 0;
249 virtual void clearColor(gColor color) = 0;
250
254 void setLightingColor(int r, int g, int b, int a = 255);
255 void setLightingColor(gColor* color) { setLightingColor(color->r, color->g, color->b, color->a); }
257 void setLightingPosition(glm::vec3 lightingPosition);
259
260 void setGlobalAmbientColor(int r, int g, int b, int a = 255);
261 void setGlobalAmbientColor(gColor color) { setGlobalAmbientColor(color.r, color.g, color.b, color.a); }
263
264 void enableFog();
266 void setFogNo(int no);
267 void setFogColor(float r, float g, float b);
268 void setFogColor(const gColor& color);
269 void setFogMode(int fogMode);
270 void setFogDensity(float value);
271 void setFogGradient(float value);
272 void setFogLinearStart(float value);
273 void setFogLinearEnd(float value);
274
276 int getFogNo() const;
277 const gColor& getFogColor() const;
278 int getFogMode() const;
279 float getFogDensity() const;
280 float getFogGradient() const;
281 float getFogLinearStart() const;
282 float getFogLinearEnd() const;
283
284 // add and remove functions are called by gLight class automatically,
285 // so you don't need to
286 void addSceneLight(gLight* light);
288 gLight* getSceneLight(int lightNo);
292
294
295 virtual void enableDepthTest() = 0;
296 virtual void enableDepthTest(int depthTestType) = 0;
297 virtual void setDepthTestFunc(int depthTestType) = 0;
298 virtual void disableDepthTest() = 0;
299 virtual bool isDepthTestEnabled() = 0;
300 virtual int getDepthTestType() = 0;
301
302 virtual void enableAlphaBlending() = 0;
303 virtual void disableAlphaBlending() = 0;
304 virtual bool isAlphaBlendingEnabled() = 0;
305 virtual void enableAlphaTest() = 0;
306 virtual void disableAlphaTest() = 0;
307 virtual bool isAlphaTestEnabled() = 0;
308
312 void setSSAOBias(float value);
313 float getSSAOBias();
314 void setSSAORadius(float value);
316 void setSSAOStrength(float value);
318 void setSSAODebug(bool enabled);
321 void beginSSAO();
322 void endSSAO();
323
327
329 void enableHDR();
331
335
349
350 void setProjectionMatrix(glm::mat4 projectionMatrix);
351 void setProjectionMatrix2d(glm::mat4 projectionMatrix2d);
352 void setViewMatrix(glm::mat4 viewMatrix);
353 void setCameraPosition(glm::vec3 cameraPosition);
355 const glm::mat4& getProjectionMatrix() const;
356 const glm::mat4& getProjectionMatrix2d() const;
357 const glm::mat4& getViewMatrix() const;
358 const glm::vec3& getCameraPosition() const;
359 const gCamera* getCamera() const;
362
363 /*
364 * Takes Screen Shot of the current Rendered Screen and returns it as an gImage class
365 */
366 virtual void takeScreenshot(gImage& img) = 0;
367
368 /*
369 * Takes Screen Shot of the part of current Rendered Screen and returns it as an gImage class
370 */
371 virtual void takeScreenshot(gImage& img, int x, int y, int width, int height) = 0;
372
373 /* -------------- gUbo ------------- */
374 virtual GLuint genBuffers() = 0;
375 virtual void deleteBuffer(GLuint& buffer) = 0;
376
377 virtual void bindBuffer(GLenum target, GLuint buffer) = 0;
378 virtual void unbindBuffer(GLenum target) = 0;
379
380 virtual void bufSubData(GLuint buffer, int offset, int size, const void* data) = 0;
381 virtual void setBufferData(GLuint buffer, const void* data, size_t size, int usage) = 0;
382 virtual void setBufferRange(int index, GLuint buffer, int offset, int size) = 0;
383
384 virtual void attachUbo(GLuint id, int bindingpoint, const std::string& uboName) = 0;
385
386 /* -------------- gVbo --------------- */
387 virtual GLuint createVAO() = 0;
388 virtual void deleteVAO(GLuint& vao) = 0;
389
390 virtual void bindVAO(GLuint vao) = 0;
391 virtual void unbindVAO() = 0;
392
393 virtual void setVertexBufferData(GLuint vbo, size_t size, const void* data, int usage) = 0;
394 virtual void setIndexBufferData(GLuint ebo, size_t size, const void* data, int usage) = 0;
395
396 virtual void drawArrays(int drawMode, int count) = 0;
397 virtual void drawElements(int drawMode, int count) = 0;
398
399 virtual void enableVertexAttrib(int index) = 0;
400 virtual void disableVertexAttrib(int index) = 0;
401 virtual void setVertexAttribPointer(int index, int size, int type, bool normalized, int stride, const void* pointer) = 0;
402
403 virtual void setViewport(int x, int y, int width, int height) = 0;
404
405 /* -------------- gFbo --------------- */
406 virtual GLuint createFramebuffer() = 0;
407 virtual void deleteFramebuffer(GLuint& fbo) = 0;
408 virtual void bindFramebuffer(GLuint fbo) = 0;
409 virtual void checkFramebufferStatus() = 0;
410
411 virtual GLuint createRenderbuffer() = 0;
412 virtual void deleteRenderbuffer(GLuint& rbo) = 0;
413 virtual void bindRenderbuffer(GLuint rbo) = 0;
414 virtual void setRenderbufferStorage(GLenum format, int width, int height) = 0;
415
416 virtual void attachTextureToFramebuffer(GLenum attachment, GLenum textarget, GLuint texId, GLuint level = 0) = 0;
417 virtual void attachRenderbufferToFramebuffer(GLenum attachment, GLuint rbo) = 0;
418
419 virtual void setDrawBufferNone() = 0;
420 virtual void setReadBufferNone() = 0;
421
422 virtual void createFullscreenQuad(GLuint& vao, GLuint& vbo) = 0;
423 virtual void deleteFullscreenQuad(GLuint& vao, GLuint* vbo) = 0;
424
425 /* -------------- gShader --------------- */
426 // This function loads shaders without preproccesing them. Geometry source can be nullptr.
427 virtual GLuint loadProgram(const char* vertexSource, const char* fragmentSource, const char* geometrySource) = 0;
428 virtual void checkCompileErrors(GLuint shader, const std::string& type) = 0;
429 virtual void setBool(GLuint uniformloc, bool value) = 0;
430 virtual void setInt(GLuint uniformloc, int value) = 0;
431 virtual void setUnsignedInt(GLuint uniformloc, unsigned int value) = 0;
432 virtual void setFloat(GLuint uniformloc, float value) = 0;
433 virtual void setVec2(GLuint uniformloc, const glm::vec2& value) = 0;
434 virtual void setVec2(GLuint uniformloc, float x, float y) = 0;
435 virtual void setVec3(GLuint uniformloc, const glm::vec3& value) = 0;
436 virtual void setVec3(GLuint uniformloc, float x, float y, float z) = 0;
437 virtual void setVec4(GLuint uniformloc, const glm::vec4& value) = 0;
438 virtual void setVec4(GLuint uniformloc, float x, float y, float z, float w) = 0;
439 virtual void setMat2(GLuint uniformloc, const glm::mat2& mat) = 0;
440 virtual void setMat3(GLuint uniformloc, const glm::mat3& mat) = 0;
441 virtual void setMat4(GLuint uniformloc, const glm::mat4& mat) = 0;
442 virtual GLuint getUniformLocation(GLuint id, const std::string& name) = 0;
443
444 virtual void useShader(GLuint id) const = 0;
445 virtual void resetShader(GLuint id, bool loaded) const = 0;
446
447 /* ------------ gPostProcessManager ------------- */
448 virtual void clearScreen(bool color = true, bool depth = true) = 0;
449 virtual void bindQuadVAO() = 0;
450 virtual void drawFullscreenQuad() = 0;
451 virtual void bindDefaultFramebuffer() = 0;
452
453 /* -------------- gGrid --------------- */
454 virtual void drawVbo(const gVbo& vbo) = 0;
455
456 /* ---------------- gTexture ---------------- */
457 virtual GLuint createTextures() = 0;
458 virtual void bindTexture(GLuint texId) = 0;
459 virtual void bindTexture(GLuint texId, int textureSlotNo) = 0;
460 virtual void unbindTexture() = 0;
461 virtual void activateTexture(int textureSlotNo = 0) = 0;
462 virtual void resetTexture() = 0;
463 virtual void deleteTexture(GLuint& texId) = 0;
464
465 virtual void texImage2D(GLenum target, GLint internalFormat, int width, int height, GLint format, GLint type, void* data) = 0;
466 virtual void setWrapping(GLenum target, GLint wrapS, GLint wrapT) = 0;
467 virtual void setWrapping(GLenum target, GLint wrapS, GLint wrapT, GLint wrapR) = 0;
468
469 virtual void setFiltering(GLenum target, GLint minFilter, GLint magFilter) = 0;
470 virtual void setWrappingAndFiltering(GLenum target, GLint wrapS, GLint wrapT, GLint minFilter, GLint magFilter) = 0;
471 virtual void setWrappingAndFiltering(GLenum target, GLint wrapS, GLint wrapT, GLint wrapR, GLint minFilter, GLint magFilter) = 0;
472 virtual void setSwizzleMask(GLint swizzleMask[4]) = 0;
473
474 virtual void readTexturePixels(unsigned char* inPixels, GLuint textureId, int width, int height, GLenum format) = 0;
475 virtual void readTexturePixelsHDR(float* inPixels, GLuint textureId, int width, int height, GLenum format) = 0;
476
477 virtual void generateMipMap() = 0;
478
479 /* ---------------- gSkybox ---------------- */
480 virtual void bindSkyTexture(GLuint texId) = 0;
481 virtual void bindSkyTexture(GLuint texId, int textureSlot) = 0;
482 virtual void unbindSkyTexture() = 0;
483 virtual void unbindSkyTexture(int textureSlotNo) = 0;
484 virtual void generateSkyMipMap() = 0;
485 virtual void enableDepthTestEqual() = 0;
486 virtual void createQuad(GLuint& inQuadVAO, GLuint& inQuadVBO) = 0;
487 virtual void enableCubeMap() = 0;
488
489 /* ---------------- gRenderObject ---------------- */
490 virtual void pushMatrix() = 0;
491 virtual void popMatrix() = 0;
492
493 /* ---------------- Utilities ---------------- */
494 void drawLine(float x1, float y1, float x2, float y2, float thickness = 1.0f);
495 void drawLine(float x1, float y1, float z1, float x2, float y2, float z2, float thickness = 1.0f);
496 void drawTriangle(float px, float py, float qx, float qy, float rx, float ry, bool is_filled = true);
497 void drawCircle(float xCenter, float yCenter, float radius, bool isFilled = false, float numberOfSides = 64.0f);
498 void drawCross(float x, float y, float width, float height, float thickness, bool isFilled);
499 void drawArc(float xCenter, float yCenter, float radius, bool isFilled = true, int numberOfSides = 60, float degree = 360.0f, float rotate = 360.0f);
500 void drawArrow(float x1, float y1, float length, float angle, float tipLength, float tipAngle);
501 void drawRectangle(float x, float y, float w, float h, bool isFilled = false);
502 void drawRoundedRectangle(float x, float y, float w, float h, int radius, bool isFilled);
503 void drawBox(float x, float y, float z, float w = 1.0f, float h = 1.0f, float d = 1.0f, bool isFilled = true);
504 void drawBox(glm::mat4 transformationMatrix, bool isFilled = true);
505 void drawSphere(float xPos, float yPos, float zPos, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int xSegmentNum = 64, int ySegmentNum = 32, bool isFilled = true);
506 void drawCylinder(float x, float y, float z, int r, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
507 void drawCylinderOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
508 void drawCylinderTrapezodial(float x, float y, float z, int r1, int r2, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
509 void drawCylinderObliqueTrapezodial(float x, float y, float z, int r1, int r2, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0, 1.0, 1.0), int segmentnum = 32, bool isFilled = true);
510 void drawCone(float x, float y, float z, int r, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
511 void drawConeOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
512 void drawPyramid(float x, float y, float z, int r, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int numberofsides = 4, bool isFilled = true);
513 void drawPyramidOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int numberofsides = 4, bool isFilled = true);
514 void drawTube(float x, float y, float z, int outerradius,int innerradious, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
515 void drawTubeOblique(float x, float y, float z, int outerradius,int innerradious, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
516 void drawTubeTrapezodial(float x, float y, float z, int topouterradius,int topinnerradious, int buttomouterradious, int buttominnerradious, int h, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
517 void drawTubeObliqueTrapezodial(float x, float y, float z, int topouterradius,int topinnerradious, int buttomouterradious, int buttominnerradious, int h, glm::vec2 shiftdistance, glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum = 32, bool isFilled = true);
518
519protected:
520 friend class gRenderObject; // this is where renderer->init() is called from
521 friend class gAppManager;
522
523 static int width, height;
525 static int screenscaling;
527
529
531 int fogno;
538
539 std::deque<gLight*> scenelights;
547
550 unsigned int depthtesttypeid[2];
552
554 float ssaobias;
563 unsigned int ssaonoisetexture;
564 std::vector<glm::vec3> ssaokernel;
572
586
590 glm::mat4 viewmatrix;
591 glm::mat4 viewmatrixold;
592 glm::vec3 cameraposition;
594
597
598 unsigned int fullscreenquadvao;
599 unsigned int fullscreenquadvbo;
600
601 // std::unique_ptr is automatically deletes the underlying object when this gRenderer object is deleted
602 std::unique_ptr<gLine> linemesh, linemesh2, linemesh3;
603 std::unique_ptr<gTriangle> trianglemesh;
604 std::unique_ptr<gCircle> circlemesh;
605 std::unique_ptr<gCross> crossmesh;
606 std::unique_ptr<gArc> arcmesh;
607 std::unique_ptr<gRectangle> rectanglemesh;
608 std::unique_ptr<gRoundedRectangle> roundedrectanglemesh;
609 std::unique_ptr<gBox> boxmesh;
610
611 virtual void init();
612 virtual void cleanup();
613 virtual void updatePackUnpackAlignment(int i) = 0;
614
615 static const std::string& getShaderSrcGridVertex();
616 static const std::string& getShaderSrcGridFragment();
617 static const std::string& getShaderSrcColorVertex();
618 static const std::string& getShaderSrcColorFragment();
619 static const std::string& getShaderSrcTextureVertex();
620 static const std::string& getShaderSrcTextureFragment();
621 static const std::string& getShaderSrcImageVertex();
622 static const std::string& getShaderSrcImageFragment();
623 static const std::string& getShaderSrcFontVertex();
624 static const std::string& getShaderSrcFontFragment();
625 static const std::string& getShaderSrcSkyboxVertex();
626 static const std::string& getShaderSrcSkyboxFragment();
627 static const std::string& getShaderSrcShadowmapVertex();
628 static const std::string& getShaderSrcShadowmapFragment();
629 static const std::string& getShaderSrcPbrVertex();
630 static const std::string& getShaderSrcPbrFragment();
631 static const std::string& getShaderSrcCubemapVertex();
632 static const std::string& getShaderSrcEquirectangularFragment();
633 static const std::string& getShaderSrcIrradianceFragment();
634 static const std::string& getShaderSrcPrefilterFragment();
635 static const std::string& getShaderSrcBrdfVertex();
636 static const std::string& getShaderSrcBrdfFragment();
637 static const std::string& getShaderSrcFboVertex();
638 static const std::string& getShaderSrcFboFragment();
639 static const std::string& getShaderSrcSSAOVertex();
640 static const std::string& getShaderSrcSSAOFragment();
641 static const std::string& getShaderSrcSSAOBlurFragment();
642
643
644};
645
646#endif /* CORE_GRENDERER_H_ */
Definition gAppManager.h:154
Definition gArc.h:13
Definition gBox.h:30
Definition gCamera.h:19
Definition gCircle.h:32
Definition gColor.h:17
float r
Definition gColor.h:40
float g
Definition gColor.h:40
float a
Definition gColor.h:40
float b
Definition gColor.h:40
Definition gCross.h:13
Definition gFbo.h:15
Definition gGrid.h:16
Definition gImage.h:34
Definition gLight.h:22
Definition gLine.h:30
Definition gObject.h:33
Definition gRectangle.h:13
Definition gRenderObject.h:25
Definition gRenderer.h:123
void drawPyramid(float x, float y, float z, int r, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int numberofsides=4, bool isFilled=true)
float getFogGradient() const
static const std::string & getShaderSrcColorVertex()
bool islightingenabled
Definition gRenderer.h:542
gLight * getSceneLight(int lightNo)
void setGridColorofAxisXZ(int r, int g, int b, int a)
void drawGridXY()
void restoreMatrices()
gShader * irradianceshader
Definition gRenderer.h:581
gShader * colorshader
Definition gRenderer.h:573
virtual void disableDepthTest()=0
virtual void bindTexture(GLuint texId)=0
virtual void drawArrays(int drawMode, int count)=0
gFbo * ssaofbo
Definition gRenderer.h:559
static const std::string & getShaderSrcCubemapVertex()
bool isdepthtestenabled
Definition gRenderer.h:548
void drawCross(float x, float y, float width, float height, float thickness, bool isFilled)
int fogmode
Definition gRenderer.h:535
static int height
Definition gRenderer.h:523
void disableLighting()
static int unscaleY(int y)
virtual void enableDepthTestEqual()=0
bool isSSAOAllocated()
bool isLightingEnabled()
static int unitheight
Definition gRenderer.h:524
gShader * brdfshader
Definition gRenderer.h:583
static void setCurrentResolution(int screenWidth, int screenHeight)
virtual void setBufferData(GLuint buffer, const void *data, size_t size, int usage)=0
virtual void clear()=0
void backupMatrices()
void setSSAOBias(float value)
virtual void setWrapping(GLenum target, GLint wrapS, GLint wrapT)=0
unsigned int fullscreenquadvbo
Definition gRenderer.h:599
void drawGridXZ()
virtual GLuint createVAO()=0
virtual void setVec3(GLuint uniformloc, const glm::vec3 &value)=0
gShader * equirectangularshader
Definition gRenderer.h:580
gColor * getLightingColor()
gShader * textureshader
Definition gRenderer.h:574
static void setUnitResolution(int resolution)
bool isssaodebug
Definition gRenderer.h:558
float getSSAOBias()
void setLightingColor(gColor *color)
Definition gRenderer.h:255
bool isGridXYEnabled()
void setGridColorofAxisYZ(int r, int g, int b, int a)
static const std::string & getShaderSrcSSAOBlurFragment()
bool isHDREnabled()
gColor globalambientcolor
Definition gRenderer.h:545
void setGridColorofAxisXY(gColor *color)
void disableHDR()
static const std::string & getShaderSrcEquirectangularFragment()
void drawRoundedRectangle(float x, float y, float w, float h, int radius, bool isFilled)
virtual void unbindTexture()=0
gColor * getGlobalAmbientColor()
virtual GLuint loadProgram(const char *vertexSource, const char *fragmentSource, const char *geometrySource)=0
gUbo< gSceneLights > * lightsubo
Definition gRenderer.h:540
virtual void deleteBuffer(GLuint &buffer)=0
float ssaobias
Definition gRenderer.h:554
bool isGridEnabled()
int getScreenHeight()
glm::vec3 lightingposition
Definition gRenderer.h:543
void setLightingColor(int r, int g, int b, int a=255)
void setGridColorofAxisWireFrameXY(int r, int g, int b, int a)
void updateScene()
bool isssaorendering
Definition gRenderer.h:566
virtual void enableCubeMap()=0
const gCamera * getCamera() const
void enableGammaCorrection()
bool isalphablendingenabled
Definition gRenderer.h:551
void disableSSAO()
void setSSAODebug(bool enabled)
void drawBox(float x, float y, float z, float w=1.0f, float h=1.0f, float d=1.0f, bool isFilled=true)
void setGridColorofAxisYZ(gColor *color)
void setGlobalAmbientColor(gColor color)
Definition gRenderer.h:261
gShader * pbrshader
Definition gRenderer.h:579
void enableLighting()
bool isFogEnabled()
virtual void disableVertexAttrib(int index)=0
static const std::string & getShaderSrcPbrFragment()
void setGridColorofAxisWireFrameYZ(gColor *color)
virtual int getDepthTestType()=0
static const int SCREENSCALING_NONE
Definition gRenderer.h:125
virtual void generateMipMap()=0
void beginSSAO()
int depthtesttype
Definition gRenderer.h:549
virtual void setViewport(int x, int y, int width, int height)=0
gFbo * ssaoresultfbo
Definition gRenderer.h:560
gShader * ssaoshader
Definition gRenderer.h:561
void setCameraPosition(glm::vec3 cameraPosition)
static const std::string & getShaderSrcSkyboxFragment()
virtual void setBool(GLuint uniformloc, bool value)=0
virtual void unbindSkyTexture()=0
static int currentresolution
Definition gRenderer.h:526
gShader * getImageShader()
gShader * getFontShader()
virtual void popMatrix()=0
gShader * getEquirectangularShader()
virtual ~gRenderer()
virtual void bindVAO(GLuint vao)=0
gShader * fboshader
Definition gRenderer.h:584
void setGridEnableYZ(bool yz)
virtual void checkCompileErrors(GLuint shader, const std::string &type)=0
virtual void bindQuadVAO()=0
virtual void bindBuffer(GLenum target, GLuint buffer)=0
virtual bool isDepthTestEnabled()=0
virtual void setDepthTestFunc(int depthTestType)=0
void addSceneLight(gLight *light)
gShader * shadowmapshader
Definition gRenderer.h:578
static const std::string & getShaderSrcColorFragment()
virtual GLuint createFramebuffer()=0
static int width
Definition gRenderer.h:523
void setFogNo(int no)
gShader * getSkyboxShader()
virtual bool isAlphaTestEnabled()=0
bool isGammaCorrectionEnabled()
static const std::string & getShaderSrcBrdfFragment()
virtual void setMat3(GLuint uniformloc, const glm::mat3 &mat)=0
glm::mat4 viewmatrixold
Definition gRenderer.h:591
const glm::mat4 & getProjectionMatrix2d() const
int getHeight()
void drawArrow(float x1, float y1, float length, float angle, float tipLength, float tipAngle)
virtual void disableAlphaTest()=0
gShader * getColorShader()
virtual void resetShader(GLuint id, bool loaded) const =0
int getUnitWidth()
gShader * getShadowmapShader()
static int unscaleX(int x)
void setGrid(gGrid *newgrid)
gShader * skyboxshader
Definition gRenderer.h:577
virtual void setVec2(GLuint uniformloc, const glm::vec2 &value)=0
static const std::string & getShaderSrcShadowmapFragment()
bool isSSAODebug()
static const std::string & getShaderSrcFontFragment()
virtual void bindFramebuffer(GLuint fbo)=0
void setGridEnableAxis(bool xy, bool yz, bool xz)
static const int DEPTHTESTTYPE_ALWAYS
Definition gRenderer.h:126
std::unique_ptr< gRoundedRectangle > roundedrectanglemesh
Definition gRenderer.h:608
static const std::string & getShaderSrcBrdfVertex()
virtual void bindTexture(GLuint texId, int textureSlotNo)=0
virtual void deleteFullscreenQuad(GLuint &vao, GLuint *vbo)=0
void setFogMode(int fogMode)
glm::vec3 cameraposition
Definition gRenderer.h:592
int getScreenWidth()
gRenderer()=default
static void setUnitResolution(int screenWidth, int screenHeight)
virtual void pushMatrix()=0
float foggradient
Definition gRenderer.h:534
void setGridColorofAxisWireFrameXZ(gColor *color)
gColor fogcolor
Definition gRenderer.h:532
const gColor & getFogColor() const
bool isssaoallocated
Definition gRenderer.h:557
bool isgammacorrectionenabled
Definition gRenderer.h:569
void drawTubeObliqueTrapezodial(float x, float y, float z, int topouterradius, int topinnerradious, int buttomouterradious, int buttominnerradious, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void enableSoftShadows()
virtual void drawFullscreenQuad()=0
virtual void setVec2(GLuint uniformloc, float x, float y)=0
virtual void activateTexture(int textureSlotNo=0)=0
virtual void setInt(GLuint uniformloc, int value)=0
virtual void setRenderbufferStorage(GLenum format, int width, int height)=0
void drawCircle(float xCenter, float yCenter, float radius, bool isFilled=false, float numberOfSides=64.0f)
void drawBox(glm::mat4 transformationMatrix, bool isFilled=true)
void cleanupSSAOResources()
static const int DEPTHTESTTYPE_LESS
Definition gRenderer.h:126
virtual void setMat4(GLuint uniformloc, const glm::mat4 &mat)=0
static const std::string & getShaderSrcImageVertex()
void setGridColorofAxisXZ(gColor *color)
int ssaorealdefaultfbo
Definition gRenderer.h:565
void drawArc(float xCenter, float yCenter, float radius, bool isFilled=true, int numberOfSides=60, float degree=360.0f, float rotate=360.0f)
void enableHDR()
void setGridEnableXY(bool xy)
glm::vec3 getLightingPosition()
virtual void enableDepthTest()=0
static int unitwidth
Definition gRenderer.h:524
void setGlobalAmbientColor(int r, int g, int b, int a=255)
virtual void clearColor(int r, int g, int b, int a=255)=0
void setSSAORadius(float value)
void drawTriangle(float px, float py, float qx, float qy, float rx, float ry, bool is_filled=true)
static const std::string & getShaderSrcFboVertex()
void setGridColorofAxisWireFrameXZ(int r, int g, int b, int a)
virtual void setSwizzleMask(GLint swizzleMask[4])=0
static void setScreenScaling(int screenScaling)
void drawPyramidOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int numberofsides=4, bool isFilled=true)
gShader * getGridShader()
float getSSAOStrength()
virtual void readTexturePixelsHDR(float *inPixels, GLuint textureId, int width, int height, GLenum format)=0
virtual void enableDepthTest(int depthTestType)=0
virtual void bindDefaultFramebuffer()=0
void setGridColorofAxisWireFrameYZ(int r, int g, int b, int a)
void drawLine(float x1, float y1, float x2, float y2, float thickness=1.0f)
gShader * prefiltershader
Definition gRenderer.h:582
void removeSceneLight(gLight *light)
gUbo< gSceneData > * sceneubo
Definition gRenderer.h:541
void setFogColor(float r, float g, float b)
glm::mat4 projectionmatrix2d
Definition gRenderer.h:589
virtual void setWrappingAndFiltering(GLenum target, GLint wrapS, GLint wrapT, GLint wrapR, GLint minFilter, GLint magFilter)=0
virtual void unbindBuffer(GLenum target)=0
virtual void setVec4(GLuint uniformloc, float x, float y, float z, float w)=0
unsigned int getFullscreenQuadVAO() const
virtual void setFloat(GLuint uniformloc, float value)=0
virtual void unbindSkyTexture(int textureSlotNo)=0
void enableFog()
virtual void setVertexBufferData(GLuint vbo, size_t size, const void *data, int usage)=0
virtual void enableVertexAttrib(int index)=0
virtual void createQuad(GLuint &inQuadVAO, GLuint &inQuadVBO)=0
float getFogLinearStart() const
float getFogDensity() const
static int getScreenScaling()
void setGridMaxLength(float length)
static const std::string & getShaderSrcGridVertex()
std::vector< glm::vec3 > ssaokernel
Definition gRenderer.h:564
gGrid * originalgrid
Definition gRenderer.h:596
void setGridEnableXZ(bool xz)
static const std::string & getShaderSrcFontVertex()
virtual void cleanup()
virtual void setDrawBufferNone()=0
virtual void resetTexture()=0
bool isSoftShadowsEnabled()
virtual void takeScreenshot(gImage &img, int x, int y, int width, int height)=0
void enableGrid()
std::unique_ptr< gCircle > circlemesh
Definition gRenderer.h:604
virtual void setMat2(GLuint uniformloc, const glm::mat2 &mat)=0
int fogno
Definition gRenderer.h:531
void setColor(const gColor &color)
void disableGrid()
virtual GLuint getUniformLocation(GLuint id, const std::string &name)=0
static const int FOGMODE_EXP
Definition gRenderer.h:127
virtual void deleteFramebuffer(GLuint &fbo)=0
gShader * getTextureShader()
glm::mat4 projectionmatrixold
Definition gRenderer.h:588
void endSSAO()
static const std::string & getShaderSrcPbrVertex()
void setSSAOStrength(float value)
virtual void deleteTexture(GLuint &texId)=0
bool isssaoenabled
Definition gRenderer.h:553
void enableSSAO()
void disableGammaCorrection()
virtual void bindSkyTexture(GLuint texId)=0
virtual void bufSubData(GLuint buffer, int offset, int size, const void *data)=0
static const std::string & getShaderSrcShadowmapVertex()
virtual void attachUbo(GLuint id, int bindingpoint, const std::string &uboName)=0
std::unique_ptr< gLine > linemesh3
Definition gRenderer.h:602
static int getResolution(int screenWidth, int screenHeight)
std::unique_ptr< gLine > linemesh
Definition gRenderer.h:602
void setGridColorofAxisXY(int r, int g, int b, int a)
gShader * getPrefilterShader()
virtual void init()
static int screenscaling
Definition gRenderer.h:525
std::deque< gLight * > scenelights
Definition gRenderer.h:539
static const std::string & getShaderSrcTextureVertex()
float getGridLineInterval()
void drawTube(float x, float y, float z, int outerradius, int innerradious, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
static const int FOGMODE_LINEAR
Definition gRenderer.h:127
gShader * getPbrShader()
gShader * getIrradianceShader()
int getCurrentResolution()
gGrid * getGrid() const
void drawCylinderObliqueTrapezodial(float x, float y, float z, int r1, int r2, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0, 1.0, 1.0), int segmentnum=32, bool isFilled=true)
void drawCone(float x, float y, float z, int r, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
float ssaoradius
Definition gRenderer.h:555
virtual void attachRenderbufferToFramebuffer(GLenum attachment, GLuint rbo)=0
void setLightingPosition(glm::vec3 lightingPosition)
virtual void setWrapping(GLenum target, GLint wrapS, GLint wrapT, GLint wrapR)=0
int getSceneLightNum()
void setFogColor(const gColor &color)
gShader * gridshader
Definition gRenderer.h:585
std::unique_ptr< gRectangle > rectanglemesh
Definition gRenderer.h:607
virtual void setVec4(GLuint uniformloc, const glm::vec4 &value)=0
bool isglobalambientcolorchanged
Definition gRenderer.h:546
int getUnitHeight()
static int scaleY(int y)
float fogdensity
Definition gRenderer.h:533
gShader * getBrdfShader()
static const int SCREENSCALING_MIPMAP
Definition gRenderer.h:125
virtual GLuint createRenderbuffer()=0
const glm::mat4 & getViewMatrix() const
virtual void takeScreenshot(gImage &img)=0
virtual void enableAlphaBlending()=0
void removeAllSceneLights()
virtual void clearScreen(bool color=true, bool depth=true)=0
virtual void createFullscreenQuad(GLuint &vao, GLuint &vbo)=0
int getUnitResolution()
virtual void unbindVAO()=0
void drawCylinderTrapezodial(float x, float y, float z, int r1, int r2, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void setColor(int r, int g, int b, int a=255)
gGrid * grid
Definition gRenderer.h:595
virtual void attachTextureToFramebuffer(GLenum attachment, GLenum textarget, GLuint texId, GLuint level=0)=0
std::unique_ptr< gTriangle > trianglemesh
Definition gRenderer.h:603
float getSSAORadius()
virtual void setUnsignedInt(GLuint uniformloc, unsigned int value)=0
static const std::string & getShaderSrcPrefilterFragment()
void setFogGradient(float value)
static void setScreenSize(int screenWidth, int screenHeight)
void drawCylinderOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
static void setCurrentResolution(int resolution)
bool isGridXZEnabled()
virtual void texImage2D(GLenum target, GLint internalFormat, int width, int height, GLint format, GLint type, void *data)=0
virtual void updatePackUnpackAlignment(int i)=0
unsigned int ssaonoisetexture
Definition gRenderer.h:563
virtual void setIndexBufferData(GLuint ebo, size_t size, const void *data, int usage)=0
void drawSphere(float xPos, float yPos, float zPos, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int xSegmentNum=64, int ySegmentNum=32, bool isFilled=true)
virtual void deleteVAO(GLuint &vao)=0
unsigned int fullscreenquadvao
Definition gRenderer.h:598
static const std::string & getShaderSrcImageFragment()
void setCamera(gCamera *camera)
bool isGridYZEnabled()
gShader * getFboShader()
gColor lightingcolor
Definition gRenderer.h:544
void setGridLineInterval(float intervalvalue)
gCamera * camera
Definition gRenderer.h:593
virtual void drawElements(int drawMode, int count)=0
static int unitresolution
Definition gRenderer.h:526
bool issoftshadowsenabled
Definition gRenderer.h:571
virtual void clearColor(gColor color)=0
void setColor(gColor *color)
void setProjectionMatrix(glm::mat4 projectionMatrix)
glm::mat4 projectionmatrix
Definition gRenderer.h:587
gColor * rendercolor
Definition gRenderer.h:528
virtual void setReadBufferNone()=0
static const std::string & getShaderSrcFboFragment()
void drawRectangle(float x, float y, float w, float h, bool isFilled=false)
virtual bool isAlphaBlendingEnabled()=0
float getGridMaxLength()
bool isalphatestenabled
Definition gRenderer.h:551
void setFogDensity(float value)
int getFogNo() const
bool isfogenabled
Definition gRenderer.h:530
std::unique_ptr< gBox > boxmesh
Definition gRenderer.h:609
std::unique_ptr< gArc > arcmesh
Definition gRenderer.h:606
virtual void deleteRenderbuffer(GLuint &rbo)=0
virtual void bindRenderbuffer(GLuint rbo)=0
static int scaleX(int x)
float getFogLinearEnd() const
gShader * imageshader
Definition gRenderer.h:576
void drawGridYZ()
static const std::string & getShaderSrcTextureFragment()
gShader * fontshader
Definition gRenderer.h:575
virtual void setVec3(GLuint uniformloc, float x, float y, float z)=0
virtual GLuint genBuffers()=0
SceneDataFlags
Definition gRenderer.h:153
@ ENABLE_SOFT_SHADOWS
Definition gRenderer.h:158
@ ENABLE_GAMMA
Definition gRenderer.h:156
@ ENABLE_FOG
Definition gRenderer.h:155
@ ENABLE_SSAO
Definition gRenderer.h:154
@ ENABLE_HDR
Definition gRenderer.h:157
virtual void useShader(GLuint id) const =0
bool isSSAOEnabled()
void setViewMatrix(glm::mat4 viewMatrix)
void drawGrid()
void setProjectionMatrix2d(glm::mat4 projectionMatrix2d)
float foglinearstart
Definition gRenderer.h:536
void drawCylinder(float x, float y, float z, int r, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
static const std::string & getShaderSrcGridFragment()
std::unique_ptr< gCross > crossmesh
Definition gRenderer.h:605
void setGridColorofAxisWireFrameXY(gColor *color)
virtual void disableAlphaBlending()=0
void setFogLinearEnd(float value)
virtual void setBufferRange(int index, GLuint buffer, int offset, int size)=0
float foglinearend
Definition gRenderer.h:537
void drawLine(float x1, float y1, float z1, float x2, float y2, float z2, float thickness=1.0f)
virtual void checkFramebufferStatus()=0
gColor * getColor()
virtual GLuint createTextures()=0
static const std::string & getShaderSrcIrradianceFragment()
static float getScaleMultiplier()
gShader * ssaoblurshader
Definition gRenderer.h:562
virtual void readTexturePixels(unsigned char *inPixels, GLuint textureId, int width, int height, GLenum format)=0
float ssaostrength
Definition gRenderer.h:556
void drawTubeOblique(float x, float y, float z, int outerradius, int innerradious, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
const glm::mat4 & getProjectionMatrix() const
int getFogMode() const
static const std::string & getShaderSrcSSAOFragment()
virtual void drawVbo(const gVbo &vbo)=0
virtual void setFiltering(GLenum target, GLint minFilter, GLint magFilter)=0
glm::mat4 viewmatrix
Definition gRenderer.h:590
void disableSoftShadows()
const glm::vec3 & getCameraPosition() const
static const int SCREENSCALING_AUTO
Definition gRenderer.h:125
virtual void bindSkyTexture(GLuint texId, int textureSlot)=0
void updateLights()
void drawConeOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
virtual void setWrappingAndFiltering(GLenum target, GLint wrapS, GLint wrapT, GLint minFilter, GLint magFilter)=0
unsigned int depthtesttypeid[2]
Definition gRenderer.h:550
static void setUnitScreenSize(int unitWidth, int unitHeight)
virtual void setVertexAttribPointer(int index, int size, int type, bool normalized, int stride, const void *pointer)=0
void disableFog()
static const std::string & getShaderSrcSSAOVertex()
std::unique_ptr< gLine > linemesh2
Definition gRenderer.h:602
virtual void enableAlphaTest()=0
static const std::string & getShaderSrcSkyboxVertex()
void setFogLinearStart(float value)
virtual void generateSkyMipMap()=0
void drawTubeTrapezodial(float x, float y, float z, int topouterradius, int topinnerradious, int buttomouterradious, int buttominnerradious, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void setColor(float r, float g, float b, float a=1.0f)
int getWidth()
bool ishdrenabled
Definition gRenderer.h:570
void initSSAOResources()
Definition gRoundedRectangle.h:13
Definition gShader.h:19
Definition gTriangle.h:13
Definition gUbo.h:12
Definition gVbo.h:30
float r
Definition gColor.h:22
float a
Definition gColor.h:22
float b
Definition gColor.h:22
float g
Definition gColor.h:22
void gDrawTubeOblique(float x, float y, float z, int outerradius, int innerradious, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void gDrawLine(float x1, float y1, float x2, float y2, float thickness=1.0f)
void gDrawTube(float x, float y, float z, int outerradius, int innerradious, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void gDrawSphere(float xPos, float yPos, float zPos, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int xSegmentNum=64, int ySegmentNum=32, bool isFilled=true)
void gDrawTriangle(float px, float py, float qx, float qy, float rx, float ry, bool is_filled=true)
int gGetCullFace()
bool gIsCullingEnabled()
void gDrawCross(float x, float y, float width, float height, float thickness, bool isFilled)
void gEnableCulling()
void gSetCullingDirection(int cullingDirection)
void gDrawPyramid(float x, float y, float z, int r, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int numberofsides=4, bool isFilled=true)
void gDrawArrow(float x1, float y1, float length, float angle, float tipLength, float tipAngle)
void gDrawCylinder(float x, float y, float z, int r, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void gDrawCone(float x, float y, float z, int r, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void gDrawCylinderObliqueTrapezodial(float x, float y, float z, int r1, int r2, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0, 1.0, 1.0), int segmentnum=32, bool isFilled=true)
#define GLIST_MAX_LIGHTS
Definition gRenderer.h:56
void gCheckGLErrorAndPrint(const std::string &prefix, const std::string &func, int line)
void gDrawRoundedRectangle(float x, float y, float w, float h, int radius, bool isFilled)
void gDrawTubeTrapezodial(float x, float y, float z, int topouterradius, int topinnerradious, int buttomouterradious, int buttominnerradious, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void gDrawCylinderOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
int gGetCullingDirection()
void gDrawRectangle(float x, float y, float w, float h, bool isFilled=false)
void gDrawCircle(float xCenter, float yCenter, float radius, bool isFilled=false, float numberOfSides=64.0f)
void gDrawTubeObliqueTrapezodial(float x, float y, float z, int topouterradius, int topinnerradious, int buttomouterradious, int buttominnerradious, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void gDisableCulling()
void gDrawPyramidOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int numberofsides=4, bool isFilled=true)
void gDrawBox(float x, float y, float z, float w=1.0f, float h=1.0f, float d=1.0f, bool isFilled=true)
void gDrawConeOblique(float x, float y, float z, int r, int h, glm::vec2 shiftdistance, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void gDrawCylinderTrapezodial(float x, float y, float z, int r1, int r2, int h, glm::vec3 scale=glm::vec3(1.0f, 1.0f, 1.0f), int segmentnum=32, bool isFilled=true)
void gDrawArc(float xCenter, float yCenter, float radius, bool isFilled=true, int numberOfSides=60, float degree=360.0f, float rotate=360.0f)
void gCullFace(int cullingFace)
Definition gRenderer.h:169
gSceneFogData fog
Definition gRenderer.h:174
unsigned int flags
Definition gRenderer.h:173
glm::mat4 viewmatrix
Definition gRenderer.h:172
glm::vec3 viewpos
Definition gRenderer.h:171
gColor rendercolor
Definition gRenderer.h:170
Definition gRenderer.h:161
int mode
Definition gRenderer.h:167
float linearStart
Definition gRenderer.h:163
float density
Definition gRenderer.h:165
glm::vec3 color
Definition gRenderer.h:162
float linearEnd
Definition gRenderer.h:164
float gradient
Definition gRenderer.h:166
Definition gRenderer.h:128
int type
Definition gRenderer.h:129
float spotoutercutoffangle
Definition gRenderer.h:141
float spotcutoffangle
Definition gRenderer.h:140
float quadratic
Definition gRenderer.h:138
glm::vec4 specular
Definition gRenderer.h:134
float constant
Definition gRenderer.h:136
glm::vec3 position
Definition gRenderer.h:130
glm::vec4 ambient
Definition gRenderer.h:132
glm::vec4 diffuse
Definition gRenderer.h:133
float linear
Definition gRenderer.h:137
glm::vec3 direction
Definition gRenderer.h:131
Definition gRenderer.h:144
int enabledlights
Definition gRenderer.h:148
gSceneLightData lights[GLIST_MAX_LIGHTS]
Definition gRenderer.h:150
glm::vec4 globalambientcolor
Definition gRenderer.h:149
int lightnum
Definition gRenderer.h:145