public void updateUniforms(int windowWidth, int windowHeight, Matrix4f viewProjectionMatrix) { setUniformf("windowWidth", windowWidth); setUniformf("windowHeight", windowHeight); setUniform("viewProjectionMatrix", viewProjectionMatrix); setUniform("sunWorldPosition", GLDirectionalLight.getInstance().getDirection().mul(-2800)); } }
public Sun(){ getWorldTransform().setLocalTranslation(GLDirectionalLight.getInstance().getDirection().mul(-2600)); Vec3f origin = new Vec3f(0,0,0); Vec3f[] array = new Vec3f[1]; array[0] = origin; GLPointVBO3D buffer = new GLPointVBO3D(); buffer.addData(array); Material<GLTexture> material1 = new Material<GLTexture>(); material1.setDiffusemap(new Texture2DTrilinearFilter("textures/sun/sun.png")); Material<GLTexture> material2 = new Material<GLTexture>(); material2.setDiffusemap(new Texture2DTrilinearFilter("textures/sun/sun_small1.png")); GLRenderInfo renderInfo = new GLRenderInfo(SunShader.getInstance(), new AlphaBlendingSrcAlpha(), buffer); addComponent(NodeComponentType.MAIN_RENDERINFO, renderInfo); addComponent(NodeComponentType.MATERIAL0, material1); addComponent(NodeComponentType.MATERIAL1, material2); Light light = new Light(); light.setOcclusionQuery(new GLOcclusionQuery()); addComponent(NodeComponentType.LIGHT, light); LightHandler.getLights().add(light); }
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];
Vec3f clip = ndc.mul(cw); Vec4f clipPos = new Vec4f(clip.getX(),clip.getY(),clip.getZ(),cw); Vec4f worldPos = BaseContext.getCamera().getViewProjectionMatrix().invert().mul(clipPos);
vertex.setPosition(vertex.getPosition().mul(135)); vertex.getPosition().setX(vertex.getPosition().getX()*1.1f); vertex.getPosition().setZ(vertex.getPosition().getZ()*1.1f);
vertex.setPosition(vertex.getPosition().mul(7.4f)); vertex.getPosition().setX(vertex.getPosition().getX()*1f); vertex.getPosition().setZ(vertex.getPosition().getZ()*1f);
vertex.setPosition(vertex.getPosition().mul(2.4f)); vertex.getPosition().setX(vertex.getPosition().getX()*1f); vertex.getPosition().setZ(vertex.getPosition().getZ()*1f);