0

我最近发现了 THREE.js,一切正常。我已经在我的html中实现了它。

<script src="https://rawgithub.com/mrdoob/three.js/master/build/three.js"></script>

我的问题是,我如何访问“附加”?我想使用 CircleGeomtry。我查看了他们的文档,但不确定如何在我的 HTML 中实现它。

这就是他们的文档中所说的

src/extras/geometries/CircleGeometry.js

我必须下载它吗?或者我可以像上面那样链接到它吗?

4

1 回答 1

0

如果您在您发布的three.js url 中搜索源代码CircleGeometry,您将看到该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);

three.js 中的“附加”都包含在分布式库中。库的源代码被分成许多文件,以保持代码库的组织性。但不要将其与将所有这些文件合并为一个以使其易于包含在网页中的内置库脚本混淆。

于 2013-08-27T18:52:30.183 回答