java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
eu.svjatoslav.sixth.e3d.examples.terrain_demo.Branch

public class Branch extends eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
A recursive branch that can contain sub-branches.

Demonstrates hierarchical transforms in Sixth 3D: each branch has its own transform (position + rotation), and sub-branches are added as child composites. The engine automatically propagates parent transforms to children via TransformStack.

Each branch wobbles around its local axes with random phase offsets. Parent wobble is automatically inherited by children, creating cascading motion.

See Also:
  • Field Summary

    Fields inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape

    cachedBoundingBox, mouseInteractionController
  • Constructor Summary

    Constructors
    Constructor
    Description
    Branch(eu.svjatoslav.sixth.e3d.geometry.Point3D startPosition, int level, int branchIndex, double parentHeight, double parentRadius)
    Creates a branch with optional recursive sub-branches.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    beforeTransformHook(eu.svjatoslav.sixth.e3d.math.TransformStack transformPipe, eu.svjatoslav.sixth.e3d.gui.RenderingContext context)
    Animates this branch with wobble around its local axes.

    Methods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape

    addShape, addShape, extractSolidPolygons, getBoundingBox, getGroup, getLocation, getSubShapesRegistry, getTransform, getViewSpaceTracker, hideGroup, intersect, removeGroup, setBackfaceCulling, setCacheNeedsRebuild, setColor, setGroupForUngrouped, setMouseInteractionController, setRootComposite, setShadingEnabled, setTransform, showGroup, subtract, transform, union

    Methods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape

    invalidateBounds

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Branch

      public Branch(eu.svjatoslav.sixth.e3d.geometry.Point3D startPosition, int level, int branchIndex, double parentHeight, double parentRadius)
      Creates a branch with optional recursive sub-branches.

      The branch is positioned at the given start point relative to its parent. In local coordinates, the branch cylinder extends from origin to a calculated endpoint. The Transform positions and rotates this local geometry.

      Parameters:
      startPosition - position relative to parent where this branch attaches
      level - recursion level (0 = first branch level, 1 = sub-branches)
      branchIndex - index among siblings (0, 1, or 2) determines angle around parent
      parentHeight - height of parent (for scaling this branch)
      parentRadius - radius of parent (for scaling this branch)
  • Method Details

    • beforeTransformHook

      public void beforeTransformHook(eu.svjatoslav.sixth.e3d.math.TransformStack transformPipe, eu.svjatoslav.sixth.e3d.gui.RenderingContext context)
      Animates this branch with wobble around its local axes.

      Parent's wobble is automatically inherited via TransformStack - no special code needed. Each branch adds its own wobble contribution, creating cascading motion that flows down the tree structure.

      The wobble is added to the base orientation, so the branch oscillates around its default outward-facing position.

      Overrides:
      beforeTransformHook in class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
      Parameters:
      transformPipe - the current transform stack (contains parent transforms)
      context - the rendering context with frame number for animation