Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
e65e086d
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
e65e086d
编写于
11月 21, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed PointCloud.sortParticles. See #5668.
上级
8134ef1a
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
43 addition
and
222 deletion
+43
-222
docs/api/objects/PointCloud.html
docs/api/objects/PointCloud.html
+3
-5
examples/webgl_custom_attributes_particles.html
examples/webgl_custom_attributes_particles.html
+0
-3
examples/webgl_custom_attributes_particles2.html
examples/webgl_custom_attributes_particles2.html
+5
-5
examples/webgl_particles_billboards.html
examples/webgl_particles_billboards.html
+1
-2
examples/webgl_particles_billboards_colors.html
examples/webgl_particles_billboards_colors.html
+1
-3
examples/webgl_particles_shapes.html
examples/webgl_particles_shapes.html
+0
-3
src/objects/PointCloud.js
src/objects/PointCloud.js
+0
-4
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+33
-197
未找到文件。
docs/api/objects/PointCloud.html
浏览文件 @
e65e086d
...
...
@@ -16,7 +16,6 @@
<h2>
Constructor
</h2>
<h3>
[name]( [page:Geometry geometry], [page:Material material] )
</h3>
<div>
...
...
@@ -24,6 +23,7 @@
material — An instance of [page:Material] (optional).
</div>
<h2>
Properties
</h2>
<h3>
[property:Geometry geometry]
</h3>
...
...
@@ -34,10 +34,6 @@
<div>
An instance of [page:Material], defining the object's appearance. Default is a [page:PointCloudMaterial] with randomised colour.
</div>
<h3>
[property:boolean sortParticles]
</h3>
<div>
When set, then the particles should be depth sorted (from far to near), based on camera, in the renderer every frame.
</div>
<h2>
Methods
</h2>
...
...
@@ -46,8 +42,10 @@
This creates a clone of the particle system.
</div>
<h2>
Source
</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>
examples/webgl_custom_attributes_particles.html
浏览文件 @
e65e086d
...
...
@@ -148,9 +148,6 @@
sphere
=
new
THREE
.
PointCloud
(
geometry
,
shaderMaterial
);
sphere
.
dynamic
=
true
;
//sphere.sortParticles = true;
var
vertices
=
sphere
.
geometry
.
vertices
;
var
values_size
=
attributes
.
size
.
value
;
var
values_color
=
attributes
.
customColor
.
value
;
...
...
examples/webgl_custom_attributes_particles2.html
浏览文件 @
e65e086d
...
...
@@ -67,8 +67,11 @@
void
main
()
{
gl_FragColor
=
vec4
(
color
*
vColor
,
1.0
);
gl_FragColor
=
gl_FragColor
*
texture2D
(
texture
,
gl_PointCoord
);
vec4
color
=
vec4
(
color
*
vColor
,
1.0
)
*
texture2D
(
texture
,
gl_PointCoord
);
if
(
color
.
w
<
0.5
)
discard
;
gl_FragColor
=
color
;
}
...
...
@@ -136,9 +139,6 @@
sphere
=
new
THREE
.
PointCloud
(
geometry
,
shaderMaterial
);
sphere
.
dynamic
=
true
;
sphere
.
sortParticles
=
true
;
var
vertices
=
sphere
.
geometry
.
vertices
;
var
values_size
=
attributes
.
size
.
value
;
var
values_color
=
attributes
.
ca
.
value
;
...
...
examples/webgl_particles_billboards.html
浏览文件 @
e65e086d
...
...
@@ -81,11 +81,10 @@
}
material
=
new
THREE
.
PointCloudMaterial
(
{
size
:
35
,
sizeAttenuation
:
false
,
map
:
sprite
,
transparent
:
true
}
);
material
=
new
THREE
.
PointCloudMaterial
(
{
size
:
35
,
sizeAttenuation
:
false
,
map
:
sprite
,
alphaTest
:
0.5
,
transparent
:
true
}
);
material
.
color
.
setHSL
(
1.0
,
0.3
,
0.7
);
particles
=
new
THREE
.
PointCloud
(
geometry
,
material
);
particles
.
sortParticles
=
true
;
scene
.
add
(
particles
);
//
...
...
examples/webgl_particles_billboards_colors.html
浏览文件 @
e65e086d
...
...
@@ -86,12 +86,10 @@
geometry
.
colors
=
colors
;
material
=
new
THREE
.
PointCloudMaterial
(
{
size
:
85
,
map
:
sprite
,
vertexColors
:
THREE
.
VertexColors
,
transparent
:
true
}
);
material
=
new
THREE
.
PointCloudMaterial
(
{
size
:
85
,
map
:
sprite
,
vertexColors
:
THREE
.
VertexColors
,
alphaTest
:
0.5
,
transparent
:
true
}
);
material
.
color
.
setHSL
(
1.0
,
0.2
,
0.7
);
particles
=
new
THREE
.
PointCloud
(
geometry
,
material
);
particles
.
sortParticles
=
true
;
scene
.
add
(
particles
);
//
...
...
examples/webgl_particles_shapes.html
浏览文件 @
e65e086d
...
...
@@ -346,9 +346,6 @@
particleCloud
=
new
THREE
.
PointCloud
(
particles
,
shaderMaterial
);
particleCloud
.
dynamic
=
true
;
// particleCloud.sortParticles = true;
var
vertices
=
particleCloud
.
geometry
.
vertices
;
var
values_size
=
attributes
.
size
.
value
;
var
values_color
=
attributes
.
pcolor
.
value
;
...
...
src/objects/PointCloud.js
浏览文件 @
e65e086d
...
...
@@ -11,8 +11,6 @@ THREE.PointCloud = function ( geometry, material ) {
this
.
geometry
=
geometry
!==
undefined
?
geometry
:
new
THREE
.
Geometry
();
this
.
material
=
material
!==
undefined
?
material
:
new
THREE
.
PointCloudMaterial
(
{
color
:
Math
.
random
()
*
0xffffff
}
);
this
.
sortParticles
=
false
;
};
THREE
.
PointCloud
.
prototype
=
Object
.
create
(
THREE
.
Object3D
.
prototype
);
...
...
@@ -149,8 +147,6 @@ THREE.PointCloud.prototype.clone = function ( object ) {
if
(
object
===
undefined
)
object
=
new
THREE
.
PointCloud
(
this
.
geometry
,
this
.
material
);
object
.
sortParticles
=
this
.
sortParticles
;
THREE
.
Object3D
.
prototype
.
clone
.
call
(
this
,
object
);
return
object
;
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
e65e086d
...
...
@@ -1202,146 +1202,6 @@ THREE.WebGLRenderer = function ( parameters ) {
a
,
ca
,
cal
,
value
,
customAttribute
;
if
(
object
.
sortParticles
)
{
_projScreenMatrixPS
.
copy
(
_projScreenMatrix
);
_projScreenMatrixPS
.
multiply
(
object
.
matrixWorld
);
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
vertex
=
vertices
[
v
];
_vector3
.
copy
(
vertex
);
_vector3
.
applyProjection
(
_projScreenMatrixPS
);
sortArray
[
v
]
=
[
_vector3
.
z
,
v
];
}
sortArray
.
sort
(
numericalSort
);
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
vertex
=
vertices
[
sortArray
[
v
][
1
]
];
offset
=
v
*
3
;
vertexArray
[
offset
]
=
vertex
.
x
;
vertexArray
[
offset
+
1
]
=
vertex
.
y
;
vertexArray
[
offset
+
2
]
=
vertex
.
z
;
}
for
(
c
=
0
;
c
<
cl
;
c
++
)
{
offset
=
c
*
3
;
color
=
colors
[
sortArray
[
c
][
1
]
];
colorArray
[
offset
]
=
color
.
r
;
colorArray
[
offset
+
1
]
=
color
.
g
;
colorArray
[
offset
+
2
]
=
color
.
b
;
}
if
(
customAttributes
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
customAttribute
=
customAttributes
[
i
];
if
(
!
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
'
vertices
'
)
)
continue
;
offset
=
0
;
cal
=
customAttribute
.
value
.
length
;
if
(
customAttribute
.
size
===
1
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
customAttribute
.
array
[
ca
]
=
customAttribute
.
value
[
index
];
}
}
else
if
(
customAttribute
.
size
===
2
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
value
=
customAttribute
.
value
[
index
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
offset
+=
2
;
}
}
else
if
(
customAttribute
.
size
===
3
)
{
if
(
customAttribute
.
type
===
'
c
'
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
value
=
customAttribute
.
value
[
index
];
customAttribute
.
array
[
offset
]
=
value
.
r
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
g
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
b
;
offset
+=
3
;
}
}
else
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
value
=
customAttribute
.
value
[
index
];
customAttribute
.
array
[
offset
]
=
value
.
x
;
customAttribute
.
array
[
offset
+
1
]
=
value
.
y
;
customAttribute
.
array
[
offset
+
2
]
=
value
.
z
;
offset
+=
3
;
}
}
}
else
if
(
customAttribute
.
size
===
4
)
{
for
(
ca
=
0
;
ca
<
cal
;
ca
++
)
{
index
=
sortArray
[
ca
][
1
];
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
;
offset
+=
4
;
}
}
}
}
}
else
{
if
(
dirtyVertices
)
{
for
(
v
=
0
;
v
<
vl
;
v
++
)
{
...
...
@@ -1356,6 +1216,9 @@ THREE.WebGLRenderer = function ( parameters ) {
}
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
geometry
.
__webglVertexBuffer
);
_gl
.
bufferData
(
_gl
.
ARRAY_BUFFER
,
vertexArray
,
hint
);
}
if
(
dirtyColors
)
{
...
...
@@ -1372,6 +1235,9 @@ THREE.WebGLRenderer = function ( parameters ) {
}
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
geometry
.
__webglColorBuffer
);
_gl
.
bufferData
(
_gl
.
ARRAY_BUFFER
,
colorArray
,
hint
);
}
if
(
customAttributes
)
{
...
...
@@ -1380,9 +1246,7 @@ THREE.WebGLRenderer = function ( parameters ) {
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
;
...
...
@@ -1460,38 +1324,10 @@ THREE.WebGLRenderer = function ( parameters ) {
}
}
}
}
if
(
dirtyVertices
||
object
.
sortParticles
)
{
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
geometry
.
__webglVertexBuffer
);
_gl
.
bufferData
(
_gl
.
ARRAY_BUFFER
,
vertexArray
,
hint
);
}
if
(
dirtyColors
||
object
.
sortParticles
)
{
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
geometry
.
__webglColorBuffer
);
_gl
.
bufferData
(
_gl
.
ARRAY_BUFFER
,
colorArray
,
hint
);
}
if
(
customAttributes
)
{
for
(
i
=
0
,
il
=
customAttributes
.
length
;
i
<
il
;
i
++
)
{
customAttribute
=
customAttributes
[
i
];
if
(
customAttribute
.
needsUpdate
||
object
.
sortParticles
)
{
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
customAttribute
.
buffer
);
_gl
.
bufferData
(
_gl
.
ARRAY_BUFFER
,
customAttribute
.
array
,
hint
);
}
customAttribute
.
needsUpdate
=
false
;
}
...
...
@@ -1582,9 +1418,7 @@ THREE.WebGLRenderer = function ( parameters ) {
customAttribute
=
customAttributes
[
i
];
if
(
customAttribute
.
needsUpdate
&&
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
'
vertices
'
)
)
{
if
(
customAttribute
.
needsUpdate
&&
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
'
vertices
'
)
)
{
offset
=
0
;
...
...
@@ -1663,6 +1497,8 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
customAttribute
.
buffer
);
_gl
.
bufferData
(
_gl
.
ARRAY_BUFFER
,
customAttribute
.
array
,
hint
);
customAttribute
.
needsUpdate
=
false
;
}
}
...
...
@@ -4137,7 +3973,7 @@ THREE.WebGLRenderer = function ( parameters ) {
customAttributesDirty
=
material
.
attributes
&&
areCustomAttributesDirty
(
material
);
if
(
geometry
.
verticesNeedUpdate
||
geometry
.
colorsNeedUpdate
||
object
.
sortParticles
||
customAttributesDirty
)
{
if
(
geometry
.
verticesNeedUpdate
||
geometry
.
colorsNeedUpdate
||
customAttributesDirty
)
{
setParticleBuffers
(
geometry
,
_gl
.
DYNAMIC_DRAW
,
object
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录