我正在为我的世界制作模组并添加夜视功能,但是有没有办法使用滤镜更改每个模型的渲染?
GL11.glDisable(GL11.GL_TEXTURE_2D);
Tessellator var7 = Tessellator.instance;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
var7.startDrawingQuads();
var7.setTranslation(par1, par3, par5);
var7.setNormal(0.0F, 0.0F, -1.0F);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
var7.setNormal(0.0F, 0.0F, 1.0F);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
var7.setNormal(0.0F, -1.0F, 0.0F);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
var7.setNormal(0.0F, 1.0F, 0.0F);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
var7.setNormal(-1.0F, 0.0F, 0.0F);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
var7.setNormal(1.0F, 0.0F, 0.0F);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
var7.setTranslation(0.0D, 0.0D, 0.0D);
var7.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
在此代码中,允许 OpenGL 在调用绘图方法之前过滤图像和/或轮廓。
OpenGL不是一个场景图,它基本上只是一些复杂的"笔和纸"。所以你必须发挥创意,想出一些能给你带来所需效果的绘图方案。
Tesselator
类不是OpenGL的一部分;如果我不得不猜测,它可能是Minecraft代码的一部分。当然可以像你想要的那样添加这样的效果,但它并不像"抛出几个开关"那么简单。我建议你先自己"从头开始"进行一些OpenGL编码,以了解OpenGL是如何工作的。这将为您提供一个更好的起点来修改复杂程序。