Search Results for

    Show / Hide Table of Contents

    Class Camera

    Describes the camera projection and view. Provides information about how to render scene (viewport location and direction, etc.).

    Inheritance
    Object
    ScriptingObject
    SceneObject
    Actor
    Camera
    Inherited Members
    Actor::_box
    Actor::_drawCategory
    Actor::_drawNoCulling
    ScriptingObject::_gcHandle
    ScriptingObject::_id
    Actor::_isActive
    Actor::_isActiveInHierarchy
    Actor::_isEnabled
    Actor::_isHierarchyDirty
    Actor::_isPrefabRoot
    Actor::_layer
    Actor::_localTransform
    Actor::_name
    SceneObject::_parent
    Actor::_physicsScene
    SceneObject::_prefabID
    SceneObject::_prefabObjectID
    Actor::_scene
    Actor::_sphere
    Actor::_staticFlags
    Actor::_transform
    ScriptingObject::_type
    Actor::AddMovement(const Vector3& translation)
    Actor::AddMovement(const Vector3& translation, const Quaternion& rotation)
    Actor::AddScript()
    Actor::AddStaticFlags(StaticFlags flags)
    Actor::AddTag(const Tag& tag)
    Actor::AddTagRecursive(const Tag& tag)
    Camera
    Actor::BreakPrefabLink()
    ScriptingObject::CanCast(const ScriptingTypeHandle& from, const ScriptingTypeHandle& to)
    ScriptingObject::CanCast(const MClass* from, const MClass* to)
    ScriptingObject::Cast(ScriptingObject* obj)
    ScriptingObject::ChangeID(const Guid& newId)
    Actor::ChangeScriptOrder(Script* script, int32 newIndex)
    Actor::Children
    Actor::Clone()
    ScriptingObject::CreateManaged()
    ScriptingObject::CreateManagedInternal()
    ScriptingObject::Deleted
    Object::DeleteObject(float timeToLive = 0.0f, bool useGameTime=false)
    Object::DeleteObjectNow()
    Actor::DEPRECATED("Use HasTag instead") const String& GetTag()
    Actor::DEPRECATED("Use AddTag instead") void SetTag(const StringView& value)
    ISerializable::DeserializeIfExists(DeserializeStream& stream, const char* memberName, ISerializeModifier* modifier)
    Camera
    Actor::DestroyChildren(float timeLeft = 0.0f)
    ScriptingObject::DestroyManaged()
    Actor::Draw(RenderContextBatch& renderContextBatch)
    Actor::EndPlay()
    Actor::FindActor(const StringView& name)
    Actor::FindActor(const MClass* type, bool activeOnly=false)
    Actor::FindActor(const MClass* type, const StringView& name)
    Actor::FindActor(const MClass* type, const Tag& tag, bool activeOnly=false)
    Actor::FindActor()
    Actor::FindActor(const Tag& tag)
    Actor::FindScript(const MClass* type)
    Actor::FindScript()
    Object::Flags
    Actor::FromBytes(const Span<byte>& data, Array<Actor* >& output, ISerializeModifier* modifier)
    Actor::FromBytes(const Span<byte>& data)
    Actor::FromBytes(const Span<byte>& data, const Dictionary<Guid, Guid, HeapAllocation>& idsMapping)
    ScriptingObject::FromInterface(void* interfaceObj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::FromInterface(T* interfaceObj)
    Actor::FromJson(const StringAnsiView& json)
    Actor::GetBox()
    Actor::GetBoxWithChildren()
    Actor::GetChild(int32 index)
    Actor::GetChild(const StringView& name)
    Actor::GetChild(const MClass* type)
    Actor::GetChild()
    Actor::GetChildren(const MClass* type)
    Actor::GetChildren()
    Actor::GetChildrenCount()
    ScriptingObject::GetClass()
    Actor::GetDirection()
    Actor::GetEditorBoxChildren()
    ScriptingObject::GetID()
    Actor::GetIsActive()
    Actor::GetLayer()
    Actor::GetLayerMask()
    Actor::GetLayerName()
    Actor::GetLocalOrientation()
    Actor::GetLocalPosition()
    Actor::GetLocalScale()
    Actor::GetLocalToWorldMatrix(Matrix& localToWorld)
    Actor::GetLocalToWorldMatrix(Double4x4& localToWorld)
    Actor::GetLocalTransform()
    ScriptingObject::GetManagedInstance()
    Actor::GetName()
    SceneObject::GetNamePath(Char separatorChar='/')
    Actor::GetOrAddChild()
    ScriptingObject::GetOrCreateManagedInstance()
    Actor::GetOrderInParent()
    Actor::GetOrientation()
    SceneObject::GetParent()
    Actor::GetPerInstanceRandom()
    Actor::GetPhysicsScene()
    Actor::GetPosition()
    SceneObject::GetPrefabID()
    SceneObject::GetPrefabObjectID()
    Actor::GetPrefabRoot()
    Actor::GetRotation()
    Actor::GetScale()
    Actor::GetScene()
    Actor::GetSceneObjectId()
    Actor::GetSceneRendering()
    Actor::GetScript(int32 index)
    Actor::GetScript(const MClass* type)
    Actor::GetScript()
    Actor::GetScriptByID(const Guid& id)
    Actor::GetScripts(const MClass* type)
    Actor::GetScripts()
    Actor::GetScriptsCount()
    Actor::GetSphere()
    Actor::GetStaticFlags()
    Actor::GetTransform()
    ScriptingObject::GetType()
    ScriptingObject::GetTypeHandle()
    Actor::GetWorldToLocalMatrix(Matrix& worldToLocal)
    Actor::GetWorldToLocalMatrix(Double4x4& worldToLocal)
    Actor::HasActorInChildren(Actor* a)
    Actor::HasActorInHierarchy(Actor* a)
    ScriptingObject::HasManagedInstance()
    SceneObject::HasParent()
    SceneObject::HasPrefabLink()
    Actor::HasScene()
    Actor::HasStaticFlag(StaticFlags flag)
    Actor::HasTag()
    Actor::HasTag(const Tag& tag)
    Actor::HasTag(const StringView& tag)
    Actor::HideFlags
    Actor::Initialize()
    Actor::InitializeHierarchy()
    Actor::Intersects(const Ray& ray, Real& distance, Vector3& normal)
    Actor::IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
    ScriptingObject::Is(const ScriptingTypeHandle& type)
    ScriptingObject::Is(const MClass* type)
    ScriptingObject::Is()
    Actor::IsActiveInHierarchy()
    SceneObject::IsDuringPlay()
    Actor::IsPrefabRoot()
    ScriptingObject::IsRegistered()
    Actor::IsStatic()
    Actor::IsTransformStatic()
    Actor::LinkPrefab(const Guid& prefabId, const Guid& prefabObjectId)
    Actor::LookAt(const Vector3& worldPos)
    Actor::LookAt(const Vector3& worldPos, const Vector3& worldUp)
    Actor::LookingAt(const Vector3& worldPos)
    Actor::LookingAt(const Vector3& worldPos, const Vector3& worldUp)
    ScriptingObject::NewObject(const ScriptingTypeHandle& typeHandle)
    ScriptingObject::NewObject()
    Actor::OnActiveChanged()
    Actor::OnActiveInTreeChanged()
    Actor::OnBeginPlay()
    Actor::OnDebugDraw()
    Actor::OnDeleteObject()
    Actor::OnEndPlay()
    Actor::OnLayerChanged()
    ScriptingObject::OnManagedInstanceDeleted()
    Actor::OnOrderInParentChanged()
    Actor::OnParentChanged()
    Actor::OnPhysicsSceneChanged(PhysicsScene* previous)
    ScriptingObject::OnScriptingDispose()
    Actor::OnStaticFlagsChanged()
    ScriptingObject::RegisterObject()
    Actor::RemoveStaticFlags(StaticFlags flags)
    Actor::RemoveTag(const Tag& tag)
    Actor::ResetLocalTransform()
    SceneObject::SceneObject(const SpawnParams& params)
    ScriptingObject::ScriptingObject(const SpawnParams& params)
    Actor::Scripts
    Camera
    Camera
    Actor::SetDirection(const Float3& value)
    Actor::SetIsActive(bool value)
    Actor::SetLayer(int32 layerIndex)
    Actor::SetLayerName(const StringView& value)
    Actor::SetLayerNameRecursive(const StringView& value)
    Actor::SetLayerRecursive(int32 layerIndex)
    Actor::SetLocalOrientation(const Quaternion& value)
    Actor::SetLocalPosition(const Vector3& value)
    Actor::SetLocalScale(const Float3& value)
    Actor::SetLocalTransform(const Transform& value)
    ScriptingObject::SetManagedInstance(MObject* instance)
    Actor::SetName(String&& value)
    Actor::SetName(const StringView& value)
    Actor::SetOrderInParent(int32 index)
    Actor::SetOrientation(const Quaternion& value)
    Actor::SetParent(Actor* value, bool worldPositionsStays, bool canBreakPrefabLink)
    Actor::SetParent(Actor* value, bool canBreakPrefabLink=true)
    SceneObject::SetParent(Actor* value)
    Actor::SetPhysicsScene(PhysicsScene* scene)
    Actor::SetPosition(const Vector3& value)
    Actor::SetRotation(const Matrix& value)
    Actor::SetScale(const Float3& value)
    Actor::SetStaticFlag(StaticFlags flag, bool value)
    Actor::SetStaticFlags(StaticFlags value)
    Actor::SetTransform(const Transform& value)
    Camera
    Actor::Tags
    Actor::ToBytes(const Array<Actor* >& actors, MemoryWriteStream& output)
    Actor::ToBytes(const Array<Actor* >& actors)
    ScriptingObject::ToInterface(ScriptingObject* obj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::ToInterface(ScriptingObject* obj)
    Actor::ToJson()
    ScriptingObject::ToManaged(const ScriptingObject* obj)
    ScriptingObject::ToNative(MObject* obj)
    Actor::ToString()
    Actor::TreeExecute(Function<bool(Actor* , Params ...)>& action, Params ... args)
    Actor::TreeExecuteChildren(Function<bool(Actor* , Params ...)>& action, Params ... args)
    Actor::TryGetSerializedObjectsIds(const Span<byte>& data)
    ScriptingObject::UnregisterObject()
    Actor::UnregisterObjectHierarchy()
    ISerializable::~ISerializable()
    Object::~Object()
    SceneObject::~SceneObject()
    ScriptingObject::~ScriptingObject()
    Assembly: FlaxEngine.dll
    File: Engine/Level/Actors/Camera.h
    Syntax
    public class Camera : public Actor

    Fields

    RenderFlags

    Frame rendering flags used to switch between graphics features for this camera.

    Declaration
    public ViewFlags RenderFlags = ViewFlags::DefaultGame
    Field Value
    ViewFlags

    RenderLayersMask

    The layers mask used for rendering using this camera. Can be used to include or exclude specific actor layers from the drawing.

    Declaration
    public LayersMask RenderLayersMask
    Field Value
    LayersMask

    RenderMode

    Describes frame rendering modes for this camera.

    Declaration
    public ViewMode RenderMode = ViewMode::Default
    Field Value
    ViewMode

    Methods

    BeginPlay(SceneBeginData* data)

    Called when adding object to the game.

    Declaration
    protected virtual void BeginPlay(SceneBeginData* data) override
    Parameters
    SceneBeginData data

    The initialization data (e.g. used to collect joints to link after begin).

    Overrides
    Actor::BeginPlay(SceneBeginData* data)

    ConvertMouseToRay(const Float2& mousePosition)

    Converts the mouse position to 3D ray.

    Declaration
    public Ray ConvertMouseToRay(const Float2& mousePosition) const
    Parameters
    Float2 mousePosition

    The mouse position.

    Returns
    Ray

    Mouse ray

    ConvertMouseToRay(const Float2& mousePosition, const Viewport& viewport)

    Converts the mouse position to 3D ray.

    Declaration
    public Ray ConvertMouseToRay(const Float2& mousePosition, const Viewport& viewport) const
    Parameters
    Float2 mousePosition

    The mouse position.

    Viewport viewport

    The viewport.

    Returns
    Ray

    Mouse ray

    Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)

    Deserializes object from the input stream.

    Declaration
    public virtual void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override
    Parameters
    DeserializeStream stream

    The input stream.

    ISerializeModifier modifier

    The deserialization modifier object. Always valid.

    Overrides
    Actor::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)

    Draw(RenderContext& renderContext)

    Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. geometry is rendered during all pass types but other actors are drawn only during GBufferFill pass).

    Declaration
    public virtual void Draw(RenderContext& renderContext) override
    Parameters
    RenderContext renderContext

    The rendering context.

    Overrides
    Actor::Draw(RenderContext& renderContext)

    GetCustomAspectRatio()

    Gets the custom aspect ratio. 0 if not use custom value.

    Declaration
    public float GetCustomAspectRatio() const
    Returns
    float

    GetEditorBox()

    Gets actor bounding box (single actor, no children included) for editor tools.

    Declaration
    public virtual BoundingBox GetEditorBox() const override
    Returns
    BoundingBox

    Overrides
    Actor::GetEditorBox()

    GetFarPlane()

    Gets camera's far plane distance.

    Declaration
    public float GetFarPlane() const
    Returns
    float

    GetFieldOfView()

    Gets the camera's field of view (in degrees).

    Declaration
    public float GetFieldOfView() const
    Returns
    float

    GetFrustum()

    Gets the frustum.

    Declaration
    public BoundingFrustum GetFrustum() const
    Returns
    BoundingFrustum

    GetMatrices(Matrix& view, Matrix& projection)

    Calculates the view and the projection matrices for the camera.

    Declaration
    public void GetMatrices(Matrix& view, Matrix& projection) const
    Parameters
    Matrix view

    The result camera view matrix.

    Matrix projection

    The result camera projection matrix.

    GetMatrices(Matrix& view, Matrix& projection, const Viewport& viewport)

    Calculates the view and the projection matrices for the camera. Support using custom viewport.

    Declaration
    public void GetMatrices(Matrix& view, Matrix& projection, const Viewport& viewport) const
    Parameters
    Matrix view

    The result camera view matrix.

    Matrix projection

    The result camera projection matrix.

    Viewport viewport

    The custom output viewport.

    GetMatrices(Matrix& view, Matrix& projection, const Viewport& viewport, const Vector3& origin)

    Calculates the view and the projection matrices for the camera. Support using custom viewport and view origin.

    Declaration
    public void GetMatrices(Matrix& view, Matrix& projection, const Viewport& viewport, const Vector3& origin) const
    Parameters
    Matrix view

    The result camera view matrix.

    Matrix projection

    The result camera projection matrix.

    Viewport viewport

    The custom output viewport.

    Vector3 origin

    The rendering view origin (for relative-to-camera rendering).

    GetNearPlane()

    Gets camera's near plane distance.

    Declaration
    public float GetNearPlane() const
    Returns
    float

    GetOrthographicScale()

    Gets the orthographic projection scale.

    Declaration
    public float GetOrthographicScale() const
    Returns
    float

    GetOrthographicSize()

    Gets the orthographic projection view height (width is based on the aspect ratio). Use 0 for size to be based on the viewport size.

    Declaration
    public float GetOrthographicSize() const
    Returns
    float

    GetUsePerspective()

    Gets the value indicating if camera should use perspective rendering mode, otherwise it will use orthographic projection.

    Declaration
    public bool GetUsePerspective() const
    Returns
    bool

    GetViewport()

    Gets the camera viewport.

    Declaration
    public Viewport GetViewport() const
    Returns
    Viewport

    HasContentLoaded()

    Returns true if actor has loaded content.

    Declaration
    public virtual bool HasContentLoaded() const override
    Returns
    bool

    Overrides
    Actor::HasContentLoaded()

    IntersectsItselfEditor(const Ray& ray, Real& distance)

    Declaration
    public bool IntersectsItselfEditor(const Ray& ray, Real& distance)
    Parameters
    Ray ray

    Real distance

    Returns
    bool

    IsPointOnView(const Vector3& worldSpaceLocation)

    Checks if the 3d point of the world is in the camera's field of view.

    Declaration
    public bool IsPointOnView(const Vector3& worldSpaceLocation) const
    Parameters
    Vector3 worldSpaceLocation

    World Position (XYZ).

    Returns
    bool

    Returns true if the point is within the field of view.

    OnDebugDrawSelected()

    Draws debug shapes for the selected actor and all child scripts.

    Declaration
    public virtual void OnDebugDrawSelected() override
    Overrides
    Actor::OnDebugDrawSelected()

    OnDisable()

    Called when actor gets removed from game systems. Occurs on EndPlay event or when actor gets inactivated in hierarchy. Use this event to unregister object from other game system (eg. audio).

    Declaration
    protected virtual void OnDisable() override
    Overrides
    Actor::OnDisable()

    OnEnable()

    Called when actor gets added to game systems. Occurs on BeginPlay event or when actor gets activated in hierarchy. Use this event to register object to other game system (eg. audio).

    Declaration
    protected virtual void OnEnable() override
    Overrides
    Actor::OnEnable()

    OnTransformChanged()

    Called when actor transform gets changed.

    Declaration
    protected virtual void OnTransformChanged() override
    Overrides
    Actor::OnTransformChanged()

    ProjectPoint(const Vector3& worldSpaceLocation, Float2& cameraViewportSpaceLocation, const Viewport& viewport)

    Projects the point from 3D world-space to the camera viewport-space (in screen pixels for given viewport).

    Declaration
    public void ProjectPoint(const Vector3& worldSpaceLocation, Float2& cameraViewportSpaceLocation, const Viewport& viewport) const
    Parameters
    Vector3 worldSpaceLocation

    The input world-space location (XYZ in world).

    Float2 cameraViewportSpaceLocation

    The output camera viewport-space location (XY in screen pixels).

    Viewport viewport

    The viewport.

    ProjectPoint(const Vector3& worldSpaceLocation, Float2& gameWindowSpaceLocation)

    Projects the point from 3D world-space to game window coordinates (in screen pixels for default viewport calculated from Viewport).

    Declaration
    public void ProjectPoint(const Vector3& worldSpaceLocation, Float2& gameWindowSpaceLocation) const
    Parameters
    Vector3 worldSpaceLocation

    The input world-space location (XYZ in world).

    Float2 gameWindowSpaceLocation

    The output game window coordinates (XY in screen pixels).

    Serialize(SerializeStream& stream, const void* otherObj)

    Serializes object to the output stream compared to the values of the other object instance (eg. default class object). If other object is null then serialize all properties.

    Declaration
    public virtual void Serialize(SerializeStream& stream, const void* otherObj) override
    Parameters
    SerializeStream stream

    The output stream.

    void otherObj

    The instance of the object to compare with and serialize only the modified properties. If null, then serialize all properties.

    Overrides
    Actor::Serialize(SerializeStream& stream, const void* otherObj)

    SetCustomAspectRatio(float value)

    Sets the custom aspect ratio. 0 if not use custom value.

    Declaration
    public void SetCustomAspectRatio(float value)
    Parameters
    float value

    SetFarPlane(float value)

    Sets camera's far plane distance.

    Declaration
    public void SetFarPlane(float value)
    Parameters
    float value

    SetFieldOfView(float value)

    Sets camera's field of view (in degrees).

    Declaration
    public void SetFieldOfView(float value)
    Parameters
    float value

    SetNearPlane(float value)

    Sets camera's near plane distance.

    Declaration
    public void SetNearPlane(float value)
    Parameters
    float value

    SetOrthographicScale(float value)

    Sets the orthographic projection scale.

    Declaration
    public void SetOrthographicScale(float value)
    Parameters
    float value

    SetOrthographicSize(float value)

    Sets the orthographic projection view height (width is based on the aspect ratio). Use 0 for size to be based on the viewport size.

    Declaration
    public void SetOrthographicSize(float value)
    Parameters
    float value

    SetUsePerspective(bool value)

    Sets the value indicating if camera should use perspective rendering mode, otherwise it will use orthographic projection.

    Declaration
    public void SetUsePerspective(bool value)
    Parameters
    bool value

    UnprojectPoint(const Float2& cameraViewportSpaceLocation, float depth, Vector3& worldSpaceLocation, const Viewport& viewport)

    Converts a camera viewport-space point into a corresponding point in world space.

    Declaration
    public void UnprojectPoint(const Float2& cameraViewportSpaceLocation, float depth, Vector3& worldSpaceLocation, const Viewport& viewport) const
    Parameters
    Float2 cameraViewportSpaceLocation

    The input camera viewport-space location (XY in screen pixels).

    float depth

    The input camera-relative depth position (eg. clipping plane).

    Vector3 worldSpaceLocation

    The output world-space location (XYZ in world).

    Viewport viewport

    The viewport.

    UnprojectPoint(const Float2& gameWindowSpaceLocation, float depth, Vector3& worldSpaceLocation)

    Converts a game window-space point into a corresponding point in world space.

    Declaration
    public void UnprojectPoint(const Float2& gameWindowSpaceLocation, float depth, Vector3& worldSpaceLocation) const
    Parameters
    Float2 gameWindowSpaceLocation

    The input game window coordinates (XY in screen pixels).

    float depth

    The input camera-relative depth position (eg. clipping plane).

    Vector3 worldSpaceLocation

    The output world-space location (XYZ in world).

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat