Package rayrangers.raytracer.world
Class Scene
java.lang.Object
rayrangers.raytracer.world.Scene
- All Implemented Interfaces:
Hittable
Represents the scene to be rendered.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a camera with a unique UUID if it has not been added yet.void
Adds a new entity to the map of entities.boolean
addLightSource
(LightSource lightSource) Adds a light source with a unique UUID if it has not been added yet.Returns the background color of the scene.Returns a map of all cameras in the scene.Returns a map of all entites in the scene.getEntityByUuid
(UUID uuid) Returns the entity from the map with the given UUID.Returns a map of all light sources in the scene.boolean
Checks if a ray has a hit in the specified interval [t0;t1].
-
Constructor Details
-
Scene
Constructs a scene with the specified background color.- Parameters:
backgroundColor
- background color
-
-
Method Details
-
addEntity
Adds a new entity to the map of entities.- Parameters:
entity
- entity to add
-
getEntityByUuid
Returns the entity from the map with the given UUID.- Parameters:
uuid
- UUID to search for- Returns:
- associated entity
-
getBackgroundColor
Returns the background color of the scene.- Returns:
- background color
-
getEntities
Returns a map of all entites in the scene.- Returns:
- map of entities
-
getCameras
Returns a map of all cameras in the scene.- Returns:
- map of cameras
-
getLightSources
Returns a map of all light sources in the scene.- Returns:
- map of light sources
-
addCamera
Adds a camera with a unique UUID if it has not been added yet.- Parameters:
camera
- camera to add- Returns:
- true if camera has not been added yet, otherwise false
-
addLightSource
Adds a light source with a unique UUID if it has not been added yet.- Parameters:
lightSource
- light source to add- Returns:
- true if light source has not been added yet, otherwise false.
-
hit
Description copied from interface:Hittable
Checks if a ray has a hit in the specified interval [t0;t1].
-