List of usage examples for com.badlogic.gdx.graphics.g3d.attributes ColorAttribute ColorAttribute
public ColorAttribute(final long type, final Color color)
From source file:com.github.fauu.helix.core.MapRegion.java
License:Open Source License
public void create(Vector2 size, Tile[] tiles, Array<Object> objects, TextureAtlas textureAtlas, GeometrySet geometrySet) {/*ww w . ja va 2 s . com*/ this.size = size; this.textureAtlas = textureAtlas; this.geometrySet = geometrySet; this.objects = objects; if (tiles != null) { this.tiles = tiles; } else { final int tilesLength = (int) (size.x * size.y); tiles = new Tile[tilesLength]; for (int i = 0; i < tilesLength; i++) { final Tile.Builder tileBuilder = new Tile.Builder(); final int tileX = i % (int) size.x; final int tileY = (int) Math.floor(i / (tilesLength / size.y)); tiles[i] = tileBuilder.setNo(i).setPosition(new Vector2(tileX, tileY)).setElevation(0) .setTextureId(0).setGeometryId(0).setFacing(Direction.SOUTH).build(); } } this.tiles = tiles; mesh = new MapRegionMesh(tiles, geometrySet, textureAtlas); renderable = new Renderable(); renderable.mesh = mesh; renderable.material = new Material(new ColorAttribute(ColorAttribute.Diffuse, Color.WHITE), new TextureAttribute(TextureAttribute.Diffuse, textureAtlas.getTextures().first())); renderable.meshPartOffset = 0; renderable.meshPartSize = mesh.getNumVertices(); renderable.primitiveType = GL20.GL_TRIANGLES; renderable.worldTransform.idt(); }
From source file:com.mbrlabs.mundus.commons.assets.MaterialAsset.java
License:Apache License
/** * Applies this material asset to the libGDX material. * * @param material/*from w w w. ja v a2s.c o m*/ * @return */ public Material applyToMaterial(Material material) { if (diffuseColor != null) { material.set(new ColorAttribute(ColorAttribute.Diffuse, diffuseColor)); } if (diffuseTexture != null) { material.set(new TextureAttribute(TextureAttribute.Diffuse, diffuseTexture.getTexture())); } else { material.remove(TextureAttribute.Diffuse); } material.set(new FloatAttribute(FloatAttribute.Shininess, shininess)); return material; }
From source file:com.mygdx.game.utilities.ModelFactory.java
License:Apache License
public static Model buildBillboardModel(Texture texture, float width, float height) { TextureRegion textureRegion = new TextureRegion(texture, texture.getWidth(), texture.getHeight()); Material material = new Material(); material.set(new TextureAttribute(TextureAttribute.Diffuse, textureRegion)); material.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE)); material.set(new BlendingAttribute()); return ModelFactory.buildPlaneModel(width, height, material, 0, 0, 1, 1); }
From source file:ve.ucv.ciens.ccg.nxtar.systems.RobotArmRenderingSystem.java
License:Apache License
@SuppressWarnings("unchecked") public RobotArmRenderingSystem(ModelBatch batch) { super(Aspect.getAspectForAll(ShaderComponent.class, RenderModelComponent.class, EnvironmentComponent.class) .exclude(MarkerCodeComponent.class)); camera = null;/*from www. j a v a2s . c om*/ this.batch = batch; // MeshBuilder builder = new MeshBuilder(); // builder.begin(new VertexAttributes(new VertexAttribute(Usage.Position, 4, "a_position"), new VertexAttribute(Usage.Color, 4, "a_color")), GL20.GL_LINES);{ // builder.line(new Vector3(0.0f, 0.0f, RobotArmPositioningSystem.MIN_Z), Color.YELLOW, new Vector3(0.0f, 0.0f, RobotArmPositioningSystem.MAX_Z), Color.YELLOW); // }lineMesh = builder.end(); // lineModel = ModelBuilder.createFromMesh(lineMesh, GL20.GL_LINES, new Material(new ColorAttribute(ColorAttribute.Diffuse, Color.YELLOW))); // lineModel = new ModelBuilder().createArrow(new Vector3(0.0f, 0.0f, RobotArmPositioningSystem.MIN_Z), new Vector3(0.0f, 0.0f, RobotArmPositioningSystem.MAX_Z), new Material(new ColorAttribute(ColorAttribute.Diffuse, Color.YELLOW)), Usage.Position | Usage.Color | Usage.Normal); lineModel = new ModelBuilder().createBox(0.01f, 0.01f, 3.5f, new Material(new ColorAttribute(ColorAttribute.Diffuse, Color.YELLOW)), Usage.Position | Usage.Color | Usage.Normal); lineInstance = new ModelInstance(lineModel); temp = new Vector3(); }