Skip to content

Vp::MainScene

#include "Viewport/scene/scenes/MainScene.h"

Inherits from Vp::Scene

Public Functions

Name
MainScene(Viewport * viewport)
virtual voiddraw(int width, int height, glm::mat4 view, glm::mat4 projection, SceneRenderTarget & renderTarget, const DisplayOptions & displayOptions) override<br>Draw the scene using the provided view and projection matrices.
virtual voiddraw(int width, int height, SceneRenderTarget & renderTarget, const DisplayOptions & displayOptions) override<br>Draw the scene using the scene's camera.
virtual voidinit() override<br>Initialises the scene.
virtual voidloadSettings(ViewportSettings & stg, bool scene, bool global) override
virtual voidsaveSettings(ViewportSettings & stg, bool scene, bool global) override
virtual voidupdate(double dt) override<br>Update entity logic.

Protected Attributes

Name
std::shared_ptr< GameObject >m_gridObject
SunLight *m_sun1
glm::vec3m_sun1_dir
SunLight *m_sun2
glm::vec3m_sun2_dir
floatm_sun2_intensity

Additional inherited members

Public Functions inherited from Vp::Scene

Name
Scene(Viewport * viewport)
virtual~Scene() =default
template <typename T ,typename std::enable_if< std::is_base_of< Entity, T >::value, bool >::type =true&gt; <br>std::weak_ptr< T >addEntity(std::shared_ptr< T > entity)<br>Adds entity to the scene.
voidaddSelectionCallback(std::function< void(Entity *)> callback)
virtual Ptr< SceneRenderTarget >createRenderTarget(const RenderOptions & options)<br>Create and populates a SceneRenderTarget object with expected framebuffer objects for the scenes render pass.
const std::vector< std::shared_ptr< Entity > > &getEntities() const
voidprocessInput(double dt, glm::vec2 mousePos, glm::ivec2 windowSize)<br>Update input logic.
voidprocessSelection(SceneRenderTarget & renderTarget, glm::vec2 mousePos, glm::ivec2 windowSize)<br>Update selection logic.
template <typename T ,typename std::enable_if< std::is_base_of< Entity, T >::value, bool >::type =true&gt; <br>voidremoveEntity(std::weak_ptr< T > entity)<br>Remove entity from the scene.
voidtriggerSelectionCallbacks(Entity * entity)

Protected Functions inherited from Vp::Scene

Name
voidrenderSortedTransparentEntities(glm::mat4 view, glm::mat4 projection, const std::vector< Entity * > & entities) const
voidsortExplicitlyOrderedTransparentEntities(std::vector< Entity * > & entities)
voidsortUnorderedTransparentEntities(glm::mat4 view, std::vector< Entity * > & entities)

Public Attributes inherited from Vp::Scene

Name
std::shared_ptr< AbstractCamera >m_camera
std::shared_ptr< Lighting >m_lighting
std::shared_ptr< SelectStencil >m_selectStencil
Viewport *m_viewport

Protected Attributes inherited from Vp::Scene

Name
std::vector< std::shared_ptr< Entity > >m_entities
std::vector< Entity * >m_explicitTransparencyOrderEntitiesFirst
std::vector< Entity * >m_explicitTransparencyOrderEntitiesLast
std::vector< Entity * >m_highlightedEntities
Entity *m_selectedEntity
std::vector< std::function< void(Entity *)> >m_selectionCallbacks <br>Callbacks that get triggered on entity selection.
std::vector< Entity * >m_unorderedTransparentEntities

Friends inherited from Vp::Scene

Name
classViewport

Public Functions Documentation

function MainScene

cpp
explicit MainScene(
    Viewport * viewport
)
explicit MainScene(
    Viewport * viewport
)

function draw

cpp
virtual void draw(
    int width,
    int height,
    glm::mat4 view,
    glm::mat4 projection,
    SceneRenderTarget & renderTarget,
    const DisplayOptions & displayOptions
) override
virtual void draw(
    int width,
    int height,
    glm::mat4 view,
    glm::mat4 projection,
    SceneRenderTarget & renderTarget,
    const DisplayOptions & displayOptions
) override

Draw the scene using the provided view and projection matrices.

Reimplements: Vp::Scene::draw

function draw

cpp
virtual void draw(
    int width,
    int height,
    SceneRenderTarget & renderTarget,
    const DisplayOptions & displayOptions
) override
virtual void draw(
    int width,
    int height,
    SceneRenderTarget & renderTarget,
    const DisplayOptions & displayOptions
) override

Draw the scene using the scene's camera.

Parameters:

  • width Width of the

Reimplements: Vp::Scene::draw

function init

cpp
virtual void init() override
virtual void init() override

Initialises the scene.

Reimplements: Vp::Scene::init

Should be called before any draw operations.

function loadSettings

cpp
virtual void loadSettings(
    ViewportSettings & stg,
    bool scene,
    bool global
) override
virtual void loadSettings(
    ViewportSettings & stg,
    bool scene,
    bool global
) override

Reimplements: Vp::Scene::loadSettings

function saveSettings

cpp
virtual void saveSettings(
    ViewportSettings & stg,
    bool scene,
    bool global
) override
virtual void saveSettings(
    ViewportSettings & stg,
    bool scene,
    bool global
) override

Reimplements: Vp::Scene::saveSettings

function update

cpp
virtual void update(
    double dt
) override
virtual void update(
    double dt
) override

Update entity logic.

Reimplements: Vp::Scene::update

Protected Attributes Documentation

variable m_gridObject

cpp
std::shared_ptr< GameObject > m_gridObject;
std::shared_ptr< GameObject > m_gridObject;

variable m_sun1

cpp
SunLight * m_sun1;
SunLight * m_sun1;

variable m_sun1_dir

cpp
glm::vec3 m_sun1_dir;
glm::vec3 m_sun1_dir;

variable m_sun2

cpp
SunLight * m_sun2;
SunLight * m_sun2;

variable m_sun2_dir

cpp
glm::vec3 m_sun2_dir;
glm::vec3 m_sun2_dir;

variable m_sun2_intensity

cpp
float m_sun2_intensity;
float m_sun2_intensity;

Updated on 2024-03-16 at 19:15:01 +0000