com.badlogic.gdx.graphics.g3d.attributes.IntAttribute Java Examples
The following examples show how to use
com.badlogic.gdx.graphics.g3d.attributes.IntAttribute.
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: ModelFactory.java From GdxDemo3D with Apache License 2.0 | 5 votes |
public static void createOutlineModel(Model model, Color outlineColor, float fattenAmount) { fatten(model, fattenAmount); for (Material m : model.materials) { m.clear(); m.set(new IntAttribute(IntAttribute.CullFace, Gdx.gl.GL_FRONT)); m.set(ColorAttribute.createDiffuse(outlineColor)); } }
Example #2
Source File: GLTFMaterialExporter.java From gdx-gltf with Apache License 2.0 | 4 votes |
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"; } } }