Java Code Examples for org.lwjgl.opengl.GL11#GL_SRC_ALPHA
The following examples show how to use
org.lwjgl.opengl.GL11#GL_SRC_ALPHA .
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: Unit.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
private final BalancedParametricEmitter createStunStar(float x, float y, float z, float time, float velocity) { int num_particles = 5; return new BalancedParametricEmitter(getOwner().getWorld(), new StunFunction(.4f, .15f), new Vector3f(x, y, z), velocity, 5f, (float)StrictMath.PI*2, (float)StrictMath.PI*2, num_particles, 0f, 2f, new Vector4f(1f, 1f, 1f, 1f), new Vector4f(0f, 0f, 0f, 0f), new Vector3f(.1f, .1f, .1f), new Vector3f(0f, 0f, 0f), time, GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, getOwner().getWorld().getRacesResources().getStarTextures(), getOwner().getWorld().getAnimationManagerGameTime()); }
Example 2
Source File: LightningCloud.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
public LightningCloud(World world, float offset_x, float offset_y, float offset_z, float seconds_to_live, float seconds_per_hit, float seconds_to_init, float meters_per_second, float hit_chance, int damage, float height, Unit src) { this.seconds_to_live = seconds_to_live; this.seconds_per_hit = seconds_per_hit; this.meters_per_second = meters_per_second; this.hit_chance = hit_chance; this.damage = damage; this.height = height; owner = src.getOwner(); float start_x = src.getPositionX() + offset_x*src.getDirectionX() - offset_y*(-src.getDirectionY()); float start_y = src.getPositionY() + offset_x*src.getDirectionY() + offset_y*src.getDirectionX(); position.setX(start_x); position.setY(start_y); position.setZ(world.getHeightMap().getNearestHeight(position.getX(), position.getY()) + height); cloud = new ParametricEmitter(world, new CloudFunction(2.5f, .7f), position, 0f, 0f, .5f, .5f, .2f, 25, 100f, new Vector4f(.4f, .4f, .4f, .6f), new Vector4f(0f, 0f, 0f, 0f), new Vector3f(3f, 3f, 1f), new Vector3f(0f, 0f, 0f), seconds_to_live + seconds_to_init, GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, world.getRacesResources().getSmokeTextures(), world.getAnimationManagerGameTime()); bubbling_sound = world.getAudio().newAudio(new AudioParameters(world.getRacesResources().getBubblingSound(), position.getX(), position.getY(), world.getHeightMap().getNearestHeight(position.getX(), position.getY()), AudioPlayer.AUDIO_RANK_MAGIC, AudioPlayer.AUDIO_DISTANCE_MAGIC, AudioPlayer.AUDIO_GAIN_BUBBLING, AudioPlayer.AUDIO_RADIUS_BUBBLING, 1f, true, false)); }
Example 3
Source File: Stun.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
public Stun(float offset_x, float offset_y, float offset_z, float hit_radius, float stun_time_closest, float stun_time_farthest, Unit src) { this.hit_radius = hit_radius; this.stun_time_closest = stun_time_closest; this.stun_time_farthest = stun_time_farthest; this.owner = src.getOwner(); start_x = src.getPositionX() + offset_x*src.getDirectionX() - offset_y*(-src.getDirectionY()); start_y = src.getPositionY() + offset_x*src.getDirectionY() + offset_y*src.getDirectionX(); float z = src.getPositionZ() + offset_z; float alpha = 12f; float energy = 4f; emitter = new RandomVelocityEmitter(owner.getWorld(), new Vector3f(start_x, start_y, z), 0f, 0f, .001f, .001f, .5f, (float)StrictMath.PI, -1, 35f, new Vector3f(0f, 0f, 6f), new Vector3f(0f, 0f, -2f), new Vector4f(1f, 1f, 1f, alpha), new Vector4f(0f, 0f, 0f, -alpha/energy), new Vector3f(.3f, .3f, .3f), new Vector3f(.025f, .025f, .025f), energy, 1f, GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, owner.getWorld().getRacesResources().getNoteTextures(), owner.getWorld().getAnimationManagerGameTime()); FindOccupantFilter filter = new FindOccupantFilter(src.getPositionX(), src.getPositionY(), hit_radius, src, Selectable.class); // FindOccupantFilter filter = new FindOccupantFilter(src.getPositionX(), src.getPositionY(), hit_radius, src, Unit.class); UnitGrid unit_grid = owner.getWorld().getUnitGrid(); unit_grid.scan(filter, UnitGrid.toGridCoordinate(src.getPositionX()), UnitGrid.toGridCoordinate(src.getPositionY())); target_list = filter.getResult(); sound = owner.getWorld().getAudio().newAudio(new AudioParameters(owner.getWorld().getRacesResources().getStunSound(owner.getWorld().getRandom()), start_x, start_y, z, AudioPlayer.AUDIO_RANK_MAGIC, AudioPlayer.AUDIO_DISTANCE_MAGIC, AudioPlayer.AUDIO_GAIN_STUN_LUR, AudioPlayer.AUDIO_RADIUS_STUN_LUR, 1f)); }
Example 4
Source File: RenderState.java From OpenPeripheral-Addons with MIT License | 5 votes |
public void forceKnownState() { GL11.glDisable(GL11.GL_LIGHTING); this.lighting = false; GL11.glDisable(GL11.GL_ALPHA_TEST); this.alphaTest = false; GL11.glDisable(GL11.GL_TEXTURE_2D); this.texture = false; GL11.glDisable(GL11.GL_DEPTH_TEST); this.depthTest = false; GL11.glEnable(GL11.GL_BLEND); this.blend = true; this.blendDst = GL11.GL_ONE_MINUS_SRC_ALPHA; this.blendSrc = GL11.GL_SRC_ALPHA; GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); this.cullFace = false; GL11.glPointSize(1.0f); this.pointSize = 1.0f; GL11.glLineWidth(1.0f); this.lineWidth = 1.0f; }
Example 5
Source File: PoisonFog.java From tribaltrouble with GNU General Public License v2.0 | 4 votes |
public final void animate(float t) { time += t; if (time >= total_time) { owner.getWorld().getAnimationManagerGameTime().removeAnimation(this); } if (first_run) { bubbling_sound.stop(.2f, Settings.getSettings().sound_gain); first_run = false; } if (bursts*SECONDS_BETWEEN_BURSTS < time) { float gaussian = (float)(GAUSSIAN_LIMIT - StrictMath.abs(StrictMath.max(-GAUSSIAN_LIMIT, StrictMath.min(GAUSSIAN_LIMIT, owner.getWorld().getRandom().nextGaussian()))))/GAUSSIAN_LIMIT; float r = gaussian*(hit_radius - BURST_RADIUS - 5f); float a = owner.getWorld().getRandom().nextFloat()*(float)StrictMath.PI*2; float x = start_x + (float)StrictMath.cos(a)*r; float y = start_y + (float)StrictMath.sin(a)*r; float z = owner.getWorld().getHeightMap().getNearestHeight(x, y); float alpha = 8f; float energy = 2f; new RandomVelocityEmitter(owner.getWorld(), new Vector3f(x, y, z), OFFSET_Z, owner.getWorld().getRandom().nextFloat()*(float)StrictMath.PI*2, BURST_RADIUS, 0f, 0f, 0f, PARTICLES_PER_BURST, PARTICLES_PER_BURST, new Vector3f(0f, 0f, 0f), new Vector3f(0f, 0f, 0f), new Vector4f(1f, 1f, 1f, alpha), new Vector4f(0f, 0f, 0f, -alpha/energy), new Vector3f(0f, 0f, .25f), new Vector3f(3.5f, 3.5f, 0f), energy, 1f, GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, owner.getWorld().getRacesResources().getPoisonTextures(), owner.getWorld().getAnimationManagerGameTime()); if (bursts%next_sound == 0) { next_sound = MIN_BURSTS_PER_SOUND + owner.getWorld().getRandom().nextInt(5); owner.getWorld().getAudio().newAudio(new AudioParameters(owner.getWorld().getRacesResources().getGasSound(), x, y, z, AudioPlayer.AUDIO_RANK_GAS, AudioPlayer.AUDIO_DISTANCE_MAGIC, AudioPlayer.AUDIO_GAIN_GAS, AudioPlayer.AUDIO_RADIUS_GAS, 1f)); } bursts++; } if ((num_hits + 1)*interval < time) { hitUnits(hit_radius); num_hits++; } }
Example 6
Source File: Building.java From tribaltrouble with GNU General Public License v2.0 | 4 votes |
public Building(Player owner, BuildingTemplate template, int grid_x, int grid_y) { super(owner, template); setGridPosition(grid_x, grid_y); UnitGrid unit_grid = getUnitGrid(); float x = UnitGrid.coordinateFromGrid(grid_x); float y = UnitGrid.coordinateFromGrid(grid_y); setPosition(x, y); pushController(new NullController(this)); /* Vector3f position, float offset_z, float uv_angle, float emitter_radius, float emitter_height, float angle_bound, float angle_max_jump, int num_particles, float particles_per_second, Vector3f velocity, Vector3f acceleration, Vector4f color, Vector4f delta_color, Vector3f particle_radius, Vector3f growth_rate, int energy, float friction, int src_blend_func, int dst_blend_func, Texture texture */ damaged_emitter = new RandomVelocityEmitter(getOwner().getWorld(), new Vector3f(getPositionX(), getPositionY(), getPositionZ() + getHitOffsetZ()), 0f, 0f, 0.01f, 0.01f, 0.5f, .7f, -1, 4f, new Vector3f(0f, 0f, 5f), new Vector3f(0f, 0f, 0f), new Vector4f(.6f, .6f, .6f, DAMAGED_PARTICLE_ALPHA), new Vector4f(0f, 0f, 0f, 0f), new Vector3f(1.5f, 1.5f, 1.5f), new Vector3f(.6f, .6f, .6f), 1.5f, .75f, GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, owner.getWorld().getRacesResources().getDamageSmokeTextures(), owner.getWorld().getAnimationManagerRealTime()); damaged_emitter.stop(); float xc = getPositionX() + getBuildingTemplate().getChimneyX(); float yc = getPositionY() + getBuildingTemplate().getChimneyY(); float zc = getPositionZ() + getBuildingTemplate().getChimneyZ(); float energy = 4f; float alpha = .6f; production_emitter = new RandomAccelerationEmitter(owner.getWorld(), new Vector3f(xc, yc, zc), 0f, 0.01f, 0.01f, 1.5f, 0.1f, -1, 6f, new Vector3f(0f, 0f, 1.3f), new Vector3f(0f, 0f, .25f), .7f, new Vector4f(.7f, .7f, .7f, alpha), new Vector4f(0f, 0f, 0f, -alpha/energy), new Vector3f(.3f, .3f, .3f), new Vector3f(.5f, .5f, .5f), energy, 1f, GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, owner.getWorld().getRacesResources().getSmokeTextures(), owner.getWorld().getAnimationManagerRealTime()); production_emitter.stop(); }