use of net.minecraft.client.render.model.BakedQuad in project fabric by FabricMC.
the class TerrainFallbackConsumer method accept.
@Override
public void accept(BakedModel model) {
final Supplier<Random> random = blockInfo.randomSupplier;
final Value defaultMaterial = blockInfo.defaultAo && model.useAmbientOcclusion() ? MATERIAL_SHADED : MATERIAL_FLAT;
final BlockState blockState = blockInfo.blockState;
for (int i = 0; i < 6; i++) {
Direction face = ModelHelper.faceFromIndex(i);
List<BakedQuad> quads = model.getQuads(blockState, face, random.get());
final int count = quads.size();
if (count != 0 && blockInfo.shouldDrawFace(face)) {
for (int j = 0; j < count; j++) {
BakedQuad q = quads.get(j);
renderQuad(q, face, defaultMaterial);
}
}
}
List<BakedQuad> quads = model.getQuads(blockState, null, random.get());
final int count = quads.size();
if (count != 0) {
for (int j = 0; j < count; j++) {
BakedQuad q = quads.get(j);
renderQuad(q, null, defaultMaterial);
}
}
}
use of net.minecraft.client.render.model.BakedQuad in project sodium-fabric by CaffeineMC.
the class ChunkBlockRenderPipeline method renderModel.
public boolean renderModel(BlockRenderView world, BakedModel model, BlockState state, BlockPos pos, Vector3f translation, VertexConsumer builder, boolean cull, Random random, long seed) {
LightPipeline lighter = this.getLightPipeline(state, model);
lighter.reset();
this.cachedColors.clear();
Vec3d blockOffset = state.getOffsetPos(world, pos);
translation.add((float) blockOffset.getX(), (float) blockOffset.getY(), (float) blockOffset.getZ());
boolean rendered = false;
for (Direction dir : DirectionUtil.ALL_DIRECTIONS) {
random.setSeed(seed);
List<BakedQuad> sided = model.getQuads(state, dir, random);
if (sided.isEmpty()) {
continue;
}
if (!cull || this.occlusionCache.shouldDrawSide(state, world, pos, dir)) {
this.renderQuadList(world, state, pos, lighter, translation, builder, sided, dir);
rendered = true;
}
}
random.setSeed(seed);
List<BakedQuad> all = model.getQuads(state, null, random);
if (!all.isEmpty()) {
this.renderQuadList(world, state, pos, lighter, translation, builder, all, null);
rendered = true;
}
return rendered;
}
use of net.minecraft.client.render.model.BakedQuad in project canvas by vram-guild.
the class FallbackConsumer method accept.
@Override
public void accept(BakedModel model) {
final Supplier<Random> random = blockInfo.randomSupplier;
final boolean useAo = blockInfo.defaultAo && model.useAmbientOcclusion();
final BlockState blockState = blockInfo.blockState;
for (int i = 0; i < 6; i++) {
final Direction face = ModelHelper.faceFromIndex(i);
final List<BakedQuad> quads = model.getQuads(blockState, face, random.get());
final int count = quads.size();
if (count != 0 && blockInfo.shouldDrawFace(i)) {
for (int j = 0; j < count; j++) {
final BakedQuad q = quads.get(j);
final Value defaultMaterial = ((BakedQuadExt) q).canvas_disableDiffuse() ? (useAo ? MATERIAL_AO_FLAT : MATERIAL_FLAT) : (useAo ? MATERIAL_AO_SHADED : MATERIAL_SHADED);
renderQuad(q, i, defaultMaterial);
}
}
}
final List<BakedQuad> quads = model.getQuads(blockState, null, random.get());
final int count = quads.size();
if (count != 0) {
for (int j = 0; j < count; j++) {
final BakedQuad q = quads.get(j);
final Value defaultMaterial = ((BakedQuadExt) q).canvas_disableDiffuse() ? (useAo ? MATERIAL_AO_FLAT : MATERIAL_FLAT) : (useAo ? MATERIAL_AO_SHADED : MATERIAL_SHADED);
renderQuad(q, ModelHelper.NULL_FACE_ID, defaultMaterial);
}
}
}
use of net.minecraft.client.render.model.BakedQuad in project meteor-client by MeteorDevelopment.
the class SimpleBlockRenderer method render.
public static void render(BlockPos pos, BlockState state, VertexConsumerProvider consumerProvider) {
if (state.getRenderType() != BlockRenderType.MODEL)
return;
VertexConsumer consumer = consumerProvider.getBuffer(RenderLayer.getSolid());
BakedModel model = mc.getBlockRenderManager().getModel(state);
Vec3d offset = state.getModelOffset(mc.world, pos);
double offsetX = pos.getX() + offset.x;
double offsetY = pos.getY() + offset.y;
double offsetZ = pos.getZ() + offset.z;
// noinspection ForLoopReplaceableByForEach
for (int i = 0; i < DIRECTIONS.length; i++) {
List<BakedQuad> list = model.getQuads(state, DIRECTIONS[i], RANDOM);
if (!list.isEmpty())
renderQuads(list, offsetX, offsetY, offsetZ, consumer);
}
List<BakedQuad> list = model.getQuads(state, null, RANDOM);
if (!list.isEmpty())
renderQuads(list, offsetX, offsetY, offsetZ, consumer);
}
use of net.minecraft.client.render.model.BakedQuad in project Client by MatHax.
the class SimpleBlockRenderer method render.
public static void render(BlockPos pos, BlockState state, VertexConsumerProvider consumerProvider) {
if (state.getRenderType() != BlockRenderType.MODEL)
return;
VertexConsumer consumer = consumerProvider.getBuffer(RenderLayer.getSolid());
BakedModel model = mc.getBlockRenderManager().getModel(state);
Vec3d offset = state.getModelOffset(mc.world, pos);
double offsetX = pos.getX() + offset.x;
double offsetY = pos.getY() + offset.y;
double offsetZ = pos.getZ() + offset.z;
// noinspection ForLoopReplaceableByForEach
for (int i = 0; i < DIRECTIONS.length; i++) {
List<BakedQuad> list = model.getQuads(state, DIRECTIONS[i], RANDOM);
if (!list.isEmpty())
renderQuads(list, offsetX, offsetY, offsetZ, consumer);
}
List<BakedQuad> list = model.getQuads(state, null, RANDOM);
if (!list.isEmpty())
renderQuads(list, offsetX, offsetY, offsetZ, consumer);
}
Aggregations