gkjohnson / three-bvh-csg

A flexible, memory compact, fast and dynamic CSG implementation on top of three-mesh-bvh
MIT License
552 stars 45 forks source link

the index of the evaluation result is null and can not render on the scene? #125

Closed df-boy closed 11 months ago

df-boy commented 11 months ago

When I run const csgEvaluator = new Evaluator(); const brush1 = new Brush( new SphereGeometry() ); const brush2 = new Brush( new BoxGeometry() ); const result = csgEvaluator.evaluate( brush1, brush2, SUBTRACTION ); I get the result as: Brush {isObject3D: true, uuid: 'c1fc5563-40a2-4e58-b04b-c483ad04ae8c', name: '', type: 'Mesh', parent: null, …} animations: [] castShadow: false children : [] frustumCulled: true geometry: BufferGeometry attributes: {position: BufferAttribute, uv: BufferAttribute, normal: BufferAttribute} boundingBox: null boundingSphere: null boundsTree: null drawRange: {start: 0, count: 2916} groups: (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}] index: null isBufferGeometry: true morphAttributes: {} morphTargetsRelative: false name: "" type: "BufferGeometry" userData: {} uuid: "63cb9056-c602-4b80-873e-f8b2ba4f66ef" id: 5 [Prototype]: EventDispatcher isBrush: true isMesh: true isObject3D: true layers: Layers {mask: 1} material: (7) [MeshBasicMaterial, MeshBasicMaterial, MeshBasicMaterial, MeshBasicMaterial, MeshBasicMaterial, MeshBasicMaterial, MeshBasicMaterial] matrix: Matrix4 {elements: Array(16)} matrixAutoUpdate: true matrixWorld: Matrix4 {elements: Array(16)} matrixWorldAutoUpdate: true matrixWorldNeedsUpdate: false name: "" parent: null position: Vector3 {x: 0, y: 0, z: 0} quaternion: Quaternion {isQuaternion: true, _x: 0, _y: 0, _z: 0, _w: 1, …} receiveShadow: false renderOrder: 0 rotation: Euler {isEuler: true, _x: 0, _y: 0, _z: 0, _order: 'XYZ', …} scale: Vector3 {x: 1, y: 1, z: 1} type: "Mesh" up: Vector3 {x: 0, y: 1, z: 0} userData: {} uuid: "c1fc5563-40a2-4e58-b04b-c483ad04ae8c" visible: true _previousMatrix: Matrix4 {elements: Array(16)} id: 6 modelViewMatrix: Matrix4 {elements: Array(16)} normalMatrix: Matrix3 {elements: Array(9)}

The index is null and it can render nothing. Can anybody help me solve this problem?

gkjohnson commented 11 months ago

If you want help please put some effort into making a live example and formatting your code.

df-boy commented 11 months ago

Thank you and I have solved this problem by setting the index manually.