SceneCamera
Sandbox.Engine
Derives from object

Summary

Represents a camera and holds render hooks. This camera can be used to draw tool windows and scene panels.

Constructors

SceneCamera( string name = "Unnammed", )

Properties

Color AmbientLightColor { get; set; }

The color of the ambient light. Set it to black for no ambient light.

Angles Angles { get; set; }

The rotation of the scene's camera.

bool AntiAliasing { get; set; }

Enable or disable anti-aliasing for this render.

Color BackgroundColor { get; set; }

Color the scene camera clears the render target to.

bool EnablePostProcessing { get; set; }

Toggle all post processing effects for this camera. The default is on.

ITagSet ExcludeTags { get; }

Scene objects with any of these tags won't be rendered by this camera.

float FieldOfView { get; set; }

The horizontal field of view of the Camera in degrees.

IEntity FirstPersonViewer { get; set; }

The entity that we're viewing from (if applicable)

bool IsMainCamera { get; }

Returns true if this is the main game camera, on which game UI is drawn

string Name { get; set; }

The name of this camera.. for debugging purposes.

bool Ortho { get; set; }

Whether to use orthographic projection.

float OrthoHeight { get; set; }

Height of the ortho when SceneCamera.Ortho is enabled.

float OrthoWidth { get; set; }

Width of the ortho when SceneCamera.Ortho is enabled.

Vector3 Position { get; set; }

The position of the scene's camera.

IEnumerable<RenderHook> RenderHooks { get; }

List of active render hooks on this scene camera.

ITagSet RenderTags { get; }

Only scene objects with one of these tags will be rendered by this camera.

Rotation Rotation { get; set; }

The rotation of the scene's camera.

Vector2 Size { get; set; }

The size of the screen. Allows us to work out aspect ratio. For now will get updated automatically on render.

SceneWorld World { get; set; }

The world we're going to render.

HashSet<SceneWorld> Worlds { get; }

Your camera can render multiple worlds.

float ZFar { get; set; }

The camera's zFar distance. This is the furthest distance this camera will be able to render. This value totally depends on the game you're making. Shorter the better, sensible ranges would be between about 1000 and 30000, but if you want it to be further out you can balance that out by making znear larger.

float ZNear { get; set; }

The camera's zNear distance. This is the closest distance this camera will be able to render. A good value for this is about 5. Below 5 and particularly below 1 you're going to start to see a lot of artifacts like zfighting.

Methods

void AddHook( RenderHook value, )

Add a specific render hook to this camera.

T FindHook<T,>( )

Find a hook that matches the type, or null

RenderHook FindHook( Type t, )

Find a hook that matches the type, or null

T FindOrCreateHook<T,>( )

Find a hook that matches T, if not found then create and return

Ray GetRay( Vector3 cursorPosition, )

Given a cursor position get a scene aiming ray.

Ray GetRay( Vector3 cursorPosition, Vector3 screenSize, )

Given a cursor position get a scene aiming ray.

int RemoveAllHooks<T,>( )

Remove all hooks of type, return the amount of hooks removed

Remove all hooks, return the amount removed

void RemoveHook( RenderHook value, )

Remove a specific render hook from this camera.

void SetViewModelCamera( float viewModelFieldOfView, float viewModelZNear = 1, float viewModelZFar = 500, )

Set attributes for rendering the viewmodel's camera.

Vector2 ToScreen( Vector3 world, )

Convert from world coords to screen coords

override string ToString( )
Overrides Object.ToString

Extensions

bool RenderToPixmap( Pixmap targetPixmap, bool async = false, )

Render this camera to the target widget. Once you do this the target widget becomes "externally painted", so you won't be able to paint on it anymore with Qt's Paint stuff.

Nested Types