reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

#include <ofShadow.h>

Classes

class  Data
 
struct  GLData
 

Public Member Functions

 ofShadow ()
 
 ~ofShadow ()
 
void setLightType (int atype)
 
void update (const ofLight &alight)
 
bool beginDepth ()
 
bool endDepth ()
 
bool beginDepth (GLenum aCubeFace)
 
bool endDepth (GLenum aCubeFace)
 
void clear ()
 
const std::shared_ptr< ofShadow::Data > & getData () const
 
bool getIsEnabled ()
 
void setEnabled (bool ab)
 
float getNearClip ()
 
float getFarClip ()
 
void setNearClip (float anear)
 
void setFarClip (float afar)
 
const bool isMultiCubeFacePass () const
 
const bool isSingleOmniPass () const
 
const int getNumShadowDepthPasses () const
 
void setSingleOmniPass (bool ab)
 
int getDepthMapWidth ()
 
int getDepthMapHeight ()
 
void setDirectionalBounds (float aWorldWidth, float aWorldHeight)
 
void setShadowType (ofShadowType atype)
 
bool isGlCullingEnabled ()
 
void setGlCullingEnabled (bool ab)
 
GLenum getFrontFaceWindingOrder ()
 
void setFrontFaceWindingOrder (GLenum aw)
 
GLuint getDepthMapFboId ()
 
GLuint getDepthMapTexId ()
 
const float & getStrength ()
 
void setStrength (float astrength)
 
const float getBias ()
 
void setBias (float abias)
 
const float getNormalBias ()
 
void setNormalBias (float abias)
 
const float getSampleRadius ()
 
void setSampleRadius (float aradius)
 
void setAreaLightSize (float awidth, float aheight)
 
void drawFrustum ()
 
std::vector< glm::vec3 > getFrustumCorners (const glm::vec3 &aup, const glm::vec3 &aright, const glm::vec3 &afwd)
 
std::string getShadowTypeAsString ()
 
const ofShadergetDepthShader (ofGLProgrammableRenderer &renderer) const
 
bool setupShadowDepthShader (ofShader &ashader, const std::string aShaderMain)
 
bool setupShadowDepthShader (ofShader &ashader, int aLightType, const std::string aShaderMain)
 
void updateDepth (const ofShader &shader, ofGLProgrammableRenderer &renderer) const
 
void updateDepth (const ofShader &shader, GLenum aCubeFace, ofGLProgrammableRenderer &renderer) const
 

Static Public Member Functions

static GLenum getTextureTarget (int aLightType)
 
static int getNumTotalPossibleShadows (int aLightType)
 
static void setDepthMapResolution (int aLightType, int ares)
 
static void setDepthMapResolution (int aLightType, int awidth, int aheight)
 
static int getDepthMapWidth (int aLightType)
 
static int getDepthMapHeight (int aLightType)
 
static GLuint getPointTexId ()
 
static GLuint getDirectionalTexId ()
 
static GLuint getSpotTexId ()
 
static GLuint getAreaTexId ()
 
static bool hasActiveShadows ()
 
static std::string getShadowTypeAsString (ofShadowType atype)
 
static void enableAllShadows ()
 
static void disableAllShadows ()
 
static void setAllShadowTypes (ofShadowType atype)
 
static void setAllShadowDepthResolutions (int awidth, int aheight)
 
static void setAllShadowBias (float bias)
 
static void setAllShadowNormalBias (float normalBias)
 
static void setAllShadowSampleRadius (float sampleRadius)
 
static std::string getShaderDefinesAsString ()
 
static bool areShadowsSupported ()
 

Protected Member Functions

void _drawFrustum (const glm::vec3 &aup, const glm::vec3 &aright, const glm::vec3 &afwd)
 
void _allocate ()
 
void _checkSetup ()
 
void _allocateFbo ()
 
void _checkFbos ()
 
void _updateNumShadows ()
 

Static Protected Member Functions

static void _updateTexDataIds ()
 

Protected Attributes

std::shared_ptr< ofShadow::Datadata
 
bool mBSinglePass = true
 
glm::mat4 mShadowProjection = glm::mat4(1.0)
 
std::vector< glm::mat4 > mLookAtMats
 
std::vector< glm::mat4 > mViewProjMats
 
float mOrthoScaleX = 1.0
 
float mOrthoScaleY = 1.0
 
float mDirectionalBoundsWidth = -1
 
float mDirectionalBoundsHeight = -1
 
float mAreaLightWidth = 100
 
float mAreaLightHeight = 50.0
 
float mFov = 90
 
bool mBEnableCulling = true
 
GLenum mGlFrontFaceWindingOrder = GL_CW
 
const glm::mat4 biasMatrix
 

Constructor & Destructor Documentation

◆ ofShadow()

ofShadow::ofShadow ( )

◆ ~ofShadow()

ofShadow::~ofShadow ( )

Member Function Documentation

◆ _allocate()

void ofShadow::_allocate ( )
protected

◆ _allocateFbo()

void ofShadow::_allocateFbo ( )
protected

◆ _checkFbos()

void ofShadow::_checkFbos ( )
protected

◆ _checkSetup()

void ofShadow::_checkSetup ( )
protected

◆ _drawFrustum()

void ofShadow::_drawFrustum ( const glm::vec3 &  aup,
const glm::vec3 &  aright,
const glm::vec3 &  afwd 
)
protected

◆ _updateNumShadows()

void ofShadow::_updateNumShadows ( )
protected

◆ _updateTexDataIds()

void ofShadow::_updateTexDataIds ( )
staticprotected

◆ areShadowsSupported()

bool ofShadow::areShadowsSupported ( )
static

◆ beginDepth() [1/2]

bool ofShadow::beginDepth ( )

◆ beginDepth() [2/2]

bool ofShadow::beginDepth ( GLenum  aCubeFace)

◆ clear()

void ofShadow::clear ( )

◆ disableAllShadows()

void ofShadow::disableAllShadows ( )
static

◆ drawFrustum()

void ofShadow::drawFrustum ( )

◆ enableAllShadows()

void ofShadow::enableAllShadows ( )
static

◆ endDepth() [1/2]

bool ofShadow::endDepth ( )

◆ endDepth() [2/2]

bool ofShadow::endDepth ( GLenum  aCubeFace)

◆ getAreaTexId()

GLuint ofShadow::getAreaTexId ( )
static

◆ getBias()

const float ofShadow::getBias ( )
inline

◆ getData()

const std::shared_ptr< ofShadow::Data > & ofShadow::getData ( ) const
inline

◆ getDepthMapFboId()

GLuint ofShadow::getDepthMapFboId ( )

◆ getDepthMapHeight() [1/2]

int ofShadow::getDepthMapHeight ( )

◆ getDepthMapHeight() [2/2]

int ofShadow::getDepthMapHeight ( int  aLightType)
static

◆ getDepthMapTexId()

GLuint ofShadow::getDepthMapTexId ( )

◆ getDepthMapWidth() [1/2]

int ofShadow::getDepthMapWidth ( )

◆ getDepthMapWidth() [2/2]

int ofShadow::getDepthMapWidth ( int  aLightType)
static

◆ getDepthShader()

const ofShader & ofShadow::getDepthShader ( ofGLProgrammableRenderer renderer) const

◆ getDirectionalTexId()

GLuint ofShadow::getDirectionalTexId ( )
static

◆ getFarClip()

float ofShadow::getFarClip ( )
inline

◆ getFrontFaceWindingOrder()

GLenum ofShadow::getFrontFaceWindingOrder ( )
inline

◆ getFrustumCorners()

std::vector< glm::vec3 > ofShadow::getFrustumCorners ( const glm::vec3 &  aup,
const glm::vec3 &  aright,
const glm::vec3 &  afwd 
)

◆ getIsEnabled()

bool ofShadow::getIsEnabled ( )
inline

◆ getNearClip()

float ofShadow::getNearClip ( )
inline

◆ getNormalBias()

const float ofShadow::getNormalBias ( )
inline

◆ getNumShadowDepthPasses()

const int ofShadow::getNumShadowDepthPasses ( ) const

◆ getNumTotalPossibleShadows()

int ofShadow::getNumTotalPossibleShadows ( int  aLightType)
static

◆ getPointTexId()

GLuint ofShadow::getPointTexId ( )
static

◆ getSampleRadius()

const float ofShadow::getSampleRadius ( )
inline

◆ getShaderDefinesAsString()

std::string ofShadow::getShaderDefinesAsString ( )
static

◆ getShadowTypeAsString() [1/2]

std::string ofShadow::getShadowTypeAsString ( )

◆ getShadowTypeAsString() [2/2]

std::string ofShadow::getShadowTypeAsString ( ofShadowType  atype)
static

◆ getSpotTexId()

GLuint ofShadow::getSpotTexId ( )
static

◆ getStrength()

const float & ofShadow::getStrength ( )
inline

◆ getTextureTarget()

GLenum ofShadow::getTextureTarget ( int  aLightType)
static

◆ hasActiveShadows()

bool ofShadow::hasActiveShadows ( )
static

◆ isGlCullingEnabled()

bool ofShadow::isGlCullingEnabled ( )
inline

◆ isMultiCubeFacePass()

const bool ofShadow::isMultiCubeFacePass ( ) const

◆ isSingleOmniPass()

const bool ofShadow::isSingleOmniPass ( ) const

◆ setAllShadowBias()

void ofShadow::setAllShadowBias ( float  bias)
static

◆ setAllShadowDepthResolutions()

void ofShadow::setAllShadowDepthResolutions ( int  awidth,
int  aheight 
)
static

◆ setAllShadowNormalBias()

void ofShadow::setAllShadowNormalBias ( float  normalBias)
static

◆ setAllShadowSampleRadius()

void ofShadow::setAllShadowSampleRadius ( float  sampleRadius)
static

◆ setAllShadowTypes()

void ofShadow::setAllShadowTypes ( ofShadowType  atype)
static

◆ setAreaLightSize()

void ofShadow::setAreaLightSize ( float  awidth,
float  aheight 
)
inline

◆ setBias()

void ofShadow::setBias ( float  abias)
inline

◆ setDepthMapResolution() [1/2]

void ofShadow::setDepthMapResolution ( int  aLightType,
int  ares 
)
static

◆ setDepthMapResolution() [2/2]

void ofShadow::setDepthMapResolution ( int  aLightType,
int  awidth,
int  aheight 
)
static

◆ setDirectionalBounds()

void ofShadow::setDirectionalBounds ( float  aWorldWidth,
float  aWorldHeight 
)

◆ setEnabled()

void ofShadow::setEnabled ( bool  ab)

◆ setFarClip()

void ofShadow::setFarClip ( float  afar)
inline

◆ setFrontFaceWindingOrder()

void ofShadow::setFrontFaceWindingOrder ( GLenum  aw)
inline

◆ setGlCullingEnabled()

void ofShadow::setGlCullingEnabled ( bool  ab)
inline

◆ setLightType()

void ofShadow::setLightType ( int  atype)

◆ setNearClip()

void ofShadow::setNearClip ( float  anear)
inline

◆ setNormalBias()

void ofShadow::setNormalBias ( float  abias)
inline

◆ setSampleRadius()

void ofShadow::setSampleRadius ( float  aradius)
inline

◆ setShadowType()

void ofShadow::setShadowType ( ofShadowType  atype)
inline

◆ setSingleOmniPass()

void ofShadow::setSingleOmniPass ( bool  ab)

◆ setStrength()

void ofShadow::setStrength ( float  astrength)
inline

◆ setupShadowDepthShader() [1/2]

bool ofShadow::setupShadowDepthShader ( ofShader ashader,
const std::string  aShaderMain 
)

◆ setupShadowDepthShader() [2/2]

bool ofShadow::setupShadowDepthShader ( ofShader ashader,
int  aLightType,
const std::string  aShaderMain 
)

◆ update()

void ofShadow::update ( const ofLight alight)

◆ updateDepth() [1/2]

void ofShadow::updateDepth ( const ofShader shader,
GLenum  aCubeFace,
ofGLProgrammableRenderer renderer 
) const

◆ updateDepth() [2/2]

void ofShadow::updateDepth ( const ofShader shader,
ofGLProgrammableRenderer renderer 
) const

Member Data Documentation

◆ biasMatrix

const glm::mat4 ofShadow::biasMatrix
protected
Initial value:
= glm::mat4(
0.5, 0.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0,
0.0, 0.0, 0.5, 0.0,
0.5, 0.5, 0.5, 1.0
)

◆ data

std::shared_ptr<ofShadow::Data> ofShadow::data
protected

◆ mAreaLightHeight

float ofShadow::mAreaLightHeight = 50.0
protected

◆ mAreaLightWidth

float ofShadow::mAreaLightWidth = 100
protected

◆ mBEnableCulling

bool ofShadow::mBEnableCulling = true
protected

◆ mBSinglePass

bool ofShadow::mBSinglePass = true
protected

◆ mDirectionalBoundsHeight

float ofShadow::mDirectionalBoundsHeight = -1
protected

◆ mDirectionalBoundsWidth

float ofShadow::mDirectionalBoundsWidth = -1
protected

◆ mFov

float ofShadow::mFov = 90
protected

◆ mGlFrontFaceWindingOrder

GLenum ofShadow::mGlFrontFaceWindingOrder = GL_CW
protected

◆ mLookAtMats

std::vector<glm::mat4> ofShadow::mLookAtMats
protected

◆ mOrthoScaleX

float ofShadow::mOrthoScaleX = 1.0
protected

◆ mOrthoScaleY

float ofShadow::mOrthoScaleY = 1.0
protected

◆ mShadowProjection

glm::mat4 ofShadow::mShadowProjection = glm::mat4(1.0)
protected

◆ mViewProjMats

std::vector<glm::mat4> ofShadow::mViewProjMats
protected

The documentation for this class was generated from the following files:
  • /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/gl/ofShadow.h
  • /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/gl/ofShadow.cpp