Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
f177bce8
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,发现更多精彩内容 >>
未验证
提交
f177bce8
编写于
5月 11, 2020
作者:
M
Mr.doob
提交者:
GitHub
5月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19135 from WestLangley/dev_instanced_buffer_geo
InstancedBufferGeometry.maxInstancedCount => .instanceCount
上级
560f94d7
107a6bb2
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
37 addition
and
15 deletion
+37
-15
docs/api/en/core/InstancedBufferGeometry.html
docs/api/en/core/InstancedBufferGeometry.html
+2
-2
docs/api/zh/core/InstancedBufferGeometry.html
docs/api/zh/core/InstancedBufferGeometry.html
+2
-2
examples/webgl_buffergeometry_instancing.html
examples/webgl_buffergeometry_instancing.html
+2
-2
src/Three.Legacy.js
src/Three.Legacy.js
+20
-0
src/core/InstancedBufferGeometry.d.ts
src/core/InstancedBufferGeometry.d.ts
+1
-1
src/core/InstancedBufferGeometry.js
src/core/InstancedBufferGeometry.js
+3
-3
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+7
-5
未找到文件。
docs/api/en/core/InstancedBufferGeometry.html
浏览文件 @
f177bce8
...
@@ -24,9 +24,9 @@
...
@@ -24,9 +24,9 @@
<h2>
Properties
</h2>
<h2>
Properties
</h2>
<p>
See [page:BufferGeometry] for inherited properties.
</p>
<p>
See [page:BufferGeometry] for inherited properties.
</p>
<h3>
[property:Number
maxInstanced
Count]
</h3>
<h3>
[property:Number
instance
Count]
</h3>
<p>
<p>
Default is *
undefined
*.
Default is *
Infinity
*.
</p>
</p>
<h2>
Methods
</h2>
<h2>
Methods
</h2>
...
...
docs/api/zh/core/InstancedBufferGeometry.html
浏览文件 @
f177bce8
...
@@ -24,9 +24,9 @@
...
@@ -24,9 +24,9 @@
<h2>
属性
</h2>
<h2>
属性
</h2>
<p>
继承属性详见 [page:BufferGeometry]。
</p>
<p>
继承属性详见 [page:BufferGeometry]。
</p>
<h3>
[property:Number
maxInstanced
Count]
</h3>
<h3>
[property:Number
instance
Count]
</h3>
<p>
<p>
默认值是 *
undefined
*。
默认值是 *
Infinity
*。
</p>
</p>
<h2>
方法
</h2>
<h2>
方法
</h2>
...
...
examples/webgl_buffergeometry_instancing.html
浏览文件 @
f177bce8
...
@@ -145,7 +145,7 @@
...
@@ -145,7 +145,7 @@
}
}
var
geometry
=
new
THREE
.
InstancedBufferGeometry
();
var
geometry
=
new
THREE
.
InstancedBufferGeometry
();
geometry
.
maxInstanced
Count
=
instances
;
// set so its initalized for dat.GUI, will be set in first draw otherwise
geometry
.
instance
Count
=
instances
;
// set so its initalized for dat.GUI, will be set in first draw otherwise
geometry
.
setAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
positions
,
3
)
);
geometry
.
setAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
positions
,
3
)
);
...
@@ -191,7 +191,7 @@
...
@@ -191,7 +191,7 @@
//
//
var
gui
=
new
GUI
(
{
width
:
350
}
);
var
gui
=
new
GUI
(
{
width
:
350
}
);
gui
.
add
(
geometry
,
'
maxInstanced
Count
'
,
0
,
instances
);
gui
.
add
(
geometry
,
'
instance
Count
'
,
0
,
instances
);
//
//
...
...
src/Three.Legacy.js
浏览文件 @
f177bce8
...
@@ -26,6 +26,7 @@ import {
...
@@ -26,6 +26,7 @@ import {
BufferAttribute
BufferAttribute
}
from
'
./core/BufferAttribute.js
'
;
}
from
'
./core/BufferAttribute.js
'
;
import
{
BufferGeometry
}
from
'
./core/BufferGeometry.js
'
;
import
{
BufferGeometry
}
from
'
./core/BufferGeometry.js
'
;
import
{
InstancedBufferGeometry
}
from
'
./core/InstancedBufferGeometry.js
'
;
import
{
InterleavedBuffer
}
from
'
./core/InterleavedBuffer.js
'
;
import
{
InterleavedBuffer
}
from
'
./core/InterleavedBuffer.js
'
;
import
{
Face3
}
from
'
./core/Face3.js
'
;
import
{
Face3
}
from
'
./core/Face3.js
'
;
import
{
Geometry
}
from
'
./core/Geometry.js
'
;
import
{
Geometry
}
from
'
./core/Geometry.js
'
;
...
@@ -1371,6 +1372,25 @@ Object.defineProperties( BufferGeometry.prototype, {
...
@@ -1371,6 +1372,25 @@ Object.defineProperties( BufferGeometry.prototype, {
}
);
}
);
Object
.
defineProperties
(
InstancedBufferGeometry
.
prototype
,
{
maxInstancedCount
:
{
get
:
function
()
{
console
.
warn
(
'
THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.
'
);
return
this
.
instanceCount
;
},
set
:
function
(
value
)
{
console
.
warn
(
'
THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.
'
);
this
.
instanceCount
=
value
;
}
}
}
);
Object
.
defineProperties
(
Raycaster
.
prototype
,
{
Object
.
defineProperties
(
Raycaster
.
prototype
,
{
linePrecision
:
{
linePrecision
:
{
...
...
src/core/InstancedBufferGeometry.d.ts
浏览文件 @
f177bce8
...
@@ -8,7 +8,7 @@ export class InstancedBufferGeometry extends BufferGeometry {
...
@@ -8,7 +8,7 @@ export class InstancedBufferGeometry extends BufferGeometry {
constructor
();
constructor
();
groups
:
{
start
:
number
;
count
:
number
;
instances
:
number
}[];
groups
:
{
start
:
number
;
count
:
number
;
instances
:
number
}[];
maxInstanced
Count
:
number
;
instance
Count
:
number
;
addGroup
(
start
:
number
,
count
:
number
,
instances
:
number
):
void
;
addGroup
(
start
:
number
,
count
:
number
,
instances
:
number
):
void
;
...
...
src/core/InstancedBufferGeometry.js
浏览文件 @
f177bce8
...
@@ -9,7 +9,7 @@ function InstancedBufferGeometry() {
...
@@ -9,7 +9,7 @@ function InstancedBufferGeometry() {
BufferGeometry
.
call
(
this
);
BufferGeometry
.
call
(
this
);
this
.
type
=
'
InstancedBufferGeometry
'
;
this
.
type
=
'
InstancedBufferGeometry
'
;
this
.
maxInstancedCount
=
undefined
;
this
.
instanceCount
=
Infinity
;
}
}
...
@@ -23,7 +23,7 @@ InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry
...
@@ -23,7 +23,7 @@ InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry
BufferGeometry
.
prototype
.
copy
.
call
(
this
,
source
);
BufferGeometry
.
prototype
.
copy
.
call
(
this
,
source
);
this
.
maxInstancedCount
=
source
.
maxInstanced
Count
;
this
.
instanceCount
=
source
.
instance
Count
;
return
this
;
return
this
;
...
@@ -39,7 +39,7 @@ InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry
...
@@ -39,7 +39,7 @@ InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry
var
data
=
BufferGeometry
.
prototype
.
toJSON
.
call
(
this
);
var
data
=
BufferGeometry
.
prototype
.
toJSON
.
call
(
this
);
data
.
maxInstancedCount
=
this
.
maxInstanced
Count
;
data
.
instanceCount
=
this
.
instance
Count
;
data
.
isInstancedBufferGeometry
=
true
;
data
.
isInstancedBufferGeometry
=
true
;
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
f177bce8
...
@@ -875,7 +875,9 @@ function WebGLRenderer( parameters ) {
...
@@ -875,7 +875,9 @@ function WebGLRenderer( parameters ) {
}
else
if
(
geometry
.
isInstancedBufferGeometry
)
{
}
else
if
(
geometry
.
isInstancedBufferGeometry
)
{
renderer
.
renderInstances
(
geometry
,
drawStart
,
drawCount
,
geometry
.
maxInstancedCount
);
var
instanceCount
=
Math
.
min
(
geometry
.
instanceCount
,
geometry
.
_maxInstanceCount
);
renderer
.
renderInstances
(
geometry
,
drawStart
,
drawCount
,
instanceCount
);
}
else
{
}
else
{
...
@@ -934,9 +936,9 @@ function WebGLRenderer( parameters ) {
...
@@ -934,9 +936,9 @@ function WebGLRenderer( parameters ) {
state
.
enableAttributeAndDivisor
(
programAttribute
,
data
.
meshPerAttribute
);
state
.
enableAttributeAndDivisor
(
programAttribute
,
data
.
meshPerAttribute
);
if
(
geometry
.
maxInstanced
Count
===
undefined
)
{
if
(
geometry
.
_maxInstance
Count
===
undefined
)
{
geometry
.
maxInstanced
Count
=
data
.
meshPerAttribute
*
data
.
count
;
geometry
.
_maxInstance
Count
=
data
.
meshPerAttribute
*
data
.
count
;
}
}
...
@@ -955,9 +957,9 @@ function WebGLRenderer( parameters ) {
...
@@ -955,9 +957,9 @@ function WebGLRenderer( parameters ) {
state
.
enableAttributeAndDivisor
(
programAttribute
,
geometryAttribute
.
meshPerAttribute
);
state
.
enableAttributeAndDivisor
(
programAttribute
,
geometryAttribute
.
meshPerAttribute
);
if
(
geometry
.
maxInstanced
Count
===
undefined
)
{
if
(
geometry
.
_maxInstance
Count
===
undefined
)
{
geometry
.
maxInstanced
Count
=
geometryAttribute
.
meshPerAttribute
*
geometryAttribute
.
count
;
geometry
.
_maxInstance
Count
=
geometryAttribute
.
meshPerAttribute
*
geometryAttribute
.
count
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录