当前位置: 首页>>代码示例>>Java>>正文


Java DirectionalLight类代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.environment.DirectionalLight的典型用法代码示例。如果您正苦于以下问题:Java DirectionalLight类的具体用法?Java DirectionalLight怎么用?Java DirectionalLight使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DirectionalLight类属于com.badlogic.gdx.graphics.g3d.environment包,在下文中一共展示了DirectionalLight类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addBackground

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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.DirectionalLight; //导入依赖的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.DirectionalLight; //导入依赖的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: load

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的package包/类
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();
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:25,代码来源:DirectionalLightsForm.java

示例5: create

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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:basherone,项目名称:libgdxcn,代码行数:21,代码来源:ShaderCollectionTest.java

示例6: create

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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:basherone,项目名称:libgdxcn,代码行数:23,代码来源:FogTest.java

示例7: create

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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:basherone,项目名称:libgdxcn,代码行数:26,代码来源:Basic3DTest.java

示例8: create

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的package包/类
@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);
}
 
开发者ID:nooone,项目名称:gdx-vr,代码行数:25,代码来源:SimpleRoom.java

示例9: Stage3d

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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

示例10: create

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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

示例11: setup

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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

示例12: setup

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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

示例13: drawProfile

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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

示例14: MapsScreen

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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

示例15: setupEnviroment

import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; //导入依赖的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


注:本文中的com.badlogic.gdx.graphics.g3d.environment.DirectionalLight类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。