Buckets:
ktongue/docker_container / simsite /frontend /node_modules /three-stdlib /helpers /VertexTangentsHelper.js
| import { LineSegments, BufferGeometry, Float32BufferAttribute, LineBasicMaterial, Vector3 } from "three"; | |
| const _v1 = /* @__PURE__ */ new Vector3(); | |
| const _v2 = /* @__PURE__ */ new Vector3(); | |
| class VertexTangentsHelper extends LineSegments { | |
| constructor(object, size = 1, color = 65535) { | |
| const geometry = new BufferGeometry(); | |
| const nTangents = object.geometry.attributes.tangent.count; | |
| const positions = new Float32BufferAttribute(nTangents * 2 * 3, 3); | |
| geometry.setAttribute("position", positions); | |
| super(geometry, new LineBasicMaterial({ color, toneMapped: false })); | |
| this.object = object; | |
| this.size = size; | |
| this.type = "VertexTangentsHelper"; | |
| this.matrixAutoUpdate = false; | |
| this.update(); | |
| } | |
| update() { | |
| this.object.updateMatrixWorld(true); | |
| const matrixWorld = this.object.matrixWorld; | |
| const position = this.geometry.attributes.position; | |
| const objGeometry = this.object.geometry; | |
| const objPos = objGeometry.attributes.position; | |
| const objTan = objGeometry.attributes.tangent; | |
| let idx = 0; | |
| for (let j = 0, jl = objPos.count; j < jl; j++) { | |
| _v1.fromBufferAttribute(objPos, j).applyMatrix4(matrixWorld); | |
| _v2.fromBufferAttribute(objTan, j); | |
| _v2.transformDirection(matrixWorld).multiplyScalar(this.size).add(_v1); | |
| position.setXYZ(idx, _v1.x, _v1.y, _v1.z); | |
| idx = idx + 1; | |
| position.setXYZ(idx, _v2.x, _v2.y, _v2.z); | |
| idx = idx + 1; | |
| } | |
| position.needsUpdate = true; | |
| } | |
| dispose() { | |
| this.geometry.dispose(); | |
| this.material.dispose(); | |
| } | |
| } | |
| export { | |
| VertexTangentsHelper | |
| }; | |
| //# sourceMappingURL=VertexTangentsHelper.js.map | |
Xet Storage Details
- Size:
- 1.65 kB
- Xet hash:
- 4ce96317058617889b93b35f04736d62b20966f749a964bcac038db76b17497d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.