com.badlogic.gdx.graphics.g3d.shaders.BaseShader Java Examples

The following examples show how to use com.badlogic.gdx.graphics.g3d.shaders.BaseShader. 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: PBRShader.java    From gdx-gltf with Apache License 2.0 5 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	ColorAttribute attribute = combinedAttributes.get(ColorAttribute.class, PBRColorAttribute.BaseColorFactor);
	Color color = attribute == null ? Color.WHITE : attribute.color;
	shader.set(inputID, color);
}
 
Example #2
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 5 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	PBRFloatAttribute metallicAttribute = combinedAttributes.get(PBRFloatAttribute.class, PBRFloatAttribute.Metallic);
	PBRFloatAttribute roughnessAttribute = combinedAttributes.get(PBRFloatAttribute.class, PBRFloatAttribute.Roughness);
	float metallic = metallicAttribute == null ? 1f : metallicAttribute.value;
	float roughness = roughnessAttribute == null ? 1f : roughnessAttribute.value;
	shader.set(inputID, v2.set(metallic, roughness));
}
 
Example #3
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 5 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	PBRTextureAttribute attribute = combinedAttributes.get(PBRTextureAttribute.class, PBRTextureAttribute.BRDFLUTTexture);
	if(attribute != null){
		final int unit = shader.context.textureBinder.bind(attribute.textureDescription);
		shader.set(inputID, unit);
	}
}
 
Example #4
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	final int unit = shader.context.textureBinder.bind(((TextureAttribute)(combinedAttributes
		.get(PBRTextureAttribute.BaseColorTexture))).textureDescription);
	shader.set(inputID, unit);
}
 
Example #5
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	final int unit = shader.context.textureBinder.bind(((TextureAttribute)(combinedAttributes
		.get(PBRTextureAttribute.EmissiveTexture))).textureDescription);
	shader.set(inputID, unit);
}
 
Example #6
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	final int unit = shader.context.textureBinder.bind(((TextureAttribute)(combinedAttributes
		.get(PBRTextureAttribute.NormalTexture))).textureDescription);
	shader.set(inputID, unit);
}
 
Example #7
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	final int unit = shader.context.textureBinder.bind(((TextureAttribute)(combinedAttributes
		.get(PBRTextureAttribute.MetallicRoughnessTexture))).textureDescription);
	shader.set(inputID, unit);
}
 
Example #8
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	PBRFloatAttribute normalScaleAttribute = combinedAttributes.get(PBRFloatAttribute.class, PBRFloatAttribute.NormalScale);
	float normalScale = normalScaleAttribute == null ? 1f : normalScaleAttribute.value;
	shader.set(inputID, normalScale);
}
 
Example #9
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	PBRFloatAttribute occlusionStrengthAttribute = combinedAttributes.get(PBRFloatAttribute.class, PBRFloatAttribute.OcclusionStrength);
	float occlusionStrength = occlusionStrengthAttribute == null ? 1f : occlusionStrengthAttribute.value;
	shader.set(inputID, occlusionStrength);
}
 
Example #10
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	final int unit = shader.context.textureBinder.bind(((TextureAttribute)(combinedAttributes
		.get(PBRTextureAttribute.OcclusionTexture))).textureDescription);
	shader.set(inputID, unit);
}
 
Example #11
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	PBRCubemapAttribute diffuseEnvAttribute = combinedAttributes.get(PBRCubemapAttribute.class, PBRCubemapAttribute.DiffuseEnv);
	final int unit = shader.context.textureBinder.bind(diffuseEnvAttribute.textureDescription);
	shader.set(inputID, unit);
}
 
Example #12
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	PBRCubemapAttribute specularEnvAttribute = combinedAttributes.get(PBRCubemapAttribute.class, PBRCubemapAttribute.SpecularEnv);
	final int unit = shader.context.textureBinder.bind(specularEnvAttribute.textureDescription);
	shader.set(inputID, unit);
}
 
Example #13
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	PBRFloatAttribute attribute = combinedAttributes.get(PBRFloatAttribute.class, PBRFloatAttribute.ShadowBias);
	float value = attribute == null ? 0f : attribute.value;
	shader.set(inputID, value);
}
 
Example #14
Source File: PBRShader.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	FogAttribute attribute = combinedAttributes.get(FogAttribute.class, FogAttribute.FogEquation);
	Vector3 value = attribute == null ? Vector3.Zero : attribute.value;
	shader.set(inputID, value);
}