lightbufferastex is now properly disposed of

should help with my mem leak probs
This commit is contained in:
minjaesong
2018-11-16 20:42:30 +09:00
parent d9f576e4dc
commit f4f0e59811

View File

@@ -356,6 +356,8 @@ object LightmapRenderer {
private val colourNull = Color(0) private val colourNull = Color(0)
private var _lightBufferAsTex: Texture = Texture(1, 1, Pixmap.Format.RGBA8888)
internal fun draw(batch: SpriteBatch) { internal fun draw(batch: SpriteBatch) {
val this_x_start = for_x_start// + overscan_open val this_x_start = for_x_start// + overscan_open
@@ -404,16 +406,16 @@ object LightmapRenderer {
// draw to the batch // draw to the batch
val lightBufferAsTex = Texture(lightBuffer) _lightBufferAsTex.dispose()
lightBufferAsTex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest) _lightBufferAsTex = Texture(lightBuffer)
_lightBufferAsTex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it
// we might not need shader here... // we might not need shader here...
//batch.draw(lightBufferAsTex, 0f, 0f, lightBufferAsTex.width.toFloat(), lightBufferAsTex.height.toFloat()) //batch.draw(lightBufferAsTex, 0f, 0f, lightBufferAsTex.width.toFloat(), lightBufferAsTex.height.toFloat())
batch.draw(lightBufferAsTex, 0f, 0f, lightBufferAsTex.width * DRAW_TILE_SIZE, lightBufferAsTex.height * DRAW_TILE_SIZE) batch.draw(_lightBufferAsTex, 0f, 0f, _lightBufferAsTex.width * DRAW_TILE_SIZE, _lightBufferAsTex.height * DRAW_TILE_SIZE)
//lightBufferAsTex.dispose()
@@ -701,9 +703,9 @@ object LightmapRenderer {
val histogram: Histogram val histogram: Histogram
get() { get() {
var reds = IntArray(MUL) // reds[intensity] ← counts val reds = IntArray(MUL) // reds[intensity] ← counts
var greens = IntArray(MUL) // do. val greens = IntArray(MUL) // do.
var blues = IntArray(MUL) // do. val blues = IntArray(MUL) // do.
val render_width = for_x_end - for_x_start val render_width = for_x_end - for_x_start
val render_height = for_y_end - for_y_start val render_height = for_y_end - for_y_start
// excluiding overscans; only reckon echo lights // excluiding overscans; only reckon echo lights