List of usage examples for com.badlogic.gdx.graphics.g3d.attributes ColorAttribute AmbientLight
long AmbientLight
To view the source code for com.badlogic.gdx.graphics.g3d.attributes ColorAttribute AmbientLight.
Click Source Link
From source file:br.com.raphaelbruno.game.zombieinvaders.vr.model.ScreenBase.java
License:Apache License
private void setupEnviroment() { camera = new CardboardCamera(); camera.position.set(0f, CAMERA_Y, 0f); camera.lookAt(0f, CAMERA_Y, -1f);//from w w w . j av a 2 s. c o m camera.near = Z_NEAR; camera.far = Z_FAR; environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 0.5f)); environment.set(new ColorAttribute(ColorAttribute.Fog, BACKGROUND_COLOR.r, BACKGROUND_COLOR.g, BACKGROUND_COLOR.b, BACKGROUND_COLOR.a)); environment.add(new DirectionalLight().set(0.6f, 0.6f, 0.4f, -0.5f, -0.6f, -0.5f)); environment.add(new DirectionalLight().set(0.6f, 0.6f, 0.4f, 0.5f, -0.6f, 0.5f)); }
From source file:com.andgate.ikou.view.GameScreen.java
License:Open Source License
private void createEnvironment() { environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f)); environment.set(new ColorAttribute(ColorAttribute.Fog, 1f, 1f, 1f, 1f)); environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); shadowLight = new DirectionalShadowLight(1024, 1024, 60f, 60f, .1f, 50f); shadowLight.set(0.8f, 0.8f, 0.8f, -1f, -.8f, -.2f); //environment.shadowMap = shadowLight; shadowBatch = new ModelBatch(new DepthShaderProvider()); }
From source file:com.badlogic.gdx.tests.dragome.examples.GearsDemo.java
@Override public void create() { environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .2f, .2f, .2f, 2f)); // environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, 0f, -0.5f, -0.5f)); sl = new PointLight().setPosition(-5, 10, -6).setColor(1, 1, 1, 1).setIntensity(150); // sl2 = new PointLight().setPosition(0, 7, 5).setColor(0.3f, 0.8f, 0.3f, 1) // .setIntensity(20); //// w w w . j a v a 2 s .c om // sl3 = new PointLight().setPosition(0, 9, 6).setColor(0.3f, 0.3f, 0.8f, 1) // .setIntensity(20); environment.add(sl); // environment.add(sl2); // environment.add(sl3); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(-10, 3, 10f); cam.lookAt(-3, 0, 0); cam.near = 1f; cam.far = 100f; cam.update(); cameraController = new CameraInputController(cam); cameraController.autoUpdate = false; cameraController.forwardTarget = false; cameraController.translateTarget = false; Gdx.input.setInputProcessor(new InputMultiplexer(cameraController)); time = TimeUtils.millis(); viewport = new ScreenViewport(cam); guiViewport = new ScreenViewport(); DefaultShaderProvider defaultShaderProvider = new DefaultShaderProvider(); modelBatch = new ModelBatch(defaultShaderProvider); ModelBuilder modelBuilder = new ModelBuilder(); model1 = gear(modelBuilder, 1.0f, 4.0f, 1.0f, 20, 0.7f, Color.RED); gear1 = new ModelInstance(model1); model2 = gear(modelBuilder, 0.5f, 2.0f, 2.0f, 10, 0.7f, Color.GREEN); gear2 = new ModelInstance(model2); model3 = gear(modelBuilder, 1.3f, 2.0f, 1.5f, 10, 0.7f, Color.BLUE); gear3 = new ModelInstance(model3); font = new BitmapFont(); batch = new SpriteBatch(); lightModel = modelBuilder.createSphere(1, 1, 1, 10, 10, new Material(ColorAttribute.createDiffuse(1, 1, 1, 1)), Usage.Position); lightModel.nodes.get(0).parts.get(0).setRenderable(pLight = new Renderable()); }
From source file:com.badlogic.gdx.tests.ViewportTest3.java
License:Apache License
public void create() { modelBatch = new ModelBatch(); modelBuilder = new ModelBuilder(); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.3f, 0.3f, 0.3f, 1.f)); shadowLight = new DirectionalLight(); shadowLight.set(0.8f, 0.8f, 0.8f, -0.5f, -1f, 0.7f); environment.add(shadowLight);//from ww w .jav a 2 s .c om modelBatch = new ModelBatch(); camera = new PerspectiveCamera(); camera.fieldOfView = 67; camera.near = 0.1f; camera.far = 300f; camera.position.set(0, 0, 100); camera.lookAt(0, 0, 0); viewports = ViewportTest1.getViewports(camera); viewport = viewports.first(); names = ViewportTest1.getViewportNames(); name = names.first(); ModelBuilder modelBuilder = new ModelBuilder(); Model boxModel = modelBuilder.createBox(50f, 50f, 50f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position | Usage.Normal); boxInstance = new ModelInstance(boxModel); boxInstance.transform.rotate(1, 0, 0, 30); boxInstance.transform.rotate(0, 1, 0, 30); Gdx.input.setInputProcessor(new InputAdapter() { public boolean keyDown(int keycode) { if (keycode == Input.Keys.SPACE) { int index = (viewports.indexOf(viewport, true) + 1) % viewports.size; name = names.get(index); viewport = viewports.get(index); resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); } return false; } }); }
From source file:com.barconr.games.marblegame.Maze3Drenderer.java
License:Apache License
public Maze3Drenderer() { modelBatch = new ModelBatch(); instances = new ArrayList<ModelInstance>(); modelBuilder = new ModelBuilder(); createModels(Assets.mazemap);//from w w w.j a va2s . c o m cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); float mapPixelWidth = layerWidth * CUBE_SIZE; float mapPixelHeight = layerHeight * CUBE_SIZE; cam.position.set((float) Gdx.graphics.getWidth() / 2, (float) Gdx.graphics.getHeight() / 2, 100f); cam.lookAt((float) Gdx.graphics.getWidth() / 2, (float) Gdx.graphics.getHeight() / 2, 0); cam.near = 0.1f; cam.far = 150f; cam.update(); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f)); environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); }
From source file:com.github.fauu.helix.datum.Ambience.java
License:Open Source License
public void setDefault() { environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1, 1, 1, 1)); bloom = new Bloom(); bloom.setBloomIntesity(.8f);//from w ww .j a va 2 s .c o m bloom.setOriginalIntesity(1); particleEffect = null; }
From source file:com.github.fauu.helix.manager.WeatherMan.java
License:Open Source License
public void setToType(WeatherType type) { Environment environment = new Environment(); Bloom bloom = null;/* ww w. j ava2s . co m*/ ParticleEffect precipitationEffect = null; switch (type) { case NONE: environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1, 1, 1, 1)); break; case SUNNY: bloom = new Bloom(); bloom.setBloomIntesity(1.1f); bloom.setOriginalIntesity(1); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1, 1, 1, 1)); break; case OVERCAST: bloom = new Bloom(); bloom.setBloomIntesity(.6f); bloom.setOriginalIntesity(.8f); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .8f, .8f, .8f, 1)); break; case RAINSTORM: bloom = new Bloom(); bloom.setBloomIntesity(.2f); bloom.setOriginalIntesity(.2f); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .5f, .5f, .6f, 1)); environment.set(new ColorAttribute(ColorAttribute.Fog, 1, 1, 1, 1)); precipitationEffect = new ParticleEffect(); precipitationEffect.load(Gdx.files.internal("effect/rain.p"), Gdx.files.internal("effect")); precipitationEffect.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2); precipitationEffect.start(); break; default: throw new IllegalStateException(); } weather.setEnvironment(environment); weather.setBloom(bloom); weather.setParticleEffect(precipitationEffect); }
From source file:com.mygdx.game.utilities.ModelFactory.java
License:Apache License
public static Model buildBillboardModel(Texture texture, float width, float height) { TextureRegion textureRegion = new TextureRegion(texture, texture.getWidth(), texture.getHeight()); Material material = new Material(); material.set(new TextureAttribute(TextureAttribute.Diffuse, textureRegion)); material.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE)); material.set(new BlendingAttribute()); return ModelFactory.buildPlaneModel(width, height, material, 0, 0, 1, 1); }
From source file:com.nsoft.boxuniverse.world.BaseWorld.java
License:Open Source License
public BaseWorld(WorldDefinition def, boolean needGeneration) { this.def = def; layers = new Layer[def.NumLayers]; batch = new SpriteBatch(); background = new Texture(def.BackGroundPath); b = new ModelBatch(); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(0, 0, 10);/*ww w . ja v a 2s . c o m*/ cam.lookAt(0, 0, 0); cam.near = 1f; cam.far = 300f; cam.update(); e = new Environment(); e.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f)); e.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); for (int i = 0; i < layers.length; i++) { layers[i] = new Layer(i, needGeneration); } // debug(); }
From source file:com.qualcomm.vuforia.samples.libGDX.screens.ChooseBallScreen.java
License:Apache License
@Override public void create() { if (app.createServerScreen.create != null) { app.createServerScreen.create.resetUserChoiceState(); app.createServerScreen.create.startBallsDistribute(); } else if (app.joinServerScreen.join != null) { PropertiesSingleton.getInstance() .initRandomCoinPosition(PropertiesSingleton.getInstance().getChosenIsland()); //PropertiesSingleton.getInstance().initRandomPowerupPosition(PropertiesSingleton.getInstance().getChosenIsland()); }//from w w w . j a v a 2s. c o m modelBatch = new ModelBatch(); fps = new FPSLogger(); Gdx.app.log("height: " + Gdx.graphics.getHeight() + "", "width: " + Gdx.graphics.getWidth() + ""); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f)); environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); environment.add((shadowLight = new DirectionalShadowLight(1024, 1024, 30f, 30f, 1f, 100f)).set(0.8f, 0.8f, 0.8f, -1f, -.8f, -.2f)); environment.shadowMap = shadowLight; shadowBatch = new ModelBatch(new DepthShaderProvider()); cam = new VuforiaCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.near = 0.1f; cam.far = 300f; cam.update(); instances = new Array<ModelInstance>(); // instances.add(new ModelInstance(model, "floor")); // instances.add(ball = new Ball(model, "ball")); // ball.setPosition(1f, 1f, 1f); this.stage = new Stage(new StretchViewport(Gdx.graphics.getHeight(), Gdx.graphics.getHeight())); initFonts(); // BitmapFont font = new BitmapFont(); Label.LabelStyle labelStyle = new Label.LabelStyle(app.font60, Color.WHITE); Label.LabelStyle labelStyle2 = new Label.LabelStyle(app.font60, Color.WHITE); Label labelTitle = new Label("CHOOSE BALL ", labelStyle); LabelScore = new Label("apple", labelStyle2); // labelTitle.setScale(Gdx.graphics.getWidth() / 10, Gdx.graphics.getHeight() / 10); Gdx.app.log("width: " + Gdx.graphics.getWidth(), "height: " + Gdx.graphics.getHeight()); labelTitle.setPosition(Gdx.graphics.getHeight() / 2 - labelTitle.getWidth() / 2, Gdx.graphics.getHeight() - labelTitle.getHeight() * 2); LabelScore.setPosition(Gdx.graphics.getHeight() - (LabelScore.getWidth() + Gdx.graphics.getHeight() / 50), LabelScore.getHeight() / 2); swipe = new Image(new Sprite(new Texture(Gdx.files.internal("swipe2.png")))); swipe.addAction(Actions.sequence(Actions.fadeOut(0.00000001f), Actions.delay(2), Actions.fadeIn(1))); // swipe.setSize((stage.getWidth()) / 6, stage.getHeight() / 6); swipe.setPosition(Gdx.graphics.getHeight() / 2 - swipe.getWidth() / 2, Gdx.graphics.getHeight() / 2 - swipe.getHeight() / 2); stage.addActor(swipe); accept = new Image(new Sprite(new Texture(Gdx.files.internal("accept.png")))); // accept.addAction(Actions.sequence(Actions.fadeOut(0.00000001f), Actions.delay(2), Actions.fadeIn(1))); accept.setSize((stage.getWidth()) / 10, stage.getWidth() / 10); accept.setPosition(Gdx.graphics.getHeight() / 2 - accept.getWidth() / 2, accept.getHeight()); // stage.addActor(accept); stage.addActor(LabelScore); stage.addActor(labelTitle); TextureAtlas atlasVote = new TextureAtlas("Buttons.pack"); Skin voteSkin = new Skin(atlasVote); ImageButton.ImageButtonStyle voteButtonStyle = new ImageButton.ImageButtonStyle(); //Instaciate voteButtonStyle.up = voteSkin.getDrawable("ready"); //Set image for not pressed button voteButtonStyle.checked = voteSkin.getDrawable("notready"); //Set image for not pressed button readyButton = new ImageButton(voteButtonStyle); readyButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (app.joinServerScreen.join != null) { app.joinServerScreen.join.sendBallChoice(ballNames.get(currentBall)); } else if (app.createServerScreen.create != null) { app.createServerScreen.create.serverUser.setBallChoice(ballNames.get(currentBall)); app.createServerScreen.create.serverUser.setChosen(true); app.createServerScreen.create.notifyBalls(); } } }); readyButton.setSize((stage.getWidth()) / 5, stage.getWidth() / 10); readyButton.setPosition(Gdx.graphics.getHeight() / 2 - readyButton.getWidth() / 2, 0); stage.addActor(readyButton); for (int i = 0; i < ballNames.size; i++) { Model tmpModel = assets.get("3d/balls/" + ballNames.get(i) + ".g3db", Model.class); for (int k = 0; k < tmpModel.meshes.size; k++) tmpModel.meshes.get(k).scale(5, 5, 5); // String id = tmpModel.nodes.get(0).id; // Node node = tmpModel.getNode(id); // node.scale.set(30f, 30f, 30f); // node.translation.set(0, 15f, 0); // tmpModel.calculateTransforms(); instances.add(new ModelInstance(tmpModel)); } InputMultiplexer inputMultiplexer = new InputMultiplexer(); inputMultiplexer.addProcessor(stage); inputMultiplexer.addProcessor(new GestureDetector(0.0f, 0.0f, 0.0f, 5f, this)); Gdx.input.setInputProcessor(inputMultiplexer); }