我最近发现了THREE.js,我得到了一切。我已经在我的html中实现了这个。
<script src="https://rawgithub.com/mrdoob/three.js/master/build/three.js"></script>
我的问题是,我如何才能访问&#34; extras&#34;?我想使用CircleGeomtry。我查看了他们的文档,但我不确定如何在HTML中实现它。
这就是它们在文档中所说的
src/extras/geometries/CircleGeometry.js
我必须下载吗?或者我可以像上面一样链接到它吗?
答案 0 :(得分:0)
如果您在CircleGeometry
发布的three.js网址上搜索源代码,您会看到该文件中包含CircleGeometry
。
THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) {
THREE.Geometry.call( this );
radius = radius || 50;
thetaStart = thetaStart !== undefined ? thetaStart : 0;
thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
segments = segments !== undefined ? Math.max( 3, segments ) : 8;
// snipped...
}
因此,您根本不需要包含任何额外的脚本。只是实例化你的圈子。
var circleGeom = new THREE.CircleGeometry(10);
&#34; extras&#34; in three.js都包含在分布式库中。该库的源代码被拆分为许多文件,以保持代码库的有序性。但不要将它与构建的库脚本混淆,后者将所有这些文件合并为一个,以便于在网页上包含。