BlankMat 0.1.0
Free open-source 3D texture creation application
Loading...
Searching...
No Matches
Scene Class Reference
Inheritance diagram for Scene:
Collaboration diagram for Scene:

Public Member Functions

void Draw (Window *window, Shader *shader)
 
void DrawShadows (Window *window, Shader *shader)
 
void FocusCamera ()
 
void TogglePerspective ()
 
void ToggleCameraRotationMode ()
 
void UseShader (const std::string &name="")
 
TextureContainerGetTextures ()
 
MaterialContainerGetMaterials ()
 
LightContainerGetLights ()
 
CameraContainerGetCameras ()
 
ShaderContainerGetShaders ()
 
MeshContainerGetMeshes ()
 
EntityContainerGetEntities ()
 
CameraGetCamera ()
 
LightGetLight ()
 
std::string GetName ()
 
std::string GetDirectory ()
 
const std::string GetCurShader ()
 
NodeGetRootNode ()
 
ShaderGetShader (const std::string &name)
 
MaterialGetMaterial (const std::string &name)
 
MaterialGetDefaultMaterial ()
 
TextureGetTexture (const std::string &name)
 
IEntityGetTransformHandle ()
 
StateGetState ()
 
LightingMode GetLightingMode ()
 
std::string GetUniqueScope (const std::string &scope)
 
bool IsScopeActive (const std::string &scope)
 
void AddNode (Node *node)
 
MeshAddMesh (Mesh *mesh, Node *parent=nullptr)
 
CameraAddCamera (const std::string &name, Camera *camera, bool select=false, bool replace=false)
 
LightAddLight (const std::string &name, Light *light, bool select=false, bool replace=false)
 
TextureAddTexture (const std::string &name, Texture *texture, bool replace=false)
 
MaterialAddMaterial (const std::string &name, Material *material, bool replace=false)
 
ShaderCreateShader (const std::string &name, bool loadGeom)
 
ShaderCreateShader (const std::string &name, const std::string &source, bool loadGeom)
 
ShaderCreateShader (const std::string &name, Config *config)
 
void DeleteMesh (Mesh *mesh)
 
void DeleteNode (Node *node)
 
void DeleteSelectable (ISelectable *item)
 
void DeleteSelection ()
 
void UpdateRenderList ()
 
void RotateCamera (const glm::vec3 &delta)
 
void TranslateCamera (const glm::vec3 &delta)
 
void SetRootNode (Node *rootNode)
 
void SetCamera (const std::string &camera)
 
void SetLight (const std::string &light)
 
void SetName (const std::string &name)
 Sets the name of the object. Note: Does not set the scope variable. If renaming based on raw input, use Rename() instead to set the scope.
 
void SetDirectory (const std::string &dir)
 
void SetLightingMode (LightingMode mode)
 
void SetEntityMaterial (IEntity *entity, Material *material)
 
void LoadMaterials (Config *config)
 
const glm::mat4 & GetProjectionMatrix (float aspect)
 
const glm::mat4 & GetViewMatrix ()
 
void Clear ()
 
void ClearRendering ()
 
 Scene (State *state)
 
 ~Scene ()
 
- Public Member Functions inherited from INameable
virtual void Rename (const std::string &newName, bool includeScope=true)
 Renames the object, setting the scope to be the scoped part of the name.
 
virtual void SetScope (const std::string &scope)
 Sets the scope of the object.
 
std::string GetUnscopedName ()
 Returns the unscoped name of the object.
 
std::string GetScope ()
 Returns the scope of the object.
 
std::string GetScopedName ()
 Returns the scoped name of the object.
 
void InitName (const std::string &name, const std::string &scope="")
 Initializes the nameable object with the given name and scope.
 
 INameable ()
 Creates a default nameable object without name or scope.
 

Protected Member Functions

MaterialLoadMaterial (Config *config, const std::string &name, const std::string &scope)
 
TextureLoadTexture (TextureType type, const std::string &path, const std::string &scope, const std::string &defaultName)
 
void HandleWireframe ()
 
const glm::mat4 & GetViewAxisProjection (Window *window)
 
void DeleteNodeContents (Node *node)
 

Protected Attributes

std::string mDirectory = ""
 
IEntitymGrid = nullptr
 
IEntitymTransformHandle = nullptr
 
IEntitymViewAxisHandle = nullptr
 
int mViewAxisPrevWidth = 0
 
int mViewAxisPrevHeight = 0
 
glm::mat4 mViewAxisProjection = glm::mat4(1.0f)
 
std::string mCurShader = ""
 
ShadermShader = nullptr
 
NodemRootNode = nullptr
 
StatemState = nullptr
 
LightingMode mMode = LightingMode::FLAT
 
std::unordered_map< std::string, EntityContainer * > mMeshRenderList
 
std::unordered_set< std::string > mScopes
 
TextureContainermTextures = nullptr
 
MaterialContainermMaterials = nullptr
 
LightContainermLights = nullptr
 
CameraContainermCameras = nullptr
 
ShaderContainermShaders = nullptr
 
MeshContainermMeshes = nullptr
 
EntityContainermEntities = nullptr
 
- Protected Attributes inherited from INameable
std::string mName = ""
 Name of the object.
 
std::string mScope = ""
 Scope of the object.
 

Static Protected Attributes

static const float WIREFRAME_LINE = 0.5f
 

Constructor & Destructor Documentation

◆ Scene()

Scene::Scene ( State state)

◆ ~Scene()

Scene::~Scene ( )

Member Function Documentation

◆ AddCamera()

Camera * Scene::AddCamera ( const std::string &  name,
Camera camera,
bool  select = false,
bool  replace = false 
)

◆ AddLight()

Light * Scene::AddLight ( const std::string &  name,
Light light,
bool  select = false,
bool  replace = false 
)

◆ AddMaterial()

Material * Scene::AddMaterial ( const std::string &  name,
Material material,
bool  replace = false 
)

◆ AddMesh()

Mesh * Scene::AddMesh ( Mesh mesh,
Node parent = nullptr 
)

◆ AddNode()

void Scene::AddNode ( Node node)

◆ AddTexture()

Texture * Scene::AddTexture ( const std::string &  name,
Texture texture,
bool  replace = false 
)

◆ Clear()

void Scene::Clear ( )

◆ ClearRendering()

void Scene::ClearRendering ( )

◆ CreateShader() [1/3]

Shader * Scene::CreateShader ( const std::string &  name,
bool  loadGeom 
)

◆ CreateShader() [2/3]

Shader * Scene::CreateShader ( const std::string &  name,
Config config 
)

◆ CreateShader() [3/3]

Shader * Scene::CreateShader ( const std::string &  name,
const std::string &  source,
bool  loadGeom 
)

◆ DeleteMesh()

void Scene::DeleteMesh ( Mesh mesh)

◆ DeleteNode()

void Scene::DeleteNode ( Node node)

◆ DeleteNodeContents()

void Scene::DeleteNodeContents ( Node node)
protected

◆ DeleteSelectable()

void Scene::DeleteSelectable ( ISelectable item)

◆ DeleteSelection()

void Scene::DeleteSelection ( )

◆ Draw()

void Scene::Draw ( Window window,
Shader shader 
)

◆ DrawShadows()

void Scene::DrawShadows ( Window window,
Shader shader 
)

◆ FocusCamera()

void Scene::FocusCamera ( )

◆ GetCamera()

Camera * Scene::GetCamera ( )

◆ GetCameras()

CameraContainer * Scene::GetCameras ( )

◆ GetCurShader()

const std::string Scene::GetCurShader ( )

◆ GetDefaultMaterial()

Material * Scene::GetDefaultMaterial ( )

◆ GetDirectory()

std::string Scene::GetDirectory ( )

◆ GetEntities()

EntityContainer * Scene::GetEntities ( )

◆ GetLight()

Light * Scene::GetLight ( )

◆ GetLightingMode()

LightingMode Scene::GetLightingMode ( )

◆ GetLights()

LightContainer * Scene::GetLights ( )

◆ GetMaterial()

Material * Scene::GetMaterial ( const std::string &  name)

◆ GetMaterials()

MaterialContainer * Scene::GetMaterials ( )

◆ GetMeshes()

MeshContainer * Scene::GetMeshes ( )

◆ GetName()

std::string Scene::GetName ( )

◆ GetProjectionMatrix()

const glm::mat4 & Scene::GetProjectionMatrix ( float  aspect)

◆ GetRootNode()

Node * Scene::GetRootNode ( )

◆ GetShader()

Shader * Scene::GetShader ( const std::string &  name)

◆ GetShaders()

ShaderContainer * Scene::GetShaders ( )

◆ GetState()

State * Scene::GetState ( )

◆ GetTexture()

Texture * Scene::GetTexture ( const std::string &  name)

◆ GetTextures()

TextureContainer * Scene::GetTextures ( )

◆ GetTransformHandle()

IEntity * Scene::GetTransformHandle ( )

◆ GetUniqueScope()

std::string Scene::GetUniqueScope ( const std::string &  scope)

◆ GetViewAxisProjection()

const glm::mat4 & Scene::GetViewAxisProjection ( Window window)
protected

◆ GetViewMatrix()

const glm::mat4 & Scene::GetViewMatrix ( )

◆ HandleWireframe()

void Scene::HandleWireframe ( )
protected

◆ IsScopeActive()

bool Scene::IsScopeActive ( const std::string &  scope)

◆ LoadMaterial()

Material * Scene::LoadMaterial ( Config config,
const std::string &  name,
const std::string &  scope 
)
protected

◆ LoadMaterials()

void Scene::LoadMaterials ( Config config)

◆ LoadTexture()

Texture * Scene::LoadTexture ( TextureType  type,
const std::string &  path,
const std::string &  scope,
const std::string &  defaultName 
)
protected

◆ RotateCamera()

void Scene::RotateCamera ( const glm::vec3 &  delta)

◆ SetCamera()

void Scene::SetCamera ( const std::string &  camera)

◆ SetDirectory()

void Scene::SetDirectory ( const std::string &  dir)

◆ SetEntityMaterial()

void Scene::SetEntityMaterial ( IEntity entity,
Material material 
)

◆ SetLight()

void Scene::SetLight ( const std::string &  light)

◆ SetLightingMode()

void Scene::SetLightingMode ( LightingMode  mode)

◆ SetName()

void Scene::SetName ( const std::string &  name)
virtual

Sets the name of the object. Note: Does not set the scope variable. If renaming based on raw input, use Rename() instead to set the scope.

Parameters
nameRaw name of the object

Reimplemented from INameable.

◆ SetRootNode()

void Scene::SetRootNode ( Node rootNode)

◆ ToggleCameraRotationMode()

void Scene::ToggleCameraRotationMode ( )

◆ TogglePerspective()

void Scene::TogglePerspective ( )

◆ TranslateCamera()

void Scene::TranslateCamera ( const glm::vec3 &  delta)

◆ UpdateRenderList()

void Scene::UpdateRenderList ( )

◆ UseShader()

void Scene::UseShader ( const std::string &  name = "")

Member Data Documentation

◆ mCameras

CameraContainer* Scene::mCameras = nullptr
protected

◆ mCurShader

std::string Scene::mCurShader = ""
protected

◆ mDirectory

std::string Scene::mDirectory = ""
protected

◆ mEntities

EntityContainer* Scene::mEntities = nullptr
protected

◆ mGrid

IEntity* Scene::mGrid = nullptr
protected

◆ mLights

LightContainer* Scene::mLights = nullptr
protected

◆ mMaterials

MaterialContainer* Scene::mMaterials = nullptr
protected

◆ mMeshes

MeshContainer* Scene::mMeshes = nullptr
protected

◆ mMeshRenderList

std::unordered_map<std::string, EntityContainer*> Scene::mMeshRenderList
protected

◆ mMode

LightingMode Scene::mMode = LightingMode::FLAT
protected

◆ mRootNode

Node* Scene::mRootNode = nullptr
protected

◆ mScopes

std::unordered_set<std::string> Scene::mScopes
protected

◆ mShader

Shader* Scene::mShader = nullptr
protected

◆ mShaders

ShaderContainer* Scene::mShaders = nullptr
protected

◆ mState

State* Scene::mState = nullptr
protected

◆ mTextures

TextureContainer* Scene::mTextures = nullptr
protected

◆ mTransformHandle

IEntity* Scene::mTransformHandle = nullptr
protected

◆ mViewAxisHandle

IEntity* Scene::mViewAxisHandle = nullptr
protected

◆ mViewAxisPrevHeight

int Scene::mViewAxisPrevHeight = 0
protected

◆ mViewAxisPrevWidth

int Scene::mViewAxisPrevWidth = 0
protected

◆ mViewAxisProjection

glm::mat4 Scene::mViewAxisProjection = glm::mat4(1.0f)
protected

◆ WIREFRAME_LINE

const float Scene::WIREFRAME_LINE = 0.5f
inlinestaticprotected