Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ce000d48
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,体验更适合开发者的 AI 搜索 >>
提交
ce000d48
编写于
10月 21, 2010
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
差异文件
Merged remote branch 'upstream/master' (original mrdoob's version)
上级
dde831bf
db7003e8
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
200 addition
and
80 deletion
+200
-80
build/Three.js
build/Three.js
+1
-1
build/ThreeDebug.js
build/ThreeDebug.js
+1
-1
examples/camera_free.html
examples/camera_free.html
+1
-1
src/renderers/CanvasRenderer.js
src/renderers/CanvasRenderer.js
+136
-49
src/renderers/Projector.js
src/renderers/Projector.js
+1
-7
src/renderers/SVGRenderer.js
src/renderers/SVGRenderer.js
+60
-21
未找到文件。
build/Three.js
浏览文件 @
ce000d48
此差异已折叠。
点击以展开。
build/ThreeDebug.js
浏览文件 @
ce000d48
此差异已折叠。
点击以展开。
examples/camera_free.html
浏览文件 @
ce000d48
...
...
@@ -150,7 +150,6 @@
// Lights
var
ambientLight
=
new
THREE
.
AmbientLight
(
Math
.
random
()
*
0x202020
);
scene
.
addLight
(
ambientLight
);
...
...
@@ -164,6 +163,7 @@
var
pointLight
=
new
THREE
.
PointLight
(
0xff0000
,
1
);
scene
.
addLight
(
pointLight
);
renderer
=
new
THREE
.
CanvasRenderer
();
renderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
...
...
src/renderers/CanvasRenderer.js
浏览文件 @
ce000d48
...
...
@@ -14,6 +14,7 @@ THREE.CanvasRenderer = function () {
_clearRect
=
new
THREE
.
Rectangle
(),
_bboxRect
=
new
THREE
.
Rectangle
(),
_enableLighting
=
false
,
_color
=
new
THREE
.
Color
(
0xffffffff
),
_light
=
new
THREE
.
Color
(
0xffffffff
),
_ambientLight
=
new
THREE
.
Color
(
0xffffffff
),
...
...
@@ -81,7 +82,13 @@ THREE.CanvasRenderer = function () {
_context.fillRect( _clipRect.getX(), _clipRect.getY(), _clipRect.getWidth(), _clipRect.getHeight() );
*/
calculateAmbientLight
(
scene
,
_ambientLight
);
_enableLighting
=
scene
.
lights
.
length
>
0
;
if
(
_enableLighting
)
{
calculateAmbientLight
(
scene
,
_ambientLight
);
}
for
(
e
=
0
,
el
=
_renderList
.
length
;
e
<
el
;
e
++
)
{
...
...
@@ -99,11 +106,19 @@ THREE.CanvasRenderer = function () {
if
(
material
instanceof
THREE
.
ParticleCircleMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
.
copyRGBA
(
material
.
color
)
;
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
=
material
.
color
;
}
width
=
element
.
scale
.
x
*
_widthHalf
;
height
=
element
.
scale
.
y
*
_heightHalf
;
...
...
@@ -205,11 +220,19 @@ THREE.CanvasRenderer = function () {
if
(
material
instanceof
THREE
.
LineColorMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
material
.
color
;
}
_context
.
lineWidth
=
material
.
lineWidth
;
_context
.
lineJoin
=
"
round
"
;
...
...
@@ -258,12 +281,20 @@ THREE.CanvasRenderer = function () {
if
(
material
instanceof
THREE
.
MeshColorFillMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
material
.
color
;
}
_context
.
beginPath
();
_context
.
moveTo
(
v1x
,
v1y
);
...
...
@@ -277,12 +308,20 @@ THREE.CanvasRenderer = function () {
}
else
if
(
material
instanceof
THREE
.
MeshColorStrokeMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
material
.
color
;
}
_context
.
beginPath
();
_context
.
moveTo
(
v1x
,
v1y
);
...
...
@@ -302,12 +341,20 @@ THREE.CanvasRenderer = function () {
}
else
if
(
material
instanceof
THREE
.
MeshFaceColorFillMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
.
copyRGBA
(
element
.
color
)
;
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
=
element
.
color
;
}
_context
.
beginPath
();
_context
.
moveTo
(
v1x
,
v1y
);
...
...
@@ -321,12 +368,20 @@ THREE.CanvasRenderer = function () {
}
else
if
(
material
instanceof
THREE
.
MeshFaceColorStrokeMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
element
.
color
;
}
_context
.
beginPath
();
_context
.
moveTo
(
v1x
,
v1y
);
...
...
@@ -433,12 +488,20 @@ THREE.CanvasRenderer = function () {
if
(
material
instanceof
THREE
.
MeshColorFillMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
material
.
color
;
}
_context
.
beginPath
();
_context
.
moveTo
(
v1x
,
v1y
);
...
...
@@ -454,12 +517,20 @@ THREE.CanvasRenderer = function () {
}
else
if
(
material
instanceof
THREE
.
MeshColorStrokeMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
material
.
color
;
}
_context
.
beginPath
();
_context
.
moveTo
(
v1x
,
v1y
);
...
...
@@ -480,12 +551,20 @@ THREE.CanvasRenderer = function () {
}
else
if
(
material
instanceof
THREE
.
MeshFaceColorFillMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
element
.
color
;
}
_context
.
beginPath
();
_context
.
moveTo
(
v1x
,
v1y
);
...
...
@@ -500,12 +579,20 @@ THREE.CanvasRenderer = function () {
}
else
if
(
material
instanceof
THREE
.
MeshFaceColorStrokeMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
element
.
color
;
}
_context
.
beginPath
();
_context
.
moveTo
(
v1x
,
v1y
);
...
...
src/renderers/Projector.js
浏览文件 @
ce000d48
...
...
@@ -225,16 +225,10 @@ THREE.Projector = function() {
}
_renderList
.
sort
(
painterSort
);
_renderList
.
sort
(
function
(
a
,
b
)
{
return
b
.
z
-
a
.
z
;
}
);
return
_renderList
;
};
function
painterSort
(
a
,
b
)
{
return
b
.
z
-
a
.
z
;
}
};
src/renderers/SVGRenderer.js
浏览文件 @
ce000d48
...
...
@@ -11,6 +11,7 @@ THREE.SVGRenderer = function () {
_clipRect
=
new
THREE
.
Rectangle
(),
_bboxRect
=
new
THREE
.
Rectangle
(),
_enableLighting
=
false
,
_color
=
new
THREE
.
Color
(
0xffffffff
),
_light
=
new
THREE
.
Color
(
0xffffffff
),
_ambientLight
=
new
THREE
.
Color
(
0xffffffff
),
...
...
@@ -72,7 +73,13 @@ THREE.SVGRenderer = function () {
_renderList
=
_projector
.
projectScene
(
scene
,
camera
);
calculateAmbientLight
(
scene
,
_ambientLight
);
_enableLighting
=
scene
.
lights
.
length
>
0
;
if
(
_enableLighting
)
{
calculateAmbientLight
(
scene
,
_ambientLight
);
}
for
(
e
=
0
,
el
=
_renderList
.
length
;
e
<
el
;
e
++
)
{
...
...
@@ -149,45 +156,77 @@ THREE.SVGRenderer = function () {
if
(
material
instanceof
THREE
.
MeshColorFillMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
material
.
color
;
}
svgNode
.
setAttribute
(
'
style
'
,
'
fill:
'
+
_color
.
__styleString
);
}
else
if
(
material
instanceof
THREE
.
MeshFaceColorFillMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
.
copyRGBA
(
element
.
color
)
;
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
=
element
.
color
;
}
svgNode
.
setAttribute
(
'
style
'
,
'
fill:
'
+
_color
.
__styleString
);
}
else
if
(
material
instanceof
THREE
.
MeshColorStrokeMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
material
.
color
;
_color
.
copyRGBA
(
material
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
svgNode
.
setAttribute
(
'
style
'
,
'
fill: none; stroke:
'
+
_color
.
__styleString
+
'
; stroke-width:
'
+
material
.
lineWidth
+
'
; stroke-linecap: round; stroke-linejoin: round
'
);
}
else
if
(
material
instanceof
THREE
.
MeshFaceColorStrokeMaterial
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
if
(
_enableLighting
)
{
_light
.
copyRGB
(
_ambientLight
);
addLights
(
scene
,
element
,
_light
);
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
_color
.
copyRGBA
(
element
.
color
);
_color
.
multiplySelfRGB
(
_light
);
_color
.
updateStyleString
();
}
else
{
_color
=
element
.
color
;
}
svgNode
.
setAttribute
(
'
style
'
,
'
fill: none; stroke:
'
+
_color
.
__styleString
+
'
; stroke-width:
'
+
material
.
lineWidth
+
'
; stroke-linecap: round; stroke-linejoin: round
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录