vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
APLightsEditor::Lights Class Reference

#include <Lights.h>

Inheritance diagram for APLightsEditor::Lights:
vrecko::Ability vrecko::BaseClass

Public Types

enum  shadowModes { NONE, SHADOW_MAP, SOFT_SHADOW_MAP }
 
enum  shadingModes { GOURAUD, PHONG }
 
enum  giModes { FULL, HALF, NO }
 
- Public Types inherited from vrecko::Ability
typedef std::vector
< ParameterStruct
ParameterVector
 Vector of the description of parameters. More...
 
- Public Types inherited from vrecko::BaseClass
enum  NotificationTypes {
  NOTIFICATION_DELETE_CLASS = 1, NOTIFICATION_EO_REGISTERING = 2, NOTIFICATION_EO_UNREGISTERING = 4, NOTIFICATION_PROGRAM_TERMINATION = 8,
  NOTIFICATION_ALL = 0xFFFFFFFF
}
 

Public Member Functions

bool loadXMLParameters (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParametersNode)
 
virtual void preInitialize ()
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
virtual void postInitialize ()
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
 Lights (void)
 
 ~Lights (void)
 
void InitializeGI ()
 
int add (osg::Vec4 position=osg::Vec4(0, 0, 0, 1), osg::Vec3 direction=osg::Vec3(0, 0,-1), float spotCutOff=180, float spotExp=0)
 
int add (osg::LightSource *lightSource)
 
int addSun (int day, int month, int year, int hour, int minute, osg::Vec4 *sunPosition=NULL)
 
bool remove (int lightNum)
 
bool removeAll ()
 
int size ()
 
osg::Light * at (int lightNum)
 
osg::LightSource * getLightSource (int lightNum)
 
osg::Light * getLight (int lightNum)
 
bool setLightVisibility (int lightNum, bool on)
 
bool setActiveShadowLight (int lightNum)
 
void enableShadows (bool OnOrOff)
 
void setMode (shadowModes shadowMode, shadingModes shadingMode, giModes giMode)
 
bool isShadowsEnabled ()
 
void setClearColor (osg::Vec4 color)
 
osg::Vec4 & getClearColor ()
 
int getCurrentShadowLightID ()
 
shadowModes getCurrentShadowMode ()
 
shadingModes getCurrectShadingMode ()
 
giModes getCurrentGIMode ()
 
void setGlobalAmbient (osg::Vec4 color)
 
const osg::Vec4 getGlobalAmbient ()
 
int getDOSampleCount ()
 
float getDORadius ()
 
int getBounceSampleCount ()
 
float getBounceRadius ()
 
int getBlurSize ()
 
void setDOSampleCount (int count)
 
void setDORadius (float radius)
 
void setBounceSampleCount (int count)
 
void setBounceRadius (float radius)
 
void setBlurSize (int size)
 
void createFlare (int lightNum)
 
const osg::Vec4 & getSunDate ()
 
osgShadow::ShadowTechnique * getShadowTechnique ()
 
std::vector< osg::Node * > & getFlares ()
 
osg::Texture2D * createBuffer (osg::Vec2 textureSize, osg::Texture::FilterMode filter, osg::Texture::WrapMode wrap, GLint internalFormat, GLenum sourceFormat)
 
void setUpCamera (osg::ref_ptr< osg::Camera > camera, osg::Vec2 textureSize, osg::ref_ptr< osg::StateSet > camSS, osg::ref_ptr< osg::Shader > vert, osg::ref_ptr< osg::Shader > frag)
 
- Public Member Functions inherited from vrecko::Ability
virtual ~Ability ()
 copy constructor More...
 
const std::string & getName () const
 Returns the ability name. More...
 
void setPluginName (const char *pName)
 Sets the plugin name. More...
 
const std::string & getPluginName (void) const
 Returns the plugin name. More...
 
const std::string & getID (void) const
 Returns ability the identification string. More...
 
void setID (const char *pID)
 (Internal usage, most people should not need to use it.) Sets the ability ID. More...
 
virtual void clean (void)
 
void setOwner (BaseClass *owner)
 (Internal usage, most people should not need to use it.) Sets ability owner. *l This method is called automatically in World::createAbility(), so one would (almost?) never want to use it directly. More...
 
BaseClassgetOwner (void)
 Returns the ability owner. More...
 
virtual ParameterVectorgetParameterVector (void)
 Return vector of the parameter description. More...
 
bool isUpdated (void)
 Set update flag. More...
 
virtual const std::string & getSenderString (void)
 Returns the identification string of sender. More...
 
- Public Member Functions inherited from vrecko::BaseClass
 BaseClass (const char *startingSenderString)
 The main constructor. More...
 
 BaseClass (BaseClass &bc)
 Copy constructor. Probably not really used. More...
 
virtual ~BaseClass ()
 Destructor. More...
 
virtual bool initialize (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parameters=NULL)
 Core initialization. More...
 
virtual bool initializeFromString (const char *xmlString)
 Helper method that allows to initialize ability from a XML-formatted string. More...
 
virtual void update (void)
 This method is called periodically in case this instance is registered in Scheduler. More...
 
virtual
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode
saveXMLParameters (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *)
 Save current setting into a XML node. More...
 
bool inputPresent (const std::string &name)
 Returns true if input pin (not request inputpin ) with given name is present. More...
 
bool outputPresent (const std::string &name)
 Returns true if output pin (not request output pin) with given name is present. More...
 
void addInputPin (InputPinBase *pin)
 Adds an input pin. More...
 
void removeInputPin (InputPinBase *pin)
 Removes an input pin. More...
 
void addOutputPin (OutputPinBase *pin)
 Adds an output pin. More...
 
void removeOutputPin (OutputPinBase *pin)
 Removes and output pin. More...
 
void addRequestInputPin (RequestInputPinBase *pin)
 Adds a request input pin. More...
 
void removeRequestInputPin (RequestInputPinBase *pin)
 Removes a request input pin. More...
 
void addRequestOutputPin (RequestOutputPinBase *pin)
 Adds a request output pin. More...
 
void removeRequestOutputPin (RequestOutputPinBase *pin)
 Removes a request output pin. More...
 
bool addNotification (BaseClass *receiver, unsigned long notificationTypes)
 Registers an observer that will be notified if a specific change occurs. More...
 
bool removeNotification (BaseClass *receiver, unsigned long notificationTypes=NOTIFICATION_ALL)
 Unregisters a previously registered observer. More...
 
virtual void processEvent (const std::string &input_name, VreckoMessage *pMessage)
 Internal method for processing the events. More...
 
virtual VreckoMessageprocessRequest (const std::string &request_input_name, VreckoMessage *pMessage)
 Internal method for processing the requests. More...
 
void reportError (const std::string &error)
 Print error message. More...
 
void setPriority (long int pr)
 Sets the priority. (Possible problems - read the full description for more info) More...
 
long int getPriority (void) const
 Returns current object priority. More...
 
void setAttribute (const std::string &attr_name, int attr_value)
 Sets an attribute value. More...
 
int getAttribute (const std::string &attr_name)
 Returns attribute value. More...
 
int getAttribute (const char *attr_name)
 Returns attribute value. More...
 
void deleteAttribute (const std::string &attr_name)
 Delete an attribute. More...
 
void setSceneFile (const std::string &sceneFileName)
 Set the name of the file this component was in (and possibly will be saved to). More...
 
const std::string & getSceneFile () const
 Get the name of the file this component was in. More...
 
virtual bool loadXMLParameters (const char *xmlString)
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
InputPinBasegetInputPin (const char *strName)
 Returns pointer to an input pin with specified name. More...
 
OutputPinBasegetOutputPin (const char *strName)
 Returns pointer to an output pin with specified name. More...
 
RequestInputPinBasegetRequestInputPin (const char *strName)
 Returns pointer to an request input pin with specified name. More...
 
RequestOutputPinBasegetRequestOutputPin (const char *strName)
 Returns pointer to an input pin with specified name. More...
 

Public Attributes

enum
APLightsEditor::Lights::shadowModes 
shadowMode
 
enum
APLightsEditor::Lights::shadingModes 
shadeMode
 
enum
APLightsEditor::Lights::giModes 
giMode
 

Additional Inherited Members

- Protected Types inherited from vrecko::BaseClass
typedef std::map< std::string,
int > 
AttributeMap
 Attributes. More...
 
typedef std::vector
< osg::ref_ptr< IOPinBase > > 
PinList
 
- Protected Member Functions inherited from vrecko::Ability
 Ability (const char *theAbilityName)
 
- Protected Attributes inherited from vrecko::Ability
BaseClasspOwner
 Pointer to the owner of this ability. (Almost?) always an EnvironmentObject class. More...
 
std::vector< std::string > parameterString
 
bool updated
 Update flag. It is used for save. More...
 

Member Enumeration Documentation

Enumerator
FULL 
HALF 
NO 
Enumerator
GOURAUD 
PHONG 
Enumerator
NONE 
SHADOW_MAP 
SOFT_SHADOW_MAP 

Constructor & Destructor Documentation

APLightsEditor::Lights::Lights ( void  )
APLightsEditor::Lights::~Lights ( void  )

Member Function Documentation

int APLightsEditor::Lights::add ( osg::Vec4  position = osg::Vec4(0,0,0,1),
osg::Vec3  direction = osg::Vec3(0,0,-1),
float  spotCutOff = 180,
float  spotExp = 0 
)

Creates a new light and put it in the scene

Parameters
positionvec4 position of the light (if last coord is zero creates directional light)
directionvec3 direction of the light
spotCutOffangle from the light axis (only for spot lights)
spotExplight intensity exponent from spot center to edges
Returns
light ID
int APLightsEditor::Lights::add ( osg::LightSource *  lightSource)

Creates a new light and put it in the scene

Parameters
lightSourcepointer to lightSource object
Returns
light ID
int APLightsEditor::Lights::addSun ( int  day,
int  month,
int  year,
int  hour,
int  minute,
osg::Vec4 *  sunPosition = NULL 
)

Put Sun in the scene

Returns
lightID
osg::Light * APLightsEditor::Lights::at ( int  lightNum)

Returns a specific light, if lightNum doesn't exist, returns NULL

osg::Texture2D * APLightsEditor::Lights::createBuffer ( osg::Vec2  textureSize,
osg::Texture::FilterMode  filter,
osg::Texture::WrapMode  wrap,
GLint  internalFormat,
GLenum  sourceFormat 
)

Creates texture object for render to texture

void APLightsEditor::Lights::createFlare ( int  lightNum)

Creates a flare for specific light

void APLightsEditor::Lights::enableShadows ( bool  OnOrOff)

Enable/disable shadows (only for PHONG shading)

int APLightsEditor::Lights::getBlurSize ( )

Returns size of blur kernel

float APLightsEditor::Lights::getBounceRadius ( )

Returns indirect bounce maximal radius

int APLightsEditor::Lights::getBounceSampleCount ( )

Returns indirect bounce sample count

osg::Vec4 & APLightsEditor::Lights::getClearColor ( )

Returns current background color

shadingModes APLightsEditor::Lights::getCurrectShadingMode ( )
inline

Returns current shading mode: PHONG, GORAUD

giModes APLightsEditor::Lights::getCurrentGIMode ( )
inline

Returns current global illumination mode: FULL, HALF, NO

int APLightsEditor::Lights::getCurrentShadowLightID ( )

Returns ID of current shadow light

shadowModes APLightsEditor::Lights::getCurrentShadowMode ( )
inline

Returns current shadow mode: SHADOW_MAP, SOFT_SHADOW_MAP, NONE

float APLightsEditor::Lights::getDORadius ( )

Returns ambient occlusion maximal radius

int APLightsEditor::Lights::getDOSampleCount ( )

Returns ambient occlusion sample count

std::vector<osg::Node*>& APLightsEditor::Lights::getFlares ( )
inline

Returns billboarding flares as a vector of pointers

const osg::Vec4 APLightsEditor::Lights::getGlobalAmbient ( )
inline

Returns the global ambient intensity

osg::Light * APLightsEditor::Lights::getLight ( int  lightNum)

Returns light according to given lightNum, if there is no such light, returns NULL

osg::LightSource * APLightsEditor::Lights::getLightSource ( int  lightNum)

Returns a light source, if light source with given lightNum doesn't exists, null is returned

osgShadow::ShadowTechnique * APLightsEditor::Lights::getShadowTechnique ( )

Returns current shadow technique, otherwise NULL

const osg::Vec4& APLightsEditor::Lights::getSunDate ( )
inline

Returns a sun date as in vec4 format - saved as osg::Vec4(day,month,year,hour*60+minute)

void APLightsEditor::Lights::InitializeGI ( )

Initializes all necessary parameters for Global Illumination

bool APLightsEditor::Lights::isShadowsEnabled ( )
bool APLightsEditor::Lights::loadXMLParameters ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *  pParametersNode)
virtual

XML parameters, options

|–ShadowTechnique, (ShadowMap,SoftShadowMap,None) | | | | //For ShadowMap and SoftShadowMap | |–TextureSize, (vec2) Size of the depth texture | | | | //For SoftShadowMap | |–JitteringScale (float) Set the values for jittering scale the shader will use. | | Zero is no jittering (i.e. see the banding in penumbra) | | High values (>64) cause 'pixelization' of the penumbra. | | Usually but not necessarily power of two number. | | Default is 32. | |–SoftnessWidth (float) Set the values for width of the soft penumbra the shader will use. | Zero is for hard shadow (no penumbra). 0.01 is already very soft penumbra. | Default is 0.005. | |–ShadingTechnique, (Gouraud,Phong) |–GlobalAmbient, (vec4) |–ClearColor, (vec4) |–Sun, (DD MM YYYY HH MM, SystemTime) | |–GlobalIlluminatonResolution, (Full, Half, No) Texture resolution of global illumination: | | Full - same size as viewport window; | | Half - half size of viewport window; | | No - global illumination is not computed. | | | |–AOSampleCount (int) Number of samples (different directions) per each pixel. | |–AOSamplesPerDirection (int) Number of samples per each direction. | |–AORadius (float) Radius of sampling, maximal length of sample. | |–DPSSampleCount (int) Number of samples per each pixel per each light. | |–DPSRadius (float) Radius of sampling. | |–PrimaryShadowTechnique (ShadowMap, SoftShadowMap, DPS) Primary shadow technique for scene | | with only one light source. | |–BounceSampleCount (int) Number of samples per each pixel. | |–BounceRadius (float) Radius of sampling, maximal length of sample. | |–BlurSize (int) Size of blur kernel. | |–LightList, | |–Light, | |–Position, (vec3) |–Direction, (vec3) |–Cutoff, (0.0 - 90.0) |–Exponent, (float) |–Ambient, (vec4) |–Diffuse, (vec4) |–Specular, (vec4) |–ConstAtt, (0.0 - 1.0) |–LinAtt, (0.0 - 1.0) |–QuadAtt, (0.0 - 1.0) |–ShadowLight, (0,1) |–LensFlare, (0,1)

Reimplemented from vrecko::BaseClass.

void APLightsEditor::Lights::postInitialize ( void  )
virtual

OBSOLETE METHOD, kept for backwards compatibility.

The preInitialize(), loadXMLParameters() and postInitialize() methods were replaced in 2011 by a single method initialize().

Reimplemented from vrecko::BaseClass.

void APLightsEditor::Lights::preInitialize ( void  )
virtual

OBSOLETE METHOD, kept for backwards compatibility.

The preInitialize(), loadXMLParameters() and postInitialize() methods were replaced in 2011 by a single method initialize().

Reimplemented from vrecko::BaseClass.

bool APLightsEditor::Lights::remove ( int  lightNum)

Remove light form the scene and recount all lights IDs

Returns
true if lights was succesfully removed
bool APLightsEditor::Lights::removeAll ( )

Remove all lights from the scene

bool APLightsEditor::Lights::setActiveShadowLight ( int  lightNum)

Set active shadow light return true if operation succeded

void APLightsEditor::Lights::setBlurSize ( int  size)

Sets size of blur kernel

void APLightsEditor::Lights::setBounceRadius ( float  radius)

Sets indirect bounce maximal radius

void APLightsEditor::Lights::setBounceSampleCount ( int  count)

Sets indirect bounce sample count

void APLightsEditor::Lights::setClearColor ( osg::Vec4  color)

Set the background color

void APLightsEditor::Lights::setDORadius ( float  radius)

Sets ambient occlusion maximal radius

void APLightsEditor::Lights::setDOSampleCount ( int  count)

Sets ambient occlusion maximal radius

void APLightsEditor::Lights::setGlobalAmbient ( osg::Vec4  color)

Sets the global ambient intensity

bool APLightsEditor::Lights::setLightVisibility ( int  lightNum,
bool  on 
)

Set light visibility, works only for gouraud shading If lightNum doesn't exist, returns false

void APLightsEditor::Lights::setMode ( shadowModes  shadowMode,
shadingModes  shadingMode,
giModes  giMode 
)

Testing method for changing shadow/shading modes, osgShadow is not fully implemented, so it's not working yet.

void APLightsEditor::Lights::setUpCamera ( osg::ref_ptr< osg::Camera >  camera,
osg::Vec2  textureSize,
osg::ref_ptr< osg::StateSet >  camSS,
osg::ref_ptr< osg::Shader >  vert,
osg::ref_ptr< osg::Shader >  frag 
)

Sets up camera for render to texture

int APLightsEditor::Lights::size ( )

Returns currect number of active lights

Member Data Documentation

enum APLightsEditor::Lights::giModes APLightsEditor::Lights::giMode
enum APLightsEditor::Lights::shadingModes APLightsEditor::Lights::shadeMode
enum APLightsEditor::Lights::shadowModes APLightsEditor::Lights::shadowMode

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