Java源码示例:net.minecraft.client.renderer.culling.ICamera
示例1
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;
}
}
示例2
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;
}
}
示例3
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;
}
示例4
@Override
public void setupTerrain(
Entity viewEntity,
double partialTicks,
ICamera camera,
int frameCount,
boolean playerSpectator) {
super.setupTerrain(viewEntity, partialTicks, camera, frameCount, playerSpectator);
}
示例5
@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();
}
示例6
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();
}
示例7
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);
}
}
}
}
示例8
@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;
}
示例9
@Override
public boolean shouldRender(T livingEntity, ICamera camera, double camX, double camY, double camZ) {
return super.shouldRender(livingEntity, camera, camX, camY, camZ);
}
示例10
@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));
}
示例11
@Override
public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks) {
super.renderEntities(renderViewEntity, camera, partialTicks);
}
示例12
@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;
}
示例13
public boolean shouldRender(ICamera camera) {
if (parent.getWrapperEntity().isDead) {
return false;
}
return camera == null || camera.isBoundingBoxInFrustum(parent.getShipBoundingBox());
}