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

Light probes are objects that store SH illumination. These SH values are baked from environmental texture maps, such as a skybox or skydome. More...

#include <LightProbes/CLightProbes.h>

Inheritance diagram for Skylicht::CLightProbes:
Skylicht::CEntityHandler Skylicht::CComponentSystem Skylicht::IActivatorObject

Public Member Functions

virtual void initComponent ()
virtual void updateComponent ()
virtual CObjectSerializablecreateSerializable ()
virtual void loadSerializable (CObjectSerializable *object)
virtual CEntityspawn ()
CEntityaddLightProbe (const core::vector3df &position)
int getPositions (std::vector< core::vector3df > &positions)
void setSH (std::vector< core::vector3df > &sh)
Public Member Functions inherited from Skylicht::CEntityHandler
virtual void onUpdateCullingLayer (u32 mask)
CEntitysearchEntityByID (const char *id)
virtual CEntitycreateEntity ()
virtual CEntitycreateEntity (CEntity *parent)
virtual void removeEntity (CEntity *entity)
virtual void removeAllEntities ()
void regenerateEntityId ()
core::array< CEntity * > & getEntities ()
int getEntityCount ()
void getEntitiesTransforms (core::array< core::matrix4 > &result)
void setShadowCasting (bool b)
bool isShadowCasting ()
Public Member Functions inherited from Skylicht::CComponentSystem
const char * getName ()
virtual void reset ()
virtual void startComponent ()
virtual void endUpdate ()
virtual void onEnable (bool b)
void setEnable (bool b)
bool isEnable ()
CGameObject * getGameObject ()
void setEnableSerializable (bool b)
bool isSerializable ()
void addLinkComponent (CComponentSystem *comp)
void removeAllLink ()
Public Member Functions inherited from Skylicht::IActivatorObject
virtual ~IActivatorObject ()
 Virtual destructor for polymorphic activator objects.

Protected Attributes

float m_intensity
Protected Attributes inherited from Skylicht::CEntityHandler
core::array< CEntity * > m_entities
bool m_shadowCasting
Protected Attributes inherited from Skylicht::CComponentSystem
CGameObject * m_gameObject
bool m_enable
bool m_serializable
std::vector< CComponentSystem * > m_linkComponent

Additional Inherited Members

Static Public Member Functions inherited from Skylicht::CComponentSystem
static int useComponent (CComponentSystem *used)
Protected Member Functions inherited from Skylicht::CEntityHandler
void setEntities (CEntity **entities, u32 count)
void removeChilds (CEntity *entity)
Protected Member Functions inherited from Skylicht::CComponentSystem
void setOwner (CGameObject *obj)

Detailed Description

Light probes are objects that store SH illumination. These SH values are baked from environmental texture maps, such as a skybox or skydome.

You can use Lightmapper::CLightmapper to bake light into CLightProbes, or you can also bake it directly from Skylicht-Editor once you have set up the Sky environment.

The ambient light that shines on objects is influenced by light probes and the environment

The baking process recalculates the colors and stores them in CLightProbeData. This value is then mapped to the nearest objects with CIndirectLightingData. This SH value will eventually be passed to the Shader during the drawing step.

When the environment changes, you need to rebake the light probes
// Example code for using Lightmapper to bake lighting to probes
CLightProbes* probesComponent = object->getComponent<CLightProbes>();
...
...
std::vector<core::vector3df> positions;
std::vector<Lightmapper::CSH9> probes;
std::vector<core::vector3df> results;
scene->update();
CEntityManager* entityMgr = scene->getEntityManager();
if (probesComponent->getPositions(positions) > 0)
{
Lightmapper::CLightmapper::getInstance()->initBaker(32);
Lightmapper::CLightmapper::getInstance()->bakeProbes(
positions,
probes,
bakeCamera,
renderPipeline,
entityMgr
);
for (Lightmapper::CSH9& sh : probes)
{
core::vector3df r[9];
sh.copyTo(r);
for (int i = 0; i < 9; i++)
results.push_back(r[i]);
}
probesComponent->setSH(results);
}
This object class manages all entities within a scene.
Definition CEntityManager.h:89
Definition CSH9.h:32
See also
Lightmapper::CLightmapper

Member Function Documentation

◆ createSerializable()

virtual CObjectSerializable * Skylicht::CLightProbes::createSerializable ( )
virtual

Reimplemented from Skylicht::CComponentSystem.

◆ initComponent()

virtual void Skylicht::CLightProbes::initComponent ( )
virtual

Reimplemented from Skylicht::CEntityHandler.

◆ loadSerializable()

virtual void Skylicht::CLightProbes::loadSerializable ( CObjectSerializable * object)
virtual

Reimplemented from Skylicht::CComponentSystem.

◆ spawn()

virtual CEntity * Skylicht::CLightProbes::spawn ( )
virtual

Reimplemented from Skylicht::CEntityHandler.

◆ updateComponent()

virtual void Skylicht::CLightProbes::updateComponent ( )
virtual

Reimplemented from Skylicht::CEntityHandler.


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