1 #ifndef __GLPROJECTIONPARAMSBASE_HH__
2 #define __GLPROJECTIONPARAMSBASE_HH__
4 #include <bias_config.h>
6 #if !(defined(BIAS_HAVE_OPENGL)&&defined(BIAS_HAVE_GLEW))
7 #error You need BIAS with OpenGL and Glew. Please recompile BIAS
10 #include <Gui/biasgl.h>
11 #include <Geometry/ProjectionParametersBase.hh>
12 #include <Base/Image/Image.hh>
13 #include <Base/Geometry/Quaternion.hh>
14 #include <Base/Debug/Debug.hh>
15 #include <GLviewer/GLProjectionParametersInterface.hh>
16 #include <GLviewer/OffscreenRendering.hh>
17 #include <GLviewer/Scenes/SceneBase.hh>
18 #include <GLviewer/OutputAttachments/GLProjectionOutputAttachment.hh>
21 #define GetMyselfAsProjectionParameterBase GetMyselfAsProjectionParametersBase
52 virtual void SetDebugLevel(
const long int lv);
53 virtual void AddDebugLevel(
const long int lv);
62 BIASERR(
"Base class called, should be overloaded!");
80 virtual int SetExtrinsics(
float eyex,
float eyey,
float eyez,
81 float scenex,
float sceney,
float scenez,
82 float upx,
float upy,
float upz);
96 void SwitchToOffscreenRendering(
bool offscreen =
true);
98 void AppendOutputAttachment(
int type, std::vector<int> args=std::vector<int>());
120 virtual int Draw(std::vector<BIAS::SceneBase *>& scenes,
123 #ifdef BIAS_HAVE_XML2
124 virtual int XMLRead (
const std::string &Filename)=0;
125 virtual int XMLWrite(
const std::string &Filename)
const =0;
126 virtual int Load (
const std::string& filename)=0;
127 virtual int Save (
const std::string& filename)
const =0;
139 void SetZClippingPlanes(
float n,
float f);
140 void SetNearClippingPlane(
float n);
141 void SetFarClippingPlane(
float f);
157 virtual double GetDepth(
const unsigned int x,
const unsigned int y);
166 virtual int SetGLMatrices(
bool forceUpdate =
true) = 0;
168 virtual int UpdateGLProjectionMatrix_(
unsigned int x0,
unsigned int y0,
169 unsigned int width,
unsigned int height)=0;
176 virtual void SetGLCameraToLocal();
183 const float invalid = 0.0,
184 const bool flip =
true)
const;
188 const float invalid = 0.0,
189 const bool flip =
true)
const;
191 const float invalid = 0.0,
192 const bool flip =
true)
const;
196 const float invalid = 0.0);
201 void ForceSceneUpdate();
210 subtractFromBackgroundImage_ = subtract;
214 if(offscreenRenderingEnabled_) {
215 AutoViewingMatchBehaviour_ = Deny;
218 AutoViewingMatchBehaviour_ = newBehaviour;
230 bool GetViewportCoordinates(
int& x,
int& y);
268 int GetGLViewport_(
int &lowerleftx,
int &lowerlefty,
269 int &sizex,
int &sizey);
270 int SetGLViewport_(
int lowerleftx,
int lowerlefty,
271 int sizex,
int sizey);
276 virtual int Draw_(std::vector<SceneBase *>& scenes,
279 virtual void Rescale_(
float scale) = 0;
280 int UpdateGLModelViewMatrix_();
281 void SetToUnknownState_();
282 void InitBeforeDraw_();
285 virtual double Z2Depth_(
const int x,
const int y,
const double z)
const =0;
294 virtual int DrawWithMatchedParamsAndViewport_(
int viewport[4],
295 int imageWidth,
int imageHeight,
296 std::vector<SceneBase*>& scenes);
304 int DrawPartOfImage_(
const unsigned int ulX,
305 const unsigned int ulY,
306 const unsigned int width,
307 const unsigned int height,
308 std::vector<SceneBase *> scenes);
311 void ReadDepthBufferToTexture_(
int texID,
int width,
int height);
313 void PrepareOutputAttachments_();
372 #ifdef BIAS_HAVE_CLASS_OFFSCREENRENDERING
BIAS::Vector2< unsigned int > lastDrawingUpperLeft_
Keeping track which image part was drawn last time Draw() was called.
BIAS::Vector4< int > lastFullGLViewport_
Remembering the last full viewport prevent unecessary calculations in AutoRescaleParams behaviour...
GLPPB encapsulates the opengl rendering interface for the projectionparameter classes.
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
static int instanceCounter
BIAS::Matrix4x4< double > GetGLProjectionMatrixTransposed()
BIAS::Matrix4x4< double > GLProjectionMatrix_
std::deque< BIAS::GLProjectionOutputAttachment * > outputAttachments_
Scene that renders a background image behind all other scenes.
bool callInitBeforeDraw_
}@
BIAS::SceneBGImage * backgroundImageScene_
bool ExtrinsicStateChanged_
Changes to the parameters or GL state that lead to new calculation of GL_MODELVIEW matrix...
std::deque< int > outputAttachmentIdentifiers_
bool IntrinsicStateChanged_
Changes to the parameters or GL state that lead to new calculation of GL_PROJECTION matrix...
BIAS::Vector4< int > lastUsedGLViewport_
Keeping track which part of image was drawn last time Draw() was called and where it was drawn...
BIAS::Matrix4x4< double > GLModelViewMatrix_
Down-, Upsampling routines and Resize.
unsigned int instanceNum_
Abstract interface class to handle changes in rendering parameters by controllers and in rendering co...
BIAS::GLProjectionParametersInterface::ViewingReshapeBehaviour AutoViewingMatchBehaviour_
BIAS::Vector2< unsigned int > drawingUpperLeft_
When cutting the image this field is telling the projection the upper left corner of the drawn image ...
virtual float GetClearDepth()
Matrix4x4 Transpose() const
std::deque< std::vector< int > > outputAttachmentOptions_
BIAS::Vector4< float > ClearColor_
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
Utility class for offscreen rendering used by GLProjection.
BIAS::glfRenderTarget * currentRenderTarget_
float GetNearClippingPlane() const
bool FirstRenderingPassFinished()
Is true if in multipass rendering procedure is rendering for second or subsequent time...
bool subtractFromBackgroundImage_
virtual BIAS::Vector4< float > GetClearColor()
void SetClearDepth(const float d)
set the clear depth for render targets
bool informScenesOfChange_
Abstract projection params have changed, scenes have to be informed about this.
bool FirstRenderingPassFinished_
float GetFarClippingPlane() const
virtual BIAS::ProjectionParametersBase * GetMyselfAsProjectionParametersBase() const
the pure virtual GetMyselfAsProjectionParameterBase() forces the child classes to inherit from a proj...
Class for extra rendering pass in GLProjection (for now only used in glutGLviewer) ...
void SubtractFromBackgroundImage(bool subtract=true)
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
Interface for render targets.
BIAS::Matrix4x4< double > GetGLModelViewMatrixTransposed()
void SetAutoReshapeBehaviour(BIAS::GLProjectionParametersInterface::ViewingReshapeBehaviour newBehaviour)
double lastAutoRescaleRatio_