Java 类com.badlogic.gdx.graphics.g3d.Environment 实例源码

项目:StreetCampusFighter    文件:GameScreen.java   
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);



}
项目:enklave    文件:ScreenRaider.java   
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);
    }
项目:VuforiaLibGDX    文件:Renderer.java   
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();
    }
项目:Chemtris    文件:GameModel.java   
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;



}
项目:neblina-libgdx3d    文件:Renderer.java   
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();
    }
}
项目:eamaster    文件:WheelWorld.java   
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();
        }
    }
项目:eamaster    文件:World.java   
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);
        }
    }
项目:ChessGDX    文件:PerspectiveRenderer.java   
/**
 * 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);
}
项目:GdxDemo3D    文件:GameRenderer.java   
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);
    }
}
项目:android-screen-recorder    文件:Renderer.java   
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();
    }
}
项目:teavm-libgdx    文件:Renderer.java   
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();
    }
}
项目:libgdxcn    文件:ShaderCollectionTest.java   
@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");
}
项目:libgdxcn    文件:FogTest.java   
@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)));
}
项目:libgdxcn    文件:Basic3DTest.java   
@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)));
    }
项目:gdx-vr    文件:SimpleRoom.java   
@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);
}
项目:gaiasky    文件:ModelBody.java   
/**
 * 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;
    }
}
项目:Scene3d    文件:Stage3d.java   
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);
}
项目:Vloxlands    文件:Structure.java   
@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();
    }
}
项目:libgdx-demo-invaders    文件:Renderer.java   
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();
    }
}
项目:amatsukaze    文件:Basic3D.java   
@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);
}
项目:amatsukaze    文件:ShaderCollectionTest.java   
@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");
}
项目:amatsukaze    文件:FogTest.java   
@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)));
}
项目:amatsukaze    文件:Basic3DTest.java   
@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)));
    }
项目:vtm    文件:GdxModelRenderer.java   
@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;
}
项目:vtm    文件:GdxRenderer3D.java   
@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;
}
项目:vtm    文件:GdxRenderer3D2.java   
@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;
}
项目:buffer_bci    文件:Renderer.java   
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();
    }
}
项目:Tower-Defense-Galaxy    文件:Laser.java   
@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();
    }
}
项目:Tower-Defense-Galaxy    文件:LevelSelectScreen.java   
@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);
}
项目:enklave    文件:ScreenProfile.java   
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();
}
项目:enklave    文件:MapsScreen.java   
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();
}
项目:ZombieInvadersVR    文件:ScreenBase.java   
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));
}
项目:Planetbase    文件:GuiRenderer.java   
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();
}
项目:Planetbase    文件:StrategyGame.java   
@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();
}
项目:nhglib    文件:ShaderUtils.java   
public static boolean useImageBasedLighting(Environment environment) {
    boolean res;

    IBLAttribute iblAttribute = (IBLAttribute) environment.get(IBLAttribute.IrradianceType);
    res = iblAttribute != null && iblAttribute.textureDescription != null;

    return res;
}
项目:nhglib    文件:RenderingSystem.java   
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());
}
项目:LibGDX-PBR    文件:PBRTestAPP.java   
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;
}
项目:exterminate    文件:EntityManager.java   
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);
    }

}
项目:exterminate    文件:LivingEntity.java   
@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);

}
项目:Chemtris    文件:Element.java   
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));

}