Loading...
Searching...
No Matches
stage.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_VIEW_KERNEL_STAGE_H
#define BALL_VIEW_KERNEL_STAGE_H
#ifndef BALL_MATHS_VECTOR3_H
# include <BALL/MATHS/vector3.h>
#endif
#ifndef BALL_MATHS_QUATERNION_H
# include <BALL/MATHS/quaternion.h>
#endif
#ifndef BALL_MATHS_MATRIX44_H
# include <BALL/MATHS/matrix44.h>
#endif
#ifndef BALL_MATHS_ANGLE_H
# include <BALL/MATHS/angle.h>
#endif
#ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
# include <BALL/VIEW/DATATYPE/colorRGBA.h>
#endif
#ifndef BALL_VIEW_KERNEL_REPRESENTATION_H
# include <BALL/VIEW/KERNEL/representation.h>
#endif
#ifndef BALL_COMMON_EXCEPTION_H
# include <BALL/COMMON/exception.h>
#endif
#ifndef BALL_VIEW_RENDERING_CAMERA_H
# include <BALL/VIEW/RENDERING/camera.h>
#endif
namespace BALL
{
namespace VIEW
{
class BALL_VIEW_EXPORT LightSource
{
public:
enum Types
{
AMBIENT = 0,
POSITIONAL,
DIRECTIONAL
};
LightSource();
LightSource(const LightSource& light_source);
virtual ~LightSource(){}
const Vector3& getPosition() const
{ return position_;}
void setPosition(const Vector3& position)
{ position_ = position; }
const Vector3& getDirection() const
{ return direction_;}
void setDirection(const Vector3& direction)
{ direction_ = direction;}
const Vector3& getAttenuation() const
{ return attenuation_;}
void setAttenuation(const Vector3& attenuation)
{ attenuation_ = attenuation;}
const Angle& getAngle() const
{ return angle_;}
void setAngle(const Angle& angle)
{ angle_ = angle;}
float getIntensity() const
{ return intensity_;}
void setIntensity(float intensity)
{ intensity_ = intensity;}
const ColorRGBA& getColor() const
{ return color_;}
void setColor(const ColorRGBA& color)
{ color_ = color;}
Index getType() const
{ return type_;}
void setType(Types type)
{ type_ = type;}
void setRelativeToCamera(bool state)
{ relative_ = state;}
bool isRelativeToCamera() const
{ return relative_;}
LightSource& operator = (const LightSource& light);
bool operator < (const LightSource& light) const;
bool operator == (const LightSource& light_source) const;
virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
protected:
//_ Position of the light source
Vector3 position_;
//_ Direction of the light cone
Vector3 direction_;
//_ Attenuation parameters of the light
Vector3 attenuation_;
//_
Vector3 r_position_;
//_
Vector3 r_direction_;
//_ Angle of the light cone
Angle angle_;
//_ Intensity of the light
float intensity_;
//_ Color of the light
ColorRGBA color_;
//_ Enumeration of types for further usage
Index type_;
//_ Relative to camera
bool relative_;
};
class BALL_VIEW_EXPORT Stage
{
public:
class BALL_VIEW_EXPORT Material
: public PersistentObject
{
public:
BALL_CREATE(Material)
Material();
virtual void persistentWrite(PersistenceManager& pm, const char* name = 0) const;
virtual void persistentRead(PersistenceManager& pm);
ColorRGBA ambient_color;
float ambient_intensity;
ColorRGBA specular_color;
float specular_intensity;
ColorRGBA reflective_color;
float reflective_intensity;
float shininess;
float transparency;
};
// needed for backwards compatibilty of project files
class BALL_VIEW_EXPORT RaytracingMaterial : public Material
{
public:
BALL_CREATE(RaytracingMaterial)
};
Stage();
Stage(const Stage& stage);
virtual ~Stage(){}
virtual void clear();
virtual const std::list<LightSource>& getLightSources() const
{ return light_sources_;}
virtual LightSource& getLightSource(Position i)
{
if (i >= light_sources_.size())
{
Exception::OutOfRange e(__FILE__, __LINE__);
throw(e);
}
std::list<LightSource>::iterator l_it;
Position current_light = 0;
for (l_it = light_sources_.begin();
(current_light < i) && (l_it != light_sources_.end());
++l_it, ++current_light)
{ }
return *l_it;
}
virtual void addLightSource(const LightSource& light_source);
virtual void removeLightSource(const LightSource& light_source) ;
void clearLightSources();
virtual Camera& getCamera()
{ return camera_;}
virtual const Camera& getCamera() const
{ return camera_;}
virtual void setCamera(const Camera& camera)
{ camera_ = camera;}
virtual const ColorRGBA& getBackgroundColor() const
{ return background_color_;}
virtual void setBackgroundColor(const ColorRGBA& color)
{ background_color_ = color;}
virtual const ColorRGBA& getInfoColor() const
{ return info_color_;}
virtual void setInfoColor(const ColorRGBA& color)
{ info_color_ = color;}
void showCoordinateSystem(bool state)
{ show_coordinate_system_ = state;}
bool coordinateSystemEnabled() const
{ return show_coordinate_system_;}
void setEyeDistance(float value)
{ eye_distance_ = value;}
float getEyeDistance() const
{ return eye_distance_;}
void setFocalDistance(float value)
{ focal_distance_ = value;}
float getFocalDistance() const
{ return focal_distance_;}
void setSwapSideBySideStereo(bool state)
{ swap_side_by_side_stereo_ = state;}
bool swapSideBySideStereo() const
{ return swap_side_by_side_stereo_;}
float getFogIntensity() const
{ return fog_intensity_;}
void setFogIntensity(float value)
{ fog_intensity_ = value;}
bool operator == (const Stage& stage) const;
Vector3 calculateRelativeCoordinates(Vector3 pos) const;
Vector3 calculateAbsoluteCoordinates(Vector3 pos) const;
virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
Material& getMaterial() { return material_; }
const Material& getMaterial() const { return material_; }
protected:
//_
ColorRGBA background_color_;
//_
ColorRGBA info_color_;
//_
std::list<LightSource> light_sources_;
//_
Camera camera_;
//_
bool show_coordinate_system_;
//_
float fog_intensity_;
//_
float eye_distance_;
//_
float focal_distance_;
//_
bool swap_side_by_side_stereo_;
// the current default materials used for raytracing
Material material_;
};
} // namespace VIEW
} // namespace BALL
#endif // BALL_VIEW_KERNEL_STAGE_H
exception.h
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition COMMON/global.h:52
angle.h
camera.h
BALL::Exception::OutOfRange
Definition COMMON/exception.h:219
BALL::PersistenceManager
Definition persistenceManager.h:73
BALL::PersistentObject::PersistentObject
PersistentObject()
Definition persistentObject.h:39
BALL::VIEW::Camera
Definition camera.h:24
BALL::VIEW::ColorRGBA
Definition colorRGBA.h:32
BALL::VIEW::LightSource
Definition stage.h:54
BALL::VIEW::LightSource::getPosition
const Vector3 & getPosition() const
Get position.
Definition stage.h:99
BALL::VIEW::LightSource::getType
Index getType() const
Definition stage.h:158
BALL::VIEW::LightSource::getAngle
const Angle & getAngle() const
Get the angle of the light cone.
Definition stage.h:124
BALL::VIEW::LightSource::setAngle
void setAngle(const Angle &angle)
Set the angle of the light cone.
Definition stage.h:128
BALL::VIEW::LightSource::setColor
void setColor(const ColorRGBA &color)
Definition stage.h:152
BALL::VIEW::LightSource::setDirection
void setDirection(const Vector3 &direction)
Set the direction vector of the light.
Definition stage.h:111
BALL::VIEW::LightSource::r_direction_
Vector3 r_direction_
Definition stage.h:214
BALL::VIEW::LightSource::color_
ColorRGBA color_
Definition stage.h:223
BALL::VIEW::LightSource::getColor
const ColorRGBA & getColor() const
Definition stage.h:146
BALL::VIEW::LightSource::getIntensity
float getIntensity() const
Definition stage.h:134
BALL::VIEW::LightSource::getDirection
const Vector3 & getDirection() const
Get the direction vector of the light.
Definition stage.h:107
BALL::VIEW::LightSource::setRelativeToCamera
void setRelativeToCamera(bool state)
If set to true, the LightSource will move with the Camera.
Definition stage.h:168
BALL::VIEW::LightSource::LightSource
LightSource(const LightSource &light_source)
BALL::VIEW::LightSource::setType
void setType(Types type)
Definition stage.h:164
BALL::VIEW::LightSource::dump
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
BALL::VIEW::LightSource::setIntensity
void setIntensity(float intensity)
Definition stage.h:140
BALL::VIEW::LightSource::intensity_
float intensity_
Definition stage.h:220
BALL::VIEW::LightSource::setPosition
void setPosition(const Vector3 &position)
Set position.
Definition stage.h:103
BALL::VIEW::LightSource::LightSource
LightSource()
BALL::VIEW::LightSource::getAttenuation
const Vector3 & getAttenuation() const
Get the attenuation parameters of the light.
Definition stage.h:115
BALL::VIEW::LightSource::setAttenuation
void setAttenuation(const Vector3 &attenuation)
Set the attenuation parameters of the light.
Definition stage.h:119
BALL::VIEW::LightSource::angle_
Angle angle_
Definition stage.h:217
BALL::VIEW::LightSource::~LightSource
virtual ~LightSource()
Definition stage.h:91
BALL::VIEW::LightSource::relative_
bool relative_
Definition stage.h:229
BALL::VIEW::LightSource::Types
Types
Enumeration of different types of lights.
Definition stage.h:59
BALL::VIEW::LightSource::AMBIENT
@ AMBIENT
Definition stage.h:64
BALL::VIEW::LightSource::POSITIONAL
@ POSITIONAL
Definition stage.h:70
BALL::VIEW::LightSource::DIRECTIONAL
@ DIRECTIONAL
Definition stage.h:74
BALL::VIEW::LightSource::isRelativeToCamera
bool isRelativeToCamera() const
Test if a LightSource will move with the Camera.
Definition stage.h:172
BALL::VIEW::LightSource::attenuation_
Vector3 attenuation_
Definition stage.h:208
BALL::VIEW::LightSource::direction_
Vector3 direction_
Definition stage.h:205
BALL::VIEW::LightSource::position_
Vector3 position_
Definition stage.h:202
BALL::VIEW::LightSource::type_
Index type_
Definition stage.h:226
BALL::VIEW::LightSource::r_position_
Vector3 r_position_
Definition stage.h:211
BALL::VIEW::Stage::Material
Definition stage.h:246
BALL::VIEW::Stage::Material::ambient_intensity
float ambient_intensity
Definition stage.h:272
BALL::VIEW::Stage::Material::reflective_color
ColorRGBA reflective_color
Definition stage.h:277
BALL::VIEW::Stage::Material::specular_color
ColorRGBA specular_color
Definition stage.h:274
BALL::VIEW::Stage::Material::persistentRead
virtual void persistentRead(PersistenceManager &pm)
BALL::VIEW::Stage::Material::persistentWrite
virtual void persistentWrite(PersistenceManager &pm, const char *name=0) const
BALL::VIEW::Stage::Material::transparency
float transparency
Definition stage.h:281
BALL::VIEW::Stage::Material::ambient_color
ColorRGBA ambient_color
Definition stage.h:271
BALL::VIEW::Stage::Material::reflective_intensity
float reflective_intensity
Definition stage.h:278
BALL::VIEW::Stage::Material::shininess
float shininess
Definition stage.h:280
BALL::VIEW::Stage::Material::Material
Material()
BALL::VIEW::Stage::Material::specular_intensity
float specular_intensity
Definition stage.h:275
BALL::VIEW::Stage::RaytracingMaterial
Definition stage.h:286
BALL::VIEW::Stage::setFogIntensity
void setFogIntensity(float value)
Definition stage.h:412
BALL::VIEW::Stage::coordinateSystemEnabled
bool coordinateSystemEnabled() const
Shows coordinate system.
Definition stage.h:380
BALL::VIEW::Stage::setSwapSideBySideStereo
void setSwapSideBySideStereo(bool state)
Settings for side by side stereo side swapping.
Definition stage.h:400
BALL::VIEW::Stage::getMaterial
Material & getMaterial()
Gives access to the default material parameters.
Definition stage.h:448
BALL::VIEW::Stage::swapSideBySideStereo
bool swapSideBySideStereo() const
Get settings for side by side stereo side swapping.
Definition stage.h:404
BALL::VIEW::Stage::getFocalDistance
float getFocalDistance() const
Get the focal distance for the stereo view.
Definition stage.h:396
BALL::VIEW::Stage::eye_distance_
float eye_distance_
Definition stage.h:474
BALL::VIEW::Stage::getCamera
virtual Camera & getCamera()
Get the camera.
Definition stage.h:347
BALL::VIEW::Stage::getMaterial
const Material & getMaterial() const
Gives access to the default material parameters, const version.
Definition stage.h:451
BALL::VIEW::Stage::Stage
Stage(const Stage &stage)
Copy constructor.
BALL::VIEW::Stage::setFocalDistance
void setFocalDistance(float value)
Set the focal distance for the stereo view.
Definition stage.h:392
BALL::VIEW::Stage::getLightSource
virtual LightSource & getLightSource(Position i)
Get a reference to the i-th light source.
Definition stage.h:319
BALL::VIEW::Stage::material_
Material material_
Definition stage.h:483
BALL::VIEW::Stage::getCamera
virtual const Camera & getCamera() const
Get the camera (const).
Definition stage.h:351
BALL::VIEW::Stage::background_color_
ColorRGBA background_color_
Definition stage.h:456
BALL::VIEW::Stage::getBackgroundColor
virtual const ColorRGBA & getBackgroundColor() const
Get the background color.
Definition stage.h:360
BALL::VIEW::Stage::show_coordinate_system_
bool show_coordinate_system_
Definition stage.h:468
BALL::VIEW::Stage::setInfoColor
virtual void setInfoColor(const ColorRGBA &color)
Set the background color.
Definition stage.h:372
BALL::VIEW::Stage::clear
virtual void clear()
Explicit default initialization.
BALL::VIEW::Stage::info_color_
ColorRGBA info_color_
Definition stage.h:459
BALL::VIEW::Stage::camera_
Camera camera_
Definition stage.h:465
BALL::VIEW::Stage::setCamera
virtual void setCamera(const Camera &camera)
Definition stage.h:356
BALL::VIEW::Stage::focal_distance_
float focal_distance_
Definition stage.h:477
BALL::VIEW::Stage::getInfoColor
virtual const ColorRGBA & getInfoColor() const
Get the background color.
Definition stage.h:368
BALL::VIEW::Stage::fog_intensity_
float fog_intensity_
Definition stage.h:471
BALL::VIEW::Stage::calculateAbsoluteCoordinates
Vector3 calculateAbsoluteCoordinates(Vector3 pos) const
BALL::VIEW::Stage::setBackgroundColor
virtual void setBackgroundColor(const ColorRGBA &color)
Set the background color.
Definition stage.h:364
BALL::VIEW::Stage::getFogIntensity
float getFogIntensity() const
Definition stage.h:408
BALL::VIEW::Stage::calculateRelativeCoordinates
Vector3 calculateRelativeCoordinates(Vector3 pos) const
BALL::VIEW::Stage::removeLightSource
virtual void removeLightSource(const LightSource &light_source)
Remove a light source.
BALL::VIEW::Stage::getLightSources
virtual const std::list< LightSource > & getLightSources() const
Get the light sources (const).
Definition stage.h:315
BALL::VIEW::Stage::dump
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
BALL::VIEW::Stage::Stage
Stage()
BALL::VIEW::Stage::~Stage
virtual ~Stage()
Destructor.
Definition stage.h:304
BALL::VIEW::Stage::getEyeDistance
float getEyeDistance() const
Get the eye distance for the stereo view.
Definition stage.h:388
BALL::VIEW::Stage::addLightSource
virtual void addLightSource(const LightSource &light_source)
Add a light source.
BALL::VIEW::Stage::setEyeDistance
void setEyeDistance(float value)
Set the eye distance for the stereo view.
Definition stage.h:384
BALL::VIEW::Stage::showCoordinateSystem
void showCoordinateSystem(bool state)
Show coordinate system.
Definition stage.h:376
BALL::VIEW::Stage::swap_side_by_side_stereo_
bool swap_side_by_side_stereo_
Definition stage.h:480
BALL::VIEW::Stage::clearLightSources
void clearLightSources()
BALL::VIEW::Stage::light_sources_
std::list< LightSource > light_sources_
Definition stage.h:462
colorRGBA.h
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
matrix44.h
BALL::VIEW
Definition constraints.h:35
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
BALL::Vector3
TVector3< float > Vector3
Definition vector3.h:1084
BALL::Angle
TAngle< float > Angle
Definition angle.h:697
BALL::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
quaternion.h
representation.h
vector3.h