Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
10e21dde
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
提交
10e21dde
编写于
12月 08, 2010
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
`Geometry::computeNormals` → `Geometry::computeFaceNormals`
上级
1053ab24
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
614 addition
and
620 deletion
+614
-620
build/Three.js
build/Three.js
+172
-172
build/ThreeDebug.js
build/ThreeDebug.js
+173
-173
build/ThreeExtras.js
build/ThreeExtras.js
+212
-212
examples/geometry_terrain.html
examples/geometry_terrain.html
+0
-1
examples/geometry_terrain_gl.html
examples/geometry_terrain_gl.html
+0
-4
examples/obj/Bird.js
examples/obj/Bird.js
+2
-2
examples/obj/Qrcode.js
examples/obj/Qrcode.js
+1
-1
examples/obj/WaltHead.js
examples/obj/WaltHead.js
+2
-2
examples/uqbiquity_test.html
examples/uqbiquity_test.html
+1
-1
src/core/Geometry.js
src/core/Geometry.js
+1
-1
src/extras/io/Loader.js
src/extras/io/Loader.js
+2
-2
src/extras/primitives/Cube.js
src/extras/primitives/Cube.js
+9
-9
src/extras/primitives/Cylinder.js
src/extras/primitives/Cylinder.js
+31
-33
src/extras/primitives/Plane.js
src/extras/primitives/Plane.js
+1
-1
src/extras/primitives/Sphere.js
src/extras/primitives/Sphere.js
+7
-6
未找到文件。
build/Three.js
浏览文件 @
10e21dde
此差异已折叠。
点击以展开。
build/ThreeDebug.js
浏览文件 @
10e21dde
此差异已折叠。
点击以展开。
build/ThreeExtras.js
浏览文件 @
10e21dde
此差异已折叠。
点击以展开。
examples/geometry_terrain.html
浏览文件 @
10e21dde
...
...
@@ -80,7 +80,6 @@
}
plane
.
computeNormals
();
plane
.
computeCentroids
();
mesh
=
new
THREE
.
Mesh
(
plane
,
material
);
...
...
examples/geometry_terrain_gl.html
浏览文件 @
10e21dde
...
...
@@ -87,10 +87,6 @@
}
// geometry.computeNormals();
// geometry.computeVertexNormals();
// geometry.sortFacesByMaterial();
texture
=
new
THREE
.
Texture
(
generateTexture
(
data
,
worldWidth
,
worldDepth
),
new
THREE
.
UVMapping
(),
THREE
.
ClampToEdgeWrapping
,
THREE
.
ClampToEdgeWrapping
);
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshBasicMaterial
(
{
map
:
texture
}
)
);
...
...
examples/obj/Bird.js
浏览文件 @
10e21dde
...
...
@@ -2,7 +2,7 @@ var Bird = function () {
var
scope
=
this
;
THREE
.
Geometry
.
call
(
this
);
THREE
.
Geometry
.
call
(
this
);
v
(
5
,
0
,
0
);
v
(
-
5
,
-
2
,
1
);
...
...
@@ -21,7 +21,7 @@ var Bird = function () {
f3
(
5
,
6
,
7
);
this
.
computeCentroids
();
this
.
computeNormals
();
this
.
compute
Face
Normals
();
this
.
sortFacesByMaterial
();
function
v
(
x
,
y
,
z
)
{
...
...
examples/obj/Qrcode.js
浏览文件 @
10e21dde
...
...
@@ -1434,7 +1434,7 @@ var Qrcode = function () {
f4
(
19
,
20
,
362
,
361
,
m2
);
this
.
computeCentroids
();
this
.
computeNormals
();
this
.
compute
Face
Normals
();
this
.
sortFacesByMaterial
();
function
v
(
x
,
y
,
z
)
{
...
...
examples/obj/WaltHead.js
浏览文件 @
10e21dde
...
...
@@ -4884,7 +4884,7 @@ var WaltHead = function () {
f3
(
1222
,
991
,
646
);
this
.
computeCentroids
();
this
.
computeNormals
();
this
.
compute
Face
Normals
();
this
.
sortFacesByMaterial
();
function
v
(
x
,
y
,
z
)
{
...
...
@@ -4908,4 +4908,4 @@ var WaltHead = function () {
}
WaltHead
.
prototype
=
new
THREE
.
Geometry
();
WaltHead
.
prototype
.
constructor
=
WaltHead
;
\ No newline at end of file
WaltHead
.
prototype
.
constructor
=
WaltHead
;
examples/uqbiquity_test.html
浏览文件 @
10e21dde
...
...
@@ -185,7 +185,7 @@
geometry
.
faces
.
push
(
face
);
}
geometry
.
computeNormals
();
geometry
.
compute
Face
Normals
();
geometry
.
computeCentroids
();
geometry
.
sortFacesByMaterial
();
...
...
src/core/Geometry.js
浏览文件 @
10e21dde
...
...
@@ -46,7 +46,7 @@ THREE.Geometry.prototype = {
},
computeNormals
:
function
(
useVertexNormals
)
{
compute
Face
Normals
:
function
(
useVertexNormals
)
{
var
n
,
nl
,
v
,
vl
,
vertex
,
f
,
fl
,
face
,
vA
,
vB
,
vC
,
cb
=
new
THREE
.
Vector3
(),
ab
=
new
THREE
.
Vector3
();
...
...
src/extras/io/Loader.js
浏览文件 @
10e21dde
...
...
@@ -244,7 +244,7 @@ THREE.Loader.prototype = {
currentOffset
+=
init_quads_smooth_uv
(
currentOffset
);
this
.
computeCentroids
();
this
.
computeNormals
();
this
.
compute
Face
Normals
();
this
.
sortFacesByMaterial
();
//var e = (new Date).getTime();
...
...
@@ -706,7 +706,7 @@ THREE.Loader.prototype = {
init_faces
();
this
.
computeCentroids
();
this
.
computeNormals
();
this
.
compute
Face
Normals
();
this
.
sortFacesByMaterial
();
function
init_vertices
()
{
...
...
src/extras/primitives/Cube.js
浏览文件 @
10e21dde
...
...
@@ -38,21 +38,21 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
}
this
.
sides
=
{
px
:
true
,
nx
:
true
,
py
:
true
,
ny
:
true
,
pz
:
true
,
nz
:
true
};
if
(
sides
!=
undefined
)
{
for
(
var
s
in
sides
)
{
if
(
this
.
sides
[
s
]
!=
undefined
)
{
this
.
sides
[
s
]
=
sides
[
s
];
}
}
}
this
.
sides
.
px
&&
buildPlane
(
'
z
'
,
'
y
'
,
1
*
flip
,
-
1
,
depth
,
height
,
-
width_half
,
this
.
materials
[
0
]
);
// px
this
.
sides
.
nx
&&
buildPlane
(
'
z
'
,
'
y
'
,
-
1
*
flip
,
-
1
,
depth
,
height
,
width_half
,
this
.
materials
[
1
]
);
// nx
this
.
sides
.
py
&&
buildPlane
(
'
x
'
,
'
z
'
,
1
*
flip
,
1
,
width
,
depth
,
height_half
,
this
.
materials
[
2
]
);
// py
...
...
@@ -173,7 +173,7 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
}
this
.
computeCentroids
();
this
.
computeNormals
();
this
.
compute
Face
Normals
();
this
.
sortFacesByMaterial
();
}
...
...
src/extras/primitives/Cylinder.js
浏览文件 @
10e21dde
...
...
@@ -2,82 +2,80 @@
* @author kile / http://kile.stravaganza.org/
*/
var
Cylinder
=
function
(
numSegs
,
topRad
,
botRad
,
height
,
topOffset
,
botOffset
)
{
var
Cylinder
=
function
(
numSegs
,
topRad
,
botRad
,
height
,
topOffset
,
botOffset
)
{
THREE
.
Geometry
.
call
(
this
);
THREE
.
Geometry
.
call
(
this
);
var
scope
=
this
,
i
;
var
scope
=
this
,
pi
=
Math
.
PI
,
i
;
// VERTICES
// Top circle vertices
for
(
i
=
0
;
i
<
numSegs
;
i
++
)
{
for
(
i
=
0
;
i
<
numSegs
;
i
++
)
{
v
(
Math
.
sin
(
2
*
pi
*
i
/
numSegs
)
*
topRad
,
Math
.
cos
(
2
*
pi
*
i
/
numSegs
)
*
topRad
,
0
);
v
(
Math
.
sin
(
2
*
3.1415
*
i
/
numSegs
)
*
topRad
,
Math
.
cos
(
2
*
3.1415
*
i
/
numSegs
)
*
topRad
,
0
);
}
// Bottom circle vertices
for
(
i
=
0
;
i
<
numSegs
;
i
++
)
{
for
(
i
=
0
;
i
<
numSegs
;
i
++
)
{
v
(
Math
.
sin
(
2
*
pi
*
i
/
numSegs
)
*
botRad
,
Math
.
cos
(
2
*
pi
*
i
/
numSegs
)
*
botRad
,
height
);
v
(
Math
.
sin
(
2
*
3.1415
*
i
/
numSegs
)
*
botRad
,
Math
.
cos
(
2
*
3.1415
*
i
/
numSegs
)
*
botRad
,
height
);
}
// FACES
// Body
for
(
i
=
0
;
i
<
numSegs
;
i
++
)
{
// Body
for
(
i
=
0
;
i
<
numSegs
;
i
++
)
{
f4
(
i
,
i
+
numSegs
,
numSegs
+
(
i
+
1
)
%
numSegs
,
(
i
+
1
)
%
numSegs
,
'
#ff0000
'
);
f4
(
i
,
i
+
numSegs
,
numSegs
+
(
i
+
1
)
%
numSegs
,
(
i
+
1
)
%
numSegs
,
'
#ff0000
'
);
}
// Bottom circle
if
(
botRad
!=
0
)
{
if
(
botRad
!=
0
)
{
v
(
0
,
0
,
-
topOffset
);
v
(
0
,
0
,
-
topOffset
);
for
(
i
=
numSegs
;
i
<
numSegs
+
(
numSegs
/
2
);
i
++
)
{
for
(
i
=
numSegs
;
i
<
numSegs
+
(
numSegs
/
2
);
i
++
)
{
f4
(
2
*
numSegs
,
(
2
*
i
-
2
*
numSegs
)
%
numSegs
,
(
2
*
i
-
2
*
numSegs
+
1
)
%
numSegs
,
(
2
*
i
-
2
*
numSegs
+
2
)
%
numSegs
);
f4
(
2
*
numSegs
,
(
2
*
i
-
2
*
numSegs
)
%
numSegs
,
(
2
*
i
-
2
*
numSegs
+
1
)
%
numSegs
,
(
2
*
i
-
2
*
numSegs
+
2
)
%
numSegs
);
}
}
// Top circle
if
(
topRad
!=
0
)
{
if
(
topRad
!=
0
)
{
v
(
0
,
0
,
height
+
topOffset
);
v
(
0
,
0
,
height
+
topOffset
);
for
(
i
=
numSegs
+
(
numSegs
/
2
);
i
<
2
*
numSegs
;
i
++
)
{
for
(
i
=
numSegs
+
(
numSegs
/
2
);
i
<
2
*
numSegs
;
i
++
)
{
f4
(
(
2
*
i
-
2
*
numSegs
+
2
)
%
numSegs
+
numSegs
,
(
2
*
i
-
2
*
numSegs
+
1
)
%
numSegs
+
numSegs
,
(
2
*
i
-
2
*
numSegs
)
%
numSegs
+
numSegs
,
2
*
numSegs
+
1
);
f4
(
(
2
*
i
-
2
*
numSegs
+
2
)
%
numSegs
+
numSegs
,
(
2
*
i
-
2
*
numSegs
+
1
)
%
numSegs
+
numSegs
,
(
2
*
i
-
2
*
numSegs
)
%
numSegs
+
numSegs
,
2
*
numSegs
+
1
);
}
}
this
.
computeCentroids
();
this
.
computeNormals
();
this
.
compute
Face
Normals
();
this
.
sortFacesByMaterial
();
function
v
(
x
,
y
,
z
)
{
function
v
(
x
,
y
,
z
)
{
scope
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
x
,
y
,
z
)
)
);
}
function
f4
(
a
,
b
,
c
,
d
)
{
function
f4
(
a
,
b
,
c
,
d
)
{
scope
.
faces
.
push
(
new
THREE
.
Face4
(
a
,
b
,
c
,
d
)
);
}
}
Cylinder
.
prototype
=
new
THREE
.
Geometry
();
...
...
src/extras/primitives/Plane.js
浏览文件 @
10e21dde
...
...
@@ -53,7 +53,7 @@ var Plane = function ( width, height, segments_width, segments_height ) {
}
this
.
computeCentroids
();
this
.
computeNormals
();
this
.
compute
Face
Normals
();
this
.
sortFacesByMaterial
();
}
...
...
src/extras/primitives/Sphere.js
浏览文件 @
10e21dde
...
...
@@ -10,7 +10,7 @@ var Sphere = function ( radius, segments_width, segments_height ) {
var
gridX
=
segments_width
||
8
,
gridY
=
segments_height
||
6
;
var
i
,
j
;
var
i
,
j
,
pi
=
Math
.
PI
;
var
iHor
=
Math
.
max
(
3
,
gridX
);
var
iVer
=
Math
.
max
(
2
,
gridY
);
var
aVtc
=
[];
...
...
@@ -18,16 +18,16 @@ var Sphere = function ( radius, segments_width, segments_height ) {
for
(
j
=
0
;
j
<
(
iVer
+
1
)
;
j
++
)
{
var
fRad1
=
j
/
iVer
;
var
fZ
=
radius
*
Math
.
cos
(
fRad1
*
Math
.
PI
);
var
fRds
=
radius
*
Math
.
sin
(
fRad1
*
Math
.
PI
);
var
fZ
=
radius
*
Math
.
cos
(
fRad1
*
pi
);
var
fRds
=
radius
*
Math
.
sin
(
fRad1
*
pi
);
var
aRow
=
[];
var
oVtx
=
0
;
for
(
i
=
0
;
i
<
iHor
;
i
++
)
{
var
fRad2
=
2
*
i
/
iHor
;
var
fX
=
fRds
*
Math
.
sin
(
fRad2
*
Math
.
PI
);
var
fY
=
fRds
*
Math
.
cos
(
fRad2
*
Math
.
PI
);
var
fX
=
fRds
*
Math
.
sin
(
fRad2
*
pi
);
var
fY
=
fRds
*
Math
.
cos
(
fRad2
*
pi
);
if
(
!
(
(
j
==
0
||
j
==
iVer
)
&&
i
>
0
)
)
{
...
...
@@ -104,7 +104,8 @@ var Sphere = function ( radius, segments_width, segments_height ) {
}
this
.
computeCentroids
();
this
.
computeNormals
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
();
this
.
sortFacesByMaterial
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录