Cleanup BatchRenderer internal names and documentation (#5852)
I have edited the BatchRenderer class. The following major changes were
made:

1. Changed old `vertexCount` to `_flushId`. This is because the name
itself was misleading. It signified the number of flushes in the
current frame.

2. Renamed `vaos` and `vaosMax` to `_packedGeometries` and
`_packedGeometryPoolSize`. They _were not_ VAOs in the sense
that they binded all the buffers automatically to the WebGL
context. Instead, they were just reusable `BatchGeometry` objects.

3. Renamed `groups` to `_drawCalls`. That is what they are, and it
makes more sense, especially after documenting it.

4. Renamed all private variables by adding a _ prefix.

5. Added documentation to all private/public properties and methods.

6. Fixed destroy(). It was nullifying non-existent variables. They
were probably from when this class was being built/tested. I've fixed
it so that it nullifies the correct resources.

7. contextChange signal is now hooked in `BatchRenderer` rather than
the `BatchPluginFactory#create`. This makes sense since the former
is the one implementing the `contextChange` signal.

8. SIDE EFFECT: Graphics used the `shader` property of `BatchRenderer`,
and since that was deemed a private properties, it broke. It fixed that
by making Graphics use `_shader`.

9. I reordered the way in which properties are initialized in the
constructor. The most important/public ones are on the top. They are
ordered in a way that makes a new-comer sense.

10. Reordered methods. The first methods are related to rendering and
are lifecycle-type methods: contextChange, render, flush, and destroy. Then
the start and stop methods. Then the private methods getAttributeBuffer,
getIndexBuffer, and packInterleavedGeometry.

11. Renamed packGeometry to packInterleavedGeometry; this is because
the method doesn't take any geometry to put into. Rather it takes
the interleaved buffers.

12. Documented literally anything else.
1 parent c165232 commit e5f6b368b09ef4b1576214eefe159270cb03d810
@Sukant Pal Sukant Pal authored on 30 Jun 2019
Matt Karl committed on 30 Jun 2019
Showing 3 changed files
View
packages/core/src/batch/BatchPluginFactory.js
View
packages/core/src/batch/BatchRenderer.js
View
packages/graphics/src/Graphics.js