net.minecraft.client.renderer.culling.Frustum Java Examples

The following examples show how to use net.minecraft.client.renderer.culling.Frustum. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LitematicaRenderer.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private ICamera createCamera(Entity entity, float partialTicks)
{
    double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
    double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
    double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;

    this.entity = entity;
    this.camera = new Frustum();
    this.camera.setPosition(x, y, z);

    return this.camera;
}
 
Example #2
Source File: MixinRenderGlobal.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Inject(method = "renderBlockLayer(Lnet/minecraft/util/BlockRenderLayer;DILnet/minecraft/entity/Entity;)I", at = @At("HEAD"))
private void preRenderBlockLayer(BlockRenderLayer blockLayerIn, double partialTicks, int pass,
    Entity entityIn, CallbackInfoReturnable callbackInfo) {
    RenderHelper.disableStandardItemLighting();

    // This probably won't work with strange mods, but I'm too lazy to do it better
    ICamera icamera = new Frustum();
    Entity entity = this.mc.getRenderViewEntity();
    double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
    double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
    double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
    icamera.setPosition(d0, d1, d2);

    for (PhysicsWrapperEntity wrapper : ValkyrienSkiesMod.VS_PHYSICS_MANAGER
        .getManagerForWorld(this.world)
        .getTickablePhysicsEntities()) {
        GL11.glPushMatrix();
        if (wrapper.getPhysicsObject().getShipRenderer() != null && wrapper.getPhysicsObject()
            .getShipRenderer().shouldRender(icamera)) {
            wrapper.getPhysicsObject().getShipRenderer()
                .renderBlockLayer(blockLayerIn, partialTicks, pass, icamera);
        }
        GL11.glPopMatrix();
    }

    GlStateManager.resetColor();
}