17 #include <osg/Transform>
18 #include <osg/Viewport>
19 #include <osg/ColorMask>
20 #include <osg/CullSettings>
21 #include <osg/Texture>
23 #include <osg/GraphicsContext>
26 #include <OpenThreads/Mutex>
29 #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
30 #define GL_FRONT_LEFT 0x0400
31 #define GL_FRONT_RIGHT 0x0401
32 #define GL_BACK_LEFT 0x0402
33 #define GL_BACK_RIGHT 0x0403
101 inline void setClearMask(GLbitfield mask) { _clearMask = mask; applyMaskAction(CLEAR_MASK); }
140 void setColorMask(
bool red,
bool green,
bool blue,
bool alpha);
153 void setViewport(
int x,
int y,
int width,
int height);
197 void setProjectionMatrixAsOrtho(
double left,
double right,
198 double bottom,
double top,
199 double zNear,
double zFar);
202 void setProjectionMatrixAsOrtho2D(
double left,
double right,
203 double bottom,
double top);
206 void setProjectionMatrixAsFrustum(
double left,
double right,
207 double bottom,
double top,
208 double zNear,
double zFar);
212 void setProjectionMatrixAsPerspective(
double fovy,
double aspectRatio,
213 double zNear,
double zFar);
223 bool getProjectionMatrixAsOrtho(
double& left,
double& right,
224 double& bottom,
double& top,
225 double& zNear,
double& zFar)
const;
229 bool getProjectionMatrixAsFrustum(
double& left,
double& right,
230 double& bottom,
double& top,
231 double& zNear,
double& zFar)
const;
238 bool getProjectionMatrixAsPerspective(
double& fovy,
double& aspectRatio,
239 double& zNear,
double& zFar)
const;
265 Matrixd getInverseViewMatrix()
const;
287 bool isRenderToTextureCamera()
const;
299 void setRenderTargetImplementation(RenderTargetImplementation impl);
302 void setRenderTargetImplementation(RenderTargetImplementation impl, RenderTargetImplementation fallback);
313 void setDrawBuffer(GLenum buffer) { _drawBuffer = buffer; applyMaskAction( DRAW_BUFFER ); }
320 void setReadBuffer(GLenum buffer) { _readBuffer = buffer; applyMaskAction( READ_BUFFER ); }
332 COLOR_BUFFER1 = COLOR_BUFFER0+1,
333 COLOR_BUFFER2 = COLOR_BUFFER0+2,
334 COLOR_BUFFER3 = COLOR_BUFFER0+3,
335 COLOR_BUFFER4 = COLOR_BUFFER0+4,
336 COLOR_BUFFER5 = COLOR_BUFFER0+5,
337 COLOR_BUFFER6 = COLOR_BUFFER0+6,
338 COLOR_BUFFER7 = COLOR_BUFFER0+7,
339 COLOR_BUFFER8 = COLOR_BUFFER0+8,
340 COLOR_BUFFER9 = COLOR_BUFFER0+9,
341 COLOR_BUFFER10 = COLOR_BUFFER0+10,
342 COLOR_BUFFER11 = COLOR_BUFFER0+11,
343 COLOR_BUFFER12 = COLOR_BUFFER0+12,
344 COLOR_BUFFER13 = COLOR_BUFFER0+13,
345 COLOR_BUFFER14 = COLOR_BUFFER0+14,
346 COLOR_BUFFER15 = COLOR_BUFFER0+15
359 unsigned int multisampleSamples = 0,
360 unsigned int multisampleColorSamples = 0);
364 unsigned int multisampleSamples = 0,
365 unsigned int multisampleColorSamples = 0);
376 _mipMapGeneration(false),
377 _multisampleSamples(0),
378 _multisampleColorSamples(0) {}
382 if (_texture.valid())
return _texture->getTextureWidth();
383 if (_image.valid())
return _image->s();
389 if (_texture.valid())
return _texture->getTextureHeight();
390 if (_image.valid())
return _image->t();
396 if (_texture.valid())
return _texture->getTextureDepth();
397 if (_image.valid())
return _image->r();
401 GLenum _internalFormat;
436 RESIZE_ATTACHMENTS=2,
437 RESIZE_PROJECTIONMATRIX=4,
438 RESIZE_DEFAULT=RESIZE_VIEWPORT|RESIZE_ATTACHMENTS
443 void resize(
int width,
int height,
int resizeMask=RESIZE_DEFAULT);
477 USE_DISPLAY_SETTINGS_MASK = (~0)
484 _implicitBufferAttachmentRenderMask = renderMask;
485 _implicitBufferAttachmentResolveMask = resolveMask;
490 _implicitBufferAttachmentRenderMask = implicitBufferAttachmentRenderMask;
495 _implicitBufferAttachmentResolveMask = implicitBufferAttachmentResolveMask;
505 if( effectiveMask && _implicitBufferAttachmentRenderMask == USE_DISPLAY_SETTINGS_MASK )
512 return _implicitBufferAttachmentRenderMask;
523 if( effectiveMask && _implicitBufferAttachmentResolveMask == USE_DISPLAY_SETTINGS_MASK )
530 return _implicitBufferAttachmentResolveMask;
535 void createCameraThread();
637 virtual void resizeGLObjectBuffers(
unsigned int maxSize);
642 virtual void releaseGLObjects(
osg::State* = 0)
const;
653 virtual void inheritCullSettings(
const CullSettings& settings,
unsigned int inheritanceMask);
DrawCallback(const DrawCallback &, const CopyOp &)
const osg::Stats * getStats() const
void setPreDrawCallback(DrawCallback *cb)
OpenThreads::Mutex _dataChangeMutex
static ref_ptr< DisplaySettings > & instance()
DrawCallback * getPreDrawCallback()
void setRenderer(osg::GraphicsOperation *rc)
const DrawCallback * getInitialDrawCallback() const
This class provides an object-oriented thread mutex interface.
virtual Camera * asCamera()
const DrawCallback * getPreDrawCallback() const
GLenum getDrawBuffer() const
const GraphicsContext * getGraphicsContext() const
osg::Matrixd & getProjectionMatrix()
GLenum getReadBuffer() const
ref_ptr< Texture > _texture
GLint GLenum internalFormat
const osg::Vec4 & getClearColor() const
ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask(bool effectiveMask=false) const
ref_ptr< DrawCallback > _preDrawCallback
double getClearDepth() const
BufferAttachmentMap & getBufferAttachmentMap()
GLint GLenum GLsizei GLsizei GLsizei depth
std::map< BufferComponent, Attachment > BufferAttachmentMap
OpenThreads::Mutex * getDataChangeMutex() const
void setFinalDrawCallback(DrawCallback *cb)
void setImplicitBufferAttachmentResolveMask(ImplicitBufferAttachmentMask implicitBufferAttachmentResolveMask)
unsigned int getAttachmentMapModifiedCount() const
unsigned int _multisampleColorSamples
unsigned int _attachmentMapModifiedCount
void setInitialDrawCallback(DrawCallback *cb)
ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask(bool effectiveMask=false) const
const OperationThread * getCameraThread() const
const ColorMask * getColorMask() const
ProjectionResizePolicy getProjectionResizePolicy() const
#define META_Node(library, name)
RenderOrder getRenderOrder() const
ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask() const
RenderTargetImplementation _renderTargetImplementation
osg::GraphicsOperation * getRenderer()
ref_ptr< Viewport > _viewport
void setRenderingCache(osg::Object *rc)
GLbitfield getClearMask() const
DrawCallback * getPostDrawCallback()
const BufferAttachmentMap & getBufferAttachmentMap() const
void setViewMatrix(const osg::Matrixd &matrix)
void setViewMatrix(const osg::Matrixf &matrix)
TransformOrder getTransformOrder() const
const osg::GraphicsOperation * getRenderer() const
ColorMask * getColorMask()
ref_ptr< DrawCallback > _initialDrawCallback
const osg::Vec4 & getClearAccum() const
OperationThread * getCameraThread()
ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask
int getClearStencil() const
void dirtyAttachmentMap()
ref_ptr< DrawCallback > _finalDrawCallback
void setDrawBuffer(GLenum buffer)
#define META_Object(library, name)
void setProjectionResizePolicy(ProjectionResizePolicy policy)
static const unsigned int FACE_CONTROLLED_BY_GEOMETRY_SHADER
GLint GLenum GLsizei width
DrawCallback * getInitialDrawCallback()
const Viewport * getViewport() const
const DrawCallback * getPostDrawCallback() const
const osg::Matrixd & getProjectionMatrix() const
void setDisplaySettings(osg::DisplaySettings *ds)
ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask() const
ref_ptr< GraphicsOperation > _renderer
void setReadBuffer(GLenum buffer)
ref_ptr< ColorMask > _colorMask
ref_ptr< DrawCallback > _postDrawCallback
RenderTargetImplementation
GraphicsContext * getGraphicsContext()
void setClearStencil(int stencil)
ref_ptr< GraphicsContext > _graphicsContext
TransformOrder _transformOrder
RenderTargetImplementation getRenderTargetFallback() const
void setProjectionMatrix(const osg::Matrixd &matrix)
void setPostDrawCallback(DrawCallback *cb)
void setProjectionMatrix(const osg::Matrixf &matrix)
ProjectionResizePolicy _projectionResizePolicy
GLint GLenum GLsizei GLsizei height
const osg::DisplaySettings * getDisplaySettings() const
virtual const Camera * asCamera() const
void setClearColor(const osg::Vec4 &color)
void setTransformOrder(TransformOrder order)
DrawCallback * getFinalDrawCallback()
void setAttachmentMapModifiedCount(unsigned int v)
const osg::Matrixd & getViewMatrix() const
void setStats(osg::Stats *stats)
RenderTargetImplementation getRenderTargetImplementation() const
osg::Matrixd & getViewMatrix()
ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask
osg::ref_ptr< osg::DisplaySettings > _displaySettings
Matrixd _projectionMatrix
const View * getView() const
void setClearDepth(double depth)
const DrawCallback * getFinalDrawCallback() const
osg::Object * getRenderingCache()
void setRenderOrder(RenderOrder order, int orderNum=0)
int ImplicitBufferAttachmentMask
void setAllowEventFocus(bool focus)
void setClearAccum(const osg::Vec4 &color)
void setImplicitBufferAttachmentRenderMask(ImplicitBufferAttachmentMask implicitBufferAttachmentRenderMask)
const osg::Object * getRenderingCache() const
void setImplicitBufferAttachmentMask(ImplicitBufferAttachmentMask renderMask=DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT, ImplicitBufferAttachmentMask resolveMask=DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT)
int getRenderOrderNum() const
RenderTargetImplementation _renderTargetFallback
osg::ref_ptr< osg::Stats > _stats
ref_ptr< OperationThread > _cameraThread
bool getAllowEventFocus() const
unsigned int _multisampleSamples
BufferAttachmentMap _bufferAttachmentMap
osg::DisplaySettings * getDisplaySettings()
void setClearMask(GLbitfield mask)
ref_ptr< Object > _renderingCache