Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Profiling stats #65

Merged
merged 5 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions editor/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Added new Add Component Dialog which only supports Light Components for now.
- Added new Gizmo feature for displaying decal Icons over objects like Light sources.
- Added normal mapping for terrains and models
- Added new profiling bar with GL profiler statistics
- Update water shader to fade out water foam over distance, to minimize ugly 1 pixel white lines from a distance.

[0.3.1] ~ 07/06/2022
Expand Down
6 changes: 6 additions & 0 deletions editor/src/main/com/mbrlabs/mundus/editor/Editor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.mbrlabs.mundus.editor.events.SceneChangedEvent
import com.mbrlabs.mundus.editor.input.FreeCamController
import com.mbrlabs.mundus.editor.input.InputManager
import com.mbrlabs.mundus.editor.input.ShortcutController
import com.mbrlabs.mundus.editor.profiling.MundusGLProfiler
import com.mbrlabs.mundus.editor.tools.ToolManager
import com.mbrlabs.mundus.editor.ui.UI
import com.mbrlabs.mundus.editor.ui.gizmos.GizmoManager
Expand Down Expand Up @@ -60,6 +61,7 @@ class Editor : Lwjgl3WindowAdapter(), ApplicationListener,
private lateinit var registry: Registry
private lateinit var toolManager: ToolManager
private lateinit var gizmoManager: GizmoManager
private lateinit var glProfiler: MundusGLProfiler

override fun create() {
Mundus.registerEventListener(this)
Expand All @@ -70,6 +72,7 @@ class Editor : Lwjgl3WindowAdapter(), ApplicationListener,
registry = Mundus.inject()
toolManager = Mundus.inject()
gizmoManager = Mundus.inject()
glProfiler = Mundus.inject()
setupInput()

// TODO dispose this
Expand Down Expand Up @@ -118,8 +121,10 @@ class Editor : Lwjgl3WindowAdapter(), ApplicationListener,
UI.sceneWidget.setCam(context.currScene.cam)
UI.sceneWidget.setRenderer {

glProfiler.resume()
sg.update()
scene.render()
glProfiler.pause()

toolManager.render()
gizmoManager.render()
Expand All @@ -136,6 +141,7 @@ class Editor : Lwjgl3WindowAdapter(), ApplicationListener,
override fun render() {
GlUtils.clearScreen(Color.WHITE)
UI.act()
glProfiler.reset()
camController.update()
toolManager.act()
UI.draw()
Expand Down
5 changes: 5 additions & 0 deletions editor/src/main/com/mbrlabs/mundus/editor/Mundus.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import com.mbrlabs.mundus.editor.history.CommandHistory
import com.mbrlabs.mundus.editor.input.FreeCamController
import com.mbrlabs.mundus.editor.input.InputManager
import com.mbrlabs.mundus.editor.input.ShortcutController
import com.mbrlabs.mundus.editor.profiling.MundusGLProfiler
import com.mbrlabs.mundus.editor.shader.Shaders
import com.mbrlabs.mundus.editor.tools.ToolManager
import com.mbrlabs.mundus.editor.tools.picker.GameObjectPicker
Expand Down Expand Up @@ -77,6 +78,7 @@ object Mundus {
private val goPicker: GameObjectPicker
private val handlePicker: ToolHandlePicker
private val json: Json
private val glProfiler: MundusGLProfiler

init {
// create home dir
Expand Down Expand Up @@ -107,6 +109,7 @@ object Mundus {
gizmoManager = GizmoManager()
shortcutController = ShortcutController(registry, projectManager, commandHistory, toolManager)
json = Json()
glProfiler = MundusGLProfiler(Gdx.graphics)

// add to DI container
context.register {
Expand All @@ -125,6 +128,7 @@ object Mundus {
bindSingleton(shortcutController)
bindSingleton(freeCamController)
bindSingleton(json)
bindSingleton(glProfiler)

bindSingleton(MetaSaver())
bindSingleton(MetaLoader())
Expand Down Expand Up @@ -217,6 +221,7 @@ object Mundus {
modelBatch.dispose()
goPicker.dispose()
handlePicker.dispose()
glProfiler.disable()
}

}
Loading