Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
29af1121
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
29af1121
编写于
4月 25, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Completed Helpers switch to BufferGeometry.
上级
ff340dc7
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
64 addition
and
64 deletion
+64
-64
src/core/BufferGeometry.js
src/core/BufferGeometry.js
+1
-1
src/extras/helpers/ArrowHelper.js
src/extras/helpers/ArrowHelper.js
+7
-7
src/extras/helpers/DirectionalLightHelper.js
src/extras/helpers/DirectionalLightHelper.js
+27
-31
src/extras/helpers/FaceNormalsHelper.js
src/extras/helpers/FaceNormalsHelper.js
+1
-1
src/extras/helpers/GridHelper.js
src/extras/helpers/GridHelper.js
+21
-17
src/extras/helpers/HemisphereLightHelper.js
src/extras/helpers/HemisphereLightHelper.js
+1
-1
src/extras/helpers/PointLightHelper.js
src/extras/helpers/PointLightHelper.js
+1
-1
src/extras/helpers/VertexNormalsHelper.js
src/extras/helpers/VertexNormalsHelper.js
+2
-2
src/objects/Line.js
src/objects/Line.js
+1
-1
src/objects/Mesh.js
src/objects/Mesh.js
+1
-1
src/objects/Points.js
src/objects/Points.js
+1
-1
未找到文件。
src/core/BufferGeometry.js
浏览文件 @
29af1121
...
...
@@ -583,7 +583,7 @@ THREE.BufferGeometry.prototype = {
var
box
=
new
THREE
.
Box3
();
var
vector
=
new
THREE
.
Vector3
();
return
function
()
{
return
function
computeBoundingSphere
()
{
if
(
this
.
boundingSphere
===
null
)
{
...
...
src/extras/helpers/ArrowHelper.js
浏览文件 @
29af1121
...
...
@@ -16,10 +16,10 @@
THREE
.
ArrowHelper
=
(
function
()
{
var
lineGeometry
=
new
THREE
.
Geometry
();
lineGeometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
1
,
0
)
);
var
lineGeometry
=
new
THREE
.
Buffer
Geometry
();
lineGeometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32Attribute
(
[
0
,
0
,
0
,
0
,
1
,
0
],
3
)
);
var
coneGeometry
=
new
THREE
.
CylinderGeometry
(
0
,
0.5
,
1
,
5
,
1
);
var
coneGeometry
=
new
THREE
.
Cylinder
Buffer
Geometry
(
0
,
0.5
,
1
,
5
,
1
);
coneGeometry
.
translate
(
0
,
-
0.5
,
0
);
return
function
ArrowHelper
(
dir
,
origin
,
length
,
color
,
headLength
,
headWidth
)
{
...
...
@@ -34,7 +34,7 @@ THREE.ArrowHelper = ( function () {
if
(
headWidth
===
undefined
)
headWidth
=
0.2
*
headLength
;
this
.
position
.
copy
(
origin
);
this
.
line
=
new
THREE
.
Line
(
lineGeometry
,
new
THREE
.
LineBasicMaterial
(
{
color
:
color
}
)
);
this
.
line
.
matrixAutoUpdate
=
false
;
this
.
add
(
this
.
line
);
...
...
@@ -46,7 +46,7 @@ THREE.ArrowHelper = ( function () {
this
.
setDirection
(
dir
);
this
.
setLength
(
length
,
headLength
,
headWidth
);
}
}
;
}()
);
...
...
@@ -100,7 +100,7 @@ THREE.ArrowHelper.prototype.setLength = function ( length, headLength, headWidth
THREE
.
ArrowHelper
.
prototype
.
setColor
=
function
(
color
)
{
this
.
line
.
material
.
color
.
set
(
color
);
this
.
cone
.
material
.
color
.
set
(
color
);
this
.
line
.
material
.
color
.
copy
(
color
);
this
.
cone
.
material
.
color
.
copy
(
color
);
};
src/extras/helpers/DirectionalLightHelper.js
浏览文件 @
29af1121
...
...
@@ -14,34 +14,25 @@ THREE.DirectionalLightHelper = function ( light, size ) {
this
.
matrix
=
light
.
matrixWorld
;
this
.
matrixAutoUpdate
=
false
;
size
=
size
||
1
;
if
(
size
===
undefined
)
size
=
1
;
var
geometry
=
new
THREE
.
Geometry
();
geometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
-
size
,
size
,
0
)
,
new
THREE
.
Vector3
(
size
,
size
,
0
)
,
new
THREE
.
Vector3
(
size
,
-
size
,
0
)
,
new
THREE
.
Vector3
(
-
size
,
-
size
,
0
)
,
new
THREE
.
Vector3
(
-
size
,
size
,
0
)
);
var
geometry
=
new
THREE
.
Buffer
Geometry
();
geometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32Attribute
(
[
-
size
,
size
,
0
,
size
,
size
,
0
,
size
,
-
size
,
0
,
-
size
,
-
size
,
0
,
-
size
,
size
,
0
],
3
)
);
var
material
=
new
THREE
.
LineBasicMaterial
(
{
fog
:
false
}
);
material
.
color
.
copy
(
this
.
light
.
color
).
multiplyScalar
(
this
.
light
.
intensity
);
this
.
lightPlane
=
new
THREE
.
Line
(
geometry
,
material
);
this
.
add
(
this
.
lightPlane
);
this
.
add
(
new
THREE
.
Line
(
geometry
,
material
)
);
geometry
=
new
THREE
.
Geometry
();
geometry
.
vertices
.
push
(
new
THREE
.
Vector3
(),
new
THREE
.
Vector3
()
);
geometry
=
new
THREE
.
BufferGeometry
();
geometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32Attribute
(
[
0
,
0
,
0
,
0
,
0
,
1
],
3
)
);
material
=
new
THREE
.
LineBasicMaterial
(
{
fog
:
false
}
);
material
.
color
.
copy
(
this
.
light
.
color
).
multiplyScalar
(
this
.
light
.
intensity
);
this
.
targetLine
=
new
THREE
.
Line
(
geometry
,
material
);
this
.
add
(
this
.
targetLine
);
this
.
add
(
new
THREE
.
Line
(
geometry
,
material
));
this
.
update
();
...
...
@@ -52,10 +43,13 @@ THREE.DirectionalLightHelper.prototype.constructor = THREE.DirectionalLightHelpe
THREE
.
DirectionalLightHelper
.
prototype
.
dispose
=
function
()
{
this
.
lightPlane
.
geometry
.
dispose
();
this
.
lightPlane
.
material
.
dispose
();
this
.
targetLine
.
geometry
.
dispose
();
this
.
targetLine
.
material
.
dispose
();
var
lightPlane
=
this
.
children
[
0
];
var
targetLine
=
this
.
children
[
1
];
lightPlane
.
geometry
.
dispose
();
lightPlane
.
material
.
dispose
();
targetLine
.
geometry
.
dispose
();
targetLine
.
material
.
dispose
();
};
...
...
@@ -71,12 +65,14 @@ THREE.DirectionalLightHelper.prototype.update = function () {
v2
.
setFromMatrixPosition
(
this
.
light
.
target
.
matrixWorld
);
v3
.
subVectors
(
v2
,
v1
);
this
.
lightPlane
.
lookAt
(
v3
);
this
.
lightPlane
.
material
.
color
.
copy
(
this
.
light
.
color
).
multiplyScalar
(
this
.
light
.
intensity
);
var
lightPlane
=
this
.
children
[
0
];
var
targetLine
=
this
.
children
[
1
];
lightPlane
.
lookAt
(
v3
);
lightPlane
.
material
.
color
.
copy
(
this
.
light
.
color
).
multiplyScalar
(
this
.
light
.
intensity
);
this
.
targetLine
.
geometry
.
vertices
[
1
].
copy
(
v3
);
this
.
targetLine
.
geometry
.
verticesNeedUpdate
=
true
;
this
.
targetLine
.
material
.
color
.
copy
(
this
.
lightPlane
.
material
.
color
);
targetLine
.
lookAt
(
v3
);
targetLine
.
scale
.
z
=
v3
.
length
();
};
...
...
src/extras/helpers/FaceNormalsHelper.js
浏览文件 @
29af1121
...
...
@@ -105,6 +105,6 @@ THREE.FaceNormalsHelper.prototype.update = ( function () {
return
this
;
}
}
;
}()
);
src/extras/helpers/GridHelper.js
浏览文件 @
29af1121
...
...
@@ -2,27 +2,34 @@
* @author mrdoob / http://mrdoob.com/
*/
THREE
.
GridHelper
=
function
(
size
,
step
)
{
THREE
.
GridHelper
=
function
(
size
,
step
,
color1
,
color2
)
{
var
geometry
=
new
THREE
.
Geometry
(
);
var
material
=
new
THREE
.
LineBasicMaterial
(
{
vertexColors
:
THREE
.
VertexColors
}
);
color1
=
new
THREE
.
Color
(
color1
!==
undefined
?
color1
:
0x444444
);
color2
=
new
THREE
.
Color
(
color2
!==
undefined
?
color2
:
0x888888
);
this
.
color1
=
new
THREE
.
Color
(
0x444444
)
;
this
.
color2
=
new
THREE
.
Color
(
0x888888
)
;
var
vertices
=
[]
;
var
colors
=
[]
;
for
(
var
i
=
-
size
;
i
<=
size
;
i
+=
step
)
{
for
(
var
i
=
-
size
,
j
=
0
;
i
<=
size
;
i
+=
step
)
{
geometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
-
size
,
0
,
i
),
new
THREE
.
Vector3
(
size
,
0
,
i
),
new
THREE
.
Vector3
(
i
,
0
,
-
size
),
new
THREE
.
Vector3
(
i
,
0
,
size
)
);
vertices
.
push
(
-
size
,
0
,
i
,
size
,
0
,
i
);
vertices
.
push
(
i
,
0
,
-
size
,
i
,
0
,
size
);
var
color
=
i
===
0
?
this
.
color1
:
this
.
color2
;
var
color
=
i
===
0
?
color1
:
color2
;
geometry
.
colors
.
push
(
color
,
color
,
color
,
color
);
color
.
toArray
(
colors
,
j
);
j
+=
3
;
color
.
toArray
(
colors
,
j
);
j
+=
3
;
color
.
toArray
(
colors
,
j
);
j
+=
3
;
color
.
toArray
(
colors
,
j
);
j
+=
3
;
}
var
geometry
=
new
THREE
.
BufferGeometry
();
geometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32Attribute
(
vertices
,
3
)
);
geometry
.
addAttribute
(
'
color
'
,
new
THREE
.
Float32Attribute
(
colors
,
3
)
);
var
material
=
new
THREE
.
LineBasicMaterial
(
{
vertexColors
:
THREE
.
VertexColors
}
);
THREE
.
LineSegments
.
call
(
this
,
geometry
,
material
);
};
...
...
@@ -30,11 +37,8 @@ THREE.GridHelper = function ( size, step ) {
THREE
.
GridHelper
.
prototype
=
Object
.
create
(
THREE
.
LineSegments
.
prototype
);
THREE
.
GridHelper
.
prototype
.
constructor
=
THREE
.
GridHelper
;
THREE
.
GridHelper
.
prototype
.
setColors
=
function
(
colorCenterLine
,
colorGrid
)
{
this
.
color1
.
set
(
colorCenterLine
);
this
.
color2
.
set
(
colorGrid
);
THREE
.
GridHelper
.
prototype
.
setColors
=
function
()
{
this
.
geometry
.
colorsNeedUpdate
=
true
;
console
.
error
(
'
THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.
'
)
;
};
src/extras/helpers/HemisphereLightHelper.js
浏览文件 @
29af1121
...
...
@@ -55,6 +55,6 @@ THREE.HemisphereLightHelper.prototype.update = function () {
this
.
lightSphere
.
lookAt
(
vector
.
setFromMatrixPosition
(
this
.
light
.
matrixWorld
).
negate
()
);
this
.
lightSphere
.
geometry
.
colorsNeedUpdate
=
true
;
}
}
;
}();
src/extras/helpers/PointLightHelper.js
浏览文件 @
29af1121
...
...
@@ -8,7 +8,7 @@ THREE.PointLightHelper = function ( light, sphereSize ) {
this
.
light
=
light
;
this
.
light
.
updateMatrixWorld
();
var
geometry
=
new
THREE
.
SphereGeometry
(
sphereSize
,
4
,
2
);
var
geometry
=
new
THREE
.
Sphere
Buffer
Geometry
(
sphereSize
,
4
,
2
);
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
wireframe
:
true
,
fog
:
false
}
);
material
.
color
.
copy
(
this
.
light
.
color
).
multiplyScalar
(
this
.
light
.
intensity
);
...
...
src/extras/helpers/VertexNormalsHelper.js
浏览文件 @
29af1121
...
...
@@ -25,7 +25,7 @@ THREE.VertexNormalsHelper = function ( object, size, hex, linewidth ) {
}
else
if
(
objGeometry
instanceof
THREE
.
BufferGeometry
)
{
nNormals
=
objGeometry
.
attributes
.
normal
.
count
nNormals
=
objGeometry
.
attributes
.
normal
.
count
;
}
...
...
@@ -140,6 +140,6 @@ THREE.VertexNormalsHelper.prototype.update = ( function () {
return
this
;
}
}
;
}()
);
src/objects/Line.js
浏览文件 @
29af1121
...
...
@@ -15,7 +15,7 @@ THREE.Line = function ( geometry, material, mode ) {
this
.
type
=
'
Line
'
;
this
.
geometry
=
geometry
!==
undefined
?
geometry
:
new
THREE
.
Geometry
();
this
.
geometry
=
geometry
!==
undefined
?
geometry
:
new
THREE
.
Buffer
Geometry
();
this
.
material
=
material
!==
undefined
?
material
:
new
THREE
.
LineBasicMaterial
(
{
color
:
Math
.
random
()
*
0xffffff
}
);
};
...
...
src/objects/Mesh.js
浏览文件 @
29af1121
...
...
@@ -11,7 +11,7 @@ THREE.Mesh = function ( geometry, material ) {
this
.
type
=
'
Mesh
'
;
this
.
geometry
=
geometry
!==
undefined
?
geometry
:
new
THREE
.
Geometry
();
this
.
geometry
=
geometry
!==
undefined
?
geometry
:
new
THREE
.
Buffer
Geometry
();
this
.
material
=
material
!==
undefined
?
material
:
new
THREE
.
MeshBasicMaterial
(
{
color
:
Math
.
random
()
*
0xffffff
}
);
this
.
drawMode
=
THREE
.
TrianglesDrawMode
;
...
...
src/objects/Points.js
浏览文件 @
29af1121
...
...
@@ -8,7 +8,7 @@ THREE.Points = function ( geometry, material ) {
this
.
type
=
'
Points
'
;
this
.
geometry
=
geometry
!==
undefined
?
geometry
:
new
THREE
.
Geometry
();
this
.
geometry
=
geometry
!==
undefined
?
geometry
:
new
THREE
.
Buffer
Geometry
();
this
.
material
=
material
!==
undefined
?
material
:
new
THREE
.
PointsMaterial
(
{
color
:
Math
.
random
()
*
0xffffff
}
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录