SceneCameraclass

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

object→SceneCamera
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.SceneCamera

Constructors1

Showing 1 constructors

public SceneCamera(string name = Unnamed)PUBLICCONSTRUCTOR

ParameterTypeDescription
name = Unnamedstring—

Methods9

Showing 9 methods

public virtual sealed void Dispose()PUBLICVIRTUAL

Returns:void—

public Vector2 ToScreenNormal(Vector3 world)PUBLIC

Convert from world coords to normal screen corrds. The results will be between 0 and 1

ParameterTypeDescription
worldVector3—
Returns:Vector2—

public Vector3 ToWorld(Vector2 screen)PUBLIC

Convert from screen coords to world coords on the near frustum plane.

ParameterTypeDescription
screenVector2—
Returns:Vector3—

Properties33

Showing 33 properties

public Color Sandbox.SceneCamera.AmbientLightColor { get; set; }PUBLICGETSET

The color of the ambient light. Set it to black for no ambient light, alpha is used for lerping between IBL and constant color.

Returns:Color—

public bool Sandbox.SceneCamera.AntiAliasing { get; set; }PUBLICGETSET

Enable or disable anti-aliasing for this render.

Returns:bool—

public Color Sandbox.SceneCamera.BackgroundColor { get; set; }PUBLICGETSET

Color the scene camera clears the render target to.

Returns:Color—

public System.Nullable`1<Matrix> Sandbox.SceneCamera.CustomProjectionMatrix { get; set; }PUBLICGETSET

Allows specifying a custom projection matrix for this camera

Returns:Nullable<Matrix>—

public bool Sandbox.SceneCamera.EnableDirectLighting { get; set; }PUBLICGETSET

Enable or disable direct lighting

Returns:bool—

public bool Sandbox.SceneCamera.EnableIndirectLighting { get; set; }PUBLICGETSET

Enable or disable indirect lighting

Returns:bool—

public bool Sandbox.SceneCamera.EnablePostProcessing { get; set; }PUBLICGETSET

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

Returns:bool—

public Sandbox.ITagSet Sandbox.SceneCamera.ExcludeTags { get; set; }PUBLICGETSET

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

Returns:ITagSet—

public float Sandbox.SceneCamera.FieldOfView { get; set; }PUBLICGETSET

The horizontal field of view of the Camera in degrees.

Returns:float—

public System.Nullable`1<Sandbox.Rendering.FogSetup> Sandbox.SceneCamera.Fog { get; set; }PUBLICGETSET

Camera-local fog resolved from Fog components. Null preserves the legacy gradient and cubemap fog. A disabled setup with full weight explicitly clears those fog layers. CameraComponent refreshes this value during rendering setup; use its Fog components for persistent settings or ViewSetup.Fog for an individual capture override.

Returns:Nullable<FogSetup>—

public string Sandbox.SceneCamera.Name { get; set; }PUBLICGETSET

The name of this camera.. for debugging purposes.

Returns:string—

public System.Action Sandbox.SceneCamera.OnRenderTransparent { get; set; }PUBLICGETSETOBSOLETE

Called when rendering the transparent pass

Obsolete: This API member is obsolete.

Returns:Action—

public bool Sandbox.SceneCamera.Ortho { get; set; }PUBLICGETSET

Whether to use orthographic projection.

Returns:bool—

public float Sandbox.SceneCamera.OrthoHeight { get; set; }PUBLICGETSET

Height of the ortho when `Sandbox.SceneCamera.Ortho` is enabled.

Returns:float—

public Sandbox.Rect Sandbox.SceneCamera.Rect { get; set; }PUBLICGETSET

The rect of the screen to render to. This is normalized, between 0 and 1.

Returns:Rect—

public Sandbox.ITagSet Sandbox.SceneCamera.RenderTags { get; set; }PUBLICGETSET

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

Returns:ITagSet—

public Vector2 Sandbox.SceneCamera.Size { get; set; }PUBLICGETSET

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

Returns:Vector2—

public Sandbox.StereoTargetEye Sandbox.SceneCamera.TargetEye { get; set; }PUBLICGETSET

The HMD eye that this camera is targeting. Use `Sandbox.StereoTargetEye.None` for the user's monitor (i.e. the companion window).

Returns:StereoTargetEye—

public bool Sandbox.SceneCamera.WantsStereoSubmit { get; set; }PUBLICGETSET

Set this to false if you don't want the stereo renderer to submit this camera's texture to the compositor. This option isn't considered if `Sandbox.SceneCamera.TargetEye` is `Sandbox.StereoTargetEye.None`.

Returns:bool—

public bool Sandbox.SceneCamera.WireframeMode { get; set; }PUBLICGETSET

Render this camera using a wireframe view.

Returns:bool—

public System.Collections.Generic.HashSet`1<Sandbox.SceneWorld> Sandbox.SceneCamera.Worlds { get; set; }PUBLICGETSET

Your camera can render multiple worlds.

Returns:HashSet<SceneWorld>—

public float Sandbox.SceneCamera.ZFar { get; set; }PUBLICGETSET

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.

Returns:float—

public float Sandbox.SceneCamera.ZNear { get; set; }PUBLICGETSET

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 z-fighting.

Returns:float—

On this page

Constructorspublic SceneCamera(System.String name = Unnamed)Methodspublic virtual sealed System.Void Dispose()public Sandbox.Frustum GetFrustum(Sandbox.Rect pixelRect, Vector3 screenSize)public Sandbox.Frustum GetFrustum(Sandbox.Rect pixelRect)public Ray GetRay(Vector2 cursorPosition, Vector3 screenSize)public Ray GetRay(Vector3 cursorPosition)public System.Boolean ToScreen(Vector3 world, Vector2 screen)public Vector2 ToScreen(Vector3 world)public Vector2 ToScreenNormal(Vector3 world)public Vector3 ToWorld(Vector2 screen)Propertiespublic Color Sandbox.SceneCamera.AmbientLightColor { get; set; }public Angles Sandbox.SceneCamera.Angles { get; set; }public System.Boolean Sandbox.SceneCamera.AntiAliasing { get; set; }public Sandbox.RenderAttributes Sandbox.SceneCamera.Attributes { get; set; }public Color Sandbox.SceneCamera.BackgroundColor { get; set; }public Sandbox.SceneCamera.BloomAccessor Sandbox.SceneCamera.Bloom { get; set; }public Sandbox.ClearFlags Sandbox.SceneCamera.ClearFlags { get; set; }public Sandbox.CubemapFogController Sandbox.SceneCamera.CubemapFog { get; set; }public System.Nullable`1<Matrix> Sandbox.SceneCamera.CustomProjectionMatrix { get; set; }public Sandbox.SceneCameraDebugMode Sandbox.SceneCamera.DebugMode { get; set; }public System.Boolean Sandbox.SceneCamera.EnableDirectLighting { get; set; }public System.Boolean Sandbox.SceneCamera.EnableIndirectLighting { get; set; }public System.Boolean Sandbox.SceneCamera.EnablePostProcessing { get; set; }public Sandbox.ITagSet Sandbox.SceneCamera.ExcludeTags { get; set; }public System.Single Sandbox.SceneCamera.FieldOfView { get; set; }public System.Nullable`1<Sandbox.Rendering.FogSetup> Sandbox.SceneCamera.Fog { get; set; }public System.String Sandbox.SceneCamera.Name { get; set; }public System.Action Sandbox.SceneCamera.OnRenderTransparent { get; set; }public System.Boolean Sandbox.SceneCamera.Ortho { get; set; }public System.Single Sandbox.SceneCamera.OrthoHeight { get; set; }public Vector3 Sandbox.SceneCamera.Position { get; set; }public Sandbox.Rect Sandbox.SceneCamera.Rect { get; set; }public Sandbox.ITagSet Sandbox.SceneCamera.RenderTags { get; set; }public Rotation Sandbox.SceneCamera.Rotation { get; set; }public Vector2 Sandbox.SceneCamera.Size { get; set; }public Sandbox.StereoTargetEye Sandbox.SceneCamera.TargetEye { get; set; }public Sandbox.VolumetricFogParameters Sandbox.SceneCamera.VolumetricFog { get; set; }public System.Boolean Sandbox.SceneCamera.WantsStereoSubmit { get; set; }public System.Boolean Sandbox.SceneCamera.WireframeMode { get; set; }public Sandbox.SceneWorld Sandbox.SceneCamera.World { get; set; }public System.Collections.Generic.HashSet`1<Sandbox.SceneWorld> Sandbox.SceneCamera.Worlds { get; set; }public System.Single Sandbox.SceneCamera.ZFar { get; set; }public System.Single Sandbox.SceneCamera.ZNear { get; set; }Metadata