Polycode::Scene Class Reference
3D rendering container.
More...
Inherits Polycode::EventDispatcher.
List of all members.
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.
|
Detailed Description
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.
Constructor & Destructor Documentation
Scene::Scene |
( |
bool |
virtualScene |
) |
|
Default constructor with options.
- Parameters:
-
| 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. |
Member Function Documentation
Adds a new SceneEntity to the scene.
- Parameters:
-
| entity | New entity to add. |
Adds a light to the scene.
- Parameters:
-
| light | Light to add to the scene. |
void Scene::enableFog |
( |
bool |
enable |
) |
|
Enables and disables fog in the scene.
- Parameters:
-
| enable | If false, disables lighting in the scene, if true, enables it. |
void Scene::enableLighting |
( |
bool |
enable |
) |
|
Enables and disables lighting in the scene.
- Parameters:
-
| enable | If false, disables lighting in the scene, if true, enables it. |
Camera * Scene::getActiveCamera |
( |
|
) |
|
Returns the scene's active camera.
- Returns:
- The scene's active camera.
Camera * Scene::getDefaultCamera |
( |
|
) |
|
Returns the scene's default camera.
- 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.
- Parameters:
-
| x | X position. |
| y | Y position. |
- Returns:
- Entity at specified screen position.
void Scene::removeEntity |
( |
SceneEntity * |
entity |
) |
[virtual] |
Removes a SceneEntity from the scene.
- Parameters:
-
| entity | New entity to remove. |
Removes a light from the scene.
- Parameters:
-
| light | Light to remove from the scene. |
void Scene::setActiveCamera |
( |
Camera * |
camera |
) |
|
Sets the scene's active camera.
- Parameters:
-
| 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.
- Parameters:
-
| 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. |
Member Data Documentation
If set to true, camera will be deleted when the screen is deleted.
Defaults true, automatically set false when a camera passed in.