Package com.badlogic.gdx.graphics.glutils

Examples of com.badlogic.gdx.graphics.glutils.ShapeRenderer


  }

  public Box2DDebugRenderer (boolean drawBodies, boolean drawJoints, boolean drawAABBs, boolean drawInactiveBodies,
    boolean drawVelocities, boolean drawContacts) {
    // next we setup the immediate mode renderer
    renderer = new ShapeRenderer();

    // next we create a SpriteBatch and a font
    batch = new SpriteBatch();

    lower = new Vector2();
View Full Code Here


public class TexturePackerTest extends ApplicationAdapter {
  ShapeRenderer renderer;
  Array<Page> pages;

  public void create () {
    renderer = new ShapeRenderer();
  }
View Full Code Here

    public ShapeRenderer shapeRenderer;
   
    @Override
    public void init (){
         shapeRenderer = new ShapeRenderer();
    }
View Full Code Here

    if (debug) drawDebug();
  }

  private void drawDebug () {
    if (debugShapes == null) {
      debugShapes = new ShapeRenderer();
      debugShapes.setAutoShapeType(true);
    }

    if (debugUnderMouse || debugParentUnderMouse || debugTableUnderMouse != Debug.none) {
      screenToStageCoordinates(stageCoords.set(Gdx.input.getX(), Gdx.input.getY()));
View Full Code Here

  }

  public Box2DDebugRenderer (boolean drawBodies, boolean drawJoints, boolean drawAABBs, boolean drawInactiveBodies,
    boolean drawVelocities, boolean drawContacts) {
    // next we setup the immediate mode renderer
    renderer = new ShapeRenderer();

    // initialize vertices array
    for (int i = 0; i < vertices.length; i++)
      vertices[i] = new Vector2();
View Full Code Here

  /** Stage to handle all UI items for an overlay in the stack */
  protected Stage stage;

  public R2Overlay(Stage stage) {
  this.stage = stage;
  renderer = new ShapeRenderer();
  this.camera = (OrthographicCamera) stage.getCamera();
  }
View Full Code Here

  Matrix4 transform = new Matrix4();
  Vector2 vector = new Vector2();

  public void create () {
    batch = new SpriteBatch();
    renderer = new ShapeRenderer();
    skeletonRenderer = new SkeletonRenderer();
    skeletonRenderer.setPremultipliedAlpha(true);

    atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas"));
View Full Code Here

  private boolean drawMeshHull = true, drawMeshTriangles = true;
  private final SkeletonBounds bounds = new SkeletonBounds();
  private float scale = 1;

  public SkeletonRendererDebug () {
    shapes = new ShapeRenderer();
  }
View Full Code Here

  public void draw (Skeleton skeleton) {
    float skeletonX = skeleton.getX();
    float skeletonY = skeleton.getY();

    Gdx.gl.glEnable(GL20.GL_BLEND);
    ShapeRenderer shapes = this.shapes;
    shapes.begin(ShapeType.Line);

    Array<Bone> bones = skeleton.getBones();
    if (drawBones) {
      shapes.setColor(boneLineColor);
      for (int i = 0, n = bones.size; i < n; i++) {
        Bone bone = bones.get(i);
        if (bone.parent == null) continue;
        float x = skeletonX + bone.data.length * bone.m00 + bone.worldX;
        float y = skeletonY + bone.data.length * bone.m10 + bone.worldY;
        shapes.line(skeletonX + bone.worldX, skeletonY + bone.worldY, x, y);
      }
      shapes.x(skeletonX, skeletonY, 4 * scale);
    }

    if (drawRegionAttachments) {
      shapes.setColor(attachmentLineColor);
      Array<Slot> slots = skeleton.getSlots();
      for (int i = 0, n = slots.size; i < n; i++) {
        Slot slot = slots.get(i);
        Attachment attachment = slot.attachment;
        if (attachment instanceof RegionAttachment) {
          RegionAttachment regionAttachment = (RegionAttachment)attachment;
          regionAttachment.updateWorldVertices(slot, false);
          float[] vertices = regionAttachment.getWorldVertices();
          shapes.line(vertices[X1], vertices[Y1], vertices[X2], vertices[Y2]);
          shapes.line(vertices[X2], vertices[Y2], vertices[X3], vertices[Y3]);
          shapes.line(vertices[X3], vertices[Y3], vertices[X4], vertices[Y4]);
          shapes.line(vertices[X4], vertices[Y4], vertices[X1], vertices[Y1]);
        }
      }
    }

    if (drawMeshHull || drawMeshTriangles) {
      Array<Slot> slots = skeleton.getSlots();
      for (int i = 0, n = slots.size; i < n; i++) {
        Slot slot = slots.get(i);
        Attachment attachment = slot.attachment;
        float[] vertices = null;
        short[] triangles = null;
        int hullLength = 0;
        if (attachment instanceof MeshAttachment) {
          MeshAttachment mesh = (MeshAttachment)attachment;
          mesh.updateWorldVertices(slot, false);
          vertices = mesh.getWorldVertices();
          triangles = mesh.getTriangles();
          hullLength = mesh.getHullLength();
        } else if (attachment instanceof SkinnedMeshAttachment) {
          SkinnedMeshAttachment mesh = (SkinnedMeshAttachment)attachment;
          mesh.updateWorldVertices(slot, false);
          vertices = mesh.getWorldVertices();
          triangles = mesh.getTriangles();
          hullLength = mesh.getHullLength();
        }
        if (vertices == null || triangles == null) continue;
        if (drawMeshTriangles) {
          shapes.setColor(triangleLineColor);
          for (int ii = 0, nn = triangles.length; ii < nn; ii += 3) {
            int v1 = triangles[ii] * 5, v2 = triangles[ii + 1] * 5, v3 = triangles[ii + 2] * 5;
            shapes.triangle(vertices[v1], vertices[v1 + 1], //
              vertices[v2], vertices[v2 + 1], //
              vertices[v3], vertices[v3 + 1] //
              );
          }
        }
        if (drawMeshHull && hullLength > 0) {
          shapes.setColor(attachmentLineColor);
          hullLength = hullLength / 2 * 5;
          float lastX = vertices[hullLength - 5], lastY = vertices[hullLength - 4];
          for (int ii = 0, nn = hullLength; ii < nn; ii += 5) {
            float x = vertices[ii], y = vertices[ii + 1];
            shapes.line(x, y, lastX, lastY);
            lastX = x;
            lastY = y;
          }
        }
      }
    }

    if (drawBoundingBoxes) {
      SkeletonBounds bounds = this.bounds;
      bounds.update(skeleton, true);
      shapes.setColor(aabbColor);
      shapes.rect(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
      shapes.setColor(boundingBoxColor);
      Array<FloatArray> polygons = bounds.getPolygons();
      for (int i = 0, n = polygons.size; i < n; i++) {
        FloatArray polygon = polygons.get(i);
        shapes.polygon(polygon.items, 0, polygon.size);
      }
    }

    shapes.end();
    shapes.begin(ShapeType.Filled);

    if (drawBones) {
      shapes.setColor(boneOriginColor);
      for (int i = 0, n = bones.size; i < n; i++) {
        Bone bone = bones.get(i);
        shapes.setColor(Color.GREEN);
        shapes.circle(skeletonX + bone.worldX, skeletonY + bone.worldY, 3 * scale, 8);
      }
    }

    shapes.end();
  }
View Full Code Here

    this(true, true, false, true);
  }

  public Box2DDebugRenderer (boolean drawBodies, boolean drawJoints, boolean drawAABBs, boolean drawInactiveBodies) {
    // next we setup the immediate mode renderer
    renderer = new ShapeRenderer();

    // next we create a SpriteBatch and a font
    batch = new SpriteBatch();

    lower = new Vector2();
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.glutils.ShapeRenderer

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.