com.badlogic.gdx.graphics.g3d.Attribute Java Examples

The following examples show how to use com.badlogic.gdx.graphics.g3d.Attribute. 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: SceneManager.java    From gdx-gltf with Apache License 2.0 6 votes vote down vote up
protected void updateEnvironment(){
	computedEnvironement.setCache(environment);
	pointLights.lights.clear();
	spotLights.lights.clear();
	if(environment != null) {
		for(Attribute a : environment){
			if(a instanceof PointLightsAttribute){
				pointLights.lights.addAll(((PointLightsAttribute) a).lights);
				computedEnvironement.replaceCache(pointLights);
			}else if(a instanceof SpotLightsAttribute){
				spotLights.lights.addAll(((SpotLightsAttribute) a).lights);
				computedEnvironement.replaceCache(spotLights);
			}else{
				computedEnvironement.set(a);
			}
		}
	}
	cullLights();
}
 
Example #2
Source File: EnvironmentCache.java    From gdx-gltf with Apache License 2.0 5 votes vote down vote up
/**
 * fast way to copy only references
 * @param env
 */
public void setCache(Environment env){
	this.mask = env.getMask();
	this.attributes.clear();
	for(Attribute a : env) this.attributes.add(a);
	this.shadowMap  = env.shadowMap;
	this.sorted = true;
}
 
Example #3
Source File: FogAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public Attribute copy () {
	return new FogAttribute(type).set(value);
}
 
Example #4
Source File: PickerIDAttribute.java    From Mundus with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(Attribute o) {
    return -1; // FIXME implement comparing
}
 
Example #5
Source File: DirectionalLightsAttribute.java    From Mundus with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(Attribute o) {
    if (type != o.type) return type < o.type ? -1 : 1;
    return 0; // FIXME implement comparing
}
 
Example #6
Source File: SunLightsAttribute.java    From Mundus with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(Attribute o) {
    if (type != o.type) return type < o.type ? -1 : 1;
    return 0; // FIXME implement comparing
}
 
Example #7
Source File: TerrainTextureAttribute.java    From Mundus with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(Attribute o) {
    if (type != o.type) return type < o.type ? -1 : 1;
    TerrainTexture otherValue = ((TerrainTextureAttribute) o).terrainTexture;
    return terrainTexture.equals(otherValue) ? 0 : -1;
}
 
Example #8
Source File: TerrainTextureAttribute.java    From Mundus with Apache License 2.0 4 votes vote down vote up
@Override
public Attribute copy() {
    return new TerrainTextureAttribute(this);
}
 
Example #9
Source File: GLTFMaterialExporter.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
private void export(Material material) {
	if(base.materialMapping.contains(material, true)) return;
	base.materialMapping.add(material);
	
	GLTFMaterial m = new GLTFMaterial();
	if(base.root.materials == null) base.root.materials = new Array<GLTFMaterial>();
	base.root.materials.add(m);
	

	m.name = material.id;
	
	boolean blending = false;
	for(Attribute a : material){
		if(a.type == ColorAttribute.Diffuse){
			pbr(m).baseColorFactor = GLTFExportTypes.rgba(defaultNull(Color.WHITE, (ColorAttribute)a));
		}
		else if(a.type == PBRColorAttribute.BaseColorFactor){
			pbr(m).baseColorFactor = GLTFExportTypes.rgba(defaultNull(Color.WHITE, (PBRColorAttribute)a));
		}
		else if(a.type == ColorAttribute.Emissive){
			m.emissiveFactor = GLTFExportTypes.rgb(defaultNull(Color.BLACK, (ColorAttribute)a));
		}
		else if(a.type == BlendingAttribute.Type){
			blending = true;
		}
		else if(a.type == IntAttribute.CullFace){
			m.doubleSided = defaultNull(true, ((IntAttribute)a).value == 0);
		}
		else if(a.type == FloatAttribute.AlphaTest){
			m.alphaCutoff = ((FloatAttribute)a).value;
		}
		else if(a.type == PBRFloatAttribute.Metallic){
			pbr(m).metallicFactor = ((PBRFloatAttribute)a).value;
		}
		else if(a.type == PBRFloatAttribute.Roughness){
			pbr(m).roughnessFactor = ((PBRFloatAttribute)a).value;
		}
		else if(a.type == PBRTextureAttribute.BaseColorTexture){
			pbr(m).baseColorTexture = texture((PBRTextureAttribute)a);
		}
		else if(a.type == PBRTextureAttribute.MetallicRoughnessTexture){
			pbr(m).metallicRoughnessTexture = texture((PBRTextureAttribute)a);
		}
		else if(a.type == PBRTextureAttribute.EmissiveTexture){
			m.emissiveTexture = texture((PBRTextureAttribute)a);
		}
		else if(a.type == PBRTextureAttribute.NormalTexture){
			m.normalTexture = normalTexture((PBRTextureAttribute)a, material);
		}
		else if(a.type == PBRTextureAttribute.OcclusionTexture){
			m.occlusionTexture = occlusionTexture((PBRTextureAttribute)a, material);
		}
	}
	if(blending){
		if(m.alphaCutoff != null){
			m.alphaMode = "MASK";
		}else{
			m.alphaMode = "BLEND";
		}
	}
}
 
Example #10
Source File: PBRCubemapAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public Attribute copy() {
	return new PBRCubemapAttribute(type, textureDescription);
}
 
Example #11
Source File: PBRCubemapAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
public static Attribute createSpecularEnv(Cubemap specularCubemap) {
	return new PBRCubemapAttribute(SpecularEnv, specularCubemap);
}
 
Example #12
Source File: PBRCubemapAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
public static Attribute createDiffuseEnv(Cubemap diffuseCubemap) {
	return new PBRCubemapAttribute(DiffuseEnv, diffuseCubemap);
}
 
Example #13
Source File: FogAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo (Attribute o) {
	return (int)(type - o.type);
}
 
Example #14
Source File: FogAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
public Attribute set(Vector3 value) {
	this.value.set(value);
	return this;
}
 
Example #15
Source File: PBRTextureAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public Attribute copy() {
	return new PBRTextureAttribute(this);
}
 
Example #16
Source File: PBRFloatAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
public static Attribute createOcclusionStrength(float value) {
	return new PBRFloatAttribute(OcclusionStrength, value);
}
 
Example #17
Source File: PBRFloatAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
public static Attribute createNormalScale(float value) {
	return new PBRFloatAttribute(NormalScale, value);
}
 
Example #18
Source File: PBRFloatAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
public static Attribute createRoughness(float value) {
	return new PBRFloatAttribute(Roughness, value);
}
 
Example #19
Source File: PBRFloatAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
public static Attribute createMetallic(float value) {
	return new PBRFloatAttribute(Metallic, value);
}
 
Example #20
Source File: PBRFloatAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public Attribute copy () {
	return new PBRFloatAttribute(type, value);
}
 
Example #21
Source File: PBRColorAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public Attribute copy() {
	return new PBRColorAttribute(type, color);
}
 
Example #22
Source File: PBRFlagAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo (Attribute o) {
	return (int)(type - o.type);
}
 
Example #23
Source File: PBRFlagAttribute.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public Attribute copy () {
	return new PBRFlagAttribute(type);
}
 
Example #24
Source File: EnvironmentCache.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
/**
 * fast way to replace an attribute without sorting
 * @param attribute
 */
public void replaceCache(Attribute attribute) {
	final int idx = indexOf(attribute.type);
	this.attributes.set(idx, attribute);
}