Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
158f2e71
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,发现更多精彩内容 >>
提交
158f2e71
编写于
11月 24, 2010
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge remote branch 'alteredq/master'
上级
14eb44a2
aaf56993
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
67 addition
and
66 deletion
+67
-66
build/Three.js
build/Three.js
+4
-4
build/ThreeDebug.js
build/ThreeDebug.js
+54
-54
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+9
-6
src/scenes/Scene.js
src/scenes/Scene.js
+0
-2
未找到文件。
build/Three.js
浏览文件 @
158f2e71
...
...
@@ -78,7 +78,7 @@ THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16711680);thi
this
.
blending
+
"
<br/>)
"
}};
THREE
.
ParticleCircleMaterial
=
function
(
a
){
this
.
color
=
new
THREE
.
Color
(
16711680
);
this
.
opacity
=
1
;
this
.
blending
=
THREE
.
NormalBlending
;
if
(
a
){
a
.
color
!==
undefined
&&
this
.
color
.
setHex
(
a
.
color
);
if
(
a
.
opacity
!==
undefined
)
this
.
opacity
=
a
.
opacity
;
if
(
a
.
blending
!==
undefined
)
this
.
blending
=
a
.
blending
}
this
.
toString
=
function
(){
return
"
THREE.ParticleCircleMaterial (<br/>color:
"
+
this
.
color
+
"
<br/>opacity:
"
+
this
.
opacity
+
"
<br/>blending:
"
+
this
.
blending
+
"
<br/>)
"
}};
THREE
.
ParticleDOMMaterial
=
function
(
a
){
this
.
domElement
=
a
;
this
.
toString
=
function
(){
return
"
THREE.ParticleDOMMaterial ( domElement:
"
+
this
.
domElement
+
"
)
"
}};
THREE
.
Texture
=
function
(
a
,
c
,
f
,
h
){
this
.
image
=
a
;
this
.
mapping
=
c
!==
undefined
?
c
:
THREE
.
UVMapping
;
this
.
wrap_s
=
f
!==
undefined
?
f
:
THREE
.
ClampToEdge
;
this
.
wrap_t
=
h
!==
undefined
?
h
:
THREE
.
ClampToEdge
;
this
.
toString
=
function
(){
return
"
THREE.Texture (<br/>image:
"
+
this
.
image
+
"
<br/>wrap_s:
"
+
this
.
wrap_s
+
"
<br/>wrap_t:
"
+
this
.
wrap_t
+
"
<br/>)
"
}};
THREE
.
UVMapping
=
0
;
THREE
.
ReflectionMap
=
1
;
THREE
.
RefractionMap
=
2
;
THREE
.
Multiply
=
0
;
THREE
.
Mix
=
1
;
THREE
.
Repeat
=
0
;
THREE
.
ClampToEdge
=
1
;
THREE
.
MirroredRepeat
=
2
;
THREE
.
TextureCube
=
function
(
a
,
c
){
this
.
image
=
a
;
this
.
mapping
=
c
?
c
:
THREE
.
ReflectionMap
;
this
.
toString
=
function
(){
return
"
THREE.TextureCube (<br/>image:
"
+
this
.
image
+
"
<br/>mapping:
"
+
this
.
mapping
+
"
<br/>)
"
}};
THREE
.
Scene
=
function
(){
this
.
objects
=
[];
this
.
lights
=
[];
this
.
addObject
=
function
(
a
){
this
.
objects
.
push
(
a
)};
this
.
removeObject
=
function
(
a
){
var
c
=
this
.
objects
.
indexOf
(
a
);
c
!==-
1
&&
this
.
objects
.
splice
(
c
,
1
);
a
.
__removed
=
true
};
this
.
addLight
=
function
(
a
){
this
.
lights
.
push
(
a
)};
this
.
removeLight
=
function
(
a
){
a
=
this
.
lights
.
indexOf
(
a
);
a
!==-
1
&&
this
.
lights
.
splice
(
a
,
1
)};
this
.
toString
=
function
(){
return
"
THREE.Scene (
"
+
this
.
objects
+
"
)
"
}};
THREE
.
Scene
=
function
(){
this
.
objects
=
[];
this
.
lights
=
[];
this
.
addObject
=
function
(
a
){
this
.
objects
.
push
(
a
)};
this
.
removeObject
=
function
(
a
){
a
=
this
.
objects
.
indexOf
(
a
);
a
!==-
1
&&
this
.
objects
.
splice
(
a
,
1
)
};
this
.
addLight
=
function
(
a
){
this
.
lights
.
push
(
a
)};
this
.
removeLight
=
function
(
a
){
a
=
this
.
lights
.
indexOf
(
a
);
a
!==-
1
&&
this
.
lights
.
splice
(
a
,
1
)};
this
.
toString
=
function
(){
return
"
THREE.Scene (
"
+
this
.
objects
+
"
)
"
}};
THREE
.
Projector
=
function
(){
function
a
(
r
,
q
){
var
l
=
0
,
R
=
1
,
H
=
r
.
z
+
r
.
w
,
U
=
q
.
z
+
q
.
w
,
$
=-
r
.
z
+
r
.
w
,
t
=-
q
.
z
+
q
.
w
;
if
(
H
>=
0
&&
U
>=
0
&&
$
>=
0
&&
t
>=
0
)
return
true
;
else
if
(
H
<
0
&&
U
<
0
||
$
<
0
&&
t
<
0
)
return
false
;
else
{
if
(
H
<
0
)
l
=
Math
.
max
(
l
,
H
/
(
H
-
U
));
else
if
(
U
<
0
)
R
=
Math
.
min
(
R
,
H
/
(
H
-
U
));
if
(
$
<
0
)
l
=
Math
.
max
(
l
,
$
/
(
$
-
t
));
else
if
(
t
<
0
)
R
=
Math
.
min
(
R
,
$
/
(
$
-
t
));
if
(
R
<
l
)
return
false
;
else
{
r
.
lerpSelf
(
q
,
l
);
q
.
lerpSelf
(
r
,
1
-
R
);
return
true
}}}
var
c
=
null
,
f
,
h
,
b
=
[],
d
,
p
,
s
=
[],
o
,
e
,
g
=
[],
k
,
i
,
n
=
[],
j
=
new
THREE
.
Vector4
,
z
=
new
THREE
.
Matrix4
,
C
=
new
THREE
.
Matrix4
,
v
=
new
THREE
.
Vector4
,
L
=
new
THREE
.
Vector4
;
this
.
projectScene
=
function
(
r
,
q
){
var
l
,
R
,
H
,
U
,
$
,
t
,
F
,
D
,
u
,
N
,
oa
,
Z
,
S
,
B
;
c
=
[];
i
=
e
=
p
=
h
=
0
;
q
.
autoUpdateMatrix
&&
q
.
updateMatrix
();
z
.
multiply
(
q
.
projectionMatrix
,
q
.
matrix
);
$
=
r
.
objects
;
l
=
0
;
for
(
R
=
$
.
length
;
l
<
R
;
l
++
){
t
=
$
[
l
];
F
=
t
.
matrix
;
t
.
autoUpdateMatrix
&&
t
.
updateMatrix
();
if
(
t
instanceof
THREE
.
Mesh
){
C
.
multiply
(
z
,
F
);
D
=
t
.
geometry
.
vertices
;
H
=
0
;
for
(
U
=
D
.
length
;
H
<
U
;
H
++
){
u
=
D
[
H
];
N
=
u
.
positionScreen
;
N
.
copy
(
u
.
position
);
C
.
transform
(
N
);
N
.
multiplyScalar
(
1
/
N
.
w
);
u
.
__visible
=
N
.
z
>
0
&&
N
.
z
<
1
}
oa
=
t
.
geometry
.
faces
;
H
=
0
;
for
(
U
=
oa
.
length
;
H
<
U
;
H
++
){
Z
=
oa
[
H
];
if
(
Z
instanceof
THREE
.
Face3
){
u
=
D
[
Z
.
a
];
N
=
D
[
Z
.
b
];
S
=
D
[
Z
.
c
];
if
(
u
.
__visible
&&
N
.
__visible
&&
S
.
__visible
)
if
(
t
.
doubleSided
||
t
.
flipSided
!=
(
S
.
positionScreen
.
x
-
u
.
positionScreen
.
x
)
*
(
N
.
positionScreen
.
y
-
u
.
positionScreen
.
y
)
-
(
S
.
positionScreen
.
y
-
u
.
positionScreen
.
y
)
*
(
N
.
positionScreen
.
x
-
u
.
positionScreen
.
x
)
<
0
){
f
=
b
[
h
]
=
b
[
h
]
||
new
THREE
.
RenderableFace3
;
f
.
v1
.
positionScreen
.
copy
(
u
.
positionScreen
);
f
.
v2
.
positionScreen
.
copy
(
N
.
positionScreen
);
f
.
v3
.
positionScreen
.
copy
(
S
.
positionScreen
);
f
.
normalWorld
.
copy
(
Z
.
normal
);
...
...
@@ -159,9 +159,9 @@ for(i=0;i<6;++i)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b.RGBA,b.RGBA,b.U
g
.
__webGLFaceCount
,
b
.
UNSIGNED_SHORT
,
0
)}};
this
.
renderPass
=
function
(
e
,
g
,
k
,
i
){
var
n
,
j
,
z
,
C
,
v
;
z
=
0
;
for
(
C
=
e
.
material
.
length
;
z
<
C
;
z
++
){
n
=
e
.
material
[
z
];
if
(
n
instanceof
THREE
.
MeshFaceMaterial
){
n
=
0
;
for
(
j
=
g
.
material
.
length
;
n
<
j
;
n
++
)
if
((
v
=
g
.
material
[
n
])
&&
v
.
blending
==
k
&&
v
.
opacity
<
1
==
i
){
this
.
setBlending
(
v
.
blending
);
this
.
renderBuffer
(
v
,
g
)}}
else
if
((
v
=
n
)
&&
v
.
blending
==
k
&&
v
.
opacity
<
1
==
i
){
this
.
setBlending
(
v
.
blending
);
this
.
renderBuffer
(
v
,
g
)}}};
this
.
render
=
function
(
e
,
g
){
var
k
,
i
;
this
.
initWebGLObjects
(
e
);
this
.
autoClear
&&
this
.
clear
();
g
.
autoUpdateMatrix
&&
g
.
updateMatrix
();
b
.
uniform3f
(
d
.
cameraPosition
,
g
.
position
.
x
,
g
.
position
.
y
,
g
.
position
.
z
);
this
.
setupLights
(
e
);
k
=
0
;
for
(
i
=
e
.
__webGLObjects
.
length
;
k
<
i
;
k
++
){
webGLObject
=
e
.
__webGLObjects
[
k
];
if
(
webGLObject
.
__object
.
visible
){
this
.
setupMatrices
(
webGLObject
.
__object
,
g
);
this
.
renderPass
(
webGLObject
.
__object
,
webGLObject
,
THREE
.
NormalBlending
,
false
)}}
k
=
0
;
for
(
i
=
e
.
__webGLObjects
.
length
;
k
<
i
;
k
++
){
webGLObject
=
e
.
__webGLObjects
[
k
];
if
(
webGLObject
.
__object
.
visible
){
this
.
setupMatrices
(
webGLObject
.
__object
,
g
);
this
.
renderPass
(
webGLObject
.
__object
,
webGLObject
,
THREE
.
AdditiveBlending
,
false
);
this
.
renderPass
(
webGLObject
.
__object
,
webGLObject
,
THREE
.
SubtractiveBlending
,
false
);
this
.
renderPass
(
webGLObject
.
__object
,
webGLObject
,
THREE
.
AdditiveBlending
,
true
);
this
.
renderPass
(
webGLObject
.
__object
,
webGLObject
,
THREE
.
SubtractiveBlending
,
true
);
this
.
renderPass
(
webGLObject
.
__object
,
webGLObject
,
THREE
.
NormalBlending
,
true
)}}};
this
.
initWebGLObjects
=
function
(
e
){
var
g
,
k
,
i
,
n
,
j
;
if
(
!
e
.
__webGLObjects
)
e
.
__webGLObjects
=
[];
g
=
0
;
for
(
k
=
e
.
objects
.
length
;
g
<
k
;
g
++
){
i
=
e
.
objects
[
g
];
if
(
i
instanceof
THREE
.
Mesh
)
for
(
n
in
i
.
materialFaceGroup
){
j
=
i
.
materialFaceGroup
[
n
];
if
(
!
j
.
__webGLVertexBuffer
){
this
.
createBuffers
(
i
,
n
);
j
.
__object
=
i
;
e
.
__webGLObjects
.
push
(
j
)}}}
for
(
g
=
e
.
__webGLObjects
.
length
-
1
;
g
>=
0
;
g
--
){
i
=
e
.
__webGLObjects
[
g
].
__object
;
i
.
__removed
&&
e
.
__webGLObjects
.
splice
(
g
,
1
)}};
this
.
setupMatrices
=
function
(
e
,
g
){
e
.
autoUpdateMatrix
&&
e
.
updateMatrix
();
p
.
multiply
(
g
.
matrix
,
e
.
matrix
);
d
.
viewMatrixArray
=
new
Float32Array
(
g
.
matrix
.
flatten
());
d
.
modelViewMatrixArray
=
new
Float32Array
(
p
.
flatten
());
d
.
projectionMatrixArray
=
new
Float32Array
(
g
.
projectionMatrix
.
flatten
());
s
=
THREE
.
Matrix4
.
makeInvert3x3
(
p
).
transpose
();
d
.
normalMatrixArray
=
new
Float32Array
(
s
.
m
);
b
.
uniformMatrix4fv
(
d
.
viewMatrix
,
false
,
d
.
viewMatrixArray
);
b
.
uniformMatrix4fv
(
d
.
modelViewMatrix
,
false
,
d
.
modelViewMatrixArray
);
b
.
uniformMatrix4fv
(
d
.
projectionMatrix
,
false
,
d
.
projectionMatrixArray
);
b
.
uniformMatrix3fv
(
d
.
normalMatrix
,
false
,
d
.
normalMatrixArray
);
b
.
uniformMatrix4fv
(
d
.
objMatrix
,
false
,
new
Float32Array
(
e
.
matrix
.
flatten
()))};
this
.
setBlending
=
function
(
e
){
switch
(
e
){
case
THREE
.
AdditiveBlending
:
b
.
blendEquation
(
b
.
FUNC_ADD
);
b
.
blendFunc
(
b
.
ONE
,
b
.
ONE
);
break
;
case
THREE
.
SubtractiveBlending
:
b
.
blendFunc
(
b
.
DST_COLOR
,
b
.
ZERO
);
break
;
default
:
b
.
blendEquation
(
b
.
FUNC_ADD
);
b
.
blendFunc
(
b
.
ONE
,
b
.
ONE_MINUS_SRC_ALPHA
)}};
this
.
setFaceCulling
=
function
(
e
,
g
){
if
(
e
){
!
g
||
g
==
"
ccw
"
?
b
.
frontFace
(
b
.
CCW
):
b
.
frontFace
(
b
.
CW
);
if
(
e
==
"
back
"
)
b
.
cullFace
(
b
.
BACK
);
else
e
==
"
front
"
?
b
.
cullFace
(
b
.
FRONT
):
b
.
cullFace
(
b
.
FRONT_AND_BACK
);
b
.
enable
(
b
.
CULL_FACE
)}
else
b
.
disable
(
b
.
CULL_FACE
)}};
e
.
objects
.
length
;
g
<
k
;
g
++
){
i
=
e
.
objects
[
g
];
if
(
i
instanceof
THREE
.
Mesh
)
for
(
n
in
i
.
materialFaceGroup
){
j
=
i
.
materialFaceGroup
[
n
];
if
(
!
j
.
__webGLVertexBuffer
){
this
.
createBuffers
(
i
,
n
);
j
.
__object
=
i
;
e
.
__webGLObjects
.
push
(
j
)}}}
};
this
.
removeObject
=
function
(
e
,
g
){
var
k
,
i
;
for
(
k
=
e
.
__webGLObjects
.
length
-
1
;
k
>=
0
;
k
--
){
i
=
e
.
__webGLObjects
[
k
].
__object
;
g
==
i
&&
e
.
__webGLObjects
.
splice
(
k
,
1
)}};
this
.
setupMatrices
=
function
(
e
,
g
){
e
.
autoUpdateMatrix
&&
e
.
updateMatrix
();
p
.
multiply
(
g
.
matrix
,
e
.
matrix
);
d
.
viewMatrixArray
=
new
Float32Array
(
g
.
matrix
.
flatten
());
d
.
modelViewMatrixArray
=
new
Float32Array
(
p
.
flatten
());
d
.
projectionMatrixArray
=
new
Float32Array
(
g
.
projectionMatrix
.
flatten
());
s
=
THREE
.
Matrix4
.
makeInvert3x3
(
p
).
transpose
();
d
.
normalMatrixArray
=
new
Float32Array
(
s
.
m
);
b
.
uniformMatrix4fv
(
d
.
viewMatrix
,
false
,
d
.
viewMatrixArray
);
b
.
uniformMatrix4fv
(
d
.
modelViewMatrix
,
false
,
d
.
modelViewMatrixArray
);
b
.
uniformMatrix4fv
(
d
.
projectionMatrix
,
false
,
d
.
projectionMatrixArray
);
b
.
uniformMatrix3fv
(
d
.
normalMatrix
,
false
,
d
.
normalMatrixArray
);
b
.
uniformMatrix4fv
(
d
.
objMatrix
,
false
,
new
Float32Array
(
e
.
matrix
.
flatten
()))};
this
.
setBlending
=
function
(
e
){
switch
(
e
){
case
THREE
.
AdditiveBlending
:
b
.
blendEquation
(
b
.
FUNC_ADD
);
b
.
blendFunc
(
b
.
ONE
,
b
.
ONE
);
break
;
case
THREE
.
SubtractiveBlending
:
b
.
blendFunc
(
b
.
DST_COLOR
,
b
.
ZERO
);
break
;
default
:
b
.
blendEquation
(
b
.
FUNC_ADD
);
b
.
blendFunc
(
b
.
ONE
,
b
.
ONE_MINUS_SRC_ALPHA
)}};
this
.
setFaceCulling
=
function
(
e
,
g
){
if
(
e
){
!
g
||
g
==
"
ccw
"
?
b
.
frontFace
(
b
.
CCW
):
b
.
frontFace
(
b
.
CW
);
if
(
e
==
"
back
"
)
b
.
cullFace
(
b
.
BACK
);
else
e
==
"
front
"
?
b
.
cullFace
(
b
.
FRONT
):
b
.
cullFace
(
b
.
FRONT_AND_BACK
);
b
.
enable
(
b
.
CULL_FACE
)}
else
b
.
disable
(
b
.
CULL_FACE
)}};
THREE
.
RenderableFace3
=
function
(){
this
.
v1
=
new
THREE
.
Vertex
;
this
.
v2
=
new
THREE
.
Vertex
;
this
.
v3
=
new
THREE
.
Vertex
;
this
.
centroidWorld
=
new
THREE
.
Vector3
;
this
.
centroidScreen
=
new
THREE
.
Vector3
;
this
.
normalWorld
=
new
THREE
.
Vector3
;
this
.
material
=
this
.
color
=
this
.
z
=
null
};
THREE
.
RenderableFace4
=
function
(){
this
.
v1
=
new
THREE
.
Vertex
;
this
.
v2
=
new
THREE
.
Vertex
;
this
.
v3
=
new
THREE
.
Vertex
;
this
.
v4
=
new
THREE
.
Vertex
;
this
.
centroidWorld
=
new
THREE
.
Vector3
;
this
.
centroidScreen
=
new
THREE
.
Vector3
;
this
.
normalWorld
=
new
THREE
.
Vector3
;
this
.
material
=
this
.
color
=
this
.
z
=
null
};
THREE
.
RenderableParticle
=
function
(){
this
.
rotation
=
this
.
z
=
this
.
y
=
this
.
x
=
null
;
this
.
scale
=
new
THREE
.
Vector2
;
this
.
material
=
this
.
color
=
null
};
THREE
.
RenderableLine
=
function
(){
this
.
v1
=
new
THREE
.
Vertex
;
this
.
v2
=
new
THREE
.
Vertex
;
this
.
material
=
this
.
color
=
this
.
z
=
null
};
build/ThreeDebug.js
浏览文件 @
158f2e71
此差异已折叠。
点击以展开。
src/renderers/WebGLRenderer.js
浏览文件 @
158f2e71
...
...
@@ -736,13 +736,18 @@ THREE.WebGLRenderer = function ( scene ) {
}*/
}
// clean up orphaned objects
};
this
.
removeObject
=
function
(
scene
,
object
)
{
var
o
,
ol
,
zobject
;
for
(
o
=
scene
.
__webGLObjects
.
length
-
1
;
o
>=
0
;
o
--
)
{
object
=
scene
.
__webGLObjects
[
o
].
__object
;
if
(
object
.
__removed
)
{
zobject
=
scene
.
__webGLObjects
[
o
].
__object
;
if
(
object
==
zobject
)
{
scene
.
__webGLObjects
.
splice
(
o
,
1
);
...
...
@@ -750,10 +755,8 @@ THREE.WebGLRenderer = function ( scene ) {
}
};
this
.
setupMatrices
=
function
(
object
,
camera
)
{
object
.
autoUpdateMatrix
&&
object
.
updateMatrix
();
...
...
src/scenes/Scene.js
浏览文件 @
158f2e71
...
...
@@ -22,8 +22,6 @@ THREE.Scene = function () {
this
.
objects
.
splice
(
i
,
1
);
}
object
.
__removed
=
true
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录