public GameScreen(){ spriteBatch = new SpriteBatch(); // buffer ok texture = new Texture(Gdx.files.internal("bg/gameBG.jpg")); viewMatrix = new Matrix4(); // matriz de visualização tranMatrix = new Matrix4(); // matriz de escala // camera camera = new PerspectiveCamera(67.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.near = 0.1f; camera.far = 1000f; camera.position.set(0, 5, 10); camera.lookAt(0, 5, 0); camera.update(); // ambiente environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1,1,1,1)); // renderizador modelBatch = new ModelBatch(); p1 = new Player(1); p2 = new Player(2); }
private void addBackground(){ decalBackground = Decal.newDecal(new TextureRegion(managerAssets.getAssetsCrafting().getTexture(NameFiles.backgroundCrafting))); decalBackground.setDimensions(100,200); decalBackground.setPosition(0,0,0); environment = new Environment(); // environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f)); environment.set(new ColorAttribute(ColorAttribute.Diffuse)); environment.set(new ColorAttribute(ColorAttribute.Specular)); environment.set(new ColorAttribute(ColorAttribute.Reflection)); environment.add(new DirectionalLight().set(0.51f, 0.5f, 0.5f, 0f, -2f, -30f)); Model model = managerAssets.getAssetsRaider().getModel(NameFiles.raiderFull); model.nodes.get(2).translation.set(-12,28.6f,-5.5f); // model.nodes.get(0).translation.set(0,28f,29.2f); // model.nodes.get(2).translation.set(0,13,-1); instance = new ModelInstance(model); instance.transform.trn(0,-20,25).rotate(0,1,0,-25); instance.transform.scale(1.5f,1.5f,1.5f); }
public Renderer(VuforiaRenderer arRenderer) { lights = new Environment(); lights.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE)); camera = new PerspectiveCamera(60, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.near = 1.0F; camera.far = 1000.0F; //set camera into "Vuforia - style" direction camera.position.set(new Vector3(0,0,0)); camera.lookAt(new Vector3(0,0,1)); this.vuforiaRenderer = arRenderer; modelBatch = new ModelBatch(); }
public GameModel(PerspectiveCamera cam, boolean [][][] collision){ //setup the model instances parts = new Array<ModelInstance>(); frame = new Array<ModelInstance>(); shadow = new Array<ModelInstance>(); //setup environment 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)); //setup collision matrix matrix = collision; //setup camera camera = cam; }
public Renderer () { try { lights = new Environment(); lights.add(new DirectionalLight().set(Color.WHITE, new Vector3(-1, -0.5f, 0).nor())); spriteBatch = new SpriteBatch(); modelBatch = new ModelBatch(); backgroundTexture = new Texture(Gdx.files.internal("data/planet.jpg"), Format.RGB565, true); backgroundTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear); font = new BitmapFont(Gdx.files.internal("data/font10.fnt"), Gdx.files.internal("data/font10.png"), false); camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); } catch (Exception ex) { ex.printStackTrace(); } }
public void render(ModelBatch batch, Environment environment) { if (drawShapes) { batch.render(hub.modelInstance, environment); batch.render(rim.modelInstance, environment); for (int i = 0; i < spokesToDraw; i++) { spokes.get(i).updateSpokeRender(); batch.render(spokes.get(i).modelInstance, environment); } // spokes.forEach(s -> batch.render(s.modelInstance, environment)); // bulletWorld.updateAabbs(); } if (debugDrawer.getDebugMode() > 0) { Camera camera = batch.getCamera(); batch.flush(); debugDrawer.begin(camera); bulletWorld.debugDrawWorld(); debugDrawer.end(); } }
public void render(ModelBatch batch, Environment environment) { if (drawShapes) { for (WorldEntity entity : entities) { batch.render(entity.instance, environment); } batch.render(instances); } if (getDebugMode() > 0) { Camera camera = batch.getCamera(); batch.flush(); debugDrawer.begin(camera); bulletWorld.debugDrawWorld(); debugDrawer.end(); // batch.begin(camera); } }
/** * Renderer for all visible 3D components. * * @param camera * @param boardController * handles interactions between the behind the scenes logic and * what is drawn * @param piecePlacement * array of 64 shorts defining the contents of all 64 board * locations */ public PerspectiveRenderer(Camera camera, BoardController boardController, short[] piecePlacement) { mCamera = camera; mBoardController = boardController; mShadowBatch = new ModelBatch(new DepthShaderProvider()); mCubeMapBatch = new ModelBatch(Gdx.files.internal("shaders/cubevertex.glsl"), Gdx.files.internal("shaders/cubefragment.glsl")); mBackgroundBatch = new ModelBatch(); mEnvironment = new Environment(); mBackgroundEnvironment = new Environment(); mDrawables = new Array<ABaseObject>(); mGraveyard = new ChessPieceGraveyard(); mLightDirection = new Vector3(11.0f, -9.0f, 11.0f); configureEnvironments(); createGameObjects(piecePlacement); }
public void setEnvironmentLights(Array<BaseLight<?>> lights, Vector3 sunDirection) { environment = new Environment(); environment.add((shadowLight = new DirectionalShadowLight( GameSettings.SHADOW_MAP_WIDTH, GameSettings.SHADOW_MAP_HEIGHT, GameSettings.SHADOW_VIEWPORT_WIDTH, GameSettings.SHADOW_VIEWPORT_HEIGHT, GameSettings.SHADOW_NEAR, GameSettings.SHADOW_FAR)) .set(GameSettings.SHADOW_INTENSITY, GameSettings.SHADOW_INTENSITY, GameSettings.SHADOW_INTENSITY, sunDirection.nor())); environment.shadowMap = shadowLight; float ambientLight = GameSettings.SCENE_AMBIENT_LIGHT; environment.set(new ColorAttribute(ColorAttribute.AmbientLight, ambientLight, ambientLight, ambientLight, 1)); for (BaseLight<?> light : lights) { environment.add(light); } }
@Override public void create () { super.create(); lights = new Environment(); lights.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.1f, 0.1f, 0.1f, 1.f)); lights.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -0.5f, -1.0f, -0.8f)); shaderProvider = new TestShaderProvider(); shaderBatch = new ModelBatch(shaderProvider); cam.position.set(1, 1, 1); cam.lookAt(0, 0, 0); cam.update(); showAxes = true; onModelClicked("g3d/shapes/teapot.g3dj"); shaderRoot = (hotLoadFolder != null && Gdx.app.getType() == ApplicationType.Desktop) ? Gdx.files.absolute(hotLoadFolder) : Gdx.files.internal("data/g3d/shaders"); }
@Override public void create () { modelBatch = new ModelBatch(); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f)); environment.set(new ColorAttribute(ColorAttribute.Fog, 0.13f, 0.13f, 0.13f, 1f)); environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(30f, 10f, 30f); cam.lookAt(0, 0, 0); cam.near = 0.1f; cam.far = 45f; cam.update(); ModelBuilder modelBuilder = new ModelBuilder(); model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position | Usage.Normal); instance = new ModelInstance(model); Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam))); }
@Override public void create () { modelBatch = new ModelBatch(new DefaultShaderProvider()); // modelBatch = new ModelBatch(); 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)); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(10f, 10f, 10f); cam.lookAt(0, 0, 0); cam.near = 0.1f; cam.far = 300f; cam.update(); ModelBuilder modelBuilder = new ModelBuilder(); model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position | Usage.Normal); instance = new ModelInstance(model); // model = new G3dModelLoader(new UBJsonReader()).loadModel(Gdx.files.internal("data/g3d/knight.g3db")); // instance = new ModelInstance(model); Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam))); }
@Override public void create() { assets = new AssetManager(); String model = "Bambo_House.g3db"; assets.load(model, Model.class); assets.finishLoading(); modelInstance = new ModelInstance(assets.get(model, Model.class), new Matrix4().setToScaling(0.6f, 0.6f, 0.6f)); DefaultShader.Config config = new Config(); config.defaultCullFace = GL20.GL_NONE; ShaderProvider shaderProvider = new DefaultShaderProvider(config); modelBatch = new ModelBatch(shaderProvider); ModelBuilder builder = new ModelBuilder(); float groundSize = 1000f; ground = new ModelInstance(builder.createRect(-groundSize, 0, groundSize, groundSize, 0, groundSize, groundSize, 0, -groundSize, -groundSize, 0, -groundSize, 0, 1, 0, new Material(), Usage.Position | Usage.Normal), new Matrix4().setToTranslation(0, -0.01f, 0)); 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)); VirtualReality.renderer.listeners.add(this); // VirtualReality.head.setCyclops(true); }
/** * Sets the shadow environment */ protected void prepareShadowEnvironment() { if (GlobalConf.scene.SHADOW_MAPPING) { Environment env = mc.env; SceneGraphRenderer sgr = GaiaSky.instance.sgr; if (shadow > 0 && sgr.smTexMap.containsKey(this)) { Matrix4 combined = sgr.smCombinedMap.get(this); Texture tex = sgr.smTexMap.get(this); if (env.shadowMap == null) { if (shadowMap == null) shadowMap = new ShadowMapImpl(combined, tex); env.shadowMap = shadowMap; } shadowMap.setProjViewTrans(combined); shadowMap.setDepthMap(tex); shadow--; } else { env.shadowMap = null; } } else { mc.env.shadowMap = null; } }
public Stage3d (float width, float height, boolean keepAspectRatio) { this.width = width; this.height = height; root = new Group3d(); root.setStage3d(this); modelBatch = new ModelBatch(); camera = new Camera3d(); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.9f, 0.9f, 0.9f, 1f)); environment.add(new DirectionalLight().set(0.8f, 0f, 0f, -1f, -0.8f, -0.2f)); setViewport(width, height, keepAspectRatio); }
@Override public void render(ModelBatch batch, Environment environment, boolean minimapMode) { super.render(batch, environment, minimapMode); if ((hovered || selected) && !minimapMode && Vloxlands.wireframe) { Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); Vloxlands.shapeRenderer.setProjectionMatrix(Game.camera.combined); Vloxlands.shapeRenderer.identity(); Vloxlands.shapeRenderer.translate(posCache.x, posCache.y - boundingBox.getDimensions().y / 2 + boundingBox.getCenter().y, posCache.z); Vloxlands.shapeRenderer.rotate(1, 0, 0, 90); Vloxlands.shapeRenderer.begin(ShapeType.Line); Vloxlands.shapeRenderer.setColor(Color.GREEN); Vloxlands.shapeRenderer.circle(0, 0, workRadius, 100); Vloxlands.shapeRenderer.line(-workRadius, 0, workRadius, 0); Vloxlands.shapeRenderer.line(0, -workRadius, 0, workRadius); Vloxlands.shapeRenderer.end(); } }
@Override public void create() { modelBatch = new ModelBatch(); 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)); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(10f, 10f, 10f); cam.lookAt(0, 0, 0); cam.near = 1f; cam.far = 300f; cam.update(); camController = new CameraInputController(cam); Gdx.input.setInputProcessor(camController); ModelBuilder modelBuilder = new ModelBuilder(); model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position | Usage.Normal); instance = new ModelInstance(model); }
@Override public boolean setup() { modelBatch = new ModelBatch(new DefaultShaderProvider()); lights = new Environment(); lights.set(new ColorAttribute(ColorAttribute.AmbientLight, 1.0f, 1.0f, 1.0f, 1.f)); lights.add(new DirectionalLight().set(0.3f, 0.3f, 0.3f, 0, 1, -0.2f)); cam = new MapCamera(mMap); renderContext = new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1)); // shader = new DefaultShader(renderable.material, // renderable.mesh.getVertexAttributes(), true, false, 1, 0, 0, 0); // shader.init(); return true; }
@Override public boolean setup() { // if (assets == null) // assets = new AssetManager(); // assets.load("data/g3d/invaders.g3dj", Model.class); // loading = true; modelBatch = new ModelBatch(new DefaultShaderProvider()); lights = new Environment(); // lights.ambientLight.set(1.0f, 1.0f, 1.0f, 1f); // lights.ambientLight.set(215 / 255f, // 240 / 255f, // 51 / 255f, 1f); lights.add(new DirectionalLight().set(0.9f, 0.9f, 0.9f, 0, 1, -0.2f)); cam = new MapCamera(mMap); return true; }
@Override public void render(float delta, ModelBatch modelBatch, ShapeRenderer shapeRenderer, Environment environment) { super.render(delta, modelBatch, shapeRenderer, environment); if(laserTime > 0) { laserTime -= delta; shapeRenderer.begin(ShapeRenderer.ShapeType.Line); shapeRenderer.setColor(1, 0, 0, 1); shapeRenderer.line(transform.getTranslation(tempVector), laserTo); shapeRenderer.end(); } }
@Override public void show() { super.show(); assets = new AssetManager(); assets.load("theme/basic/campaign/scene.g3db", Model.class); modelBatch = new ModelBatch(); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f)); //environment.add(new DirectionalLight().set(1f, 1f, 1f, -1f, -1f, -1f)); addDisposables(modelBatch, assets); }
private void drawProfile() { environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f)); environment.add(new DirectionalLight().set(1f, 1f, 1f, 1f, 1f, 1f)); Model model = managerAssets.getAssetsProfile().getModel(NameFiles.profileObject); model.nodes.get(2).translation.set(0,-14.5f,9); instance = new ModelInstance(model); instance.transform.scale(0.2f,0.2f,0.2f); instance.transform.trn(0,-8f,27).rotate(0,1,0,55); decalBackground = Decal.newDecal(new TextureRegion(managerAssets.getAssetsCrafting().getTexture(NameFiles.backgroundCrafting))); decalBackground.setDimensions(75,150); decalBackground.setPosition(0,0,0); queueDisplay = QueueDisplay.getInstance(); }
public MapsScreen(GameManager game) { gameManager = game; environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f)); environment.add(new DirectionalLight().set(1f, 1f, 1f, -1f, -0.8f, -0.2f)); camera = new PerspectiveCamera(40, Width, Height); camera.lookAt(0, 0, 0); camera.far = 4000; camera.near = 1; camera.update(); pos = new Vector2[3][3]; CameraGroupStrategy cameraGroupStategy = new CameraGroupStrategy(camera); batch = new DecalBatch(cameraGroupStategy); bounds = new Bounds(); matrixPixmap = MapPixmap.getInstance(); managerAssets = ManagerAssets.getInstance(); myLocation = MyLocation.getInstance(); pointerx = new int[4]; pointery = new int[4]; compass = myLocation.getCompas(); queue = MyQueue.getInstance(); //calc bounds bounds.getCorners(matrixPixmap.getMatrix()[1][1].getLatitude(),matrixPixmap.getMatrix()[1][1].getLongitude() , 17.0, 640.0, 640.0); unitlong = (bounds.calcDisance(bounds.latSW, bounds.longSW, bounds.latSW, bounds.longNE)+bounds.calcDisance(bounds.latNE,bounds.longNE,bounds.latNE,bounds.longSW))/2.0; unitlong=600/unitlong; unitlat = bounds.calcDisance(bounds.latSW, bounds.longSW, bounds.latNE, bounds.longSW); unitlat= 600/unitlat; timerEnergy = new Timer(); informationProfile = InformationProfile.getInstance(); }
private void setupEnviroment() { camera = new CardboardCamera(); camera.position.set(0f, CAMERA_Y, 0f); camera.lookAt(0f, CAMERA_Y, -1f); 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)); }
public static void renderGui(Camera cam, EntityStatic entity, Environment environment, float deltaTime){ spriteBatch.begin(); if(entity!=null) { spriteBatch.draw( textureRegions[2].getTexture(), 0, 0, 0, 0, textureRegions[2].getRegionWidth(), textureRegions[2].getRegionHeight() * entity.timeHeld, /* Scale output height */ 1, 1, 0, textureRegions[2].getRegionX(), textureRegions[2].getRegionY(), /* Move input data position */ textureRegions[2].getRegionWidth(), textureRegions[2].getRegionHeight(), /* Scale input height */ false, false); spriteBatch.draw(textureRegions[0], 0, 0); entity.handleGuiInteraction(deltaTime, cam); } else { spriteBatch.draw(textureRegions[1], 0, 0); } spriteBatch.draw(textureRegions[3+StrategyGame.selectedProjectile.ordinal()], 0, 0); spriteBatch.end(); }
@Override public void create() { INSTANCE=this; Debug.dbg("Path: "+System.getProperty("user.dir")); 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)); staticEntityBatch = new ModelBatch(); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); float cameraDist=0.8f; cam.position.set(cameraDist,cameraDist,cameraDist); cam.lookAt(0,0,0); cam.near = 0.1f; cam.far = 300f; cam.update(); Assets.modelBuilder = new ModelBuilder(); Model world = Assets.modelBuilder.createSphere(2f,2f,2f, 80, 80, /* 80x80 seems to be enough polys to look smooth */ new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position | Usage.Normal); models.add(world); planetSurface = new ModelInstance(world); camController = new CameraController(cam); Gdx.input.setInputProcessor(camController); space=new Space(); }
public static boolean useImageBasedLighting(Environment environment) { boolean res; IBLAttribute iblAttribute = (IBLAttribute) environment.get(IBLAttribute.IrradianceType); res = iblAttribute != null && iblAttribute.textureDescription != null; return res; }
public RenderingSystem() { clearColor = Color.BLACK; fpsLogger = new FPSLogger(); environment = new Environment(); shaderProvider = new PBRShaderProvider(environment); renderer = new ModelBatch(shaderProvider); renderingInterfaces = new Array<>(); spriteBatch = new SpriteBatch(); updateFramebuffer(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); }
public static Renderable createRenderableFromMesh(Mesh mesh, Material material, Shader shader, Environment environment) { Renderable outRend=new Renderable(); outRend.meshPart.mesh=mesh; outRend.meshPart.primitiveType=GL20.GL_TRIANGLES; if(material!=null) outRend.material=material; if(environment!=null) outRend.environment=environment; outRend.meshPart.offset=0; //strada.shader=elrShader; if(shader!=null) outRend.shader=shader; outRend.meshPart.size=mesh.getNumIndices(); return outRend; }
public void draw(ModelBatch modelBatch, Environment environment, boolean pourOmbre) { for (Entity entity : managedEntities.values()) { if (!entity.removeMe && entity.onChunk != World.EMPTY && entity.onChunk != null && entity != InGame.player //Z && entity.pos.dst2(InGame.player.pos) < 14400f && (!pourOmbre || entity.pos.dst2(InGame.player.pos) < 60f * 60f)) entity.draw(modelBatch, environment, pourOmbre); } }
@Override public void draw(ModelBatch modelBatch, Environment environment, boolean pourOmbre) { if (model == null) return; if (InGame.wallhack && !pourOmbre) { InGame.shapeRenderer.setTransformMatrix(model.transform); InGame.shapeRenderer.box(-sizeBox.x * 0.5f, 0, sizeBox.z * 0.5f, sizeBox.x, sizeBox.y, sizeBox.z); } // transform.scale(size.x, size.y, size.z); // System.out.println(this); model.transform.rotate(Vector3.X, -baseRotationY); transform.rotate(Vector3.Z, angleY); modelBatch.render(model, environment); transform.rotate(Vector3.Z, -angleY); model.transform.rotate(Vector3.X, baseRotationY); transform.scale(1f / size.x, 1f / size.y, 1f / size.z); // // transform.rotate(Vector3.X, -anglePenche); }
public Element(int ve, boolean[][][] mtx, PerspectiveCamera cam){ valence = ve; matrix = mtx; camera = cam; //setup environment 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)); }