@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)));
}
java类com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute的实例源码
FogTest.java 文件源码
项目:amatsukaze
阅读 20
收藏 0
点赞 0
评论 0
LevelSelectScreen.java 文件源码
项目:Tower-Defense-Galaxy
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void show() {
super.show();
assets = new AssetManager();
assets.load("theme/basic/campaign/scene.g3db", Model.class);
modelBatch = new ModelBatch();
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
//environment.add(new DirectionalLight().set(1f, 1f, 1f, -1f, -1f, -1f));
addDisposables(modelBatch, assets);
}
ScreenProfile.java 文件源码
项目:enklave
阅读 32
收藏 0
点赞 0
评论 0
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();
}
MapsScreen.java 文件源码
项目:enklave
阅读 38
收藏 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
阅读 29
收藏 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));
}
StrategyGame.java 文件源码
项目:Planetbase
阅读 22
收藏 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();
}
StrategyGame.java 文件源码
项目:Planetbase
阅读 29
收藏 0
点赞 0
评论 0
public void renderSelectTooltip(){
float radius=selectGroup+0.03f;
ModelInstance sphere=new ModelInstance(Assets.modelBuilder.createSphere(radius, radius, radius
,(int)(100*radius),(int)(100*radius), //This can be lower-resolution
new Material(ColorAttribute.createDiffuse(1,0,0,0.5f)),
Usage.Position | Usage.Normal));
sphere.transform.setToTranslation(-cam.direction.x, -cam.direction.y, -cam.direction.z);
staticEntityBatch.render(sphere);
}
DemoMotionGdxAdapter.java 文件源码
项目:thunderboard-android
阅读 18
收藏 0
点赞 0
评论 0
public void turnOffLights() {
for (Material mat : lightMaterials) {
if (mat.has(ColorAttribute.Emissive)) {
mat.remove(ColorAttribute.Emissive);
}
}
}
AttributeTypeAdapter.java 文件源码
项目:Argent
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void write(JsonWriter out, Attribute value) throws IOException {
if(value == null) {
out.nullValue();
return;
}
out.beginObject();
String alias = value.getClass().getSimpleName();
out.name("type").value(value.type);
alias += "::" + value.getAttributeAlias(value.type);
out.name("alias").value(alias);
out.name("attrData").beginObject();
if(value instanceof TextureAttribute) {
out.name("offsetU").value(((TextureAttribute) value).offsetU);
out.name("offsetV").value(((TextureAttribute) value).offsetV);
out.name("scaleU").value(((TextureAttribute) value).scaleU);
out.name("scaleV").value(((TextureAttribute) value).scaleV);
out.name("textureDescriptor").value(JSONSerializer.instance().serialize(((TextureAttribute) value).textureDescription));
}else if(value instanceof ColorAttribute) {
out.name("colour").value(((ColorAttribute) value).color.toString());
}else if(value instanceof BlendingAttribute) {
out.name("alpha").value(((BlendingAttribute) value).opacity);
}
out.endObject();
out.endObject();
}
AttributeTypeAdapter.java 文件源码
项目:Argent
阅读 23
收藏 0
点赞 0
评论 0
@Override
public Attribute read(JsonReader in) throws IOException {
Attribute attr = null;
long type = -1;
String alias = "";
in.beginObject();
while(in.hasNext()) {
switch(in.nextName()) {
case "type": type = in.nextLong(); break;
case "alias": alias = in.nextString(); break;
case "attrData":
attr = buildFromAlias(alias);
if(attr == null) break;
in.beginObject();
while(in.hasNext()) {
switch(in.nextName()) {
case "offsetU":
((TextureAttribute)attr).offsetU = (float) in.nextDouble(); break;
case "offsetV":
((TextureAttribute)attr).offsetV = (float) in.nextDouble(); break;
case "scaleU":
((TextureAttribute)attr).scaleU = (float) in.nextDouble(); break;
case "scaleV":
((TextureAttribute)attr).scaleV = (float) in.nextDouble(); break;
case "textureDescriptor":
((TextureAttribute)attr).textureDescription.set(JSONSerializer.instance().deserialize(in.nextString(), TextureDescriptor.class)); break;
case "colour":
((ColorAttribute)attr).color.set(Color.valueOf(in.nextString())); break;
case "alpha":
((BlendingAttribute)attr).opacity = (float) in.nextDouble(); break;
}
}
in.endObject();
break;
}
}
in.endObject();
return attr;
}