Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
538aa18b
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,发现更多精彩内容 >>
提交
538aa18b
编写于
8月 02, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CanvasRenderer: Support ParticleBasicMaterial without map.
上级
13a665d4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
17 deletion
+35
-17
examples/canvas_particles_floor.html
examples/canvas_particles_floor.html
+3
-13
src/core/Projector.js
src/core/Projector.js
+1
-0
src/renderers/CanvasRenderer.js
src/renderers/CanvasRenderer.js
+29
-4
src/renderers/renderables/RenderableParticle.js
src/renderers/renderables/RenderableParticle.js
+2
-0
未找到文件。
examples/canvas_particles_floor.html
浏览文件 @
538aa18b
...
...
@@ -51,25 +51,15 @@
scene
.
add
(
camera
);
var
PI2
=
Math
.
PI
*
2
;
var
material
=
new
THREE
.
ParticleCanvasMaterial
(
{
color
:
0xffffff
,
program
:
function
(
context
)
{
context
.
beginPath
();
context
.
arc
(
0
,
0
,
1
,
0
,
PI2
,
true
);
context
.
closePath
();
context
.
fill
();
}
}
);
var
material
=
new
THREE
.
ParticleBasicMaterial
(
{
color
:
0xffffff
}
);
for
(
var
ix
=
0
;
ix
<
AMOUNTX
;
ix
++
)
{
for
(
var
iy
=
0
;
iy
<
AMOUNTY
;
iy
++
)
{
particle
=
new
THREE
.
Particle
(
material
);
particle
.
scale
.
y
=
2
;
particle
.
scale
.
y
=
6
;
particle
.
position
.
x
=
ix
*
SEPARATION
-
(
(
AMOUNTX
*
SEPARATION
)
/
2
);
particle
.
position
.
z
=
iy
*
SEPARATION
-
(
(
AMOUNTY
*
SEPARATION
)
/
2
);
scene
.
add
(
particle
);
...
...
src/core/Projector.js
浏览文件 @
538aa18b
...
...
@@ -377,6 +377,7 @@ THREE.Projector = function() {
if
(
_vector4
.
z
>
0
&&
_vector4
.
z
<
1
)
{
_particle
=
getNextParticleInPool
();
_particle
.
object
=
object
;
_particle
.
x
=
_vector4
.
x
/
_vector4
.
w
;
_particle
.
y
=
_vector4
.
y
/
_vector4
.
w
;
_particle
.
z
=
_vector4
.
z
;
...
...
src/renderers/CanvasRenderer.js
浏览文件 @
538aa18b
...
...
@@ -415,7 +415,34 @@ THREE.CanvasRenderer = function ( parameters ) {
if
(
material
instanceof
THREE
.
ParticleBasicMaterial
)
{
if
(
material
.
map
!==
null
)
{
if
(
material
.
map
===
null
)
{
scaleX
=
element
.
object
.
scale
.
x
;
scaleY
=
element
.
object
.
scale
.
y
;
// TODO: Be able to disable this
scaleX
*=
element
.
scale
.
x
*
_canvasWidthHalf
;
scaleY
*=
element
.
scale
.
y
*
_canvasHeightHalf
;
_bboxRect
.
set
(
v1
.
x
-
scaleX
,
v1
.
y
-
scaleY
,
v1
.
x
+
scaleX
,
v1
.
y
+
scaleY
);
if
(
_clipRect
.
intersects
(
_bboxRect
)
===
false
)
{
return
;
}
setFillStyle
(
material
.
color
.
getContextStyle
()
);
_context
.
save
();
_context
.
translate
(
v1
.
x
,
v1
.
y
);
_context
.
rotate
(
-
element
.
rotation
);
_context
.
scale
(
scaleX
,
scaleY
);
_context
.
fillRect
(
-
1
,
-
1
,
1
,
1
);
_context
.
restore
();
}
else
{
bitmap
=
material
.
map
.
image
;
bitmapWidth
=
bitmap
.
width
>>
1
;
...
...
@@ -444,19 +471,17 @@ THREE.CanvasRenderer = function ( parameters ) {
_context
.
translate
(
-
bitmapWidth
,
-
bitmapHeight
);
_context
.
drawImage
(
bitmap
,
0
,
0
);
_context
.
restore
();
}
/* DEBUG
setStrokeStyle( 'rgb(255,255,0)' );
_context.beginPath();
_context.moveTo( v1.x - 10, v1.y );
_context.lineTo( v1.x + 10, v1.y );
_context.moveTo( v1.x, v1.y - 10 );
_context.lineTo( v1.x, v1.y + 10 );
_context.closePath();
_context.strokeStyle = 'rgb(255,255,0)';
_context.stroke();
*/
...
...
src/renderers/renderables/RenderableParticle.js
浏览文件 @
538aa18b
...
...
@@ -4,6 +4,8 @@
THREE
.
RenderableParticle
=
function
()
{
this
.
object
=
null
;
this
.
x
=
null
;
this
.
y
=
null
;
this
.
z
=
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录