Guest User

Untitled

a guest
Sep 25th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. coalesceRecords(records: WGLDisplayRecord[]): void {
  2. const nRecords = records.length;
  3.  
  4. if (nRecords === 0) {
  5. return;
  6. }
  7.  
  8. let coalesced = 1;
  9.  
  10. for (let i = 1; i < nRecords; ++i) {
  11. if (
  12. records[i - coalesced].geometryType === records[i].geometryType &&
  13. records[i - coalesced]["_materialInfo"] === records[i]["_materialInfo"]
  14. ) {
  15. records[i - coalesced].vertexCount += records[i].vertexCount;
  16. records[i - coalesced].indexCount += records[i].indexCount;
  17. ++coalesced;
  18. } else {
  19. records[i - coalesced + 1] = records[i];
  20. }
  21. }
  22.  
  23. records.length = records.length - coalesced + 1;
  24. }
Add Comment
Please, Sign In to add comment