protected void computeWorldPos(){ Vec2f chunkCenter = location.add(gap/2f); Vec4f worldPosition = getWorldTransform().getWorldMatrixRTS().mul( new Vec4f(chunkCenter.getX(),0,chunkCenter.getY(),1)); worldPosition = worldPosition.normalize(); worldPosition = worldPosition.mul(terrainProperties.getHorizontalScaling()); // TODO displacment // Vec3f displacement = TerrainHelper.getTerrainHeight(terrainProperties, loc.getX(), loc.getY()); // System.out.println(worldPosition); worldPos = worldPosition.xyz(); }
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 GLButton(int xPos, int yPos, int xScaling, int yScaling, Mesh panelMesh){ super(xPos, yPos, xScaling, yScaling); pos = new Vec2f[4]; shader = UITextPanelShader.getInstance(); vao = new GUIVAO(); config = new DefaultRenderParams(); vao.addData(panelMesh); Vec4f q0 = new Vec4f(0,0,0,0); Vec4f q1 = new Vec4f(0,0,0,0); Vec4f q2 = new Vec4f(0,0,0,0); Vec4f q3 = new Vec4f(0,0,0,0); q0 = getWorldTransform().getWorldMatrix().mul(new Vec4f(panelMesh.getVertices()[0].getPosition(),1)); q1 = getWorldTransform().getWorldMatrix().mul(new Vec4f(panelMesh.getVertices()[1].getPosition(),1)); q2 = getWorldTransform().getWorldMatrix().mul(new Vec4f(panelMesh.getVertices()[2].getPosition(),1)); q3 = getWorldTransform().getWorldMatrix().mul(new Vec4f(panelMesh.getVertices()[3].getPosition(),1)); pos[0] = new Vec2f(q0.getX(),q0.getY()+5); pos[1] = new Vec2f(q1.getX(),q1.getY()+5); pos[2] = new Vec2f(q2.getX()-7,q2.getY()-5); pos[3] = new Vec2f(q3.getX()-7,q3.getY()-5); }
texturePanel0.setTexture(new Texture2DBilinearFilter("textures/lens_flare/tex4.png")); texturePanel0.getOrthoTransform().setScaling(200,200,0); texturePanel0.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel0.getOrthoTransform().getWorldMatrix())); texturePanel0.setSpacing(0.06f); texturePanel0.setBrightness(0.2f); texturePanel1.setTexture(new Texture2DBilinearFilter("textures/lens_flare/tex01.png")); texturePanel1.getOrthoTransform().setScaling(400,400,0); texturePanel1.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel1.getOrthoTransform().getWorldMatrix())); texturePanel1.setSpacing(0.0f); texturePanel1.setBrightness(0.4f); texturePanel2.setTexture(new Texture2DBilinearFilter("textures/lens_flare/tex2.png")); texturePanel2.getOrthoTransform().setScaling(250,250,0); texturePanel2.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel2.getOrthoTransform().getWorldMatrix())); texturePanel2.setSpacing(0.2f); texturePanel2.setBrightness(0.25f); texturePanel3.setTexture(new Texture2DBilinearFilter("textures/lens_flare/tex7.png")); texturePanel3.getOrthoTransform().setScaling(200,200,0); texturePanel3.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel3.getOrthoTransform().getWorldMatrix())); texturePanel3.setSpacing(0.4f); texturePanel3.setBrightness(0.2f); texturePanel4.setTexture(new Texture2DBilinearFilter("textures/lens_flare/tex5.png")); texturePanel4.getOrthoTransform().setScaling(100,100,0); texturePanel4.setOrthographicMatrix(new Matrix4f().Orthographic2D().mul(texturePanel4.getOrthoTransform().getWorldMatrix())); texturePanel4.setSpacing(0.6f); texturePanel4.setBrightness(0.2f);
Vec3f clip = ndc.mul(cw); Vec4f clipPos = new Vec4f(clip.getX(),clip.getY(),clip.getZ(),cw); Vec4f worldPos = BaseContext.getCamera().getViewProjectionMatrix().invert().mul(clipPos); worldPos = worldPos.div(worldPos.getW());
- lensFlareTexture.getOrthoTransform().getScaling().getY()/2f); lensFlareTexture.setOrthographicMatrix( new Matrix4f().Orthographic2D().mul(lensFlareTexture.getOrthoTransform().getWorldMatrix()));