From 3270b1dc854601446059692913683634f49f8661 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 16 Apr 2012 19:18:32 +0000 Subject: [PATCH] Some android sync --- .../core/src/processing/core/PGraphics.java | 2 +- android/core/src/processing/core/PShape.java | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/android/core/src/processing/core/PGraphics.java b/android/core/src/processing/core/PGraphics.java index 3e9db05b3..deeaca42a 100644 --- a/android/core/src/processing/core/PGraphics.java +++ b/android/core/src/processing/core/PGraphics.java @@ -838,7 +838,7 @@ public class PGraphics extends PImage implements PConstants { if (which > 0) { return hints[which]; } else { - return hints[-which]; + return !hints[-which]; } } diff --git a/android/core/src/processing/core/PShape.java b/android/core/src/processing/core/PShape.java index 8588af145..42f56eb58 100644 --- a/android/core/src/processing/core/PShape.java +++ b/android/core/src/processing/core/PShape.java @@ -1161,7 +1161,18 @@ public class PShape implements PConstants { return vertices[index]; } + + public PVector getVertex(int index, PVector vec) { + if (vec == null) { + vec = new PVector(); + } + vec.x = vertices[index][X]; + vec.y = vertices[index][Y]; + vec.z = vertices[index][Z]; + return vec; + } + public float getVertexX(int index) { return vertices[index][X]; } @@ -1176,6 +1187,62 @@ public class PShape implements PConstants { return vertices[index][Z]; } + public void setVertex(int index, float x, float y, float z) { + vertices[index][X] = x; + vertices[index][Y] = y; + vertices[index][Z] = z; + } + + public PVector getNormal(int index, PVector vec) { + if (vec == null) { + vec = new PVector(); + } + vec.x = vertices[index][NX]; + vec.y = vertices[index][NY]; + vec.z = vertices[index][NZ]; + return vec; + } + + public float getNormalX(int index) { + return vertices[index][NX]; + } + + public float getNormalY(int index) { + return vertices[index][NY]; + } + + public float getNormalZ(int index) { + return vertices[index][NZ]; + } + + public void setNormal(int index, float nx, float ny, float nz) { + vertices[index][NX] = nx; + vertices[index][NY] = ny; + vertices[index][NZ] = nz; + } + + public PVector getVertexUV(int index, PVector vec) { + if (vec == null) { + vec = new PVector(); + } + vec.x = vertices[index][U]; + vec.y = vertices[index][V]; + return vec; + } + + public float getVertexU(int index) { + return vertices[index][U]; + } + + public float getVertexV(int index) { + return vertices[index][V]; + } + + public void setVertexUV(int index, float u, float v) { + vertices[index][U] = u; + vertices[index][V] = v; + } + public int[] getVertexCodes() { if (vertexCodes == null) {