當前位置: 首頁>>代碼示例>>Java>>正文


Java Environment.add方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.g3d.Environment.add方法的典型用法代碼示例。如果您正苦於以下問題:Java Environment.add方法的具體用法?Java Environment.add怎麽用?Java Environment.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.g3d.Environment的用法示例。


在下文中一共展示了Environment.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addBackground

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
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);
    }
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:19,代碼來源:ScreenRaider.java

示例2: GameModel

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
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;



}
 
開發者ID:msk610,項目名稱:Chemtris,代碼行數:21,代碼來源:GameModel.java

示例3: Renderer

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
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();
	}
}
 
開發者ID:Motsai,項目名稱:neblina-libgdx3d,代碼行數:19,代碼來源:Renderer.java

示例4: setEnvironmentLights

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
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);
	}
}
 
開發者ID:jsjolund,項目名稱:GdxDemo3D,代碼行數:22,代碼來源:GameRenderer.java

示例5: create

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
@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)));
	}
 
開發者ID:if1live,項目名稱:amatsukaze,代碼行數:26,代碼來源:Basic3DTest.java

示例6: create

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
@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");
}
 
開發者ID:if1live,項目名稱:amatsukaze,代碼行數:21,代碼來源:ShaderCollectionTest.java

示例7: create

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
@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);
}
 
開發者ID:if1live,項目名稱:amatsukaze,代碼行數:25,代碼來源:Basic3D.java

示例8: Stage3d

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
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);
}
 
開發者ID:pyros2097,項目名稱:Scene3d,代碼行數:17,代碼來源:Stage3d.java

示例9: create

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
@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)));
}
 
開發者ID:if1live,項目名稱:amatsukaze,代碼行數:23,代碼來源:FogTest.java

示例10: setup

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
@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;
}
 
開發者ID:opensciencemap,項目名稱:vtm,代碼行數:21,代碼來源:GdxModelRenderer.java

示例11: setup

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
@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;
}
 
開發者ID:opensciencemap,項目名稱:vtm,代碼行數:24,代碼來源:GdxRenderer3D2.java

示例12: drawProfile

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
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();
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:15,代碼來源:ScreenProfile.java

示例13: MapsScreen

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
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();
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:31,代碼來源:MapsScreen.java

示例14: setupEnviroment

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
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));
}
 
開發者ID:raphaelbruno,項目名稱:ZombieInvadersVR,代碼行數:14,代碼來源:ScreenBase.java

示例15: create

import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
@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();
}
 
開發者ID:DevelopersGuild,項目名稱:Planetbase,代碼行數:35,代碼來源:StrategyGame.java


注:本文中的com.badlogic.gdx.graphics.g3d.Environment.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。