void PostProcessing::renderGI(const core::matrix4 &RHMatrix, const core::vector3df &rh_extend, GLuint shr, GLuint shg, GLuint shb) { core::matrix4 InvRHMatrix; RHMatrix.getInverse(InvRHMatrix); glDisable(GL_DEPTH_TEST); glUseProgram(FullScreenShader::GlobalIlluminationReconstructionShader::Program); glBindVertexArray(FullScreenShader::GlobalIlluminationReconstructionShader::vao); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_3D, shr); { glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_3D, shg); { glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_3D, shb); { glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } setTexture(3, irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), GL_NEAREST, GL_NEAREST); setTexture(4, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST); FullScreenShader::GlobalIlluminationReconstructionShader::setUniforms(RHMatrix, InvRHMatrix, rh_extend, 3, 4, 0, 1, 2); glDrawArrays(GL_TRIANGLES, 0, 3); }
//----------------------------------------------------------------------------- void KartModel::attachHat() { m_hat_node = NULL; if(m_hat_name.size()>0) { scene::IBoneSceneNode *bone = m_animated_node->getJointNode("Head"); if(!bone) bone = m_animated_node->getJointNode("head"); if(bone) { // Till we have all models fixed, accept Head and head as bone name scene::IMesh *hat_mesh = irr_driver->getAnimatedMesh( file_manager->getAsset(FileManager::MODEL, m_hat_name)); m_hat_node = irr_driver->addMesh(hat_mesh, "hat"); bone->addChild(m_hat_node); m_animated_node->setCurrentFrame((float)m_animation_frame[AF_STRAIGHT]); m_animated_node->OnAnimate(0); bone->updateAbsolutePosition(); // With the hat node attached to the head bone, we have to // reverse the transformation of the bone, so that the hat // is still properly placed. Esp. the hat offset needs // to be rotated. const core::matrix4 mat = bone->getAbsoluteTransformation(); core::matrix4 inv; mat.getInverse(inv); core::vector3df rotated_offset; inv.rotateVect(rotated_offset, m_hat_offset); m_hat_node->setPosition(rotated_offset); m_hat_node->setScale(inv.getScale()); m_hat_node->setRotation(inv.getRotationDegrees()); } // if bone } // if(m_hat_name) } // attachHat
void PostProcessing::renderGI(const core::matrix4 &RHMatrix, const core::vector3df &rh_extend, GLuint shr, GLuint shg, GLuint shb) { core::matrix4 InvRHMatrix; RHMatrix.getInverse(InvRHMatrix); glDisable(GL_DEPTH_TEST); FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->SetTextureUnits(createVector<GLuint>( irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), irr_driver->getDepthStencilTexture(), shr, shg, shb)); DrawFullScreenEffect<FullScreenShader::GlobalIlluminationReconstructionShader>(RHMatrix, InvRHMatrix, rh_extend); }
void setProjMatrix(core::matrix4 matrix) { m_ProjMatrix = matrix; matrix.getInverse(m_InvProjMatrix); }
// ------------------------------------------------------------------------ void setViewMatrix(core::matrix4 matrix) { m_ViewMatrix = matrix; matrix.getInverse(m_InvViewMatrix); }