NAP
Public Member Functions | Public Attributes | List of all members
SpotLightComponentInstance Class Reference

#include <spotlightcomponent.h>

Public Member Functions

 SpotLightComponentInstance (EntityInstance &entity, Component &resource)
 
virtual bool init (utility::ErrorState &errorState) override
 
virtual ELightType getLightType () const override
 
virtual EShadowMapType getShadowMapType () const override
 
float getAttenuation () const
 
void setAttenuation (float attenuation)
 
float getAngle () const
 
void setAngle (float angle)
 
float getFOVClip () const
 
void setFOVClip (float clip)
 
float getFalloff () const
 
void setFalloff (float falloff)
 
- Public Member Functions inherited from LightComponentInstance
 LightComponentInstance (EntityInstance &entity, Component &resource)
 
virtual ~LightComponentInstance ()
 
virtual void onDestroy () override
 
virtual void enable (bool enable)
 
bool isEnabled () const
 
bool canCastShadows () const
 
bool castsShadows () const
 
virtual uint getShadowMapSize () const
 
virtual float getIntensity () const
 
void setIntensity (float intensity)
 
virtual float getShadowStrength () const
 
virtual void setShadowStrength (float strength)
 
virtual const RGBColorFloatgetColor () const
 
void setColor (const RGBColorFloat &color)
 
const glm::vec3 getLightPosition () const
 
const glm::vec3 getLightDirection () const
 
const TransformComponentInstancegetTransform () const
 
TransformComponentInstancegetTransform ()
 
bool hasCamera () const
 
CameraComponentInstancegetCamera () const
 
CameraComponentInstancegetCamera ()
 
const RenderGnomonComponentInstancegetGnomon () const
 
RenderGnomonComponentInstancegetGnomon ()
 
const RenderFrustumComponentInstancegetFrustrum () const
 
RenderFrustumComponentInstancegetFrustrum ()
 
- Public Member Functions inherited from ComponentInstance
 ComponentInstance (EntityInstance &entity, Component &resource)
 
virtual void update (double deltaTime)
 
nap::EntityInstancegetEntityInstance () const
 
nap::ComponentgetComponent () const
 
template<typename T >
T * getComponent () const
 
virtual bool init (utility::ErrorState &errorState)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

float mAttenuation = 0.1f
 
float mAngle = 90.0f
 
float mFOVClip = 1.0f
 
float mFalloff = 0.5f
 
- Public Attributes inherited from LightComponentInstance
float mIntensity = 1.0f
 
RGBColorFloat mColor = { 1.0f, 1.0f, 1.0f }
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 
- Protected Member Functions inherited from LightComponentInstance
void registerUniformLightProperty (const std::string &memberName)
 
SpawnedEntityInstance spawnShadowCamera (const nap::Entity &entity, nap::utility::ErrorState &error)
 
- Protected Attributes inherited from LightComponentInstance
LightComponentmResource = nullptr
 
TransformComponentInstancemTransform = nullptr
 
RenderAdvancedServicemService = nullptr
 
SpawnedEntityInstance mSpawnedCamera
 
bool mIsEnabled = true
 
bool mIsShadowEnabled = false
 
float mShadowStrength = 1.0f
 
uint mShadowMapSize = 512
 

Description

Spot light component instance for NAP RenderAdvanced's light system.

Source that emits light from its origin to a specified direction with an angle of view (i.e. cone light). The shadow map for this light is a 2D depth texture; therefore, the reach of the light can exceed the extent beyond that of the depth map. The Render Advanced service creates and manages a nap::DepthRenderTarget and nap::DepthRenderTexture2D for rendering this light's shadow maps.

Inheritance diagram for SpotLightComponentInstance:
[legend]
Collaboration diagram for SpotLightComponentInstance:
[legend]

Constructor & Destructor Documentation

◆ SpotLightComponentInstance()

SpotLightComponentInstance ( EntityInstance entity,
Component resource 
)

Member Function Documentation

◆ getAngle()

float getAngle ( ) const

Light angle of view in degrees

Returns
lamp angle of view in degrees

◆ getAttenuation()

float getAttenuation ( ) const

The rate at which light intensity is lost over distance from the origin

Returns
light attenuation

◆ getFalloff()

float getFalloff ( ) const

Light falloff. A value of 0.0 results in a hard edge, a value of 1.0 results in a linear gradient.

Returns
light falloff

◆ getFOVClip()

float getFOVClip ( ) const

Light shadow camera view clip value, where 1.0 is equals the light angle of view.

Returns
shadow camera view clip value

◆ getLightType()

virtual ELightType getLightType ( ) const
overridevirtual
Returns
the light type

Implements LightComponentInstance.

◆ getShadowMapType()

virtual EShadowMapType getShadowMapType ( ) const
overridevirtual
Returns
the shadow map type

Implements LightComponentInstance.

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initialize LightComponentInstance based on the LightComponent resource

Parameters
errorStateshould hold the error message when initialization fails
Returns
if the LightComponentInstance is initialized successfully

Reimplemented from LightComponentInstance.

◆ setAngle()

void setAngle ( float  angle)

Set light and camera angle of view in degrees

Parameters
angleangle of view in degrees

◆ setAttenuation()

void setAttenuation ( float  attenuation)

Set the rate at which light intensity is lost over distance from the origin

Parameters
attenuationlight attenuation

◆ setFalloff()

void setFalloff ( float  falloff)

Set the spotlight falloff. A value of 0.0 results in a hard edge, a value of 1.0 results in a linear gradient.

Parameters
fallofflight falloff value (0-1)

◆ setFOVClip()

void setFOVClip ( float  clip)

Set light shadow camera view clip value, where 1.0 is equals the light angle of view.

Parameters
clipshadow camera view clip value in the range 0.0 - 1.0

Member Data Documentation

◆ mAngle

float mAngle = 90.0f

◆ mAttenuation

float mAttenuation = 0.1f

◆ mFalloff

float mFalloff = 0.5f

◆ mFOVClip

float mFOVClip = 1.0f