10#ifndef CORE_GRENDERER_H_
11#define CORE_GRENDERER_H_
15#if defined(WIN32) || defined(LINUX)
21#if defined(EMSCRIPTEN)
23#include <GLES3/gl2ext.h>
24#include <GLES3/gl3platform.h>
28#include <GLES3/gl3ext.h>
29#include <GLES3/gl3platform.h>
34#include <OpenGL/glu.h>
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>
41#define GLM_ENABLE_EXPERIMENTAL
42#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
44#include <glm/gtc/matrix_inverse.hpp>
45#include <glm/gtc/matrix_transform.hpp>
46#include <glm/gtx/quaternion.hpp>
54#ifndef GLIST_MAX_LIGHTS
56#define GLIST_MAX_LIGHTS 8
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__)
65#define G_CHECK_GL(fn) fn
66#define G_CHECK_GL2(value, fn) value = fn
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);
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);
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;
384 virtual void attachUbo(GLuint
id,
int bindingpoint,
const std::string& uboName) = 0;
401 virtual void setVertexAttribPointer(
int index,
int size,
int type,
bool normalized,
int stride,
const void* pointer) = 0;
427 virtual GLuint
loadProgram(
const char* vertexSource,
const char* fragmentSource,
const char* geometrySource) = 0;
429 virtual void setBool(GLuint uniformloc,
bool value) = 0;
430 virtual void setInt(GLuint uniformloc,
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;
448 virtual void clearScreen(
bool color =
true,
bool depth =
true) = 0;
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;
469 virtual void setFiltering(GLenum target, GLint minFilter, GLint magFilter) = 0;
471 virtual void setWrappingAndFiltering(GLenum target, GLint wrapS, GLint wrapT, GLint wrapR, GLint minFilter, GLint magFilter) = 0;
486 virtual void createQuad(GLuint& inQuadVAO, GLuint& inQuadVBO) = 0;
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);
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);
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);
Definition gAppManager.h:154
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 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)
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
static int unscaleY(int y)
virtual void enableDepthTestEqual()=0
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
void setSSAOBias(float value)
virtual void setWrapping(GLenum target, GLint wrapS, GLint wrapT)=0
unsigned int fullscreenquadvbo
Definition gRenderer.h:599
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
void setLightingColor(gColor *color)
Definition gRenderer.h:255
void setGridColorofAxisYZ(int r, int g, int b, int a)
static const std::string & getShaderSrcSSAOBlurFragment()
gColor globalambientcolor
Definition gRenderer.h:545
void setGridColorofAxisXY(gColor *color)
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
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)
bool isssaorendering
Definition gRenderer.h:566
virtual void enableCubeMap()=0
const gCamera * getCamera() const
void enableGammaCorrection()
bool isalphablendingenabled
Definition gRenderer.h:551
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
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
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 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
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
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
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()
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
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)
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 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()
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
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 setDrawBufferNone()=0
virtual void resetTexture()=0
bool isSoftShadowsEnabled()
virtual void takeScreenshot(gImage &img, int x, int y, int width, int height)=0
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)
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
static const std::string & getShaderSrcPbrVertex()
void setSSAOStrength(float value)
virtual void deleteTexture(GLuint &texId)=0
bool isssaoenabled
Definition gRenderer.h:553
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()
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 * getIrradianceShader()
int getCurrentResolution()
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
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
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
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
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)
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)
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
bool isalphatestenabled
Definition gRenderer.h:551
void setFogDensity(float value)
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
float getFogLinearEnd() const
gShader * imageshader
Definition gRenderer.h:576
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
void setViewMatrix(glm::mat4 viewMatrix)
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
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
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 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
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)
bool ishdrenabled
Definition gRenderer.h:570
Definition gRoundedRectangle.h:13
Definition gTriangle.h:13
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)
void gDrawCross(float x, float y, float width, float height, float thickness, bool isFilled)
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 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