Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup: Update references to BatchedMesh.maxGeometryCount #28694

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/api/en/objects/BatchedMesh.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ <h2>Code Example</h2>
const sphereGeometryId = batchedMesh.addGeometry( sphere );

// create instances of those geometries
const boxInstancedId1 = batchedMesh.addInstance( boxGeometryId );
const boxInstancedId1 = batchedMesh.addInstance( boxGeometryId );
const boxInstancedId2 = batchedMesh.addInstance( boxGeometryId );

const sphereInstancedId1 = batchedMesh.addInstance( sphereGeometryId );
const sphereInstancedId2 = batchedMesh.addInstance( sphereGeometryId );
const sphereInstancedId1 = batchedMesh.addInstance( sphereGeometryId );
const sphereInstancedId2 = batchedMesh.addInstance( sphereGeometryId );

// position the geometries
batchedMesh.setMatrixAt( boxInstancedId1, boxMatrix1 );
Expand Down Expand Up @@ -100,9 +100,9 @@ <h3>[property:Boolean sortObjects]</h3>
rendered front to back. Default is `true`.
</p>

<h3>[property:Integer maxGeometryCount]</h3>
<h3>[property:Integer maxInstanceCount]</h3>
<p>
The maximum number of individual geometries that can be stored in the [name]. Read only.
The maximum number of individual instances that can be stored in the [name]. Read only.
</p>

<h3>[property:Boolean isBatchedMesh]</h3>
Expand Down Expand Up @@ -231,7 +231,7 @@ <h3>
[method:Integer addInstance]( [param:Integer geometryId] )
</h3>
<p>
[page:Integer geometryId]: The id of a previously added geometry via "addGeometry" to add into the [name] to render.
[page:Integer geometryId]: The id of a previously added geometry via "addGeometry" to add into the [name] to render.
</p>
<p>
Adds a new instance to the [name] using the geometry of the given geometryId and returns a new id referring to the new instance to be used
Expand Down
8 changes: 4 additions & 4 deletions docs/api/zh/objects/BatchedMesh.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ <h2>例子</h2>
<h2>构造函数</h2>
<h3>
[name](
[param:Integer maxGeometryCount], [param:Integer maxVertexCount],
[param:Integer maxInstanceCount], [param:Integer maxVertexCount],
[param:Integer maxIndexCount], [param:Material material],
)
</h3>
<p>
[page:Integer maxGeometryCount] - 计划添加的单个几何体的最大数量。<br />
[page:Integer maxInstanceCount] - 计划添加的单个几何体的最大数量。<br />
[page:Integer maxVertexCount] - 所有几何体使用的最大顶点数。<br />
[page:Integer maxIndexCount] - 所有几何图形使用的最大索引数。<br />
[page:Material material] - [page:Material] 的一个实例。默认是新的 [page:MeshBasicMaterial]。<br />
Expand Down Expand Up @@ -83,7 +83,7 @@ <h3>[property:Boolean sortObjects]</h3>
如果为 true,则对 [name] 中的各个对象进行排序以改善与过度绘制相关的工件。如果材质被标记为“透明”,则对象将从后到前渲染,如果没有,则它们从前到后渲染。默认为 `true`。
</p>

<h3>[property:Integer maxGeometryCount]</h3>
<h3>[property:Integer maxInstanceCount]</h3>
<p>
只读,[name] 中可以存储的单个几何体的最大数量。
</p>
Expand Down Expand Up @@ -222,4 +222,4 @@ <h2>源代码</h2>
</p>
</body>

</html>
</html>
2 changes: 1 addition & 1 deletion examples/webgl_mesh_batch.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
// initialize options
this._options = this._options || {
get: el => el.z,
aux: new Array( this.maxGeometryCount )
aux: new Array( this.maxInstanceCount )
};

const options = this._options;
Expand Down
6 changes: 3 additions & 3 deletions examples/webgpu_mesh_batch.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
let gui;
let geometries, mesh, material;
const ids = [];

const matrix = new THREE.Matrix4();

//
Expand Down Expand Up @@ -313,7 +313,7 @@

controls.update();


if ( mesh.isBatchedMesh ) {

mesh.sortObjects = api.sortObjects;
Expand Down Expand Up @@ -355,7 +355,7 @@
// initialize options
this._options = this._options || {
get: el => el.z,
aux: new Array( this.maxGeometryCount )
aux: new Array( this.maxInstanceCount )
};

const options = this._options;
Expand Down
2 changes: 1 addition & 1 deletion src/core/Object3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ class Object3D extends EventDispatcher {
sphereCenter: bound.sphere.center.toArray()
} ) );

object.maxGeometryCount = this._maxGeometryCount;
object.maxInstanceCount = this._maxInstanceCount;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how versioning works for toJSON(), does this require a major version bump of metadata.version on the outputted json?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would ignore this aspect for now. If someone complains, we can consider to apply a fallback on maxGeometryCount.

object.maxVertexCount = this._maxVertexCount;
object.maxIndexCount = this._maxIndexCount;

Expand Down
4 changes: 2 additions & 2 deletions src/loaders/ObjectLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ class ObjectLoader extends Loader {
geometry = getGeometry( data.geometry );
material = getMaterial( data.material );

object = new BatchedMesh( data.maxGeometryCount, data.maxVertexCount, data.maxIndexCount, material );
object = new BatchedMesh( data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material );
object.geometry = geometry;
object.perObjectFrustumCulled = data.perObjectFrustumCulled;
object.sortObjects = data.sortObjects;
Expand Down Expand Up @@ -938,7 +938,7 @@ class ObjectLoader extends Loader {

} );

object._maxGeometryCount = data.maxGeometryCount;
object._maxInstanceCount = data.maxInstanceCount;
object._maxVertexCount = data.maxVertexCount;
object._maxIndexCount = data.maxIndexCount;

Expand Down