@Override public void render(final Renderable renderable, final Attributes combinedAttributes) { boolean firstCall = true; for(final LightWrapper light : lights) { light.applyToShader(program); if(firstCall){ context.setDepthTest(GL20.GL_LEQUAL); context.setBlending(false, GL20.GL_ONE, GL20.GL_ONE); super.render(renderable, combinedAttributes); firstCall = false; }else{ context.setDepthTest(GL20.GL_EQUAL); context.setBlending(true, GL20.GL_ONE, GL20.GL_ONE); renderable.meshPart.render(program, false); } } }
@Override public void render(final Renderable renderable, final Attributes combinedAttributes) { renderable.meshPart.primitiveType = GL20.GL_TRIANGLES; final boolean[] firstCall = {true}; lights.forEach(l -> { l.applyToShader(program); if(Gdx.input.isKeyJustPressed(Input.Keys.L)) for (String s : program.getUniforms()) { System.out.println(s); } if(true) { context.setDepthTest(GL20.GL_LEQUAL); context.setBlending(false, GL20.GL_ONE, GL20.GL_ONE); super.render(renderable, combinedAttributes); firstCall[0] = false; }else{ context.setDepthTest(GL20.GL_EQUAL); context.setBlending(true, GL20.GL_ONE, GL20.GL_ONE); MeshPart part = renderable.meshPart; part.mesh.render(program, part.primitiveType, part.offset, part.size, false); } }); }
@Override public void render(Renderable renderable, Attributes combinedAttributes) { // context.setCullFace(GL_BACK); // Classic depth test context.setDepthTest(GL20.GL_LEQUAL); // Deactivate blending on first pass context.setBlending(false, GL20.GL_ONE, GL20.GL_ONE); context.setDepthMask(true); if (!combinedAttributes.has(BlendingAttribute.Type)) context.setBlending(false, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); super.render(renderable, combinedAttributes); // program.begin(); // super.render(renderable, combinedAttributes); // program.end(); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { if (renderable.environment == null) shader.program.setUniform3fv(shader.loc(inputID), ones, 0, ones.length); else { renderable.worldTransform.getTranslation(tmpV1); if (renderable.environment.has(ColorAttribute.AmbientLight)) cacheAmbientCubemap.set(((ColorAttribute)renderable.environment.get(ColorAttribute.AmbientLight)).color); for (int i = dirLightsOffset; i < renderable.environment.directionalLights.size; i++) cacheAmbientCubemap.add(renderable.environment.directionalLights.get(i).color, renderable.environment.directionalLights.get(i).direction); for (int i = pointLightsOffset; i < renderable.environment.pointLights.size; i++) cacheAmbientCubemap.add(renderable.environment.pointLights.get(i).color, renderable.environment.pointLights.get(i).position, tmpV1, renderable.environment.pointLights.get(i).intensity); cacheAmbientCubemap.clamp(); shader.program.setUniform3fv(shader.loc(inputID), cacheAmbientCubemap.data, 0, cacheAmbientCubemap.data.length); } }
@Override public void render(final Renderable renderable, final Attributes combinedAttributes) { try{ super.render(renderable, combinedAttributes); }catch (NullPointerException npe) { } }
@Override public void render(final Renderable renderable, final Attributes combinedAttributes) { renderable.meshPart.primitiveType = info.primitive.id; try { super.render(renderable, combinedAttributes); }catch (Exception e) { e.printStackTrace(); } }
@Override public void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { if (com.a2client.Config.getInstance()._renderShadows) { shader.set(inputID, Render.toShadowMapSpace); } }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { for (int i = 0; i < bones.length; i++) { final int idx = i / 16; bones[i] = (renderable.bones == null || idx >= renderable.bones.length || renderable.bones[idx] == null) ? idtMatrix.val[i % 16] : renderable.bones[idx].val[i % 16]; } shader.program.setUniformMatrix4fv(shader.loc(inputID), bones, 0, bones.length); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { if (combinedAttributes.has(CubemapAttribute.EnvironmentMap)) { shader.set(inputID, shader.context.textureBinder.bind(((CubemapAttribute)combinedAttributes .get(CubemapAttribute.EnvironmentMap)).textureDescription)); } }
public void render (Renderable renderable, final Attributes combinedAttributes) { for (int u, i = 0; i < localUniforms.size; ++i) if (setters.get(u = localUniforms.get(i)) != null) setters.get(u).set(this, u, renderable, combinedAttributes); if (currentMesh != renderable.mesh) { if (currentMesh != null) currentMesh.unbind(program, tempArray.items); currentMesh = renderable.mesh; currentMesh.bind(program, getAttributeLocations(renderable.mesh.getVertexAttributes())); } renderable.mesh.render(program, renderable.primitiveType, renderable.meshPartOffset, renderable.meshPartSize, false); }
@Override public void render(final Renderable renderable, final Attributes combinedAttributes) { super.render(renderable, combinedAttributes); }
@Override public void render(Renderable renderable, Attributes combinedAttributes) { setPrimitiveType(renderable); super.render(renderable, combinedAttributes); restorePrimitiveType(renderable); }
@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 void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, shader.camera.view); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, shader.camera.combined); }
@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) { 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, ((FloatAttribute)(combinedAttributes.get(FloatAttribute.Shininess))).value); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, ((ColorAttribute)(combinedAttributes.get(ColorAttribute.Diffuse))).color); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { final int unit = shader.context.textureBinder.bind(((TextureAttribute)(combinedAttributes .get(TextureAttribute.Diffuse))).textureDescription); shader.set(inputID, unit); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { final TextureAttribute ta = (TextureAttribute)(combinedAttributes.get(TextureAttribute.Diffuse)); shader.set(inputID, ta.offsetU, ta.offsetV, ta.scaleU, ta.scaleV); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, ((ColorAttribute)(combinedAttributes.get(ColorAttribute.Specular))).color); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { final int unit = shader.context.textureBinder.bind(((TextureAttribute)(combinedAttributes .get(TextureAttribute.Specular))).textureDescription); shader.set(inputID, unit); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { final TextureAttribute ta = (TextureAttribute)(combinedAttributes.get(TextureAttribute.Specular)); shader.set(inputID, ta.offsetU, ta.offsetV, ta.scaleU, ta.scaleV); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { shader.set(inputID, ((ColorAttribute)(combinedAttributes.get(ColorAttribute.Emissive))).color); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { final int unit = shader.context.textureBinder.bind(((TextureAttribute)(combinedAttributes .get(TextureAttribute.Emissive))).textureDescription); shader.set(inputID, unit); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { final TextureAttribute ta = (TextureAttribute)(combinedAttributes.get(TextureAttribute.Emissive)); shader.set(inputID, ta.offsetU, ta.offsetV, ta.scaleU, ta.scaleV); }