35 ShadowMapRenderShaderBaseImplementation::ShadowMapRenderShaderBaseImplementation(
Renderer* renderer)
103 if (shaderVersion !=
"gl2") {
183 if (
lightId != this->lightId) {
188 auto lightPosition =
Vector3(light.position[0], light.position[1], light.position[2]);
189 auto lightSpotDirection =
Vector3(light.spotDirection[0], light.spotDirection[1], light.spotDirection[2]);
208 case LightingShaderConstants::SPECULAR_TEXTUREUNIT_DIFFUSE:
static int32_t getShadowMapWidth()
static int32_t getShadowMapHeight()
static int32_t getShadowMapRenderLookUps()
Interface to lighting shader program.
Matrix3x3 & getTextureMatrix(int contextIdx)
Get texture matrix.
int32_t LIGHTING_SPECULAR
virtual void setProgramUniformFloatVec2(int contextIdx, int32_t uniformId, const array< float, 2 > &data)=0
Set up a float vec2 uniform value.
virtual bool isUsingProgramAttributeLocation()=0
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.
Matrix4x4 & getProjectionMatrix()
virtual void setProgramUniformInteger(int contextIdx, int32_t uniformId, int32_t value)=0
Set up a integer uniform value.
virtual bool linkProgram(int32_t programId)=0
Links attached shaders to a program.
virtual void setProgramUniformFloatMatrix3x3(int contextIdx, int32_t uniformId, const array< float, 9 > &value)=0
Set up a float matrix 3x3 uniform value.
Renderer_SpecularMaterial & getSpecularMaterial(int contextIdx)
Get specular material.
void setLighting(int contextIdx, int32_t lighting)
Set current lighting model.
virtual bool isInstancedRenderingAvailable()=0
Checks if instanced rendering is available.
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.
Matrix4x4 & getModelViewMatrix()
Matrix4x4 & getCameraMatrix()
virtual void useProgram(int contextIdx, int32_t programId)=0
Use shader program.
virtual void setProgramUniformFloatVec3(int contextIdx, int32_t uniformId, const array< float, 3 > &data)=0
Set up a float vec3 uniform value.
virtual const string getShaderVersion()=0
virtual void setProgramUniformFloat(int contextIdx, int32_t uniformId, float value)=0
Set up a float uniform value.
Renderer_Light & getLight(int contextIdx, int32_t lightIdx)
Get light.
Shadow mapping base shader to render shadow maps.
virtual void loadTextures(const string &pathName) override
Load textures.
int32_t uniformTextureAtlasSize
int32_t renderUniformLightLinearAttenuation
virtual void updateLight(Renderer *renderer, int contextIdx, int32_t lightId) override
Update light.
virtual void updateTextureMatrix(Renderer *renderer, int contextIdx) override
Update texture matrix.
virtual void updateMaterial(Renderer *renderer, int contextIdx) override
Update material.
int32_t renderUniformLightConstantAttenuation
int32_t renderUniformLightQuadraticAttenuation
virtual ~ShadowMapRenderShaderBaseImplementation()
Destructor.
int32_t uniformTextureUnit
virtual void setRenderLightId(int32_t lightId) override
Set light id.
int32_t renderUniformLightPosition
virtual void initialize() override
Init shadow mapping.
int32_t renderUniformMVPMatrix
int32_t renderUniformLightDirection
int32_t uniformDiffuseTextureMaskedTransparencyThreshold
int32_t renderUniformDepthBiasMVPMatrix
virtual bool isInitialized() override
int32_t renderUniformTexturePixelHeight
virtual void unloadTextures() override
Unload textures.
virtual void bindTexture(Renderer *renderer, int contextIdx, int32_t textureId) override
Bind texture.
int32_t renderUniformLightSpotCosCutoff
int32_t renderUniformProjectionMatrix
virtual void unUseProgram(int contextIdx) override
Un use shadow map render shader program.
virtual void useProgram(Engine *engine, int contextIdx) override
Use shadow map render shader program.
int32_t renderUniformMVMatrix
int32_t uniformDiffuseTextureUnit
int32_t uniformDiffuseTextureMaskedTransparency
int32_t renderUniformNormalMatrix
int32_t uniformDiffuseTextureAvailable
virtual void updateMatrices(int contextIdx) override
Update matrices.
int32_t renderUniformCameraMatrix
int32_t renderUniformTexturePixelWidth
int32_t uniformTextureAtlasPixelDimension
int32_t renderUniformShadowMapLookUps
int32_t uniformTextureMatrix
int32_t renderUniformModelTranslation
int32_t renderUniformLightSpotExponent
virtual void setDepthBiasMVPMatrix(int contextIdx, const Matrix4x4 &depthBiasMVPMatrix) override
Set up program depth bias mvp matrix.
int32_t renderUniformTime
static constexpr int32_t TEXTUREUNIT
const array< float, 9 > & getArray() const
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Vector3 multiply(const Vector3 &vector3) const
Multiplies this matrix with vector3.
Matrix4x4 & set(float r0c0, float r0c1, float r0c2, float r0c3, float r1c0, float r1c1, float r1c2, float r1c3, float r2c0, float r2c1, float r2c2, float r2c3, float r3c0, float r3c1, float r3c2, float r3c3)
Sets this matrix by its components.
Matrix4x4 & invert()
Inverts this matrix.
Matrix4x4 & transpose()
Transposes this matrix.
const array< float, 16 > & getArray() const
void getTranslation(Vector3 &translation) const
Get translation.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
const array< float, 3 > & getArray() const
File system singleton class.
Lighting shader constants.