diff --git a/meson.build b/meson.build
index 063a4b4..cf2d76d 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('worldbuilder', ['c', 'vala'],
- version: '0.1.0',
- meson_version: '>= 1.0.0',
+ version: '0.1.0',
+ meson_version: '>= 1.0.0',
default_options: [ 'warning_level=2', 'werror=false', ],
)
@@ -29,7 +29,7 @@ subdir('src')
subdir('po')
gnome.post_install(
- glib_compile_schemas: true,
- gtk_update_icon_cache: true,
+ glib_compile_schemas: true,
+ gtk_update_icon_cache: true,
update_desktop_database: true,
)
diff --git a/src/core/camera.vala b/src/core/camera.vala
index dcd9af9..d65a6c7 100644
--- a/src/core/camera.vala
+++ b/src/core/camera.vala
@@ -2,21 +2,21 @@ namespace Worldbuilder.Core
{
public class Camera : Object
{
- /**
- * The position of the camera
- */
- public Vector3 position { get; set; }
+ /**
+ * The position of the camera
+ */
+ public Vector3 position { get; set; }
- /**
- * The direction the camera is facing.
- */
- public Vector3 direction { get; set; }
+ /**
+ * The direction the camera is facing.
+ */
+ public Vector3 direction { get; set; }
- public Camera (Vector3 position = Vector3 (), Vector3 direction = Vector3 (0, 0, -1))
- {
- this.position = position;
- this.direction = direction;
+ public Camera (Vector3 position = Vector3 (), Vector3 direction = Vector3 (0, 0, -1))
+ {
+ this.position = position;
+ this.direction = direction;
+ }
}
-}
}
\ No newline at end of file
diff --git a/src/core/mesh.vala b/src/core/mesh.vala
index 021b27e..1013b08 100644
--- a/src/core/mesh.vala
+++ b/src/core/mesh.vala
@@ -2,20 +2,6 @@ namespace Worldbuilder.Core
{
public class Mesh : Object
{
- public struct Point
- {
- public Vector3 v;
- public Vector2 uv;
- public Vector3 n;
-
- public Point (Vector3 v = Vector3(), Vector2 uv = Vector2(), Vector3 n = Vector3())
- {
- this.v = v;
- this.uv = uv;
- this.n = n;
- }
- }
-
public struct Face
{
public Point p[3];
@@ -99,4 +85,4 @@ namespace Worldbuilder.Core
return @"$id (vbo: $vbo)";
}
}
-}
\ No newline at end of file
+}
diff --git a/src/core/model.vala b/src/core/model.vala
index 099f2b6..652a552 100644
--- a/src/core/model.vala
+++ b/src/core/model.vala
@@ -98,7 +98,7 @@ namespace Worldbuilder.Core
float z = data.parse_float ();
normals += Vector3 (x, y, z).normalized ();
} else if (data.skip_symbol ("f")) { // face
- Mesh.Point points[3];
+ Point points[3];
int npoints = 0;
while (!data.at_end_of_line) {
diff --git a/src/core/point.vala b/src/core/point.vala
new file mode 100644
index 0000000..4c67094
--- /dev/null
+++ b/src/core/point.vala
@@ -0,0 +1,17 @@
+
+namespace Worldbuilder.Core
+{
+ public struct Point
+ {
+ public Vector3 v;
+ public Vector2 uv;
+ public Vector3 n;
+
+ public Point (Vector3 v = Vector3(), Vector2 uv = Vector2(), Vector3 n = Vector3())
+ {
+ this.v = v;
+ this.uv = uv;
+ this.n = n;
+ }
+ }
+}
diff --git a/src/meson.build b/src/meson.build
index b914e38..c1e5d15 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -2,10 +2,12 @@ worldbuilder_sources = [
'main.vala',
'application.vala',
'window.vala',
+ 'viewport.vala',
+ 'core/point.vala',
+ 'core/vector2.vala',
'core/vector3.vala',
'core/matrix4x4.vala',
- 'core/vector2.vala',
'core/camera.vala',
'core/mesh.vala',
'core/texture2d.vala',
diff --git a/src/viewport.ui b/src/viewport.ui
new file mode 100644
index 0000000..6a5b6c2
--- /dev/null
+++ b/src/viewport.ui
@@ -0,0 +1,8 @@
+
+
+
+
+ true
+ true
+
+
diff --git a/src/viewport.vala b/src/viewport.vala
new file mode 100644
index 0000000..cec14ce
--- /dev/null
+++ b/src/viewport.vala
@@ -0,0 +1,10 @@
+using Gtk;
+
+namespace Worldbuilder
+{
+ [GtkTemplate(ui = "/com/brodybrooks/WorldBuilder/viewport.ui")]
+ public class Viewport : Gtk.GLArea
+ {
+
+ }
+}
diff --git a/src/window.ui b/src/window.ui
index 3223bb1..aa918eb 100644
--- a/src/window.ui
+++ b/src/window.ui
@@ -10,6 +10,12 @@
1280
720
+
+
+
+
diff --git a/src/window.vala b/src/window.vala
index f9434d7..fa3f844 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -22,22 +22,31 @@ namespace Worldbuilder {
[GtkTemplate(ui = "/com/brodybrooks/WorldBuilder/window.ui")]
public class Window : Adw.ApplicationWindow {
[GtkChild]
- private unowned Gtk.GLArea draw_area;
+ private unowned Viewport viewport;
private SceneRenderer renderer;
public Window(Gtk.Application app) {
Object(application: app);
+
+ viewport.set_has_depth_buffer (true);
renderer = new SceneRenderer();
- draw_area.realize.connect(renderer.Setup);
- draw_area.render.connect(renderer.Render);
- draw_area.resize.connect(renderer.OnResize);
+ viewport.realize.connect(renderer.Setup);
+ viewport.render.connect(renderer.Render);
+ viewport.resize.connect(renderer.OnResize);
}
~Window()
{
print("Closing!!\n");
}
+
+ [GtkCallback]
+ private bool OnKeyPressed(Gtk.EventControllerKey controller, uint keyval, uint keycode, Gdk.ModifierType mod_state)
+ {
+ print("Key pressed!\n");
+ return true;
+ }
}
}
diff --git a/src/worldbuilder.gresource.xml b/src/worldbuilder.gresource.xml
index c0dc356..73ee0f4 100644
--- a/src/worldbuilder.gresource.xml
+++ b/src/worldbuilder.gresource.xml
@@ -2,6 +2,7 @@
window.ui
+ viewport.ui
shortcuts-dialog.ui