本文整理匯總了Java中com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute.createDiffuse方法的典型用法代碼示例。如果您正苦於以下問題:Java ColorAttribute.createDiffuse方法的具體用法?Java ColorAttribute.createDiffuse怎麽用?Java ColorAttribute.createDiffuse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute
的用法示例。
在下文中一共展示了ColorAttribute.createDiffuse方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: MaterialInterpreter
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //導入方法依賴的package包/類
public MaterialInterpreter() {
waterColor = new Color(0.13f, 0.05f, 0.8f, 1);
waterMaterial = new Material(
ColorAttribute.createDiffuse(waterColor),
ColorAttribute.createSpecular(1, 1, 1, 1),
FloatAttribute.createShininess(8f));
sandColor = new Color(0.9f, 0.733f, 0.58f, 1);
sandMaterial = new Material(ColorAttribute.createDiffuse(sandColor),
ColorAttribute.createSpecular(1, 1, 1, 1),
FloatAttribute.createShininess(8f));
grassColor = new Color(0f, 1f, 0f, 1f);
grassMaterial = new Material(ColorAttribute.createDiffuse(grassColor),
ColorAttribute.createSpecular(1, 1, 1, 1),
FloatAttribute.createShininess(8f));
}
示例2: createPlayerModel
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //導入方法依賴的package包/類
/** players are represented by cubes, with another cube marking the direction it is facing */
public void createPlayerModel() {
ModelBuilder mb = new ModelBuilder();
ModelBuilder mb2 = new ModelBuilder();
long attr = Usage.Position | Usage.Normal;
float r = 0.5f;
float g = 1f;
float b = 0.75f;
Material material = new Material(ColorAttribute.createDiffuse(new Color(r, g, b, 1f)));
Material faceMaterial = new Material(ColorAttribute.createDiffuse(Color.BLUE));
float w = 1f;
float d = w;
float h = 2f;
mb.begin();
//playerModel = mb.createBox(w, h, d, material, attr);
Node node = mb.node("box", mb2.createBox(w, h, d, material, attr));
// the face is just a box to show which direction the player is facing
Node faceNode = mb.node("face", mb2.createBox(w/2, h/2, d/2, faceMaterial, attr));
faceNode.translation.set(0f, 0f, d/2);
playerModel = mb.end();
}
示例3: create
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //導入方法依賴的package包/類
@Override
public void create () {
Gdx.gl.glClearColor(0.2f, 0.3f, 1.0f, 0.f);
atlas = new TextureAtlas(Gdx.files.internal("data/testpack"));
regions = atlas.getRegions();
modelBatch = new ModelBatch(new DefaultShaderProvider());
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();
final Material material = new Material(ColorAttribute.createDiffuse(1f, 1f, 1f, 1f), new TextureAttribute(TextureAttribute.Diffuse));
model = modelBuilder.createBox(5f, 5f, 5f, material, Usage.Position | Usage.Normal | Usage.TextureCoordinates);
instance = new ModelInstance(model);
attribute = instance.materials.get(0).get(TextureAttribute.class, TextureAttribute.Diffuse);
Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
示例4: World
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //導入方法依賴的package包/類
public World(int width, int depth) {
this.width = width;
this.depth = depth;
islands = new Island[width * depth];
highlight = new Material(TextureAttribute.createDiffuse(Vloxlands.assets.get("img/transparent.png", Texture.class)), ColorAttribute.createDiffuse(SELECTION));
dataMaps = new Material[Config.dataMaps.length][2];
for (int i = 0; i < dataMaps.length; i++) {
Material trp = new Material(TextureAttribute.createDiffuse(Vloxlands.assets.get("img/datamaps/" + Config.dataMaps[i].toLowerCase() + ".png", Texture.class)), new BlendingAttribute());
Material opq = Config.dataMapFullBlending[i] ? trp : new Material(TextureAttribute.createDiffuse(Vloxlands.assets.get("img/datamaps/" + Config.dataMaps[i].toLowerCase() + ".png", Texture.class)));
dataMaps[i] = new Material[] { opq, trp };
}
}
示例5: create
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //導入方法依賴的package包/類
/**
* Intiialisierung der Anwendung: Einrichten der libgdx Umgebung, starten
* des Servers
*/
@Override
public void create() {
// Erstellung einer Umgebung, um die Tiefe des Objektes sichtbar zu
// machen.
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
environment.add(new DirectionalLight().set(0.35f, 0.35f, 0.35f, 0.5f, -0.8f, 0.8f));
// Erstellung der ModellBatch, zur welche sp�ter das zu rendernde Objekt
// hinzugef�gt wird.
modelBatch = new ModelBatch();
// Kamera wird erstellt und ihre Eigenschaften werden festgelegt.
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.near = 1f;
cam.far = 300f;
cam.update();
// stage = new Stage();
// BitmapFont font = new BitmapFont();
// Skin skin = new Skin();
// TextureAtlas buttonAtlas = new TextureAtlas(Gdx.files.internal("images/Button.pack"));
// skin.addRegions(buttonAtlas);
// TextButtonStyle textButtonStyle = new TextButtonStyle();
// textButtonStyle.font = font;
// textButtonStyle.up = skin.getDrawable("black");
// textButtonStyle.down = skin.getDrawable("black");
// textButtonStyle.checked = skin.getDrawable("black");
// TextButton button = new TextButton("Refresh", textButtonStyle);
// stage.addActor(button);
// button.setBounds(0, 0, 50, 50);
// button.addListener(new ChangeListener(){
//
// @Override
// public void changed(ChangeEvent event, Actor actor) {
// model.dispose();
// renderNewModell();
//
// }
//
// });
// Farbe des Objektes wird festgelegt
material = new Material(ColorAttribute.createDiffuse(Color.GREEN));
// Der Modellbuilder hilft bei der Erstellung des Objektes
modelBuilder = new ModelBuilder();
// Kamera f�r den Nutzer steuerbar machen
camController = new CameraInputController(cam);
Gdx.input.setInputProcessor(camController);
// setupModel(VerticesGenerationTest.testVerts2());
setupServer();
}