Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
06a97738
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,发现更多精彩内容 >>
提交
06a97738
编写于
12月 30, 2010
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
差异文件
Synced with mrdoob's branch.
上级
6cfcdd15
5c8a0896
变更
29
展开全部
隐藏空白更改
内联
并排
Showing
29 changed file
with
953 addition
and
504 deletion
+953
-504
build/Three.js
build/Three.js
+114
-114
build/ThreeDebug.js
build/ThreeDebug.js
+115
-115
build/ThreeExtras.js
build/ThreeExtras.js
+142
-142
examples/geometry_terrain_gl.html
examples/geometry_terrain_gl.html
+0
-1
examples/geometry_terrain_gl2.html
examples/geometry_terrain_gl2.html
+347
-0
examples/js/PRNG.js
examples/js/PRNG.js
+11
-0
examples/js/SimplexNoise.js
examples/js/SimplexNoise.js
+92
-0
src/core/Color.js
src/core/Color.js
+2
-2
src/core/Geometry.js
src/core/Geometry.js
+3
-3
src/core/Matrix3.js
src/core/Matrix3.js
+1
-1
src/core/UV.js
src/core/UV.js
+1
-1
src/core/Vertex.js
src/core/Vertex.js
+1
-1
src/extras/GeometryUtils.js
src/extras/GeometryUtils.js
+3
-3
src/extras/ImageUtils.js
src/extras/ImageUtils.js
+2
-2
src/extras/SceneUtils.js
src/extras/SceneUtils.js
+19
-19
src/extras/primitives/Cube.js
src/extras/primitives/Cube.js
+3
-3
src/extras/primitives/Cylinder.js
src/extras/primitives/Cylinder.js
+1
-1
src/extras/primitives/Plane.js
src/extras/primitives/Plane.js
+1
-1
src/extras/primitives/Sphere.js
src/extras/primitives/Sphere.js
+1
-1
src/materials/Uniforms.js
src/materials/Uniforms.js
+18
-18
src/materials/mappings/CubeReflectionMapping.js
src/materials/mappings/CubeReflectionMapping.js
+3
-3
src/materials/mappings/CubeRefractionMapping.js
src/materials/mappings/CubeRefractionMapping.js
+3
-3
src/materials/mappings/LatitudeReflectionMapping.js
src/materials/mappings/LatitudeReflectionMapping.js
+3
-3
src/materials/mappings/LatitudeRefractionMapping.js
src/materials/mappings/LatitudeRefractionMapping.js
+3
-3
src/materials/mappings/SphericalReflectionMapping.js
src/materials/mappings/SphericalReflectionMapping.js
+3
-3
src/materials/mappings/SphericalRefractionMapping.js
src/materials/mappings/SphericalRefractionMapping.js
+3
-3
src/materials/mappings/UVMapping.js
src/materials/mappings/UVMapping.js
+3
-3
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+45
-45
src/renderers/WebGLRenderer2.js
src/renderers/WebGLRenderer2.js
+10
-10
未找到文件。
build/Three.js
浏览文件 @
06a97738
此差异已折叠。
点击以展开。
build/ThreeDebug.js
浏览文件 @
06a97738
此差异已折叠。
点击以展开。
build/ThreeExtras.js
浏览文件 @
06a97738
此差异已折叠。
点击以展开。
examples/geometry_terrain_gl.html
浏览文件 @
06a97738
...
...
@@ -37,7 +37,6 @@
<script
type=
"text/javascript"
src=
"js/ImprovedNoise.js"
></script>
<script
type=
"text/javascript"
src=
"../build/Three.js"
></script>
<script
type=
"text/javascript"
src=
"../src/extras/GeometryUtils.js"
></script>
<script
type=
"text/javascript"
src=
"../src/extras/primitives/Plane.js"
></script>
<script
type=
"text/javascript"
>
...
...
examples/geometry_terrain_gl2.html
0 → 100644
浏览文件 @
06a97738
<!DOCTYPE HTML>
<html
lang=
"en"
>
<head>
<title>
three.js - geometry - webgl terrain
</title>
<meta
charset=
"utf-8"
>
<style
type=
"text/css"
>
body
{
color
:
#61443e
;
font-family
:
Monospace
;
font-size
:
13px
;
text-align
:
center
;
background-color
:
#bfd1e5
;
margin
:
0px
;
overflow
:
hidden
;
}
#info
{
position
:
absolute
;
top
:
0px
;
width
:
100%
;
padding
:
5px
;
}
a
{
color
:
#a06851
;
}
</style>
</head>
<body>
<div
id=
"container"
><br
/><br
/><br
/><br
/><br
/>
Generating world...
</div>
<div
id=
"info"
><a
href=
"http://github.com/mrdoob/three.js"
target=
"_blank"
>
three.js
</a>
- webgl terrain demo
<br
/>
(left click: forward, right click: backward)
</div>
<script
type=
"text/javascript"
src=
"js/Stats.js"
></script>
<script
type=
"text/javascript"
src=
"js/PRNG.js"
></script>
<script
type=
"text/javascript"
src=
"js/SimplexNoise.js"
></script>
<script
type=
"text/javascript"
src=
"../build/Three.js"
></script>
<script
type=
"text/javascript"
src=
"../src/extras/primitives/Plane.js"
></script>
<script
type=
"text/javascript"
>
var
container
,
stats
;
var
camera
,
scene
,
renderer
;
var
mesh
,
texture
;
var
worldWidth
=
256
,
worldDepth
=
256
,
worldHalfWidth
=
worldWidth
/
2
,
worldHalfDepth
=
worldDepth
/
2
;
var
mouseX
=
0
,
mouseY
=
0
,
lat
=
0
,
lon
=
0
,
phy
=
0
,
theta
=
0
;
var
direction
=
new
THREE
.
Vector3
(),
moveForward
=
false
,
moveBackward
=
false
;
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
init
();
setInterval
(
loop
,
1000
/
60
);
function
init
()
{
container
=
document
.
getElementById
(
'
container
'
);
camera
=
new
THREE
.
Camera
(
60
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
20000
);
camera
.
target
.
position
.
z
=
-
100
;
scene
=
new
THREE
.
Scene
();
data
=
generateHeight
(
worldWidth
,
worldDepth
);
camera
.
position
.
y
=
(
data
[
worldHalfWidth
+
(
worldHalfDepth
*
worldWidth
)
]
*
10
)
+
200
;
camera
.
target
.
position
.
y
=
camera
.
position
.
y
;
var
geometry
=
new
Plane
(
10000
,
10000
,
worldWidth
-
1
,
worldDepth
-
1
);
for
(
var
i
=
0
,
l
=
geometry
.
vertices
.
length
;
i
<
l
;
i
++
)
{
geometry
.
vertices
[
i
].
position
.
z
=
data
[
i
]
*
10
;
}
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
}
)
);
mesh
.
rotation
.
x
=
-
90
*
Math
.
PI
/
180
;
scene
.
addObject
(
mesh
);
renderer
=
new
THREE
.
WebGLRenderer
(
{
scene
:
scene
}
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
innerHTML
=
""
;
container
.
appendChild
(
renderer
.
domElement
);
stats
=
new
Stats
();
stats
.
domElement
.
style
.
position
=
'
absolute
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
document
.
addEventListener
(
'
mousedown
'
,
onDocumentMouseDown
,
false
);
document
.
addEventListener
(
'
mouseup
'
,
onDocumentMouseUp
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
contextmenu
'
,
function
(
event
)
{
event
.
preventDefault
();
},
false
);
}
/*
function generateHeight( width, height ) {
var size = width * height, data = new Float32Array( size ),
perlin = new ImprovedNoise(), quality = 1, z = Math.random() * 100;
for ( var i = 0; i < size; i ++ ) {
data[ i ] = 0
}
for ( var j = 0; j < 4; j ++ ) {
for ( var i = 0; i < size; i ++ ) {
var x = i % width, y = ~~ ( i / width );
data[ i ] += Math.abs( perlin.noise( x / quality, y / quality, z ) * quality * 1.75 );
}
quality *= 5;
}
return data;
}
*/
function
generateHeight
(
width
,
height
)
{
var
x
,
y
,
h
,
quality
=
100
,
size
=
width
*
height
,
octaves
=
10
,
offsetX
=
100
,
offsetY
=
100
,
data
=
[],
prng
=
new
PRNG
(),
simplex1
=
new
SimplexNoise
(
prng
),
simplex2
=
new
SimplexNoise
(
prng
),
simplex3
=
new
SimplexNoise
(
prng
);
simplex1
.
setSeed
(
Math
.
random
()
*
100
);
simplex2
.
setSeed
(
Math
.
random
()
*
100
);
simplex3
.
setSeed
(
Math
.
random
()
*
100
);
// Base Terrain
for
(
var
i
=
0
;
i
<
size
;
i
++
)
{
x
=
(
(
i
%
width
)
+
offsetX
)
/
quality
;
y
=
(
~~
(
i
/
width
)
+
offsetY
)
/
quality
;
h
=
32
-
(
Math
.
abs
(
simplex1
.
noise
(
x
,
y
,
0
)
+
simplex2
.
noise
(
x
,
y
,
0
)
)
-
simplex3
.
noise
(
x
,
y
,
0
)
)
*
64
;
data
[
i
]
=
h
;
}
// Blur
for
(
var
i
=
0
;
i
<
size
;
i
++
)
{
x
=
i
%
width
;
if
(
x
==
0
)
continue
;
if
(
x
=
width
-
1
);
continue
;
data
[
i
]
+=
(
data
[
i
-
1
]
+
data
[
i
+
1
]
)
*
0.5
;
data
[
i
]
*=
0.5
;
}
for
(
var
i
=
width
;
i
<
size
-
width
;
i
++
)
{
data
[
i
]
+=
(
data
[
i
-
width
]
+
data
[
i
+
width
]
)
*
0.5
;
data
[
i
]
*=
0.5
;
}
for
(
var
j
=
4
;
j
<
100
;
j
*=
2
)
{
for
(
var
i
=
0
;
i
<
size
;
i
++
)
{
x
=
(
(
i
%
width
)
+
offsetX
)
/
j
,
y
=
(
~~
(
i
/
width
)
+
offsetY
)
/
j
;
data
[
i
]
-=
Math
.
abs
(
simplex1
.
noise
(
x
,
y
,
0
)
*
simplex2
.
noise
(
x
,
y
,
0
)
*
simplex3
.
noise
(
x
,
y
,
0
)
)
*
j
;
}
}
return
data
;
}
function
generateTexture
(
data
,
width
,
height
)
{
var
canvas
,
canvasScaled
,
context
,
image
,
imageData
,
level
,
diff
,
texel
,
vector3
,
sun
,
shade
;
vector3
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
sun
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
sun
.
normalize
();
canvas
=
document
.
createElement
(
'
canvas
'
);
canvas
.
width
=
width
;
canvas
.
height
=
height
;
context
=
canvas
.
getContext
(
'
2d
'
);
context
.
fillStyle
=
'
#000
'
;
context
.
fillRect
(
0
,
0
,
width
,
height
);
image
=
context
.
getImageData
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
imageData
=
image
.
data
;
for
(
var
i
=
0
,
j
=
0
,
l
=
imageData
.
length
;
i
<
l
;
i
+=
4
,
j
++
)
{
texel
=
data
[
j
];
/*
imageData[ i ] = texel;
imageData[ i + 1 ] = texel;
imageData[ i + 2 ] = texel;
continue;
*/
shade
=
0
;
for
(
var
k
=
1
;
k
<
16
;
k
++
)
{
vector3
.
x
=
data
[
j
-
k
]
-
data
[
j
+
k
];
vector3
.
y
=
1
;
vector3
.
z
=
data
[
j
-
width
*
k
]
-
data
[
j
+
width
*
k
];
vector3
.
normalize
();
shade
+=
vector3
.
dot
(
sun
)
*
(
16
-
k
);
}
imageData
[
i
]
=
(
128
+
shade
)
+
texel
;
imageData
[
i
+
1
]
=
(
64
+
shade
)
+
texel
;
imageData
[
i
+
2
]
=
(
32
+
shade
)
+
texel
;
}
context
.
putImageData
(
image
,
0
,
0
);
// Scaled 4x
canvasScaled
=
document
.
createElement
(
'
canvas
'
);
canvasScaled
.
width
=
width
*
4
;
canvasScaled
.
height
=
height
*
4
;
canvasScaled
.
loaded
=
true
;
context
=
canvasScaled
.
getContext
(
'
2d
'
);
context
.
scale
(
4
,
4
);
context
.
drawImage
(
canvas
,
0
,
0
);
image
=
context
.
getImageData
(
0
,
0
,
canvasScaled
.
width
,
canvasScaled
.
height
);
imageData
=
image
.
data
;
for
(
var
i
=
0
,
l
=
imageData
.
length
;
i
<
l
;
i
+=
4
)
{
var
v
=
~~
(
Math
.
random
()
*
5
);
imageData
[
i
]
+=
v
;
imageData
[
i
+
1
]
+=
v
;
imageData
[
i
+
2
]
+=
v
;
}
context
.
putImageData
(
image
,
0
,
0
);
return
canvasScaled
;
}
function
onDocumentMouseDown
(
event
)
{
event
.
preventDefault
();
event
.
stopPropagation
();
switch
(
event
.
button
)
{
case
0
:
moveForward
=
true
;
break
;
case
2
:
moveBackward
=
true
;
break
;
}
}
function
onDocumentMouseUp
(
event
)
{
event
.
preventDefault
();
event
.
stopPropagation
();
switch
(
event
.
button
)
{
case
0
:
moveForward
=
false
;
break
;
case
2
:
moveBackward
=
false
;
break
;
}
}
function
onDocumentMouseMove
(
event
)
{
mouseX
=
event
.
clientX
-
windowHalfX
;
mouseY
=
event
.
clientY
-
windowHalfY
;
}
function
loop
()
{
if
(
moveForward
)
camera
.
translateZ
(
-
10
);
if
(
moveBackward
)
camera
.
translateZ
(
10
);
lon
+=
mouseX
*
0.004
;
lat
-=
mouseY
*
0.004
;
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
lat
)
);
phi
=
(
90
-
lat
)
*
Math
.
PI
/
180
;
theta
=
lon
*
Math
.
PI
/
180
;
camera
.
target
.
position
.
x
=
100
*
Math
.
sin
(
phi
)
*
Math
.
cos
(
theta
)
+
camera
.
position
.
x
;
camera
.
target
.
position
.
y
=
100
*
Math
.
cos
(
phi
)
+
camera
.
position
.
y
;
camera
.
target
.
position
.
z
=
100
*
Math
.
sin
(
phi
)
*
Math
.
sin
(
theta
)
+
camera
.
position
.
z
;
renderer
.
render
(
scene
,
camera
);
stats
.
update
();
}
</script>
</body>
</html>
examples/js/PRNG.js
0 → 100644
浏览文件 @
06a97738
// Park-Miller-Carta Pseudo-Random Number Generator
// https://github.com/pnitsch/BitmapData.js/blob/master/js/BitmapData.js
var
PRNG
=
function
()
{
this
.
seed
=
1
;
this
.
next
=
function
()
{
return
(
this
.
gen
()
/
2147483647
);
};
this
.
nextRange
=
function
(
min
,
max
)
{
return
min
+
((
max
-
min
)
*
this
.
next
())
};
this
.
gen
=
function
()
{
return
this
.
seed
=
(
this
.
seed
*
16807
)
%
2147483647
;
};
};
examples/js/SimplexNoise.js
0 → 100644
浏览文件 @
06a97738
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Sean McCullough banksean@gmail.com
var
SimplexNoise
=
function
(
gen
)
{
this
.
rand
=
gen
;
this
.
grad3
=
[
[
1
,
1
,
0
],[
-
1
,
1
,
0
],[
1
,
-
1
,
0
],[
-
1
,
-
1
,
0
],
[
1
,
0
,
1
],[
-
1
,
0
,
1
],[
1
,
0
,
-
1
],[
-
1
,
0
,
-
1
],
[
0
,
1
,
1
],[
0
,
-
1
,
1
],[
0
,
1
,
-
1
],[
0
,
-
1
,
-
1
]
];
this
.
simplex
=
[
[
0
,
1
,
2
,
3
],[
0
,
1
,
3
,
2
],[
0
,
0
,
0
,
0
],[
0
,
2
,
3
,
1
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
1
,
2
,
3
,
0
],
[
0
,
2
,
1
,
3
],[
0
,
0
,
0
,
0
],[
0
,
3
,
1
,
2
],[
0
,
3
,
2
,
1
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
1
,
3
,
2
,
0
],
[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],
[
1
,
2
,
0
,
3
],[
0
,
0
,
0
,
0
],[
1
,
3
,
0
,
2
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
2
,
3
,
0
,
1
],[
2
,
3
,
1
,
0
],
[
1
,
0
,
2
,
3
],[
1
,
0
,
3
,
2
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
2
,
0
,
3
,
1
],[
0
,
0
,
0
,
0
],[
2
,
1
,
3
,
0
],
[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],
[
2
,
0
,
1
,
3
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
3
,
0
,
1
,
2
],[
3
,
0
,
2
,
1
],[
0
,
0
,
0
,
0
],[
3
,
1
,
2
,
0
],
[
2
,
1
,
0
,
3
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
0
,
0
,
0
,
0
],[
3
,
1
,
0
,
2
],[
0
,
0
,
0
,
0
],[
3
,
2
,
0
,
1
],[
3
,
2
,
1
,
0
]
];
};
SimplexNoise
.
prototype
.
setSeed
=
function
(
seed
)
{
this
.
p
=
[];
this
.
rand
.
seed
=
seed
;
for
(
var
i
=
0
;
i
<
256
;
i
++
)
{
this
.
p
[
i
]
=
Math
.
floor
(
this
.
rand
.
nextRange
(
0
,
255
));
}
this
.
perm
=
[];
for
(
var
i
=
0
;
i
<
512
;
i
++
)
{
this
.
perm
[
i
]
=
this
.
p
[
i
&
255
];
}
}
SimplexNoise
.
prototype
.
dot
=
function
(
g
,
x
,
y
)
{
return
g
[
0
]
*
x
+
g
[
1
]
*
y
;
};
SimplexNoise
.
prototype
.
noise
=
function
(
xin
,
yin
)
{
var
n0
,
n1
,
n2
;
var
F2
=
0.5
*
(
Math
.
sqrt
(
3.0
)
-
1.0
);
var
s
=
(
xin
+
yin
)
*
F2
;
var
i
=
Math
.
floor
(
xin
+
s
);
var
j
=
Math
.
floor
(
yin
+
s
);
var
G2
=
(
3.0
-
Math
.
sqrt
(
3.0
))
/
6.0
;
var
t
=
(
i
+
j
)
*
G2
;
var
X0
=
i
-
t
;
var
Y0
=
j
-
t
;
var
x0
=
xin
-
X0
;
var
y0
=
yin
-
Y0
;
var
i1
,
j1
;
if
(
x0
>
y0
)
{
i1
=
1
;
j1
=
0
;}
else
{
i1
=
0
;
j1
=
1
;}
var
x1
=
x0
-
i1
+
G2
;
var
y1
=
y0
-
j1
+
G2
;
var
x2
=
x0
-
1.0
+
2.0
*
G2
;
var
y2
=
y0
-
1.0
+
2.0
*
G2
;
var
ii
=
i
&
255
;
var
jj
=
j
&
255
;
var
gi0
=
this
.
perm
[
ii
+
this
.
perm
[
jj
]]
%
12
;
var
gi1
=
this
.
perm
[
ii
+
i1
+
this
.
perm
[
jj
+
j1
]]
%
12
;
var
gi2
=
this
.
perm
[
ii
+
1
+
this
.
perm
[
jj
+
1
]]
%
12
;
var
t0
=
0.5
-
x0
*
x0
-
y0
*
y0
;
if
(
t0
<
0
)
n0
=
0.0
;
else
{
t0
*=
t0
;
n0
=
t0
*
t0
*
this
.
dot
(
this
.
grad3
[
gi0
],
x0
,
y0
);
}
var
t1
=
0.5
-
x1
*
x1
-
y1
*
y1
;
if
(
t1
<
0
)
n1
=
0.0
;
else
{
t1
*=
t1
;
n1
=
t1
*
t1
*
this
.
dot
(
this
.
grad3
[
gi1
],
x1
,
y1
);
}
var
t2
=
0.5
-
x2
*
x2
-
y2
*
y2
;
if
(
t2
<
0
)
n2
=
0.0
;
else
{
t2
*=
t2
;
n2
=
t2
*
t2
*
this
.
dot
(
this
.
grad3
[
gi2
],
x2
,
y2
);
}
return
70.0
*
(
n0
+
n1
+
n2
);
};
src/core/Color.js
浏览文件 @
06a97738
...
...
@@ -7,7 +7,7 @@ THREE.Color = function ( hex ) {
this
.
autoUpdate
=
true
;
this
.
setHex
(
hex
);
}
}
;
THREE
.
Color
.
prototype
=
{
...
...
@@ -65,7 +65,7 @@ THREE.Color.prototype = {
},
toString
:
function
()
{
return
'
THREE.Color ( r:
'
+
this
.
r
+
'
, g:
'
+
this
.
g
+
'
, b:
'
+
this
.
b
+
'
, hex:
'
+
this
.
hex
+
'
)
'
;
...
...
src/core/Geometry.js
浏览文件 @
06a97738
...
...
@@ -113,7 +113,7 @@ THREE.Geometry.prototype = {
computeVertexNormals
:
function
()
{
var
v
,
vertices
=
[],
var
v
,
v
l
,
v
ertices
=
[],
f
,
fl
,
face
;
for
(
v
=
0
,
vl
=
this
.
vertices
.
length
;
v
<
vl
;
v
++
)
{
...
...
@@ -179,7 +179,7 @@ THREE.Geometry.prototype = {
var
f
,
fl
,
v
,
vl
,
face
,
uv
,
vA
,
vB
,
vC
,
uvA
,
uvB
,
uvC
,
x1
,
x2
,
y1
,
y2
,
z1
,
z2
,
s1
,
s2
,
t1
,
t2
,
r
,
t
,
n
,
s1
,
s2
,
t1
,
t2
,
r
,
t
,
test
,
tan1
=
[],
tan2
=
[],
sdir
=
new
THREE
.
Vector3
(),
tdir
=
new
THREE
.
Vector3
(),
tmp
=
new
THREE
.
Vector3
(),
tmp2
=
new
THREE
.
Vector3
(),
...
...
@@ -355,7 +355,7 @@ THREE.Geometry.prototype = {
// which could then use vertex color attributes instead of each being
// in its separate VBO
var
i
,
l
,
f
,
fl
,
face
,
material
,
vertices
,
mhash
,
ghash
,
hash_map
=
{};
var
i
,
l
,
f
,
fl
,
face
,
material
,
materials
,
vertices
,
mhash
,
ghash
,
hash_map
=
{};
function
materialHash
(
material
)
{
...
...
src/core/Matrix3.js
浏览文件 @
06a97738
...
...
@@ -18,4 +18,4 @@ THREE.Matrix3.prototype = {
}
}
}
;
src/core/UV.js
浏览文件 @
06a97738
...
...
@@ -24,4 +24,4 @@ THREE.UV.prototype = {
}
}
}
;
src/core/Vertex.js
浏览文件 @
06a97738
...
...
@@ -16,7 +16,7 @@ THREE.Vertex = function ( position, normal ) {
this
.
__visible
=
true
;
}
}
;
THREE
.
Vertex
.
prototype
=
{
...
...
src/extras/GeometryUtils.js
浏览文件 @
06a97738
...
...
@@ -28,7 +28,7 @@ var GeometryUtils = {
}
for
(
var
i
=
0
,
il
=
faces2
.
length
;
i
<
il
;
i
++
)
{
for
(
i
=
0
,
il
=
faces2
.
length
;
i
<
il
;
i
++
)
{
var
face
=
faces2
[
i
],
faceCopy
,
normal
,
faceVertexNormals
=
face
.
vertexNormals
;
...
...
@@ -59,7 +59,7 @@ var GeometryUtils = {
}
for
(
var
i
=
0
,
il
=
uvs2
.
length
;
i
<
il
;
i
++
)
{
for
(
i
=
0
,
il
=
uvs2
.
length
;
i
<
il
;
i
++
)
{
var
uv
=
uvs2
[
i
],
uvCopy
=
[];
...
...
@@ -75,4 +75,4 @@ var GeometryUtils = {
}
}
}
;
src/extras/ImageUtils.js
浏览文件 @
06a97738
...
...
@@ -20,7 +20,7 @@ var ImageUtils = {
images
[
i
]
=
new
Image
();
images
[
i
].
loaded
=
0
;
images
[
i
].
onload
=
function
()
{
images
.
loadCount
+=
1
;
this
.
loaded
=
true
;
}
images
[
i
].
onload
=
function
()
{
images
.
loadCount
+=
1
;
this
.
loaded
=
true
;
}
;
images
[
i
].
src
=
array
[
i
];
}
...
...
@@ -29,4 +29,4 @@ var ImageUtils = {
}
}
}
;
src/extras/SceneUtils.js
浏览文件 @
06a97738
var
SceneUtils
=
{
addMesh
:
function
(
scene
,
geometry
,
scale
,
x
,
y
,
z
,
rx
,
ry
,
rz
,
material
)
{
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
scale
.
x
=
mesh
.
scale
.
y
=
mesh
.
scale
.
z
=
scale
;
mesh
.
position
.
x
=
x
;
...
...
@@ -13,30 +13,30 @@ var SceneUtils = {
scene
.
addObject
(
mesh
);
return
mesh
;
},
},
addPanoramaCubeWebGL
:
function
(
scene
,
size
,
textureCube
)
{
var
shader
=
ShaderUtils
.
lib
[
"
cube
"
];
shader
.
uniforms
[
"
tCube
"
].
texture
=
textureCube
;
var
material
=
new
THREE
.
MeshShaderMaterial
(
{
fragment_shader
:
shader
.
fragment_shader
,
vertex_shader
:
shader
.
vertex_shader
,
var
material
=
new
THREE
.
MeshShaderMaterial
(
{
fragment_shader
:
shader
.
fragment_shader
,
vertex_shader
:
shader
.
vertex_shader
,
uniforms
:
shader
.
uniforms
}
),
mesh
=
new
THREE
.
Mesh
(
new
Cube
(
size
,
size
,
size
,
1
,
1
,
null
,
true
),
material
);
scene
.
addObject
(
mesh
);
return
mesh
;
},
addPanoramaCube
:
function
(
scene
,
size
,
images
)
{
var
materials
=
[];
var
materials
=
[]
,
mesh
;
materials
.
push
(
new
THREE
.
MeshBasicMaterial
(
{
map
:
new
THREE
.
Texture
(
images
[
0
]
)
}
)
);
materials
.
push
(
new
THREE
.
MeshBasicMaterial
(
{
map
:
new
THREE
.
Texture
(
images
[
1
]
)
}
)
);
materials
.
push
(
new
THREE
.
MeshBasicMaterial
(
{
map
:
new
THREE
.
Texture
(
images
[
2
]
)
}
)
);
...
...
@@ -46,14 +46,14 @@ var SceneUtils = {
mesh
=
new
THREE
.
Mesh
(
new
Cube
(
size
,
size
,
size
,
1
,
1
,
materials
,
true
),
new
THREE
.
MeshFaceMaterial
()
);
scene
.
addObject
(
mesh
);
return
mesh
;
},
addPanoramaCubePlanes
:
function
(
scene
,
size
,
images
)
{
var
hsize
=
size
/
2
,
plane
=
new
Plane
(
size
,
size
),
pi2
=
Math
.
PI
/
2
,
pi
=
Math
.
PI
;
SceneUtils
.
addMesh
(
scene
,
plane
,
1
,
0
,
0
,
-
hsize
,
0
,
0
,
0
,
new
THREE
.
MeshBasicMaterial
(
{
map
:
new
THREE
.
Texture
(
images
[
5
]
)
}
)
);
...
...
@@ -61,7 +61,7 @@ var SceneUtils = {
SceneUtils
.
addMesh
(
scene
,
plane
,
1
,
hsize
,
0
,
0
,
0
,
-
pi2
,
0
,
new
THREE
.
MeshBasicMaterial
(
{
map
:
new
THREE
.
Texture
(
images
[
1
]
)
}
)
);
SceneUtils
.
addMesh
(
scene
,
plane
,
1
,
0
,
hsize
,
0
,
pi2
,
0
,
pi
,
new
THREE
.
MeshBasicMaterial
(
{
map
:
new
THREE
.
Texture
(
images
[
2
]
)
}
)
);
SceneUtils
.
addMesh
(
scene
,
plane
,
1
,
0
,
-
hsize
,
0
,
-
pi2
,
0
,
pi
,
new
THREE
.
MeshBasicMaterial
(
{
map
:
new
THREE
.
Texture
(
images
[
3
]
)
}
)
);
}
}
}
;
src/extras/primitives/Cube.js
浏览文件 @
06a97738
...
...
@@ -64,7 +64,7 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
function
buildPlane
(
u
,
v
,
udir
,
vdir
,
width
,
height
,
depth
,
material
)
{
var
w
,
var
w
,
ix
,
iy
,
gridX
=
segments_width
||
1
,
gridY
=
segments_height
||
1
,
gridX1
=
gridX
+
1
,
...
...
@@ -160,7 +160,7 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
}
for
(
var
i
=
0
,
l
=
scope
.
faces
.
length
;
i
<
l
;
i
++
)
{
for
(
i
=
0
,
il
=
scope
.
faces
.
length
;
i
<
i
l
;
i
++
)
{
var
face
=
scope
.
faces
[
i
];
...
...
@@ -179,7 +179,7 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
this
.
computeFaceNormals
();
this
.
sortFacesByMaterial
();
}
}
;
Cube
.
prototype
=
new
THREE
.
Geometry
();
Cube
.
prototype
.
constructor
=
Cube
;
src/extras/primitives/Cylinder.js
浏览文件 @
06a97738
...
...
@@ -76,7 +76,7 @@ var Cylinder = function ( numSegs, topRad, botRad, height, topOffset, botOffset
}
}
}
;
Cylinder
.
prototype
=
new
THREE
.
Geometry
();
Cylinder
.
prototype
.
constructor
=
Cylinder
;
src/extras/primitives/Plane.js
浏览文件 @
06a97738
...
...
@@ -56,7 +56,7 @@ var Plane = function ( width, height, segments_width, segments_height ) {
this
.
computeFaceNormals
();
this
.
sortFacesByMaterial
();
}
}
;
Plane
.
prototype
=
new
THREE
.
Geometry
();
Plane
.
prototype
.
constructor
=
Plane
;
src/extras/primitives/Sphere.js
浏览文件 @
06a97738
...
...
@@ -110,7 +110,7 @@ var Sphere = function ( radius, segments_width, segments_height ) {
this
.
boundingSphere
=
{
radius
:
radius
};
}
}
;
Sphere
.
prototype
=
new
THREE
.
Geometry
();
Sphere
.
prototype
.
constructor
=
Sphere
;
src/materials/Uniforms.js
浏览文件 @
06a97738
var
Uniforms
=
{
clone
:
function
(
uniforms_src
)
{
var
u
,
p
,
parameter
,
uniforms_dst
=
{};
var
u
,
p
,
parameter
,
parameter_src
,
uniforms_dst
=
{};
for
(
u
in
uniforms_src
)
{
uniforms_dst
[
u
]
=
{};
for
(
p
in
uniforms_src
[
u
]
)
{
parameter_src
=
uniforms_src
[
u
][
p
];
if
(
parameter_src
instanceof
THREE
.
Color
||
parameter_src
instanceof
THREE
.
Vector3
||
parameter_src
instanceof
THREE
.
Texture
)
{
uniforms_dst
[
u
][
p
]
=
parameter_src
.
clone
();
}
else
{
uniforms_dst
[
u
][
p
]
=
parameter_src
;
}
}
}
return
uniforms_dst
;
}
}
}
;
src/materials/mappings/CubeReflectionMapping.js
浏览文件 @
06a97738
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
CubeReflectionMapping
=
function
()
{
}
};
src/materials/mappings/CubeRefractionMapping.js
浏览文件 @
06a97738
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
CubeRefractionMapping
=
function
()
{
}
};
src/materials/mappings/LatitudeReflectionMapping.js
浏览文件 @
06a97738
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
LatitudeReflectionMapping
=
function
()
{
}
};
src/materials/mappings/LatitudeRefractionMapping.js
浏览文件 @
06a97738
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
LatitudeRefractionMapping
=
function
()
{
}
};
src/materials/mappings/SphericalReflectionMapping.js
浏览文件 @
06a97738
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
SphericalReflectionMapping
=
function
()
{
}
};
src/materials/mappings/SphericalRefractionMapping.js
浏览文件 @
06a97738
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
SphericalRefractionMapping
=
function
()
{
}
};
src/materials/mappings/UVMapping.js
浏览文件 @
06a97738
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
UVMapping
=
function
()
{
}
};
src/renderers/WebGLRenderer.js
浏览文件 @
06a97738
...
...
@@ -38,12 +38,12 @@ THREE.WebGLRenderer = function ( parameters ) {
maxLightCount
=
allocateLights
(
parameters
.
scene
,
4
),
fog
=
parameters
.
scene
?
parameters
.
scene
.
fog
:
null
,
antialias
=
parameters
.
antialias
!=
undefined
?
parameters
.
antialias
:
true
,
clearColor
=
parameters
.
clearColor
?
new
THREE
.
Color
(
parameters
.
clearColor
)
:
new
THREE
.
Color
(
0x000000
),
clearAlpha
=
parameters
.
clearAlpha
?
parameters
.
clearAlpha
:
0
;
this
.
domElement
=
_canvas
;
this
.
autoClear
=
true
;
...
...
@@ -63,12 +63,12 @@ THREE.WebGLRenderer = function ( parameters ) {
};
this
.
setClearColor
=
function
(
hex
,
alpha
)
{
var
color
=
new
THREE
.
Color
(
hex
);
_gl
.
clearColor
(
color
.
r
,
color
.
g
,
color
.
b
,
alpha
);
};
this
.
clear
=
function
()
{
_gl
.
clear
(
_gl
.
COLOR_BUFFER_BIT
|
_gl
.
DEPTH_BUFFER_BIT
);
...
...
@@ -122,7 +122,7 @@ THREE.WebGLRenderer = function ( parameters ) {
this
.
createBuffers
=
function
(
object
,
g
)
{
var
f
,
fl
,
fi
,
face
,
vertexNormals
,
normal
,
uv
,
v1
,
v2
,
v3
,
v4
,
t1
,
t2
,
t3
,
t4
,
m
,
ml
,
i
,
var
f
,
fl
,
fi
,
face
,
vertexNormals
,
faceNormal
,
normal
,
uv
,
v1
,
v2
,
v3
,
v4
,
t1
,
t2
,
t3
,
t4
,
m
,
ml
,
i
,
faceArray
=
[],
lineArray
=
[],
...
...
@@ -321,7 +321,7 @@ THREE.WebGLRenderer = function ( parameters ) {
geometryChunk
.
__webGLLineCount
=
lineArray
.
length
;
};
function
setMaterialShaders
(
material
,
shaders
)
{
material
.
fragment_shader
=
shaders
.
fragment_shader
;
...
...
@@ -340,30 +340,30 @@ THREE.WebGLRenderer = function ( parameters ) {
material
.
uniforms
.
opacity
.
value
=
material
.
opacity
;
material
.
uniforms
.
map
.
texture
=
material
.
map
;
material
.
uniforms
.
env_map
.
texture
=
material
.
env_map
;
material
.
uniforms
.
reflectivity
.
value
=
material
.
reflectivity
;
material
.
uniforms
.
refraction_ratio
.
value
=
material
.
refraction_ratio
;
material
.
uniforms
.
combine
.
value
=
material
.
combine
;
material
.
uniforms
.
useRefract
.
value
=
material
.
env_map
&&
material
.
env_map
.
mapping
instanceof
THREE
.
CubeRefractionMapping
;
if
(
fog
)
{
material
.
uniforms
.
fogColor
.
value
.
setHex
(
fog
.
color
.
hex
);
if
(
fog
instanceof
THREE
.
Fog
)
{
material
.
uniforms
.
fogNear
.
value
=
fog
.
near
;
material
.
uniforms
.
fogFar
.
value
=
fog
.
far
;
}
else
if
(
fog
instanceof
THREE
.
FogExp2
)
{
material
.
uniforms
.
fogDensity
.
value
=
fog
.
density
;
}
}
};
function
refreshLights
(
material
,
lights
)
{
...
...
@@ -375,8 +375,7 @@ THREE.WebGLRenderer = function ( parameters ) {
material
.
uniforms
.
pointLightColor
.
value
=
lights
.
point
.
colors
;
material
.
uniforms
.
pointLightPosition
.
value
=
lights
.
point
.
positions
;
}
};
this
.
renderBuffer
=
function
(
camera
,
lights
,
fog
,
material
,
geometryChunk
)
{
...
...
@@ -409,9 +408,9 @@ THREE.WebGLRenderer = function ( parameters ) {
setMaterialShaders
(
material
,
THREE
.
ShaderLib
[
'
normal
'
]
);
}
else
if
(
material
instanceof
THREE
.
MeshBasicMaterial
)
{
setMaterialShaders
(
material
,
THREE
.
ShaderLib
[
'
basic
'
]
);
refreshUniforms
(
material
,
fog
);
}
else
if
(
material
instanceof
THREE
.
MeshLambertMaterial
)
{
...
...
@@ -492,9 +491,9 @@ THREE.WebGLRenderer = function ( parameters ) {
material
instanceof
THREE
.
MeshLambertMaterial
)
{
refreshUniforms
(
material
,
fog
);
}
if
(
material
instanceof
THREE
.
MeshShaderMaterial
||
material
instanceof
THREE
.
MeshDepthMaterial
||
material
instanceof
THREE
.
MeshNormalMaterial
||
...
...
@@ -540,16 +539,16 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
fog
)
{
_gl
.
uniform3f
(
program
.
uniforms
.
fogColor
,
fog
.
color
.
r
,
fog
.
color
.
g
,
fog
.
color
.
b
);
if
(
fog
instanceof
THREE
.
Fog
)
{
_gl
.
uniform1f
(
program
.
uniforms
.
fogNear
,
fog
.
near
);
_gl
.
uniform1f
(
program
.
uniforms
.
fogFar
,
fog
.
far
);
}
else
if
(
fog
instanceof
THREE
.
FogExp2
)
{
_gl
.
uniform1f
(
program
.
uniforms
.
fogDensity
,
fog
.
density
);
}
}
...
...
@@ -1154,7 +1153,7 @@ THREE.WebGLRenderer = function ( parameters ) {
"
}
"
,
THREE
.
Snippets
[
"
fog_fragment
"
],
"
}
"
];
return
chunks
.
join
(
"
\n
"
);
...
...
@@ -1234,7 +1233,7 @@ THREE.WebGLRenderer = function ( parameters ) {
parameters
.
fog
?
"
#define USE_FOG
"
:
""
,
parameters
.
fog
instanceof
THREE
.
FogExp2
?
"
#define FOG_EXP2
"
:
""
,
parameters
.
map
?
"
#define USE_MAP
"
:
""
,
parameters
.
env_map
?
"
#define USE_ENVMAP
"
:
""
,
...
...
@@ -1548,7 +1547,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function
bufferNeedsSmoothNormals
(
geometryChunk
,
object
)
{
var
m
,
ml
,
i
,
l
,
needsSmoothNormals
=
false
;
var
m
,
ml
,
i
,
l
,
meshMaterial
,
needsSmoothNormals
=
false
;
for
(
m
=
0
,
ml
=
object
.
materials
.
length
;
m
<
ml
;
m
++
)
{
...
...
@@ -1590,7 +1589,8 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
scene
)
{
var
l
,
ll
,
light
,
dirLights
=
pointLights
=
maxDirLights
=
maxPointLights
=
0
;
var
l
,
ll
,
light
,
dirLights
,
pointLights
,
maxDirLights
,
maxPointLights
;
dirLights
=
pointLights
=
maxDirLights
=
maxPointLights
=
0
;
for
(
l
=
0
,
ll
=
scene
.
lights
.
length
;
l
<
ll
;
l
++
)
{
...
...
@@ -1660,24 +1660,24 @@ THREE.Snippets = {
fog_pars_fragment
:
[
"
#ifdef USE_FOG
"
,
"
uniform vec3 fogColor;
"
,
"
#ifdef FOG_EXP2
"
,
"
uniform float fogDensity;
"
,
"
#else
"
,
"
uniform float fogNear;
"
,
"
uniform float fogFar;
"
,
"
#endif
"
,
"
#endif
"
].
join
(
"
\n
"
),
fog_fragment
:
[
"
#ifdef USE_FOG
"
,
"
float depth = gl_FragCoord.z / gl_FragCoord.w;
"
,
"
#ifdef FOG_EXP2
"
,
...
...
@@ -1687,7 +1687,7 @@ THREE.Snippets = {
"
#else
"
,
"
float fogFactor = smoothstep( fogNear, fogFar, depth );
"
,
"
#endif
"
,
"
gl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );
"
,
"
#endif
"
...
...
@@ -1868,7 +1868,7 @@ THREE.Snippets = {
"
}
"
].
join
(
"
\n
"
)
};
THREE
.
ShaderLib
=
{
...
...
@@ -1937,9 +1937,9 @@ THREE.ShaderLib = {
].
join
(
"
\n
"
)
},
'
basic
'
:
{
uniforms
:
{
"
color
"
:
{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0xeeeeee
)
},
"
opacity
"
:
{
type
:
"
f
"
,
value
:
1
},
"
map
"
:
{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
...
...
@@ -1953,9 +1953,9 @@ THREE.ShaderLib = {
"
fogFar
"
:
{
type
:
"
f
"
,
value
:
2000
},
"
fogColor
"
:
{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0xffffff
)
}
},
fragment_shader
:
[
"
uniform vec3 color;
"
,
"
uniform float opacity;
"
,
...
...
@@ -1964,7 +1964,7 @@ THREE.ShaderLib = {
THREE
.
Snippets
[
"
fog_pars_fragment
"
],
"
void main() {
"
,
"
vec4 mColor = vec4( color, opacity );
"
,
"
vec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );
"
,
"
vec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );
"
,
...
...
@@ -2048,11 +2048,11 @@ THREE.ShaderLib = {
THREE
.
Snippets
[
"
envmap_fragment
"
],
THREE
.
Snippets
[
"
fog_fragment
"
],
"
}
"
].
join
(
"
\n
"
),
vertex_shader
:
[
"
varying vec3 vLightWeighting;
"
,
...
...
src/renderers/WebGLRenderer2.js
浏览文件 @
06a97738
...
...
@@ -14,6 +14,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
_canvas
=
document
.
createElement
(
'
canvas
'
),
_gl
,
_currentProgram
,
_modelViewMatrix
=
new
THREE
.
Matrix4
(),
_normalMatrix
=
new
THREE
.
Matrix4
(),
_viewMatrixArray
=
new
Float32Array
(
16
),
_modelViewMatrixArray
=
new
Float32Array
(
16
),
_projectionMatrixArray
=
new
Float32Array
(
16
),
...
...
@@ -100,7 +101,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
function
renderObject
(
object
)
{
var
geometry
,
material
,
m
,
n
l
,
var
geometry
,
material
,
m
,
m
l
,
program
,
uniforms
,
attributes
;
object
.
autoUpdateMatrix
&&
object
.
updateMatrix
();
...
...
@@ -268,11 +269,11 @@ THREE.WebGLRenderer2 = function ( antialias ) {
}
else
if
(
object
instanceof
THREE
.
Line
)
{
}
else
if
(
object
instanceof
THREE
.
Particle
)
{
}
...
...
@@ -283,10 +284,9 @@ THREE.WebGLRenderer2 = function ( antialias ) {
function
buildBuffers
(
geometry
)
{
var
itemCount
=
0
,
vertexIndex
,
group
,
f
,
fl
,
face
,
v1
,
v2
,
v3
,
v
ertexNormals
,
normal
,
uv
,
f
,
fl
,
face
,
v1
,
v2
,
v3
,
v
4
,
vertexNormals
,
faceNormal
,
normal
,
uv
,
vertexGroups
=
[],
faceGroups
=
[],
lineGroups
=
[],
normalGroups
=
[],
uvGroups
=
[],
vertices
,
faces
,
lines
,
normals
,
uvs
,
buffers
=
{};
vertices
,
faces
,
lines
,
normals
,
uvs
;
for
(
f
=
0
,
fl
=
geometry
.
faces
.
length
;
f
<
fl
;
f
++
)
{
...
...
@@ -544,9 +544,9 @@ THREE.WebGLRenderer2 = function ( antialias ) {
identifiers
.
push
(
'
mColor
'
,
'
mOpacity
'
);
material
.
map
?
identifiers
.
push
(
'
tMap
'
)
:
null
;
material
.
env_map
?
identifiers
.
push
(
'
tSpherical
'
)
:
null
;
material
.
fog
?
identifiers
.
push
(
'
fog
'
,
'
fogColor
'
,
'
fogNear
'
,
'
fogFar
'
)
:
null
;
if
(
material
.
map
)
identifiers
.
push
(
'
tMap
'
)
;
if
(
material
.
env_map
)
identifiers
.
push
(
'
tSpherical
'
)
;
if
(
material
.
fog
)
identifiers
.
push
(
'
fog
'
,
'
fogColor
'
,
'
fogNear
'
,
'
fogFar
'
)
;
}
else
if
(
material
instanceof
THREE
.
MeshNormalMaterial
)
{
...
...
@@ -622,7 +622,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
function
compileProgram
(
vertex_shader
,
fragment_shader
)
{
var
program
=
_gl
.
createProgram
(),
shader
var
program
=
_gl
.
createProgram
(),
shader
,
prefix_vertex
,
prefix_fragment
;
prefix_vertex
=
[
maxVertexTextures
()
>
0
?
"
#define VERTEX_TEXTURES
"
:
""
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录