From 819741493d07adb30d44576ffb2de9c09d346a77 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Mon, 23 Mar 2026 20:30:37 +0200 Subject: [PATCH] feat(math,gui): add full euler rotation and developer camera tools Add yaw/pitch/roll Euler angle support to Quaternion and Transform, enabling complete 3-axis camera orientation. The developer tools panel now displays real-time camera position and rotation with a copy button for saving viewpoints to source code. Fix mouse drag to initialize from current camera orientation, preventing jumps when camera was programmatically positioned with non-default rotation. Optimize alpha blending in rendering loops by replacing division with bit-shift and pre-multiplying source colors. Add bounds clamping and Arrays.fill optimization to TextureBitmap.fillRect. --- TODO.org | 22 ++-- doc/perspective-correct-textures/index.org | 2 +- .../sixth/e3d/gui/DeveloperToolsPanel.java | 108 ++++++++++++++---- .../svjatoslav/sixth/e3d/gui/ViewFrame.java | 3 - .../svjatoslav/sixth/e3d/gui/ViewPanel.java | 13 +-- .../e3d/gui/humaninput/InputManager.java | 12 +- .../svjatoslav/sixth/e3d/math/Quaternion.java | 51 ++++++++- .../svjatoslav/sixth/e3d/math/Transform.java | 52 ++++++++- .../raster/shapes/basic/line/Line.java | 18 +-- .../basic/solidpolygon/SolidPolygon.java | 6 +- .../texturedpolygon/TexturedPolygon.java | 12 +- .../raster/texture/TextureBitmap.java | 87 ++++++++++++-- 12 files changed, 304 insertions(+), 82 deletions(-) diff --git a/TODO.org b/TODO.org index a186422..e5c386d 100644 --- a/TODO.org +++ b/TODO.org @@ -43,7 +43,6 @@ By default, suggest using half of the available CPU cores. Extend it to display all available primitive shapes with labels, documenting each shape and its parameters. -** Use shaded polygons for valumetric actree demo * Performance :PROPERTIES: :CUSTOM_ID: performance @@ -74,10 +73,19 @@ between threads. :CUSTOM_ID: investigate-performance-optimizations :END: Focus on critical pixel fill loops: -- Textured polygon -- Flat polygon -- Line -- Billboard + + +| Status | Class | Hot Method(s) | Buffer Type | +|--------+------------------+--------------------------------------------------------------------------------------+--------------| +| DONE | TextureBitmap | drawPixel(), fillColor() | int[] (ARGB) | +| TODO | SolidPolygon | drawHorizontalLine() (scanline inner loop) | int[] | +| TODO | TexturedPolygon | drawHorizontalLine() (texture sampling inner loop) | int[] | +| TODO | Line | drawHorizontalLine(), drawSinglePixelHorizontalLine(), drawSinglePixelVerticalLine() | int[] | +| TODO | Billboard | paint() (nested loop over pixels) | int[] | +| TODO | GlowingPoint | createTexture() | int[] | +| TODO | Texture | downscaleBitmap(), upscaleBitmap(), avg2(), avg4() | int[] | +| TODO | RenderingContext | Constructor (extracts pixels from DataBufferInt) | int[] | + ** Dynamically resize horizontal per-CPU core slices based on their complexity @@ -100,10 +108,6 @@ Focus on critical pixel fill loops: :PROPERTIES: :CUSTOM_ID: add-polygon-reduction-lod :END: -** Make it easy to copy current camera position in developer tools -It would be nice to fly around and choose good viewpoint and then copy -camera view position into application source code, so that next time -application starts already at that pre-chosen location ** Add object fading based on view distance :PROPERTIES: :CUSTOM_ID: add-object-fading-view-distance diff --git a/doc/perspective-correct-textures/index.org b/doc/perspective-correct-textures/index.org index 59d0760..35f2cce 100644 --- a/doc/perspective-correct-textures/index.org +++ b/doc/perspective-correct-textures/index.org @@ -42,7 +42,7 @@ #+end_export -[[file:index.org][Back to main documentation]] +[[file:../index.org][Back to main documentation]] * The problem :PROPERTIES: diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/DeveloperToolsPanel.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/DeveloperToolsPanel.java index 8c1dd37..88a4e56 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/DeveloperToolsPanel.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/DeveloperToolsPanel.java @@ -4,10 +4,14 @@ */ package eu.svjatoslav.sixth.e3d.gui; +import eu.svjatoslav.sixth.e3d.geometry.Point3D; +import eu.svjatoslav.sixth.e3d.math.Quaternion; + import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; +import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; @@ -20,6 +24,7 @@ import java.util.List; *

Opens as a popup window when F12 is pressed. Provides:

*