ModularPowersuits/src/main/java/net/machinemuse/powersuits/client/render/entity/RenderLuxCapacitorEntity.java

51 lines
1.9 KiB
Java
Raw Normal View History

package net.machinemuse.powersuits.client.render.entity;
2013-04-19 15:27:51 +02:00
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
2013-04-19 15:27:51 +02:00
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.entity.EntityLuxCapacitor;
2013-04-19 15:27:51 +02:00
import net.minecraft.entity.Entity;
2014-09-09 15:29:37 +02:00
import net.minecraft.util.ResourceLocation;
2013-04-19 15:27:51 +02:00
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.obj.WavefrontObject;
2013-04-23 23:36:50 +02:00
import static org.lwjgl.opengl.GL11.*;
2013-08-04 00:47:33 +02:00
public class RenderLuxCapacitorEntity extends MuseRender {
2013-04-23 23:36:50 +02:00
protected static WavefrontObject lightmodel;
protected static WavefrontObject framemodel;
2013-04-19 15:27:51 +02:00
2013-04-23 23:36:50 +02:00
public static WavefrontObject getLightModel() {
if (lightmodel == null) {
2014-09-09 15:29:37 +02:00
lightmodel = (WavefrontObject) AdvancedModelLoader.loadModel(new ResourceLocation(Config.RESOURCE_PREFIX() + "models/lightCore.obj"));
2013-04-23 23:36:50 +02:00
}
return lightmodel;
}
2013-04-19 15:27:51 +02:00
2013-04-23 23:36:50 +02:00
public static WavefrontObject getFrameModel() {
if (framemodel == null) {
2014-09-09 15:29:37 +02:00
framemodel = (WavefrontObject) AdvancedModelLoader.loadModel(new ResourceLocation(Config.RESOURCE_PREFIX() + "models/lightBase.obj"));
2013-04-23 23:36:50 +02:00
}
return framemodel;
}
2013-04-19 15:27:51 +02:00
2013-04-23 23:36:50 +02:00
@Override
public void doRender(Entity undifferentiatedentity, double x, double y, double z, float yaw, float partialTickTime) {
EntityLuxCapacitor entity = (EntityLuxCapacitor) undifferentiatedentity;
2014-09-09 15:29:37 +02:00
MuseTextureUtils.pushTexture(Config.TEXTURE_PREFIX() + "models/thusters_uvw_2.png");
2013-04-23 23:36:50 +02:00
glPushMatrix();
glTranslated(x, y, z);
double scale = 0.0625;
glScaled(scale, scale, scale);
getFrameModel().renderAll();
RenderState.glowOn();
new Colour(entity.red, entity.green, entity.blue, 1.0).doGL();
2013-04-23 23:36:50 +02:00
getLightModel().renderAll();
RenderState.glowOff();
2013-04-23 23:36:50 +02:00
glPopMatrix();
MuseTextureUtils.popTexture();
2013-04-23 23:36:50 +02:00
}
2013-04-19 15:27:51 +02:00
}