Polycode
|
3D rendering container. More...
Inherits Polycode::EventDispatcher.
Public Member Functions | |
Scene () | |
Default constructor. | |
Scene (bool virtualScene) | |
Default constructor with options. | |
void | addEntity (SceneEntity *entity) |
Adds a new SceneEntity to the scene. | |
virtual void | removeEntity (SceneEntity *entity) |
Removes a SceneEntity from the scene. | |
Camera * | getDefaultCamera () |
Returns the scene's default camera. | |
Camera * | getActiveCamera () |
Returns the scene's active camera. | |
void | setActiveCamera (Camera *camera) |
Sets the scene's active camera. | |
void | enableLighting (bool enable) |
Enables and disables lighting in the scene. | |
void | enableFog (bool enable) |
Enables and disables fog in the scene. | |
void | setFogProperties (int fogMode, Color color, Number density, Number startDepth, Number endDepth) |
Sets the fog properties for the scene. | |
SceneEntity * | getEntityAtScreenPosition (Number x, Number y) |
Returns the entity at the specified screen position. | |
void | addLight (SceneLight *light) |
Adds a light to the scene. | |
void | removeLight (SceneLight *light) |
Removes a light from the scene. | |
Public Attributes | |
Color | clearColor |
Scene clear color. | |
bool | useClearColor |
If set to true, the renderer will use the scene's clear color when rendering the scene. | |
Color | ambientColor |
Ambient color, passed to lighting shaders. | |
Color | fogColor |
Fog color, passed to lighting shaders. | |
bool | enabled |
If this is set to false, the scene is not rendered or updated during the render loop. | |
bool | ownsChildren |
If ownsChildren is set to true, the scene will delete its children upon destruction (defaults to false). | |
bool | ownsCamera |
If set to true, camera will be deleted when the screen is deleted. |
3D rendering container.
The Scene class is the main container for all 3D rendering in Polycode. Scenes are automatically rendered and need only be instantiated to immediately add themselves to the rendering pipeline. A Scene is created with a camera automatically.
Scene::Scene | ( | bool | virtualScene | ) |
Default constructor with options.
virtualScene | If this flag is set to true, the scene is not rendered to the screen. Use this if you want to render the scene only to a texture. |
void Scene::addEntity | ( | SceneEntity * | entity | ) |
Adds a new SceneEntity to the scene.
entity | New entity to add. |
void Scene::addLight | ( | SceneLight * | light | ) |
Adds a light to the scene.
light | Light to add to the scene. |
void Scene::enableFog | ( | bool | enable | ) |
Enables and disables fog in the scene.
enable | If false, disables lighting in the scene, if true, enables it. |
void Scene::enableLighting | ( | bool | enable | ) |
Enables and disables lighting in the scene.
enable | If false, disables lighting in the scene, if true, enables it. |
Camera * Scene::getActiveCamera | ( | ) |
Returns the scene's active camera.
Camera * Scene::getDefaultCamera | ( | ) |
Returns the scene's default camera.
SceneEntity * Scene::getEntityAtScreenPosition | ( | Number | x, |
Number | y | ||
) |
Returns the entity at the specified screen position.
This is currently very slow and not super reliable.
x | X position. |
y | Y position. |
void Scene::removeEntity | ( | SceneEntity * | entity | ) | [virtual] |
Removes a SceneEntity from the scene.
entity | New entity to remove. |
void Scene::removeLight | ( | SceneLight * | light | ) |
Removes a light from the scene.
light | Light to remove from the scene. |
void Scene::setActiveCamera | ( | Camera * | camera | ) |
Sets the scene's active camera.
camera | New camera to set as the active camera. |
void Scene::setFogProperties | ( | int | fogMode, |
Color | color, | ||
Number | density, | ||
Number | startDepth, | ||
Number | endDepth | ||
) |
Sets the fog properties for the scene.
fogMode | Fog falloff mode. (Renderer::FOG_LINEAR, Renderer::FOG_EXP, Renderer::FOG_EXP2). |
color | Fog color. |
density | Fog density. |
startDepth | Starting depth of the fog. |
endDepth | Ending depth of the fog. |
If set to true, camera will be deleted when the screen is deleted.
Defaults true, automatically set false when a camera passed in.