sixth-3d.git
25 hours agofeat: unify polygon type for CSG and rendering feat master
Svjatoslav Agejenko [Mon, 30 Mar 2026 16:44:01 +0000 (19:44 +0300)]
feat: unify polygon type for CSG and rendering

Extend SolidPolygon to support N-vertex convex polygons, enabling
direct use in CSG operations without triangulation. Move CSG boolean
operations (union, subtract, intersect) from the standalone CSG class
to AbstractCompositeShape for in-place modifications with simpler API.

- SolidPolygon now handles arbitrary convex polygons via fan triangulation
- CSG operations work directly on SolidPolygon, eliminating CSGPolygon
- Add chainable setters to AbstractCompositeShape for fluent API
- Add non-mutating methods to Point2D/Point3D/Transform
- Rename TexturedPolygon to TexturedTriangle for consistency
- Fix vertex cloning, polygon validation, collinear point detection
- Use ThreadLocal fields for thread-safe rendering state

3 days agofeat(csg): add constructive solid geometry with BSP tree boolean operations
Svjatoslav Agejenko [Sat, 28 Mar 2026 12:47:12 +0000 (14:47 +0200)]
feat(csg): add constructive solid geometry with BSP tree boolean operations

Add a complete CSG system that enables boolean operations (union, subtract,
intersect) on 3D solids using BSP trees. The implementation includes:

- CSG class with union/subtract/intersect/inverse operations
- CSGNode BSP tree for spatial partitioning and polygon clipping
- CSGPlane for polygon classification and splitting
- CSGPolygon N-gon type for BSP operations
- PolygonType enum for vertex classification

Integration with existing shapes via:
- extractSolidPolygons() method on AbstractCompositeShape
- SolidPolygonMesh composite for rendering CSG results
- CSG.fromCompositeShape() factory for converting existing primitives

Also includes supporting refactorings: rename coordinates field to vertices
for consistency, simplified constructors for arrow shapes with auto-calculated
tip dimensions, and Point3D/Vertex enhancements for vector math.

5 days agofeat(shapes): add directional arrow, cone shapes with arbitrary orientation
Svjatoslav Agejenko [Wed, 25 Mar 2026 19:18:25 +0000 (21:18 +0200)]
feat(shapes): add directional arrow, cone shapes with arbitrary orientation

Add SolidPolygonArrow combining cylinder body with conical tip, pointing
from start to end point. Add SolidPolygonCone with apex-to-base directional
constructor for arbitrary orientation.

Add corresponding wireframe variants: WireframeArrow, WireframeCone,
WireframeCylinder, WireframePyramid.

Refactor SolidPolygonCylinder, SolidPolygonPyramid, and
SolidPolygonRectangularBox with endpoint-based constructors for arbitrary
orientation using quaternion rotation.

Optimize Billboard.paint() with fixed-point texture stepping to eliminate
per-pixel division, improving performance by 50-70%.

Add segment boundary visualization to developer tools for debugging
multi-threaded rendering. Add custom title support to ViewFrame.

Document the left-handed coordinate system with Y-down convention.

8 days agofeat(math,gui): add full euler rotation and developer camera tools
Svjatoslav Agejenko [Mon, 23 Mar 2026 18:30:37 +0000 (20:30 +0200)]
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.

8 days agofeat(engine): add DiamondSquare and improve rendering architecture
Svjatoslav Agejenko [Sun, 22 Mar 2026 19:10:55 +0000 (21:10 +0200)]
feat(engine): add DiamondSquare and improve rendering architecture

Add DiamondSquare algorithm for procedural terrain heightmap generation.
Merge Rotation class into Quaternion for unified rotation handling.
Introduce global LightingManager in ViewPanel for scene-wide lighting.
Fix text rendering to use per-segment Graphics2D for proper clipping.
Fix raytracer camera frame to use inverse rotation.
Add comprehensive documentation for perspective-correct texture mapping.
Simplify debug log buffer by removing passthrough feature.

Squashed commits:
- fix(raytracer): use inverse rotation when placing camera frame
- refactor(gui): remove stdout passthrough from debug log buffer
- fix(render): use per-segment Graphics2D to clip text rendering
- docs: add CUSTOM_ID properties to all org-mode sections
- feat(math): add DiamondSquare algorithm and document composite shape fields
- refactor(gui): improve developer tools and composite shape logging
- refactor(lighting): use global LightingManager in ViewPanel
- refactor(math): merge Rotation into Quaternion
- docs: move perspective texture docs to dedicated directory

10 days agorefactor(math): simplify Rotation API to use quaternions exclusively
Svjatoslav Agejenko [Fri, 20 Mar 2026 20:51:50 +0000 (22:51 +0200)]
refactor(math): simplify Rotation API to use quaternions exclusively

10 days agofeat(math): add Matrix3x3 and Quaternion for 3D transformations
Svjatoslav Agejenko [Fri, 20 Mar 2026 20:51:42 +0000 (22:51 +0200)]
feat(math): add Matrix3x3 and Quaternion for 3D transformations

- Add Matrix3x3 class for 3D transformations
- Add toMatrix method to Rotation with test
- Use matrix for point transformation
- Cache transformation matrix for performance
- Add Quaternion class for 3D rotations
- Use quaternion internally instead of Euler angles
- Use quaternion-based camera rotation
- Use rotation matrix for movement direction
- Use quaternion for lookAt rotation

10 days agodocs: add TODO roadmap
Svjatoslav Agejenko [Fri, 20 Mar 2026 20:51:34 +0000 (22:51 +0200)]
docs: add TODO roadmap

- Add comprehensive TODO roadmap with organized sections
- Consolidate future ideas into TODO.org
- Remove outdated ideas and simplify structure

10 days agoperf: optimize texture rendering and scanlines
Svjatoslav Agejenko [Fri, 20 Mar 2026 20:51:28 +0000 (22:51 +0200)]
perf: optimize texture rendering and scanlines

- Optimize scanline texture coordinate interpolation
- Optimize texture sampling and add alpha blending
- Optimize mipmap downsampling/upsampling with direct pixel ops
- Fix y-coordinate swap in drawRectangle
- Use Arrays.fill for fillColor and opaque scanlines

10 days agofeat: add debug tools and documentation
Svjatoslav Agejenko [Fri, 20 Mar 2026 20:51:20 +0000 (22:51 +0200)]
feat: add debug tools and documentation

- Add F12 debug panel with toggleable diagnostic features
- Add alternate segments rendering for overdraw detection
- Add WindingOrderDemo example
- Add comprehensive Javadoc to geometry and shape classes
- Add rendering loop documentation with screenshots
- Add package-info.java for all major packages
- Rename DebugSettings to DeveloperTools
- Fix frame number tracking and buffer strategy initialization

2 weeks agoInitial commit
Svjatoslav Agejenko [Sun, 15 Mar 2026 01:15:47 +0000 (03:15 +0200)]
Initial commit