Skip to content

Commit

Permalink
added yaw and pitch manipulations, updated default settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Nokse22 committed May 4, 2024
1 parent c2ee4d5 commit 2a54d46
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
10 changes: 5 additions & 5 deletions data/io.github.nokse22.Exhibit.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
<default>true</default>
</key>
<key name="tone-mapping" type="b">
<default>false</default>
<default>true</default>
</key>
<key name="ambient-occlusion" type="b">
<default>false</default>
<default>true</default>
</key>
<key name="anti-aliasing" type="b">
<default>false</default>
<default>true</default>
</key>
<key name="hdri-ambient" type="b">
<default>false</default>
<default>true</default>
</key>
<key name="orthographic" type="b">
<default>false</default>
<default>true</default>
</key>
<key name="light-intensity" type="d">
<default>1.0</default>
Expand Down
1 change: 1 addition & 0 deletions data/window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ This application is experimental, crashes are expected.</property>
<object class="GtkGestureDrag">
<signal name="drag-update" handler="on_drag_update"/>
<signal name="drag-end" handler="on_drag_end"/>
<property name="button">0</property>
</object>
</child>
<child>
Expand Down
10 changes: 8 additions & 2 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,18 @@ def on_scroll(self, gesture, dx, dy):

@Gtk.Template.Callback("on_drag_update")
def on_drag_update(self, gesture, x_offset, y_offset):
self.camera.elevation(-(self.drag_prev_offset[1] - y_offset))
self.camera.azimuth(self.drag_prev_offset[0] - x_offset)
if gesture.get_current_button() == 1:
self.camera.elevation(-(self.drag_prev_offset[1] - y_offset))
self.camera.azimuth(self.drag_prev_offset[0] - x_offset)
elif gesture.get_current_button() == 2:
self.camera.pitch(-(self.drag_prev_offset[1] - y_offset)*0.05)
self.camera.yaw(-(self.drag_prev_offset[0] - x_offset)*0.05)

if self.window_settings.get_setting("point-up"):
self.camera.setViewUp((0.0, 1.0, 0.0))

print(gesture.get_current_button())

self.gl_area.queue_render()

self.drag_prev_offset = (x_offset, y_offset)
Expand Down

0 comments on commit 2a54d46

Please sign in to comment.