8#define GLFW_INCLUDE_NONE
56 array<float, 4>
ambient {{ 0.0f, 0.0f, 0.0f, 1.0f }};
57 array<float, 4>
diffuse {{ 1.0f, 1.0f, 1.0f, 1.0f }};
58 array<float, 4>
specular {{ 1.0f, 1.0f, 1.0f, 1.0f }};
59 array<float, 4>
position {{ 0.0f, 0.0f, 0.0f, 0.0f }};
88 array<float, 4>
ambient {{ 0.2f, 0.2f, 0.2f, 1.0f }};
89 array<float, 4>
diffuse {{ 0.8f, 0.8f, 0.8f, 1.0f }};
90 array<float, 4>
specular {{ 0.0f, 0.0f, 0.0f, 1.0f }};
91 array<float, 4>
emission {{ 0.0f, 0.0f, 0.0f, 1.0f }};
345 virtual int32_t
loadShader(int32_t type,
const string& pathName,
const string& fileName,
const string& definitions =
string(),
const string& functions =
string()) = 0;
352 virtual void useProgram(
int contextIdx, int32_t programId) = 0;
495 return rendererContext.lighting;
505 rendererContext.lighting = lighting;
580 return rendererContext.textureMatrix;
596 virtual void setClearColor(
float red,
float green,
float blue,
float alpha) = 0;
671 virtual void setColorMask(
bool red,
bool green,
bool blue,
bool alpha) = 0;
677 virtual void clear(int32_t mask) = 0;
693 virtual int32_t
createDepthBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex) = 0;
703 virtual int32_t
createColorBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex) = 0;
818 virtual int32_t
createFramebufferObject(int32_t depthBufferTextureId, int32_t colorBufferTextureId, int32_t cubeMapTextureId = 0, int32_t cubeMapTextureIndex = 0) = 0;
834 int32_t depthBufferTextureId,
835 int32_t geometryBufferTextureId1,
836 int32_t geometryBufferTextureId2,
837 int32_t geometryBufferTextureId3,
838 int32_t colorBufferTextureId1,
839 int32_t colorBufferTextureId2,
840 int32_t colorBufferTextureId3,
841 int32_t colorBufferTextureId4,
842 int32_t colorBufferTextureId5
1101 return rendererContext.lights[lightIdx];
1118 return rendererContext.effectColorMul;
1128 return rendererContext.effectColorAdd;
1144 return rendererContext.specularMaterial;
1154 return rendererContext.pbrMaterial;
1169 return rendererContext.shader;
1180 rendererContext.shader = id;
1196 return rendererContext.shaderParameters;
1206 rendererContext.shaderParameters = parameters;
1240 virtual void dispatchCompute(
int contextIdx, int32_t numGroupsX, int32_t numGroupsY, int32_t numGroupsZ) = 0;
1327 return rendererContext.maskMaxValue;
1337 rendererContext.maskMaxValue = maskMaxValue;
1347 return rendererContext.environmentMappingCubeMapPosition;
1357 rendererContext.environmentMappingCubeMapPosition = position;
TDME2 engine entity shader parameters.
virtual void setTextureUnit(int contextIdx, int32_t textureUnit)=0
Sets up texture unit.
virtual void bindCubeMapTexture(int contextIdx, int32_t textureId)=0
Binds a cube map texture with given id or unbinds when using ID_NONE.
Matrix4x4 projectionMatrix
virtual void enableAdditionBlending()=0
Enable blending with c = a + b.
virtual void uploadIndicesBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer *data)=0
Uploads buffer data to buffer object.
virtual int32_t loadShader(int32_t type, const string &pathName, const string &fileName, const string &definitions=string(), const string &functions=string())=0
Loads a shader.
virtual void uploadIndicesBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, ShortBuffer *data)=0
Uploads buffer data to buffer object.
virtual void resizeDepthBufferTexture(int32_t textureId, int32_t width, int32_t height)=0
Resizes a depth texture.
int32_t CUBEMAPTEXTUREINDEX_NEGATIVE_Z
virtual void onUpdateProjectionMatrix(int contextIdx)=0
Update projection matrix event.
virtual void initializeFrame()=0
Pre Frame Initialization.
virtual void setViewPort(int32_t width, int32_t height)=0
Set up viewport parameter.
virtual void drawInstancedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, int32_t instances)=0
Draw instanced triangles from buffer objects.
int32_t SHADER_FRAGMENT_SHADER
Renderer_SpecularMaterial & getSpecularMaterial(int contextIdx)
Get specular material.
virtual void memoryBarrier()=0
Memory barrier.
virtual void bindEffectColorMulsBufferObject(int contextIdx, int32_t bufferObjectId, int32_t divisor)=0
Bind effect color muls buffer object.
array< float, 3 > & getEnvironmentMappingCubeMapPosition(int contextIdx)
Get environment mapping cube map position.
virtual void bindSkinningVertexJointIdxsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertex joint indices buffer object.
Matrix4x4 modelViewMatrix
array< float, 4 > & getEffectColorMul(int contextIdx)
Get effect color mul.
virtual void setProgramUniformFloatVec4(int contextIdx, int32_t uniformId, const array< float, 4 > &data)=0
Set up a float vec4 uniform value.
virtual void drawInstancedIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, int32_t instances)=0
Draw instanced indexed triangles from buffer objects.
virtual void enableCulling(int contextIdx)=0
Enable culling.
virtual void enableDepthBufferTest()=0
Enable depth buffer test.
virtual void drawLinesFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset)=0
Draw lines from buffer objects.
Renderer_Statistics statistics
void setShaderPrefix(const string &shaderPrefix)
Set shader prefix.
virtual void onUpdateCameraMatrix(int contextIdx)=0
Update camera matrix event.
virtual void uploadSkinningBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer *data)=0
Upload skinning buffer object.
virtual bool isSupportingMultithreadedRendering()=0
virtual void bindTangentsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind tangents buffer object.
int32_t LIGHTING_SPECULAR
virtual void onUpdateShader(int contextIdx)=0
On update shader.
virtual bool isSupportingIntegerProgramAttributes()=0
int32_t SHADER_COMPUTE_SHADER
virtual void finishFrame()=0
Finish frame.
Vector3 & getCameraPosition()
virtual void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer *data)=0
Uploads buffer data to buffer object.
Matrix4x4 & getViewportMatrix()
virtual void enableDepthBufferWriting()=0
Enable depth buffer writing.
virtual void resizeColorBufferTexture(int32_t textureId, int32_t width, int32_t height)=0
Resize color buffer texture.
Texture * generateMipMap(const string &id, Texture *texture, int32_t level, int32_t atlasBorderSize)
Generate mip map for atlas texture currently.
virtual int32_t createColorBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex)=0
Creates a color buffer texture.
Matrix4x4 & getProjectionMatrix()
virtual void unbindBufferObjects(int contextIdx)=0
Unbind buffer objects.
virtual void setClearColor(float red, float green, float blue, float alpha)=0
Set up clear color.
int32_t SHADER_VERTEX_SHADER
int32_t UNIFORM_CL_SKINNING_MATRIX_COUNT
virtual int32_t createProgram(int type)=0
Creates a shader program.
int32_t CLEAR_COLOR_BUFFER_BIT
virtual void setProgramUniformFloatVec2(int contextIdx, int32_t uniformId, const array< float, 2 > &data)=0
Set up a float vec2 uniform value.
int32_t UNIFORM_CL_SKINNING_VERTEX_COUNT
int32_t CUBEMAPTEXTUREINDEX_NEGATIVE_X
virtual bool isUsingProgramAttributeLocation()=0
virtual void onUpdateLight(int contextIdx, int32_t lightId)=0
Update light.
virtual void setCullFace(int32_t cullFace)=0
Sets up which face will be culled.
int32_t CUBEMAPTEXTUREINDEX_POSITIVE_Y
virtual void disposeBufferObjects(vector< int32_t > &bufferObjectIds)=0
Disposes a frame buffer object.
virtual bool isComputeShaderAvailable()=0
virtual void bindSkinningMatricesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning matrices result buffer object.
virtual void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, ShortBuffer *data)=0
Uploads buffer data to buffer object.
virtual void updateViewPort()=0
Update viewport.
int32_t UNIFORM_CL_SKINNING_INSTANCE_COUNT
virtual void bindSpriteSheetDimensionBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind sprite sheet dimension buffer object.
virtual int32_t getTextureUnit(int contextIdx)=0
Get texture unit.
virtual void setProgramAttributeLocation(int32_t programId, int32_t location, const string &name)=0
Bind attribute to a input location.
virtual void bindSkinningVerticesResultBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertices result buffer object.
virtual void enableBlending()=0
Enables blending.
virtual void disableBlending()=0
Disables blending.
virtual void drawPointsFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset)=0
Draw points from buffer objects.
virtual ByteBuffer * readPixels(int32_t x, int32_t y, int32_t width, int32_t height)=0
Read pixels.
virtual void initGuiMode()=0
Set up renderer for GUI rendering.
float getMaskMaxValue(int contextIdx)
Get mask max value.
virtual int32_t createTexture()=0
Creates a texture.
vector< Renderer_Context > rendererContexts
int32_t getViewPortWidth()
virtual void setProgramUniformInteger(int contextIdx, int32_t uniformId, int32_t value)=0
Set up a integer uniform value.
int32_t CUBEMAPTEXTUREINDEX_NEGATIVE_Y
int32_t getEffectPass()
Get effect pass.
virtual void onBindTexture(int contextIdx, int32_t textureId)=0
On bind texture event.
virtual int32_t createFramebufferObject(int32_t depthBufferTextureId, int32_t colorBufferTextureId, int32_t cubeMapTextureId=0, int32_t cubeMapTextureIndex=0)=0
Creates a frame buffer object with depth texture attached.
virtual bool isBufferObjectsAvailable()=0
Checks if buffer objects is available.
virtual void setColorMask(bool red, bool green, bool blue, bool alpha)=0
Set up GL rendering colormask.
RendererType rendererType
RendererType getRendererType()
virtual void onUpdateTextureMatrix(int contextIdx)=0
Update texture matrix for active texture unit event.
virtual int32_t getTextureUnits()=0
void setMaskMaxValue(int contextIdx, float maskMaxValue)
Set mask max value.
virtual bool linkProgram(int32_t programId)=0
Links attached shaders to a program.
virtual void bindTexture(int contextIdx, int32_t textureId)=0
Binds a texture with given id or unbinds when using ID_NONE.
virtual void setProgramUniformFloatMatrix3x3(int contextIdx, int32_t uniformId, const array< float, 9 > &value)=0
Set up a float matrix 3x3 uniform value.
Matrix4x4 & getCameraMatrix()
virtual void bindSkinningNormalsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning normal buffer object.
virtual void bindModelMatricesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind model matrices buffer object.
virtual bool isPBRAvailable()=0
virtual int32_t createDepthBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex)=0
Creates a depth buffer texture.
virtual void disableDepthBufferWriting()=0
Disable depth buffer writing.
virtual const string getVendor()=0
const string & getShader(int contextIdx)
Get shader.
virtual void bindIndicesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind indices buffer object.
int32_t getViewPortHeight()
virtual const string getRenderer()=0
void setLighting(int contextIdx, int32_t lighting)
Set current lighting model.
Renderer()
Public constructor.
virtual void attachShaderToProgram(int32_t programId, int32_t shaderId)=0
Attaches a shader to a program.
int32_t DEPTHFUNCTION_ALWAYS
virtual void setFrontFace(int contextIdx, int32_t frontFace)=0
Set up clock wise or counter clock wise faces as front face.
virtual void bindSkinningNormalsResultBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning normals result buffer object.
virtual bool isInstancedRenderingAvailable()=0
Checks if instanced rendering is available.
void setShader(int contextIdx, const string &id)
Set shader.
virtual int32_t createGBufferGeometryTexture(int32_t width, int32_t height)=0
Creates a geometry buffer geometry texture.
virtual void setProgramUniformFloatMatrix4x4(int contextIdx, int32_t uniformId, const array< float, 16 > &value)=0
Set up a float matrix 4x4 uniform value.
virtual int32_t getProgramUniformLocation(int32_t programId, const string &name)=0
Returns location of given uniform variable.
virtual void drawTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset)=0
Draw triangles from buffer objects.
int32_t DEPTHFUNCTION_LESSEQUAL
Renderer_PBRMaterial & getPBRMaterial(int contextIdx)
Get PBR material.
const string & getShaderPrefix()
Get shader prefix.
virtual void onUpdateModelViewMatrix(int contextIdx)=0
Update model view matrix event.
virtual void bindBitangentsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind bitangents buffer object.
virtual void initialize()=0
Initialize renderer.
virtual void disposeTexture(int32_t textureId)=0
Dispose a texture.
virtual void onUpdateShaderParameters(int contextIdx)=0
On update shader parameters.
virtual void bindSkinningVertexJointsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertex joints buffer object.
Matrix4x4 & getModelViewMatrix()
virtual int32_t createCubeMapTexture(int contextIdx, int32_t width, int32_t height)=0
Create cube map texture from frame buffers.
const EntityShaderParameters & getShaderParameters(int contextIdx)
Get shader parameters.
virtual void resizeGBufferGeometryTexture(int32_t textureId, int32_t width, int32_t height)=0
Resizes a geometry buffer geometry texture.
virtual void bindFrameBuffer(int32_t frameBufferId)=0
Enables a framebuffer to be rendered.
virtual void uploadTexture(int contextIdx, Texture *texture)=0
Uploads texture data to current bound texture.
virtual void bindSkinningVerticesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertices buffer object.
virtual void uploadSkinningBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer *data)=0
Upload skinning buffer object.
int32_t DEPTHFUNCTION_GREATEREQUAL
virtual void clear(int32_t mask)=0
Clear render buffer with given mask.
int32_t getLighting(int contextIdx)
Get current lighting model.
virtual bool isUsingShortIndices()=0
virtual bool isDepthTextureAvailable()=0
Checks if depth texture is available.
virtual void disableCulling(int contextIdx)=0
Disable culling.
virtual void disposeFrameBufferObject(int32_t frameBufferId)=0
Disposes a frame buffer object.
virtual void drawIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset)=0
Draw indexed triangles from buffer objects.
virtual bool isDeferredShadingAvailable()=0
virtual void dispatchCompute(int contextIdx, int32_t numGroupsX, int32_t numGroupsY, int32_t numGroupsZ)=0
Dispatch compute.
virtual const Renderer_Statistics getStatistics()=0
virtual void bindSkinningVertexJointWeightsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertex joint weights buffer object.
int32_t CUBEMAPTEXTUREINDEX_POSITIVE_Z
void setEffectPass(int32_t effectPass)
Set effect pass.
virtual void doneGuiMode()=0
Set up renderer for 3d rendering.
int32_t CONTEXTINDEX_DEFAULT
virtual bool isNormalMappingAvailable()=0
Matrix2D3x3 & getTextureMatrix(int contextIdx)
Get texture matrix.
virtual float readPixelDepth(int32_t x, int32_t y)=0
Reads a pixel depth.
virtual bool isSpecularMappingAvailable()=0
virtual void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer *data)=0
Uploads buffer data to buffer object.
virtual void bindTextureCoordinatesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind texture coordinates buffer object.
virtual void setDepthFunction(int32_t depthFunction)=0
Set up depth function.
virtual void onUpdateEffect(int contextIdx)=0
Update material.
int32_t DEPTHFUNCTION_EQUAL
virtual vector< int32_t > createBufferObjects(int32_t buffers, bool useGPUMemory, bool shared)=0
Generate buffer objects for vertex data and such.
void setEnvironmentMappingCubeMapPosition(int contextIdx, array< float, 3 > &position)
Set environment mapping cube map position.
virtual void setProgramUniformFloatMatrices4x4(int contextIdx, int32_t uniformId, int32_t count, FloatBuffer *data)=0
Set up a float matrices 4x4 uniform values.
virtual void uploadCubeMapTexture(int contextIdx, Texture *textureLeft, Texture *textureRight, Texture *textureTop, Texture *textureBottom, Texture *textureFront, Texture *textureBack)=0
Uploads cube map texture data to current bound texture.
virtual void onUpdateMaterial(int contextIdx)=0
On update material.
virtual void bindPointSizesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind point sizes buffer object.
virtual int32_t createGBufferColorTexture(int32_t width, int32_t height)=0
Creates a geometry buffer color RGBA texture.
virtual void bindColorsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind colors buffer object.
virtual bool initializeWindowSystemRendererContext(GLFWwindow *glfwWindow)=0
Initialize window system renderer context.
virtual void setLineWidth(float lineWidth)=0
Set line width.
virtual void setVSync(bool vSync)=0
Enable/Disable v-sync.
int32_t FRAMEBUFFER_DEFAULT
Renderer_Light & getLight(int contextIdx, int32_t lightIdx)
Get light.
virtual void useProgram(int contextIdx, int32_t programId)=0
Use shader program.
array< float, 4 > & getEffectColorAdd(int contextIdx)
Get effect color add.
virtual void setProgramUniformFloatVec3(int contextIdx, int32_t uniformId, const array< float, 3 > &data)=0
Set up a float vec3 uniform value.
virtual void bindVerticesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind vertices buffer object.
void setShaderParameters(int contextIdx, const EntityShaderParameters ¶meters)
Set shader parameters.
int32_t CUBEMAPTEXTUREINDEX_POSITIVE_X
virtual int32_t createGeometryBufferObject(int32_t depthBufferTextureId, int32_t geometryBufferTextureId1, int32_t geometryBufferTextureId2, int32_t geometryBufferTextureId3, int32_t colorBufferTextureId1, int32_t colorBufferTextureId2, int32_t colorBufferTextureId3, int32_t colorBufferTextureId4, int32_t colorBufferTextureId5)=0
Creates a geometry frame buffer object.
virtual bool isGLCLAvailable()=0
virtual void bindTextureSpriteIndicesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind texture and sprite indices buffer object.
virtual bool prepareWindowSystemRendererContext(int tryIdx)=0
Prepare window system renderer context.
virtual void disableDepthBufferTest()=0
Disable depth buffer test.
virtual void bindEffectColorAddsBufferObject(int contextIdx, int32_t bufferObjectId, int32_t divisor)=0
Bind effect color adds buffer object.
virtual void resizeGBufferColorTexture(int32_t textureId, int32_t width, int32_t height)=0
Resizes a geometry buffer color RGBA texture.
virtual ~Renderer()
Destructor.
virtual void bindNormalsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind normals buffer object.
virtual void bindOriginsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind origins buffer object.
int32_t CLEAR_DEPTH_BUFFER_BIT
virtual const string getShaderVersion()=0
virtual void setProgramUniformFloat(int contextIdx, int32_t uniformId, float value)=0
Set up a float uniform value.
Renderer_SpecularMaterial specularMaterial
EntityShaderParameters shaderParameters
array< float, 3 > environmentMappingCubeMapPosition
Renderer_PBRMaterial pbrMaterial
array< float, 4 > effectColorAdd
Matrix2D3x3 textureMatrix
array< Renderer_Light, 8 > lights
array< float, 4 > effectColorMul
Bean holding light properties.
array< float, 4 > ambient
array< float, 3 > spotDirection
array< float, 4 > position
float constantAttenuation
array< float, 4 > diffuse
float quadraticAttenuation
array< float, 4 > specular
Bean holding PBR material properties.
array< float, 4 > baseColorFactor
float baseColorTextureMaskedTransparencyThreshold
int baseColorTextureMaskedTransparency
Bean holding specular material properties.
float diffuseTextureMaskedTransparencyThreshold
array< float, 4 > ambient
array< float, 4 > emission
int diffuseTextureMaskedTransparency
array< float, 4 > diffuse
array< float, 4 > specular
array< float, 2 > textureAtlasPixelDimension
Bean holding light properties.
uint32_t disposedTextures
int64_t memoryUsageShared