Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CScene Class Reference

This object class manages all other objects, it represents the data of a scene. More...

#include <Scene/CScene.h>

Inheritance diagram for Skylicht::CScene:
irr::IEventReceiver

Public Member Functions

void releaseScene ()
void setName (const wchar_t *lpName)
void setName (const char *lpName)
const char * getNameA ()
const wchar_t * getName ()
void setVisibleAllZone (bool b)
void updateAddRemoveObject ()
void updateIndexSearchObject ()
virtual CGameObjectsearchObjectInChild (const wchar_t *name)
virtual CGameObjectsearchObjectInChildByID (const char *id)
virtual CEntitysearchEntityInChildByID (const char *id)
u32 searchObjectByCullingLayer (ArrayGameObject &result, u32 mask)
virtual CZonecreateZone ()
virtual void removeZone (CGameObject *zone)
CEntityManagergetEntityManager ()
int getZoneCount ()
CZonegetZone (int i)
ArrayZone * getAllZone ()
void bringToNext (CZone *object, CZone *target, bool behind)
CZonegetZoneBefore (CZone *object)
void registerEvent (const char *name, IEventReceiver *pEvent)
void unRegisterEvent (IEventReceiver *pEvent)
virtual bool OnEvent (const SEvent &event)
 Called if an event happened.
virtual void update ()
CObjectSerializablecreateSerializable ()
void loadSerializable (CObjectSerializable *object)
Public Member Functions inherited from irr::IEventReceiver
virtual ~IEventReceiver ()
 Destructor.

Protected Types

typedef std::pair< std::string, IEventReceiver * > eventType

Protected Attributes

std::wstring m_name
std::string m_namec
ArrayZone m_zones
CEntityManagerm_entityManager
std::vector< eventType > m_eventReceivers

Detailed Description

This object class manages all other objects, it represents the data of a scene.

A scene can be constructed programmatically, or you can use an Skylicht-Editor to create and arrange objects.

The image shows a scene built with Skylicht-Editor.

When a scene is created in the editor and saved as a .scene file, you can use CSceneImporter to load all the data back into CScene.

CScene* scene = new CScene();
// declare component used in scene
// see: SampleScene/Demo.txt
USE_COMPONENT(CBoxCollider);
USE_COMPONENT(CCube);
USE_COMPONENT(CDirectionalLight);
USE_COMPONENT(CIndirectLighting);
USE_COMPONENT(CLightProbes);
USE_COMPONENT(CPlane);
USE_COMPONENT(CReflectionProbe);
USE_COMPONENT(CRenderMesh);
USE_COMPONENT(CRigidbody);
USE_COMPONENT(CSkySun);
USE_COMPONENT(CStaticPlaneCollider);
USE_COMPONENT(CTransformEuler);
...
CSceneImporter::beginImportScene(scene, "SampleScene/Demo.scene");
bool finished = false;
char log[512];
do
{
finished = CSceneImporter::updateLoadScene())
sprintf(log, "Loading: %d%%", (int)(CSceneImporter::getLoadingPercent() * 100.0f));
os::Printer::log(log);
}
while (!finished);
Component for rendering cube primitives.
Definition CCube.h:44
This object holds the parameters for directional lights, also known as outdoor lighting.
Definition CDirectionalLight.h:38
This object holds the parameters for indirect lighting like SH or AmbientColor or Lightmap.
Definition CIndirectLighting.h:47
Light probes are objects that store SH illumination. These SH values are baked from environmental tex...
Definition CLightProbes.h:84
Component for rendering plane primitives.
Definition CPlane.h:45
The object class enables mapping reflection onto the Object.
Definition CReflectionProbe.h:62
The object class helps to initialize a model from a path or prefab, and gets the model's material to ...
Definition CRenderMesh.h:81
Definition CSkySun.h:34
This is object class for classes that describe a GameObject's Transform.
Definition CTransformEuler.h:47
All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees a...
Definition CIndexBuffer.h:13

Additionally, in some cases, you can manually create a scene using code, as shown below:

CScene *scene = new CScene();
CZone *zone = scene->createZone();
// Example add canvas
CGameObject* guiObj = zone->createEmptyObject();
CCanvas* canvas = guiObj->addComponent<CCanvas>();
// Example add camera
CGameObject* camObj = zone->createEmptyObject();
camObj->addComponent<CCamera>();
camObj->addComponent<CEditorCamera>()->setMoveSpeed(2.0f);
camObj->addComponent<CFpsMoveCamera>()->setMoveSpeed(1.0f);
// call update method for all objects
scene->update();
This is an object class used to set up the camera, including its position, viewing angle,...
Definition CCamera.h:70
This class manages GUI components, including creating and deleting images and sprites.
Definition CCanvas.h:79
This is an object class that can perform mouse operations to move the camera. It is used on operating...
Definition CEditorCamera.h:38
The object class supports camera movement with arrow keys.
Definition CFpsMoveCamera.h:38
This object class stores information for a GameObject.
Definition CGameObject.h:52
It's the primary container object for the CScene; all CGameObject have a CZone as their root parent.
Definition CZone.h:37
See also
CGameObject, CContainerObject, CZone, CSceneImporter

To render the scene to screen, you first need to set up the Render Pipeline, and then call render method from the Pipeline.

See also
CShadowMapRP, CDeferredRP, CForwardRP, CPostProcessorRP

Member Function Documentation

◆ OnEvent()

virtual bool Skylicht::CScene::OnEvent ( const SEvent & event)
virtual

Called if an event happened.

Please take care that you should only return 'true' when you want to prevent Irrlicht from processing the event any further. So 'true' does mean that an event is completely done. Therefore your return value for all unprocessed events should be 'false'.

Returns
True if the event was processed.

Implements irr::IEventReceiver.


The documentation for this class was generated from the following file: