GlistEngine
Loading...
Searching...
No Matches
gRenderer.h
Go to the documentation of this file.
1/*
2 * gRenderer.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 defined(__APPLE__)
32#include <TargetConditionals.h>
33#endif
34#if TARGET_OS_OSX
35#include <GL/glew.h>
36#include <OpenGL/gl.h>
37#include <OpenGL/glu.h>
38#endif
39#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
40# include <OpenGLES/ES3/gl.h>
41# include <OpenGLES/ES3/glext.h>
42# include <OpenGLES/gltypes.h>
43#endif
44#define GLM_ENABLE_EXPERIMENTAL
45#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
46#include <glm/glm.hpp>
47#include <glm/gtc/matrix_inverse.hpp>
48#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
49#include <glm/gtx/quaternion.hpp>
50
51#include "gColor.h"
52#include "gConstants.h"
53#include <deque>
54#include <memory>
55#include <vector>
56
57#ifndef GLIST_MAX_LIGHTS
58// amount of maximum lights, this is used to allocate memory for the light uniform buffer
59#define GLIST_MAX_LIGHTS 8
60#endif
61
62// You can define ENGINE_OPENGL_CHECKS to enable OpenGL checks
63// without debugging.
64#if defined(DEBUG) || defined(ENGINE_OPENGL_CHECKS)
65#define G_CHECK_GL(a) gCheckGLErrorAndPrint("Previously Unhandled ", __PRETTY_FUNCTION__, __LINE__); a; gCheckGLErrorAndPrint("", __PRETTY_FUNCTION__, __LINE__)
66#define G_CHECK_GL2(value, fn) gCheckGLErrorAndPrint("Previously Unhandled ", __PRETTY_FUNCTION__, __LINE__); value = fn; gCheckGLErrorAndPrint("", __PRETTY_FUNCTION__, __LINE__)
67#else
68#define G_CHECK_GL(fn) fn
69#define G_CHECK_GL2(value, fn) value = fn
70#endif
71
72void gCheckGLErrorAndPrint(const std::string& prefix, const std::string& func, int line);
73
77void gCullFace(int cullingFace);
79void gSetCullingDirection(int cullingDirection);
81
82// --- 2D / 3D Line Overloads
83void gDrawLine(float x1, float y1, float x2, float y2);
84void gDrawLine(float x1, float y1, float x2, float y2, float thickness);
85void gDrawLine(float x1, float y1, float z1, float x2, float y2, float z2, float thickness = 1.0f);
86void gDrawLine(float x1, float y1, float x2, float y2, float thickness, float rotateAngle, float pivotx, float pivoty);
87
88void gDrawTriangle(float px, float py, float qx, float qy, float rx, float ry, bool is_filled = true, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
89void gDrawCircle(float xCenter, float yCenter, float radius, bool isFilled = false, float numberOfSides = 64.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
90void gDrawCross(float x, float y, float width, float height, float thickness, bool isFilled, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
91void gDrawArc(float xCenter, float yCenter, float radius, bool isFilled = true, int numberOfSides = 60, float degree = 360.0f, float rotate = 360.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
92void gDrawArrow(float x1, float y1, float length, float angle, float tipLength, float tipAngle, float thickness = 1.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
93void gDrawRectangle(float x, float y, float w, float h, bool isFilled = false, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
94void gDrawRoundedRectangle(float x, float y, float w, float h, int radius, bool isFilled, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
95void gDrawBox(float x, float y, float z, float w = 1.0f, float h = 1.0f, float d = 1.0f, bool isFilled = true);
96void gDrawBox(float x, float y, float z, float w, float h, float d, float rotateAngle, float axisX, float axisY, float axisZ, bool isFilled = true);
97void gDrawBox(glm::mat4 transformationMatrix, bool isFilled = true);
98void 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);
99void 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);
100void 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);
101void 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);
102void 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);
103void 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);
104void 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);
105void 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);
106void 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);
107void 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);
108void 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);
109void 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);
110void 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);
111
112class gVbo;
113class gFbo;
114
115template<typename T>
116class gUbo;
117class gLight;
118class gImage;
119class gShader;
120class gCamera;
121class gGrid;
122class gLine;
123class gTriangle;
124class gCircle;
125class gCross;
126class gArc;
127class gRectangle;
129class gBox;
130//class gArrow;
131
132class gRenderer : public gObject {
133public:
136 static const int FOGMODE_LINEAR, FOGMODE_EXP;
137 struct alignas(16) gSceneLightData {
138 alignas(4) int type;
139 alignas(16) glm::vec3 position;
140 alignas(16) glm::vec3 direction;
141 alignas(16) glm::vec4 ambient;
142 alignas(16) glm::vec4 diffuse;
143 alignas(16) glm::vec4 specular;
144
145 alignas(4) float constant;
146 alignas(4) float linear;
147 alignas(4) float quadratic;
148
149 alignas(4) float spotcutoffangle;
150 alignas(4) float spotoutercutoffangle;
151 };
152
153 struct alignas(16) gSceneLights {
154 alignas(4) int lightnum = 0;
155 alignas(4) int enabledlights;
156 alignas(16) glm::vec4 globalambientcolor;
158 };
159
161 ENABLE_SSAO = 0b0001,
162 ENABLE_FOG = 0b0010,
163 ENABLE_GAMMA = 0b0100,
164 ENABLE_HDR = 0b1000,
166 };
167
168 struct alignas(16) gSceneFogData {
169 alignas(16) glm::vec3 color;
170 alignas(4) float linearStart;
171 alignas(4) float linearEnd;
172 alignas(4) float density;
173 alignas(4) float gradient;
174 alignas(4) int mode;
175 };
176 struct alignas(16) gSceneData {
177 alignas(16) gColor rendercolor;
178 alignas(16) glm::vec3 viewpos;
179 alignas(16) glm::mat4 viewmatrix;
180 alignas(4) unsigned int flags;
182 };
183
184 gRenderer() = default;
185 virtual ~gRenderer();
186
187 static void setScreenSize(int screenWidth, int screenHeight);
188 static void setUnitScreenSize(int unitWidth, int unitHeight);
189 static void setScreenScaling(int screenScaling);
191
192 int getWidth();
198 static int getScreenScaling();
199 unsigned int getFullscreenQuadVAO() const;
200
201 static void setCurrentResolution(int resolution);
202 static void setCurrentResolution(int screenWidth, int screenHeight);
203 static void setUnitResolution(int resolution);
204 static void setUnitResolution(int screenWidth, int screenHeight);
205 static int getResolution(int screenWidth, int screenHeight);
208 static float getScaleMultiplier();
209 static int scaleX(int x);
210 static int scaleY(int y);
211 static int unscaleX(int x);
212 static int unscaleY(int y);
213
214 //grid
215 void drawGrid();
221 void setGridEnableAxis(bool xy, bool yz, bool xz);
222 void setGridEnableXY(bool xy);
223 void setGridEnableYZ(bool yz);
224 void setGridEnableXZ(bool xz);
225 void setGridColorofAxisXZ(int r, int g, int b, int a);
226 void setGridColorofAxisYZ(int r, int g, int b, int a);
227 void setGridColorofAxisXY(int r, int g, int b, int a);
231 void setGridColorofAxisWireFrameXZ(int r, int g, int b, int a);
232 void setGridColorofAxisWireFrameYZ(int r, int g, int b, int a);
233 void setGridColorofAxisWireFrameXY(int r, int g, int b, int a);
241 void setGridMaxLength(float length);
243 void setGridLineInterval(float intervalvalue);
245
246 gGrid* getGrid() const;
247 void setGrid(gGrid* newgrid);
248
249 void setColor(int r, int g, int b, int a = 255);
250 void setColor(float r, float g, float b, float a = 1.0f);
251 void setColor(const gColor& color);
252 void setColor(gColor* color);
254
255 virtual bool beginFrame() { return true; }
256 virtual void endFrame() {}
257 virtual void flushQueuedDraws() {}
258
259 // Backend hooks for deferred lighting. OpenGL keeps its established
260 // gDeferredLight implementation and leaves these defaults alone; Vulkan owns
261 // render-pass resources that cannot live in the backend-neutral graphics class.
262 virtual bool setupDeferredLighting(int width, int height) { return false; }
263 virtual bool resizeDeferredLighting(int width, int height) { return false; }
264 virtual bool beginDeferredGeometryPass() { return false; }
265 virtual bool renderDeferredLightingPass() { return false; }
266 virtual void endDeferredLighting() {}
267 virtual void releaseDeferredLighting() {}
268 virtual bool isDeferredGeometryPassActive() const { return false; }
269
270 int getRenderEngineType() const { return renderenginetype; }
271 bool isVulkan() const { return renderenginetype == G_RENDERER_VK; }
272
273 virtual void drawColored2D(const glm::vec2* points, int count, const glm::vec4& color, const glm::mat4& mvp,
274 int drawMode = GL_TRIANGLES) {}
275
276 virtual void drawTexturedRect2D(GLuint textureId, GLuint maskTextureId, const glm::vec4& tint,
277 const glm::mat4& mvp,
278 const glm::vec2& uvOffset = glm::vec2(0.0f), const glm::vec2& uvScale = glm::vec2(1.0f)) {}
279
280 // Backend hook for an already-expanded textured triangle list. xyuv contains
281 // four floats per vertex: screen-space x/y followed by texture u/v. This is
282 // used by batched text, where all glyph quads share one atlas texture and can
283 // therefore be recorded as one draw instead of one draw per glyph.
284 virtual void drawTexturedTriangles2D(GLuint textureId, const glm::vec4& tint,
285 const glm::mat4& mvp, const float* xyuv, int vertexCount) {}
286
287 // What a backend needs about a mesh's surface in order to shade it. Mirrors the
288 // non-map part of gMaterial; the texture maps join it once the Vulkan path can
289 // sample them.
291 glm::vec4 ambient{1.0f};
292 glm::vec4 diffuse{1.0f};
293 glm::vec4 specular{1.0f};
294 float shininess = 0.5f;
295 glm::vec2 texturetiling{1.0f, 1.0f};
296 // Texture ids as gTexture hands them out, or 0 for "this mesh has no map of
297 // that kind". A diffuse map replaces the ambient and diffuse colours rather
298 // than tinting them, matching what the OpenGL shader does.
299 GLuint diffusemapid = 0;
300 GLuint specularmapid = 0;
301 // Tangent-space normal map. When set, the surface normal comes from the
302 // texture and the lighting is computed in tangent space.
303 GLuint normalmapid = 0;
304
305 // PBR takes a different shader entirely: a metallic-roughness workflow whose
306 // maps replace the colours above rather than sitting alongside them. Backends
307 // switch on ispbr rather than on which ids happen to be set, because a PBR
308 // material with no maps at all is still PBR and has its own defaults.
309 bool ispbr = false;
310 GLuint albedomapid = 0;
311 GLuint pbrnormalmapid = 0;
312 GLuint metallicmapid = 0;
313 GLuint roughnessmapid = 0;
314 GLuint aomapid = 0;
315 };
316
317 // Backend hook for a 3D mesh. OpenGL draws these through its own shader and vbo
318 // binding and leaves this a no-op; Vulkan looks the vertex array id up in its
319 // registry and records a draw from the buffers already on the device.
320 //
321 // vertexArrayId is gVbo's VAO name, which is what the backend keys its buffers
322 // off. indexCount is 0 for a non-indexed mesh, in which case vertexCount is
323 // used. Only the model matrix is passed: the camera and the lights are scene
324 // state the backend already has, and sending them per mesh would mean pushing
325 // far more than the 128 bytes Vulkan guarantees for push constants.
326 //
327 // instanceCount above 1 draws the mesh that many times, reading a model matrix
328 // per instance from the buffer gVbo::setInstanceData uploaded. The transforms
329 // themselves are not passed here: they already live on the device by the time
330 // this is called, which is the point of uploading them.
331 virtual void drawMesh3D(GLuint vertexArrayId, int vertexCount, int indexCount,
332 const glm::mat4& model, const gMeshSurface& surface,
333 int drawMode = GL_TRIANGLES, int instanceCount = 1) {}
334
335 // Backend hooks for shadow mapping. OpenGL leaves both alone: gShadowMap drives
336 // it there directly, through an FBO and shader uniforms it owns. Vulkan needs
337 // the render target created up front and the light's transform handed over,
338 // because the depth pass is a separate render pass with its own pipeline.
339 //
340 // allocateShadowMap returns false when the backend cannot provide one, which is
341 // what makes gShadowMap fall back to drawing the scene unshadowed.
342 // Backend hook for one face of the skybox. OpenGL draws the sky through its own
343 // cubemap shader and leaves this a no-op; Vulkan has no cube map here and draws
344 // six quads instead, one per face, each sampling a plain 2D texture.
345 //
346 // xyzuv holds five floats per vertex - three of position in world space, two of
347 // texture coordinate. Returns false when the backend cannot draw it, which is
348 // what tells gSkybox to fall back to its own path.
349 virtual bool drawSkyboxFace(GLuint textureId, const float* xyzuv, int vertexCount,
350 const glm::mat4& viewProjection) { return false; }
351
352 virtual bool allocateShadowMap(int width, int height) { return false; }
353 virtual void releaseShadowMap() {}
354
355 // Opens and closes the depth-only pass the shadow map is drawn into. Called by
356 // the frame loop around the first of the two scene draws; OpenGL does the
357 // equivalent inside gShadowMap::enable() and leaves these alone.
358 virtual bool beginShadowPass() { return false; }
359 virtual void endShadowPass() {}
360 virtual bool isShadowPassActive() const { return false; }
361
362 // lightMatrix is lightProjection * lightView; lightPosition is where the caster
363 // sits, used for the depth bias. enabled false means shade without shadows.
364 virtual void setShadowMapState(bool enabled, const glm::mat4& lightMatrix,
365 const glm::vec3& lightPosition, bool softShadows) {}
366
367 virtual void clear() = 0;
368 virtual void clearColor(int r, int g, int b, int a = 255) = 0;
369 virtual void clearColor(gColor color) = 0;
370
374 void setLightingColor(int r, int g, int b, int a = 255);
375 void setLightingColor(gColor* color) { setLightingColor(color->r, color->g, color->b, color->a); }
377 void setLightingPosition(glm::vec3 lightingPosition);
379
380 void setGlobalAmbientColor(int r, int g, int b, int a = 255);
381 void setGlobalAmbientColor(gColor color) { setGlobalAmbientColor(color.r, color.g, color.b, color.a); }
383
384 void enableFog();
386 void setFogNo(int no);
387 void setFogColor(float r, float g, float b);
388 void setFogColor(const gColor& color);
389 void setFogMode(int fogMode);
390 void setFogDensity(float value);
391 void setFogGradient(float value);
392 void setFogLinearStart(float value);
393 void setFogLinearEnd(float value);
394
396 int getFogNo() const;
397 const gColor& getFogColor() const;
398 int getFogMode() const;
399 float getFogDensity() const;
400 float getFogGradient() const;
401 float getFogLinearStart() const;
402 float getFogLinearEnd() const;
403
404 void addSceneLight(gLight* light);
406 gLight* getSceneLight(int lightNo);
409 // Virtual because the two backends publish light state at different moments.
410 // OpenGL writes its uniform block right here, the instant a light is enabled or
411 // its colour changes. The Vulkan backend gathers the whole scene block once per
412 // render pass instead, so it overrides this to mark that block stale - a canvas
413 // that enables its light just before drawing and disables it after, which is
414 // what gLight's API invites, would otherwise be shaded with the state left over
415 // from the previous frame, when the light was off.
416 virtual void updateLights();
417
418 // Presentation pacing. OpenGL sets it on the window through glfwSwapInterval
419 // and needs nothing here; Vulkan expresses it as the swapchain's present mode,
420 // so the backend overrides this to rebuild the swapchain with the new one.
421 virtual void setVsync(bool enabled) {}
422
423 // Multisample anti-aliasing, in samples per pixel: 1 (the default) is off, and 2,
424 // 4 or 8 ask for that many coverage samples on the screen pass. Shaped like
425 // setVsync for the same reason - OpenGL takes it from the window's framebuffer
426 // while Vulkan bakes it into the render pass and every pipeline, so only the
427 // Vulkan backend overrides these.
428 //
429 // The request is capped at what the device supports for colour *and* depth
430 // attachments, so getMultiSampling() is the value that was actually achieved and
431 // may be lower than what was asked for - 1 on a device that offers no
432 // multisampled combination at all. Off by default: an existing application sees
433 // no change in cost or appearance until it asks.
434 virtual void setMultiSampling(int samples) {}
435 virtual int getMultiSampling() const { return 1; }
436
438
441 virtual void enableDepthTest() = 0;
442 virtual void enableDepthTest(int depthTestType) = 0;
443 virtual void setDepthTestFunc(int depthTestType) = 0;
444 virtual void disableDepthTest() = 0;
445 virtual bool isDepthTestEnabled() = 0;
446 virtual int getDepthTestType() = 0;
447 virtual void enableCulling() { iscullingenabled = true; }
448 virtual void disableCulling() { iscullingenabled = false; }
449 virtual bool isCullingEnabled() const { return iscullingenabled; }
450 virtual void setCullFace(int face) { cullface = face; }
451 virtual int getCullFace() const { return cullface; }
452 virtual void setCullingDirection(int direction) { cullingdirection = direction; }
453 virtual int getCullingDirection() const { return cullingdirection; }
454
455 virtual void enableAlphaBlending() = 0;
456 virtual void disableAlphaBlending() = 0;
457 virtual bool isAlphaBlendingEnabled() = 0;
458
459 // How a blended draw combines with what is already in the framebuffer. Only
460 // meaningful while alpha blending is on; enabling it resets the mode to ALPHA,
461 // which is what it has always done.
462 //
463 // This exists because there was no way to ask for anything but the standard
464 // over operator. A game wanting an additive effect - a muzzle flash, a glow, a
465 // spark - had to reach past the renderer and call glBlendFunc itself, and that
466 // call means nothing to a backend that is not OpenGL: on Vulkan blending is
467 // baked into the pipeline, so the effect silently came out composited instead
468 // of added.
470 BLENDMODE_ALPHA, // src * a + dst * (1 - a). Layers one image over another.
471 BLENDMODE_ADDITIVE, // src * a + dst. Only brightens, so black adds nothing.
472 };
473 virtual void setBlendMode(int blendMode) { blendmode = blendMode; }
474 virtual int getBlendMode() const { return blendmode; }
475 virtual void enableAlphaTest() = 0;
476 virtual void disableAlphaTest() = 0;
477 virtual bool isAlphaTestEnabled() = 0;
478
482 void setSSAOBias(float value);
483 float getSSAOBias();
484 void setSSAORadius(float value);
486 void setSSAOStrength(float value);
488 void setSSAODebug(bool enabled);
491 void beginSSAO();
492 void endSSAO();
493
497
499 void enableHDR();
501
505
519
520 // Virtual because the two backends do not agree on what a projection matrix is.
521 // OpenGL clips depth to -1..1, Vulkan to 0..1, so the Vulkan backend folds a
522 // correction into whatever the camera hands it. Everything downstream - gMesh,
523 // gGrid, gSkybox - passes getProjectionMatrix() straight to a shader, so putting
524 // the fix here keeps it out of every one of those call sites.
525 virtual void setProjectionMatrix(glm::mat4 projectionMatrix);
526 void setProjectionMatrix2d(glm::mat4 projectionMatrix2d);
527 void setViewMatrix(glm::mat4 viewMatrix);
528 void setCameraPosition(glm::vec3 cameraPosition);
530 const glm::mat4& getProjectionMatrix() const;
531 const glm::mat4& getProjectionMatrix2d() const;
532 const glm::mat4& getViewMatrix() const;
533 const glm::vec3& getCameraPosition() const;
534 const gCamera* getCamera() const;
537
538 virtual void takeScreenshot(gImage& img) = 0;
539 virtual void takeScreenshot(gImage& img, int x, int y, int width, int height) = 0;
540
541 /* -------------- gUbo ------------- */
542 virtual GLuint genBuffers() = 0;
543 virtual void deleteBuffer(GLuint& buffer) = 0;
544
545 virtual void bindBuffer(GLenum target, GLuint buffer) = 0;
546 virtual void unbindBuffer(GLenum target) = 0;
547
548 virtual void bufSubData(GLuint buffer, int offset, int size, const void* data) = 0;
549 virtual void setBufferData(GLuint buffer, const void* data, size_t size, int usage) = 0;
550 virtual void setBufferRange(int index, GLuint buffer, int offset, int size) = 0;
551
552 virtual void attachUbo(GLuint id, int bindingpoint, const std::string& uboName) = 0;
553
554 /* -------------- gVbo --------------- */
555 virtual GLuint createVAO() = 0;
556 virtual void deleteVAO(GLuint& vao) = 0;
557
558 virtual void bindVAO(GLuint vao) = 0;
559 virtual void unbindVAO() = 0;
560
561 virtual void setVertexBufferData(GLuint vbo, size_t size, const void* data, int usage) = 0;
562 virtual void setIndexBufferData(GLuint ebo, size_t size, const void* data, int usage) = 0;
563
564 virtual void drawArrays(int drawMode, int count) = 0;
565 virtual void drawElements(int drawMode, int count) = 0;
566 virtual void drawArraysInstanced(int drawMode, int count, int instanceCount) = 0;
567 virtual void drawElementsInstanced(int drawMode, int count, int instanceCount) = 0;
568
569 virtual void enableVertexAttrib(int index) = 0;
570 virtual void disableVertexAttrib(int index) = 0;
571 virtual void setVertexAttribPointer(int index, int size, int type, bool normalized, int stride, const void* pointer) = 0;
572 virtual void setVertexAttribDivisor(int index, int divisor) = 0;
573
574 virtual void setViewport(int x, int y, int width, int height) = 0;
575 void getViewport(int& x, int& y, int& width, int& height) const;
576
577 /* -------------- gFbo --------------- */
578 virtual GLuint createFramebuffer() = 0;
579 virtual void deleteFramebuffer(GLuint& fbo) = 0;
580 virtual void bindFramebuffer(GLuint fbo) = 0;
581 GLuint getBoundFramebuffer() const;
582 virtual void checkFramebufferStatus() = 0;
583
584 virtual GLuint createRenderbuffer() = 0;
585 virtual void deleteRenderbuffer(GLuint& rbo) = 0;
586 virtual void bindRenderbuffer(GLuint rbo) = 0;
587 virtual void setRenderbufferStorage(GLenum format, int width, int height) = 0;
588
589 virtual void attachTextureToFramebuffer(GLenum attachment, GLenum textarget, GLuint texId, GLuint level = 0) = 0;
590 virtual void attachRenderbufferToFramebuffer(GLenum attachment, GLuint rbo) = 0;
591
592 virtual void setDrawBufferNone() = 0;
593 virtual void setReadBufferNone() = 0;
594
595 virtual void createFullscreenQuad(GLuint& vao, GLuint& vbo) = 0;
596 virtual void deleteFullscreenQuad(GLuint& vao, GLuint* vbo) = 0;
597
598 /* -------------- gShader --------------- */
599 virtual GLuint loadProgram(const char* vertexSource, const char* fragmentSource, const char* geometrySource) = 0;
600
601 // Where the sources about to be handed to loadProgram came from, when they came
602 // from files rather than from strings the application built. The OpenGL backend
603 // has no use for it and ignores it; the Vulkan backend looks for pre-compiled
604 // SPIR-V beside them, which is how a shader reaches a build with no shader
605 // compiler linked in - every mobile and release build.
606 virtual void setShaderSourcePaths(const std::string& vertexPath, const std::string& fragmentPath) {
607 (void)vertexPath;
608 (void)fragmentPath;
609 }
610 virtual void checkCompileErrors(GLuint shader, const std::string& type) = 0;
611 virtual void setBool(GLuint uniformloc, bool value) = 0;
612 virtual void setInt(GLuint uniformloc, int value) = 0;
613 virtual void setUnsignedInt(GLuint uniformloc, unsigned int value) = 0;
614 virtual void setFloat(GLuint uniformloc, float value) = 0;
615 virtual void setVec2(GLuint uniformloc, const glm::vec2& value) = 0;
616 virtual void setVec2(GLuint uniformloc, float x, float y) = 0;
617 virtual void setVec3(GLuint uniformloc, const glm::vec3& value) = 0;
618 virtual void setVec3(GLuint uniformloc, float x, float y, float z) = 0;
619 virtual void setVec4(GLuint uniformloc, const glm::vec4& value) = 0;
620 virtual void setVec4(GLuint uniformloc, float x, float y, float z, float w) = 0;
621 virtual void setMat2(GLuint uniformloc, const glm::mat2& mat) = 0;
622 virtual void setMat3(GLuint uniformloc, const glm::mat3& mat) = 0;
623 virtual void setMat4(GLuint uniformloc, const glm::mat4& mat) = 0;
624 virtual GLuint getUniformLocation(GLuint id, const std::string& name) = 0;
625
626 virtual void useShader(GLuint id) const = 0;
627 virtual void resetShader(GLuint id, bool loaded) const = 0;
628
629 /* ------------ gPostProcessManager ------------- */
630 virtual void clearScreen(bool color = true, bool depth = true) = 0;
631 virtual void bindQuadVAO() = 0;
632 virtual void drawFullscreenQuad() = 0;
633 virtual void bindDefaultFramebuffer() = 0;
634
635 /* -------------- gGrid --------------- */
636 virtual void drawVbo(const gVbo& vbo) = 0;
637 virtual void drawVbo(const gVbo& vbo, const glm::mat4& model, const gMeshSurface& surface) = 0;
638
639 /* ---------------- gTexture ---------------- */
640 virtual GLuint createTextures() = 0;
641 virtual void bindTexture(GLuint texId) = 0;
642 virtual void bindTexture(GLuint texId, int textureSlotNo) = 0;
643 virtual void unbindTexture() = 0;
644 virtual void activateTexture(int textureSlotNo = 0) = 0;
645 virtual void resetTexture() = 0;
646 virtual void deleteTexture(GLuint& texId) = 0;
647
648 virtual void texImage2D(GLenum target, GLint internalFormat, int width, int height, GLint format, GLint type, void* data, GLint level = 0) = 0;
649 virtual void setTextureMaxLevel(GLenum target, int maxLevel) = 0;
650 virtual void setWrapping(GLenum target, GLint wrapS, GLint wrapT) = 0;
651 virtual void setWrapping(GLenum target, GLint wrapS, GLint wrapT, GLint wrapR) = 0;
652
653 virtual void setFiltering(GLenum target, GLint minFilter, GLint magFilter) = 0;
654 virtual void setWrappingAndFiltering(GLenum target, GLint wrapS, GLint wrapT, GLint minFilter, GLint magFilter) = 0;
655 virtual void setWrappingAndFiltering(GLenum target, GLint wrapS, GLint wrapT, GLint wrapR, GLint minFilter, GLint magFilter) = 0;
656 virtual void setSwizzleMask(GLint swizzleMask[4]) = 0;
657
658 virtual void readTexturePixels(unsigned char* inPixels, GLuint textureId, int width, int height, GLenum format) = 0;
659 virtual void readTexturePixelsHDR(float* inPixels, GLuint textureId, int width, int height, GLenum format) = 0;
660
661 virtual void generateMipMap() = 0;
662
663 /* ---------------- gSkybox ---------------- */
664 virtual void bindSkyTexture(GLuint texId) = 0;
665 virtual void bindSkyTexture(GLuint texId, int textureSlot) = 0;
666 virtual void unbindSkyTexture() = 0;
667 virtual void unbindSkyTexture(int textureSlotNo) = 0;
668 virtual void generateSkyMipMap() = 0;
669 virtual void enableDepthTestEqual() = 0;
670 virtual void createQuad(GLuint& inQuadVAO, GLuint& inQuadVBO) = 0;
671 virtual void enableCubeMap() = 0;
672
673 /* ---------------- gRenderObject ---------------- */
674 virtual void pushMatrix() = 0;
675 virtual void popMatrix() = 0;
676
677 /* ---------------- Utilities ---------------- */
678 void drawLine(float x1, float y1, float x2, float y2);
679 void drawLine(float x1, float y1, float x2, float y2, float thickness);
680 void drawLine(float x1, float y1, float z1, float x2, float y2, float z2, float thickness = 1.0f);
681 void drawLine(float x1, float y1, float x2, float y2, float thickness, float rotateAngle, float pivotx, float pivoty);
682
683 void drawTriangle(float px, float py, float qx, float qy, float rx, float ry, bool is_filled = true, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
684 void drawCircle(float xCenter, float yCenter, float radius, bool isFilled = false, float numberOfSides = 64.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
685 void drawCross(float x, float y, float width, float height, float thickness, bool isFilled, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
686 void drawArc(float xCenter, float yCenter, float radius, bool isFilled = true, int numberOfSides = 60, float degree = 360.0f, float rotate = 360.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
687 void drawArrow(float x1, float y1, float length, float angle, float tipLength, float tipAngle, float thickness = 1.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
688 void drawRectangle(float x, float y, float w, float h, bool isFilled = false, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
689 void drawRoundedRectangle(float x, float y, float w, float h, int radius, bool isFilled, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
690 void drawBox(float x, float y, float z, float w = 1.0f, float h = 1.0f, float d = 1.0f, bool isFilled = true);
691 void drawBox(float x, float y, float z, float w, float h, float d, float rotateAngle, float axisX, float axisY, float axisZ, bool isFilled = true);
692 void drawBox(glm::mat4 transformationMatrix, bool isFilled = true);
693 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);
694 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);
695 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);
696 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);
697 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);
698 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);
699 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);
700 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);
701 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);
702 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);
703 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);
704 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);
705 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);
706
707protected:
708 friend class gRenderObject;
709 friend class gAppManager;
710
711 static int width, height;
713 static int screenscaling;
715
716 gColor* rendercolor = nullptr;
717
719
720 bool isfogenabled = false;
721 int fogno = -1;
723 float fogdensity = 0.3f;
724 float foggradient = 2.0f;
726 float foglinearstart = 0.0f;
727 float foglinearend = 1.0f;
728
729 std::deque<gLight*> scenelights;
732 bool islightingenabled = true;
737
738 bool isdepthtestenabled = false;
740 bool iscullingenabled = false;
741 int cullface = GL_BACK;
742 int cullingdirection = GL_CCW;
743 unsigned int depthtesttypeid[2];
746
749
751 float ssaobias;
756 gFbo* ssaofbo = nullptr;
757 gFbo* ssaoresultfbo = nullptr;
758 gShader* ssaoshader = nullptr;
768 bool ishdrenabled = false;
770
771 // init() creates these, and init() is skipped under Vulkan because there is no
772 // GL context to compile GLSL against. Without an initialiser the members would
773 // hold indeterminate values there, and a caller that forgets its backend check
774 // would dereference garbage rather than crash on a null.
777 gShader* fontshader = nullptr;
781 gShader* pbrshader = nullptr;
785 gShader* brdfshader = nullptr;
786 gShader* fboshader = nullptr;
787 gShader* gridshader = nullptr;
788
792 glm::mat4 viewmatrix;
793 glm::mat4 viewmatrixold;
794 glm::vec3 cameraposition;
795 gCamera* camera = nullptr;
796
797 gGrid* grid = nullptr;
798 gGrid* originalgrid = nullptr;
799
800 unsigned int fullscreenquadvao;
801 unsigned int fullscreenquadvbo;
802
803 std::unique_ptr<gLine> linemesh, linemesh2, linemesh3;
804 std::unique_ptr<gTriangle> trianglemesh;
805 std::unique_ptr<gCircle> circlemesh;
806 std::unique_ptr<gCross> crossmesh;
807 std::unique_ptr<gArc> arcmesh;
808 std::unique_ptr<gRectangle> rectanglemesh;
809 std::unique_ptr<gRoundedRectangle> roundedrectanglemesh;
810 std::unique_ptr<gBox> boxmesh;
811 //std::unique_ptr<gArrow> arrowmesh;
812
813 virtual void init();
814 virtual void cleanup();
815 virtual void updatePackUnpackAlignment(int i) = 0;
816
819
820 static const std::string& getShaderSrcGridVertex();
821 static const std::string& getShaderSrcGridFragment();
822 static const std::string& getShaderSrcColorVertex();
823 static const std::string& getShaderSrcColorFragment();
824 static const std::string& getShaderSrcTextureVertex();
825 static const std::string& getShaderSrcTextureFragment();
826 static const std::string& getShaderSrcImageVertex();
827 static const std::string& getShaderSrcImageFragment();
828 static const std::string& getShaderSrcFontVertex();
829 static const std::string& getShaderSrcFontFragment();
830 static const std::string& getShaderSrcSkyboxVertex();
831 static const std::string& getShaderSrcSkyboxFragment();
832 static const std::string& getShaderSrcShadowmapVertex();
833 static const std::string& getShaderSrcShadowmapFragment();
834 static const std::string& getShaderSrcPbrVertex();
835 static const std::string& getShaderSrcPbrFragment();
836 static const std::string& getShaderSrcCubemapVertex();
837 static const std::string& getShaderSrcEquirectangularFragment();
838 static const std::string& getShaderSrcIrradianceFragment();
839 static const std::string& getShaderSrcPrefilterFragment();
840 static const std::string& getShaderSrcBrdfVertex();
841 static const std::string& getShaderSrcBrdfFragment();
842 static const std::string& getShaderSrcFboVertex();
843 static const std::string& getShaderSrcFboFragment();
844 static const std::string& getShaderSrcSSAOVertex();
845 static const std::string& getShaderSrcSSAOFragment();
846 static const std::string& getShaderSrcSSAOBlurFragment();
847};
848
849
850// OpenGL calls made by application code
851// -------------------------------------
852// Games written against this engine reach past the renderer now and then and call
853// OpenGL directly, because for most of the engine's life OpenGL was the only thing
854// underneath. Those calls mean nothing on a backend that is not OpenGL: with no GL
855// context bound they do not even fail cleanly - the driver is entitled to hang.
856//
857// The two that come up in practice are a mid-frame depth clear, which is how a
858// first person weapon is drawn over the world, and a switch to additive blending
859// for a muzzle flash or a spark. Both have renderer entry points, so the calls are
860// routed there rather than left to reach a context that is not there. On OpenGL
861// each one still ends up in the same glClear / glBlendFunc it always did, so the
862// GL path is unchanged, down to the arguments.
863//
864// This is deliberately narrow. It rescues the calls that existing games make, not
865// OpenGL in general: anything else an application calls directly still goes
866// straight to GL and still means nothing on another backend.
867void gCompatClear(unsigned int mask);
868void gCompatBlendFunc(unsigned int sourceFactor, unsigned int destinationFactor);
869
870// Not applied while the engine itself is being compiled - it has a renderer to
871// call and needs the real entry points to implement these with. GLIST_ENGINE_BUILD
872// is defined on the engine target only, so application and plugin translation
873// units are the ones that get the redirection.
874#ifndef GLIST_ENGINE_BUILD
875#define glClear(mask) gCompatClear(mask)
876#define glBlendFunc(sourceFactor, destinationFactor) gCompatBlendFunc(sourceFactor, destinationFactor)
877#endif
878
879#endif /* CORE_GRENDERER_H_ */
Definition gArc.h:13
Definition gBox.h:30
Definition gCamera.h:18
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 gRectangle.h:6
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)
virtual void updateLights()
float getFogGradient() const
void getViewport(int &x, int &y, int &width, int &height) const
static const std::string & getShaderSrcColorVertex()
bool islightingenabled
Definition gRenderer.h:732
gLight * getSceneLight(int lightNo)
void drawRoundedRectangle(float x, float y, float w, float h, int radius, bool isFilled, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
void setGridColorofAxisXZ(int r, int g, int b, int a)
void drawGridXY()
void restoreMatrices()
gShader * irradianceshader
Definition gRenderer.h:783
gShader * colorshader
Definition gRenderer.h:775
virtual void disableDepthTest()=0
virtual bool beginFrame()
Definition gRenderer.h:255
virtual void bindTexture(GLuint texId)=0
virtual bool setupDeferredLighting(int width, int height)
Definition gRenderer.h:262
virtual void drawArrays(int drawMode, int count)=0
gFbo * ssaofbo
Definition gRenderer.h:756
static const std::string & getShaderSrcCubemapVertex()
bool isdepthtestenabled
Definition gRenderer.h:738
virtual bool drawSkyboxFace(GLuint textureId, const float *xyzuv, int vertexCount, const glm::mat4 &viewProjection)
Definition gRenderer.h:349
GLuint ssaoprevframebuffer
Definition gRenderer.h:761
int fogmode
Definition gRenderer.h:725
static int height
Definition gRenderer.h:711
void disableLighting()
void drawLine(float x1, float y1, float x2, float y2, float thickness)
virtual void setVsync(bool enabled)
Definition gRenderer.h:421
virtual bool beginShadowPass()
Definition gRenderer.h:358
static int unscaleY(int y)
virtual void enableDepthTestEqual()=0
virtual void endDeferredLighting()
Definition gRenderer.h:266
bool isSSAOAllocated()
bool isLightingEnabled()
static int unitheight
Definition gRenderer.h:712
bool isVulkan() const
Definition gRenderer.h:271
gShader * brdfshader
Definition gRenderer.h:785
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:801
virtual void drawVbo(const gVbo &vbo, const glm::mat4 &model, const gMeshSurface &surface)=0
virtual int getCullingDirection() const
Definition gRenderer.h:453
void drawGridXZ()
virtual GLuint createVAO()=0
virtual void setVec3(GLuint uniformloc, const glm::vec3 &value)=0
gShader * equirectangularshader
Definition gRenderer.h:782
gColor * getLightingColor()
gShader * textureshader
Definition gRenderer.h:776
static void setUnitResolution(int resolution)
void gPopMatrix()
int blendmode
Definition gRenderer.h:745
bool isssaodebug
Definition gRenderer.h:755
float getSSAOBias()
void setLightingColor(gColor *color)
Definition gRenderer.h:375
virtual void setMultiSampling(int samples)
Definition gRenderer.h:434
bool isGridXYEnabled()
void setGridColorofAxisYZ(int r, int g, int b, int a)
static const std::string & getShaderSrcSSAOBlurFragment()
bool isHDREnabled()
gColor globalambientcolor
Definition gRenderer.h:735
void setGridColorofAxisXY(gColor *color)
void disableHDR()
static const std::string & getShaderSrcEquirectangularFragment()
virtual void unbindTexture()=0
gColor * getGlobalAmbientColor()
virtual GLuint loadProgram(const char *vertexSource, const char *fragmentSource, const char *geometrySource)=0
int viewportheight
Definition gRenderer.h:748
gUbo< gSceneLights > * lightsubo
Definition gRenderer.h:730
void drawArrow(float x1, float y1, float length, float angle, float tipLength, float tipAngle, float thickness=1.0f, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
virtual void deleteBuffer(GLuint &buffer)=0
float ssaobias
Definition gRenderer.h:751
bool isGridEnabled()
int getScreenHeight()
glm::vec3 lightingposition
Definition gRenderer.h:733
void setLightingColor(int r, int g, int b, int a=255)
virtual void setVertexAttribDivisor(int index, int divisor)=0
void setGridColorofAxisWireFrameXY(int r, int g, int b, int a)
void updateScene()
bool isssaorendering
Definition gRenderer.h:763
virtual void enableCubeMap()=0
int viewportwidth
Definition gRenderer.h:748
const gCamera * getCamera() const
void enableGammaCorrection()
bool isalphablendingenabled
Definition gRenderer.h:744
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:381
virtual void releaseShadowMap()
Definition gRenderer.h:353
gShader * pbrshader
Definition gRenderer.h:781
void enableLighting()
bool isFogEnabled()
virtual void disableVertexAttrib(int index)=0
void drawRectangle(float x, float y, float w, float h, bool isFilled=false, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
static const std::string & getShaderSrcPbrFragment()
void setGridColorofAxisWireFrameYZ(gColor *color)
virtual int getDepthTestType()=0
static const int SCREENSCALING_NONE
Definition gRenderer.h:134
virtual void generateMipMap()=0
void beginSSAO()
int depthtesttype
Definition gRenderer.h:739
virtual void setViewport(int x, int y, int width, int height)=0
gFbo * ssaoresultfbo
Definition gRenderer.h:757
gShader * ssaoshader
Definition gRenderer.h:758
void setCameraPosition(glm::vec3 cameraPosition)
static const std::string & getShaderSrcSkyboxFragment()
virtual void setBool(GLuint uniformloc, bool value)=0
virtual void unbindSkyTexture()=0
int viewporty
Definition gRenderer.h:748
virtual void setCullingDirection(int direction)
Definition gRenderer.h:452
int renderenginetype
Definition gRenderer.h:718
static int currentresolution
Definition gRenderer.h:714
virtual void texImage2D(GLenum target, GLint internalFormat, int width, int height, GLint format, GLint type, void *data, GLint level=0)=0
gShader * getImageShader()
gShader * getFontShader()
virtual void popMatrix()=0
GLuint boundframebuffer
Definition gRenderer.h:747
gShader * getEquirectangularShader()
virtual ~gRenderer()
virtual void bindVAO(GLuint vao)=0
gShader * fboshader
Definition gRenderer.h:786
int cullface
Definition gRenderer.h:741
void setGridEnableYZ(bool yz)
virtual void checkCompileErrors(GLuint shader, const std::string &type)=0
virtual void bindQuadVAO()=0
virtual void setProjectionMatrix(glm::mat4 projectionMatrix)
virtual void bindBuffer(GLenum target, GLuint buffer)=0
virtual bool beginDeferredGeometryPass()
Definition gRenderer.h:264
virtual bool isDepthTestEnabled()=0
void drawCircle(float xCenter, float yCenter, float radius, bool isFilled=false, float numberOfSides=64.0f, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
virtual void setDepthTestFunc(int depthTestType)=0
void addSceneLight(gLight *light)
gShader * shadowmapshader
Definition gRenderer.h:780
static const std::string & getShaderSrcColorFragment()
virtual GLuint createFramebuffer()=0
void drawCross(float x, float y, float width, float height, float thickness, bool isFilled, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
static int width
Definition gRenderer.h:711
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:793
const glm::mat4 & getProjectionMatrix2d() const
int getHeight()
virtual void disableAlphaTest()=0
virtual void setShaderSourcePaths(const std::string &vertexPath, const std::string &fragmentPath)
Definition gRenderer.h:606
gShader * getColorShader()
virtual void releaseDeferredLighting()
Definition gRenderer.h:267
int cullingdirection
Definition gRenderer.h:742
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:779
virtual void drawColored2D(const glm::vec2 *points, int count, const glm::vec4 &color, const glm::mat4 &mvp, int drawMode=GL_TRIANGLES)
Definition gRenderer.h:273
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:135
std::unique_ptr< gRoundedRectangle > roundedrectanglemesh
Definition gRenderer.h:809
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:794
int getScreenWidth()
gRenderer()=default
static void setUnitResolution(int screenWidth, int screenHeight)
virtual void pushMatrix()=0
float foggradient
Definition gRenderer.h:724
virtual void disableCulling()
Definition gRenderer.h:448
void setGridColorofAxisWireFrameXZ(gColor *color)
gColor fogcolor
Definition gRenderer.h:722
virtual int getCullFace() const
Definition gRenderer.h:451
const gColor & getFogColor() const
bool isssaoallocated
Definition gRenderer.h:754
bool isgammacorrectionenabled
Definition gRenderer.h:767
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
virtual void endShadowPass()
Definition gRenderer.h:359
void drawBox(glm::mat4 transformationMatrix, bool isFilled=true)
void cleanupSSAOResources()
static const int DEPTHTESTTYPE_LESS
Definition gRenderer.h:135
virtual void setMat4(GLuint uniformloc, const glm::mat4 &mat)=0
bool iscullingenabled
Definition gRenderer.h:740
static const std::string & getShaderSrcImageVertex()
void setGridColorofAxisXZ(gColor *color)
int ssaorealdefaultfbo
Definition gRenderer.h:760
void enableHDR()
void setGridEnableXY(bool xy)
glm::vec3 getLightingPosition()
virtual void enableDepthTest()=0
static int unitwidth
Definition gRenderer.h:712
virtual int getBlendMode() const
Definition gRenderer.h:474
void setGlobalAmbientColor(int r, int g, int b, int a=255)
virtual void endFrame()
Definition gRenderer.h:256
virtual void clearColor(int r, int g, int b, int a=255)=0
void setSSAORadius(float value)
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()
virtual void drawMesh3D(GLuint vertexArrayId, int vertexCount, int indexCount, const glm::mat4 &model, const gMeshSurface &surface, int drawMode=GL_TRIANGLES, int instanceCount=1)
Definition gRenderer.h:331
float getSSAOStrength()
void drawLine(float x1, float y1, float x2, float y2)
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)
gShader * prefiltershader
Definition gRenderer.h:784
void removeSceneLight(gLight *light)
gUbo< gSceneData > * sceneubo
Definition gRenderer.h:731
void setFogColor(float r, float g, float b)
glm::mat4 projectionmatrix2d
Definition gRenderer.h:791
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
int ssaoprevviewport[4]
Definition gRenderer.h:762
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()
gGrid * originalgrid
Definition gRenderer.h:798
void drawArc(float xCenter, float yCenter, float radius, bool isFilled=true, int numberOfSides=60, float degree=360.0f, float rotate=360.0f, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
void setGridEnableXZ(bool xz)
virtual void setCullFace(int face)
Definition gRenderer.h:450
static const std::string & getShaderSrcFontVertex()
void drawLine(float x1, float y1, float x2, float y2, float thickness, float rotateAngle, float pivotx, float pivoty)
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
virtual bool isShadowPassActive() const
Definition gRenderer.h:360
void destroyPrimitiveMeshes()
void enableGrid()
std::unique_ptr< gCircle > circlemesh
Definition gRenderer.h:805
virtual void setMat2(GLuint uniformloc, const glm::mat2 &mat)=0
int fogno
Definition gRenderer.h:721
friend class gRenderObject
Definition gRenderer.h:708
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:136
virtual void deleteFramebuffer(GLuint &fbo)=0
gShader * getTextureShader()
glm::mat4 projectionmatrixold
Definition gRenderer.h:790
void endSSAO()
static const std::string & getShaderSrcPbrVertex()
void setSSAOStrength(float value)
virtual void deleteTexture(GLuint &texId)=0
virtual void flushQueuedDraws()
Definition gRenderer.h:257
bool isssaoenabled
Definition gRenderer.h:750
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
int getRenderEngineType() const
Definition gRenderer.h:270
std::unique_ptr< gLine > linemesh3
Definition gRenderer.h:803
virtual void drawElementsInstanced(int drawMode, int count, int instanceCount)=0
static int getResolution(int screenWidth, int screenHeight)
std::unique_ptr< gLine > linemesh
Definition gRenderer.h:803
void setGridColorofAxisXY(int r, int g, int b, int a)
virtual int getMultiSampling() const
Definition gRenderer.h:435
virtual bool isDeferredGeometryPassActive() const
Definition gRenderer.h:268
gShader * getPrefilterShader()
virtual bool resizeDeferredLighting(int width, int height)
Definition gRenderer.h:263
virtual void init()
static int screenscaling
Definition gRenderer.h:713
void createPrimitiveMeshes()
std::deque< gLight * > scenelights
Definition gRenderer.h:729
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:136
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:752
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
virtual bool isCullingEnabled() const
Definition gRenderer.h:449
int getSceneLightNum()
void setFogColor(const gColor &color)
int viewportx
Definition gRenderer.h:748
gShader * gridshader
Definition gRenderer.h:787
std::unique_ptr< gRectangle > rectanglemesh
Definition gRenderer.h:808
virtual void setVec4(GLuint uniformloc, const glm::vec4 &value)=0
bool isglobalambientcolorchanged
Definition gRenderer.h:736
int getUnitHeight()
static int scaleY(int y)
float fogdensity
Definition gRenderer.h:723
gShader * getBrdfShader()
static const int SCREENSCALING_MIPMAP
Definition gRenderer.h:134
void drawTriangle(float px, float py, float qx, float qy, float rx, float ry, bool is_filled=true, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
friend class gAppManager
Definition gRenderer.h:709
virtual GLuint createRenderbuffer()=0
const glm::mat4 & getViewMatrix() const
virtual void takeScreenshot(gImage &img)=0
virtual void enableAlphaBlending()=0
virtual bool allocateShadowMap(int width, int height)
Definition gRenderer.h:352
void removeAllSceneLights()
virtual void clearScreen(bool color=true, bool depth=true)=0
virtual void createFullscreenQuad(GLuint &vao, GLuint &vbo)=0
int getUnitResolution()
GLuint getBoundFramebuffer() const
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)
void setupSSAODepthSampling()
gGrid * grid
Definition gRenderer.h:797
virtual void attachTextureToFramebuffer(GLenum attachment, GLenum textarget, GLuint texId, GLuint level=0)=0
std::unique_ptr< gTriangle > trianglemesh
Definition gRenderer.h:804
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 updatePackUnpackAlignment(int i)=0
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:800
static const std::string & getShaderSrcImageFragment()
void setCamera(gCamera *camera)
bool isGridYZEnabled()
gShader * getFboShader()
gColor lightingcolor
Definition gRenderer.h:734
void setGridLineInterval(float intervalvalue)
gCamera * camera
Definition gRenderer.h:795
virtual void drawElements(int drawMode, int count)=0
static int unitresolution
Definition gRenderer.h:714
bool issoftshadowsenabled
Definition gRenderer.h:769
virtual void clearColor(gColor color)=0
void setColor(gColor *color)
glm::mat4 projectionmatrix
Definition gRenderer.h:789
gColor * rendercolor
Definition gRenderer.h:716
virtual void setReadBufferNone()=0
static const std::string & getShaderSrcFboFragment()
virtual bool isAlphaBlendingEnabled()=0
float getGridMaxLength()
bool isalphatestenabled
Definition gRenderer.h:744
void drawBox(float x, float y, float z, float w, float h, float d, float rotateAngle, float axisX, float axisY, float axisZ, bool isFilled=true)
void setFogDensity(float value)
int getFogNo() const
bool isfogenabled
Definition gRenderer.h:720
std::unique_ptr< gBox > boxmesh
Definition gRenderer.h:810
virtual void drawArraysInstanced(int drawMode, int count, int instanceCount)=0
std::unique_ptr< gArc > arcmesh
Definition gRenderer.h:807
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:778
void drawGridYZ()
static const std::string & getShaderSrcTextureFragment()
gShader * fontshader
Definition gRenderer.h:777
virtual void setVec3(GLuint uniformloc, float x, float y, float z)=0
virtual void enableCulling()
Definition gRenderer.h:447
virtual GLuint genBuffers()=0
SceneDataFlags
Definition gRenderer.h:160
@ ENABLE_SOFT_SHADOWS
Definition gRenderer.h:165
@ ENABLE_GAMMA
Definition gRenderer.h:163
@ ENABLE_FOG
Definition gRenderer.h:162
@ ENABLE_SSAO
Definition gRenderer.h:161
@ ENABLE_HDR
Definition gRenderer.h:164
virtual void useShader(GLuint id) const =0
bool isSSAOEnabled()
static void updateProjectionMatrix2d()
void setViewMatrix(glm::mat4 viewMatrix)
void drawGrid()
void setProjectionMatrix2d(glm::mat4 projectionMatrix2d)
float foglinearstart
Definition gRenderer.h:726
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()
virtual void setTextureMaxLevel(GLenum target, int maxLevel)=0
std::unique_ptr< gCross > crossmesh
Definition gRenderer.h:806
void setGridColorofAxisWireFrameXY(gColor *color)
virtual void setBlendMode(int blendMode)
Definition gRenderer.h:473
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:727
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:759
BlendMode
Definition gRenderer.h:469
@ BLENDMODE_ALPHA
Definition gRenderer.h:470
@ BLENDMODE_ADDITIVE
Definition gRenderer.h:471
virtual void drawTexturedRect2D(GLuint textureId, GLuint maskTextureId, const glm::vec4 &tint, const glm::mat4 &mvp, const glm::vec2 &uvOffset=glm::vec2(0.0f), const glm::vec2 &uvScale=glm::vec2(1.0f))
Definition gRenderer.h:276
virtual void readTexturePixels(unsigned char *inPixels, GLuint textureId, int width, int height, GLenum format)=0
float ssaostrength
Definition gRenderer.h:753
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
virtual void drawTexturedTriangles2D(GLuint textureId, const glm::vec4 &tint, const glm::mat4 &mvp, const float *xyuv, int vertexCount)
Definition gRenderer.h:284
int getFogMode() const
void gPushMatrix()
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:792
void disableSoftShadows()
const glm::vec3 & getCameraPosition() const
static const int SCREENSCALING_AUTO
Definition gRenderer.h:134
virtual void bindSkyTexture(GLuint texId, int textureSlot)=0
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:743
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:803
virtual void enableAlphaTest()=0
static const std::string & getShaderSrcSkyboxVertex()
virtual bool renderDeferredLightingPass()
Definition gRenderer.h:265
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()
virtual void setShadowMapState(bool enabled, const glm::mat4 &lightMatrix, const glm::vec3 &lightPosition, bool softShadows)
Definition gRenderer.h:364
bool ishdrenabled
Definition gRenderer.h:768
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
#define G_RENDERER_VK
Definition gConstants.h:33
#define G_RENDERER_GL
Definition gConstants.h:32
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 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 gCompatClear(unsigned int mask)
int gGetCullFace()
void gDrawArc(float xCenter, float yCenter, float radius, bool isFilled=true, int numberOfSides=60, float degree=360.0f, float rotate=360.0f, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
void gDrawRectangle(float x, float y, float w, float h, bool isFilled=false, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
bool gIsCullingEnabled()
void gDrawCircle(float xCenter, float yCenter, float radius, bool isFilled=false, float numberOfSides=64.0f, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
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 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 gDrawCross(float x, float y, float width, float height, float thickness, bool isFilled, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
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)
void gDrawTriangle(float px, float py, float qx, float qy, float rx, float ry, bool is_filled=true, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
#define GLIST_MAX_LIGHTS
Definition gRenderer.h:59
void gCheckGLErrorAndPrint(const std::string &prefix, const std::string &func, int line)
void gDrawLine(float x1, float y1, float x2, float y2)
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)
void gDrawArrow(float x1, float y1, float length, float angle, float tipLength, float tipAngle, float thickness=1.0f, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
int gGetCullingDirection()
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 gDrawRoundedRectangle(float x, float y, float w, float h, int radius, bool isFilled, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
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 gCompatBlendFunc(unsigned int sourceFactor, unsigned int destinationFactor)
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 gCullFace(int cullingFace)
Definition gRenderer.h:290
GLuint metallicmapid
Definition gRenderer.h:312
glm::vec2 texturetiling
Definition gRenderer.h:295
glm::vec4 diffuse
Definition gRenderer.h:292
GLuint diffusemapid
Definition gRenderer.h:299
bool ispbr
Definition gRenderer.h:309
float shininess
Definition gRenderer.h:294
GLuint normalmapid
Definition gRenderer.h:303
glm::vec4 ambient
Definition gRenderer.h:291
GLuint pbrnormalmapid
Definition gRenderer.h:311
glm::vec4 specular
Definition gRenderer.h:293
GLuint specularmapid
Definition gRenderer.h:300
GLuint aomapid
Definition gRenderer.h:314
GLuint roughnessmapid
Definition gRenderer.h:313
GLuint albedomapid
Definition gRenderer.h:310
Definition gRenderer.h:176
gSceneFogData fog
Definition gRenderer.h:181
unsigned int flags
Definition gRenderer.h:180
glm::mat4 viewmatrix
Definition gRenderer.h:179
glm::vec3 viewpos
Definition gRenderer.h:178
gColor rendercolor
Definition gRenderer.h:177
Definition gRenderer.h:168
int mode
Definition gRenderer.h:174
float linearStart
Definition gRenderer.h:170
float density
Definition gRenderer.h:172
glm::vec3 color
Definition gRenderer.h:169
float linearEnd
Definition gRenderer.h:171
float gradient
Definition gRenderer.h:173
Definition gRenderer.h:137
int type
Definition gRenderer.h:138
float spotoutercutoffangle
Definition gRenderer.h:150
float spotcutoffangle
Definition gRenderer.h:149
float quadratic
Definition gRenderer.h:147
glm::vec4 specular
Definition gRenderer.h:143
float constant
Definition gRenderer.h:145
glm::vec3 position
Definition gRenderer.h:139
glm::vec4 ambient
Definition gRenderer.h:141
glm::vec4 diffuse
Definition gRenderer.h:142
float linear
Definition gRenderer.h:146
glm::vec3 direction
Definition gRenderer.h:140
Definition gRenderer.h:153
int enabledlights
Definition gRenderer.h:155
gSceneLightData lights[GLIST_MAX_LIGHTS]
Definition gRenderer.h:157
glm::vec4 globalambientcolor
Definition gRenderer.h:156
int lightnum
Definition gRenderer.h:154