Exemple #1
0
void lb::LightSystem::Update( const ofCamera& _camera )
{
    m_clusterGrid.CullPointLights( _camera.getModelViewMatrix(), m_pointLights );
    m_clusterGrid.SortLightIndexList();
    m_clusterGrid.UpdateLightIndexTextures();

    UpdateUbo();
}
Exemple #2
0
void lb::LightSystem::Update( const ofCamera& _camera )
{
    // updateData() will use direct state access (DSA) on GL 4.5, faster than map?
    m_pointLightUbo.updateData( m_pointLights.size() * sizeof( lb::PointLight ), m_pointLights.data() );

    m_clusterGrid.CullPointLights( _camera.getModelViewMatrix(), m_pointLights );
    m_clusterGrid.SortLightIndexList();
    m_clusterGrid.UpdateLightIndexTextures();
}
Exemple #3
0
        //--------------------------------------------------------------
        void ViewUbo::update(const ofCamera & camera)
        {
            const auto bounds = ofGetCurrentViewport();
            this->data.viewportSize = glm::vec2(bounds.width, bounds.height);
            this->data.rcpViewportSize = 1.0f / this->data.viewportSize;
            this->data.nearClip = camera.getNearClip();
            this->data.farClip = camera.getFarClip();
			this->data.viewMatrix = camera.getModelViewMatrix();
            this->data.inverseViewMatrix = glm::inverse(this->data.viewMatrix);

            this->ubo.updateData(sizeof(Data), &this->data);
        }
void SecondCamera::setFromOtherCamera(ofCamera& other)
{
	setFarClip(other.getFarClip());
	setNearClip(other.getNearClip());
	setFov(other.getFov());
	
	matProjection = other.getProjectionMatrix();
	matModelView = other.getModelViewMatrix();
	
	matModelView.postMultTranslate(-_offset);
	
	isActive = true;
}
 void PostProcessing::begin(ofCamera& cam)
 {
     // update camera matrices
     cam.begin();
     cam.end();
     
     raw.begin(false);
     
     glMatrixMode(GL_PROJECTION);
     glPushMatrix();
     glLoadMatrixf(cam.getProjectionMatrix(ofRectangle(0, 0, width, height)).getPtr());
     
     glMatrixMode(GL_MODELVIEW);
     glPushMatrix();
     glLoadMatrixf(cam.getModelViewMatrix().getPtr());
     
     glViewport(0, 0, raw.getWidth(), raw.getHeight());
     
     glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
 }
 void PostProcessing::begin(ofCamera& cam)
 {
     // update camera matrices
     cam.begin();
     cam.end();
     
     raw.begin(ofFboBeginMode::NoDefaults);
     
     ofMatrixMode(OF_MATRIX_PROJECTION);
     ofPushMatrix();
     ofLoadMatrix(cam.getProjectionMatrix(ofRectangle(0, 0, width, height)));
     
     ofMatrixMode(OF_MATRIX_MODELVIEW);
     ofPushMatrix();
     ofLoadMatrix(cam.getModelViewMatrix());
     
     ofViewport(0, 0, raw.getWidth(), raw.getHeight());
     
     glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
     
     ofPushStyle();
     glPushAttrib(GL_ENABLE_BIT);
 }