Java Code Examples for com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider

The following examples show how to use com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider. These examples are extracted from open source projects. 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 Project: GdxDemo3D   Source File: GameRenderer.java    License: Apache License 2.0 6 votes vote down vote up
public GameRenderer(Viewport viewport, Camera camera, GameEngine engine) {
	this.viewport = viewport;
	this.camera = camera;
	this.engine = engine;

	shapeRenderer = new MyShapeRenderer();
	shapeRenderer.setAutoShapeType(true);

	spriteBatch = new SpriteBatch();
	font = new BitmapFont();
	font.setColor(Color.WHITE);
	font.setUseIntegerPositions(false);
	font.getData().setScale(0.01f);
	shadowBatch = new ModelBatch(new DepthShaderProvider());

	ShaderProgram.pedantic = false;
	final String vertUber = Gdx.files.internal("shaders/uber.vert").readString();
	final String fragUber = Gdx.files.internal("shaders/uber.frag").readString();
	modelBatch = new ModelBatch(new DefaultShaderProvider(vertUber, fragUber) {
		@Override
		protected Shader createShader(final Renderable renderable) {
			return new UberShader(renderable, config);
		}
	});
}
 
Example 2
Source Project: gdx-gltf   Source File: SceneManager.java    License: Apache License 2.0 5 votes vote down vote up
public SceneManager(ShaderProvider shaderProvider, DepthShaderProvider depthShaderProvider, RenderableSorter renderableSorter)
{
	this.renderableSorter = renderableSorter;
	
	batch = new ModelBatch(shaderProvider, renderableSorter);
	
	depthBatch = new ModelBatch(depthShaderProvider);
	
	float lum = 1f;
	environment.set(new ColorAttribute(ColorAttribute.AmbientLight, lum, lum, lum, 1));
}
 
Example 3
public static void createBatchs() {
	Config modelConfigShader = new Config(Gdx.files.classpath(VERTEX_SHADER).readString(),
			Gdx.files.classpath(FRAGMENT_SHADER).readString());

	modelConfigShader.numBones = MAX_BONES;
	modelConfigShader.numDirectionalLights = 0;
	modelConfigShader.numPointLights = 0;
	modelConfigShader.numSpotLights = 0;

	modelBatch = new ModelBatch(new DefaultShaderProvider(modelConfigShader));

	shadowBatch = new ModelBatch(new DepthShaderProvider());
	floorBatch = new ModelBatch(new DefaultShaderProvider(Gdx.files.classpath(VERTEX_SHADER),
			Gdx.files.classpath(FLOOR_FRAGMENT_SHADER)));
}
 
Example 4
Source Project: gdx-gltf   Source File: PBRShaderProvider.java    License: Apache License 2.0 4 votes vote down vote up
public static DepthShaderProvider createDefaultDepth(int maxBones){
	DepthShader.Config config = createDefaultDepthConfig();
	config.numBones = maxBones;
	return createDefaultDepth(config);
}
 
Example 5
Source Project: gdx-gltf   Source File: PBRShaderProvider.java    License: Apache License 2.0 4 votes vote down vote up
public static DepthShaderProvider createDefaultDepth(DepthShader.Config config){
	return new PBRDepthShaderProvider(config);
}
 
Example 6
Source Project: gdx-gltf   Source File: SceneManager.java    License: Apache License 2.0 4 votes vote down vote up
public SceneManager(ShaderProvider shaderProvider, DepthShaderProvider depthShaderProvider)
{
	this(shaderProvider, depthShaderProvider, new SceneRenderableSorter());
}