本文整理匯總了Java中com.badlogic.gdx.graphics.g3d.Environment類的典型用法代碼示例。如果您正苦於以下問題:Java Environment類的具體用法?Java Environment怎麽用?Java Environment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Environment類屬於com.badlogic.gdx.graphics.g3d包,在下文中一共展示了Environment類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GameScreen
import com.badlogic.gdx.graphics.g3d.Environment; //導入依賴的package包/類
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);
}
示例2: 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);
}
示例3: Renderer
import com.badlogic.gdx.graphics.g3d.Environment; //導入依賴的package包/類
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();
}
示例4: 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;
}
示例5: 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();
}
}
示例6: render
import com.badlogic.gdx.graphics.g3d.Environment; //導入依賴的package包/類
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();
}
}
示例7: render
import com.badlogic.gdx.graphics.g3d.Environment; //導入依賴的package包/類
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);
}
}
示例8: PerspectiveRenderer
import com.badlogic.gdx.graphics.g3d.Environment; //導入依賴的package包/類
/**
* 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);
}
示例9: 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);
}
}
示例10: 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");
}
示例11: 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)));
}
示例12: 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)));
}
示例13: create
import com.badlogic.gdx.graphics.g3d.Environment; //導入依賴的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);
}
示例14: prepareShadowEnvironment
import com.badlogic.gdx.graphics.g3d.Environment; //導入依賴的package包/類
/**
* 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;
}
}
示例15: 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);
}