Example usage for org.lwjgl.opengl GL11 GL_EXP

List of usage examples for org.lwjgl.opengl GL11 GL_EXP

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 GL_EXP.

Prototype

int GL_EXP

To view the source code for org.lwjgl.opengl GL11 GL_EXP.

Click Source Link

Document

FogMode

Usage

From source file:com.ardor3d.scene.state.lwjgl.LwjglFogStateUtil.java

License:Open Source License

private static void applyFogMode(final DensityFunction densityFunction, final FogStateRecord record) {
    int glMode = 0;
    switch (densityFunction) {
    case Exponential:
        glMode = GL11.GL_EXP;
        break;/*from www  . ja v a 2  s . co m*/
    case Linear:
        glMode = GL11.GL_LINEAR;
        break;
    case ExponentialSquared:
        glMode = GL11.GL_EXP2;
        break;
    }

    if (!record.isValid() || record.fogMode != glMode) {
        GL11.glFogi(GL11.GL_FOG_MODE, glMode);
        record.fogMode = glMode;
    }
}

From source file:de.sanandrew.mods.enderstuffp.client.event.RenderGameOverlayHandler.java

License:Creative Commons License

@SubscribeEvent
public void renderFogDensity(FogDensity event) {
    if (event.block == EspBlocks.endFluidBlock) {
        GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);

        if (event.entity.isPotionActive(Potion.waterBreathing)) {
            event.density = 0.05F;/*  w  w  w  .j  av a  2 s . c om*/
        } else {
            event.density = 0.7F - EnchantmentHelper.getRespiration(event.entity) * 0.03F;
        }
        event.setCanceled(true);
    }
}

From source file:gravestone.core.event.GSRenderEventHandler.java

License:LGPL

@SubscribeEvent
@SideOnly(Side.CLIENT)/*from   ww w  . j  a v  a 2 s  .c om*/
public void fogEvent(EntityViewRenderEvent.RenderFogEvent event) {
    if (GSConfig.isFogEnabled) {
        if (fogDensity < fogDensityPerTick) {
            fogDensity += DENSITY_PER_TICK;
        } else if (fogDensity > fogDensityPerTick) {
            fogDensity -= DENSITY_PER_TICK;
        }
        if (fogDensity < DENSITY_PER_TICK) {
            fogDensity = 0;
        }

        if (fogDensity > 0) {
            GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
            GL11.glFogf(GL11.GL_FOG_DENSITY, fogDensity);
        }
    }
}

From source file:io.flob.blackheart.Level.java

License:Open Source License

public void tick() throws Exception {

    if (display_list_dirty) {
        load_display_list();/*from www  .j  a  va2 s. com*/
    }

    ByteBuffer temp = ByteBuffer.allocateDirect(16);
    temp.order(ByteOrder.nativeOrder());
    float fog_colour[] = new float[] { 0f, 0f, 0f, 0f };
    GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
    temp.asFloatBuffer().put(fog_colour).flip();
    GL11.glFog(GL11.GL_FOG_COLOR, temp.asFloatBuffer());
    GL11.glFogf(GL11.GL_FOG_DENSITY, 0.25f);
    GL11.glHint(GL11.GL_FOG_HINT, GL11.GL_DONT_CARE);
    GL11.glFogf(GL11.GL_FOG_START, 0);
    GL11.glFogf(GL11.GL_FOG_END, 200);

    _barry.tick();

    try {
        Collections.sort(objects_dynamic, this.sort_objects);
    } catch (Exception ex) {
        Output.error(ex.getMessage());
    }

    if (Debug.collision_boxs) {
        _game._core._display.flush_texture();
        for (int count = 0; count < objects_static.size(); count++) {
            if (objects_static.get(count) instanceof ICollidable) {
                ICollidable objcet = (ICollidable) objects_static.get(count);
                objcet.collision_box().render();
            }
        }
        for (int count = 0; count < objects_dynamic.size(); count++) {
            if (objects_dynamic.get(count) instanceof ICollidable) {
                ICollidable objcet = (ICollidable) objects_dynamic.get(count);
                objcet.collision_box().render();
            }
        }
        _barry.collision_box().render();
        _barry.ray_picker().collision_box().render();
    }

    GL11.glPushMatrix();
    _game._core._texture.game_atlas.bind();
    if (_game.anaglyph()) {
        GL11.glTranslatef(1 * 0.03f, 0, 0);
        GL11.glColorMask(true, false, false, true);
    }
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glCallList(display_list);
    for (int count = 0; count < objects_dynamic.size(); count++) {
        objects_dynamic.get(count).tick();
    }
    GL11.glEnd();
    if (_game.anaglyph()) {
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glColorMask(false, true, true, true);
        GL11.glTranslatef(-1 * 0.03f, 0, 0);
        GL11.glBegin(GL11.GL_QUADS);
        GL11.glCallList(display_list);
        for (int count = 0; count < objects_dynamic.size(); count++) {
            objects_dynamic.get(count)._render();
        }
        GL11.glEnd();
        GL11.glColorMask(true, true, true, true);
    }
    GL11.glPopMatrix();

    for (int count = 0; count < objects_dynamic.size(); count++) {
        if (objects_dynamic.get(count).IRemove()) {
            objects_dynamic.remove(count);
        }
    }

    _hud.tick();

    if (_barry.health() <= 0) {
        _game._core.state(_game._core._game_dead);
    }
}

From source file:nightkosh.gravestone_extended.core.event.RenderEventHandler.java

License:LGPL

@SubscribeEvent
@SideOnly(Side.CLIENT)// w  w  w  .j a v a2s.  c o  m
public void fogEvent(EntityViewRenderEvent.RenderFogEvent event) {
    if (ExtendedConfig.isFogEnabled) {
        if (fogDensity < fogDensityPerTick) {
            fogDensity += DENSITY_PER_TICK;
        } else if (fogDensity > fogDensityPerTick) {
            fogDensity -= DENSITY_PER_TICK;
        }
        if (fogDensity < DENSITY_PER_TICK) {
            fogDensity = 0;
        }

        if (fogDensity > 0) {
            GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
            GL11.glFogf(GL11.GL_FOG_DENSITY, fogDensity);
        }
    }
}