Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
816d19a8
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,发现更多精彩内容 >>
提交
816d19a8
编写于
3月 31, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
REVISION ++
上级
70594cc9
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
422 addition
and
407 deletion
+422
-407
README.md
README.md
+12
-0
REVISION
REVISION
+1
-1
build/Three.js
build/Three.js
+17
-17
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+1
-1
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+1
-1
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+1
-1
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+245
-239
examples/webgl_lights_pointlights.html
examples/webgl_lights_pointlights.html
+3
-3
examples/webgl_stencilLensFlare.html
examples/webgl_stencilLensFlare.html
+5
-5
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+135
-138
未找到文件。
README.md
浏览文件 @
816d19a8
...
...
@@ -141,6 +141,18 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a &
### Change Log ###
2011 03 31 -
**r38**
(225.720 KB, gzip: 55.881 KB)
*
Added
`LensFlare`
light. (
[
empaempa
](
http://github.com/empaempa
)
)
*
Added
`ShadowVolume`
object (stencil shadows). (
[
empaempa
](
http://github.com/empaempa
)
)
*
Improved Blender Exporter plus added Scene support. (
[
alteredq
](
http://github.com/alteredq
)
)
*
Blender Importer for loading JSON files. (
[
alteredq
](
http://github.com/alteredq
)
)
*
Added load/complete callbacks to
`Loader`
(
[
mrdoob
](
http://github.com/mrdoob
)
)
*
Minor WebGL blend mode clean up. (
[
mrdoob
](
http://github.com/mrdoob
)
)
*
*
Materials now extend Material (
[
mrdoob
](
http://github.com/mrdoob
)
)
*
`material.transparent`
define whether material is transparent or not (before we were guessing). (
[
mrdoob
](
http://github.com/mrdoob
)
)
2011 03 22 -
**r37**
(208.495 KB, gzip: 51.376 KB)
*
Changed JSON file format. (
**Re-exporting of models required**
) (
[
alteredq
](
http://github.com/alteredq
)
and
[
mrdoob
](
http://github.com/mrdoob
)
)
...
...
REVISION
浏览文件 @
816d19a8
3
7
3
8
build/Three.js
浏览文件 @
816d19a8
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
816d19a8
// ThreeCanvas.js r3
7
- http://github.com/mrdoob/three.js
// ThreeCanvas.js r3
8
- http://github.com/mrdoob/three.js
var
THREE
=
THREE
||
{};
THREE
.
Color
=
function
(
a
){
this
.
setHex
(
a
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
this
.
hex
=
a
.
hex
;
this
.
__styleString
=
a
.
__styleString
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
e
,
d
,
f
,
g
,
i
,
h
;
if
(
c
==
0
)
e
=
d
=
f
=
0
;
else
{
g
=
Math
.
floor
(
a
*
6
);
i
=
a
*
6
-
g
;
a
=
c
*
(
1
-
b
);
h
=
c
*
(
1
-
b
*
i
);
b
=
c
*
(
1
-
b
*
(
1
-
i
));
switch
(
g
){
case
1
:
e
=
h
;
d
=
c
;
f
=
a
;
break
;
case
2
:
e
=
a
;
d
=
c
;
f
=
b
;
break
;
case
3
:
e
=
a
;
d
=
h
;
f
=
c
;
break
;
case
4
:
e
=
b
;
d
=
a
;
f
=
c
;
break
;
case
5
:
e
=
c
;
d
=
a
;
f
=
h
;
break
;
case
6
:
case
0
:
e
=
c
;
d
=
b
;
f
=
a
}}
this
.
r
=
e
;
this
.
g
=
d
;
this
.
b
=
f
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
...
...
build/custom/ThreeDOM.js
浏览文件 @
816d19a8
// ThreeDOM.js r3
7
- http://github.com/mrdoob/three.js
// ThreeDOM.js r3
8
- http://github.com/mrdoob/three.js
var
THREE
=
THREE
||
{};
THREE
.
Color
=
function
(
a
){
this
.
setHex
(
a
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
this
.
hex
=
a
.
hex
;
this
.
__styleString
=
a
.
__styleString
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
e
,
d
,
g
,
f
,
i
,
h
;
if
(
c
==
0
)
e
=
d
=
g
=
0
;
else
{
f
=
Math
.
floor
(
a
*
6
);
i
=
a
*
6
-
f
;
a
=
c
*
(
1
-
b
);
h
=
c
*
(
1
-
b
*
i
);
b
=
c
*
(
1
-
b
*
(
1
-
i
));
switch
(
f
){
case
1
:
e
=
h
;
d
=
c
;
g
=
a
;
break
;
case
2
:
e
=
a
;
d
=
c
;
g
=
b
;
break
;
case
3
:
e
=
a
;
d
=
h
;
g
=
c
;
break
;
case
4
:
e
=
b
;
d
=
a
;
g
=
c
;
break
;
case
5
:
e
=
c
;
d
=
a
;
g
=
h
;
break
;
case
6
:
case
0
:
e
=
c
;
d
=
b
;
g
=
a
}}
this
.
r
=
e
;
this
.
g
=
d
;
this
.
b
=
g
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
...
...
build/custom/ThreeExtras.js
浏览文件 @
816d19a8
// ThreeExtras.js r3
7
- http://github.com/mrdoob/three.js
// ThreeExtras.js r3
8
- http://github.com/mrdoob/three.js
var
GeometryUtils
=
{
merge
:
function
(
a
,
e
){
var
b
=
e
instanceof
THREE
.
Mesh
,
c
=
a
.
vertices
.
length
,
d
=
b
?
e
.
geometry
:
e
,
f
=
a
.
vertices
,
g
=
d
.
vertices
,
h
=
a
.
faces
,
l
=
d
.
faces
,
k
=
a
.
faceVertexUvs
[
0
];
d
=
d
.
faceVertexUvs
[
0
];
b
&&
e
.
matrixAutoUpdate
&&
e
.
updateMatrix
();
for
(
var
j
=
0
,
m
=
g
.
length
;
j
<
m
;
j
++
){
var
p
=
new
THREE
.
Vertex
(
g
[
j
].
position
.
clone
());
b
&&
e
.
matrix
.
multiplyVector3
(
p
.
position
);
f
.
push
(
p
)}
j
=
0
;
for
(
m
=
l
.
length
;
j
<
m
;
j
++
){
g
=
l
[
j
];
var
w
,
t
,
z
=
g
.
vertexNormals
;
p
=
g
.
vertexColors
;
if
(
g
instanceof
THREE
.
Face3
)
w
=
new
THREE
.
Face3
(
g
.
a
+
c
,
g
.
b
+
c
,
g
.
c
+
c
);
else
g
instanceof
THREE
.
Face4
&&
(
w
=
new
THREE
.
Face4
(
g
.
a
+
c
,
g
.
b
+
c
,
g
.
c
+
c
,
g
.
d
+
c
));
w
.
normal
.
copy
(
g
.
normal
);
b
=
0
;
for
(
f
=
z
.
length
;
b
<
f
;
b
++
){
t
=
z
[
b
];
w
.
vertexNormals
.
push
(
t
.
clone
())}
w
.
color
.
copy
(
g
.
color
);
b
=
0
;
for
(
f
=
p
.
length
;
b
<
f
;
b
++
){
t
=
p
[
b
];
w
.
vertexColors
.
push
(
t
.
clone
())}
w
.
materials
=
g
.
materials
.
slice
();
w
.
centroid
.
copy
(
g
.
centroid
);
h
.
push
(
w
)}
j
=
0
;
for
(
m
=
d
.
length
;
j
<
m
;
j
++
){
c
=
d
[
j
];
h
=
[];
b
=
0
;
for
(
f
=
c
.
length
;
b
<
f
;
b
++
)
h
.
push
(
new
THREE
.
UV
(
c
[
b
].
u
,
c
[
b
].
v
));
k
.
push
(
h
)}}},
ImageUtils
=
{
loadTexture
:
function
(
a
,
e
,
b
){
var
c
=
new
Image
,
d
=
new
THREE
.
Texture
(
c
,
e
);
c
.
onload
=
function
(){
d
.
needsUpdate
=!
0
;
b
&&
b
(
this
)};
c
.
src
=
a
;
return
d
},
loadTextureCube
:
function
(
a
,
e
,
b
){
var
c
,
d
=
[],
f
=
new
THREE
.
Texture
(
d
,
e
);
e
=
d
.
loadCount
=
0
;
for
(
c
=
a
.
length
;
e
<
c
;
++
e
){
d
[
e
]
=
new
Image
;
d
[
e
].
onload
=
function
(){
d
.
loadCount
+=
1
;
if
(
d
.
loadCount
==
6
)
f
.
needsUpdate
=!
0
;
b
&&
b
(
this
)};
d
[
e
].
src
=
a
[
e
]}
return
f
}},
SceneUtils
=
{
loadScene
:
function
(
a
,
e
,
b
,
c
){
var
d
=
new
Worker
(
a
);
d
.
postMessage
(
0
);
var
f
=
THREE
.
Loader
.
prototype
.
extractUrlbase
(
a
);
d
.
onmessage
=
function
(
g
){
function
h
(
X
,
Y
){
return
Y
==
"
relativeToHTML
"
?
...
...
build/custom/ThreeSVG.js
浏览文件 @
816d19a8
// ThreeSVG.js r3
7
- http://github.com/mrdoob/three.js
// ThreeSVG.js r3
8
- http://github.com/mrdoob/three.js
var
THREE
=
THREE
||
{};
THREE
.
Color
=
function
(
a
){
this
.
setHex
(
a
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
this
.
hex
=
a
.
hex
;
this
.
__styleString
=
a
.
__styleString
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
e
,
d
,
f
,
g
,
i
,
h
;
if
(
c
==
0
)
e
=
d
=
f
=
0
;
else
{
g
=
Math
.
floor
(
a
*
6
);
i
=
a
*
6
-
g
;
a
=
c
*
(
1
-
b
);
h
=
c
*
(
1
-
b
*
i
);
b
=
c
*
(
1
-
b
*
(
1
-
i
));
switch
(
g
){
case
1
:
e
=
h
;
d
=
c
;
f
=
a
;
break
;
case
2
:
e
=
a
;
d
=
c
;
f
=
b
;
break
;
case
3
:
e
=
a
;
d
=
h
;
f
=
c
;
break
;
case
4
:
e
=
b
;
d
=
a
;
f
=
c
;
break
;
case
5
:
e
=
c
;
d
=
a
;
f
=
h
;
break
;
case
6
:
case
0
:
e
=
c
;
d
=
b
;
f
=
a
}}
this
.
r
=
e
;
this
.
g
=
d
;
this
.
b
=
f
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
...
...
build/custom/ThreeWebGL.js
浏览文件 @
816d19a8
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
examples/webgl_lights_pointlights.html
浏览文件 @
816d19a8
...
...
@@ -97,13 +97,13 @@
scene
.
addLight
(
new
THREE
.
AmbientLight
(
0x00000
)
);
light1
=
new
THREE
.
PointLight
(
0xff0040
,
1
,
50
);
light1
=
new
THREE
.
PointLight
(
0xff0040
,
2
,
50
);
scene
.
addLight
(
light1
);
light2
=
new
THREE
.
PointLight
(
0x0040ff
,
1
,
50
);
light2
=
new
THREE
.
PointLight
(
0x0040ff
,
2
,
50
);
scene
.
addLight
(
light2
);
light3
=
new
THREE
.
PointLight
(
0x80ff80
,
1
,
50
);
light3
=
new
THREE
.
PointLight
(
0x80ff80
,
2
,
50
);
scene
.
addLight
(
light3
);
var
sphere
=
new
Sphere
(
0.5
,
16
,
8
);
...
...
examples/webgl_stencilLensFlare.html
浏览文件 @
816d19a8
...
...
@@ -71,8 +71,8 @@
new
THREE
.
ShadowVolume
(
mesh1
)
new
THREE
.
ShadowVolume
(
mesh2
)
new
THREE
.
ShadowVolume
(
mesh3
)
// moving objects
var
cube
=
new
Cube
(
40
,
40
,
40
);
...
...
@@ -84,13 +84,13 @@
boxMesh
=
new
THREE
.
Mesh
(
cube
,
material2
);
scene
.
addChild
(
boxMesh
);
new
THREE
.
ShadowVolume
(
mesh
);
new
THREE
.
ShadowVolume
(
boxMesh
);
// lights
light
=
new
THREE
.
PointLight
(
0xffffff
);
scene
.
addChild
(
light
);
...
...
@@ -109,7 +109,7 @@
lensFlare
.
add
(
ImageUtils
.
loadTexture
(
"
textures/lensflare1.png
"
),
256
,
0.33
,
THREE
.
AdditiveBlending
);
lensFlare
.
add
(
lensFlare
.
lensFlares
[
1
].
texture
,
300
,
0.66
,
THREE
.
AdditiveBlending
);
lensFlare
.
add
(
lensFlare
.
lensFlares
[
1
].
texture
,
400
,
1.0
,
THREE
.
AdditiveBlending
);
lightCube
.
addChild
(
lensFlare
);
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
816d19a8
...
...
@@ -547,29 +547,29 @@ THREE.WebGLRenderer = function ( parameters ) {
geometryGroup
.
__webglFaceCount
=
ntris
*
3
+
(
object
.
geometry
.
edgeFaces
?
object
.
geometry
.
edgeFaces
.
length
*
2
*
3
:
0
);
geometryGroup
.
__webglLineCount
=
nlines
*
2
;
// custom attributes
for
(
m
=
0
,
ml
=
materials
.
length
;
m
<
ml
;
m
++
)
{
if
(
materials
[
m
].
attributes
)
{
for
(
m
=
0
,
ml
=
materials
.
length
;
m
<
ml
;
m
++
)
{
if
(
materials
[
m
].
attributes
)
{
geometryGroup
.
__webglCustomAttributes
=
{};
for
(
a
in
materials
[
m
].
attributes
)
{
for
(
a
in
materials
[
m
].
attributes
)
{
attribute
=
materials
[
m
].
attributes
[
a
];
size
=
1
;
// "f" and "i"
if
(
attribute
.
type
===
"
v2
"
)
size
=
2
;
if
(
attribute
.
type
===
"
v2
"
)
size
=
2
;
else
if
(
attribute
.
type
===
"
v3
"
)
size
=
3
;
else
if
(
attribute
.
type
===
"
v4
"
)
size
=
4
;
else
if
(
attribute
.
type
===
"
c
"
)
size
=
3
;
attribute
.
size
=
size
;
attribute
.
dirty
=
true
;
attribute
.
needsUpdate
=
true
;
attribute
.
array
=
new
Float32Array
(
nvertices
*
size
);
attribute
.
buffer
=
_gl
.
createBuffer
();
...
...
@@ -578,7 +578,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
}
}
};
...
...
@@ -586,7 +586,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function
setMeshBuffers
(
geometryGroup
,
object
,
hint
)
{
var
f
,
fl
,
fi
,
face
,
var
f
,
fl
,
fi
,
face
,
vertexNormals
,
faceNormal
,
normal
,
vertexColors
,
faceColor
,
vertexTangents
,
...
...
@@ -629,7 +629,7 @@ THREE.WebGLRenderer = function ( parameters ) {
skinWeightArray
=
geometryGroup
.
__skinWeightArray
,
morphTargetsArrays
=
geometryGroup
.
__morphTargetsArrays
,
customAttributes
=
geometryGroup
.
__webglCustomAttributes
,
customAttribute
,
...
...
@@ -670,15 +670,14 @@ THREE.WebGLRenderer = function ( parameters ) {
morphTargets
=
geometry
.
morphTargets
;
if
(
customAttributes
)
{
for
(
a
in
customAttributes
)
{
customAttributes
[
a
].
offset
=
0
;
}
}
}
for
(
f
=
0
,
fl
=
chunk_faces
.
length
;
f
<
fl
;
f
++
)
{
...
...
@@ -731,79 +730,79 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if
(
customAttributes
)
{
for
(
a
in
customAttributes
)
{
customAttribute
=
customAttributes
[
a
];
if
(
customAttribute
.
dirty
)
{
if
(
customAttribute
.
needsUpdate
)
{
offset_custom
=
customAttribute
.
offset
;
if
(
customAttribute
.
size
===
1
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
face
.
a
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
face
.
b
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
c
];
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
face
.
a
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
face
.
b
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
c
];
customAttribute
.
offset
+=
3
;
}
else
{
v1
=
customAttribute
.
value
[
face
.
a
];
v2
=
customAttribute
.
value
[
face
.
b
];
v3
=
customAttribute
.
value
[
face
.
c
];
if
(
customAttribute
.
size
===
2
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v3
.
y
;
customAttribute
.
offset
+=
6
;
}
else
if
(
customAttribute
.
size
===
3
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v3
.
y
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
z
;
customAttribute
.
offset
+=
9
;
}
else
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v1
.
w
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v2
.
w
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v1
.
w
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v2
.
w
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
9
]
=
v3
.
y
;
customAttribute
.
array
[
offset_custom
+
10
]
=
v3
.
z
;
customAttribute
.
array
[
offset_custom
+
11
]
=
v3
.
w
;
customAttribute
.
offset
+=
12
;
}
}
}
}
}
...
...
@@ -1097,90 +1096,90 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if
(
customAttributes
)
{
for
(
a
in
customAttributes
)
{
customAttribute
=
customAttributes
[
a
];
if
(
customAttribute
.
dirty
)
{
if
(
customAttribute
.
needsUpdate
)
{
offset_custom
=
customAttribute
.
offset
;
if
(
customAttribute
.
size
===
1
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
face
.
a
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
face
.
b
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
c
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
d
];
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
face
.
a
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
face
.
b
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
c
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
d
];
customAttribute
.
offset
+=
4
;
}
else
{
v1
=
customAttribute
.
value
[
face
.
a
];
v2
=
customAttribute
.
value
[
face
.
b
];
v3
=
customAttribute
.
value
[
face
.
c
];
v4
=
customAttribute
.
value
[
face
.
d
];
if
(
customAttribute
.
size
===
2
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v3
.
y
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v4
.
x
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v4
.
x
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v4
.
y
;
customAttribute
.
offset
+=
8
;
}
else
if
(
customAttribute
.
size
===
3
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v3
.
y
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
z
;
customAttribute
.
array
[
offset_custom
+
9
]
=
v4
.
x
;
customAttribute
.
array
[
offset_custom
+
9
]
=
v4
.
x
;
customAttribute
.
array
[
offset_custom
+
10
]
=
v4
.
y
;
customAttribute
.
array
[
offset_custom
+
11
]
=
v4
.
z
;
customAttribute
.
offset
+=
12
;
}
else
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v1
.
w
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v2
.
w
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v1
.
w
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v2
.
w
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
9
]
=
v3
.
y
;
customAttribute
.
array
[
offset_custom
+
10
]
=
v3
.
z
;
customAttribute
.
array
[
offset_custom
+
11
]
=
v3
.
w
;
customAttribute
.
array
[
offset_custom
+
12
]
=
v4
.
x
;
customAttribute
.
array
[
offset_custom
+
12
]
=
v4
.
x
;
customAttribute
.
array
[
offset_custom
+
13
]
=
v4
.
y
;
customAttribute
.
array
[
offset_custom
+
14
]
=
v4
.
z
;
customAttribute
.
array
[
offset_custom
+
15
]
=
v4
.
w
;
customAttribute
.
offset
+=
16
;
}
}
}
}
}
...
...
@@ -1399,7 +1398,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if
(
dirtyNormals
&&
normalType
)
{
if
(
dirtyNormals
&&
normalType
)
{
if
(
vertexNormals
.
length
==
4
&&
needsSmoothNormals
)
{
...
...
@@ -1520,17 +1519,17 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if
(
customAttributes
)
{
for
(
a
in
customAttributes
)
{
customAttribute
=
customAttributes
[
a
];
if
(
customAttribute
.
dirty
)
{
if
(
customAttribute
.
needsUpdate
)
{
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
customAttribute
.
buffer
);
_gl
.
bufferData
(
_gl
.
ARRAY_BUFFER
,
customAttribute
.
array
,
hint
);
customAttribute
.
dirty
=
false
;
customAttribute
.
needsUpdate
=
false
;
}
...
...
@@ -2270,20 +2269,20 @@ THREE.WebGLRenderer = function ( parameters ) {
// custom attributes
if
(
geometryGroup
.
__webglCustomAttributes
)
{
for
(
a
in
geometryGroup
.
__webglCustomAttributes
)
{
if
(
attributes
[
a
]
>=
0
)
{
attribute
=
geometryGroup
.
__webglCustomAttributes
[
a
];
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
attribute
.
buffer
);
_gl
.
vertexAttribPointer
(
attributes
[
a
],
attribute
.
size
,
_gl
.
FLOAT
,
false
,
0
,
0
);
}
}
}
...
...
@@ -3383,8 +3382,6 @@ THREE.WebGLRenderer = function ( parameters ) {
geometry
.
__dirtyTangents
=
true
;
geometry
.
__dirtyColors
=
true
;
}
// create separate wrapper per each use of VBO
...
...
@@ -3479,14 +3476,14 @@ THREE.WebGLRenderer = function ( parameters ) {
customAttributeDirty
=
false
;
for
(
a
in
geometryGroup
.
__webglCustomAttributes
)
{
if
(
geometryGroup
.
__webglCustomAttributes
[
a
].
dirty
)
{
for
(
a
in
geometryGroup
.
__webglCustomAttributes
)
{
if
(
geometryGroup
.
__webglCustomAttributes
[
a
].
needsUpdate
)
{
customAttributeDirty
=
true
;
break
;
}
}
if
(
geometry
.
__dirtyVertices
||
geometry
.
__dirtyMorphTargets
||
geometry
.
__dirtyElements
||
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录