@woosh/meep-engine 2.139.0 → 2.140.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts +3 -3
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js +4 -4
- package/src/{engine/physics/broadphase/aabb_transform_oriented.d.ts → core/geom/3d/aabb/aabb3_transform_oriented.d.ts} +2 -2
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -0
- package/src/{engine/physics/broadphase/aabb_transform_oriented.js → core/geom/3d/aabb/aabb3_transform_oriented.js} +1 -1
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts +54 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.js +69 -0
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts +24 -2
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.js +24 -1
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts +148 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.js +451 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts +210 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/MeshShape3D.js +593 -0
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +46 -2
- package/src/core/geom/3d/shape/Triangle3D.d.ts +95 -0
- package/src/core/geom/3d/shape/Triangle3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/Triangle3D.js +318 -0
- package/src/core/geom/3d/shape/UnionShape3D.js +13 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts +30 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts.map +1 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.js +64 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.js +9 -11
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts +28 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.js +48 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.js +40 -18
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts +9 -5
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.js +38 -10
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts +14 -5
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.js +47 -5
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts +19 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.js +75 -13
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts +2 -2
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.js +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.js +2 -2
- package/src/core/geom/vec3/v3_negate_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_negate_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_negate_array.js +2 -2
- package/src/core/geom/vec3/v3_quat3_apply.d.ts +29 -0
- package/src/core/geom/vec3/v3_quat3_apply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply.js +39 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts +30 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.js +41 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts +32 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_triple_cross_product.js +45 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +16 -3
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +211 -211
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +72 -8
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +37 -5
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +101 -3
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +1789 -1416
- package/src/engine/control/first-person/TODO.md +173 -127
- package/src/engine/control/first-person/abilities/Slide.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Slide.js +9 -1
- package/src/engine/control/first-person/prototype_first_person_controller.js +88 -2
- package/src/engine/control/first-person/test/buildTestPlayer.d.ts.map +1 -1
- package/src/engine/control/first-person/test/buildTestPlayer.js +9 -1
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts +42 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts.map +1 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.js +171 -0
- package/src/engine/physics/BULLET_REVIEW.md +945 -0
- package/src/engine/physics/CANNON_REVIEW.md +1300 -0
- package/src/engine/physics/JOLT_REVIEW.md +913 -0
- package/src/engine/physics/PLAN.md +461 -236
- package/src/engine/physics/RAPIER_REVIEW.md +934 -0
- package/src/engine/physics/REVIEW_001_ACTION_PLAN.md +642 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +2 -2
- package/src/engine/physics/contact/ManifoldStore.d.ts +83 -10
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
- package/src/engine/physics/contact/ManifoldStore.js +608 -499
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +2 -2
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +128 -20
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +1301 -1159
- package/src/engine/physics/fluid/FluidSimulator.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidSimulator.js +2 -1
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +28 -6
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.js +39 -17
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +6 -6
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -1
- package/src/engine/physics/gjk/expanding_polytope_algorithm.js +68 -22
- package/src/engine/physics/gjk/gjk.d.ts +28 -2
- package/src/engine/physics/gjk/gjk.d.ts.map +1 -1
- package/src/engine/physics/gjk/gjk.js +421 -378
- package/src/engine/physics/gjk/minkowski_support.d.ts +37 -0
- package/src/engine/physics/gjk/minkowski_support.d.ts.map +1 -0
- package/src/engine/physics/gjk/minkowski_support.js +75 -0
- package/src/engine/physics/gjk/mpr.d.ts +56 -0
- package/src/engine/physics/gjk/mpr.d.ts.map +1 -0
- package/src/engine/physics/gjk/mpr.js +344 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +20 -5
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
- package/src/engine/physics/inertia/world_inverse_inertia.js +36 -38
- package/src/engine/physics/integration/integrate_position.d.ts +25 -7
- package/src/engine/physics/integration/integrate_position.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_position.js +43 -12
- package/src/engine/physics/integration/integrate_velocity.d.ts +30 -0
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_velocity.js +82 -1
- package/src/engine/physics/narrowphase/PosedShape.d.ts +0 -8
- package/src/engine/physics/narrowphase/PosedShape.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/PosedShape.js +28 -30
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_box_manifold.js +113 -17
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts +30 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.js +811 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_contacts.js +10 -56
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts +71 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.js +375 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts +91 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/compute_penetration.js +396 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts +35 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.js +80 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts +31 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.js +55 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.js +204 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +94 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts +37 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.js +37 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts +8 -2
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +1422 -382
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/sphere_box_contact.js +16 -23
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts +48 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.js +143 -0
- package/src/engine/physics/queries/overlap_shape.d.ts +51 -0
- package/src/engine/physics/queries/overlap_shape.d.ts.map +1 -0
- package/src/engine/physics/queries/overlap_shape.js +183 -0
- package/src/engine/physics/queries/shape_cast.d.ts +56 -0
- package/src/engine/physics/queries/shape_cast.d.ts.map +1 -0
- package/src/engine/physics/queries/shape_cast.js +387 -0
- package/src/engine/physics/solver/solve_contacts.d.ts +116 -30
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +641 -223
- package/src/engine/physics/broadphase/aabb_transform_oriented.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts +0 -20
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.js +0 -83
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { BufferGeometry, Float32BufferAttribute, Vector3 } from "three";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A capsule aligned with the Y axis, built as a single continuous surface of
|
|
5
|
+
* revolution: a top hemispherical cap, a cylindrical mid-section and a bottom
|
|
6
|
+
* hemispherical cap.
|
|
7
|
+
*
|
|
8
|
+
* Dimensions follow the {@link CapsuleShape3D} convention:
|
|
9
|
+
* - `radius` is the radius of both the caps and the cylindrical section.
|
|
10
|
+
* - `height` is the length of the cylindrical section ONLY (the caps are
|
|
11
|
+
* added on top of it), so the total extent along Y is `height + 2 * radius`,
|
|
12
|
+
* spanning `[-(height/2 + radius), +(height/2 + radius)]`, centred at the
|
|
13
|
+
* origin.
|
|
14
|
+
*
|
|
15
|
+
* Two further parameters control tessellation:
|
|
16
|
+
* - `capSegments` rings per hemispherical cap (from equator to pole).
|
|
17
|
+
* - `radialSegments` segments around the Y axis.
|
|
18
|
+
*
|
|
19
|
+
* Watertightness: the mesh is emitted as one grid of vertex rings running from
|
|
20
|
+
* the top pole down to the bottom pole. Consecutive rings — including the
|
|
21
|
+
* top-equator -> bottom-equator ring that spans the cylinder — are stitched
|
|
22
|
+
* sharing their ring vertices, so there is never a gap between the caps and the
|
|
23
|
+
* body. The angular seam is duplicated only for UV continuity (the duplicate
|
|
24
|
+
* sits at the same position) and each pole is a proper triangle fan, so welding
|
|
25
|
+
* vertices by position yields a closed, consistently oriented 2-manifold.
|
|
26
|
+
*/
|
|
27
|
+
export class CapsuleGeometry extends BufferGeometry {
|
|
28
|
+
/**
|
|
29
|
+
* @param {number} [radius=0.5] radius of the caps and the cylindrical section
|
|
30
|
+
* @param {number} [height=1] length of the cylindrical section, excluding the caps
|
|
31
|
+
* @param {number} [capSegments=8] number of rings in each hemispherical cap
|
|
32
|
+
* @param {number} [radialSegments=16] number of segments around the Y axis
|
|
33
|
+
*/
|
|
34
|
+
constructor(radius = 0.5, height = 1, capSegments = 8, radialSegments = 16) {
|
|
35
|
+
super();
|
|
36
|
+
|
|
37
|
+
this.type = 'CapsuleGeometry';
|
|
38
|
+
|
|
39
|
+
this.parameters = {
|
|
40
|
+
radius: radius,
|
|
41
|
+
height: height,
|
|
42
|
+
capSegments: capSegments,
|
|
43
|
+
radialSegments: radialSegments
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
capSegments = Math.max(1, Math.floor(capSegments));
|
|
47
|
+
radialSegments = Math.max(3, Math.floor(radialSegments));
|
|
48
|
+
|
|
49
|
+
const half_height = height / 2;
|
|
50
|
+
|
|
51
|
+
// arc length of the lateral profile, used to keep the V coordinate
|
|
52
|
+
// proportional to surface distance across the caps and the body
|
|
53
|
+
const cap_arc = radius * (Math.PI / 2);
|
|
54
|
+
const profile_length = 2 * cap_arc + height;
|
|
55
|
+
const inv_profile = profile_length > 0 ? 1 / profile_length : 0;
|
|
56
|
+
|
|
57
|
+
// number of vertex rows from the top pole (row 0) to the bottom pole.
|
|
58
|
+
// top hemisphere: capSegments + 1 rows (pole .. top equator),
|
|
59
|
+
// bottom hemisphere: capSegments + 1 rows (bottom equator .. pole).
|
|
60
|
+
const row_count = 2 * (capSegments + 1);
|
|
61
|
+
|
|
62
|
+
const indices = [];
|
|
63
|
+
const vertices = [];
|
|
64
|
+
const normals = [];
|
|
65
|
+
const uvs = [];
|
|
66
|
+
|
|
67
|
+
const vertex = new Vector3();
|
|
68
|
+
const normal = new Vector3();
|
|
69
|
+
|
|
70
|
+
// grid[row] -> array of vertex indices for that ring
|
|
71
|
+
const grid = [];
|
|
72
|
+
|
|
73
|
+
let index = 0;
|
|
74
|
+
|
|
75
|
+
for (let row = 0; row < row_count; row++) {
|
|
76
|
+
|
|
77
|
+
// resolve the profile angle (measured from the +Y pole of the owning
|
|
78
|
+
// hemisphere), that hemisphere's centre Y, and the cumulative surface
|
|
79
|
+
// arc length from the top pole
|
|
80
|
+
let angle;
|
|
81
|
+
let center_y;
|
|
82
|
+
let arc;
|
|
83
|
+
|
|
84
|
+
if (row <= capSegments) {
|
|
85
|
+
// top hemisphere: alpha 0 .. PI/2, centred at +half_height
|
|
86
|
+
angle = (row / capSegments) * (Math.PI / 2);
|
|
87
|
+
center_y = half_height;
|
|
88
|
+
arc = radius * angle;
|
|
89
|
+
} else {
|
|
90
|
+
// bottom hemisphere: beta PI/2 .. PI, centred at -half_height
|
|
91
|
+
const k = row - (capSegments + 1);
|
|
92
|
+
angle = (Math.PI / 2) + (k / capSegments) * (Math.PI / 2);
|
|
93
|
+
center_y = -half_height;
|
|
94
|
+
arc = cap_arc + height + radius * (angle - Math.PI / 2);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const sin_angle = Math.sin(angle);
|
|
98
|
+
const cos_angle = Math.cos(angle);
|
|
99
|
+
|
|
100
|
+
const ring_radius = radius * sin_angle;
|
|
101
|
+
const y = center_y + radius * cos_angle;
|
|
102
|
+
|
|
103
|
+
const v = 1 - arc * inv_profile;
|
|
104
|
+
|
|
105
|
+
// nudge the U of the pole vertices half a segment so the texture wraps
|
|
106
|
+
// symmetrically over the triangle fan (mirrors SphereGeometry)
|
|
107
|
+
let u_offset = 0;
|
|
108
|
+
if (row === 0) {
|
|
109
|
+
u_offset = 0.5 / radialSegments;
|
|
110
|
+
} else if (row === row_count - 1) {
|
|
111
|
+
u_offset = -0.5 / radialSegments;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const vertices_row = [];
|
|
115
|
+
|
|
116
|
+
for (let s = 0; s <= radialSegments; s++) {
|
|
117
|
+
|
|
118
|
+
const u = s / radialSegments;
|
|
119
|
+
const theta = u * Math.PI * 2;
|
|
120
|
+
|
|
121
|
+
const cos_theta = Math.cos(theta);
|
|
122
|
+
const sin_theta = Math.sin(theta);
|
|
123
|
+
|
|
124
|
+
// vertex
|
|
125
|
+
vertex.x = ring_radius * cos_theta;
|
|
126
|
+
vertex.y = y;
|
|
127
|
+
vertex.z = ring_radius * sin_theta;
|
|
128
|
+
vertices.push(vertex.x, vertex.y, vertex.z);
|
|
129
|
+
|
|
130
|
+
// normal points away from the central axis on the body and away
|
|
131
|
+
// from the hemisphere centre on the caps
|
|
132
|
+
normal.set(sin_angle * cos_theta, cos_angle, sin_angle * sin_theta).normalize();
|
|
133
|
+
normals.push(normal.x, normal.y, normal.z);
|
|
134
|
+
|
|
135
|
+
// uv
|
|
136
|
+
uvs.push(u + u_offset, v);
|
|
137
|
+
|
|
138
|
+
vertices_row.push(index++);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
grid.push(vertices_row);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// indices — stitch every ring to the next, sharing ring vertices so the
|
|
145
|
+
// caps and the body join with no gaps. The degenerate triangle of each
|
|
146
|
+
// pole quad is skipped (one vertex pair collapses onto the pole).
|
|
147
|
+
for (let row = 0; row < row_count - 1; row++) {
|
|
148
|
+
|
|
149
|
+
for (let s = 0; s < radialSegments; s++) {
|
|
150
|
+
|
|
151
|
+
const a = grid[row][s + 1];
|
|
152
|
+
const b = grid[row][s];
|
|
153
|
+
const c = grid[row + 1][s];
|
|
154
|
+
const d = grid[row + 1][s + 1];
|
|
155
|
+
|
|
156
|
+
// wound so the explicit normals face outward
|
|
157
|
+
if (row !== 0) indices.push(b, a, d);
|
|
158
|
+
if (row !== row_count - 2) indices.push(b, d, c);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
this.setIndex(indices);
|
|
163
|
+
this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
|
|
164
|
+
this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
|
|
165
|
+
this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
static fromJSON(data) {
|
|
169
|
+
return new CapsuleGeometry(data.radius, data.height, data.capSegments, data.radialSegments);
|
|
170
|
+
}
|
|
171
|
+
}
|