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); }
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(); }
float cw = BaseContext.getCamera().getProjectionMatrix().get(3,2) / (ndc.getZ() - BaseContext.getCamera().getProjectionMatrix().get(2,2)); 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()); pos.setX(worldPos.getX()); pos.setY(worldPos.getY()); pos.setZ(worldPos.getZ());
@SuppressWarnings("restriction") @Override public void init(VkImageView imageView, LongBuffer waitSemaphores) { super.init(imageView, waitSemaphores); bean = (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); UIScreen screen0 = new UIScreen(); screen0.getElements().add(new VkColorPanel(new Vec4f(0,0,0,0.5f), 0, 215, 325, 225, panelMeshBuffer, guiOverlayFbo)); screen0.getElements().add(new VkStaticTextPanel("FPS:", 20, 45, 40, 40, fontsImageBundle.getImageView(), fontsImageBundle.getSampler(), guiOverlayFbo)); screen0.getElements().add(new VkStaticTextPanel("CPU:", 20, 90, 40, 40, fontsImageBundle.getImageView(), fontsImageBundle.getSampler(), guiOverlayFbo)); screen0.getElements().add(new VkDynamicTextPanel("000", 120, 45, 40, 40, fontsImageBundle.getImageView(), fontsImageBundle.getSampler(), guiOverlayFbo)); screen0.getElements().add(new VkDynamicTextPanel("000", 120, 90, 40, 40, fontsImageBundle.getImageView(), fontsImageBundle.getSampler(), guiOverlayFbo)); screen0.getElements().add(new VkTexturePanel("textures/logo/Vulkan_Logo.png", 0, 220, 310, 130, panelMeshBuffer, guiOverlayFbo)); getScreens().add(screen0); }
GLTerrain.getConfiguration().getScaleY() * -1f); GLTerrain.getConfiguration().setWaterReflectionShift( (int) (getClipplane().getW() * 2f));
@SuppressWarnings("restriction") public void init() { super.init(); bean = (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); UIScreen screen0 = new UIScreen(); screen0.getElements().add(new GLColorPanel(new Vec4f(0,0,0,0.5f), 0, BaseContext.getConfig().getWindowHeight()-245, 355, 250, panelMeshBuffer)); screen0.getElements().add(new GLStaticTextPanel("FPS:", 10, BaseContext.getConfig().getWindowHeight()-40, 40, 40, fontsTexture)); screen0.getElements().add(new GLStaticTextPanel("CPU:", 10, BaseContext.getConfig().getWindowHeight()-80, 40, 40, fontsTexture)); screen0.getElements().add(new GLDynamicTextPanel("000", 110, BaseContext.getConfig().getWindowHeight()-40, 40, 40, fontsTexture)); screen0.getElements().add(new GLDynamicTextPanel("000", 110, BaseContext.getConfig().getWindowHeight()-80, 40, 40, fontsTexture)); screen0.getElements().add(new GLTexturePanel("textures/logo/OpenGL_Logo.png", 0, BaseContext.getConfig().getWindowHeight()-240, 360, 160, panelMeshBuffer)); getScreens().add(screen0); }
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())); }
clipplane = new Vec4f(0,-1,0,getWorldTransform().getTranslation().getY() + clip_offset);