use of gaiasky.util.gdx.IntModelBuilder in project gaiasky by langurmonkey.
the class StarCluster method initModel.
public void initModel() {
if (clusterTex == null) {
clusterTex = new Texture(Settings.settings.data.dataFileHandle("data/tex/base/cluster-tex.png"), true);
clusterTex.setFilter(TextureFilter.MipMapLinearNearest, TextureFilter.Linear);
}
if (model == null) {
Material mat = new Material(new BlendingAttribute(GL20.GL_ONE, GL20.GL_ONE), new ColorAttribute(ColorAttribute.Diffuse, cc[0], cc[1], cc[2], cc[3]));
IntModelBuilder modelBuilder = ModelCache.cache.mb;
modelBuilder.begin();
// create part
IntMeshPartBuilder bPartBuilder = modelBuilder.part("sph", GL20.GL_LINES, Bits.indexes(Usage.Position), mat);
bPartBuilder.icosphere(1, 3, false, true);
model = (modelBuilder.end());
modelTransform = new Matrix4();
}
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, modelTransform);
// 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);
}
use of gaiasky.util.gdx.IntModelBuilder in project gaiasky by langurmonkey.
the class SpacecraftGui method doneLoading.
/**
* Constructs the interface
*/
public void doneLoading(AssetManager assetManager) {
aiTexture = assetManager.get(Settings.settings.data.dataFile("tex/base/attitudeindicator.png"), Texture.class);
aiTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
aiPointerTexture = assetManager.get("img/ai-pointer.png", Texture.class);
aiPointerTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
aiVelTex = assetManager.get("img/ai-vel.png", Texture.class);
aiVelTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
aiAntivelTex = assetManager.get("img/ai-antivel.png", Texture.class);
aiAntivelTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
aiVelDec = Decal.newDecal(new TextureRegion(aiVelTex));
aiAntivelDec = Decal.newDecal(new TextureRegion(aiAntivelTex));
Material mat = new Material(new TextureAttribute(TextureAttribute.Diffuse, aiTexture), new ColorAttribute(ColorAttribute.Specular, 0.3f, 0.3f, 0.3f, 1f), new DepthTestAttribute(GL20.GL_LESS, aiCam.near, aiCam.far, true));
aiModel = new IntModelBuilder().createSphere(1.6f, 30, 30, false, mat, Bits.indexes(Usage.Position, Usage.Normal, Usage.Tangent, Usage.BiNormal, Usage.TextureCoordinates));
aiTransform = new Matrix4();
aiModelInstance = new IntModelInstance(aiModel, aiTransform);
aiViewport = new ExtendViewport(indicatorw * Settings.settings.program.ui.scale, indicatorh * Settings.settings.program.ui.scale, aiCam);
buildGui();
EventManager.instance.subscribe(this, gaiasky.event.Event.SPACECRAFT_STABILISE_CMD, gaiasky.event.Event.SPACECRAFT_STOP_CMD, gaiasky.event.Event.SPACECRAFT_INFO, gaiasky.event.Event.SPACECRAFT_NEAREST_INFO, gaiasky.event.Event.SPACECRAFT_THRUST_INFO);
EventManager.instance.unsubscribe(this, gaiasky.event.Event.SPACECRAFT_LOADED);
}
Aggregations