use of net.modificationstation.stationapi.api.client.render.StationTessellator in project StationAPI by ModificationStation.
the class BakedModelRendererImpl method renderWorld.
@Override
public boolean renderWorld(BlockState state, BakedModel model, BlockView blockView, int x, int y, int z, int textureOverride) {
posAccessor.stationapi$setX(x);
posAccessor.stationapi$setY(y);
posAccessor.stationapi$setZ(z);
long seed = state.getRenderingSeed(pos);
if (!model.isVanillaAdapter()) {
BlockRenderContext context = CONTEXTS.get();
return context.render(blockView, model, state, pos, random, seed);
}
BlockBase block = state.getBlock();
if (textureOverride >= 0)
return true;
Tessellator t = Tessellator.INSTANCE;
StationTessellator fastT = StationTessellator.get(t);
light.initialize(block, blockView, x, y, z, Minecraft.isSmoothLightingEnabled() && model.useAmbientOcclusion());
boolean rendered = false;
ImmutableList<BakedQuad> qs;
BakedQuad q;
float[] qlight = light.light;
for (int quadSet = 0, size = DIRECTIONS.length; quadSet < size; quadSet++) {
Direction face = DIRECTIONS[quadSet];
random.setSeed(seed);
qs = model.getQuads(state, face, random);
if (!qs.isEmpty() && (face == null || block.isSideRendered(blockView, x + face.vector.x, y + face.vector.y, z + face.vector.z, quadSet))) {
rendered = true;
for (int j = 0, quadSize = qs.size(); j < quadSize; j++) {
q = qs.get(j);
light.calculateForQuad(q);
if (q.hasColour()) {
int i = StationRenderAPI.getBlockColours().getColour(state, blockView, pos, q.getColorIndex());
float r = redI2F(i);
float g = greenI2F(i);
float b = blueI2F(i);
if (GameRenderer.anaglyph3d) {
float colourMultiplierGreenTmp = (r * 30F + g * 70F) / 100F, colourMultiplierBlueTmp = (r * 30F + b * 70F) / 100F;
r = (r * 30F + g * 59F + b * 11F) / 100F;
g = colourMultiplierGreenTmp;
b = colourMultiplierBlueTmp;
}
fastT.quad(q.getVertexData(), x, y, z, colourF2I(r * qlight[0], g * qlight[0], b * qlight[0]), colourF2I(r * qlight[1], g * qlight[1], b * qlight[1]), colourF2I(r * qlight[2], g * qlight[2], b * qlight[2]), colourF2I(r * qlight[3], g * qlight[3], b * qlight[3]));
} else
fastT.quad(q.getVertexData(), x, y, z, colourF2I(qlight[0], qlight[0], qlight[0]), colourF2I(qlight[1], qlight[1], qlight[1]), colourF2I(qlight[2], qlight[2], qlight[2]), colourF2I(qlight[3], qlight[3], qlight[3]));
}
}
}
return rendered;
}
Aggregations