Search in sources :

Example 6 with Profiler

use of net.minecraft.profiler.Profiler in project BuildCraft by BuildCraft.

the class RenderTickListener method renderMarkerConnector.

private static void renderMarkerConnector(WorldClient world, EntityPlayer player) {
    Profiler profiler = Minecraft.getMinecraft().mcProfiler;
    profiler.startSection("marker");
    for (MarkerCache<?> cache : MarkerCache.CACHES) {
        profiler.startSection(cache.name);
        renderMarkerCache(player, cache.getSubCache(world));
        profiler.endSection();
    }
    profiler.endSection();
}
Also used : Profiler(net.minecraft.profiler.Profiler)

Example 7 with Profiler

use of net.minecraft.profiler.Profiler in project BuildCraft by BuildCraft.

the class RenderTickListener method renderMarkerCache.

private static void renderMarkerCache(EntityPlayer player, MarkerSubCache<?> cache) {
    Profiler profiler = Minecraft.getMinecraft().mcProfiler;
    profiler.startSection("compute");
    Set<LaserData_BC8> toRender = new HashSet<>();
    for (final BlockPos a : cache.getAllMarkers()) {
        for (final BlockPos b : cache.getValidConnections(a)) {
            if (a.toLong() > b.toLong()) {
                // Only render each pair once
                continue;
            }
            Vec3d start = VecUtil.convertCenter(a);
            Vec3d end = VecUtil.convertCenter(b);
            Vec3d startToEnd = end.subtract(start).normalize();
            Vec3d endToStart = start.subtract(end).normalize();
            start = start.add(VecUtil.scale(startToEnd, 0.125));
            end = end.add(VecUtil.scale(endToStart, 0.125));
            LaserType laserType = cache.getPossibleLaserType();
            if (laserType == null || isLookingAt(a, b, player)) {
                laserType = BuildCraftLaserManager.MARKER_DEFAULT_POSSIBLE;
            }
            LaserData_BC8 data = new LaserData_BC8(laserType, start, end, 1 / 16.0);
            toRender.add(data);
        }
    }
    profiler.endStartSection("render");
    for (LaserData_BC8 laser : toRender) {
        LaserRenderer_BC8.renderLaserStatic(laser);
    }
    profiler.endSection();
}
Also used : LaserType(buildcraft.lib.client.render.laser.LaserData_BC8.LaserType) Profiler(net.minecraft.profiler.Profiler) BlockPos(net.minecraft.util.math.BlockPos) LaserData_BC8(buildcraft.lib.client.render.laser.LaserData_BC8) Vec3d(net.minecraft.util.math.Vec3d) HashSet(java.util.HashSet)

Example 8 with Profiler

use of net.minecraft.profiler.Profiler in project ImmersiveEngineering by BluSunrize.

the class ParticleRenderer method dispatch.

public static void dispatch() {
    Profiler profiler = ClientUtils.mc().mcProfiler;
    profiler.startSection(ImmersiveEngineering.MODID + "-particles");
    boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING);
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    for (String key : EntityFXIEBase.queuedRenders.keySet()) {
        profiler.endStartSection(key);
        int i = 0;
        //			ClientUtils.tes().startDrawingQuads();
        for (EntityFXIEBase particle : EntityFXIEBase.queuedRenders.get(key)) {
            if ((i++) == 0)
                ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture());
        //				particle.tessellateFromQueue(ClientUtils.tes());
        }
    //			ClientUtils.tes().draw();
    }
    EntityFXIEBase.queuedRenders.clear();
    profiler.startSection("depthIgnoring");
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    for (String key : EntityFXIEBase.queuedDepthIgnoringRenders.keySet()) {
        profiler.endStartSection(key);
        int i = 0;
        //			ClientUtils.tes().startDrawingQuads();
        for (EntityFXIEBase particle : EntityFXIEBase.queuedDepthIgnoringRenders.get(key)) {
            if ((i++) == 0)
                ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture());
        //				particle.tessellateFromQueue(ClientUtils.tes());
        }
    //			ClientUtils.tes().draw();
    }
    EntityFXIEBase.queuedDepthIgnoringRenders.clear();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    profiler.endSection();
    if (!isLightingEnabled)
        GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    profiler.endSection();
}
Also used : Profiler(net.minecraft.profiler.Profiler)

Example 9 with Profiler

use of net.minecraft.profiler.Profiler in project BetterWithAddons by DaedalusGame.

the class ParticleRenderDispatcher method dispatch.

// Called from LightningHandler.onRenderWorldLast since that was
// already registered. /shrug
public static void dispatch() {
    Tessellator tessellator = Tessellator.getInstance();
    Profiler profiler = Minecraft.getMinecraft().mcProfiler;
//GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
//GlStateManager.depthMask(false);
//GlStateManager.enableBlend();
//GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
//GlStateManager.alphaFunc(GL11.GL_GREATER, 0.003921569F);
//GlStateManager.enableLighting();
//profiler.startSection("leaf");
//FXLeafParticle.dispatchQueuedRenders(tessellator);
//profiler.endSection();
//GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
//GlStateManager.disableBlend();
//GlStateManager.depthMask(true);
//GL11.glPopAttrib();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) Profiler(net.minecraft.profiler.Profiler)

Example 10 with Profiler

use of net.minecraft.profiler.Profiler in project SpongeCommon by SpongePowered.

the class ExperienceHolderUtilsTest method data.

@Parameterized.Parameters
public static Iterable<Object[]> data() {
    World world = new World(null, new WorldInfo(new NBTTagCompound()), new WorldProviderSurface(), new Profiler(), false) {

        @Override
        protected IChunkProvider createChunkProvider() {
            return null;
        }

        @Override
        protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) {
            return false;
        }
    };
    // noinspection EntityConstructor
    EntityPlayer player = new EntityPlayer(world, new GameProfile(UUID.randomUUID(), "Player")) {

        @Override
        public boolean isSpectator() {
            return false;
        }

        @Override
        public boolean isCreative() {
            return false;
        }
    };
    return () -> new Iterator<Object[]>() {

        private int level;

        private int startExp;

        @Override
        public boolean hasNext() {
            return level < 50;
        }

        @Override
        public Object[] next() {
            player.experienceLevel = level;
            Object[] data = { level, startExp, player.xpBarCap() };
            startExp += player.xpBarCap();
            level++;
            return data;
        }
    };
}
Also used : WorldProviderSurface(net.minecraft.world.WorldProviderSurface) Profiler(net.minecraft.profiler.Profiler) GameProfile(com.mojang.authlib.GameProfile) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Iterator(java.util.Iterator) WorldInfo(net.minecraft.world.storage.WorldInfo) EntityPlayer(net.minecraft.entity.player.EntityPlayer) World(net.minecraft.world.World)

Aggregations

Profiler (net.minecraft.profiler.Profiler)15 Vec3d (net.minecraft.util.math.Vec3d)4 EnumFacing (net.minecraft.util.EnumFacing)3 BlockPos (net.minecraft.util.math.BlockPos)3 MutableQuad (buildcraft.lib.client.model.MutableQuad)2 LaserData_BC8 (buildcraft.lib.client.render.laser.LaserData_BC8)2 IBlockState (net.minecraft.block.state.IBlockState)2 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)2 ItemStack (net.minecraft.item.ItemStack)2 World (net.minecraft.world.World)2 TileQuarry (buildcraft.builders.tile.TileQuarry)1 EnumProgressState (buildcraft.factory.tile.TileHeatExchange.EnumProgressState)1 ExchangeSectionEnd (buildcraft.factory.tile.TileHeatExchange.ExchangeSectionEnd)1 ExchangeSectionStart (buildcraft.factory.tile.TileHeatExchange.ExchangeSectionStart)1 LaserType (buildcraft.lib.client.render.laser.LaserData_BC8.LaserType)1 GameProfile (com.mojang.authlib.GameProfile)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Tessellator (net.minecraft.client.renderer.Tessellator)1 EntityItem (net.minecraft.entity.item.EntityItem)1