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

项目: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);
    }
项目: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();
    }
}
项目:Alien-Ark    文件:DirectionalLightsForm.java   
public void load(final PlanetConfig pPlanetConfig) {
    planetConfig = pPlanetConfig;
    content.clear();
    addButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            DirectionalLight directionalLight = new DirectionalLight();
            pPlanetConfig.environmentDirectionalLights.add(directionalLight);
            addLight(directionalLight, pPlanetConfig.environmentDirectionalLights.size() + 1, pPlanetConfig);
            listener.onReloadScene(pPlanetConfig);
            pack();
        }
    });


    // directional lights
    int index = 1;
    for (final DirectionalLight dLight : pPlanetConfig.environmentDirectionalLights) {
        addLight(dLight, index, pPlanetConfig);
        index++;
    }

    pack();
}
项目: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);
}
项目: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);
}
项目: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();
    }
}
项目: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    文件: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();
}
项目: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));

}
项目:Skyland    文件:WorldGenerator.java   
public static Environment generateBaseEnvironment(Vector3 sun) {
    Environment environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
    environment.set(new ColorAttribute(ColorAttribute.Fog, .3f, .55f, 1, 1));
    environment.add(new DirectionalLight().set(.3f, .3f, .3f, -.2f, 0.6f, .8f));
    environment.add(new DirectionalLight().set(1f, 1f, 1f, .2f, -0.6f, -.8f));
    environment.add(new PointLight().set(1, 1, 1, sun, 200));
    return environment;
}
项目:origin    文件:Render.java   
public Render(Game game)
    {
        ShaderProgram.pedantic = false;
        _game = game;

        _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));

        _defaultShader = makeShader("modelView");
        _modelShader = _defaultShader;
        _modelBatch = new ModelBatch();

        _skybox = new Skybox();
        _terrain = new Terrain(this);

        _postProcess = new PostProcess();
        _postProcess.addEffect(new OutlineEffect(true));
//      _postProcess.addEffect(new ContrastEffect(true));
//      _postProcess.addEffect(new DepthOfFieldEffect(true));
//      _postProcess.addEffect(new MotionBlurEffect(true));
//      _postProcess.addEffect(new HorizontalBlurEffect(1f / 2f));
//      _postProcess.addEffect(new VerticalBlurEffect(1f / 2f));
//      _postProcess.addEffect(new HorizontalBlurEffect(1f / 8f));
//      _postProcess.addEffect(new VerticalBlurEffect(1f / 8f));
//      _postProcess.addEffect(new EmptyEffect(true));

        _frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);

        fullScreenQuad = createFullScreenQuad();
        // for debug
        testQuad1 = createTestQuad(0.7f, -1, 0.3f);
        testQuad2 = createTestQuad(0.7f, 0, 0.3f);

        Icosahedron.init();
    }
项目:Alien-Ark    文件:PlanetScreen.java   
@Override
public void onReloadScene(PlanetConfig planetConfig) {
    environment.clear();
    for (ColorAttribute cAttribute : planetConfig.environmentColorAttributes) {
        environment.set(cAttribute);
    }
    for (DirectionalLight dLight : planetConfig.environmentDirectionalLights) {
        environment.add(dLight);
    }
}
项目:tiles3-basic-example    文件:WorldRendererSystem.java   
public WorldRendererSystem(EntityManager entityManager, EventManager eventManager) {
    super(entityManager, eventManager);

    viewportContext = Services.get(ViewportContext.class);
    modelBatch = Services.get(ModelBatch.class);
    shapeRenderer = Services.get(ShapeRenderer.class);

    tileMapRenderer = new TileMapRenderer();

    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, AMBIENT_LIGHT));
    environment.add(new DirectionalLight().set(DIRECTIONAL_LIGHT, MathHelpers.LEFT_VECTOR3));
    environment.add(new DirectionalLight().set(DIRECTIONAL_LIGHT, MathHelpers.RIGHT_VECTOR3));
    environment.add(new DirectionalLight().set(DIRECTIONAL_LIGHT, MathHelpers.DOWN_VECTOR3));
}
项目:ForgE    文件:TestModelsScreen.java   
@Override
protected void onInitialize() {
  this.levelEnv          = new LevelEnv();
  this.camera            = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  camera.near = 0.1f;
  camera.position.set(5, 5, 5);
  camera.lookAt(0.1f, 0.1f, 0.1f);

  environment = new Environment();
  environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
  environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -0.5f, -1.0f, -0.8f));


  this.modelBatch        = new ModelBatch();
  //this.voxelBatch        = new VoxelBatch(new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED)));
  ModelLoader g3djLoader = new G3dModelLoader(new UBJsonReader());
  model                  = g3djLoader.loadModel(ForgE.files.internal("raw/models/test.g3db"));

  modelInstance          = new ModelInstance(model);

  modelInstance.calculateBoundingBox(bounds);
  camera.position.set(1, 1, 1).nor().scl(bounds.getDimensions(tmpV1).len() * 1.75f + bounds.getCenter(tmpV2).len());
  camera.up.set(0, 1, 0);
  camera.lookAt(0, 0, 0);
  camera.far = 50f + bounds.getDimensions(tmpV1).len() * 3.0f;
  camera.update(true);
}
项目:ForgE    文件:StorageManager.java   
public Kryo create () {
  Kryo kryo = new Kryo();
  kryo.register(GameDatabase.class, new GameDatabaseSerializer());
  kryo.register(LevelState.class, new FullLevelStateSerializer());
  kryo.register(ChunkMap.class, new ChunkMapDataSerializer());
  kryo.register(Voxel.class, new VoxelSerializer());
  kryo.register(Vector3.class, new Vector3Serializer());
  kryo.register(LevelEnv.class, new LevelEnvSerializer());
  kryo.register(Vector2.class, new Vector2Serializer());
  kryo.register(Color.class, new ColorSerializer());
  kryo.register(DirectionalLight.class, new DirectionalLightSerializer());
  kryo.register(Asset.class, new AssetSerializer());
  kryo.register(BoundingBox.class, new BoundingBoxSerializer());
  kryo.register(VoxelChunkRenderable.class, new VoxelFaceRenderableSerializer());
  kryo.register(Matrix4.class, new Matrix4Serializer());
  kryo.register(Vector3i.class, new Vector3iSerializer());
  kryo.register(Teleport.class, new PlayerStartPositionSerializer());
  kryo.register(TextureAsset.class, new AssetSerializer());
  kryo.register(ModelAsset.class, new AssetSerializer());
  kryo.register(CubemapAsset.class, new AssetSerializer());
  kryo.setDefaultSerializer(TaggedFieldSerializer.class);
  kryo.register(Skybox.class, new SkyboxSerializer());
  kryo.register(CubemapSkybox.class, new SkyboxSerializer());
  kryo.register(DayNightSkybox.class, new SkyboxSerializer());
  kryo.register(WaterEnv.class, new WaterEnvSerializer());
  kryo.register(DynamicGeometryProvider.class, new TerrainGeometryProviderSerializer());
  kryo.register(VoxelChunkRenderableFactory.class, new VoxelChunkRenderableFactorySerializer());
  kryo.register(ChunkPartCollider.class, new ChunkPartColliderSerializer());
  kryo.register(OrthographicDirectionalLight.class, new OrthographicDirectionalLightSerializer());
  return kryo;
}
项目:ForgE    文件:DirectionalLightSerializer.java   
@Override
public DirectionalLight read(Kryo kryo, Input input, Class<DirectionalLight> type) {
  DirectionalLight light = new DirectionalLight();
  light.direction.set(kryo.readObject(input, Vector3.class));
  light.color.set(kryo.readObject(input, Color.class));
  return light;
}
项目:libgdxcn    文件:DefaultShader.java   
@Override
public void begin (final Camera camera, final RenderContext context) {
    super.begin(camera, context);

    for (final DirectionalLight dirLight : directionalLights)
        dirLight.set(0, 0, 0, 0, -1, 0);
    for (final PointLight pointLight : pointLights)
        pointLight.set(0, 0, 0, 0, 0, 0, 0);
    lightsSet = false;

    if (has(u_time)) set(u_time, time += Gdx.graphics.getDeltaTime());
}
项目:libgdxcn    文件:Environment.java   
public Environment add (BaseLight light) {
    if (light instanceof DirectionalLight)
        directionalLights.add((DirectionalLight)light);
    else if (light instanceof PointLight)
        pointLights.add((PointLight)light);
    else
        throw new GdxRuntimeException("Unknown light type");
    return this;
}
项目:libgdxcn    文件:Environment.java   
public Environment remove (BaseLight light) {
    if (light instanceof DirectionalLight)
        directionalLights.removeValue((DirectionalLight)light, false);
    else if (light instanceof PointLight)
        pointLights.removeValue((PointLight)light, false);
    else
        throw new GdxRuntimeException("Unknown light type");
    return this;
}
项目:libgdxcn    文件:ParticleControllerTest.java   
@Override
public void create () {
    super.create();
    emitters = new Array<ParticleController>();
    assets.load(DEFAULT_PARTICLE, Texture.class);
    assets.load(DEFAULT_SKIN, Skin.class);
    loading = true;
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0f, 0f, 0.1f, 1f));
    environment.add(new DirectionalLight().set(1f, 1f, 1f,  0, -0.5f, -1 ));
    billboardParticleBatch = new BillboardParticleBatch();
    billboardParticleBatch.setCamera(cam);
    ui = new Stage();
    builder = new StringBuilder();
}
项目:libgdxcn    文件:ModelTest.java   
@Override
public void create () {
    super.create();
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -0.5f, -1.0f, -0.8f));

    cam.position.set(1, 1, 1);
    cam.lookAt(0, 0, 0);
    cam.update();
    showAxes = true;

    onModelClicked("g3d/teapot.g3db");
}
项目:libgdxcn    文件:LightsTest.java   
@Override
public void create () {
    super.create();
    environment.clear();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.2f, 0.2f, 0.2f, 1.0f));
    environment.add(dirLight = new DirectionalLight().set(0.8f, 0.2f, 0.2f, -1f, -2f, -0.5f));
    environment.add(pointLight = new PointLight().set(0.2f, 0.8f, 0.2f, 0f, 0f, 0f, 100f));

    ModelBuilder mb = new ModelBuilder();
    lightModel = mb.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());
}
项目:libgdxcn    文件:TextureRegion3DTest.java   
@Override
public void create () {
    Gdx.gl.glClearColor(0.2f, 0.3f, 1.0f, 0.f);

    atlas = new TextureAtlas(Gdx.files.internal("data/testpack"));
    regions = atlas.getRegions();

    modelBatch = new ModelBatch(new DefaultShaderProvider());

    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();
    final Material material = new Material(ColorAttribute.createDiffuse(1f, 1f, 1f, 1f), new TextureAttribute(TextureAttribute.Diffuse));
    model = modelBuilder.createBox(5f, 5f, 5f, material, Usage.Position | Usage.Normal | Usage.TextureCoordinates);
    instance = new ModelInstance(model);
    attribute = instance.materials.get(0).get(TextureAttribute.class, TextureAttribute.Diffuse);

    Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
项目:libgdxcn    文件:VoxelTest.java   
@Override
public void create () {
    spriteBatch = new SpriteBatch();
    font = new BitmapFont();
    modelBatch = new ModelBatch();
    DefaultShader.defaultCullFace = GL20.GL_FRONT;
    camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.near = 0.5f;
    camera.far = 1000;
    controller = new FirstPersonCameraController(camera);
    Gdx.input.setInputProcessor(controller);

    lights = new Environment();
    lights.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
    lights.add(new DirectionalLight().set(1, 1, 1, 0, -1, 0));

    Texture texture = new Texture(Gdx.files.internal("data/g3d/tiles.png"));
    TextureRegion[][] tiles = TextureRegion.split(texture, 32, 32);

    MathUtils.random.setSeed(0);
    voxelWorld = new VoxelWorld(tiles[0], 20, 4, 20);
    PerlinNoiseGenerator.generateVoxels(voxelWorld, 0, 63, 10);
    float camX = voxelWorld.voxelsX / 2f;
    float camZ = voxelWorld.voxelsZ / 2f;
    float camY = voxelWorld.getHighest(camX, camZ) + 1.5f;
    camera.position.set(camX, camY, camZ);
}