List of usage examples for com.badlogic.gdx.graphics GL20 GL_ONE
int GL_ONE
To view the source code for com.badlogic.gdx.graphics GL20 GL_ONE.
Click Source Link
From source file:com.cyphercove.doublehelix.MainRenderer.java
License:Apache License
@Override public void create() { if (settingsAdapter != null) settingsAdapter.updateAllSettings(); fader = new FullScreenFader(0, 1.5f); disposables.add(fader);//from w w w. j a v a 2s . c o m GaussianBlurShaderProvider gaussianBlurShaderProvider = new GaussianBlurShaderProvider(); bloom = new GaussianBlur(8f, false, true, gaussianBlurShaderProvider); bloom.setClearColor(Color.BLACK); bloom.setDepthTestingToScene(false); bloom.setBlending(true, GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); disposables.add(bloom); rearDOFBlur = new GaussianBlur(8f, true, true, gaussianBlurShaderProvider); rearDOFBlur.setDepthTestingToScene(true); rearDOFBlur.setBlending(false, 0, 0); disposables.add(rearDOFBlur); cam = new DepthOfFieldCamera(0.10f, 3.5f, 1f, 28f); needFinishCreate = true; firstFrameDrawn = false; //Enable point rendering for use when flake particles setting is off. Gdx.gl.glEnable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE); if (Gdx.app.getType() == Application.ApplicationType.Desktop) { Gdx.gl.glEnable(0x8861); // GL_POINT_OES } }
From source file:com.cyphercove.doublehelix.Particle.java
License:Apache License
public Particle(TextureRegion textureRegion, Texture pointTexture) { super();//from w ww . j a va 2s. c o m decal = new DecalPlus(); decal.setTextureRegion(textureRegion); decal.setBlending(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); point = new BillboardDecal(); point.setTexture(pointTexture); point.setBlending(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); }
From source file:com.cyphercove.doublehelix.ParticleGroupStrategy.java
License:Apache License
@Override public void beforeGroup(int group, Array<Decal> contents) { Gdx.gl.glEnable(GL20.GL_BLEND);//from ww w . j a v a2 s . co m Gdx.gl.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_COLOR); contents.sort(cameraSorter); tmpColor.set(Settings.backgroundColor).lerp(Color.WHITE, WHITENESS); shader.begin(); shader.setUniformMatrix("u_projTrans", camera.combined); shader.setUniformi("u_texture", 0); shader.setUniformf("u_baseColor", tmpColor); }
From source file:com.cyphercove.doublehelix.ParticleGroupStrategy.java
License:Apache License
@Override public void beforeBillboardGroup(int group, Array<BillboardDecal> contents) { Gdx.gl.glEnable(GL20.GL_BLEND);//from ww w .j a v a 2s . co m Gdx.gl.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_COLOR); contents.sort(billboardCameraSorter); tmpColor.set(Settings.backgroundColor).lerp(Color.WHITE, WHITENESS); billboardShader.begin(); billboardShader.setUniformMatrix("u_projTrans", camera.combined); billboardShader.setUniformi("u_texture", 0); billboardShader.setUniformf("u_baseColor", tmpColor); }
From source file:com.esotericsoftware.spine.superspineboy.View.java
License:Open Source License
void render() { viewport.apply();/*w w w . java 2 s. co m*/ Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (ui.bgButton.isChecked()) { mapRenderer.setBlending(false); mapRenderer.render(mapLayersOpaque1); mapRenderer.setBlending(true); mapRenderer.render(mapLayersBackground2); } batch.begin(); // Draw enemies. for (Enemy enemy : model.enemies) { enemy.view.skeleton.getColor().a = Math.min(1, enemy.deathTimer / Enemy.fadeTime); skeletonRenderer.draw(batch, enemy.view.skeleton); } // Draw player. if (player.collisionTimer < 0 || (int) (player.collisionTimer / flashTime) % 3 != 0) skeletonRenderer.draw(batch, player.view.skeleton); batch.end(); if (ui.bgButton.isChecked()) { mapRenderer.setBlending(false); mapRenderer.render(mapLayersOpaque3); mapRenderer.setBlending(true); mapRenderer.render(mapForegroundLayers4); } batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE); batch.begin(); // Draw bullets. TextureRegion bulletRegion = assets.bulletRegion; float bulletWidth = bulletRegion.getRegionWidth() * scale; float bulletHeight = bulletRegion.getRegionHeight() * scale / 2; for (int i = 2, n = model.bullets.size; i < n; i += 5) { float x = model.bullets.get(i), y = model.bullets.get(i + 1); float angle = model.bullets.get(i + 2); float vx = MathUtils.cosDeg(angle); float vy = MathUtils.sinDeg(angle); // Adjust position so bullet region is drawn with the bullet position in the center of the fireball. x -= vx * bulletWidth * 0.65f; y -= vy * bulletWidth * 0.65f; x += vy * bulletHeight / 2; y += -vx * bulletHeight / 2; batch.draw(bulletRegion, x, y, 0, 0, bulletWidth, bulletHeight, 1, 1, angle); } // Draw hit markers. TextureRegion hitRegion = assets.hitRegion; Color color = batch.getColor().set(1, 1, 1, 1); float hitWidth = hitRegion.getRegionWidth() * scale; float hitHeight = hitRegion.getRegionWidth() * scale; for (int i = hits.size - 4; i >= 0; i -= 4) { float time = hits.get(i); float x = hits.get(i + 1); float y = hits.get(i + 2); float angle = hits.get(i + 3); color.a = time / bulletHitTime; batch.setColor(color); float vx = MathUtils.cosDeg(angle); float vy = MathUtils.sinDeg(angle); // Adjust position so bullet region is drawn with the bullet position in the center of the fireball. x += vy * bulletHeight * 0.2f; y += -vx * bulletHeight * 0.2f; batch.draw(hitRegion, x - hitWidth / 2, y, hitWidth / 2, 0, hitWidth, hitHeight, 1, 1, angle); } batch.setColor(Color.WHITE); batch.end(); batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); if (ui.bgButton.isChecked()) mapRenderer.render(mapForegroundLayers5); ui.render(); }
From source file:com.github.fauu.helix.graphics.ParticleEmitter.java
License:Apache License
public void draw(Batch batch) { if (premultipliedAlpha) { batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); } else if (additive) { batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE); } else {/*from www. j a va 2 s .c o m*/ batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); } Particle[] particles = this.particles; boolean[] active = this.active; for (int i = 0, n = active.length; i < n; i++) { if (active[i]) particles[i].draw(batch); } if (cleansUpBlendFunction && (additive || premultipliedAlpha)) batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); }
From source file:com.github.fauu.helix.graphics.ParticleEmitter.java
License:Apache License
/** Updates and draws the particles. This is slightly more efficient than calling {@link #update(float, float, float)} and * {@link #draw(batch)} separately. */ public void draw(Batch batch, float delta) { accumulator += delta * 1000;// w ww . j ava 2 s . c om if (accumulator < 1) { draw(batch); return; } int deltaMillis = (int) accumulator; accumulator -= deltaMillis; if (premultipliedAlpha) { batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); } else if (additive) { batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE); } else { batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); } Particle[] particles = this.particles; boolean[] active = this.active; int activeCount = this.activeCount; for (int i = 0, n = active.length; i < n; i++) { if (active[i]) { Particle particle = particles[i]; if (updateParticle(particle, 0, 0, delta, deltaMillis)) particle.draw(batch); else { active[i] = false; activeCount--; } } } this.activeCount = activeCount; if (cleansUpBlendFunction && (additive || premultipliedAlpha)) batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); if (delayTimer < delay) { delayTimer += deltaMillis; return; } if (firstUpdate) { firstUpdate = false; addParticle(); } if (durationTimer < duration) durationTimer += deltaMillis; else { if (!continuous || allowCompletion) return; restart(); } emissionDelta += deltaMillis; float emissionTime = emission + emissionDiff * emissionValue.getScale(durationTimer / (float) duration); if (emissionTime > 0) { emissionTime = 1000 / emissionTime; if (emissionDelta >= emissionTime) { int emitCount = (int) (emissionDelta / emissionTime); emitCount = Math.min(emitCount, maxParticleCount - activeCount); emissionDelta -= emitCount * emissionTime; emissionDelta %= emissionTime; addParticles(emitCount); } } if (activeCount < minParticleCount) addParticles(minParticleCount - activeCount); }
From source file:com.lyeeedar.Roguelike3D.Game.LevelObjects.LevelObject.java
License:Open Source License
public static LevelObject checkObject(AbstractObject ao, float x, float y, float z, Level level, MonsterEvolver evolver) {/*from ww w . j a v a 2 s . c om*/ LevelObject lo = null; if (ao.type == ObjectType.STATIC) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Static(ao, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Static(ao, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Static(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao); } } else if (ao.type == ObjectType.DOOR_UNLOCKED) { lo = new Door(ao, new Color(1, 1, 1, 1), "tex+", (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, 1.0f, GL20.GL_TRIANGLES, "cube", "1", "1", "1"); } else if (ao.type == ObjectType.FIRE_CAMP) { lo = new Static(false, x, y, z, ao); lo.shortDesc = ao.shortDesc; lo.longDesc = ao.longDesc; ParticleEffect effect = new ParticleEffect(15); ParticleEmitter flame = new ParticleEmitter(2, 2, 0.01f, 1.0f, 0.0f, 1.0f, 0, GL20.GL_SRC_ALPHA, GL20.GL_ONE, "f", "name"); flame.createBasicEmitter(2, 1, new Color(0.8f, 0.9f, 0.1f, 1.0f), new Color(1.0f, 0.0f, 0.0f, 1.0f), 0, 3.5f, 0); flame.setSpriteTimeline(true, new float[] { 0, 0 }, new float[] { 2, 2 }); flame.addLight(true, 0.07f, 0.5f, Color.ORANGE, true, 0, 2, 0); flame.calculateParticles(); effect.addEmitter(flame, 2, 0f, 2); effect.create(); lo.addParticleEffect(effect); } else if (ao.type == ObjectType.FIRE_TORCH) { // // lo = new Static(false, x, y, z, ao); // lo.shortDesc = ao.shortDesc; // lo.longDesc = ao.longDesc; // // ParticleEmitter p = new ParticleEmitter(x-0.3f, y+1.5f, z-0.3f, 1, 1, 1, 0.05f, 1); // p.setTexture("texf", new Vector3(0.0f, 2.0f, 0.0f), new Colour(0.7f, 0.9f, 0.3f, 1.0f), new Colour(1.0f, 0.0f, 0.0f, 1.0f), true, 0.5f, 1.5f, false, true); // // level.getParticleEmitters().add(p); // lo.addParticleEmitter(p); } else if (ao.type == ObjectType.STAIR_UP) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("model")) { lo = new Stair(ao, GameData.getCurrentLevelContainer().getUpLevel(), colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Stair(ao, GameData.getCurrentLevelContainer().getUpLevel(), colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else if (ao.type == ObjectType.STAIR_DOWN) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("model")) { lo = new Stair(ao, GameData.getCurrentLevelContainer().getDownLevel(), colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Stair(ao, GameData.getCurrentLevelContainer().getDownLevel(), colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else if (ao.type == ObjectType.PLAYER_PLACER) { lo = new PlayerPlacer(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao); } else if (ao.type == ObjectType.SPAWNER_0) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 0, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 0, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 0, evolver); } } else if (ao.type == ObjectType.SPAWNER_1) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 1, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 1, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 1, evolver); } } else if (ao.type == ObjectType.SPAWNER_2) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 2, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 2, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 2, evolver); } } else if (ao.type == ObjectType.SPAWNER_3) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 3, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 3, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 3, evolver); } } else if (ao.type == ObjectType.SPAWNER_4) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 4, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 4, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 4, evolver); } } else if (ao.type == ObjectType.SPAWNER_5) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 5, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 5, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 5, evolver); } } else if (ao.type == ObjectType.SPAWNER_6) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 6, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 6, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 6, evolver); } } else if (ao.type == ObjectType.SPAWNER_7) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 7, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 7, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 7, evolver); } } else if (ao.type == ObjectType.SPAWNER_8) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 8, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 8, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 8, evolver); } } else if (ao.type == ObjectType.SPAWNER_9) { if (ao.visible) { String texture = ao.texture; Color colour = ao.colour; if (ao.modelType.equalsIgnoreCase("file")) { lo = new Spawner(ao, 9, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "file", ao.modelName); } else if (ao.modelType.equalsIgnoreCase("cube")) { lo = new Spawner(ao, 9, evolver, colour, texture, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao.modelScale, GL20.GL_TRIANGLES, "cube", "" + ao.modelDimensions[0], "" + ao.modelDimensions[1], "" + ao.modelDimensions[2]); } } else { lo = new Spawner(false, (ao.x) * GameData.BLOCK_SIZE, 0, (ao.z) * GameData.BLOCK_SIZE, ao, 9, evolver); } } return lo; }
From source file:com.mob.dao.objects.Map.java
License:Open Source License
/** * Renders a map layer to it's internal FrameBuffer Object * * @param layer/*w w w . j a v a 2s . c o m*/ * @return void */ public void renderLayerToBuffer(int layer) { int width = (int) (Map.MAX_MAP_SIZE_WIDTH * Map.TILE_PIXEL_WIDTH); int height = (int) (Map.MAX_MAP_SIZE_HEIGHT * Map.TILE_PIXEL_HEIGHT); OrthographicCamera camera = new OrthographicCamera(width, height); camera.setToOrtho(true, width, height); FrameBuffer fbo = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false); SpriteBatch sb = new SpriteBatch(); sb.setProjectionMatrix(camera.combined); fbo.begin(); sb.enableBlending(); Gdx.gl.glBlendFuncSeparate(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); Gdx.gl.glViewport(0, 0, width, height); Gdx.gl.glClearColor(0, 0, 0, 0); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); sb.begin(); this.renderLayer(sb, layer); sb.end(); fbo.end(); this.bufferedLayer = fbo.getColorBufferTexture(); }
From source file:com.shatteredpixel.shatteredpixeldungeon.effects.Beam.java
License:Open Source License
@Override public void draw() { Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE); super.draw(); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); }