【发布时间】:2021-12-02 06:27:06
【问题描述】:
我可以用 BufferGeometry 创建一个三角形,其中array=new Float32Array([0, 20, 0, 0, 0, 0, 20, 0, 0]);
<mesh>
<bufferGeometry attach="geometry">
<bufferAttribute
attachObject={["attributes", "position"]}
count={3}
array={array}
itemSize={3}
/>
</bufferGeometry>
<meshBasicMaterial
attach="material"
color="#5243aa"
wireframe={false}
side={THREE.DoubleSide}
/>
</mesh>
现在我想使用InstancedMesh 创建 1 个三角形。但是它并没有像预期的那样工作。
<instancedMesh ref={meshRef} args={[null as any, null as any, 1]}>
<bufferGeometry attach="geometry">
<bufferAttribute
attachObject={["attributes", "position"]}
count={3}
array={position}
itemSize={3}
/>
</bufferGeometry>
<meshBasicMaterial
attach="material"
color="#5243aa"
wireframe={false}
side={THREE.DoubleSide}
/>
</instancedMesh>
有什么想法吗?
【问题讨论】:
标签: three.js react-three-fiber