java类net.minecraft.client.renderer.culling.Frustum的实例源码

RenderingHandler.java 文件源码 项目:WorldProtect 阅读 26 收藏 0 点赞 0 评论 0
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onWorldRender (RenderWorldLastEvent event) {

    if (icon == null)
        icon = RenderUtils.getParticleTexture(new ItemStack(Blocks.STAINED_GLASS));

    final Minecraft mc = Minecraft.getMinecraft();
    final Frustum camera = RenderUtils.getCamera(mc.getRenderViewEntity(), event.getPartialTicks());

    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

    for (final BlockPos pos : BlockHandler.PROTECTED)
        if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(pos)))
            this.renderPingOverlay(pos);
}
ClientProxy.java 文件源码 项目:Hard-Science 阅读 19 收藏 0 点赞 0 评论 0
private static void refreshCamera()
{
    Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
    if(entity == null) return;

    float partialTicks = Animation.getPartialTickTime();

    ICamera newCam = new Frustum();
    double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks;
    double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks;
    double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks;
    newCam.setPosition(d0, d1, d2);
    cameraX = d0;
    cameraY = d1;
    cameraZ = d2;
    camera = newCam;
}
RenderUtils.java 文件源码 项目:WorldProtect 阅读 23 收藏 0 点赞 0 评论 0
@SideOnly(Side.CLIENT)
public static Frustum getCamera (Entity renderEntity, float partialTicks) {

    final double cameraX = renderEntity.prevPosX + (renderEntity.posX - renderEntity.prevPosX) * partialTicks;
    final double cameraY = renderEntity.prevPosY + (renderEntity.posY - renderEntity.prevPosY) * partialTicks;
    final double cameraZ = renderEntity.prevPosZ + (renderEntity.posZ - renderEntity.prevPosZ) * partialTicks;

    final Frustum camera = new Frustum();
    camera.setPosition(cameraX, cameraY, cameraZ);
    return camera;
}
ChainRender.java 文件源码 项目:Factorization 阅读 19 收藏 0 点赞 0 评论 0
ICamera getFrustum(float partial) {
    // Unfortunately we have to make our own Frustum.
    final Minecraft mc = Minecraft.getMinecraft();
    final Entity eye = mc.getRenderViewEntity();
    double eyeX = eye.lastTickPosX + (eye.posX - eye.lastTickPosX) * (double)partial;
    double eyeY = eye.lastTickPosY + (eye.posY - eye.lastTickPosY) * (double)partial;
    double eyeZ = eye.lastTickPosZ + (eye.posZ - eye.lastTickPosZ) * (double)partial;

    Frustum frustum = new Frustum(); // Notch can't spell
    frustum.setPosition(eyeX, eyeY, eyeZ);
    return frustum;
}
RenderUtils.java 文件源码 项目:MMDLib-old 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Gets the camera for a specific entity.
 *
 * @param entity The entity to get the camera for.
 * @param partialTicks The partial ticks for the camera.
 * @return The camera for the entity.
 */
public static Frustum getCamera (Entity entity, float partialTicks) {
    final double cameraX = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
    final double cameraY = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks;
    final double cameraZ = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
    final Frustum camera = new Frustum();
    camera.setPosition(cameraX, cameraY, cameraZ);
    return camera;
}
RenderUtils.java 文件源码 项目:Bookshelf 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Gets the camera for a specific entity.
 *
 * @param entity The entity to get the camera for.
 * @param partialTicks The partial ticks for the camera.
 * @return The camera for the entity.
 */
public static Frustum getCamera (Entity entity, float partialTicks) {

    final double cameraX = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
    final double cameraY = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks;
    final double cameraZ = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;

    final Frustum camera = new Frustum();
    camera.setPosition(cameraX, cameraY, cameraZ);
    return camera;
}
ShadersRender.java 文件源码 项目:BaseClient 阅读 23 收藏 0 点赞 0 评论 0
public static void setFrustrumPosition(Frustum frustrum, double x, double y, double z)
{
    frustrum.setPosition(x, y, z);
}


问题


面经


文章

微信
公众号

扫码关注公众号