public class ParShapes
extends java.lang.Object
The library provides a set of functions that populate fields of the ParShapesMesh structure.
The normals and tcoords fields might be null, but every other field is guaranteed to have valid values. This mesh representation is
very limited: indices must be unsigned 32-bit integers, points must be three-tuples, and there is no support for face-varying data.
When you’re done extracting the data you need from the mesh, be sure to free it:
par_shapes_mesh* m = par_shapes_create_subdivided_sphere(1);
// ...
par_shapes_free_mesh(m);| Modifier and Type | Method and Description |
|---|---|
static void |
npar_shapes__compute_welded_normals(long m) |
static void |
npar_shapes__connect(long scene,
long cylinder,
int slices) |
static long |
npar_shapes_clone(long mesh,
long target)
Unsafe version of:
clone |
static void |
npar_shapes_compute_aabb(long mesh,
float[] aabb)
Array version of:
npar_shapes_compute_aabb(long, long) |
static void |
npar_shapes_compute_aabb(long mesh,
long aabb)
Unsafe version of:
compute_aabb |
static void |
npar_shapes_compute_normals(long mesh)
Unsafe version of:
compute_normals |
static long |
npar_shapes_create_cone(int slices,
int stacks)
Unsafe version of:
create_cone |
static long |
npar_shapes_create_cube()
Unsafe version of:
create_cube |
static long |
npar_shapes_create_cylinder(int slices,
int stacks)
Unsafe version of:
create_cylinder |
static long |
npar_shapes_create_disk(float radius,
int slices,
float[] center,
float[] normal)
Array version of:
npar_shapes_create_disk(float, int, long, long) |
static long |
npar_shapes_create_disk(float radius,
int slices,
long center,
long normal)
Unsafe version of:
create_disk |
static long |
npar_shapes_create_dodecahedron()
Unsafe version of:
create_dodecahedron |
static long |
npar_shapes_create_empty()
Unsafe version of:
create_empty |
static long |
npar_shapes_create_hemisphere(int slices,
int stacks)
Unsafe version of:
create_hemisphere |
static long |
npar_shapes_create_icosahedron()
Unsafe version of:
create_icosahedron |
static long |
npar_shapes_create_klein_bottle(int slices,
int stacks)
Unsafe version of:
create_klein_bottle |
static long |
npar_shapes_create_lsystem(long program,
int slices,
int maxdepth)
Unsafe version of:
create_lsystem |
static long |
npar_shapes_create_octahedron()
Unsafe version of:
create_octahedron |
static long |
npar_shapes_create_parametric_sphere(int slices,
int stacks)
Unsafe version of:
create_parametric_sphere |
static long |
npar_shapes_create_plane(int slices,
int stacks)
Unsafe version of:
create_plane |
static long |
npar_shapes_create_rock(int seed,
int nsubdivisions)
Unsafe version of:
create_rock |
static long |
npar_shapes_create_subdivided_sphere(int nsubdivisions)
Unsafe version of:
create_subdivided_sphere |
static long |
npar_shapes_create_tetrahedron()
Unsafe version of:
create_tetrahedron |
static long |
npar_shapes_create_torus(int slices,
int stacks,
float radius)
Unsafe version of:
create_torus |
static long |
npar_shapes_create_trefoil_knot(int slices,
int stacks,
float radius)
Unsafe version of:
create_trefoil_knot |
static void |
npar_shapes_export(long mesh,
long objfile)
Unsafe version of:
export |
static void |
npar_shapes_free_mesh(long mesh)
Unsafe version of:
free_mesh |
static void |
npar_shapes_invert(long mesh,
int startface,
int nfaces)
Unsafe version of:
invert |
static void |
npar_shapes_merge_and_free(long dst,
long src)
Unsafe version of:
merge_and_free |
static void |
npar_shapes_merge(long dst,
long src)
Unsafe version of:
merge |
static void |
npar_shapes_remove_degenerate(long mesh,
float minarea)
Unsafe version of:
remove_degenerate |
static void |
npar_shapes_rotate(long mesh,
float radians,
float[] axis)
Array version of:
npar_shapes_rotate(long, float, long) |
static void |
npar_shapes_rotate(long mesh,
float radians,
long axis)
Unsafe version of:
rotate |
static void |
npar_shapes_scale(long mesh,
float x,
float y,
float z)
Unsafe version of:
scale |
static void |
npar_shapes_translate(long mesh,
float x,
float y,
float z)
Unsafe version of:
translate |
static void |
npar_shapes_unweld(long mesh,
boolean create_indices)
Unsafe version of:
unweld |
static long |
npar_shapes_weld(long mesh,
float epsilon,
int[] mapping)
Array version of:
npar_shapes_weld(long, float, long) |
static long |
npar_shapes_weld(long mesh,
float epsilon,
long mapping)
Unsafe version of:
weld |
static void |
par_shapes__compute_welded_normals(ParShapesMesh m) |
static void |
par_shapes__connect(ParShapesMesh scene,
ParShapesMesh cylinder,
int slices) |
static ParShapesMesh |
par_shapes_clone(ParShapesMesh mesh,
ParShapesMesh target)
Makes a deep copy of a mesh.
|
static void |
par_shapes_compute_aabb(ParShapesMesh mesh,
float[] aabb)
Array version of:
compute_aabb |
static void |
par_shapes_compute_aabb(ParShapesMesh mesh,
java.nio.FloatBuffer aabb)
Takes a pointer to 6 floats and sets them to min xyz, max xyz.
|
static void |
par_shapes_compute_normals(ParShapesMesh mesh)
Computes smooth normals by averaging adjacent facet normals.
|
static ParShapesMesh |
par_shapes_create_cone(int slices,
int stacks)
Creates a cone similar to
create_cylinder but the radius diminishes to zero as Z increases. |
static ParShapesMesh |
par_shapes_create_cube()
Generates points for a cube that fits in the unit sphere.
|
static ParShapesMesh |
par_shapes_create_cylinder(int slices,
int stacks)
Creates a cylinder that sits on the Z=0 plane using the given tessellation levels across the UV domain.
|
static ParShapesMesh |
par_shapes_create_disk(float radius,
int slices,
float[] center,
float[] normal)
Array version of:
create_disk |
static ParShapesMesh |
par_shapes_create_disk(float radius,
int slices,
java.nio.FloatBuffer center,
java.nio.FloatBuffer normal)
Generates an orientable disk shape in 3-space.
|
static ParShapesMesh |
par_shapes_create_dodecahedron()
Generates points for a 12-sided polyhedron that fits in the unit sphere.
|
static ParShapesMesh |
par_shapes_create_empty()
Creates an empty shape.
|
static ParShapesMesh |
par_shapes_create_hemisphere(int slices,
int stacks)
Creates a hemisphere mesh.
|
static ParShapesMesh |
par_shapes_create_icosahedron()
Generates points for a 20-sided polyhedron that fits in the unit sphere.
|
static ParShapesMesh |
par_shapes_create_klein_bottle(int slices,
int stacks)
Creates a klein bottle mesh.
|
static ParShapesMesh |
par_shapes_create_lsystem(java.nio.ByteBuffer program,
int slices,
int maxdepth)
Creates trees or vegetation by executing a recursive turtle graphics program.
|
static ParShapesMesh |
par_shapes_create_lsystem(java.lang.CharSequence program,
int slices,
int maxdepth)
Creates trees or vegetation by executing a recursive turtle graphics program.
|
static ParShapesMesh |
par_shapes_create_octahedron()
Generates points for an 8-sided polyhedron that fits in the unit sphere.
|
static ParShapesMesh |
par_shapes_create_parametric_sphere(int slices,
int stacks)
Creates a sphere with texture coordinates and small triangles near the poles.
|
static ParShapesMesh |
par_shapes_create_plane(int slices,
int stacks)
Creates a plane mesh.
|
static ParShapesMesh |
par_shapes_create_rock(int seed,
int nsubdivisions)
Generates a rock shape that sits on the Y=0 plane, and sinks into it a bit.
|
static ParShapesMesh |
par_shapes_create_subdivided_sphere(int nsubdivisions)
Approximates a sphere with a subdivided icosahedron, which produces a nice distribution of triangles, but no texture coordinates.
|
static ParShapesMesh |
par_shapes_create_tetrahedron()
Generates points for a 4-sided polyhedron that fits in the unit sphere.
|
static ParShapesMesh |
par_shapes_create_torus(int slices,
int stacks,
float radius)
Creates a donut that sits on the Z=0 plane with the specified inner radius.
|
static ParShapesMesh |
par_shapes_create_trefoil_knot(int slices,
int stacks,
float radius)
Creates a trefoil knot mesh.
|
static void |
par_shapes_export(ParShapesMesh mesh,
java.nio.ByteBuffer objfile)
Dumps out a text file conforming to the venerable OBJ format.
|
static void |
par_shapes_export(ParShapesMesh mesh,
java.lang.CharSequence objfile)
Dumps out a text file conforming to the venerable OBJ format.
|
static void |
par_shapes_free_mesh(ParShapesMesh mesh)
Frees the specified
ParShapesMesh structure. |
static void |
par_shapes_invert(ParShapesMesh mesh,
int startface,
int nfaces)
Reverses the winding of a run of faces.
|
static void |
par_shapes_merge_and_free(ParShapesMesh dst,
ParShapesMesh src)
Merges two shapes and frees the source shape.
|
static void |
par_shapes_merge(ParShapesMesh dst,
ParShapesMesh src)
Merges two shapes.
|
static void |
par_shapes_remove_degenerate(ParShapesMesh mesh,
float minarea)
Removes all triangles whose area is less than
minarea. |
static void |
par_shapes_rotate(ParShapesMesh mesh,
float radians,
float[] axis)
Array version of:
rotate |
static void |
par_shapes_rotate(ParShapesMesh mesh,
float radians,
java.nio.FloatBuffer axis)
Rotates the specified mesh.
|
static void |
par_shapes_scale(ParShapesMesh mesh,
float x,
float y,
float z)
Scales the specified mesh.
|
static void |
par_shapes_set_epsilon_degenerate_sphere(float epsilon) |
static void |
par_shapes_set_epsilon_welded_normals(float epsilon) |
static void |
par_shapes_translate(ParShapesMesh mesh,
float x,
float y,
float z)
Translates the specified mesh.
|
static void |
par_shapes_unweld(ParShapesMesh mesh,
boolean create_indices)
Dereferences the entire index buffer and replaces the point list.
|
static ParShapesMesh |
par_shapes_weld(ParShapesMesh mesh,
float epsilon,
int[] mapping)
Array version of:
weld |
static ParShapesMesh |
par_shapes_weld(ParShapesMesh mesh,
float epsilon,
java.nio.IntBuffer mapping)
Merges colocated verts, builds a new index buffer, and returns the optimized mesh.
|
public static void npar_shapes_free_mesh(long mesh)
free_meshpublic static void par_shapes_free_mesh(ParShapesMesh mesh)
ParShapesMesh structure.mesh - the mesh to freepublic static long npar_shapes_create_cylinder(int slices,
int stacks)
create_cylinder@Nullable public static ParShapesMesh par_shapes_create_cylinder(int slices, int stacks)
scale.slices - the number of slicesstacks - the number of stackspublic static long npar_shapes_create_cone(int slices,
int stacks)
create_cone@Nullable public static ParShapesMesh par_shapes_create_cone(int slices, int stacks)
create_cylinder but the radius diminishes to zero as Z increases. Again, height and radius are 1.0, but can be changed
with scale.slices - the number of slicesstacks - the number of stackspublic static long npar_shapes_create_torus(int slices,
int stacks,
float radius)
create_torus@Nullable public static ParShapesMesh par_shapes_create_torus(int slices, int stacks, float radius)
scale.slices - the number of slicesstacks - the number of stacksradius - the torus radiuspublic static long npar_shapes_create_parametric_sphere(int slices,
int stacks)
create_parametric_sphere@Nullable public static ParShapesMesh par_shapes_create_parametric_sphere(int slices, int stacks)
slices - the number of slicesstacks - the number of stackspublic static long npar_shapes_create_subdivided_sphere(int nsubdivisions)
create_subdivided_sphere@Nullable public static ParShapesMesh par_shapes_create_subdivided_sphere(int nsubdivisions)
nsubdivisions - the number of subdivisionspublic static long npar_shapes_create_klein_bottle(int slices,
int stacks)
create_klein_bottle@Nullable public static ParShapesMesh par_shapes_create_klein_bottle(int slices, int stacks)
slices - the number of slicesstacks - the number of stackspublic static long npar_shapes_create_trefoil_knot(int slices,
int stacks,
float radius)
create_trefoil_knot@Nullable public static ParShapesMesh par_shapes_create_trefoil_knot(int slices, int stacks, float radius)
slices - the number of slicesstacks - the number of stackspublic static long npar_shapes_create_hemisphere(int slices,
int stacks)
create_hemisphere@Nullable public static ParShapesMesh par_shapes_create_hemisphere(int slices, int stacks)
slices - the number of slicesstacks - the number of stackspublic static long npar_shapes_create_plane(int slices,
int stacks)
create_plane@Nullable public static ParShapesMesh par_shapes_create_plane(int slices, int stacks)
slices - the number of slicesstacks - the number of stackspublic static long npar_shapes_create_icosahedron()
create_icosahedron@Nullable public static ParShapesMesh par_shapes_create_icosahedron()
public static long npar_shapes_create_dodecahedron()
create_dodecahedron@Nullable public static ParShapesMesh par_shapes_create_dodecahedron()
public static long npar_shapes_create_octahedron()
create_octahedron@Nullable public static ParShapesMesh par_shapes_create_octahedron()
public static long npar_shapes_create_tetrahedron()
create_tetrahedron@Nullable public static ParShapesMesh par_shapes_create_tetrahedron()
public static long npar_shapes_create_cube()
create_cube@Nullable public static ParShapesMesh par_shapes_create_cube()
public static long npar_shapes_create_disk(float radius,
int slices,
long center,
long normal)
create_disk@Nullable public static ParShapesMesh par_shapes_create_disk(float radius, int slices, java.nio.FloatBuffer center, java.nio.FloatBuffer normal)
radius - the disk radiusslices - the number of slicescenter - the disk centernormal - the disk normalpublic static long npar_shapes_create_empty()
create_empty@Nullable public static ParShapesMesh par_shapes_create_empty()
merge_and_free.public static long npar_shapes_create_rock(int seed,
int nsubdivisions)
create_rock@Nullable public static ParShapesMesh par_shapes_create_rock(int seed, int nsubdivisions)
seed - a seed valuensubdivisions - the number of subdivisionspublic static long npar_shapes_create_lsystem(long program,
int slices,
int maxdepth)
create_lsystem@Nullable public static ParShapesMesh par_shapes_create_lsystem(java.nio.ByteBuffer program, int slices, int maxdepth)
program - the list of command-argument pairsslices - the number of slicesmaxdepth - the maximum depth@Nullable public static ParShapesMesh par_shapes_create_lsystem(java.lang.CharSequence program, int slices, int maxdepth)
program - the list of command-argument pairsslices - the number of slicesmaxdepth - the maximum depthpublic static void npar_shapes_export(long mesh,
long objfile)
exportpublic static void par_shapes_export(ParShapesMesh mesh, java.nio.ByteBuffer objfile)
mesh - the mesh to exportobjfile - the OBJ file pathpublic static void par_shapes_export(ParShapesMesh mesh, java.lang.CharSequence objfile)
mesh - the mesh to exportobjfile - the OBJ file pathpublic static void npar_shapes_compute_aabb(long mesh,
long aabb)
compute_aabbpublic static void par_shapes_compute_aabb(ParShapesMesh mesh, java.nio.FloatBuffer aabb)
mesh - the mesh to queryaabb - a pointer to an array of 6 floats in which the AABB will be writtenpublic static long npar_shapes_clone(long mesh,
long target)
clone@Nullable public static ParShapesMesh par_shapes_clone(ParShapesMesh mesh, @Nullable ParShapesMesh target)
NULL to target. To avoid memory churn, pass an existing mesh to target.mesh - the mesh to copytarget - the target meshpublic static void npar_shapes_merge(long dst,
long src)
mergepublic static void par_shapes_merge(ParShapesMesh dst, ParShapesMesh src)
dst - the destination meshsrc - the source meshpublic static void npar_shapes_translate(long mesh,
float x,
float y,
float z)
translatepublic static void par_shapes_translate(ParShapesMesh mesh, float x, float y, float z)
mesh - the mesh to translatex - the X axis translation amounty - the Y axis translation amountz - the Z axis translation amountpublic static void npar_shapes_rotate(long mesh,
float radians,
long axis)
rotatepublic static void par_shapes_rotate(ParShapesMesh mesh, float radians, java.nio.FloatBuffer axis)
mesh - the mesh to rotateradians - the rotation angle, in radiansaxis - the rotation axispublic static void npar_shapes_scale(long mesh,
float x,
float y,
float z)
scalepublic static void par_shapes_scale(ParShapesMesh mesh, float x, float y, float z)
mesh - the mesh to scalex - the X axis scale factory - the Y axis scale factorz - the Z axis scale factorpublic static void npar_shapes_merge_and_free(long dst,
long src)
merge_and_freepublic static void par_shapes_merge_and_free(ParShapesMesh dst, ParShapesMesh src)
dst - the destination meshsrc - the source meshpublic static void npar_shapes_invert(long mesh,
int startface,
int nfaces)
invertpublic static void par_shapes_invert(ParShapesMesh mesh, int startface, int nfaces)
nfaces to reverse every face in the mesh.mesh - the mesh to reversestartface - the index of the first face to reversenfaces - the number of faces to reversepublic static void npar_shapes_remove_degenerate(long mesh,
float minarea)
remove_degeneratepublic static void par_shapes_remove_degenerate(ParShapesMesh mesh, float minarea)
minarea.mesh - the mesh to cleanupminarea - triangles with an area below this value will be removedpublic static void npar_shapes_unweld(long mesh,
boolean create_indices)
unweldpublic static void par_shapes_unweld(ParShapesMesh mesh, boolean create_indices)
This creates an inefficient structure, but is useful for drawing facets. If create_indices is true, a trivial "0 1 2 3..." index buffer is
generated.
mesh - the mesh to unweldcreate_indices - if an index buffer should be generatedpublic static long npar_shapes_weld(long mesh,
float epsilon,
long mapping)
weld@Nullable public static ParShapesMesh par_shapes_weld(ParShapesMesh mesh, float epsilon, @Nullable java.nio.IntBuffer mapping)
mesh - the mesh to weldepsilon - the maximum distance to consider when welding verticesmapping - null, or a pointer to npoints 32-bit integers, which gets filled with the mapping from old vertex indices to new indicespublic static void npar_shapes_compute_normals(long mesh)
compute_normalspublic static void par_shapes_compute_normals(ParShapesMesh mesh)
mesh - the meshpublic static void par_shapes_set_epsilon_welded_normals(float epsilon)
public static void par_shapes_set_epsilon_degenerate_sphere(float epsilon)
public static void npar_shapes__compute_welded_normals(long m)
public static void par_shapes__compute_welded_normals(ParShapesMesh m)
public static void npar_shapes__connect(long scene,
long cylinder,
int slices)
public static void par_shapes__connect(ParShapesMesh scene, ParShapesMesh cylinder, int slices)
public static long npar_shapes_create_disk(float radius,
int slices,
float[] center,
float[] normal)
npar_shapes_create_disk(float, int, long, long)@Nullable public static ParShapesMesh par_shapes_create_disk(float radius, int slices, float[] center, float[] normal)
create_diskpublic static void npar_shapes_compute_aabb(long mesh,
float[] aabb)
npar_shapes_compute_aabb(long, long)public static void par_shapes_compute_aabb(ParShapesMesh mesh, float[] aabb)
compute_aabbpublic static void npar_shapes_rotate(long mesh,
float radians,
float[] axis)
npar_shapes_rotate(long, float, long)public static void par_shapes_rotate(ParShapesMesh mesh, float radians, float[] axis)
rotatepublic static long npar_shapes_weld(long mesh,
float epsilon,
int[] mapping)
npar_shapes_weld(long, float, long)@Nullable public static ParShapesMesh par_shapes_weld(ParShapesMesh mesh, float epsilon, @Nullable int[] mapping)
weldCopyright LWJGL. All Rights Reserved. License terms.