Usage example:
// Specify a 100x100x20 rounded box.
const par_octasphere_config cfg = {
.corner_radius = 5,
.width = 100,
.height = 100,
.depth = 20,
.num_subdivisions = 3,
};
// Allocate memory for the mesh and opt-out of normals.
uint32_t num_indices;
uint32_t num_vertices;
par_octasphere_get_counts(&cfg, &num_indices, &num_vertices);
par_octasphere_mesh mesh = {
.positions = malloc(sizeof(float) * 3 * num_vertices),
.normals = NULL,
.texcoords = malloc(sizeof(float) * 2 * num_vertices),
.indices = malloc(sizeof(uint16_t) * num_indices),
};
// Generate vertex coordinates, UV's, and triangle indices.
par_octasphere_populate(&cfg, &mesh);
To generate a sphere: set width, height, and depth to 0 in your configuration. To generate a capsule shape: set only two of these dimensions to 0.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | par_octasphere_NORMALS_SMOOTH
|
| public static final int | |
| public static final int | par_octasphere_UV_LATLONG
|
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static native void | npar_octasphere_get_counts(long config, long num_indices, long num_vertices)
Unsafe version of: |
| public static native void | npar_octasphere_get_counts(long config, int[] num_indices, int[] num_vertices)
Array version of: |
| public static native void | |
| public static void | par_octasphere_get_counts(ParOctasphereConfig config, IntBuffer num_indices, IntBuffer num_vertices)
Computes the maximum possible number of indices and vertices for the given octasphere config. |
| public static void | par_octasphere_get_counts(ParOctasphereConfig config, int[] num_indices, int[] num_vertices)
Array version of: |
| public static void | par_octasphere_populate(ParOctasphereConfig config, ParOctasphereMesh mesh)
Populates a pre-allocated mesh structure with indices and vertices. |
| par_octasphere_NORMALS_SMOOTH | back to summary |
|---|---|
| public static final int par_octasphere_NORMALS_SMOOTH
| |
| par_octasphere_PAR_OCTASPHERE_MAX_SUBDIVISIONS | back to summary |
|---|---|
| public static final int par_octasphere_PAR_OCTASPHERE_MAX_SUBDIVISIONS | |
| par_octasphere_UV_LATLONG | back to summary |
|---|---|
| public static final int par_octasphere_UV_LATLONG
| |
| ParOctasphere | back to summary |
|---|---|
| protected ParOctasphere() | |
| npar_octasphere_get_counts | back to summary |
|---|---|
| public static native void npar_octasphere_get_counts(long config, long num_indices, long num_vertices) Unsafe version of: | |
| npar_octasphere_get_counts | back to summary |
|---|---|
| public static native void npar_octasphere_get_counts(long config, int[] num_indices, int[] num_vertices) Array version of: | |
| npar_octasphere_populate | back to summary |
|---|---|
| public static native void npar_octasphere_populate(long config, long mesh) Unsafe version of: | |
| par_octasphere_get_counts | back to summary |
|---|---|
| public static void par_octasphere_get_counts(ParOctasphereConfig config, IntBuffer num_indices, IntBuffer num_vertices) Computes the maximum possible number of indices and vertices for the given octasphere config. | |
| par_octasphere_get_counts | back to summary |
|---|---|
| public static void par_octasphere_get_counts(ParOctasphereConfig config, int[] num_indices, int[] num_vertices) Array version of: | |
| par_octasphere_populate | back to summary |
|---|---|
| public static void par_octasphere_populate(ParOctasphereConfig config, ParOctasphereMesh mesh) Populates a pre-allocated mesh structure with indices and vertices. | |