Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
a7740f47
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,发现更多精彩内容 >>
提交
a7740f47
编写于
3月 20, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ParticleCircleMaterial ⟶ ParticleCanvasMaterial (canvas code injection)
上级
af5e208b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
77 addition
and
26 deletion
+77
-26
examples/canvas_materials_video.html
examples/canvas_materials_video.html
+16
-2
examples/canvas_particles_floor.html
examples/canvas_particles_floor.html
+15
-1
examples/canvas_particles_random.html
examples/canvas_particles_random.html
+12
-1
examples/canvas_particles_waves.html
examples/canvas_particles_waves.html
+16
-1
src/extras/io/Loader.js
src/extras/io/Loader.js
+8
-8
src/materials/ParticleCanvasMaterial.js
src/materials/ParticleCanvasMaterial.js
+4
-1
src/renderers/CanvasRenderer.js
src/renderers/CanvasRenderer.js
+3
-8
utils/build.py
utils/build.py
+3
-4
未找到文件。
examples/canvas_materials_video.html
浏览文件 @
a7740f47
...
...
@@ -99,7 +99,7 @@
textureReflection
=
new
THREE
.
Texture
(
imageReflection
);
textureReflection
.
minFilter
=
THREE
.
LinearFilter
;
textureReflection
.
magFilter
=
THREE
.
LinearFilter
;
var
materialReflection
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
textureReflection
}
);
//
...
...
@@ -125,7 +125,21 @@
var
amountx
=
10
;
var
amounty
=
10
;
var
material
=
new
THREE
.
ParticleCircleMaterial
(
{
color
:
0x808080
}
);
var
PI2
=
Math
.
PI
*
2
;
var
material
=
new
THREE
.
ParticleCanvasMaterial
(
{
color
:
0x0808080
,
program
:
function
(
context
,
color
)
{
context
.
fillStyle
=
color
.
__styleString
;
context
.
beginPath
();
context
.
arc
(
0
,
0
,
1
,
0
,
PI2
,
true
);
context
.
closePath
();
context
.
fill
();
}
}
);
for
(
var
ix
=
0
;
ix
<
amountx
;
ix
++
)
{
...
...
examples/canvas_particles_floor.html
浏览文件 @
a7740f47
...
...
@@ -49,7 +49,21 @@
scene
=
new
THREE
.
Scene
();
var
material
=
new
THREE
.
ParticleCircleMaterial
(
{
color
:
0xffffff
,
opacity
:
1
}
);
var
PI2
=
Math
.
PI
*
2
;
var
material
=
new
THREE
.
ParticleCanvasMaterial
(
{
color
:
0xffffff
,
program
:
function
(
context
,
color
)
{
context
.
fillStyle
=
color
.
__styleString
;
context
.
beginPath
();
context
.
arc
(
0
,
0
,
1
,
0
,
PI2
,
true
);
context
.
closePath
();
context
.
fill
();
}
}
);
for
(
var
ix
=
0
;
ix
<
AMOUNTX
;
ix
++
)
{
...
...
examples/canvas_particles_random.html
浏览文件 @
a7740f47
...
...
@@ -45,9 +45,20 @@
scene
=
new
THREE
.
Scene
();
var
PI2
=
Math
.
PI
*
2
;
var
program
=
function
(
context
,
color
)
{
context
.
fillStyle
=
color
.
__styleString
;
context
.
beginPath
();
context
.
arc
(
0
,
0
,
1
,
0
,
PI2
,
true
);
context
.
closePath
();
context
.
fill
();
}
for
(
var
i
=
0
;
i
<
1000
;
i
++
)
{
particle
=
new
THREE
.
Particle
(
new
THREE
.
ParticleC
ircleMaterial
(
{
color
:
Math
.
random
()
*
0x808008
+
0x808080
,
opacity
:
1
}
)
);
particle
=
new
THREE
.
Particle
(
new
THREE
.
ParticleC
anvasMaterial
(
{
color
:
Math
.
random
()
*
0x808008
+
0x808080
,
program
:
program
}
)
);
particle
.
position
.
x
=
Math
.
random
()
*
2000
-
1000
;
particle
.
position
.
y
=
Math
.
random
()
*
2000
-
1000
;
particle
.
position
.
z
=
Math
.
random
()
*
2000
-
1000
;
...
...
examples/canvas_particles_waves.html
浏览文件 @
a7740f47
...
...
@@ -51,8 +51,23 @@
particles
=
new
Array
();
var
PI2
=
Math
.
PI
*
2
;
var
material
=
new
THREE
.
ParticleCanvasMaterial
(
{
color
:
0xffffff
,
program
:
function
(
context
,
color
)
{
context
.
strokeStyle
=
color
.
__styleString
;
context
.
beginPath
();
context
.
arc
(
0
,
0
,
1
,
0
,
PI2
,
true
);
context
.
closePath
();
context
.
stroke
();
}
}
);
var
i
=
0
;
var
material
=
new
THREE
.
ParticleCircleMaterial
(
{
color
:
0xffffff
,
opacity
:
1
}
);
for
(
var
ix
=
0
;
ix
<
AMOUNTX
;
ix
++
)
{
...
...
src/extras/io/Loader.js
浏览文件 @
a7740f47
...
...
@@ -2,9 +2,9 @@
* @author alteredq / http://alteredqualia.com/
*/
THREE
.
Loader
=
function
()
{
THREE
.
Loader
=
function
(
showStatus
)
{
this
.
showStatus
=
showStatus
;
this
.
showStatus
=
showStatus
;
this
.
statusDomElement
=
showStatus
?
this
.
addStatusElement
()
:
null
;
};
...
...
@@ -12,9 +12,9 @@ THREE.Loader = function () {
THREE
.
Loader
.
prototype
=
{
addStatusElement
:
function
(
)
{
var
e
=
document
.
createElement
(
"
div
"
);
e
.
style
.
fontSize
=
"
0.8em
"
;
e
.
style
.
textAlign
=
"
left
"
;
e
.
style
.
background
=
"
#b00
"
;
...
...
@@ -25,13 +25,13 @@ THREE.Loader.prototype = {
e
.
style
.
right
=
"
0px
"
;
e
.
style
.
top
=
"
0px
"
;
e
.
style
.
zIndex
=
1000
;
e
.
innerHTML
=
"
Loading ...
"
;
return
e
;
},
updateProgress
:
function
(
progress
)
{
var
message
=
"
Loaded
"
;
...
...
src/materials/ParticleC
ircle
Material.js
→
src/materials/ParticleC
anvas
Material.js
浏览文件 @
a7740f47
...
...
@@ -3,22 +3,25 @@
*
* parameters = {
* color: <hex>,
* program: <function>,
* opacity: <float>,
* blending: THREE.NormalBlending
* }
*/
THREE
.
ParticleC
ircle
Material
=
function
(
parameters
)
{
THREE
.
ParticleC
anvas
Material
=
function
(
parameters
)
{
this
.
id
=
THREE
.
MaterialCounter
.
value
++
;
this
.
color
=
new
THREE
.
Color
(
0xffffff
);
this
.
program
=
function
(
context
,
color
)
{};
this
.
opacity
=
1
;
this
.
blending
=
THREE
.
NormalBlending
;
if
(
parameters
)
{
if
(
parameters
.
color
!==
undefined
)
this
.
color
.
setHex
(
parameters
.
color
);
if
(
parameters
.
program
!==
undefined
)
this
.
program
=
parameters
.
program
;
if
(
parameters
.
opacity
!==
undefined
)
this
.
opacity
=
parameters
.
opacity
;
if
(
parameters
.
blending
!==
undefined
)
this
.
blending
=
parameters
.
blending
;
...
...
src/renderers/CanvasRenderer.js
浏览文件 @
a7740f47
...
...
@@ -391,8 +391,8 @@ THREE.CanvasRenderer = function () {
_context
.
translate
(
v1
.
x
,
v1
.
y
);
_context
.
rotate
(
-
element
.
rotation
);
_context
.
scale
(
scaleX
,
-
scaleY
);
_context
.
translate
(
-
bitmapWidth
,
-
bitmapHeight
);
_context
.
translate
(
-
bitmapWidth
,
-
bitmapHeight
);
_context
.
drawImage
(
bitmap
,
0
,
0
);
_context
.
restore
();
...
...
@@ -410,7 +410,7 @@ THREE.CanvasRenderer = function () {
_context.stroke();
*/
}
else
if
(
material
instanceof
THREE
.
ParticleC
ircle
Material
)
{
}
else
if
(
material
instanceof
THREE
.
ParticleC
anvas
Material
)
{
if
(
_enableLighting
)
{
...
...
@@ -441,18 +441,13 @@ THREE.CanvasRenderer = function () {
}
setFillStyle
(
_color
.
__styleString
);
_context
.
save
();
_context
.
translate
(
v1
.
x
,
v1
.
y
);
_context
.
rotate
(
-
element
.
rotation
);
_context
.
scale
(
width
,
height
);
_context
.
beginPath
();
_context
.
arc
(
0
,
0
,
1
,
0
,
_pi2
,
true
);
_context
.
closePath
();
material
.
program
(
_context
,
_color
);
_context
.
fill
();
_context
.
restore
();
}
...
...
utils/build.py
浏览文件 @
a7740f47
...
...
@@ -47,7 +47,7 @@ COMMON_FILES = [
'materials/MeshFaceMaterial.js'
,
'materials/MeshShaderMaterial.js'
,
'materials/ParticleBasicMaterial.js'
,
'materials/ParticleC
ircle
Material.js'
,
'materials/ParticleC
anvas
Material.js'
,
'materials/ParticleDOMMaterial.js'
,
'materials/Texture.js'
,
'materials/RenderTarget.js'
,
...
...
@@ -132,7 +132,7 @@ CANVAS_FILES = [
'materials/MeshNormalMaterial.js'
,
'materials/MeshFaceMaterial.js'
,
'materials/ParticleBasicMaterial.js'
,
'materials/ParticleC
ircle
Material.js'
,
'materials/ParticleC
anvas
Material.js'
,
'materials/Texture.js'
,
'objects/Particle.js'
,
'objects/Line.js'
,
...
...
@@ -213,7 +213,7 @@ SVG_FILES = [
'materials/MeshNormalMaterial.js'
,
'materials/MeshFaceMaterial.js'
,
'materials/ParticleBasicMaterial.js'
,
'materials/ParticleC
ircle
Material.js'
,
'materials/ParticleC
anvas
Material.js'
,
'objects/Particle.js'
,
'objects/Line.js'
,
'objects/Mesh.js'
,
...
...
@@ -265,7 +265,6 @@ WEBGL_FILES = [
'materials/MeshFaceMaterial.js'
,
'materials/MeshShaderMaterial.js'
,
'materials/ParticleBasicMaterial.js'
,
'materials/ParticleCircleMaterial.js'
,
'materials/Texture.js'
,
'materials/RenderTarget.js'
,
'materials/Uniforms.js'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录