Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.Mesh


  /** End building the mesh and returns the mesh */
  public Mesh end () {
    if (this.attributes == null) throw new RuntimeException("Call begin() first");
    endpart();

    final Mesh mesh = new Mesh(true, vertices.size / stride, indices.size, attributes);
    mesh.setVertices(vertices.items, 0, vertices.size);
    mesh.setIndices(indices.items, 0, indices.size);

    for (MeshPart p : parts)
      p.mesh = mesh;
    parts.clear();

View Full Code Here


  public SpriteCache (int size, ShaderProgram shader, boolean useIndices) {
    this.shader = shader;

    if (useIndices && size > 5460) throw new IllegalArgumentException("Can't have more than 5460 sprites per batch: " + size);

    mesh = new Mesh(true, size * (useIndices ? 4 : 6), useIndices ? size * 6 : 0, new VertexAttribute(Usage.Position, 2,
      ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE),
      new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));
    mesh.setAutoBind(false);

    if (useIndices) {
View Full Code Here

  }

  @Deprecated
  public static Model createFromMesh (final float[] vertices, final VertexAttribute[] attributes, final short[] indices,
    int primitiveType, final Material material) {
    final Mesh mesh = new Mesh(false, vertices.length, indices.length, attributes);
    mesh.setVertices(vertices);
    mesh.setIndices(indices);
    return createFromMesh(mesh, 0, indices.length, primitiveType, material);
  }
View Full Code Here

  @Override
  public void onTemplateChecked (Model model, boolean isChecked) {
    //Update the shapes
    SpawnShapeValue shapeValue = null;
    Mesh mesh = model.meshes.get(0);
    weightMeshSpawnShapeValue.setMesh(mesh, model);
    meshSpawnShapeValue.setMesh(mesh, model);
    if(shapeCombo.getSelectedItem() == SPAWN_SHAPE_WEIGHT_MESH){
      SpawnInfluencer influencer = (SpawnInfluencer)editor.getEmitter().findInfluencer(SpawnInfluencer.class);
      influencer.spawnShapeValue = weightMeshSpawnShapeValue;
View Full Code Here

      start[i] = new Vector2();
      end[i] = new Vector2();
    }
    setDirection(direction);

    lightMesh = new Mesh(VertexDataType.VertexArray, staticLight, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
      "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
      new VertexAttribute(Usage.Generic, 1, "s"));
    softShadowMesh = new Mesh(VertexDataType.VertexArray, staticLight, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
      "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
      new VertexAttribute(Usage.Generic, 1, "s"));
    update();
  }
View Full Code Here

    sin = new float[rays];
    cos = new float[rays];
    endX = new float[rays];
    endY = new float[rays];

    lightMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
      "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
      new VertexAttribute(Usage.Generic, 1, "s"));
    softShadowMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum * 2, 0, new VertexAttribute(Usage.Position, 2,
      "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
      new VertexAttribute(Usage.Generic, 1, "s"));
    setMesh();
  }
View Full Code Here

    verts[V3] = 1f;

    verts[U4] = 0f;
    verts[V4] = 1f;

    Mesh tmpMesh = new Mesh(true, 4, 0, new VertexAttribute(
        Usage.Position, 2, "a_position"), new VertexAttribute(
        Usage.TextureCoordinates, 2, "a_texCoord"));

    tmpMesh.setVertices(verts);
    return tmpMesh;

  }
View Full Code Here

  public PositionalLight(RayHandler rayHandler, int rays, Color color, float distance, float x, float y, float directionDegree) {
    super(rayHandler, rays, color, distance, directionDegree);
    start.x = x;
    start.y = y;

    lightMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
      "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
      new VertexAttribute(Usage.Generic, 1, "s"));
    softShadowMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum * 2, 0, new VertexAttribute(Usage.Position, 2,
      "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
      new VertexAttribute(Usage.Generic, 1, "s"));
    setMesh();
  }
View Full Code Here

    verts[V3] = 1f;

    verts[U4] = 0f;
    verts[V4] = 1f;

    Mesh tmpMesh = new Mesh(true, 4, 0, new VertexAttribute(
        Usage.Position, 2, "a_position"), new VertexAttribute(
        Usage.TextureCoordinates, 2, "a_texCoord"));

    tmpMesh.setVertices(verts);
    return tmpMesh;

  }
View Full Code Here

    for (int i = 0; i < rayNum; i++) {
      start[i] = new Vector2();
      end[i] = new Vector2();
    }
   
    lightMesh = new Mesh(
        VertexDataType.VertexArray, staticLight, vertexNum, 0,
        new VertexAttribute(Usage.Position, 2, "vertex_positions"),
        new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
        new VertexAttribute(Usage.Generic, 1, "s"));
    softShadowMesh = new Mesh(
        VertexDataType.VertexArray, staticLight, vertexNum, 0,
        new VertexAttribute(Usage.Position, 2, "vertex_positions"),
        new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
        new VertexAttribute(Usage.Generic, 1, "s"));
   
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.Mesh

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.