Implemented KRViewport object, which reduces redundant KRMat4 calculations and paves the way for upcoming rendering features.
--HG-- extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%40142
This commit is contained in:
@@ -118,9 +118,9 @@ float KRLight::getDecayStart() {
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
||||
void KRLight::render(KRCamera *pCamera, KRContext *pContext, KRMat4 &viewMatrix, KRVector3 &lightDirection, KRMat4 *pShadowMatrices, GLuint *shadowDepthTextures, int cShadowBuffers, KRNode::RenderPass renderPass) {
|
||||
void KRLight::render(KRCamera *pCamera, KRContext *pContext, const KRViewport &viewport, KRVector3 &lightDirection, KRMat4 *pShadowMatrices, GLuint *shadowDepthTextures, int cShadowBuffers, KRNode::RenderPass renderPass) {
|
||||
|
||||
KRNode::render(pCamera, pContext, viewMatrix, lightDirection, pShadowMatrices, shadowDepthTextures, cShadowBuffers, renderPass);
|
||||
KRNode::render(pCamera, pContext, viewport, lightDirection, pShadowMatrices, shadowDepthTextures, cShadowBuffers, renderPass);
|
||||
|
||||
if(renderPass == KRNode::RENDER_PASS_FLARES) {
|
||||
if(m_flareTexture.size() && m_flareSize > 0.0f) {
|
||||
@@ -136,15 +136,9 @@ void KRLight::render(KRCamera *pCamera, KRContext *pContext, KRMat4 &viewMatrix,
|
||||
KRMat4 m_modelMatrix = KRMat4();
|
||||
m_modelMatrix.translate(light_position.x, light_position.y, light_position.z);
|
||||
|
||||
|
||||
KRMat4 mvpmatrix = m_modelMatrix * viewMatrix * projectionMatrix;
|
||||
KRMat4 matModelToView = viewMatrix * m_modelMatrix;
|
||||
matModelToView.transpose();
|
||||
matModelToView.invert();
|
||||
|
||||
// Render light flare on transparency pass
|
||||
KRShader *pShader = pContext->getShaderManager()->getShader("flare", pCamera, false, false, false, 0, false, false, false, false, false, false, false, false, false, false, false, false, false, renderPass);
|
||||
if(pShader->bind(pCamera, m_modelMatrix, matModelToView, mvpmatrix, lightDirection, pShadowMatrices, shadowDepthTextures, 0, renderPass)) {
|
||||
if(pShader->bind(viewport, m_modelMatrix, lightDirection, pShadowMatrices, shadowDepthTextures, 0, renderPass)) {
|
||||
GLDEBUG(glUniform1f(
|
||||
pShader->m_uniforms[KRShader::KRENGINE_UNIFORM_FLARE_SIZE],
|
||||
m_flareSize
|
||||
|
||||
Reference in New Issue
Block a user