playcanvas / playcanvas/engine
batching.js code comment. And add support for batching animated Skinned models?
@mvaligursky is already working on this.
Since Feb 7, 2020.
- Dominant language
- JavaScript
- Stars
- 16.8k
- Forks
- 2k
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 222
Description
I've got a code comment regarding:
// Split by instance number
if (i === meshInstancesLeftA.length) {
meshInstancesLeftB = [];
} else {
meshInstancesLeftB = meshInstancesLeftA.slice(i + 1);
}
Isn't the if (i === meshInstancesLeftA.length) { an impossible/redundant case check? You've already accessed meshInstancesLeftA[i] which is assumed within range and won't be undefined. i=== meshInstancesLeftA.length will never happen, i think. The else case should be sufficient enough, right?
Also, refer to the changes I did in batching.js on my fork that supports Skinned batching.
https://github.com/Glidias/engine/blob/master/src/scene/batching.js
Test project with scripts/3rd/modpc.js hacks wit batching (View in EDITOR).
https://playcanvas.com/editor/scene/613629
I tested with a bunch of soldiers + ships all using the same batch group, they seem to be all batched to 1 group, all split okay if exceeded maxInstance count limit. THe mods also include allowing batching with custom shader chunks (as shown in the green y-view-scaled billboards when you spawn on the map).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.