use of gaiasky.util.gdx.shader.Environment in project gaiasky by langurmonkey.
the class ShapeObject method initModel.
public void initModel() {
this.localTransform = new Matrix4();
if (model == null) {
Pair<IntModel, Map<String, Material>> m = ModelCache.cache.getModel(modelShape, modelParams, Bits.indexes(Usage.Position), primitiveType);
model = m.getFirst();
for (Map.Entry<String, Material> material : m.getSecond().entrySet()) {
material.getValue().set(new BlendingAttribute(GL20.GL_ONE, GL20.GL_ONE));
material.getValue().set(new ColorAttribute(ColorAttribute.Diffuse, cc[0], cc[1], cc[2], cc[3]));
}
mc = new ModelComponent(false);
mc.initialize(null);
DirectionalLight dLight = new DirectionalLight();
dLight.set(1, 1, 1, 1, 1, 1);
mc.env = new Environment();
mc.env.add(dLight);
mc.env.set(new ColorAttribute(ColorAttribute.AmbientLight, 1.0f, 1.0f, 1.0f, 1f));
mc.env.set(new FloatAttribute(FloatAttribute.Shininess, 0.2f));
mc.instance = new IntModelInstance(model, new Matrix4());
// Relativistic effects
if (Settings.settings.runtime.relativisticAberration)
mc.rec.setUpRelativisticEffectsMaterial(mc.instance.materials);
// Gravitational waves
if (Settings.settings.runtime.gravitationalWaves)
mc.rec.setUpGravitationalWavesMaterial(mc.instance.materials);
}
}
Aggregations