com.badlogic.gdx.graphics.g3d.utils.RenderContext Java Examples

The following examples show how to use com.badlogic.gdx.graphics.g3d.utils.RenderContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Renderer.java    From VuforiaLibGDX with MIT License 6 votes vote down vote up
public Renderer() {

        lights = new Environment();
        lights.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE));

        camera = new PerspectiveCamera(60, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        camera.near = 1.0F;
        camera.far = 1000.0F;
        //set camera into "Vuforia - style" direction
        camera.position.set(new Vector3(0,0,0));
        camera.lookAt(new Vector3(0,0,1));

        IntBuffer buffer = BufferUtils.newIntBuffer(16);
        Gdx.gl.glGetIntegerv(GL20.GL_MAX_TEXTURE_IMAGE_UNITS, buffer);
        int units = buffer.get(0);
        Log.d("TAG", "Max texture units: "+units);
        modelBatch = new ModelBatch(new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 0)));
    }
 
Example #2
Source File: SkyboxShader.java    From Mundus with Apache License 2.0 5 votes vote down vote up
@Override
public void begin(Camera camera, RenderContext context) {
    this.context = context;
    context.begin();
    program.begin();

    set(UNIFORM_PROJ_VIEW_MATRIX, camera.combined);
    transform.idt();
    transform.translate(camera.position);
    set(UNIFORM_TRANS_MATRIX, transform);
}
 
Example #3
Source File: TerrainShader.java    From Mundus with Apache License 2.0 5 votes vote down vote up
@Override
public void begin(Camera camera, RenderContext context) {
    this.context = context;
    context.begin();
    context.setCullFace(GL20.GL_BACK);

    this.context.setDepthTest(GL20.GL_LEQUAL, 0f, 1f);
    this.context.setDepthMask(true);

    program.begin();

    set(UNIFORM_PROJ_VIEW_MATRIX, camera.combined);
    set(UNIFORM_CAM_POS, camera.position);
}
 
Example #4
Source File: ModelShader.java    From Mundus with Apache License 2.0 5 votes vote down vote up
@Override
public void begin(Camera camera, RenderContext context) {
    this.context = context;
    context.begin();

    this.context.setCullFace(GL20.GL_BACK);
    this.context.setDepthTest(GL20.GL_LEQUAL, 0f, 1f);
    this.context.setDepthMask(true);

    program.begin();

    set(UNIFORM_PROJ_VIEW_MATRIX, camera.combined);
    set(UNIFORM_CAM_POS, camera.position);
}
 
Example #5
Source File: PickerShader.java    From Mundus with Apache License 2.0 5 votes vote down vote up
@Override
public void begin(Camera camera, RenderContext context) {
    this.context = context;
    this.context.setCullFace(GL20.GL_BACK);
    this.context.setDepthTest(GL20.GL_LEQUAL, 0f, 1f);
    this.context.setDepthMask(true);

    program.begin();

    set(UNIFORM_PROJ_VIEW_MATRIX, camera.combined);
}
 
Example #6
Source File: CubesShaderProvider.java    From Cubes with MIT License 5 votes vote down vote up
@Override
public void begin(Camera camera, RenderContext context) {
  super.begin(camera, context);
  if (Cubes.getClient() == null) {
    program.setUniformf(u_sunlight, 1f);
  } else {
    program.setUniformf(u_sunlight, Cubes.getClient().world.getWorldSunlight());
  }
  program.setUniformf(u_lightoverride, -1f);
}
 
Example #7
Source File: CubesShaderProvider.java    From Cubes with MIT License 5 votes vote down vote up
@Override
public void begin(Camera camera, RenderContext context) {
  super.begin(camera, context);
  for (Feature feature : features) {
    feature.begin(program, camera, context);
  }
}
 
Example #8
Source File: CubesShaderProvider.java    From Cubes with MIT License 5 votes vote down vote up
@Override
public void begin(ShaderProgram program, Camera camera, RenderContext context) {
  WorldClient worldClient = ((WorldClient) Cubes.getClient().world);
  float distance = Settings.getIntegerSettingValue(Settings.GRAPHICS_VIEW_DISTANCE) * Area.SIZE_BLOCKS;
  float fogDistance = MathUtils.clamp(distance * 0.1f, 8f, 16f);

  program.setUniformf(u_cameraposition, Cubes.getClient().player.position);
  program.setUniformf(u_skycolor, worldClient.getSkyColour());
  program.setUniformf(u_fogdistance, fogDistance);
  program.setUniformf(u_minfogdistance, distance - fogDistance);
}
 
Example #9
Source File: CubesShaderProvider.java    From Cubes with MIT License 5 votes vote down vote up
@Override
public void begin(ShaderProgram program, Camera camera, RenderContext context) {
  TextureAttribute textureAttribute = AmbientOcclusion.getTextureAttribute();

  ao_unit = context.textureBinder.bind(textureAttribute.textureDescription);
  program.setUniformi(u_aoTexture, ao_unit);
  program.setUniformf(u_aoUVTransform, textureAttribute.offsetU, textureAttribute.offsetV, textureAttribute.scaleU, textureAttribute.scaleV);
  program.setUniformf(u_aoStrength, AmbientOcclusion.getStrength().strength);
}
 
Example #10
Source File: UberShader.java    From GdxDemo3D with Apache License 2.0 4 votes vote down vote up
@Override
public void begin(final Camera camera, final RenderContext context) {
	super.begin(camera, context);
	context.setDepthTest(GL20.GL_LEQUAL);
	program.begin();
}
 
Example #11
Source File: CubesShaderProvider.java    From Cubes with MIT License votes vote down vote up
void begin(ShaderProgram program, Camera camera, RenderContext context);