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

The following examples show how to use net.minecraft.client.renderer.culling.ICamera. 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: RenderGlobalSchematic.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
private boolean isOutlineActive(Entity entityIn, Entity viewer, ICamera camera)
{
    boolean sleeping = viewer instanceof EntityLivingBase && ((EntityLivingBase)viewer).isPlayerSleeping();

    if (entityIn == viewer && this.mc.gameSettings.thirdPersonView == 0 && sleeping == false)
    {
        return false;
    }
    else if (entityIn.isGlowing())
    {
        return true;
    }
    else if (this.mc.player.isSpectator() && this.mc.gameSettings.keyBindSpectatorOutlines.isKeyDown() && entityIn instanceof EntityPlayer)
    {
        return entityIn.ignoreFrustumCheck || camera.isBoundingBoxInFrustum(entityIn.getEntityBoundingBox()) || entityIn.isRidingOrBeingRiddenBy(this.mc.player);
    }
    else
    {
        return false;
    }
}
 
Example #2
Source File: LitematicaRenderer.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void piecewisePrepareAndUpdate(float partialTicks)
{
    this.renderPiecewise = Configs.Generic.BETTER_RENDER_ORDER.getBooleanValue() &&
                           Configs.Visuals.ENABLE_RENDERING.getBooleanValue() &&
                           this.mc.getRenderViewEntity() != null;
    this.renderPiecewisePrepared = false;
    this.renderPiecewiseBlocks = false;

    if (this.renderPiecewise)
    {
        boolean invert = Hotkeys.INVERT_GHOST_BLOCK_RENDER_STATE.getKeybind().isKeybindHeld();
        this.renderPiecewiseSchematic = Configs.Visuals.ENABLE_SCHEMATIC_RENDERING.getBooleanValue() != invert;
        this.renderPiecewiseBlocks = this.renderPiecewiseSchematic && Configs.Visuals.ENABLE_SCHEMATIC_BLOCKS.getBooleanValue();

        this.mc.profiler.startSection("litematica_culling");

        Entity entity = this.mc.getRenderViewEntity();
        ICamera icamera = this.createCamera(entity, partialTicks);

        this.calculateFinishTime();
        RenderGlobalSchematic renderGlobal = this.getWorldRenderer();

        this.mc.profiler.endStartSection("litematica_terrain_setup");
        renderGlobal.setupTerrain(entity, partialTicks, icamera, this.frameCount++, this.mc.player.isSpectator());

        this.mc.profiler.endStartSection("litematica_update_chunks");
        renderGlobal.updateChunks(this.finishTimeNano);

        this.mc.profiler.endSection();

        this.renderPiecewisePrepared = true;
    }
}
 
Example #3
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 #4
Source File: MarkersRenderGlobal.java    From ForgeHax with MIT License 5 votes vote down vote up
@Override
public void setupTerrain(
    Entity viewEntity,
    double partialTicks,
    ICamera camera,
    int frameCount,
    boolean playerSpectator) {
  super.setupTerrain(viewEntity, partialTicks, camera, frameCount, playerSpectator);
}
 
Example #5
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();
}
 
Example #6
Source File: PhysObjectRenderManager.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
public void renderBlockLayer(BlockRenderLayer layerToRender, double partialTicks, int pass, ICamera iCamera) {
    if (renderChunks == null) {
        renderChunks = new PhysRenderChunk[parent.getOwnedChunks().chunkLengthX()][parent
            .getOwnedChunks()
            .chunkLengthZ()];
        for (int xChunk = 0; xChunk < parent.getOwnedChunks().chunkLengthX(); xChunk++) {
            for (int zChunk = 0; zChunk < parent.getOwnedChunks().chunkLengthZ(); zChunk++) {
                renderChunks[xChunk][zChunk] = new PhysRenderChunk(parent, parent
                    .getChunkAt(xChunk + parent.getOwnedChunks().minX(),
                        zChunk + parent.getOwnedChunks().minZ()));
            }
        }
    }

    GL11.glPushMatrix();
    Minecraft.getMinecraft().entityRenderer.enableLightmap();
    // int i = parent.wrapper.getBrightnessForRender((float) partialTicks);

    // int j = i % 65536;
    // int k = i / 65536;
    // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)
    // j, (float) k);
    // GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

    applyRenderTransform(partialTicks);
    for (PhysRenderChunk[] chunkArray : renderChunks) {
        for (PhysRenderChunk renderChunk : chunkArray) {
            renderChunk.renderBlockLayer(layerToRender, partialTicks, pass, iCamera);
        }
    }

    Minecraft.getMinecraft().entityRenderer.disableLightmap();
    GL11.glPopMatrix();
}
 
Example #7
Source File: PhysRenderChunk.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
public void renderBlockLayer(BlockRenderLayer layerToRender, double partialTicks, int pass, ICamera iCamera) {
    for (int i = 0; i < 16; i++) {
        IVSRenderChunk renderChunk = renderChunks[i];
        if (renderChunk != null) {
            AxisAlignedBB renderChunkBB = new AxisAlignedBB(chunk.x << 4, renderChunk.minY(), chunk.z << 4, (chunk.x << 4) + 15, renderChunk.maxY(), (chunk.z << 4) + 15);
            Polygon polygon = new Polygon(renderChunkBB, toRender.getShipTransformationManager().getRenderTransform(), TransformType.SUBSPACE_TO_GLOBAL);
            AxisAlignedBB inWorldBB = polygon.getEnclosedAABB();

            // Only render chunks that can be shown by the camera.
            if (iCamera.isBoundingBoxInFrustum(inWorldBB)) {
                renderChunk.renderBlockLayer(layerToRender, partialTicks, pass);
            }
        }
    }
}
 
Example #8
Source File: RenderElevatorCapsule.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public boolean shouldRender(EntityElevatorCapsule livingEntity,
		ICamera camera, double camX, double camY, double camZ) {
	// TODO Auto-generated method stub
	//return super.shouldRender(livingEntity, camera, camX, camY, camZ);
	return true;
}
 
Example #9
Source File: MixinRendererLivingEntity.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean shouldRender(T livingEntity, ICamera camera, double camX, double camY, double camZ) {
    return super.shouldRender(livingEntity, camera, camX, camY, camZ);
}
 
Example #10
Source File: MixinRenderGlobal.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(method = "renderEntities", at = @At(value = "HEAD", target = "Lnet/minecraft/client/renderer/RenderHelper;disableStandardItemLighting()V"))
private void renderEnt(Entity renderViewEntity, ICamera camera, float partialTicks, CallbackInfo info) {
    EventBus.INSTANCE.post(new RenderEntitiesEvent(partialTicks));
}
 
Example #11
Source File: MarkersRenderGlobal.java    From ForgeHax with MIT License 4 votes vote down vote up
@Override
public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks) {
  super.renderEntities(renderViewEntity, camera, partialTicks);
}
 
Example #12
Source File: MixinRenderGlobal.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Inject(method = "renderEntities(Lnet/minecraft/entity/Entity;Lnet/minecraft/client/renderer/culling/ICamera;F)V", at = @At("HEAD"))
private void preRenderEntities(Entity renderViewEntity, ICamera camera, float partialTicks,
    CallbackInfo callbackInfo) {
    // ClientProxy.lastCamera = camera;
}
 
Example #13
Source File: PhysObjectRenderManager.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
public boolean shouldRender(ICamera camera) {
    if (parent.getWrapperEntity().isDead) {
        return false;
    }
    return camera == null || camera.isBoundingBoxInFrustum(parent.getShipBoundingBox());
}