Package com.j3d.engine.scene
Class SceneManager
java.lang.Object
com.j3d.engine.scene.SceneManager
SceneManager is the class. The main class that handles the rendering of 3D objects onto a 2D screen.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SelectionManagerThe current selection made by the user.private final Finderstatic final HistoryThe history manager for undo/redo functionality.An Array of Layersprivate HashMap<UUID, Consumer<Graphics2D>> A list of overlap Runnables to be executed after rendering such that it's on top of everything else.private final SceneRendererThe dimensions of the window.private final HashSet<HasParents<? extends GObject>> private final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaxis(Graphics2D g, Camera camera) Draws the 3D Cartesian axes (X, Y, Z) in the scene, relative to the camera's position.voidaxisGrid(Graphics2D g, Camera camera) voidclear(Graphics2D graphics) "Clears" the screen by drawing a white box over it.voidvoidvoiddraw(Graphics2D graphics) Draws all objects in all layers to the screen.voiddrawLine3D(Graphics2D g, Vector3 start, Vector3 end, Camera cam) voiddrawPoly3D(Graphics2D g, ArrayList<Vector3> points) voiddrawText3D(Graphics2D g, Vector3 location, String text, Camera cam) Draws 3D text at a specified location in the scene.voiddrawText3D(Graphics2D g, Vector3 location, String text, Camera cam, Color bgColor, Color fgColor) Draws 3D text at a specified location in the scene with custom background and foreground colors.voiddrawTriangle3D(Graphics2D graphics2D, Vector3 pos1, Vector3 pos2, Vector3 pos3) finder()Finds aThingwithin the scene by its name.findThingLayer(Thing objectParent) HashSet<HasParents<? extends GObject>> voidhasNoParent(HasParents<? extends GObject> g) voidhasParent(HasParents<? extends GObject> gObject) voidremoveFromParent(GObject o, Thing t) voidremoveOverlap(UUID id) voidremoveThing(Thing thing) voidResets the entire scene by clearing all layers, selections, and unregistering all triangles from theSceneRenderer.voidscheduleOverlap(UUID id, Consumer<Graphics2D> r) Schedules an overlap Runnable to be executed after rendering.select(SelectionQuery selectionQuery) Updates the current selection based on the providedSelectionQuery.voidvoidvoidsetClipboard(ArrayList<GObject> clipboard)
-
Field Details
-
screenSize
The dimensions of the window. -
layers
An Array of Layers -
points
-
unparented
-
clipboard
-
finder
-
renderer
-
currentSelection
The current selection made by the user. -
overlaps
A list of overlap Runnables to be executed after rendering such that it's on top of everything else. This is not for UI but mainly for debugging purposes. -
history
The history manager for undo/redo functionality. -
usable
- See Also:
-
-
Constructor Details
-
SceneManager
Default Constructor- Parameters:
dim- The dimensions of the screen
-
-
Method Details
-
finder
-
getRenderer
-
usableLayer
-
axisGrid
-
axis
Draws the 3D Cartesian axes (X, Y, Z) in the scene, relative to the camera's position. The length of the axes is scaled based on the camera's distance from the origin.- Parameters:
g- The Graphics2D object to draw on.camera- The camera instance used for perspective transformation.
-
drawLine3D
-
drawText3D
Draws 3D text at a specified location in the scene. -
drawText3D
public void drawText3D(Graphics2D g, Vector3 location, String text, Camera cam, Color bgColor, Color fgColor) Draws 3D text at a specified location in the scene with custom background and foreground colors.- Parameters:
g- The Graphics2D object to draw on.location- The 3DVector3coordinates where the text should be drawn.text- The string to be drawn.cam- TheCamerainstance used for perspective transformation.bgColor- The background color for the text box.fgColor- The foreground color for the text.
-
drawPoly3D
-
clear
"Clears" the screen by drawing a white box over it. -
draw
Draws all objects in all layers to the screen.- Parameters:
graphics- The Graphics2D object to draw on.
-
scheduleOverlap
Schedules an overlap Runnable to be executed after rendering.- Parameters:
r- The Runnable to execute.
-
removeOverlap
-
removeThing
- Parameters:
thing- TheThingto be removed.
-
select
Updates the current selection based on the providedSelectionQuery.This method modifies the current selection according to the type specified in the
selectionQuery:SelectionType.ALL: Selects all objects within the defined area.SelectionType.BOUNDS_STRICT: Selects objects fully contained within the selection boundaries.SelectionType.BOUNDS_SOFT: Selects objects that intersect with or are partially within the selection boundaries.SelectionType.SUBTRACT: Inverts the current selection, selecting unselected objects and deselecting selected ones.SelectionType.UNION: Adds objects from the new selection to the existing selection.SelectionType.INCLUDE: Adds objects from the new selection to the existing selection.SelectionType.EXCLUDE: Removes objects from the existing selection that are present in the new selection.
- Parameters:
selectionQuery- TheSelectionQuerydefining the selection criteria and type.
-
select
-
select
-
select
-
selectAll
public void selectAll() -
getSelected
-
deselectAll
public void deselectAll() -
select
-
getUnparented
-
hasNoParent
-
hasParent
-
setClipboard
-
getClipboard
-
clearClipboard
public void clearClipboard() -
findThing
Finds aThingwithin the scene by its name. -
findObjectParent
-
findThingLayer
-
resetScene
public void resetScene()Resets the entire scene by clearing all layers, selections, and unregistering all triangles from theSceneRenderer. This effectively returns the sceneManager to an empty state, ready for a new project or scene. -
drawTriangle3D
-
removeFromParent
-