- 124
- 1
- 0
Имеется кастомное главное меню, в котором в качестве логотипа используется модель. Сделал загрузчик модели, перехватил событие рендера главного меню. Но у модели все полигоны освещаются одинаково ярко и внутренние просвечиваются сквозь внешние.
Java:
public class MainMenu extends GuiScreen {
ResourceLocation bg = new ResourceLocation(NovaGui.MODID, "textures/gui/bg.png");
ResourceLocation modelLogo = new ResourceLocation(NovaGui.MODID, "models/evlogo.mqo");
ResourceLocation logoTexture = new ResourceLocation(NovaGui.MODID, "textures/model/evlogo.png");
Model logo;
float zindex = 0;
float rotate = 0;
@Override
public void initGui() {
try {
logo = new Model(null).load(Minecraft.getMinecraft().getResourceManager().getResource(modelLogo).getInputStream());
Material mat = logo.getMaterial("mat1");
mat.setTexture(Minecraft.getMinecraft().getResourceManager().getResource(logoTexture).getInputStream());
logo.setMaterial("mat1", mat);
mat.loadTexture();
} catch (IOException e) {e.printStackTrace();}
}
@Override
public void drawScreen(int x, int y, float a) {
super.drawScreen(x, y, a);
Minecraft.getMinecraft().getTextureManager().bindTexture(bg);
Tessellator t = Tessellator.instance;
t.startDrawingQuads();
t.addVertexWithUV(0, 0, zindex, 0, 0);
t.addVertexWithUV(0, height, zindex, 0, 1);
t.addVertexWithUV(width, height, zindex, 1, 1);
t.addVertexWithUV(width, 0, zindex, 1, 0);
t.draw();
GL11.glPushMatrix();
if (logo != null) {
renderModel(logo);
}
GL11.glPopMatrix();
rotate++;
rotate %= 360;
}
public void renderModel(Model model) {
GL11.glTranslated(width / 2, height / 4, 0);
GL11.glScalef(width / 20f, width / 20f, width / 20f);
GL11.glRotatef(rotate, 0, 1, 0);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
model.renderAll();
}
}