private static Map.Entry<BaseShader.Uniform, BaseShader.Setter> getUniformSet(String name) { for (Map.Entry<BaseShader.Uniform, BaseShader.Setter> entry : UNIFORMS().entrySet()) { if(entry.getKey().alias.equals(name)) return entry; } return null; }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { if (com.a2client.Config.getInstance()._renderShadows) { shader.set(inputID, Render.toShadowMapSpace); } }
@Override protected Shader createShader (Renderable renderable) { if (config.vertexShader != null && config.fragmentShader != null && tempFolder != null && Gdx.app.getType() == ApplicationType.Desktop) { String prefix = DefaultShader.createPrefix(renderable, config); Gdx.files.absolute(tempFolder).child(name + ".vertex.glsl").writeString(prefix + config.vertexShader, false); Gdx.files.absolute(tempFolder).child(name + ".fragment.glsl").writeString(prefix + config.fragmentShader, false); } BaseShader result = new MultiPassShader(renderable, config); if (tempFolder != null && Gdx.app.getType() == ApplicationType.Desktop) Gdx.files.absolute(tempFolder).child(name + ".log.txt").writeString(result.program.getLog(), false); return result; }
private List<String> getDetectedUniformNames() { List<String> names = new ArrayList<>(); Map<BaseShader.Uniform, BaseShader.Setter> uniforms = ShaderUtils.detectUniforms(vertexShaderArea.getText(), fragmentShaderArea.getText()); uniforms.keySet().forEach(u -> names.add(u.alias)); return names; }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, Skybox.skyColor.r, Skybox.skyColor.g, Skybox.skyColor.b); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, Skybox.fogEnabled ? Skybox.fogDensity : 0f); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, Skybox.fogGradient); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, Render.clipNormal.x, Render.clipNormal.y, Render.clipNormal.z, Render.clipHeight); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, 6); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, com.a2client.Config.getInstance()._renderShadows ? ShadowBox.SHADOW_DISTANCE : -1f); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, Skybox.sunPosition); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, shader.camera.projection); }
@Override public boolean isGlobal(BaseShader shader, int inputID) { return true; }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, shader.camera.view); }
@Override public boolean isGlobal(BaseShader shader, int inputID) { return false; }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, shader.camera.position.x, shader.camera.position.y, shader.camera.position.z, 1.1881f / (shader.camera.far * shader.camera.far)); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, shader.camera.direction); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, shader.camera.up); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { if (combinedAttributes.has(Vector3Attribute.InvWavelength)) shader.set(inputID, ((Vector3Attribute) (combinedAttributes.get(Vector3Attribute.InvWavelength))).value); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, renderable.worldTransform); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, temp.set(shader.camera.view).mul(renderable.worldTransform)); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, temp.set(shader.camera.combined).mul(renderable.worldTransform)); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, tmpM.set(renderable.worldTransform).inv().transpose()); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, ((AtmosphereAttribute) (combinedAttributes.get(AtmosphereAttribute.Alpha))).value); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, ((AtmosphereAttribute) (combinedAttributes.get(AtmosphereAttribute.CameraHeight))).value); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, ((AtmosphereAttribute) (combinedAttributes.get(AtmosphereAttribute.CameraHeight2))).value); }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, ((AtmosphereAttribute) (combinedAttributes.get(AtmosphereAttribute.OuterRadius))).value); }