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

MapsScreen.java 文件源码 项目:enklave 阅读 35 收藏 0 点赞 0 评论 0
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();
}
ScreenBase.java 文件源码 项目:ZombieInvadersVR 阅读 36 收藏 0 点赞 0 评论 0
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));
}
GuiRenderer.java 文件源码 项目:Planetbase 阅读 49 收藏 0 点赞 0 评论 0
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();
}
StrategyGame.java 文件源码 项目:Planetbase 阅读 18 收藏 0 点赞 0 评论 0
@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();
}
ShaderUtils.java 文件源码 项目:nhglib 阅读 27 收藏 0 点赞 0 评论 0
public static boolean useImageBasedLighting(Environment environment) {
    boolean res;

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

    return res;
}
RenderingSystem.java 文件源码 项目:nhglib 阅读 24 收藏 0 点赞 0 评论 0
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());
}
PBRTestAPP.java 文件源码 项目:LibGDX-PBR 阅读 37 收藏 0 点赞 0 评论 0
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;
}
EntityManager.java 文件源码 项目:exterminate 阅读 33 收藏 0 点赞 0 评论 0
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);
    }

}
LivingEntity.java 文件源码 项目:exterminate 阅读 23 收藏 0 点赞 0 评论 0
@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);

}
Element.java 文件源码 项目:Chemtris 阅读 21 收藏 0 点赞 0 评论 0
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));

}


问题


面经


文章

微信
公众号

扫码关注公众号