Skip to content

Commit 35396a1

Browse files
committed
update frames renderer loading logic
1 parent 1d86c30 commit 35396a1

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/main/kotlin/solve/rendering/engine/core/renderers/FramesRenderer.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import solve.rendering.engine.utils.toIntVector
2626
import solve.scene.controller.SceneController
2727
import solve.scene.model.VisualizationFrame
2828
import solve.utils.ceilToInt
29-
import java.util.Collections.synchronizedList
29+
import java.util.concurrent.CopyOnWriteArrayList
3030
import kotlin.math.abs
3131
import kotlin.math.min
3232

@@ -58,7 +58,7 @@ class FramesRenderer(
5858

5959
private var cameraLastGridCellPosition = getScreenCenterGridCellPosition()
6060

61-
private val bufferFramesToUpload = synchronizedList<LoadedBufferFrameData>(mutableListOf())
61+
private val bufferFramesToUpload = CopyOnWriteArrayList<LoadedBufferFrameData>(mutableListOf())
6262
private val framesLoadingCoroutineScope = CoroutineScope(Dispatchers.Default)
6363

6464
private var needToReinitializeBuffers = false
@@ -166,9 +166,7 @@ class FramesRenderer(
166166

167167
private fun uploadLoadedFramesToBuffers() {
168168
bufferFramesToUpload.forEach { frame ->
169-
synchronized(bufferFramesToUpload) {
170-
bufferFramesToUpload.remove(frame)
171-
}
169+
bufferFramesToUpload.remove(frame)
172170
bufferFramesArrayTexture?.uploadTexture(frame.textureData, frame.bufferIndex)
173171
Texture2D.freeData(frame.textureData)
174172
}
@@ -293,9 +291,7 @@ class FramesRenderer(
293291
return@launch
294292
}
295293

296-
synchronized(bufferFramesToUpload) {
297-
bufferFramesToUpload.add(LoadedBufferFrameData(textureData, index))
298-
}
294+
bufferFramesToUpload.add(LoadedBufferFrameData(textureData, index))
299295
}
300296
}
301297

src/main/kotlin/solve/scene/SceneFacade.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import tornadofx.find
2525
* Transforms common application data models into scene data and applies it.
2626
*/
2727
object SceneFacade {
28-
val lastVisualizationKeepSettingsProperty = SimpleObjectProperty(false)
28+
val lastVisualizationKeepSettingsProperty = SimpleObjectProperty(true)
2929
private var lastVisualizationKeepSettings: Boolean
3030
get() = lastVisualizationKeepSettingsProperty.value
3131
private set(value) {

0 commit comments

Comments
 (0)