Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
290502de
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
290502de
编写于
3月 03, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Docs: Geometry, Math and Vertex.
上级
3abd17c0
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
195 addition
and
295 deletion
+195
-295
docs/api/core/Geometry.html
docs/api/core/Geometry.html
+147
-4
docs/api/core/Geometry.rst
docs/api/core/Geometry.rst
+0
-198
docs/api/core/Math.html
docs/api/core/Math.html
+45
-8
docs/api/core/Math.rst
docs/api/core/Math.rst
+0
-60
docs/api/core/Vertex.html
docs/api/core/Vertex.html
+2
-10
docs/api/core/Vertex.rst
docs/api/core/Vertex.rst
+0
-14
docs/index.html
docs/index.html
+1
-1
未找到文件。
docs/api/core/Geometry.html
浏览文件 @
290502de
<h1>
[name]
</h1>
<div
class=
"desc"
>
todo
</div>
<div
class=
"desc"
>
Base class for geometries
</div>
<h2>
Example
</h2>
<code>
// geometry with random points
var geometry = new THREE.Geometry()
for ( var i = 0; i
<
10000;
i
++
)
{
var
vertex =
new
THREE.Vertex
();
vertex.position.x =
Math.random()
*
1000
-
500;
vertex.position.y =
Math.random()
*
1000
-
500;
vertex.position.z =
Math.random()
*
1000
-
500;
geometry.vertices.push
(
vertex
);
}
geometry.computeBoundingSphere
();
</
code
>
<h2>
Constructor
</h2>
<h3>
[name]()
</h3>
...
...
@@ -10,14 +30,137 @@
<h2>
Properties
</h2>
<h3>
.[page:Vector3 todo]
</h3>
<h3>
.[page:Integer id]
</h3>
<div>
Unique number of this geometry instance
</div>
<h3>
.[page:Array vertices]
</h3>
<div>
Array of [page:Vertex vertices].
</div>
<h3>
.[page:Array colors]
</h3>
<div>
Array of vertex [page:Color colors], matching number and order of vertices.
<br
/>
Used in [page:ParticleSystem], [page:Line] and [page:Ribbon].
<br
/>
[page:Mesh Meshes] use per-face-use-of-vertex colors embedded directly in faces.
</div>
<h3>
.[page:Array materials]
</h3>
<div>
Array of [page:Material materials].
</div>
<h3>
.[page:Array faces]
</h3>
<div>
Array of [page:Face3 triangles] or/and [page:Face4 quads].
</div>
<h3>
.[page:Array faceUvs]
</h3>
<div>
Array of face [page:UV] layers.
<br
/>
Each UV layer is an array of [page:UV] matching order and number of faces.
</div>
<h3>
.[page:Array faceVertexUvs]
</h3>
<div>
Array of face [page:UV] layers.
<br
/>
Each UV layer is an array of [page:UV] matching order and number of vertices in faces.
</div>
<h3>
.[page:Array morphTargets]
</h3>
<div>
Array of morph targets. Each morph target is JS object:
<code>
{ name: "targetName", vertices: [ new THREE.Vertex(), ... ] }
</code>
Morph vertices match number and order of primary vertices.
</div>
<h3>
.[page:Array morphColors]
</h3>
<div>
Array of morph colors. Morph colors have similar structure as morph targets, each color set is JS object:
<code>
morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] }
</code>
Morph colors can match either number and order of faces (face colors) or number of vertices (vertex colors).
</div>
<h3>
.[page:Array skinWeights]
</h3>
<div>
Array of skinning weights, matching number and order of vertices.
</div>
<h3>
.[page:Array skinIndices]
</h3>
<div>
Array of skinning indices, matching number and order of vertices.
</div>
<h3>
.[page:Object boundingBox]
</h3>
<div>
Bounding box.
<code>
{ min: new THREE.Vector3(), max: new THREE.Vector3() }
</code>
</div>
<h3>
.[page:Object boundingSphere]
</h3>
<div>
Bounding sphere.
<code>
{ radius: float }
</code>
</div>
<h3>
.[page:Boolean hasTangents]
</h3>
<div>
True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents].
</div>
<h3>
.[page:Boolean dynamic]
</h3>
<div>
Set to
<strong>
true
</strong>
if attribute buffers will need to change in runtime (using "dirty" flags).
<br/>
Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.
</div>
<h2>
Methods
</h2>
<h3>
.todo( [page:Vector3 todo] )
</h3>
<h3>
.applyMatrix( [page:Matrix4 matrix] )
</h3>
<div>
Bakes matrix transform directly into vertex coordinates.
</div>
<h3>
.computeCentroids()
</h3>
<div>
Computes centroids for all faces.
</div>
<h3>
.computeFaceNormals()
</h3>
<div>
Computes face normals.
</div>
<h3>
.computeVertexNormals()
</h3>
<div>
Computes vertex normals by averaging face normals.
<br
/>
Face normals must be existing / computed beforehand.
</div>
<h3>
.computeTangents()
</h3>
<div>
Computes vertex tangents.
<br
/>
Based on
<a
href=
"http://www.terathon.com/code/tangent.html"
target=
"_blank"
>
http://www.terathon.com/code/tangent.html
</a><br
/>
Geometry must have vertex [page:UV UVs] (layer 0 will be used).
</div>
<h3>
.computeBoundingBox()
</h3>
<div>
Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
</div>
<h3>
.computeBoundingSphere()
</h3>
<div>
Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
</div>
<h3>
.mergeVertices()
</h3>
<div>
todo — todo
<br
/>
Checks for duplicate vertices using hashmap.
<br
/>
Duplicated vertices are removed and faces' vertices are updated.
</div>
...
...
docs/api/core/Geometry.rst
已删除
100644 → 0
浏览文件 @
3abd17c0
Geometry - Base class for geometries
----------------------------------------
.. ...............................................................................
.. rubric:: Constructor
.. ...............................................................................
.. class:: Geometry()
Base class for geometries
Encapsulates unique instances of vertex buffer objects in :class:`WebGLRenderer`
.. ...............................................................................
.. rubric:: Attributes
.. ...............................................................................
.. attribute:: Geometry.id
Unique number of this geometry instance
.. attribute:: Geometry.boundingBox
Bounding box
::
boundingBox = { min: new THREE.Vector3(), max: new THREE.Vector3() }
.. attribute:: Geometry.boundingSphere
Bounding sphere
::
boundingSphere = { radius: float }
.. attribute:: Geometry.materials
Array of :class:`materials <Material>`
Used with models containing multiple materials in a single geometry (with pass-through :class:`MeshFaceMaterial`)
Face indices index into this array.
.. ...............................................................................
.. rubric:: Attribute buffers
.. ...............................................................................
.. attribute:: Geometry.faces
Array of faces (:class:`Face3`, :class:`Face4`)
.. attribute:: Geometry.vertices
Array of :class:`vertices <Vertex>`
Face indices index into this array.
.. attribute:: Geometry.colors
Array of vertex :class:`colors <Color>`, matching number and order of vertices.
Used in :class:`ParticleSystem`, :class:`Line` and :class:`Ribbon`.
:class:`Meshes <Mesh>` use per-face-use-of-vertex colors embedded directly in faces.
.. attribute:: Geometry.faceUvs
Array of face UV layers.
Each UV layer is an array of :class:`UV` matching order and number of faces.
.. attribute:: Geometry.faceVertexUvs
Array of vertex UV layers.
Each UV layer is an array of :class:`UV` matching order and number of vertices in faces.
.. attribute:: Geometry.morphTargets
Array of morph targets.
Each morph target is JS object:
::
morphTarget = { name: "targetName", vertices: [ new THREE.Vertex(), ... ] }
Morph vertices match number and order of primary vertices.
.. attribute:: Geometry.morphColors
Array of morph colors.
Morph colors have similar structure as morph targets, each color set is JS object:
::
morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] }
Morph colors can match either number and order of faces (face colors) or number of vertices (vertex colors).
.. attribute:: Geometry.skinWeights
Array of skinning weights (:class:`Vector4`), matching number and order of vertices.
.. attribute:: Geometry.skinIndices
Array of skinning indices (:class:`Vector4`), matching number and order of vertices.
.. ...............................................................................
.. rubric:: Flags
.. ...............................................................................
.. attribute:: Geometry.hasTangents
True if geometry has tangents. Set in :func:`Geometry.computeTangents`
``default false``
.. attribute:: Geometry.dynamic
Set to `true` if attribute buffers will need to change in runtime (using ``dirty`` flags).
Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.
``default false``
.. ...............................................................................
.. rubric:: Methods
.. ...............................................................................
.. function:: Geometry.applyMatrix( matrix )
Bakes matrix transform directly into vertex coordinates
:param Matrix4 matrix: matrix transform
.. function:: Geometry.computeCentroids()
Computes centroids for all faces
.. function:: Geometry.computeFaceNormals()
Computes face normals
.. function:: Geometry.computeVertexNormals()
Computes vertex normals by averaging face normals.
Face normals must be existing / computed beforehand.
.. function:: Geometry.computeTangents()
Computes vertex tangents
Based on http://www.terathon.com/code/tangent.html
Geometry must have vertex UVs (layer 0 will be used).
.. function:: Geometry.computeBoundingBox()
Computes bounding box of the geometry, updating :attr:`Geometry.boundingBox` attribute.
.. function:: Geometry.computeBoundingSphere()
Computes bounding sphere of the geometry, updating :attr:`Geometry.boundingSphere` attribute.
.. function:: Geometry.mergeVertices()
Checks for duplicate vertices using hashmap.
Duplicated vertices are removed and faces' vertices are updated.
.. ...............................................................................
.. rubric:: Example
.. ...............................................................................
::
// geometry with random points
// (useful for example with ParticleSystem)
var n = 10000;
var geometry = new THREE.Geometry()
for ( var i = 0; i < n; i ++ ) {
var x = THREE.MathUtils.randFloatSpread( 1000 );
var y = THREE.MathUtils.randFloatSpread( 1000 );
var z = THREE.MathUtils.randFloatSpread( 1000 );
var position = new THREE.Vector3( x, y, z );
var vertex = new THREE.Vertex( position );
geometry.vertices.push( vertex );
}
geometry.computeBoundingSphere();
docs/api/core/Math.html
浏览文件 @
290502de
<h1>
[name]
</h1>
<div
class=
"desc"
>
todo
</div>
<div
class=
"desc"
>
Math utility functions
</div>
<h2>
Constructor
</h2>
<h2>
Methods
</h2>
<h3>
[name]()
</h3>
<h3>
.clamp( [page:Float x], [page:Float a], [page:Float b] ) [page:Float]
</h3>
<div>
x — Value to be clamped.
<br
/>
a — Minimum value
<br
/>
b — Maximum value.
</div>
<div>
Clamps the
<strong>
x
</strong>
to be between
<strong>
a
</strong>
and
<strong>
b
</strong>
.
</div>
<h3>
.clampBottom( [page:Float x], [page:Float a] ) [page:Float]
</h3>
<div>
x — Value to be clamped.
<br
/>
a — Minimum value
</div>
<div>
Clamps the
<strong>
x
</strong>
to be larger than
<strong>
a
</strong>
.
</div>
<h2>
Properties
</h2>
<h3>
.mapLinear( [page:Float x], [page:Float a] ) [page:Float]
</h3>
<div>
x — Value to be mapped.
<br
/>
a1 — Minimum value for range A.
<br
/>
a2 — Maximum value for range A.
<br
/>
b1 — Minimum value for range B.
<br
/>
b2 — Maximum value for range B.
</div>
<div>
Linear mapping of
<strong>
x
</strong>
from range [
<strong>
a1
</strong>
,
<strong>
a2
</strong>
] to range [
<strong>
b1
</strong>
,
<strong>
b2
</strong>
].
</div>
<h3>
.[page:Vector3 todo]
</h3>
<h3>
.random16() [page:Float]
</h3>
<div>
Random float from 0 to 1 with 16 bits of randomness.
<br
/>
Standard Math.random() creates repetitive patterns when applied over larger space.
</div>
<h3>
.randInt( [page:Integer low], [page:Integer high] ) [page:Integer]
</h3>
<div>
Random integer from
<strong>
low
</strong>
to
<strong>
high
</strong>
interval.
</div>
<h2>
Methods
</h2>
<h3>
.randFloat( [page:Float low], [page:Float high] ) [page:Float]
</h3>
<div>
Random float from
<strong>
low
</strong>
to
<strong>
high
</strong>
interval.
</div>
<h3>
.
todo( [page:Vector3 todo] )
</h3>
<h3>
.
randFloatSpread( [page:Float range] ) [page:Float]
</h3>
<div>
todo — todo
<br
/>
Random float from
<strong>
- range / 2
</strong>
to
<strong>
range / 2
</strong>
interval.
</div>
...
...
docs/api/core/Math.rst
已删除
100644 → 0
浏览文件 @
3abd17c0
Math - Math utility functions
-----------------------------
.. ...............................................................................
.. rubric:: Methods
.. ...............................................................................
.. function:: Math.clamp( x, a, b )
Clamps the x to be between a and b
:param float x: value to be clamped
:param float a: minimum value
:param float b: maximum value
:returns: Clamped value
:rtype: float
.. function:: Math.clampBottom( x, a )
Clamps the x to be larger than a
:param float x: value to be clamped
:param float a: minimum value
:returns: Clamped value
:rtype: float
.. function:: Math.mapLinear( x, a1, a2, b1, b2 )
Linear mapping of x from range <a1, a2> to range <b1, b2>
:param float x: value to be mapped
:param float a1: minimum value for range A
:param float a2: maximum value for range A
:param float b1: minimum value for range B
:param float b2: maximum value for range B
:returns: mapped value
:rtype: float
.. function:: Math.random16()
Random float from <0, 1> with 16 bits of randomness
(standard Math.random() creates repetitive patterns when applied over larger space)
:returns: Random float from <0, 1> with 16 bits of randomness
:rtype: float
.. function:: Math.randInt( low, high )
:returns: Random integer from *low* to *high* interval
:rtype: integer
.. function:: Math.randFloat( low, high )
:returns: Random float from *low* to *high* interval
:rtype: float
.. function:: Math.randFloatSpread( range )
:returns: Random float from -range/2 to range/2 interval
:rtype: float
docs/api/core/Vertex.html
浏览文件 @
290502de
<h1>
[name]
</h1>
<div
class=
"desc"
>
todo
</div>
<div
class=
"desc"
></div>
<h2>
Constructor
</h2>
...
...
@@ -10,15 +10,7 @@
<h2>
Properties
</h2>
<h3>
.[page:Vector3 todo]
</h3>
<h2>
Methods
</h2>
<h3>
.todo( [page:Vector3 todo] )
</h3>
<div>
todo — todo
<br
/>
</div>
<h3>
.[page:Vector3 position]
</h3>
<h2>
Source
</h2>
...
...
docs/api/core/Vertex.rst
已删除
100644 → 0
浏览文件 @
3abd17c0
Vertex - Represents a vertex in space
-------------------------------------
.. rubric:: Constructor
.. class:: Vertex()
Represents a vertex in space
.. rubric:: Attributes
.. rubric:: Method
.. rubric:: Example(s)
\ No newline at end of file
docs/index.html
浏览文件 @
290502de
...
...
@@ -351,7 +351,7 @@
text
=
text
.
replace
(
/
\[
name
\]
/gi
,
name
);
text
=
text
.
replace
(
/
\[
path
\]
/gi
,
path
);
text
=
text
.
replace
(
/
\[
page:
(\w
+
)\]
/gi
,
"
<a href=
\"
javascript:goTo('$1')
\"
title=
\"
$1
\"
>$1</a>
"
);
text
=
text
.
replace
(
/
\[
page:
(\w
+
)
(
\w
+
)\]
/gi
,
"
<a href=
\"
javascript:goTo('$1')
\"
title=
\"
$1
\"
>$2</a>
"
);
text
=
text
.
replace
(
/
\[
page:
(\w
+
)
(
[\w
|
\.]
+
)\]
/gi
,
"
<a href=
\"
javascript:goTo('$1')
\"
title=
\"
$1
\"
>$2</a>
"
);
viewer
.
innerHTML
=
'
<br>
'
+
text
+
'
<br><br>
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录