Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
da7e7255
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,发现更多精彩内容 >>
提交
da7e7255
编写于
2月 07, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implemented extend pattern in WebGLRenderer2 objects.
上级
82f90a00
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
1490 addition
and
1472 deletion
+1490
-1472
src/renderers/webgl/objects/LineRenderer.js
src/renderers/webgl/objects/LineRenderer.js
+113
-107
src/renderers/webgl/objects/MeshRenderer.js
src/renderers/webgl/objects/MeshRenderer.js
+1018
-1016
src/renderers/webgl/objects/Object3DRenderer.js
src/renderers/webgl/objects/Object3DRenderer.js
+64
-61
src/renderers/webgl/objects/ParticleRenderer.js
src/renderers/webgl/objects/ParticleRenderer.js
+183
-180
src/renderers/webgl/objects/RibbonRenderer.js
src/renderers/webgl/objects/RibbonRenderer.js
+112
-108
未找到文件。
src/renderers/webgl/objects/LineRenderer.js
浏览文件 @
da7e7255
THREE
.
WebGLRenderer
.
LineRenderer
=
function
(
lowlevelrenderer
,
info
)
{
THREE
.
WebGLRenderer
.
LineRenderer
=
function
(
lowlevelrenderer
,
info
){
THREE
.
WebGLRenderer
.
Object3DRenderer
.
call
(
this
,
lowlevelrenderer
,
info
);
};
};
THREE
.
WebGLRenderer
.
LineRenderer
.
prototype
=
Object
.
create
(
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
);
THREE
.
WebGLRenderer
.
LineRenderer
.
prototype
.
createBuffers
=
function
(
geometry
)
{
THREE
.
extend
(
THREE
.
WebGLRenderer
.
LineRenderer
.
prototype
,
{
var
renderer
=
this
.
renderer
;
geometry
.
__webglVertexBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglColorBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglLineDistanceBuffer
=
renderer
.
createBuffer
();
createBuffers
:
function
(
geometry
)
{
this
.
info
.
memory
.
geometries
++
;
};
var
renderer
=
this
.
renderer
;
geometry
.
__webglVertexBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglColorBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglLineDistanceBuffer
=
renderer
.
createBuffer
();
THREE
.
WebGLRenderer
.
LineRenderer
.
prototype
.
initBuffers
=
function
(
geometry
,
object
)
{
this
.
info
.
memory
.
geometries
++
;
var
nvertices
=
geometry
.
vertices
.
length
;
},
geometry
.
__vertexArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__colorArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__lineDistanceArray
=
new
Float32Array
(
nvertices
*
1
);
initBuffers
:
function
(
geometry
,
object
)
{
geometry
.
__webglLineCount
=
nvertices
;
var
nvertices
=
geometry
.
vertices
.
length
;
this
.
initCustomAttributes
(
geometry
,
object
);
};
geometry
.
__vertexArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__colorArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__lineDistanceArray
=
new
Float32Array
(
nvertices
*
1
);
geometry
.
__webglLineCount
=
nvertices
;
this
.
initCustomAttributes
(
geometry
,
object
);
THREE
.
WebGLRenderer
.
LineRenderer
.
prototype
.
setBuffers
=
function
(
geometry
,
object
)
{
},
var
renderer
=
this
.
renderer
;
var
v
,
c
,
d
,
vertex
,
offset
,
color
,
setBuffers
:
function
(
geometry
,
object
)
{
vertices
=
geometry
.
vertices
,
colors
=
geometry
.
colors
,
lineDistances
=
geometry
.
lineDistances
,
var
renderer
=
this
.
renderer
;
var
v
,
c
,
d
,
vertex
,
offset
,
color
,
vl
=
vertices
.
length
,
cl
=
colors
.
length
,
dl
=
lineDistances
.
length
,
vertices
=
geometry
.
vertices
,
colors
=
geometry
.
colors
,
lineDistances
=
geometry
.
lineDistances
,
vertexArray
=
geometry
.
__vertexArray
,
colorArray
=
geometry
.
__colorArray
,
lineDistanceArray
=
geometry
.
__lineDistanceArray
,
vl
=
vertices
.
length
,
cl
=
colors
.
length
,
dl
=
lineDistances
.
length
,
dirtyVertices
=
geometry
.
verticesNeedUpdate
,
dirtyColors
=
geometry
.
colorsNeedUpdate
,
dirtyLineDistances
=
geometry
.
lineDistancesNeedUpdate
,
vertexArray
=
geometry
.
__vertexArray
,
colorArray
=
geometry
.
__colorArray
,
lineDistanceArray
=
geometry
.
__lineDistanceArray
,
customAttributes
=
geometry
.
__webglCustomAttributesList
,
dirtyVertices
=
geometry
.
verticesNeedUpdate
,
dirtyColors
=
geometry
.
colorsNeedUpdate
,
dirtyLineDistances
=
geometry
.
lineDistancesNeedUpdate
,
i
,
il
,
a
,
ca
,
cal
,
value
,
customAttribute
;
customAttributes
=
geometry
.
__webglCustomAttributesList
,
if
(
dirtyVertices
)
{
i
,
il
,
a
,
ca
,
cal
,
value
,
customAttribute
;
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
if
(
dirtyVertices
)
{
vertex
=
vertices
[
v
];
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
offset
=
v
*
3
;
vertex
=
vertices
[
v
]
;
vertexArray
[
offset
]
=
vertex
.
x
;
vertexArray
[
offset
+
1
]
=
vertex
.
y
;
vertexArray
[
offset
+
2
]
=
vertex
.
z
;
offset
=
v
*
3
;
vertexArray
[
offset
]
=
vertex
.
x
;
vertexArray
[
offset
+
1
]
=
vertex
.
y
;
vertexArray
[
offset
+
2
]
=
vertex
.
z
;
}
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglVertexBuffer
,
vertexArray
);
}
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglVertexBuffer
,
vertexArray
);
if
(
dirtyColors
)
{
}
for
(
c
=
0
;
c
<
cl
;
c
++
)
{
if
(
dirtyColors
)
{
color
=
colors
[
c
];
for
(
c
=
0
;
c
<
cl
;
c
++
)
{
offset
=
c
*
3
;
color
=
colors
[
c
];
colorArray
[
offset
]
=
color
.
r
;
colorArray
[
offset
+
1
]
=
color
.
g
;
colorArray
[
offset
+
2
]
=
color
.
b
;
offset
=
c
*
3
;
}
colorArray
[
offset
]
=
color
.
r
;
colorArray
[
offset
+
1
]
=
color
.
g
;
colorArray
[
offset
+
2
]
=
color
.
b
;
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglColorBuffer
,
colorArray
);
}
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglColorBuffer
,
colorArray
);
if
(
dirtyLineDistances
)
{
}
for
(
d
=
0
;
d
<
dl
;
d
++
)
{
if
(
dirtyLineDistances
)
{
lineDistanceArray
[
d
]
=
lineDistances
[
d
];
for
(
d
=
0
;
d
<
dl
;
d
++
)
{
}
lineDistanceArray
[
d
]
=
lineDistances
[
d
]
;
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglLineDistanceBuffer
,
lineDistanceArray
)
;
}
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglLineDistanceBuffer
,
lineDistanceArray
);
}
if
(
customAttributes
)
{
if
(
customAttributes
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
customAttribute
=
customAttributes
[
i
];
customAttribute
=
customAttributes
[
i
];
if
(
customAttribute
.
needsUpdate
&&
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
)
{
if
(
customAttribute
.
needsUpdate
&&
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
)
{
offset
=
0
;
offset
=
0
;
cal
=
customAttribute
.
value
.
length
;
cal
=
customAttribute
.
value
.
length
;
if
(
customAttribute
.
size
===
1
)
{
if
(
customAttribute
.
size
===
1
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
customAttribute
.
array
[
ca
]
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
ca
]
=
customAttribute
.
value
[
ca
];
}
}
}
else
if
(
customAttribute
.
size
===
2
)
{
}
else
if
(
customAttribute
.
size
===
2
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
offset
+=
2
;
offset
+=
2
;
}
}
}
else
if
(
customAttribute
.
size
===
3
)
{
}
else
if
(
customAttribute
.
size
===
3
)
{
if
(
customAttribute
.
type
===
"
c
"
)
{
if
(
customAttribute
.
type
===
"
c
"
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
r
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
g
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
b
;
customAttribute
.
array
[
offset
]
=
value
.
r
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
g
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
b
;
offset
+=
3
;
offset
+=
3
;
}
}
}
else
{
}
else
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
offset
+=
3
;
offset
+=
3
;
}
}
}
}
else
if
(
customAttribute
.
size
===
4
)
{
}
else
if
(
customAttribute
.
size
===
4
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
+
3
]
=
value
.
w
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
+
3
]
=
value
.
w
;
offset
+=
4
;
offset
+=
4
;
}
}
}
renderer
.
setDynamicArrayBuffer
(
customAttribute
.
buffer
,
customAttribute
.
array
);
renderer
.
setDynamicArrayBuffer
(
customAttribute
.
buffer
,
customAttribute
.
array
);
}
}
}
}
};
}
);
src/renderers/webgl/objects/MeshRenderer.js
浏览文件 @
da7e7255
此差异已折叠。
点击以展开。
src/renderers/webgl/objects/Object3DRenderer.js
浏览文件 @
da7e7255
THREE
.
WebGLRenderer
.
Object3DRenderer
=
function
(
lowlevelrenderer
,
info
)
{
THREE
.
WebGLRenderer
.
Object3DRenderer
=
function
(
lowlevelrenderer
,
info
){
this
.
renderer
=
lowlevelrenderer
;
this
.
info
=
info
;
};
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
.
getBufferMaterial
=
function
(
object
,
geometryGroup
)
{
THREE
.
extend
(
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
,
{
return
object
.
material
instanceof
THREE
.
MeshFaceMaterial
?
object
.
material
.
materials
[
geometryGroup
.
materialIndex
]
:
object
.
material
;
getBufferMaterial
:
function
(
object
,
geometryGroup
)
{
};
return
object
.
material
instanceof
THREE
.
MeshFaceMaterial
?
object
.
material
.
materials
[
geometryGroup
.
materialIndex
]
:
object
.
material
;
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
.
bufferGuessUVType
=
function
(
material
)
{
},
// material must use some texture to require uvs
bufferGuessUVType
:
function
(
material
)
{
if
(
material
.
map
||
material
.
lightMap
||
material
.
bumpMap
||
material
.
normalMap
||
material
.
specularMap
||
material
instanceof
THREE
.
ShaderMaterial
)
{
// material must use some texture to require uvs
return
true
;
if
(
material
.
map
||
material
.
lightMap
||
material
.
bumpMap
||
material
.
normalMap
||
material
.
specularMap
||
material
instanceof
THREE
.
ShaderMaterial
)
{
}
return
true
;
return
false
;
}
}
;
return
false
;
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
.
bufferGuessNormalType
=
function
(
material
)
{
},
// only MeshBasicMaterial and MeshDepthMaterial don't need normals
bufferGuessNormalType
:
function
(
material
)
{
if
(
(
material
instanceof
THREE
.
MeshBasicMaterial
&&
!
material
.
envMap
)
||
material
instanceof
THREE
.
MeshDepthMaterial
)
{
// only MeshBasicMaterial and MeshDepthMaterial don't need normals
return
false
;
if
(
(
material
instanceof
THREE
.
MeshBasicMaterial
&&
!
material
.
envMap
)
||
material
instanceof
THREE
.
MeshDepthMaterial
)
{
}
return
false
;
if
(
this
.
materialNeedsSmoothNormals
(
material
)
)
{
}
return
THREE
.
SmoothShading
;
if
(
this
.
materialNeedsSmoothNormals
(
material
)
)
{
}
else
{
return
THREE
.
SmoothShading
;
return
THREE
.
FlatShading
;
}
else
{
}
return
THREE
.
FlatShading
;
};
}
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
.
materialNeedsSmoothNormals
=
function
(
material
)
{
},
return
material
&&
material
.
shading
!==
undefined
&&
material
.
shading
===
THREE
.
SmoothShading
;
materialNeedsSmoothNormals
:
function
(
material
)
{
}
;
return
material
&&
material
.
shading
!==
undefined
&&
material
.
shading
===
THREE
.
SmoothShading
;
},
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
.
bufferGuessVertexColorType
=
function
(
material
)
{
bufferGuessVertexColorType
:
function
(
material
)
{
if
(
material
.
vertexColors
)
{
if
(
material
.
vertexColors
)
{
return
material
.
vertexColors
;
return
material
.
vertexColors
;
}
}
return
false
;
return
false
;
};
},
initCustomAttributes
:
function
(
geometry
,
object
)
{
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
.
initCustomAttributes
=
function
(
geometry
,
object
)
{
var
nvertices
=
geometry
.
vertices
.
length
;
var
nvertices
=
geometry
.
vertices
.
length
;
var
material
=
object
.
material
;
var
material
=
object
.
material
;
if
(
material
.
attributes
)
{
if
(
material
.
attributes
)
{
if
(
geometry
.
__webglCustomAttributesList
===
undefined
)
{
if
(
geometry
.
__webglCustomAttributesList
===
undefined
)
{
geometry
.
__webglCustomAttributesList
=
[];
geometry
.
__webglCustomAttributesList
=
[];
}
}
for
(
var
a
in
material
.
attributes
)
{
for
(
var
a
in
material
.
attributes
)
{
var
attribute
=
material
.
attributes
[
a
];
var
attribute
=
material
.
attributes
[
a
];
if
(
!
attribute
.
__webglInitialized
||
attribute
.
createUniqueBuffers
)
{
if
(
!
attribute
.
__webglInitialized
||
attribute
.
createUniqueBuffers
)
{
attribute
.
__webglInitialized
=
true
;
attribute
.
__webglInitialized
=
true
;
var
size
=
1
;
// "f" and "i"
var
size
=
1
;
// "f" and "i"
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
;
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
.
size
=
size
;
attribute
.
array
=
new
Float32Array
(
nvertices
*
size
)
;
attribute
.
array
=
new
Float32Array
(
nvertices
*
size
);
attribute
.
buffer
=
this
.
renderer
.
createBuffer
();
attribute
.
buffer
.
belongsToAttribute
=
a
;
attribute
.
buffer
=
this
.
renderer
.
createBuffer
();
attribute
.
buffer
.
belongsToAttribute
=
a
;
attribute
.
needsUpdate
=
true
;
attribute
.
needsUpdate
=
true
;
}
}
geometry
.
__webglCustomAttributesList
.
push
(
attribute
);
geometry
.
__webglCustomAttributesList
.
push
(
attribute
);
}
}
}
}
,
};
numericalSort
:
function
(
a
,
b
)
{
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
.
numericalSort
=
function
(
a
,
b
)
{
return
b
[
0
]
-
a
[
0
];
return
b
[
0
]
-
a
[
0
];
}
};
}
)
;
src/renderers/webgl/objects/ParticleRenderer.js
浏览文件 @
da7e7255
THREE
.
WebGLRenderer
.
ParticleRenderer
=
function
(
lowlevelrenderer
,
info
)
{
THREE
.
WebGLRenderer
.
ParticleRenderer
=
function
(
lowlevelrenderer
,
info
){
THREE
.
WebGLRenderer
.
Object3DRenderer
.
call
(
this
,
lowlevelrenderer
,
info
);
};
THREE
.
WebGLRenderer
.
ParticleRenderer
.
prototype
=
Object
.
create
(
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
);
THREE
.
WebGLRenderer
.
ParticleRenderer
.
prototype
.
createBuffers
=
function
(
geometry
)
{
THREE
.
extend
(
THREE
.
WebGLRenderer
.
ParticleRenderer
.
prototype
,
{
var
renderer
=
this
.
renderer
;
geometry
.
__webglVertexBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglColorBuffer
=
renderer
.
createBuffer
();
createBuffers
:
function
(
geometry
)
{
this
.
info
.
memory
.
geometries
++
;
};
var
renderer
=
this
.
renderer
;
geometry
.
__webglVertexBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglColorBuffer
=
renderer
.
createBuffer
();
THREE
.
WebGLRenderer
.
ParticleRenderer
.
prototype
.
initBuffers
=
function
(
geometry
,
object
)
{
this
.
info
.
memory
.
geometries
++
;
},
var
nvertices
=
geometry
.
vertices
.
length
;
initBuffers
:
function
(
geometry
,
object
)
{
geometry
.
__vertexArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__colorArray
=
new
Float32Array
(
nvertices
*
3
);
var
nvertices
=
geometry
.
vertices
.
length
;
geometry
.
__sortArray
=
[];
geometry
.
__vertexArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__colorArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__webglParticleCount
=
nvertices
;
geometry
.
__sortArray
=
[]
;
this
.
initCustomAttributes
(
geometry
,
object
)
;
geometry
.
__webglParticleCount
=
nvertices
;
}
;
this
.
initCustomAttributes
(
geometry
,
object
)
;
},
THREE
.
WebGLRenderer
.
ParticleRenderer
.
prototype
.
setBuffers
=
function
(
geometry
,
object
,
projectionScreenMatrix
)
{
setBuffers
:
function
(
geometry
,
object
,
projectionScreenMatrix
)
{
var
renderer
=
this
.
renderer
;
var
v
,
c
,
vertex
,
offset
,
index
,
color
,
var
renderer
=
this
.
renderer
;
var
v
,
c
,
vertex
,
offset
,
index
,
color
,
vertices
=
geometry
.
vertices
,
vl
=
vertices
.
length
,
vertices
=
geometry
.
vertices
,
vl
=
vertices
.
length
,
colors
=
geometry
.
colors
,
cl
=
colors
.
length
,
colors
=
geometry
.
colors
,
cl
=
colors
.
length
,
vertexArray
=
geometry
.
__vertexArray
,
colorArray
=
geometry
.
__colorArray
,
vertexArray
=
geometry
.
__vertexArray
,
colorArray
=
geometry
.
__colorArray
,
sortArray
=
geometry
.
__sortArray
,
sortArray
=
geometry
.
__sortArray
,
dirtyVertices
=
geometry
.
verticesNeedUpdate
,
dirtyElements
=
geometry
.
elementsNeedUpdate
,
dirtyColors
=
geometry
.
colorsNeedUpdate
,
dirtyVertices
=
geometry
.
verticesNeedUpdate
,
dirtyElements
=
geometry
.
elementsNeedUpdate
,
dirtyColors
=
geometry
.
colorsNeedUpdate
,
customAttributes
=
geometry
.
__webglCustomAttributesList
,
i
,
il
,
a
,
ca
,
cal
,
value
,
customAttribute
;
customAttributes
=
geometry
.
__webglCustomAttributesList
,
i
,
il
,
a
,
ca
,
cal
,
value
,
customAttribute
;
var
_projScreenMatrixPS
=
THREE
.
WebGLRenderer
.
ParticleRenderer
.
_m1
,
_vector3
=
THREE
.
WebGLRenderer
.
ParticleRenderer
.
_v1
;
var
_projScreenMatrixPS
=
THREE
.
WebGLRenderer
.
ParticleRenderer
.
_m1
,
_vector3
=
THREE
.
WebGLRenderer
.
ParticleRenderer
.
_v1
;
if
(
object
.
sortParticles
)
{
if
(
object
.
sortParticles
)
{
_projScreenMatrixPS
.
multiplyMatrices
(
projectionScreenMatrix
,
object
.
matrixWorld
);
_projScreenMatrixPS
.
multiplyMatrices
(
projectionScreenMatrix
,
object
.
matrixWorld
);
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
vertex
=
vertices
[
v
];
vertex
=
vertices
[
v
];
_vector3
.
copy
(
vertex
);
_vector3
.
applyProjection
(
_projScreenMatrixPS
);
_vector3
.
copy
(
vertex
);
_vector3
.
applyProjection
(
_projScreenMatrixPS
);
sortArray
[
v
]
=
[
_vector3
.
z
,
v
];
sortArray
[
v
]
=
[
_vector3
.
z
,
v
];
}
}
sortArray
.
sort
(
this
.
numericalSort
);
sortArray
.
sort
(
this
.
numericalSort
);
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
vertex
=
vertices
[
sortArray
[
v
][
1
]
];
vertex
=
vertices
[
sortArray
[
v
][
1
]
];
offset
=
v
*
3
;
offset
=
v
*
3
;
vertexArray
[
offset
]
=
vertex
.
x
;
vertexArray
[
offset
+
1
]
=
vertex
.
y
;
vertexArray
[
offset
+
2
]
=
vertex
.
z
;
vertexArray
[
offset
]
=
vertex
.
x
;
vertexArray
[
offset
+
1
]
=
vertex
.
y
;
vertexArray
[
offset
+
2
]
=
vertex
.
z
;
}
}
for
(
c
=
0
;
c
<
cl
;
c
++
)
{
for
(
c
=
0
;
c
<
cl
;
c
++
)
{
offset
=
c
*
3
;
offset
=
c
*
3
;
color
=
colors
[
sortArray
[
c
][
1
]
];
color
=
colors
[
sortArray
[
c
][
1
]
];
colorArray
[
offset
]
=
color
.
r
;
colorArray
[
offset
+
1
]
=
color
.
g
;
colorArray
[
offset
+
2
]
=
color
.
b
;
colorArray
[
offset
]
=
color
.
r
;
colorArray
[
offset
+
1
]
=
color
.
g
;
colorArray
[
offset
+
2
]
=
color
.
b
;
}
}
if
(
customAttributes
)
{
if
(
customAttributes
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
customAttribute
=
customAttributes
[
i
];
customAttribute
=
customAttributes
[
i
];
if
(
!
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
)
continue
;
if
(
!
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
)
continue
;
offset
=
0
;
offset
=
0
;
cal
=
customAttribute
.
value
.
length
;
cal
=
customAttribute
.
value
.
length
;
if
(
customAttribute
.
size
===
1
)
{
if
(
customAttribute
.
size
===
1
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
index
=
sortArray
[
ca
][
1
];
customAttribute
.
array
[
ca
]
=
customAttribute
.
value
[
index
];
customAttribute
.
array
[
ca
]
=
customAttribute
.
value
[
index
];
}
}
}
else
if
(
customAttribute
.
size
===
2
)
{
}
else
if
(
customAttribute
.
size
===
2
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
index
=
sortArray
[
ca
][
1
];
value
=
customAttribute
.
value
[
index
];
value
=
customAttribute
.
value
[
index
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
offset
+=
2
;
offset
+=
2
;
}
}
}
else
if
(
customAttribute
.
size
===
3
)
{
}
else
if
(
customAttribute
.
size
===
3
)
{
if
(
customAttribute
.
type
===
"
c
"
)
{
if
(
customAttribute
.
type
===
"
c
"
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
index
=
sortArray
[
ca
][
1
];
value
=
customAttribute
.
value
[
index
];
value
=
customAttribute
.
value
[
index
];
customAttribute
.
array
[
offset
]
=
value
.
r
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
g
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
b
;
customAttribute
.
array
[
offset
]
=
value
.
r
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
g
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
b
;
offset
+=
3
;
offset
+=
3
;
}
}
}
else
{
}
else
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
index
=
sortArray
[
ca
][
1
];
value
=
customAttribute
.
value
[
index
];
value
=
customAttribute
.
value
[
index
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
offset
+=
3
;
offset
+=
3
;
}
}
}
}
else
if
(
customAttribute
.
size
===
4
)
{
}
else
if
(
customAttribute
.
size
===
4
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
index
=
sortArray
[
ca
][
1
];
value
=
customAttribute
.
value
[
index
];
value
=
customAttribute
.
value
[
index
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
+
3
]
=
value
.
w
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
+
3
]
=
value
.
w
;
offset
+=
4
;
offset
+=
4
;
}
}
...
...
@@ -194,121 +198,121 @@ THREE.WebGLRenderer.ParticleRenderer.prototype.setBuffers = function( geometry,
}
}
}
else
{
}
else
{
if
(
dirtyVertices
)
{
if
(
dirtyVertices
)
{
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
vertex
=
vertices
[
v
];
vertex
=
vertices
[
v
]
;
offset
=
v
*
3
;
offset
=
v
*
3
;
vertexArray
[
offset
]
=
vertex
.
x
;
vertexArray
[
offset
+
1
]
=
vertex
.
y
;
vertexArray
[
offset
+
2
]
=
vertex
.
z
;
vertexArray
[
offset
]
=
vertex
.
x
;
vertexArray
[
offset
+
1
]
=
vertex
.
y
;
vertexArray
[
offset
+
2
]
=
vertex
.
z
;
}
}
}
if
(
dirtyColors
)
{
if
(
dirtyColors
)
{
for
(
c
=
0
;
c
<
cl
;
c
++
)
{
for
(
c
=
0
;
c
<
cl
;
c
++
)
{
color
=
colors
[
c
];
color
=
colors
[
c
]
;
offset
=
c
*
3
;
offset
=
c
*
3
;
colorArray
[
offset
]
=
color
.
r
;
colorArray
[
offset
+
1
]
=
color
.
g
;
colorArray
[
offset
+
2
]
=
color
.
b
;
colorArray
[
offset
]
=
color
.
r
;
colorArray
[
offset
+
1
]
=
color
.
g
;
colorArray
[
offset
+
2
]
=
color
.
b
;
}
}
}
if
(
customAttributes
)
{
if
(
customAttributes
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
customAttribute
=
customAttributes
[
i
];
customAttribute
=
customAttributes
[
i
];
if
(
customAttribute
.
needsUpdate
&&
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
)
{
if
(
customAttribute
.
needsUpdate
&&
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
)
{
cal
=
customAttribute
.
value
.
length
;
cal
=
customAttribute
.
value
.
length
;
offset
=
0
;
offset
=
0
;
if
(
customAttribute
.
size
===
1
)
{
if
(
customAttribute
.
size
===
1
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
customAttribute
.
array
[
ca
]
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
ca
]
=
customAttribute
.
value
[
ca
];
}
}
}
else
if
(
customAttribute
.
size
===
2
)
{
}
else
if
(
customAttribute
.
size
===
2
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
offset
+=
2
;
offset
+=
2
;
}
}
}
else
if
(
customAttribute
.
size
===
3
)
{
}
else
if
(
customAttribute
.
size
===
3
)
{
if
(
customAttribute
.
type
===
"
c
"
)
{
if
(
customAttribute
.
type
===
"
c
"
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
r
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
g
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
b
;
customAttribute
.
array
[
offset
]
=
value
.
r
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
g
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
b
;
offset
+=
3
;
offset
+=
3
;
}
}
}
else
{
}
else
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
offset
+=
3
;
offset
+=
3
;
}
}
}
}
else
if
(
customAttribute
.
size
===
4
)
{
}
else
if
(
customAttribute
.
size
===
4
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
+
3
]
=
value
.
w
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
+
3
]
=
value
.
w
;
offset
+=
4
;
offset
+=
4
;
}
}
...
...
@@ -320,29 +324,29 @@ THREE.WebGLRenderer.ParticleRenderer.prototype.setBuffers = function( geometry,
}
}
if
(
dirtyVertices
||
object
.
sortParticles
)
{
if
(
dirtyVertices
||
object
.
sortParticles
)
{
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglVertexBuffer
,
vertexArray
);
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglVertexBuffer
,
vertexArray
);
}
}
if
(
dirtyColors
||
object
.
sortParticles
)
{
if
(
dirtyColors
||
object
.
sortParticles
)
{
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglColorBuffer
,
colorArray
);
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglColorBuffer
,
colorArray
);
}
}
if
(
customAttributes
)
{
if
(
customAttributes
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
customAttribute
=
customAttributes
[
i
];
customAttribute
=
customAttributes
[
i
];
if
(
customAttribute
.
needsUpdate
||
object
.
sortParticles
)
{
if
(
customAttribute
.
needsUpdate
||
object
.
sortParticles
)
{
renderer
.
setDynamicArrayBuffer
(
customAttribute
.
buffer
,
customAttribute
.
array
);
renderer
.
setDynamicArrayBuffer
(
customAttribute
.
buffer
,
customAttribute
.
array
);
}
}
...
...
@@ -350,8 +354,7 @@ THREE.WebGLRenderer.ParticleRenderer.prototype.setBuffers = function( geometry,
}
};
}
);
THREE
.
WebGLRenderer
.
ParticleRenderer
.
_m1
=
new
THREE
.
Matrix4
();
THREE
.
WebGLRenderer
.
ParticleRenderer
.
_v1
=
new
THREE
.
Vector3
();
src/renderers/webgl/objects/RibbonRenderer.js
浏览文件 @
da7e7255
THREE
.
WebGLRenderer
.
RibbonRenderer
=
function
(
lowlevelrenderer
,
info
)
{
THREE
.
WebGLRenderer
.
RibbonRenderer
=
function
(
lowlevelrenderer
,
info
){
THREE
.
WebGLRenderer
.
Object3DRenderer
.
call
(
this
,
lowlevelrenderer
,
info
);
};
THREE
.
WebGLRenderer
.
RibbonRenderer
.
prototype
=
Object
.
create
(
THREE
.
WebGLRenderer
.
Object3DRenderer
.
prototype
);
THREE
.
WebGLRenderer
.
RibbonRenderer
.
prototype
.
createBuffers
=
function
(
geometry
)
{
THREE
.
extend
(
THREE
.
WebGLRenderer
.
RibbonRenderer
.
prototype
,
{
var
renderer
=
this
.
renderer
;
geometry
.
__webglVertexBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglColorBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglNormalBuffer
=
renderer
.
createBuffer
();
createBuffers
:
function
(
geometry
)
{
this
.
info
.
memory
.
geometries
++
;
};
var
renderer
=
this
.
renderer
;
geometry
.
__webglVertexBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglColorBuffer
=
renderer
.
createBuffer
();
geometry
.
__webglNormalBuffer
=
renderer
.
createBuffer
();
THREE
.
WebGLRenderer
.
RibbonRenderer
.
prototype
.
initBuffers
=
function
(
geometry
,
object
)
{
this
.
info
.
memory
.
geometries
++
;
},
var
nvertices
=
geometry
.
vertices
.
length
;
initBuffers
:
function
(
geometry
,
object
)
{
geometry
.
__vertexArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__colorArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__normalArray
=
new
Float32Array
(
nvertices
*
3
);
var
nvertices
=
geometry
.
vertices
.
length
;
geometry
.
__webglVertexCount
=
nvertices
;
geometry
.
__vertexArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__colorArray
=
new
Float32Array
(
nvertices
*
3
);
geometry
.
__normalArray
=
new
Float32Array
(
nvertices
*
3
);
this
.
initCustomAttributes
(
geometry
,
object
)
;
geometry
.
__webglVertexCount
=
nvertices
;
}
;
this
.
initCustomAttributes
(
geometry
,
object
)
;
},
THREE
.
WebGLRenderer
.
RibbonRenderer
.
prototype
.
setBuffers
=
function
(
geometry
,
object
,
projectionScreenMatrix
)
{
setBuffers
:
function
(
geometry
,
object
,
projectionScreenMatrix
)
{
var
renderer
=
this
.
renderer
;
var
v
,
c
,
n
,
vertex
,
offset
,
color
,
normal
,
var
renderer
=
this
.
renderer
;
var
v
,
c
,
n
,
vertex
,
offset
,
color
,
normal
,
i
,
il
,
ca
,
cal
,
customAttribute
,
value
,
i
,
il
,
ca
,
cal
,
customAttribute
,
value
,
vertices
=
geometry
.
vertices
,
colors
=
geometry
.
colors
,
normals
=
geometry
.
normals
,
vertices
=
geometry
.
vertices
,
colors
=
geometry
.
colors
,
normals
=
geometry
.
normals
,
vl
=
vertices
.
length
,
cl
=
colors
.
length
,
nl
=
normals
.
length
,
vl
=
vertices
.
length
,
cl
=
colors
.
length
,
nl
=
normals
.
length
,
vertexArray
=
geometry
.
__vertexArray
,
colorArray
=
geometry
.
__colorArray
,
normalArray
=
geometry
.
__normalArray
,
vertexArray
=
geometry
.
__vertexArray
,
colorArray
=
geometry
.
__colorArray
,
normalArray
=
geometry
.
__normalArray
,
dirtyVertices
=
geometry
.
verticesNeedUpdate
,
dirtyColors
=
geometry
.
colorsNeedUpdate
,
dirtyNormals
=
geometry
.
normalsNeedUpdate
,
dirtyVertices
=
geometry
.
verticesNeedUpdate
,
dirtyColors
=
geometry
.
colorsNeedUpdate
,
dirtyNormals
=
geometry
.
normalsNeedUpdate
,
customAttributes
=
geometry
.
__webglCustomAttributesList
;
customAttributes
=
geometry
.
__webglCustomAttributesList
;
if
(
dirtyVertices
)
{
if
(
dirtyVertices
)
{
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
vertex
=
vertices
[
v
];
vertex
=
vertices
[
v
];
offset
=
v
*
3
;
offset
=
v
*
3
;
vertexArray
[
offset
]
=
vertex
.
x
;
vertexArray
[
offset
+
1
]
=
vertex
.
y
;
vertexArray
[
offset
+
2
]
=
vertex
.
z
;
vertexArray
[
offset
]
=
vertex
.
x
;
vertexArray
[
offset
+
1
]
=
vertex
.
y
;
vertexArray
[
offset
+
2
]
=
vertex
.
z
;
}
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglVertexBuffer
,
vertexArray
);
}
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglVertexBuffer
,
vertexArray
);
if
(
dirtyColors
)
{
}
for
(
c
=
0
;
c
<
cl
;
c
++
)
{
if
(
dirtyColors
)
{
color
=
colors
[
c
];
for
(
c
=
0
;
c
<
cl
;
c
++
)
{
offset
=
c
*
3
;
color
=
colors
[
c
];
colorArray
[
offset
]
=
color
.
r
;
colorArray
[
offset
+
1
]
=
color
.
g
;
colorArray
[
offset
+
2
]
=
color
.
b
;
offset
=
c
*
3
;
}
colorArray
[
offset
]
=
color
.
r
;
colorArray
[
offset
+
1
]
=
color
.
g
;
colorArray
[
offset
+
2
]
=
color
.
b
;
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglColorBuffer
,
colorArray
);
}
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglColorBuffer
,
colorArray
);
if
(
dirtyNormals
)
{
}
for
(
n
=
0
;
n
<
nl
;
n
++
)
{
if
(
dirtyNormals
)
{
normal
=
normals
[
n
];
for
(
n
=
0
;
n
<
nl
;
n
++
)
{
offset
=
n
*
3
;
normal
=
normals
[
n
];
normalArray
[
offset
]
=
normal
.
x
;
normalArray
[
offset
+
1
]
=
normal
.
y
;
normalArray
[
offset
+
2
]
=
normal
.
z
;
offset
=
n
*
3
;
}
normalArray
[
offset
]
=
normal
.
x
;
normalArray
[
offset
+
1
]
=
normal
.
y
;
normalArray
[
offset
+
2
]
=
normal
.
z
;
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglNormalBuffer
,
normalArray
);
}
renderer
.
setDynamicArrayBuffer
(
geometry
.
__webglNormalBuffer
,
normalArray
);
if
(
customAttributes
)
{
}
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
if
(
customAttributes
)
{
customAttribute
=
customAttributes
[
i
];
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
if
(
customAttribute
.
needsUpdate
&&
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
)
{
customAttribute
=
customAttributes
[
i
]
;
offset
=
0
;
if
(
customAttribute
.
needsUpdate
&&
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
)
{
cal
=
customAttribute
.
value
.
length
;
offset
=
0
;
if
(
customAttribute
.
size
===
1
)
{
cal
=
customAttribute
.
value
.
length
;
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
if
(
customAttribute
.
size
===
1
)
{
customAttribute
.
array
[
ca
]
=
customAttribute
.
value
[
ca
];
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
}
customAttribute
.
array
[
ca
]
=
customAttribute
.
value
[
ca
];
}
else
if
(
customAttribute
.
size
===
2
)
{
}
}
else
if
(
customAttribute
.
size
===
2
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
offset
+=
2
;
offset
+=
2
;
}
}
}
else
if
(
customAttribute
.
size
===
3
)
{
}
else
if
(
customAttribute
.
size
===
3
)
{
if
(
customAttribute
.
type
===
"
c
"
)
{
if
(
customAttribute
.
type
===
"
c
"
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
r
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
g
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
b
;
customAttribute
.
array
[
offset
]
=
value
.
r
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
g
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
b
;
offset
+=
3
;
offset
+=
3
;
}
}
}
else
{
}
else
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
offset
+=
3
;
offset
+=
3
;
}
}
}
}
else
if
(
customAttribute
.
size
===
4
)
{
}
else
if
(
customAttribute
.
size
===
4
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
value
=
customAttribute
.
value
[
ca
];
value
=
customAttribute
.
value
[
ca
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
+
3
]
=
value
.
w
;
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
customAttribute
.
array
[
offset
+
3
]
=
value
.
w
;
offset
+=
4
;
offset
+=
4
;
}
}
}
renderer
.
setDynamicArrayBuffer
(
customAttribute
.
buffer
,
customAttribute
.
array
);
renderer
.
setDynamicArrayBuffer
(
customAttribute
.
buffer
,
customAttribute
.
array
);
}
}
...
...
@@ -202,4 +206,4 @@ THREE.WebGLRenderer.RibbonRenderer.prototype.setBuffers = function( geometry, ob
}
};
}
)
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录