The par_shapes API is divided into three sections:
For our purposes, a "mesh" is a list of points and a list of triangles; the former is a flattened list of three-tuples (32-bit floats) and the latter
is also a flattened list of three-tuples (16-bit uints). Triangles are always oriented such that their front face winds counter-clockwise.
Depending on which generator function is used, meshes may or may not contain normals and texture coordinates (one per vertex).
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static native void | |
| public static native void | |
| public static native long | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | npar_shapes_create_disk(float radius, int slices, long center, long normal)
Unsafe version of: |
| public static native long | npar_shapes_create_disk(float radius, int slices, float[] center, float[] normal)
Array version of: |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | npar_shapes_create_lsystem(long program, int slices, int maxdepth, long rand_fn, long context)
Unsafe version of: |
| public static native long | |
| public static native long | |
| public static native long | npar_shapes_create_parametric_sphere(int slices, int stacks)
Unsafe version of: |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | npar_shapes_create_trefoil_knot(int slices, int stacks, float radius)
Unsafe version of: |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native long | |
| public static native long | |
| public static void | |
| public static void | |
| public static ParShapesMesh | par_shapes_clone(ParShapesMesh
the mesh to copy mesh, ParShapesMesh the target mesh target)Makes a deep copy of a mesh. |
| public static void | par_shapes_compute_aabb(ParShapesMesh
the mesh to query mesh, FloatBuffer a pointer to an array of 6 floats in which the AABB will be written aabb)Takes a pointer to 6 floats and sets them to min xyz, max xyz. |
| public static void | |
| public static void | par_shapes_compute_normals(ParShapesMesh
the mesh mesh)Computes smooth normals by averaging adjacent facet normals. |
| public static ParShapesMesh | par_shapes_create_cone(int
the number of slices slices, int the number of stacks stacks)Creates a cone similar to |
| public static ParShapesMesh | |
| public static ParShapesMesh | par_shapes_create_cylinder(int
the number of slices slices, int the number of stacks stacks)Creates a cylinder that sits on the Z=0 plane using the given tessellation levels across the UV domain. |
| public static ParShapesMesh | par_shapes_create_disk(float
the disk radius radius, int the number of slices slices, FloatBuffer the disk center center, FloatBuffer the disk normal normal)Generates an orientable disk shape in 3-space. |
| public static ParShapesMesh | par_shapes_create_disk(float radius, int slices, float[] center, float[] normal)
Array version of: |
| public static ParShapesMesh | par_shapes_create_dodecahedron()
Generates points for a 12-sided polyhedron that fits in the unit sphere. |
| public static ParShapesMesh | |
| public static ParShapesMesh | par_shapes_create_hemisphere(int
the number of slices slices, int the number of stacks stacks)Creates a hemisphere mesh. |
| public static ParShapesMesh | par_shapes_create_icosahedron()
Generates points for a 20-sided polyhedron that fits in the unit sphere. |
| public static ParShapesMesh | par_shapes_create_klein_bottle(int
the number of slices slices, int the number of stacks stacks)Creates a klein bottle mesh. |
| public static ParShapesMesh | par_shapes_create_lsystem(ByteBuffer
the list of command-argument pairs program, int the number of slices slices, int the maximum depth maxdepth, ParShapesRandFnI is expected to return a value between 0 and 1, or can be rand_fn, long NULL (in which case (float) rand() / RAND_MAX will be used)passed unmodified to context)rand_fnCreates trees or vegetation by executing a recursive turtle graphics program. |
| public static ParShapesMesh | par_shapes_create_lsystem(CharSequence
the list of command-argument pairs program, int the number of slices slices, int the maximum depth maxdepth, ParShapesRandFnI is expected to return a value between 0 and 1, or can be rand_fn, long NULL (in which case (float) rand() / RAND_MAX will be used)passed unmodified to context)rand_fnCreates trees or vegetation by executing a recursive turtle graphics program. |
| public static ParShapesMesh | par_shapes_create_octahedron()
Generates points for an 8-sided polyhedron that fits in the unit sphere. |
| public static ParShapesMesh | par_shapes_create_parametric_disk(int
the number of slices slices, int the number of stacks stacks)Creates a disk of radius |
| public static ParShapesMesh | par_shapes_create_parametric_sphere(int
the number of slices slices, int the number of stacks stacks)Creates a sphere with texture coordinates and small triangles near the poles. |
| public static ParShapesMesh | par_shapes_create_plane(int
the number of slices slices, int the number of stacks stacks)Creates a plane mesh. |
| public static ParShapesMesh | par_shapes_create_rock(int
a seed value seed, int the number of subdivisions nsubdivisions)Generates a rock shape that sits on the Y=0 plane, and sinks into it a bit. |
| public static ParShapesMesh | par_shapes_create_subdivided_sphere(int
the number of subdivisions nsubdivisions)Approximates a sphere with a subdivided icosahedron, which produces a nice distribution of triangles, but no texture coordinates. |
| public static ParShapesMesh | par_shapes_create_tetrahedron()
Generates points for a 4-sided polyhedron that fits in the unit sphere. |
| public static ParShapesMesh | par_shapes_create_torus(int
the number of slices slices, int the number of stacks stacks, float the torus radius radius)Creates a donut that sits on the Z=0 plane with the specified inner radius. |
| public static ParShapesMesh | par_shapes_create_trefoil_knot(int
the number of slices slices, int the number of stacks stacks, float radius)Creates a trefoil knot mesh. |
| public static void | par_shapes_export(ParShapesMesh
the mesh to export mesh, ByteBuffer the OBJ file path objfile)Dumps out a text file conforming to the venerable OBJ format. |
| public static void | par_shapes_export(ParShapesMesh
the mesh to export mesh, CharSequence the OBJ file path objfile)Dumps out a text file conforming to the venerable OBJ format. |
| public static void | par_shapes_free_mesh(ParShapesMesh
the mesh to free mesh)Frees the specified |
| public static void | par_shapes_invert(ParShapesMesh
the mesh to reverse mesh, int the index of the first face to reverse startface, int the number of faces to reverse nfaces)Reverses the winding of a run of faces. |
| public static void | par_shapes_merge(ParShapesMesh
the destination mesh dst, ParShapesMesh the source mesh src)Merges two shapes. |
| public static void | par_shapes_merge_and_free(ParShapesMesh
the destination mesh dst, ParShapesMesh the source mesh src)Merges two shapes and frees the source shape. |
| public static void | par_shapes_remove_degenerate(ParShapesMesh
the mesh to cleanup mesh, float triangles with an area below this value will be removed minarea)Removes all triangles whose area is less than |
| public static void | par_shapes_rotate(ParShapesMesh
the mesh to rotate mesh, float the rotation angle, in radians radians, FloatBuffer the rotation axis axis)Rotates the specified mesh. |
| public static void | |
| public static void | par_shapes_scale(ParShapesMesh
the mesh to scale mesh, float the X axis scale factor x, float the Y axis scale factor y, float the Z axis scale factor z)Scales the specified mesh. |
| public static native void | |
| public static native void | |
| public static void | par_shapes_translate(ParShapesMesh
the mesh to translate mesh, float the X axis translation amount x, float the Y axis translation amount y, float the Z axis translation amount z)Translates the specified mesh. |
| public static void | par_shapes_unweld(ParShapesMesh
the mesh to unweld mesh, boolean if an index buffer should be generated create_indices)Dereferences the entire index buffer and replaces the point list. |
| public static ParShapesMesh | par_shapes_weld(ParShapesMesh
the mesh to weld mesh, float the maximum distance to consider when welding vertices epsilon, IntBuffer null, or a pointer to mapping)npoints 32-bit integers, which gets filled with the mapping from old vertex indices to new indicesMerges colocated verts, builds a new index buffer, and returns the optimized mesh. |
| public static ParShapesMesh |