Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
20c8c5e3
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,发现更多精彩内容 >>
提交
20c8c5e3
编写于
2月 22, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SVGRenderer: Reset counters on clear() instead of on render(). Cleaned up code a bit too.
上级
c5cca753
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
29 deletion
+23
-29
examples/js/renderers/SVGRenderer.js
examples/js/renderers/SVGRenderer.js
+23
-29
未找到文件。
examples/js/renderers/SVGRenderer.js
浏览文件 @
20c8c5e3
...
...
@@ -19,7 +19,6 @@ THREE.SVGRenderer = function () {
_color
=
new
THREE
.
Color
(),
_diffuseColor
=
new
THREE
.
Color
(),
_emissiveColor
=
new
THREE
.
Color
(),
_ambientLight
=
new
THREE
.
Color
(),
_directionalLights
=
new
THREE
.
Color
(),
_pointLights
=
new
THREE
.
Color
(),
...
...
@@ -80,6 +79,10 @@ THREE.SVGRenderer = function () {
this
.
clear
=
function
()
{
_pathCount
=
0
;
_circleCount
=
0
;
_lineCount
=
0
;
while
(
_svg
.
childNodes
.
length
>
0
)
{
_svg
.
removeChild
(
_svg
.
childNodes
[
0
]
);
...
...
@@ -97,9 +100,7 @@ THREE.SVGRenderer = function () {
}
var
e
,
el
,
element
,
material
;
this
.
autoClear
&&
this
.
clear
();
if
(
this
.
autoClear
===
true
)
this
.
clear
();
_this
.
info
.
render
.
vertices
=
0
;
_this
.
info
.
render
.
faces
=
0
;
...
...
@@ -108,15 +109,12 @@ THREE.SVGRenderer = function () {
_elements
=
_renderData
.
elements
;
_lights
=
_renderData
.
lights
;
_pathCount
=
0
;
_circleCount
=
0
;
_lineCount
=
0
;
calculateLights
(
_lights
);
for
(
e
=
0
,
el
=
_elements
.
length
;
e
<
el
;
e
++
)
{
element
=
_elements
[
e
];
for
(
var
e
=
0
,
el
=
_elements
.
length
;
e
<
el
;
e
++
)
{
material
=
element
.
material
;
var
element
=
_elements
[
e
];
var
material
=
element
.
material
;
if
(
material
===
undefined
||
material
.
visible
===
false
)
continue
;
...
...
@@ -127,7 +125,7 @@ THREE.SVGRenderer = function () {
_v1
=
element
;
_v1
.
x
*=
_svgWidthHalf
;
_v1
.
y
*=
-
_svgHeightHalf
;
renderParticle
(
_v1
,
element
,
material
,
scene
);
renderParticle
(
_v1
,
element
,
material
);
}
else
if
(
element
instanceof
THREE
.
RenderableLine
)
{
...
...
@@ -140,7 +138,7 @@ THREE.SVGRenderer = function () {
if
(
_clipBox
.
isIntersectionBox
(
_elemBox
)
===
true
)
{
renderLine
(
_v1
,
_v2
,
element
,
material
,
scene
);
renderLine
(
_v1
,
_v2
,
element
,
material
);
}
...
...
@@ -158,7 +156,7 @@ THREE.SVGRenderer = function () {
_elemBox
.
setFromPoints
(
[
_v1
.
positionScreen
,
_v2
.
positionScreen
,
_v3
.
positionScreen
]
);
renderFace3
(
_v1
,
_v2
,
_v3
,
element
,
material
,
scene
);
renderFace3
(
_v1
,
_v2
,
_v3
,
element
,
material
);
}
else
if
(
element
instanceof
THREE
.
RenderableFace4
)
{
...
...
@@ -176,7 +174,7 @@ THREE.SVGRenderer = function () {
_elemBox
.
setFromPoints
(
[
_v1
.
positionScreen
,
_v2
.
positionScreen
,
_v3
.
positionScreen
,
_v4
.
positionScreen
]
);
renderFace4
(
_v1
,
_v2
,
_v3
,
_v4
,
element
,
material
,
scene
);
renderFace4
(
_v1
,
_v2
,
_v3
,
_v4
,
element
,
material
);
}
...
...
@@ -186,16 +184,14 @@ THREE.SVGRenderer = function () {
function
calculateLights
(
lights
)
{
var
l
,
ll
,
light
,
lightColor
;
_ambientLight
.
setRGB
(
0
,
0
,
0
);
_directionalLights
.
setRGB
(
0
,
0
,
0
);
_pointLights
.
setRGB
(
0
,
0
,
0
);
for
(
l
=
0
,
ll
=
lights
.
length
;
l
<
ll
;
l
++
)
{
for
(
var
l
=
0
,
ll
=
lights
.
length
;
l
<
ll
;
l
++
)
{
light
=
lights
[
l
];
lightColor
=
light
.
color
;
var
light
=
lights
[
l
];
var
lightColor
=
light
.
color
;
if
(
light
instanceof
THREE
.
AmbientLight
)
{
...
...
@@ -266,7 +262,7 @@ THREE.SVGRenderer = function () {
}
function
renderParticle
(
v1
,
element
,
material
,
scene
)
{
function
renderParticle
(
v1
,
element
,
material
)
{
/*
_svgNode = getCircleNode( _circleCount++ );
...
...
@@ -295,7 +291,7 @@ THREE.SVGRenderer = function () {
}
function
renderLine
(
v1
,
v2
,
element
,
material
,
scene
)
{
function
renderLine
(
v1
,
v2
,
element
,
material
)
{
_svgNode
=
getLineNode
(
_lineCount
++
);
...
...
@@ -314,7 +310,7 @@ THREE.SVGRenderer = function () {
}
function
renderFace3
(
v1
,
v2
,
v3
,
element
,
material
,
scene
)
{
function
renderFace3
(
v1
,
v2
,
v3
,
element
,
material
)
{
_this
.
info
.
render
.
vertices
+=
3
;
_this
.
info
.
render
.
faces
++
;
...
...
@@ -332,10 +328,9 @@ THREE.SVGRenderer = function () {
}
}
else
if
(
material
instanceof
THREE
.
MeshLambertMaterial
)
{
}
else
if
(
material
instanceof
THREE
.
MeshLambertMaterial
||
material
instanceof
THREE
.
MeshPhongMaterial
)
{
_diffuseColor
.
copy
(
material
.
color
);
_emissiveColor
.
copy
(
material
.
emissive
);
if
(
material
.
vertexColors
===
THREE
.
FaceColors
)
{
...
...
@@ -347,7 +342,7 @@ THREE.SVGRenderer = function () {
calculateLight
(
_lights
,
element
.
centroidModel
,
element
.
normalModel
,
_color
);
_color
.
multiply
(
_diffuseColor
).
add
(
_emissiveColor
);
_color
.
multiply
(
_diffuseColor
).
add
(
material
.
emissive
);
}
else
if
(
material
instanceof
THREE
.
MeshDepthMaterial
)
{
...
...
@@ -376,7 +371,7 @@ THREE.SVGRenderer = function () {
}
function
renderFace4
(
v1
,
v2
,
v3
,
v4
,
element
,
material
,
scene
)
{
function
renderFace4
(
v1
,
v2
,
v3
,
v4
,
element
,
material
)
{
_this
.
info
.
render
.
vertices
+=
4
;
_this
.
info
.
render
.
faces
++
;
...
...
@@ -394,10 +389,9 @@ THREE.SVGRenderer = function () {
}
}
else
if
(
material
instanceof
THREE
.
MeshLambertMaterial
)
{
}
else
if
(
material
instanceof
THREE
.
MeshLambertMaterial
||
material
instanceof
THREE
.
MeshPhongMaterial
)
{
_diffuseColor
.
copy
(
material
.
color
);
_emissiveColor
.
copy
(
material
.
emissive
);
if
(
material
.
vertexColors
===
THREE
.
FaceColors
)
{
...
...
@@ -409,7 +403,7 @@ THREE.SVGRenderer = function () {
calculateLight
(
_lights
,
element
.
centroidModel
,
element
.
normalModel
,
_color
);
_color
.
multiply
(
_diffuseColor
).
add
(
_emissiveColor
);
_color
.
multiply
(
_diffuseColor
).
add
(
material
.
emissive
);
}
else
if
(
material
instanceof
THREE
.
MeshDepthMaterial
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录