HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_Light Class Referenceabstract

Base class for all light types. More...

#include <GR_Light.h>

+ Inheritance diagram for GR_Light:

Classes

struct  LightTag
 

Public Types

enum  LightType {
  AMBIENT, DISTANT, POINT, ENVIRONMENT,
  AREA
}
 

Public Member Functions

LightType type () const
 
bool isHeadlight () const
 
void setHeadlight (bool e)
 
bool isEnabled () const
 
void setEnabled (bool e)
 
bool canShadow () const
 
void setCanShadow (bool e)
 
void setLightID (exint id)
 
void setInstanceTransforms (const UT_Matrix4FArray &transforms, const UT_Vector4FArray &colors)
 
bool isInstanced () const
 
int numInstances () const
 
bool initSceneSetForRender (RV_Render *r, RV_ShaderProgram *shader, UT_UniquePtr< RV_ShaderBlock > &scene_block, UT_UniquePtr< RV_ShaderVariableSet > &scene_set)
 
bool initLightSetForRender (RV_Render *r, RV_ShaderProgramBase *shader)
 
bool bindSets (RV_Render *r, RV_ShaderProgramBase *shader)
 
virtual bool initBlocks (RV_Render *r, const GR_CommonDispOption &opts)=0
 
bool isDirty () const
 
virtual unsigned setupShadowRenders (RE_RenderContext, GR_RenderMode &out_render_mode, bool scene_changed, unsigned shadowmap_size, const GR_DistantShadowMapParms &)=0
 
virtual RV_ShaderProgramgetShader (bool shadows, bool per_sample, bool is_antialiased, bool is_raytrace)=0
 
virtual bool canRayTraceShadow () const
 
virtual void startShadowRender (RE_RenderContext rc, unsigned shadowmap_index)
 
virtual void finishShadowRender (RE_RenderContext)
 
virtual void finishShadowRenders (RE_RenderContext)
 
virtual bool needsShadowMap ()=0
 
virtual bool hasShadowMap ()=0
 
virtual void attachShadowMap (RE_RenderContext)
 
virtual void clearShadowMap ()
 
void setLightLink (const UT_StringHolder &link)
 
const UT_StringHolderlightLink () const
 
virtual void setShadowMask (const UT_StringHolder &mask)
 
const UT_StringHoldershadowMask () const
 
- Public Member Functions inherited from GR_SceneItem
const UT_StringHoldername () const
 
exint id () const
 
int64 getVersion () const
 
void setVersion (int64 v)
 
void incref ()
 
void decref ()
 
void setName (const UT_StringHolder &name)
 
void setID (int id)
 

Static Public Member Functions

static RV_ShaderProgramgetAmbientOcclusionShader (bool is_raytrace)
 
static bool initShaders (RV_Instance *inst)
 
static void cleanupShaders ()
 

Protected Types

enum  { GLOBAL_SET = 0, LIGHT_SET = 1 }
 

Protected Member Functions

 GR_Light (const UT_StringHolder &name, LightType type)
 
 ~GR_Light () override
 
 UT_NON_COPYABLE (GR_Light)
 
bool privInitBlocks (RV_Render *r, void *light_block, int light_size, void *shadow_block, int shadow_size)
 
void privBindTexture (RV_Render *r, const UT_StringHolder &map_name, int rel_op_id, RV_TextureRef &map_id, const UT_StringHolder &sampler_name, const GR_CommonDispOption &opts, RV_TextureParms *tex_parms=nullptr, bool is_cube=false)
 
void initTexParms (RV_Render *r, const GR_CommonDispOption &opts, RV_TextureParms &parms) const
 
- Protected Member Functions inherited from GR_SceneItem
 GR_SceneItem (const UT_StringHolder &name, int id)
 
virtual ~GR_SceneItem ()
 
 UT_NON_COPYABLE (GR_SceneItem)
 

Static Protected Member Functions

static RV_ShaderProgramprivGetShader (exint tags)
 

Protected Attributes

bool myDirtyFlag
 
bool myShadowDirtyFlag
 
bool mySetBound
 
UT_StringHolder myShadowMask
 

Static Protected Attributes

static LightTag Tag
 

Detailed Description

Base class for all light types.

Definition at line 41 of file GR_Light.h.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
GLOBAL_SET 
LIGHT_SET 

Definition at line 146 of file GR_Light.h.

Enumerator
AMBIENT 
DISTANT 
POINT 
ENVIRONMENT 
AREA 

Definition at line 44 of file GR_Light.h.

Constructor & Destructor Documentation

GR_Light::GR_Light ( const UT_StringHolder name,
LightType  type 
)
protected
GR_Light::~GR_Light ( )
overrideprotected

Member Function Documentation

virtual void GR_Light::attachShadowMap ( RE_RenderContext  )
inlinevirtual

Reimplemented in GR_AreaLight.

Definition at line 103 of file GR_Light.h.

bool GR_Light::bindSets ( RV_Render r,
RV_ShaderProgramBase shader 
)
virtual bool GR_Light::canRayTraceShadow ( ) const
inlinevirtual

Reimplemented in GR_AreaLight.

Definition at line 93 of file GR_Light.h.

bool GR_Light::canShadow ( ) const
inline

Definition at line 61 of file GR_Light.h.

static void GR_Light::cleanupShaders ( )
static
virtual void GR_Light::clearShadowMap ( )
inlinevirtual

Reimplemented in GR_AreaLight, GR_PointLight, and GR_DistantLight.

Definition at line 104 of file GR_Light.h.

virtual void GR_Light::finishShadowRender ( RE_RenderContext  )
inlinevirtual

Reimplemented in GR_AreaLight.

Definition at line 99 of file GR_Light.h.

virtual void GR_Light::finishShadowRenders ( RE_RenderContext  )
inlinevirtual

Reimplemented in GR_AreaLight.

Definition at line 100 of file GR_Light.h.

static RV_ShaderProgram* GR_Light::getAmbientOcclusionShader ( bool  is_raytrace)
static
virtual RV_ShaderProgram* GR_Light::getShader ( bool  shadows,
bool  per_sample,
bool  is_antialiased,
bool  is_raytrace 
)
pure virtual
virtual bool GR_Light::hasShadowMap ( )
pure virtual

Implemented in GR_AreaLight, and GR_AmbientLight.

virtual bool GR_Light::initBlocks ( RV_Render r,
const GR_CommonDispOption opts 
)
pure virtual
bool GR_Light::initLightSetForRender ( RV_Render r,
RV_ShaderProgramBase shader 
)
bool GR_Light::initSceneSetForRender ( RV_Render r,
RV_ShaderProgram shader,
UT_UniquePtr< RV_ShaderBlock > &  scene_block,
UT_UniquePtr< RV_ShaderVariableSet > &  scene_set 
)
static bool GR_Light::initShaders ( RV_Instance inst)
static
void GR_Light::initTexParms ( RV_Render r,
const GR_CommonDispOption opts,
RV_TextureParms parms 
) const
protected
bool GR_Light::isDirty ( ) const
inline

Definition at line 80 of file GR_Light.h.

bool GR_Light::isEnabled ( ) const
inline

Definition at line 58 of file GR_Light.h.

bool GR_Light::isHeadlight ( ) const
inline

Definition at line 55 of file GR_Light.h.

bool GR_Light::isInstanced ( ) const
inline

Definition at line 68 of file GR_Light.h.

const UT_StringHolder& GR_Light::lightLink ( ) const
inline

Definition at line 110 of file GR_Light.h.

virtual bool GR_Light::needsShadowMap ( )
pure virtual

Implemented in GR_AreaLight, and GR_AmbientLight.

int GR_Light::numInstances ( ) const
inline

Definition at line 69 of file GR_Light.h.

void GR_Light::privBindTexture ( RV_Render r,
const UT_StringHolder map_name,
int  rel_op_id,
RV_TextureRef map_id,
const UT_StringHolder sampler_name,
const GR_CommonDispOption opts,
RV_TextureParms tex_parms = nullptr,
bool  is_cube = false 
)
protected
static RV_ShaderProgram* GR_Light::privGetShader ( exint  tags)
staticprotected
bool GR_Light::privInitBlocks ( RV_Render r,
void light_block,
int  light_size,
void shadow_block,
int  shadow_size 
)
protected
void GR_Light::setCanShadow ( bool  e)
inline

Definition at line 62 of file GR_Light.h.

void GR_Light::setEnabled ( bool  e)
inline

Definition at line 59 of file GR_Light.h.

void GR_Light::setHeadlight ( bool  e)
inline

Definition at line 56 of file GR_Light.h.

void GR_Light::setInstanceTransforms ( const UT_Matrix4FArray transforms,
const UT_Vector4FArray colors 
)
void GR_Light::setLightID ( exint  id)
inline

Definition at line 64 of file GR_Light.h.

void GR_Light::setLightLink ( const UT_StringHolder link)
inline

Definition at line 109 of file GR_Light.h.

virtual void GR_Light::setShadowMask ( const UT_StringHolder mask)
inlinevirtual

Reimplemented in GR_AreaLight.

Definition at line 111 of file GR_Light.h.

virtual unsigned GR_Light::setupShadowRenders ( RE_RenderContext  ,
GR_RenderMode out_render_mode,
bool  scene_changed,
unsigned  shadowmap_size,
const GR_DistantShadowMapParms  
)
pure virtual

Implemented in GR_AreaLight, and GR_AmbientLight.

const UT_StringHolder& GR_Light::shadowMask ( ) const
inline

Definition at line 113 of file GR_Light.h.

virtual void GR_Light::startShadowRender ( RE_RenderContext  rc,
unsigned  shadowmap_index 
)
inlinevirtual

Reimplemented in GR_AreaLight.

Definition at line 97 of file GR_Light.h.

LightType GR_Light::type ( ) const
inline

Definition at line 53 of file GR_Light.h.

GR_Light::UT_NON_COPYABLE ( GR_Light  )
protected

Member Data Documentation

bool GR_Light::myDirtyFlag
protected

Definition at line 141 of file GR_Light.h.

bool GR_Light::mySetBound
protected

Definition at line 143 of file GR_Light.h.

bool GR_Light::myShadowDirtyFlag
protected

Definition at line 142 of file GR_Light.h.

UT_StringHolder GR_Light::myShadowMask
protected

Definition at line 144 of file GR_Light.h.

LightTag GR_Light::Tag
staticprotected

Definition at line 171 of file GR_Light.h.


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