List of usage examples for com.badlogic.gdx.graphics.g3d Material Material
public Material()
From source file:com.bladecoder.engine.util.Utils3D.java
License:Apache License
private static void createAxes() { ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin();/*from ww w. j a v a 2 s.c o m*/ MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES, Usage.Position | Usage.ColorUnpacked, new Material()); builder.setColor(Color.LIGHT_GRAY); for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) { builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX); builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t); } builder = modelBuilder.part("axes", GL20.GL_LINES, Usage.Position | Usage.ColorUnpacked, new Material()); builder.setColor(Color.RED); builder.line(0, 0, 0, 10, 0, 0); builder.setColor(Color.GREEN); builder.line(0, 0, 0, 0, 10, 0); builder.setColor(Color.BLUE); builder.line(0, 0, 0, 0, 0, 10); axesModel = modelBuilder.end(); axesInstance = new ModelInstance(axesModel); }
From source file:com.mbrlabs.mundus.commons.terrain.Terrain.java
License:Apache License
private Terrain(int vertexResolution) { this.transform = new Matrix4(); this.attribs = MeshBuilder.createAttributes(VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates); this.posPos = attribs.getOffset(VertexAttributes.Usage.Position, -1); this.norPos = attribs.getOffset(VertexAttributes.Usage.Normal, -1); this.uvPos = attribs.getOffset(VertexAttributes.Usage.TextureCoordinates, -1); this.stride = attribs.vertexSize / 4; this.vertexResolution = vertexResolution; this.heightData = new float[vertexResolution * vertexResolution]; this.terrainTexture = new TerrainTexture(); this.terrainTexture.setTerrain(this); material = new Material(); material.set(new TerrainTextureAttribute(TerrainTextureAttribute.ATTRIBUTE_SPLAT0, terrainTexture)); }
From source file:com.mbrlabs.mundus.editor.utils.UsefulMeshs.java
License:Apache License
public static Model createAxes() { final float GRID_MIN = -10f; final float GRID_MAX = 10f; final float GRID_STEP = 1f; ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin();/*from ww w. j ava 2 s . co m*/ MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES, VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material()); builder.setColor(Color.LIGHT_GRAY); for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) { builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX); builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t); } builder = modelBuilder.part("axes", GL20.GL_LINES, VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material()); builder.setColor(Color.RED); builder.line(0, 0, 0, 100, 0, 0); builder.setColor(Color.GREEN); builder.line(0, 0, 0, 0, 100, 0); builder.setColor(Color.BLUE); builder.line(0, 0, 0, 0, 0, 100); return modelBuilder.end(); }
From source file:com.mbrlabs.mundus.tools.brushes.TerrainBrush.java
License:Apache License
public TerrainBrush(ProjectManager projectManager, Shader shader, ModelBatch batch, CommandHistory history, FileHandle pixmapBrush) {/*from w w w .j a v a 2 s . c o m*/ super(projectManager, shader, batch, history); ModelBuilder modelBuilder = new ModelBuilder(); sphereModel = modelBuilder.createSphere(1, 1, 1, 30, 30, new Material(), VertexAttributes.Usage.Position); sphereModelInstance = new ModelInstance(sphereModel); sphereModelInstance.calculateBoundingBox(boundingBox); scale(15); brushPixmap = new Pixmap(pixmapBrush); pixmapCenter = brushPixmap.getWidth() / 2; }
From source file:com.mbrlabs.mundus.utils.Compass.java
License:Apache License
public Compass(PerspectiveCamera worldCam) { this.worldCam = worldCam; this.ownCam = new PerspectiveCamera(); ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin();//from w w w. ja va 2 s . c o m MeshPartBuilder builder = modelBuilder.part("compass", GL20.GL_TRIANGLES, VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material()); builder.setColor(Color.RED); builder.arrow(0, 0, 0, ARROW_LENGTH, 0, 0, ARROW_CAP_SIZE, ARROW_THIKNESS, ARROW_DIVISIONS); builder.setColor(Color.GREEN); builder.arrow(0, 0, 0, 0, ARROW_LENGTH, 0, ARROW_CAP_SIZE, ARROW_THIKNESS, ARROW_DIVISIONS); builder.setColor(Color.BLUE); builder.arrow(0, 0, 0, 0, 0, ARROW_LENGTH, ARROW_CAP_SIZE, ARROW_THIKNESS, ARROW_DIVISIONS); compassModel = modelBuilder.end(); compassInstance = new ModelInstance(compassModel); // translate to top left corner compassInstance.transform.translate(0.93f, 0.94f, 0); }
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:org.bladecoder.bladeengine.util.Utils3D.java
License:Apache License
private static void createAxes() { ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin();/* w ww. jav a 2 s . co m*/ MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES, Usage.Position | Usage.Color, new Material()); builder.setColor(Color.LIGHT_GRAY); for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) { builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX); builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t); } builder = modelBuilder.part("axes", GL20.GL_LINES, Usage.Position | Usage.Color, new Material()); builder.setColor(Color.RED); builder.line(0, 0, 0, 10, 0, 0); builder.setColor(Color.GREEN); builder.line(0, 0, 0, 0, 10, 0); builder.setColor(Color.BLUE); builder.line(0, 0, 0, 0, 0, 10); axesModel = modelBuilder.end(); axesInstance = new ModelInstance(axesModel); }