简体   繁体   English

不知道如何访问 Three.js 中的 ParametricGeometry

[英]Don't know how to access ParametricGeometry in Three.js

I have tried to research how to access ParametricGeometry as I get this message every time I try to use it "THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"我尝试研究如何访问 ParametricGeometry,因为每次尝试使用它时都会收到此消息“THREE.ParametricGeometry 已移至 /examples/jsm/geometries/ParametricGeometry.js”

Any thoughts on how would be much appreciated.任何关于如何的想法将不胜感激。

Here is a working example, built with the docs:这是一个使用文档构建的工作示例:

 body{ overflow: hidden; margin: 0; }
 <script type="module"> import * as THREE from "https://cdn.skypack.dev/three@0.136.0"; import {OrbitControls} from "https://cdn.skypack.dev/three@0.136.0/examples/jsm/controls/OrbitControls"; import {ParametricGeometry} from "https://cdn.skypack.dev/three@0.136.0/examples/jsm/geometries/ParametricGeometry"; import {ParametricGeometries} from "https://cdn.skypack.dev/three@0.136.0/examples/jsm/geometries/ParametricGeometries"; let scene = new THREE.Scene(); let camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 1, 1000); camera.position.setScalar(10); let renderer = new THREE.WebGLRenderer(); renderer.setSize(innerWidth, innerHeight); document.body.appendChild(renderer.domElement); let contorls = new OrbitControls(camera, renderer.domElement); const geometry = new ParametricGeometry( ParametricGeometries.klein, 25, 25 ); const material = new THREE.MeshBasicMaterial( { map: new THREE.TextureLoader().load("https://threejs.org/examples/textures/uv_grid_opengl.jpg") } ); const klein = new THREE.Mesh( geometry, material ); scene.add( klein ); renderer.setAnimationLoop(() => { renderer.render(scene, camera); }); </script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM