25 #ifndef __SCENEBASE_HH__
26 #define __SCENEBASE_HH__
28 #include <bias_config.h>
30 #ifndef BIAS_HAVE_OPENGL
31 # error You need BIAS with USE_OpenGL Please recompile BIAS.
32 #endif // BUILD_GLviewer
35 #include <Base/Geometry/HomgPoint3D.hh>
36 #include <Base/Geometry/HomgPlane3D.hh>
38 #include <Gui/biasgl.h>
39 #include <Base/Math/Vector3.hh>
40 #include <Base/Debug/Debug.hh>
71 enum EChannel { C_BothMono, C_LeftOnly, C_RightOnly, C_BothStereo };
81 { camera_ = nc; IsActive_=
true; };
104 { dTriangleMeshDrawStyle_ = style;};
110 { renderBoundingBox_ = render; }
124 virtual void Render() ;
133 {
return ActiveChannel_; }
136 { ActiveChannel_ = channel; }
139 void SetColorMask(
bool red=
true,
bool green=
true,
bool blue=
true,
bool alpha=
true)
141 colorMask_[0] = (red) ? GL_TRUE : GL_FALSE;
142 colorMask_[1] = (green) ? GL_TRUE : GL_FALSE;
143 colorMask_[2] = (blue) ? GL_TRUE : GL_FALSE;
144 colorMask_[3] = (alpha) ? GL_TRUE : GL_FALSE;
155 virtual bool HasBoundingBoxCollision(
SceneBase* otherScene);
158 virtual double TimeToContact(
SceneBase* otherScene,
164 velocity = velocity_;
171 velocity_ = velocity;
190 gravityImmunity_ = i;
195 return gravityImmunity_;
204 virtual void PerformCollision(
SceneBase* otherscene,
214 void ApplyTimeStep(
const double& delta = 1.0,
217 const double& frictioncoefficient = 0.999);
221 static void AnimationAndCollision(std::vector<SceneBase*> scenes,
224 const double& friction = 0.999);
227 void DumpInfo()
const;
230 virtual void MoveScene(
const double& delta = 1.0);
239 virtual void RenderBoundingBox();
248 return animationSpeed_;
258 virtual void Draw() = 0;
267 GLboolean colorMask_[4];
282 #endif // __SCENEBASE_HH__
bool renderBoundingBox_
show the bounding box ?
virtual void UpdateCameraRelatedState()
Method is called by GLProjection if its params have changed.
static double animationSpeed_
how long does a single step in time take for animations ?
bool gravityImmunity_
if true, scene is not accelerated by gravity
void SetGravityImmunity(bool i)
set behaviour with respect to gravity
void SetTriangleMeshDrawStyle(TRIANGLEMESH_DRAW_STYLE style)
Set the drawing style for triangles.
TRIANGLEMESH_DRAW_STYLE dTriangleMeshDrawStyle_
virtual bool SelectObjectAt(BIAS::Vector3< double > &p)
Select a scene element/primitive at position p.
void SetPointDrawStyle(POINT_DRAW_STYLE style)
Set the drawing style for points.
double GetElasticity()
returns the elasticity value
virtual ~SceneBase()
destructor
bool GetGravityImmunity() const
is this scene accelerated by gravity ?
void SetActive(bool b)
Set whether the scene is active or not.
Abstract interface class to handle changes in rendering parameters by controllers and in rendering co...
void GetMomentum(double &mass, BIAS::Vector3< double > &velocity) const
get mass and velocity in m/s
virtual void SetRenderBoundingBox(bool render)
Set whether to render the boundign box or not.
static void SetAnimationSpeed(double s)
set time quantization for animations
bool IsActive() const
Returns whether the scene is active or not.
BIAS::Vector3< double > velocity_
scene velocity in m/s
POINT_DRAW_STYLE GetPointDrawStyle()
Get the drawing style for points.
double mass_
for collision:
void SetElasticity(const double &elas)
set collision behaviour: 1.0=elastic, no energy is lost, >1 superelastic (requires energy from outsid...
POINT_DRAW_STYLE dPointDrawStyle_
virtual GLProjectionParametersInterface * GetGLProjectionParametersInterface()
Get the camera as projectionparametersinterface, can be of type GLProjection of of any from GLProject...
virtual void ResetSelection()
Reset the selection, overwrite to react on calls to this function in derived classes.
TRIANGLEMESH_DRAW_STYLE GetTriangleMeshDrawStyle()
Get the drawing style for triangles.
class BIASGLviewer_EXPORT GLProjectionParametersInterface
Base class for all scenes.
void SetActiveChannel(const enum EChannel channel)
Set a color channel active.
static double GetAnimationSpeed()
get time quantization for animations
double elasticity_
the more elastic the less enegry is lost in collisions
virtual void GetBoundingBox(BIAS::Vector3< double > &themin, BIAS::Vector3< double > &themax)
Determine and return the bouning box of all elements of the scene.
void SetMomentum(const double &mass, const BIAS::Vector3< double > &velocity)
set mass and velocity in m/s
void SetColorMask(bool red=true, bool green=true, bool blue=true, bool alpha=true)
sets a color mask for the scene rendering
virtual void SetGLProjectionParametersInterface(GLProjectionParametersInterface *nc)
Set the camera as projectionparametersinterface, can be of type GLProjection of of any from GLProject...
BIAS::GLProjectionParametersInterface * camera_