Hi,
I'm relatively new to MC modding, so I probably made some stupid mistakes there.
So here's my question:
I have a gun, that renders a muzzle flash (just a view aligned quad) when firing, which all works fine. The muzzle flash is affected by sky/world lighting, but I want it to be at full brightness at all times, just like the GUI or particles.
Right now my code is executed from the gun item's renderer (which probably isn't the best way to do it)
How can I tell the tesselator to ignore lighting? I have tried to disable gl_LIGHTING, or setting the tesselator's brightness but it didn't work.
Also, would it be better to do this in the GUI? If so, would it be possible to render this quad behind the gun model?
public void doRender(float progress, float offsetX, float offsetY, float offsetZ, float scale) {
System.out.println("RenderMuzzleFlash");
int currentFrame = (int)((float)numSprites*progress);
if (currentFrame < numSprites) {
int col = currentFrame % cols;
int row = (currentFrame / cols);
float u = 1.f/cols;
float v = 1.f/rows;
float U1 = col*u;
float V1 = row*v;
float U2 = (col+1)*u;
float V2 = (row+1)*v;
Minecraft.getMinecraft().getTextureManager().bindTexture(fxTexture);
GL11.glPushMatrix();
GL11.glTranslatef(0.f, 0.f, 0.f);
GL11.glRotatef(0, 0, 0, 0);
GL11.glScalef(scale, scale, scale);
//GL11.glDisable(GL11.GL_DIFFUSE);
//GL11.glDisable(GL11.GL_LIGHTING);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(offsetX, offsetY, offsetZ+scale, (double)U1, (double)V1);
tessellator.addVertexWithUV(offsetX+scale, offsetY, offsetZ+scale, (double)U2, (double)V1);
tessellator.addVertexWithUV(offsetX+scale, offsetY, offsetZ, (double)U2, (double)V2);
tessellator.addVertexWithUV(offsetX, offsetY, offsetZ, (double)U1, (double)V2);
//tessellator.setBrightness(15);
//GL11.glColor3f(1, 1, 1);
tessellator.setColorOpaque(255, 255, 255);
tessellator.draw();
//GL11.glEnable(GL11.GL_DIFFUSE);
//GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}