public UIElement(int xPos, int yPos, int xScaling, int yScaling){ super(); setOrthographicMatrix(new Matrix4f().Orthographic2D()); getWorldTransform().setTranslation(xPos, yPos, 0); getWorldTransform().setScaling(xScaling, yScaling, 0); setOrthographicMatrix(getOrthographicMatrix().mul(getWorldTransform().getWorldMatrix())); }
public Ocean() { super(128, OceanBRDFShader.getInstance(), OceanWireframeShader.getInstance()); getWorldTransform().setScaling(Constants.ZFAR,1,Constants.ZFAR); getWorldTransform().setTranslation(-Constants.ZFAR/2,0,-Constants.ZFAR/2); setClip_offset(4); setClipplane(new Vec4f(0,-1,0,getWorldTransform().getTranslation().getY() + getClip_offset())); }
public TerrainQuadtree(Map<NodeComponentType, NodeComponent> components, int rootChunkCount, float horizontalScaling) { super(); Transform worldTransformFace0 = new Transform(); worldTransformFace0.setTranslation(-0.5f * horizontalScaling, 0, -0.5f * horizontalScaling); worldTransformFace0.setScaling(horizontalScaling); for (int i=0; i<rootChunkCount; i++){ for (int j=0; j<rootChunkCount; j++){ addChild(createChildChunk(components, quadtreeCache, worldTransformFace0, new Vec2f(1f * i/(float)rootChunkCount,1f * j/(float)rootChunkCount), 0, new Vec2f(i,j))); } } }
public void update() { getWorldTransform().setScaling(getWorldTransform().getLocalScaling()); for(Node child: getChildren()) child.update(); }
public void updateUniforms(Renderable object) { setUniform("modelViewProjectionMatrix", object.getWorldTransform().getModelViewProjectionMatrix()); setUniform("worldMatrix", object.getWorldTransform().getWorldMatrix()); } }
offScreenReflecRefracFbo = VkContext.getResources().getOffScreenReflectionFbo(); getWorldTransform().setScaling(Constants.ZFAR,1,Constants.ZFAR); getWorldTransform().setTranslation(-Constants.ZFAR/2,0,-Constants.ZFAR/2); clipplane = new Vec4f(0,-1,0,getWorldTransform().getTranslation().getY() + clip_offset); pushConstants.put(BufferUtil.createByteBuffer(getWorldTransform().getWorldMatrix())); pushConstants.putFloat(waterConfiguration.getWindDirection().getX()); pushConstants.putFloat(waterConfiguration.getWindDirection().getY());
Vec3f localTranslation = new Vec3f(location.getX(),0,location.getY()); getLocalTransform().setScaling(localScaling); getLocalTransform().setTranslation(localTranslation); getWorldTransform().setLocalScaling(config.getScaleXZ(), config.getScaleY(), config.getScaleXZ()); getWorldTransform().getLocalTranslation().setX(-config.getScaleXZ()/2f); getWorldTransform().getLocalTranslation().setZ(-config.getScaleXZ()/2f); getWorldTransform().getLocalTranslation().setY(0); getWorldTransform().setScaling(getWorldTransform().getLocalScaling()); getWorldTransform().setTranslation(getWorldTransform().getLocalTranslation());
Transform worldTransformFace0 = new Transform(); worldTransformFace0.setTranslation(-0.5f * horizontalScaling, 0.5f * horizontalScaling, -0.5f * horizontalScaling); worldTransformFace0.setRotation(-90f, 0f, 0f); worldTransformFace0.setScaling(horizontalScaling); Transform worldTransformFace1 = new Transform(); worldTransformFace1.setTranslation(-0.5f * horizontalScaling, 0.5f * horizontalScaling, -0.5f * horizontalScaling); worldTransformFace1.setRotation(-90, 90, 0); worldTransformFace1.setScaling(horizontalScaling); Transform worldTransformFace2 = new Transform(); worldTransformFace2.setTranslation(-0.5f * horizontalScaling, 0.5f * horizontalScaling, -0.5f * horizontalScaling); worldTransformFace2.setRotation(-90, 180, 0); worldTransformFace2.setScaling(horizontalScaling); Transform worldTransformFace3 = new Transform(); worldTransformFace3.setTranslation(-0.5f * horizontalScaling, 0.5f * horizontalScaling, -0.5f * horizontalScaling); worldTransformFace3.setRotation(-90, -90, 0); worldTransformFace3.setScaling(horizontalScaling); Transform worldTransformFace4 = new Transform(); worldTransformFace4.setTranslation(-0.5f * horizontalScaling, 0.5f * horizontalScaling, -0.5f * horizontalScaling); worldTransformFace4.setScaling(horizontalScaling);
public QuadtreeChunk(Map<NodeComponentType, NodeComponent> components, QuadtreeCache quadtreeCache, Transform worldTransform, Vec2f location, int lod, Vec2f index){ addComponent(NodeComponentType.CONFIGURATION, components.get(NodeComponentType.CONFIGURATION)); terrainProperties = getComponent(NodeComponentType.CONFIGURATION); this.quadtreeCache = quadtreeCache; this.isleaf = true; this.index = index; this.lod = lod; this.location = location; this.gap = 1f/(terrainProperties.getRootChunkCount() * (float)(Math.pow(2, lod))); Vec3f localScaling = new Vec3f(gap,0,gap); Vec3f localTranslation = new Vec3f(location.getX(),0,location.getY()); getLocalTransform().setScaling(localScaling); getLocalTransform().setTranslation(localTranslation); setWorldTransform(worldTransform); computeWorldPos(); }
texturePanel0.getOrthoTransform().setScaling(200,200,0); texturePanel0.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel0.getOrthoTransform().getWorldMatrix())); texturePanel0.setSpacing(0.06f); texturePanel0.setBrightness(0.2f); texturePanel1.getOrthoTransform().setScaling(400,400,0); texturePanel1.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel1.getOrthoTransform().getWorldMatrix())); texturePanel1.setSpacing(0.0f); texturePanel1.setBrightness(0.4f); texturePanel2.getOrthoTransform().setScaling(250,250,0); texturePanel2.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel2.getOrthoTransform().getWorldMatrix())); texturePanel2.setSpacing(0.2f); texturePanel2.setBrightness(0.25f); texturePanel3.getOrthoTransform().setScaling(200,200,0); texturePanel3.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel3.getOrthoTransform().getWorldMatrix())); texturePanel3.setSpacing(0.4f); texturePanel3.setBrightness(0.2f); texturePanel4.getOrthoTransform().setScaling(100,100,0); texturePanel4.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel4.getOrthoTransform().getWorldMatrix())); texturePanel4.setSpacing(0.6f); texturePanel4.setBrightness(0.2f); texturePanel5.getOrthoTransform().setScaling(100,100,0); texturePanel5.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel5.getOrthoTransform().getWorldMatrix())); texturePanel5.setSpacing(0.8f); texturePanel5.setBrightness(0.1f);
lensFlareTexture.getOrthoTransform().getTranslation().setX( light.getScreenSpacePosition().getX() + (sunToWindowCenter.getX() * lensFlareTexture.getSpacing()) - lensFlareTexture.getOrthoTransform().getScaling().getX()/2f); lensFlareTexture.getOrthoTransform().getTranslation().setY( light.getScreenSpacePosition().getY() + (sunToWindowCenter.getY() * lensFlareTexture.getSpacing()) - lensFlareTexture.getOrthoTransform().getScaling().getY()/2f); lensFlareTexture.setOrthographicMatrix( new Matrix4f().Orthographic2D().mul(lensFlareTexture.getOrthoTransform().getWorldMatrix()));
public void update() { super.update(); uniformBuffer.mapMemory(BufferUtil.createByteBuffer(getWorldTransform().getWorldMatrix())); }
VkContext.getDeviceManager().getPhysicalDevice(DeviceType.MAJOR_GRAPHICS_DEVICE).getMemoryProperties(); getWorldTransform().setTranslation(new Vec3f(-2,-1.4f,-2).normalize().mul(-2600)); Vec3f origin = new Vec3f(0,0,0); Vec3f[] array = new Vec3f[1]; pushConstants.put(BufferUtil.createByteBuffer(getWorldTransform().getWorldMatrix())); pushConstants.flip();
sceneGraph.getWorldTransform().setScaling(1,-1,1); sceneGraph.update(); sceneGraph.getRoot().record(offScreenReflectionRenderList); sceneGraph.getWorldTransform().setScaling(1,1,1); sceneGraph.update(); sceneGraph.getRoot().record(offScreenRefractionRenderList);
VkContext.getDeviceManager().getPhysicalDevice(DeviceType.MAJOR_GRAPHICS_DEVICE).getMemoryProperties(); getWorldTransform().setLocalScaling(Constants.ZFAR*0.5f, Constants.ZFAR*0.5f, Constants.ZFAR*0.5f); ubo.put(BufferUtil.createByteBuffer(getWorldTransform().getWorldMatrix())); ubo.flip();
public void updateUniforms(Renderable object) { bindUniformBlock("Camera", Constants.CameraUniformBlockBinding); setUniformi("isReflection", BaseContext.getConfig().isRenderReflection() ? 1 : 0); ((GLInstancedCluster) object.getParentNode()).getWorldMatricesBuffer().bindBufferBase(0); bindUniformBlock("worldMatrices", 0); ((GLInstancedCluster) object.getParentNode()).getModelMatricesBuffer().bindBufferBase(1); bindUniformBlock("modelMatrices", 1); setUniform("clipplane", BaseContext.getConfig().getClipplane()); setUniform("scalingMatrix", new Matrix4f().Scaling(object.getWorldTransform().getScaling())); List<Integer> indices = ((InstancedCluster) object.getParentNode()).getHighPolyIndices(); for (int i=0; i<indices.size(); i++) { setUniformi("matrixIndices[" + i +"]", indices.get(i)); } } }
pushConstants.put(BufferUtil.createByteBuffer(getLocalTransform().getWorldMatrix())); pushConstants.put(BufferUtil.createByteBuffer(getWorldTransform().getWorldMatrixRTS())); pushConstants.putFloat(terrainProperties.getVerticalScaling()); pushConstants.putFloat(terrainProperties.getHorizontalScaling());
public SkySphere() { Skydome top = new Skydome(); top.getWorldTransform().setLocalScaling(Constants.ZFAR*0.5f, Constants.ZFAR*0.5f, Constants.ZFAR*0.5f); Skydome bot = new Skydome(); bot.getWorldTransform().setLocalTranslation(0,-30,0); bot.getWorldTransform().setLocalScaling(Constants.ZFAR*0.5f, -Constants.ZFAR*0.5f, Constants.ZFAR*0.5f); addChild(top); addChild(bot); } }
public void update() { setCameraUnderwater(BaseContext.getCamera().getPosition().getY() < (getWorldTransform().getTranslation().getY())); }
public LensFlareTexturePanel() { super(); orthographicMatrix = new Matrix4f().Orthographic2D(); orthoTransform = new Transform(); setConfig(new AdditiveBlending()); setShader(LensFlareShader.getInstance()); }