List of usage examples for com.badlogic.gdx.graphics.g3d.decals DecalBatch DecalBatch
public DecalBatch(int size, GroupStrategy groupStrategy)
From source file:com.cyphercove.doublehelix.MainRenderer.java
License:Apache License
private void finishCreate() { needFinishCreate = false;//from w w w . j ava 2s .c o m modelBatch = new ModelBatch(); disposables.add(modelBatch); environment = new Environment(); assets = new AssetManager(); disposables.add(assets); TextureLoader.TextureParameter trilinearRepeatTextureParams = new TextureLoader.TextureParameter(); trilinearRepeatTextureParams.format = Pixmap.Format.RGBA8888; trilinearRepeatTextureParams.magFilter = Texture.TextureFilter.Linear; trilinearRepeatTextureParams.minFilter = Texture.TextureFilter.MipMapLinearLinear; trilinearRepeatTextureParams.wrapU = Texture.TextureWrap.Repeat; trilinearRepeatTextureParams.wrapV = Texture.TextureWrap.Repeat; trilinearRepeatTextureParams.genMipMaps = true; assets.load(HELIX_NORMAL_AO_TEXTURE, Texture.class, trilinearRepeatTextureParams); assets.load(PARTICLE_A_TEXTURE, Texture.class, trilinearRepeatTextureParams); TextureLoader.TextureParameter bilinearClampedTextureParams = new TextureLoader.TextureParameter(); bilinearClampedTextureParams.format = Pixmap.Format.RGBA8888; bilinearClampedTextureParams.magFilter = Texture.TextureFilter.Linear; bilinearClampedTextureParams.minFilter = Texture.TextureFilter.MipMapLinearNearest; bilinearClampedTextureParams.wrapU = Texture.TextureWrap.ClampToEdge; bilinearClampedTextureParams.wrapV = Texture.TextureWrap.ClampToEdge; bilinearClampedTextureParams.genMipMaps = true; assets.load(BG_GLOW_TEXTURE, Texture.class, bilinearClampedTextureParams); assets.load(BG_BLOOM_TEXTURE, Texture.class, bilinearClampedTextureParams); assets.load(POINT_PARTICLE_TEXTURE, Texture.class, bilinearClampedTextureParams); TextureLoader.TextureParameter borderTexParams = new TextureLoader.TextureParameter(); borderTexParams.format = Pixmap.Format.Alpha; borderTexParams.magFilter = Texture.TextureFilter.Linear; borderTexParams.minFilter = Texture.TextureFilter.Linear; assets.load(FILM_BORDER_TEXTURE, Texture.class, borderTexParams); TextureLoader.TextureParameter noiseTexParams = new TextureLoader.TextureParameter(); noiseTexParams.format = Pixmap.Format.Alpha; noiseTexParams.magFilter = Texture.TextureFilter.Nearest; noiseTexParams.minFilter = Texture.TextureFilter.Nearest; noiseTexParams.wrapU = Texture.TextureWrap.Repeat; noiseTexParams.wrapV = Texture.TextureWrap.Repeat; assets.load(FILM_NOISE_TEXTURE, Texture.class, noiseTexParams); TextureLoader.TextureParameter scanlineTexParams = new TextureLoader.TextureParameter(); scanlineTexParams.format = Pixmap.Format.Alpha; scanlineTexParams.magFilter = Texture.TextureFilter.Linear; scanlineTexParams.minFilter = Texture.TextureFilter.Linear; scanlineTexParams.wrapU = Texture.TextureWrap.Repeat; scanlineTexParams.wrapV = Texture.TextureWrap.Repeat; assets.load(SCANLINE_TEXTURE, Texture.class, scanlineTexParams); assets.load(HELIX_MODEL, Model.class); assets.load(BG_MODEL, Model.class); assets.load(BG_BLOOM_MODEL, Model.class); assets.finishLoading(); helixNormalAOTexture = assets.get(HELIX_NORMAL_AO_TEXTURE, Texture.class); backgroundTexture = assets.get(BG_GLOW_TEXTURE, Texture.class); backgroundBloomTexture = assets.get(BG_BLOOM_TEXTURE, Texture.class); Texture filmNoiseTexture = assets.get(FILM_NOISE_TEXTURE, Texture.class); Texture filmBorderTexture = assets.get(FILM_BORDER_TEXTURE, Texture.class); Texture scanlineTexture = assets.get(SCANLINE_TEXTURE, Texture.class); Model helixModel = assets.get(HELIX_MODEL, Model.class); mainHelixModelInstance = new ModelInstance(helixModel); mainHelixModelInstance.userData = Settings.frontHelixColor; mainHelixTransformManager = new TransformManager(mainHelixModelInstance); rearHelixModelInstance = new ModelInstance(helixModel); rearHelixModelInstance.userData = Settings.rearHelixColor; rearHelixTransformManager = new TransformManager(rearHelixModelInstance); rearHelixTransformManager.eulers.set(12.477f, -96.843f, -7.902f); rearHelixTransformManager.position.set(7.95135f, -5.46558f, 9.82413f); Model bgModel = assets.get(BG_MODEL, Model.class); backgroundModelInstance = new ModelInstance(bgModel); Model bgBloomModel = assets.get(BG_BLOOM_MODEL, Model.class); backgroundBloomModelInstance = new ModelInstance(bgBloomModel); sssShader = new SubsurfaceScatteringShader(helixNormalAOTexture, (new Vector3(-0.6f, 1f, 1f)).nor()); sssShader.init(); disposables.add(sssShader); backgroundShader = new BackgroundShader(backgroundTexture); backgroundShader.init(); disposables.add(backgroundShader); unlitShader = new UnlitShader(backgroundBloomTexture); unlitShader.init(); disposables.add(unlitShader); blackShader = new BlackShader(); blackShader.init(); disposables.add(blackShader); bloomShaderProgram = loadShaderProgram("bloom"); disposables.add(bloomShaderProgram); particleATexture = assets.get(PARTICLE_A_TEXTURE, Texture.class); particleATextureRegion = new TextureRegion(particleATexture); particlePointTexture = assets.get(POINT_PARTICLE_TEXTURE, Texture.class); particles = new Particles(particlePointTexture, particleATextureRegion, cam); InputMultiplexer inputMultiplexer = new InputMultiplexer(inputAdapter, particles.inputAdapter); Gdx.input.setInputProcessor(inputMultiplexer); particleGroupStrategy = new ParticleGroupStrategy(cam); disposables.add(particleGroupStrategy); decalBatch = new DecalBatch(Particles.MAX_PARTICLES, particleGroupStrategy); disposables.add(decalBatch); billboardDecalBatch = new BillboardDecalBatch(Particles.MAX_PARTICLES, particleGroupStrategy); disposables.add(billboardDecalBatch); filmGrain = new FilmGrain(filmNoiseTexture, filmBorderTexture, scanlineTexture, false); disposables.add(filmGrain); filmGrainForBloom = new FilmGrain(filmNoiseTexture, filmBorderTexture, scanlineTexture, true); disposables.add(filmGrainForBloom); }