OSDN Git Service

swig generated java files
[mikumikustudio/libgdx-mikumikustudio.git] / extensions / gdx-bullet / jni / swig-src / com / badlogic / gdx / physics / bullet / btIndexedMesh.java
index d09e0f3..c95e052 100644 (file)
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.8
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-package com.badlogic.gdx.physics.bullet;
-
-import com.badlogic.gdx.math.Vector3;
-import com.badlogic.gdx.math.Quaternion;
-import com.badlogic.gdx.math.Matrix3;
-
-public class btIndexedMesh {
-  private long swigCPtr;
-  protected boolean swigCMemOwn;
-
-  protected btIndexedMesh(long cPtr, boolean cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = cPtr;
-  }
-
-  public static long getCPtr(btIndexedMesh obj) {
-    return (obj == null) ? 0 : obj.swigCPtr;
-  }
-
-  protected void finalize() {
-    delete();
-  }
-
-  public synchronized void delete() {
-    if (swigCPtr != 0) {
-      if (swigCMemOwn) {
-        swigCMemOwn = false;
-        gdxBulletJNI.delete_btIndexedMesh(swigCPtr);
-      }
-      swigCPtr = 0;
-    }
-  }
-
-  public void setM_numTriangles(int value) {
-    gdxBulletJNI.btIndexedMesh_m_numTriangles_set(swigCPtr, this, value);
-  }
-
-  public int getM_numTriangles() {
-    return gdxBulletJNI.btIndexedMesh_m_numTriangles_get(swigCPtr, this);
-  }
-
-  public void setM_triangleIndexBase(SWIGTYPE_p_unsigned_char value) {
-    gdxBulletJNI.btIndexedMesh_m_triangleIndexBase_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
-  }
-
-  public SWIGTYPE_p_unsigned_char getM_triangleIndexBase() {
-    long cPtr = gdxBulletJNI.btIndexedMesh_m_triangleIndexBase_get(swigCPtr, this);
-    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-  }
-
-  public void setM_triangleIndexStride(int value) {
-    gdxBulletJNI.btIndexedMesh_m_triangleIndexStride_set(swigCPtr, this, value);
-  }
-
-  public int getM_triangleIndexStride() {
-    return gdxBulletJNI.btIndexedMesh_m_triangleIndexStride_get(swigCPtr, this);
-  }
-
-  public void setM_numVertices(int value) {
-    gdxBulletJNI.btIndexedMesh_m_numVertices_set(swigCPtr, this, value);
-  }
-
-  public int getM_numVertices() {
-    return gdxBulletJNI.btIndexedMesh_m_numVertices_get(swigCPtr, this);
-  }
-
-  public void setM_vertexBase(SWIGTYPE_p_unsigned_char value) {
-    gdxBulletJNI.btIndexedMesh_m_vertexBase_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
-  }
-
-  public SWIGTYPE_p_unsigned_char getM_vertexBase() {
-    long cPtr = gdxBulletJNI.btIndexedMesh_m_vertexBase_get(swigCPtr, this);
-    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-  }
-
-  public void setM_vertexStride(int value) {
-    gdxBulletJNI.btIndexedMesh_m_vertexStride_set(swigCPtr, this, value);
-  }
-
-  public int getM_vertexStride() {
-    return gdxBulletJNI.btIndexedMesh_m_vertexStride_get(swigCPtr, this);
-  }
-
-  public void setM_indexType(int value) {
-    gdxBulletJNI.btIndexedMesh_m_indexType_set(swigCPtr, this, value);
-  }
-
-  public int getM_indexType() {
-    return gdxBulletJNI.btIndexedMesh_m_indexType_get(swigCPtr, this);
-  }
-
-  public void setM_vertexType(int value) {
-    gdxBulletJNI.btIndexedMesh_m_vertexType_set(swigCPtr, this, value);
-  }
-
-  public int getM_vertexType() {
-    return gdxBulletJNI.btIndexedMesh_m_vertexType_get(swigCPtr, this);
-  }
-
-  public btIndexedMesh() {
-    this(gdxBulletJNI.new_btIndexedMesh(), true);
-  }
-
-  public void setTriangleIndexBase(short[] data, long size) {
-    gdxBulletJNI.btIndexedMesh_setTriangleIndexBase(swigCPtr, this, data, size);
-  }
-
-  public void setVertexBase(float[] data, long size) {
-    gdxBulletJNI.btIndexedMesh_setVertexBase(swigCPtr, this, data, size);
-  }
-
-  public void dispose() {
-    gdxBulletJNI.btIndexedMesh_dispose(swigCPtr, this);
-  }
-
-}
+/* ----------------------------------------------------------------------------\r
+ * This file was automatically generated by SWIG (http://www.swig.org).\r
+ * Version 2.0.10\r
+ *\r
+ * Do not make changes to this file unless you know what you are doing--modify\r
+ * the SWIG interface file instead.\r
+ * ----------------------------------------------------------------------------- */\r
+\r
+package com.badlogic.gdx.physics.bullet;\r
+\r
+import com.badlogic.gdx.graphics.Mesh;\r
+import com.badlogic.gdx.graphics.VertexAttribute;\r
+import com.badlogic.gdx.graphics.VertexAttributes.Usage;\r
+import com.badlogic.gdx.graphics.g3d.model.MeshPart;\r
+import com.badlogic.gdx.utils.Array;\r
+import com.badlogic.gdx.utils.GdxRuntimeException;\r
+\r
+public class btIndexedMesh extends BulletBase {\r
+       private long swigCPtr;\r
+       \r
+       protected btIndexedMesh(final String className, long cPtr, boolean cMemoryOwn) {\r
+               super(className, cPtr, cMemoryOwn);\r
+               swigCPtr = cPtr;\r
+       }\r
+       \r
+       protected btIndexedMesh(long cPtr, boolean cMemoryOwn) {\r
+               this("btIndexedMesh", cPtr, cMemoryOwn);\r
+               construct();\r
+       }\r
+       \r
+       @Override\r
+       protected void reset(long cPtr, boolean cMemoryOwn) {\r
+               if (!destroyed)\r
+                       destroy();\r
+               super.reset(swigCPtr = cPtr, cMemoryOwn);\r
+       }\r
+       \r
+       public static long getCPtr(btIndexedMesh obj) {\r
+               return (obj == null) ? 0 : obj.swigCPtr;\r
+       }\r
+\r
+       @Override\r
+       protected void finalize() throws Throwable {\r
+               if (!destroyed)\r
+                       destroy();\r
+               super.finalize();\r
+       }\r
+\r
+  @Override protected synchronized void delete() {\r
+               if (swigCPtr != 0) {\r
+                       if (swigCMemOwn) {\r
+                               swigCMemOwn = false;\r
+                               gdxBulletJNI.delete_btIndexedMesh(swigCPtr);\r
+                       }\r
+                       swigCPtr = 0;\r
+               }\r
+               super.delete();\r
+       }\r
+\r
+       protected final static Array<btIndexedMesh> instances = new Array<btIndexedMesh>();\r
+       protected static btIndexedMesh getInstance(final MeshPart meshPart) {\r
+               final int n = instances.size;\r
+               for (int i = 0; i < n; i++) {\r
+                       final btIndexedMesh mesh = instances.get(i);\r
+                       if (meshPart.equals(mesh.meshPart))\r
+                               return mesh;\r
+               }\r
+               return null;\r
+       }\r
+       \r
+       /** Create or reuse a btIndexedMesh instance based on the specified {@link MeshPart}.\r
+        * Use {@link #release()} to release the mesh when it's no longer needed. */\r
+       public static btIndexedMesh obtain(final MeshPart meshPart) {\r
+               if (meshPart == null)\r
+                       throw new GdxRuntimeException("meshPart cannot be null");\r
+               \r
+               btIndexedMesh result = getInstance(meshPart);\r
+               if (result == null) {\r
+                       result = new btIndexedMesh(meshPart);\r
+                       instances.add(result);\r
+               }\r
+               result.obtain();\r
+               return result;\r
+       }\r
+       \r
+       protected MeshPart meshPart;\r
+       \r
+       /** Construct a new btIndexedMesh based on the supplied {@link Mesh}\r
+        * The specified mesh must be indexed and triangulated and must outlive this btIndexedMesh.\r
+        * The buffers for the vertices and indices are shared amonst both. */\r
+       public btIndexedMesh(final Mesh mesh) {\r
+               this();\r
+               set(mesh);\r
+       }\r
+       \r
+       /** Construct a new btIndexedMesh based on the supplied {@link MeshPart}\r
+        * The specified mesh must be indexed and triangulated and must outlive this btIndexedMesh.\r
+        * The buffers for the vertices and indices are shared amonst both. */\r
+       public btIndexedMesh(final MeshPart meshPart) {\r
+               this();\r
+               set(meshPart);\r
+       }\r
+       \r
+       /** Construct a new btIndexedMesh based on the supplied {@link Mesh}\r
+        * The specified mesh must be indexed and triangulated and must outlive this btIndexedMesh.\r
+        * The buffers for the vertices and indices are shared amonst both. */\r
+       public btIndexedMesh(final Mesh mesh, int offset, int count) {\r
+               this();\r
+               set(mesh, offset, count);\r
+       }\r
+       \r
+       /** @return The {@link MeshPart} used to create or set this btIndexedMesh, may be null. */\r
+       public MeshPart getMeshPart() {\r
+               return meshPart;\r
+       }\r
+       \r
+       /** Convenience method to set this btIndexedMesh to the specified {@link Mesh} \r
+        * The specified mesh must be indexed and triangulated and must outlive this btIndexedMesh.\r
+        * The buffers for the vertices and indices are shared amonst both. */\r
+       public void set(final Mesh mesh) {\r
+               set(mesh, 0, mesh.getNumIndices());\r
+       }\r
+\r
+       /** Convenience method to set this btIndexedMesh to the specified {@link MeshPart} \r
+        * The specified mesh must be indexed and triangulated and must outlive this btIndexedMesh.\r
+        * The buffers for the vertices and indices are shared amonst both. */\r
+       public void set(final MeshPart meshPart) {\r
+               if (meshPart.primitiveType != com.badlogic.gdx.graphics.GL10.GL_TRIANGLES)\r
+                       throw new com.badlogic.gdx.utils.GdxRuntimeException("Mesh must be indexed and triangulated");\r
+               set(meshPart.mesh, meshPart.indexOffset, meshPart.numVertices);\r
+               this.meshPart = meshPart;\r
+       }\r
+\r
+       /** Convenience method to set this btIndexedMesh to the specified {@link Mesh} \r
+        * The specified mesh must be indexed and triangulated and must outlive this btIndexedMesh.\r
+        * The buffers for the vertices and indices are shared amonst both. */\r
+       public void set(final Mesh mesh, int offset, int count) {\r
+               if ((count <= 0) || ((count % 3) != 0))\r
+                       throw new com.badlogic.gdx.utils.GdxRuntimeException("Mesh must be indexed and triangulated");\r
+\r
+               VertexAttribute posAttr = mesh.getVertexAttribute(Usage.Position);\r
+               \r
+               if (posAttr == null)\r
+                       throw new com.badlogic.gdx.utils.GdxRuntimeException("Mesh doesn't have a position attribute");\r
+               \r
+               setVertices(mesh.getVerticesBuffer(), mesh.getVertexSize(), mesh.getNumVertices(), posAttr.offset);\r
+               setIndices(mesh.getIndicesBuffer(), offset, count);\r
+               \r
+               meshPart = null;\r
+       }\r
+\r
+  public void setNumTriangles(int value) {\r
+    gdxBulletJNI.btIndexedMesh_numTriangles_set(swigCPtr, this, value);\r
+  }\r
+\r
+  public int getNumTriangles() {\r
+    return gdxBulletJNI.btIndexedMesh_numTriangles_get(swigCPtr, this);\r
+  }\r
+\r
+  public void setTriangleIndexBase(java.nio.ByteBuffer value) {\r
+    assert value.isDirect() : "Buffer must be allocated direct.";\r
+    {\r
+      gdxBulletJNI.btIndexedMesh_triangleIndexBase_set(swigCPtr, this, value);\r
+    }\r
+  }\r
+\r
+  public java.nio.ByteBuffer getTriangleIndexBase() {\r
+    return gdxBulletJNI.btIndexedMesh_triangleIndexBase_get(swigCPtr, this);\r
+}\r
+\r
+  public void setTriangleIndexStride(int value) {\r
+    gdxBulletJNI.btIndexedMesh_triangleIndexStride_set(swigCPtr, this, value);\r
+  }\r
+\r
+  public int getTriangleIndexStride() {\r
+    return gdxBulletJNI.btIndexedMesh_triangleIndexStride_get(swigCPtr, this);\r
+  }\r
+\r
+  public void setNumVertices(int value) {\r
+    gdxBulletJNI.btIndexedMesh_numVertices_set(swigCPtr, this, value);\r
+  }\r
+\r
+  public int getNumVertices() {\r
+    return gdxBulletJNI.btIndexedMesh_numVertices_get(swigCPtr, this);\r
+  }\r
+\r
+  public void setVertexBase(java.nio.ByteBuffer value) {\r
+    assert value.isDirect() : "Buffer must be allocated direct.";\r
+    {\r
+      gdxBulletJNI.btIndexedMesh_vertexBase_set(swigCPtr, this, value);\r
+    }\r
+  }\r
+\r
+  public java.nio.ByteBuffer getVertexBase() {\r
+    return gdxBulletJNI.btIndexedMesh_vertexBase_get(swigCPtr, this);\r
+}\r
+\r
+  public void setVertexStride(int value) {\r
+    gdxBulletJNI.btIndexedMesh_vertexStride_set(swigCPtr, this, value);\r
+  }\r
+\r
+  public int getVertexStride() {\r
+    return gdxBulletJNI.btIndexedMesh_vertexStride_get(swigCPtr, this);\r
+  }\r
+\r
+  public void setIndexType(int value) {\r
+    gdxBulletJNI.btIndexedMesh_indexType_set(swigCPtr, this, value);\r
+  }\r
+\r
+  public int getIndexType() {\r
+    return gdxBulletJNI.btIndexedMesh_indexType_get(swigCPtr, this);\r
+  }\r
+\r
+  public void setVertexType(int value) {\r
+    gdxBulletJNI.btIndexedMesh_vertexType_set(swigCPtr, this, value);\r
+  }\r
+\r
+  public int getVertexType() {\r
+    return gdxBulletJNI.btIndexedMesh_vertexType_get(swigCPtr, this);\r
+  }\r
+\r
+  public btIndexedMesh() {\r
+    this(gdxBulletJNI.new_btIndexedMesh(), true);\r
+  }\r
+\r
+  public void setTriangleIndexBase(java.nio.ShortBuffer data) {\r
+    assert data.isDirect() : "Buffer must be allocated direct.";\r
+    {\r
+      gdxBulletJNI.btIndexedMesh_setTriangleIndexBase(swigCPtr, this, data);\r
+    }\r
+  }\r
+\r
+  public void setVertexBase(java.nio.FloatBuffer data) {\r
+    assert data.isDirect() : "Buffer must be allocated direct.";\r
+    {\r
+      gdxBulletJNI.btIndexedMesh_setVertexBase(swigCPtr, this, data);\r
+    }\r
+  }\r
+\r
+  public void setVertices(java.nio.FloatBuffer vertices, int sizeInBytesOfEachVertex, int vertexCount, int positionOffsetInBytes) {\r
+    assert vertices.isDirect() : "Buffer must be allocated direct.";\r
+    {\r
+      gdxBulletJNI.btIndexedMesh_setVertices(swigCPtr, this, vertices, sizeInBytesOfEachVertex, vertexCount, positionOffsetInBytes);\r
+    }\r
+  }\r
+\r
+  public void setIndices(java.nio.ShortBuffer indices, int indexOffset, int indexCount) {\r
+    assert indices.isDirect() : "Buffer must be allocated direct.";\r
+    {\r
+      gdxBulletJNI.btIndexedMesh_setIndices(swigCPtr, this, indices, indexOffset, indexCount);\r
+    }\r
+  }\r
+\r
+}\r