use of gaiasky.util.gdx.shader.Material in project gaiasky by langurmonkey.
the class StubModel method setTransparency.
public void setTransparency(float alpha) {
if (instance != null) {
int n = instance.materials.size;
for (int i = 0; i < n; i++) {
Material mat = instance.materials.get(i);
BlendingAttribute ba = null;
if (mat.has(BlendingAttribute.Type)) {
ba = (BlendingAttribute) mat.get(BlendingAttribute.Type);
} else {
ba = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
mat.set(ba);
}
ba.opacity = alpha;
}
}
}
use of gaiasky.util.gdx.shader.Material in project gaiasky by langurmonkey.
the class ModelComponent method setTransparency.
public void setTransparency(float alpha, int src, int dst) {
int n = instance.materials.size;
for (int i = 0; i < n; i++) {
Material mat = instance.materials.get(i);
BlendingAttribute ba;
if (mat.has(BlendingAttribute.Type)) {
ba = (BlendingAttribute) mat.get(BlendingAttribute.Type);
ba.destFunction = dst;
ba.sourceFunction = src;
} else {
ba = new BlendingAttribute(src, dst);
mat.set(ba);
}
ba.opacity = alpha;
}
}
use of gaiasky.util.gdx.shader.Material in project gaiasky by langurmonkey.
the class ModelComponent method addReflectionCubemapAttribute.
public void addReflectionCubemapAttribute(Array<Material> materials) {
for (Material mat : materials) {
if (mat.has(ColorAttribute.Reflection) || mat.has(TextureAttribute.Reflection)) {
MaterialComponent.reflectionCubemap.prepareCubemap(manager);
mat.set(new CubemapAttribute(CubemapAttribute.ReflectionCubemap, MaterialComponent.reflectionCubemap.cubemap));
}
}
}
use of gaiasky.util.gdx.shader.Material in project gaiasky by langurmonkey.
the class ModelComponent method setDepthTest.
public void setDepthTest(int func, boolean mask) {
if (instance != null) {
int n = instance.materials.size;
for (int i = 0; i < n; i++) {
Material mat = instance.materials.get(i);
DepthTestAttribute dta;
if (mat.has(DepthTestAttribute.Type)) {
dta = (DepthTestAttribute) mat.get(DepthTestAttribute.Type);
} else {
dta = new DepthTestAttribute();
mat.set(dta);
}
dta.depthFunc = func;
dta.depthMask = mask;
}
}
}
use of gaiasky.util.gdx.shader.Material in project gaiasky by langurmonkey.
the class ModelComponent method addColorToMat.
public void addColorToMat() {
if (cc != null && useColor) {
// Regular mesh, we use the color
int n = instance.materials.size;
for (int i = 0; i < n; i++) {
Material material = instance.materials.get(i);
if (material.get(TextureAttribute.Ambient) == null && material.get(TextureAttribute.Diffuse) == null) {
material.set(new ColorAttribute(ColorAttribute.Diffuse, cc[0], cc[1], cc[2], cc[3]));
material.set(new ColorAttribute(ColorAttribute.Ambient, cc[0], cc[1], cc[2], cc[3]));
if (!culling)
material.set(new IntAttribute(IntAttribute.CullFace, GL20.GL_NONE));
}
}
}
}
Aggregations