public void updateQuadtree(){ if (BaseContext.getCamera().isCameraMoved()){ updateCounter++; } if (updateCounter == updateThreshold){ synchronized(finishUpdateQuadtreeLock) { updateQuadtreeFinished = false; for (Node node : getChildren()){ ((QuadtreeChunk) node).updateQuadtree(leafChunks, formerLeafChunks); } updateCounter = 0; updateQuadtreeFinished = true; finishUpdateQuadtreeLock.notifyAll(); } } }
@Override public void updateUBOs(){ getHighPolyIndices().clear(); int index = 0; for (Matrix4f transform : getWorldMatrices()){ if (transform.getTranslation().sub(BaseContext.getCamera().getPosition()).length() < 220){ getHighPolyIndices().add(index); } index++; } getHighPolyInstances().setValue(getHighPolyIndices().size()); }
public void updateUBOs(){ getHighPolyIndices().clear(); int index = 0; for (Matrix4f transform : getWorldMatrices()){ if (transform.getTranslation().sub(BaseContext.getCamera().getPosition()).length() < 500){ getHighPolyIndices().add(index); } index++; } getHighPolyInstances().setValue(getHighPolyIndices().size()); }
public void updateUBOs(){ getHighPolyIndices().clear(); int index = 0; for (Matrix4f transform : getWorldMatrices()){ if (transform.getTranslation().sub(BaseContext.getCamera().getPosition()).length() < 220){ getHighPolyIndices().add(index); } index++; } getHighPolyInstances().setValue(getHighPolyIndices().size()); }
public void renderShadows(){ if (getCenter().sub(BaseContext.getCamera().getPosition()).length() < 800){ super.renderShadows();; } } }
public void renderShadows(){ if (getCenter().sub(BaseContext.getCamera().getPosition()).length() < 800){ super.renderShadows();; } } }
public void render(){ if (getCenter().sub(BaseContext.getCamera().getPosition()).length() < 800){ super.render(); } }
public void render(){ if (getCenter().sub(BaseContext.getCamera().getPosition()).length() < 600){ super.render(); } } }
public void render(){ if (getCenter().sub(BaseContext.getCamera().getPosition()).length() < 800){ super.render(); } }
public void update() { setCameraUnderwater(BaseContext.getCamera().getPosition().getY() < (getWorldTransform().getTranslation().getY())); }
public void run() { while(isRunning()){ InstancedHandler.getInstance().getLock().lock(); try { InstancedHandler.getInstance().getCondition().await(); } catch (InterruptedException e) { e.printStackTrace(); } finally{ InstancedHandler.getInstance().getLock().unlock(); } synchronized (getChildren()) { getChildren().clear(); for (InstancedCluster cluster : getClusters()){ if (cluster.getCenter().sub(BaseContext.getCamera().getPosition()).length() < 600){ addChild(cluster); } } } } } }
public void run(){ while(isRunning()){ InstancedHandler.getInstance().getLock().lock(); try { InstancedHandler.getInstance().getCondition().await(); } catch (InterruptedException e) { e.printStackTrace(); } finally{ InstancedHandler.getInstance().getLock().unlock(); } synchronized (getChildren()) { getChildren().clear(); for (InstancedCluster cluster : getClusters()){ if (cluster.getCenter().sub(BaseContext.getCamera().getPosition()).length() < 600){ addChild(cluster); } } } } } }
private void updateChildNodes(){ float distance = (BaseContext.getCamera().getPosition().sub(worldPos)).length(); if (distance < config.getLod_range()[lod]){ add4ChildNodes(lod+1); } else if(distance >= config.getLod_range()[lod]){ removeChildNodes(); } }
private void updateChildNodes(Map<String, QuadtreeChunk> leafChunks, Map<String, QuadtreeChunk> formerLeafChunks){ float distance = (BaseContext.getCamera().getPosition().sub(worldPos)).length(); if (distance < terrainProperties.getLod_range()[lod]){ add4ChildNodes(leafChunks, formerLeafChunks, lod+1); } else if(distance >= terrainProperties.getLod_range()[lod]){ removeChildNodes(leafChunks, formerLeafChunks); } }
if (cluster.getCenter().sub(BaseContext.getCamera().getPosition()).length() < 2000){ cluster.updateUBOs(); addChild(cluster);
public void run() { while(isRunning()){ InstancedHandler.getInstance().getLock().lock(); try { InstancedHandler.getInstance().getCondition().await(); } catch (InterruptedException e) { e.printStackTrace(); } finally{ InstancedHandler.getInstance().getLock().unlock(); } synchronized (getChildren()) { getChildren().clear(); for (InstancedCluster cluster : getClusters()){ if (cluster.getCenter().sub(BaseContext.getCamera().getPosition()).length() < 2000){ cluster.updateUBOs(); addChild(cluster); } } } } } }
public void render(GLTexture worldPositionSceneTexture, GLTexture normalSceneTexture){ ssaoShader.bind(); glBindImageTexture(0, ssaoSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA32F); glBindImageTexture(1, worldPositionSceneTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); glBindImageTexture(2, normalSceneTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); glBindImageTexture(3, noiseTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); ssaoShader.updateUniforms(BaseContext.getCamera().getViewMatrix(), BaseContext.getCamera().getProjectionMatrix(), width, height, kernel); glDispatchCompute(width/16,height/16,1); blurShader.bind(); glBindImageTexture(0, ssaoBlurSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA32F); glBindImageTexture(1, ssaoSceneTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); blurShader.updateUniforms(width, height); glDispatchCompute(width/16,height/16,1); }
public void render(GLTexture sceneSampler, GLTexture depthmap) { pixelVelocityShader.bind(); glBindImageTexture(0, pixelVelocityTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA32F); pixelVelocityShader.updateUniforms(BaseContext.getCamera().getProjectionMatrix(), BaseContext.getCamera().getViewProjectionMatrix().invert(), BaseContext.getCamera().getPreviousViewProjectionMatrix(), depthmap); glDispatchCompute(BaseContext.getWindow().getWidth()/8, BaseContext.getWindow().getHeight()/8, 1); glFinish(); motionBlurSceneTexture.bind(); motionBlurShader.bind(); glBindImageTexture(0, motionBlurSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); glBindImageTexture(1, sceneSampler.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(2, pixelVelocityTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); motionBlurShader.updateUniforms(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight()); glDispatchCompute(BaseContext.getWindow().getWidth()/8, BaseContext.getWindow().getHeight()/8, 1); glFinish(); }
public void render(GLTexture sceneSampler, GLTexture lightScatteringMask) { lightScatteringShader.bind(); glBindImageTexture(0, lightScatteringMask.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(1, sunLightScatteringTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); lightScatteringShader.updateUniforms(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight(), BaseContext.getCamera().getViewProjectionMatrix()); glDispatchCompute(BaseContext.getWindow().getWidth()/8, BaseContext.getWindow().getHeight()/8, 1); glFinish(); additiveBlendShader.bind(); glBindImageTexture(0, sunLightScatteringTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(1, sceneSampler.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(2, sunLightScatteringSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); glDispatchCompute(BaseContext.getWindow().getWidth()/8, BaseContext.getWindow().getHeight()/8, 1); glFinish(); }