openscenegraph
Camera
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_CAMERA
15#define OSG_CAMERA 1
16
17#include <osg/Transform>
18#include <osg/Viewport>
19#include <osg/ColorMask>
20#include <osg/CullSettings>
21#include <osg/Texture>
22#include <osg/Image>
23#include <osg/GraphicsContext>
24#include <osg/Stats>
25
26#include <OpenThreads/Mutex>
27
28
29#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_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
34#endif
35
36namespace osg {
37
38// forward declare View to allow Camera to point back to the View that its within
39class View;
40class RenderInfo;
41
45{
46 public :
47
48
50
52 Camera(const Camera&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
53
55
56 virtual Camera* asCamera() { return this; }
57 virtual const Camera* asCamera() const { return this; }
58
60 void setView(View* view) { _view = view; }
61
63 View* getView() { return _view; }
64
66 const View* getView() const { return _view; }
67
68
71 void setStats(osg::Stats* stats) { _stats = stats; }
72
74 osg::Stats* getStats() { return _stats.get(); }
75
77 const osg::Stats* getStats() const { return _stats.get(); }
78
79
82 void setAllowEventFocus(bool focus) { _allowEventFocus = focus; }
83
86 bool getAllowEventFocus() const { return _allowEventFocus; }
87
88
90 void setDisplaySettings(osg::DisplaySettings* ds) { _displaySettings = ds; }
91
93 osg::DisplaySettings* getDisplaySettings() { return _displaySettings.get(); }
94
96 const osg::DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); }
97
98
101 inline void setClearMask(GLbitfield mask) { _clearMask = mask; applyMaskAction(CLEAR_MASK); }
102
104 inline GLbitfield getClearMask() const { return _clearMask; }
105
108 void setClearColor(const osg::Vec4& color) { _clearColor=color; applyMaskAction(CLEAR_COLOR); }
109
111 const osg::Vec4& getClearColor() const { return _clearColor; }
112
115 void setClearAccum(const osg::Vec4& color) { _clearAccum=color; }
116
118 const osg::Vec4& getClearAccum() const { return _clearAccum; }
119
122 void setClearDepth(double depth) { _clearDepth=depth; }
123
125 double getClearDepth() const { return _clearDepth; }
126
129 void setClearStencil(int stencil) { _clearStencil=stencil; }
130
132 int getClearStencil() const { return _clearStencil; }
133
134
136 void setColorMask(osg::ColorMask* colorMask);
137
138
140 void setColorMask(bool red, bool green, bool blue, bool alpha);
141
143 const ColorMask* getColorMask() const { return _colorMask.get(); }
144
146 ColorMask* getColorMask() { return _colorMask.get(); }
147
148
150 void setViewport(osg::Viewport* viewport);
151
153 void setViewport(int x,int y,int width,int height);
154
156 const Viewport* getViewport() const { return _viewport.get(); }
157
159 Viewport* getViewport() { return _viewport.get(); }
160
161
162
164 {
166 POST_MULTIPLY
167 };
168
170 void setTransformOrder(TransformOrder order) { _transformOrder = order; }
171
173 TransformOrder getTransformOrder() const { return _transformOrder; }
174
182
184 inline void setProjectionResizePolicy(ProjectionResizePolicy policy) { _projectionResizePolicy = policy; }
185
187 inline ProjectionResizePolicy getProjectionResizePolicy() const { return _projectionResizePolicy; }
188
189
191 inline void setProjectionMatrix(const osg::Matrixf& matrix) { _projectionMatrix.set(matrix); }
192
194 inline void setProjectionMatrix(const osg::Matrixd& matrix) { _projectionMatrix.set(matrix); }
195
197 void setProjectionMatrixAsOrtho(double left, double right,
198 double bottom, double top,
199 double zNear, double zFar);
200
202 void setProjectionMatrixAsOrtho2D(double left, double right,
203 double bottom, double top);
204
206 void setProjectionMatrixAsFrustum(double left, double right,
207 double bottom, double top,
208 double zNear, double zFar);
209
212 void setProjectionMatrixAsPerspective(double fovy,double aspectRatio,
213 double zNear, double zFar);
214
216 osg::Matrixd& getProjectionMatrix() { return _projectionMatrix; }
217
219 const osg::Matrixd& getProjectionMatrix() const { return _projectionMatrix; }
220
223 bool getProjectionMatrixAsOrtho(double& left, double& right,
224 double& bottom, double& top,
225 double& zNear, double& zFar) const;
226
229 bool getProjectionMatrixAsFrustum(double& left, double& right,
230 double& bottom, double& top,
231 double& zNear, double& zFar) const;
232
238 bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio,
239 double& zNear, double& zFar) const;
240
241
242
244 inline void setViewMatrix(const osg::Matrixf& matrix) { _viewMatrix.set(matrix); dirtyBound();}
245
247 inline void setViewMatrix(const osg::Matrixd& matrix) { _viewMatrix.set(matrix); dirtyBound();}
248
250 osg::Matrixd& getViewMatrix() { return _viewMatrix; }
251
253 const osg::Matrixd& getViewMatrix() const { return _viewMatrix; }
254
256 void setViewMatrixAsLookAt(const osg::Vec3d& eye,const osg::Vec3d& center,const osg::Vec3d& up);
257
259 void getViewMatrixAsLookAt(osg::Vec3d& eye,osg::Vec3d& center,osg::Vec3d& up,double lookDistance=1.0) const;
260
262 void getViewMatrixAsLookAt(osg::Vec3f& eye,osg::Vec3f& center,osg::Vec3f& up,float lookDistance=1.0f) const;
263
266
267
269 {
272 POST_RENDER
273 };
274
278 void setRenderOrder(RenderOrder order, int orderNum = 0) { _renderOrder = order; _renderOrderNum = orderNum; }
279
281 RenderOrder getRenderOrder() const { return _renderOrder; }
282
284 int getRenderOrderNum() const { return _renderOrderNum; }
285
288
297
300
303
305 RenderTargetImplementation getRenderTargetImplementation() const { return _renderTargetImplementation; }
306
308 RenderTargetImplementation getRenderTargetFallback() const { return _renderTargetFallback; }
309
310
313 void setDrawBuffer(GLenum buffer) { _drawBuffer = buffer; applyMaskAction( DRAW_BUFFER ); }
314
316 GLenum getDrawBuffer() const { return _drawBuffer; }
317
320 void setReadBuffer(GLenum buffer) { _readBuffer = buffer; applyMaskAction( READ_BUFFER ); }
321
323 GLenum getReadBuffer() const { return _readBuffer; }
324
326 {
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
347 };
348
349 static const unsigned int FACE_CONTROLLED_BY_GEOMETRY_SHADER;
350
352 void attach(BufferComponent buffer, GLenum internalFormat);
353
358 void attach(BufferComponent buffer, osg::Texture* texture, unsigned int level = 0, unsigned int face=0, bool mipMapGeneration=false,
359 unsigned int multisampleSamples = 0,
360 unsigned int multisampleColorSamples = 0);
361
363 void attach(BufferComponent buffer, osg::Image* image,
364 unsigned int multisampleSamples = 0,
365 unsigned int multisampleColorSamples = 0);
366
369
371 {
373 _internalFormat(GL_NONE),
374 _level(0),
375 _face(0),
376 _mipMapGeneration(false),
377 _multisampleSamples(0),
378 _multisampleColorSamples(0) {}
379
380 int width() const
381 {
382 if (_texture.valid()) return _texture->getTextureWidth();
383 if (_image.valid()) return _image->s();
384 return 0;
385 };
386
387 int height() const
388 {
389 if (_texture.valid()) return _texture->getTextureHeight();
390 if (_image.valid()) return _image->t();
391 return 0;
392 };
393
394 int depth() const
395 {
396 if (_texture.valid()) return _texture->getTextureDepth();
397 if (_image.valid()) return _image->r();
398 return 0;
399 };
400
404 unsigned int _level;
405 unsigned int _face;
409 };
410
411 typedef std::map< BufferComponent, Attachment> BufferAttachmentMap;
412
414 BufferAttachmentMap& getBufferAttachmentMap() { return _bufferAttachmentMap; }
415
417 const BufferAttachmentMap& getBufferAttachmentMap() const { return _bufferAttachmentMap; }
418
419
421 void dirtyAttachmentMap() { ++_attachmentMapModifiedCount; }
422
424 void setAttachmentMapModifiedCount(unsigned int v) { _attachmentMapModifiedCount = v; }
425
427 unsigned int getAttachmentMapModifiedCount() const { return _attachmentMapModifiedCount; }
428
430 void resizeAttachments(int width, int height);
431
432
434 {
435 RESIZE_VIEWPORT=1,
436 RESIZE_ATTACHMENTS=2,
437 RESIZE_PROJECTIONMATRIX=4,
438 RESIZE_DEFAULT=RESIZE_VIEWPORT|RESIZE_ATTACHMENTS
439 };
440
443 void resize(int width, int height, int resizeMask=RESIZE_DEFAULT);
444
445
473 {
474 IMPLICIT_DEPTH_BUFFER_ATTACHMENT = DisplaySettings::IMPLICIT_DEPTH_BUFFER_ATTACHMENT,
475 IMPLICIT_STENCIL_BUFFER_ATTACHMENT = DisplaySettings::IMPLICIT_STENCIL_BUFFER_ATTACHMENT,
476 IMPLICIT_COLOR_BUFFER_ATTACHMENT = DisplaySettings::IMPLICIT_COLOR_BUFFER_ATTACHMENT,
477 USE_DISPLAY_SETTINGS_MASK = (~0)
478 };
479
481
482 void setImplicitBufferAttachmentMask(ImplicitBufferAttachmentMask renderMask = DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT, ImplicitBufferAttachmentMask resolveMask = DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT)
483 {
484 _implicitBufferAttachmentRenderMask = renderMask;
485 _implicitBufferAttachmentResolveMask = resolveMask;
486 }
487
489 {
490 _implicitBufferAttachmentRenderMask = implicitBufferAttachmentRenderMask;
491 }
492
494 {
495 _implicitBufferAttachmentResolveMask = implicitBufferAttachmentResolveMask;
496 }
497
499 {
500 return _implicitBufferAttachmentRenderMask;
501 }
502
509 {
510 if( effectiveMask && _implicitBufferAttachmentRenderMask == USE_DISPLAY_SETTINGS_MASK )
511 {
512 const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get();
514 }
515 else
516 {
517 return _implicitBufferAttachmentRenderMask;
518 }
519 }
520
522 {
523 return _implicitBufferAttachmentResolveMask;
524 }
525
532 {
533 if( effectiveMask && _implicitBufferAttachmentResolveMask == USE_DISPLAY_SETTINGS_MASK )
534 {
535 const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get();
537 }
538 else
539 {
540 return _implicitBufferAttachmentResolveMask;
541 }
542 }
543
547 const OpenThreads::Affinity& getProcessorAffinity() const { return _affinity; }
548
551
554
556 OperationThread* getCameraThread() { return _cameraThread.get(); }
557
559 const OperationThread* getCameraThread() const { return _cameraThread.get(); }
560
561
562
565
567 GraphicsContext* getGraphicsContext() { return _graphicsContext.get(); }
568
570 const GraphicsContext* getGraphicsContext() const { return _graphicsContext.get(); }
571
572
574 void setRenderer(osg::GraphicsOperation* rc) { _renderer = rc; }
575
577 osg::GraphicsOperation* getRenderer() { return _renderer.get(); }
578
580 const osg::GraphicsOperation* getRenderer() const { return _renderer.get(); }
581
582
584 void setRenderingCache(osg::Object* rc) { _renderingCache = rc; }
585
587 osg::Object* getRenderingCache() { return _renderingCache.get(); }
588
590 const osg::Object* getRenderingCache() const { return _renderingCache.get(); }
591
592
595 {
597
598 DrawCallback(const DrawCallback& org,const CopyOp& copyop):
599 Callback(org, copyop) {}
600
602
604 inline void run(osg::RenderInfo& renderInfo) const
605 {
606 operator () (renderInfo);
607
608 if (_nestedCallback.valid())
609 ((const DrawCallback*)_nestedCallback.get())->run(renderInfo);
610 }
611
613 virtual void operator () (osg::RenderInfo& renderInfo) const;
614
616 virtual void operator () (const osg::Camera& /*camera*/) const {}
617
619 virtual void resizeGLObjectBuffers(unsigned int maxSize)
620 {
621 if (_nestedCallback.valid())
622 _nestedCallback->resizeGLObjectBuffers(maxSize);
623 }
624
628 virtual void releaseGLObjects(osg::State* state = 0) const
629 {
630 if (_nestedCallback.valid())
631 _nestedCallback->releaseGLObjects(state);
632 }
633
634 };
635
637 void setInitialDrawCallback(DrawCallback* cb) { _initialDrawCallback = cb; }
638
640 DrawCallback* getInitialDrawCallback() { return _initialDrawCallback.get(); }
641
643 const DrawCallback* getInitialDrawCallback() const { return _initialDrawCallback.get(); }
644
647 {
648 if (nc != NULL)
649 {
650 if (_initialDrawCallback.valid()) _initialDrawCallback->addNestedCallback(nc);
651 else setInitialDrawCallback(nc);
652 }
653 }
654
655 template<class T> void addInitialDrawCallback(const ref_ptr<T>& nc) { addInitialDrawCallback(nc.get()); }
656
659 {
660 if (nc != NULL && _initialDrawCallback.valid())
661 {
662 if (_initialDrawCallback == nc)
663 {
664 ref_ptr< DrawCallback> new_nested_callback = (DrawCallback*) nc->getNestedCallback();
665 nc->setNestedCallback(0);
666 setInitialDrawCallback(new_nested_callback.get());
667 }
668 else _initialDrawCallback->removeNestedCallback(nc);
669 }
670 }
671
672 template<class T> void removeInitialDrawCallback(const ref_ptr<T>& nc) { removeInitialDrawCallback(nc.get()); }
673
675 void setPreDrawCallback(DrawCallback* cb) { _preDrawCallback = cb; }
676
678 DrawCallback* getPreDrawCallback() { return _preDrawCallback.get(); }
679
681 const DrawCallback* getPreDrawCallback() const { return _preDrawCallback.get(); }
682
685 {
686 if (nc != NULL)
687 {
688 if (_preDrawCallback.valid()) _preDrawCallback->addNestedCallback(nc);
689 else setPreDrawCallback(nc);
690 }
691 }
692
693 template<class T> void addPreDrawCallback(const ref_ptr<T>& nc) { addPreDrawCallback(nc.get()); }
694
697 {
698 if (nc != NULL && _preDrawCallback.valid())
699 {
700 if (_preDrawCallback == nc)
701 {
702 ref_ptr< DrawCallback> new_nested_callback = (DrawCallback*) nc->getNestedCallback();
703 nc->setNestedCallback(0);
704 setPreDrawCallback(new_nested_callback.get());
705 }
706 else _preDrawCallback->removeNestedCallback(nc);
707 }
708 }
709
710 template<class T> void removePreDrawCallback(const ref_ptr<T>& nc) { removePreDrawCallback(nc.get()); }
711
713 void setPostDrawCallback(DrawCallback* cb) { _postDrawCallback = cb; }
714
716 DrawCallback* getPostDrawCallback() { return _postDrawCallback.get(); }
717
719 const DrawCallback* getPostDrawCallback() const { return _postDrawCallback.get(); }
720
723 {
724 if (nc != NULL)
725 {
726 if (_postDrawCallback.valid()) _postDrawCallback->addNestedCallback(nc);
727 else setPostDrawCallback(nc);
728 }
729 }
730
731 template<class T> void addPostDrawCallback(const ref_ptr<T>& nc) { addPostDrawCallback(nc.get()); }
732
735 {
736 if (nc != NULL && _postDrawCallback.valid())
737 {
738 if (_postDrawCallback == nc)
739 {
740 ref_ptr< DrawCallback> new_nested_callback = (DrawCallback*) nc->getNestedCallback();
741 nc->setNestedCallback(0);
742 setPostDrawCallback(new_nested_callback.get());
743 }
744 else _postDrawCallback->removeNestedCallback(nc);
745 }
746 }
747
748 template<class T> void removePostDrawCallback(const ref_ptr<T>& nc) { removePostDrawCallback(nc.get()); }
749
751 void setFinalDrawCallback(DrawCallback* cb) { _finalDrawCallback = cb; }
752
754 DrawCallback* getFinalDrawCallback() { return _finalDrawCallback.get(); }
755
757 const DrawCallback* getFinalDrawCallback() const { return _finalDrawCallback.get(); }
758
761 {
762 if (nc != NULL)
763 {
764 if (_finalDrawCallback.valid()) _finalDrawCallback->addNestedCallback(nc);
765 else setFinalDrawCallback(nc);
766 }
767 }
768
769 template<class T> void addFinalDrawCallback(const ref_ptr<T>& nc) { addFinalDrawCallback(nc.get()); }
770
773 {
774 if (nc != NULL && _finalDrawCallback.valid())
775 {
776 if (_finalDrawCallback == nc)
777 {
778 ref_ptr< DrawCallback> new_nested_callback = (DrawCallback*) nc->getNestedCallback();
779 nc->setNestedCallback(0);
780 setFinalDrawCallback(new_nested_callback.get());
781 }
782 else _finalDrawCallback->removeNestedCallback(nc);
783 }
784 }
785
786 template<class T> void removeFinalDrawCallback(const ref_ptr<T>& nc) { removeFinalDrawCallback(nc.get()); }
787
788 OpenThreads::Mutex* getDataChangeMutex() const { return &_dataChangeMutex; }
789
791 virtual void resizeGLObjectBuffers(unsigned int maxSize);
792
796 virtual void releaseGLObjects(osg::State* = 0) const;
797
798 public:
799
801 virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const;
802
804 virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const;
805
807 virtual void inheritCullSettings(const CullSettings& settings, unsigned int inheritanceMask);
808
809 protected :
810
811 virtual ~Camera();
812
814
815
817
819
821
823
824 GLbitfield _clearMask;
829
832
835
838
841
844
850
852
855
857
860
865};
866
867
870{
871 inline bool operator() (const Camera* lhs,const Camera* rhs) const
872 {
873 if (lhs->getRenderOrder()<rhs->getRenderOrder()) return true;
874 if (rhs->getRenderOrder()<lhs->getRenderOrder()) return false;
875 return lhs->getRenderOrderNum()<rhs->getRenderOrderNum();
876 }
877};
878
879
880}
881
882#endif
Simple container for specifying which CPU a thread should have affinity with. An empty Affinity....
Definition Affinity:34
This class provides an object-oriented thread mutex interface.
Definition Mutex:31
Definition Callback:34
osg::Callback * getNestedCallback()
Definition Callback:89
void setNestedCallback(osg::Callback *cb)
Definition Callback:88
Definition Camera:45
void setViewport(int x, int y, int width, int height)
osg::Vec4 _clearAccum
Definition Camera:826
ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask(bool effectiveMask) const
Definition Camera:508
BufferAttachmentMap _bufferAttachmentMap
Definition Camera:847
void setProjectionMatrix(const osg::Matrixf &matrix)
Definition Camera:191
ColorMask * getColorMask()
Definition Camera:146
OpenThreads::Affinity _affinity
Definition Camera:853
osg::ref_ptr< osg::Stats > _stats
Definition Camera:818
ref_ptr< DrawCallback > _postDrawCallback
Definition Camera:863
ProjectionResizePolicy _projectionResizePolicy
Definition Camera:834
ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask() const
Definition Camera:498
osg::Matrixd & getProjectionMatrix()
Definition Camera:216
void removePostDrawCallback(const ref_ptr< T > &nc)
Definition Camera:748
void setRenderTargetImplementation(RenderTargetImplementation impl, RenderTargetImplementation fallback)
GLbitfield _clearMask
Definition Camera:824
void attach(BufferComponent buffer, GLenum internalFormat)
void setClearDepth(double depth)
Definition Camera:122
virtual bool computeWorldToLocalMatrix(Matrix &matrix, NodeVisitor *) const
void removeInitialDrawCallback(const ref_ptr< T > &nc)
Definition Camera:672
void setRenderTargetImplementation(RenderTargetImplementation impl)
Camera(const Camera &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
int getRenderOrderNum() const
Definition Camera:284
RenderOrder
Definition Camera:269
@ PRE_RENDER
Definition Camera:270
@ NESTED_RENDER
Definition Camera:271
void setViewMatrix(const osg::Matrixd &matrix)
Definition Camera:247
TransformOrder getTransformOrder() const
Definition Camera:173
int _clearStencil
Definition Camera:828
void setFinalDrawCallback(DrawCallback *cb)
Definition Camera:751
void setProjectionMatrix(const osg::Matrixd &matrix)
Definition Camera:194
RenderTargetImplementation
Definition Camera:290
@ FRAME_BUFFER_OBJECT
Definition Camera:291
@ PIXEL_BUFFER_RTT
Definition Camera:292
@ PIXEL_BUFFER
Definition Camera:293
@ FRAME_BUFFER
Definition Camera:294
void removeFinalDrawCallback(DrawCallback *nc)
Definition Camera:772
static const unsigned int FACE_CONTROLLED_BY_GEOMETRY_SHADER
Definition Camera:349
void addPostDrawCallback(const ref_ptr< T > &nc)
Definition Camera:731
const osg::Vec4 & getClearColor() const
Definition Camera:111
ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask() const
Definition Camera:521
unsigned int getAttachmentMapModifiedCount() const
Definition Camera:427
bool _allowEventFocus
Definition Camera:820
void setInitialDrawCallback(DrawCallback *cb)
Definition Camera:637
void attach(BufferComponent buffer, osg::Image *image, unsigned int multisampleSamples=0, unsigned int multisampleColorSamples=0)
const ColorMask * getColorMask() const
Definition Camera:143
ref_ptr< Object > _renderingCache
Definition Camera:859
void addPostDrawCallback(DrawCallback *nc)
Definition Camera:722
void attach(BufferComponent buffer, osg::Texture *texture, unsigned int level=0, unsigned int face=0, bool mipMapGeneration=false, unsigned int multisampleSamples=0, unsigned int multisampleColorSamples=0)
void addPreDrawCallback(DrawCallback *nc)
Definition Camera:684
DrawCallback * getPostDrawCallback()
Definition Camera:716
DrawCallback * getPreDrawCallback()
Definition Camera:678
const osg::DisplaySettings * getDisplaySettings() const
Definition Camera:96
Matrixd _projectionMatrix
Definition Camera:836
void removePostDrawCallback(DrawCallback *nc)
Definition Camera:734
void removeInitialDrawCallback(DrawCallback *nc)
Definition Camera:658
OperationThread * getCameraThread()
Definition Camera:556
META_Node(osg, Camera)
unsigned int _attachmentMapModifiedCount
Definition Camera:851
osg::Object * getRenderingCache()
Definition Camera:587
void setColorMask(osg::ColorMask *colorMask)
void setDisplaySettings(osg::DisplaySettings *ds)
Definition Camera:90
void addFinalDrawCallback(DrawCallback *nc)
Definition Camera:760
RenderTargetImplementation getRenderTargetImplementation() const
Definition Camera:305
Matrixd getInverseViewMatrix() const
View * _view
Definition Camera:816
void createCameraThread()
OpenThreads::Affinity & getProcessorAffinity()
Definition Camera:546
void resizeAttachments(int width, int height)
bool getProjectionMatrixAsOrtho(double &left, double &right, double &bottom, double &top, double &zNear, double &zFar) const
BufferAttachmentMap & getBufferAttachmentMap()
Definition Camera:414
GLenum getReadBuffer() const
Definition Camera:323
int _renderOrderNum
Definition Camera:840
GLenum _readBuffer
Definition Camera:843
void setProjectionMatrixAsFrustum(double left, double right, double bottom, double top, double zNear, double zFar)
const osg::Object * getRenderingCache() const
Definition Camera:590
void setViewMatrixAsLookAt(const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up)
void removeFinalDrawCallback(const ref_ptr< T > &nc)
Definition Camera:786
osg::Vec4 _clearColor
Definition Camera:825
Viewport * getViewport()
Definition Camera:159
const DrawCallback * getPostDrawCallback() const
Definition Camera:719
virtual ~Camera()
osg::DisplaySettings * getDisplaySettings()
Definition Camera:93
osg::Stats * getStats()
Definition Camera:74
ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask
Definition Camera:848
void setClearAccum(const osg::Vec4 &color)
Definition Camera:115
int ImplicitBufferAttachmentMask
Definition Camera:480
const osg::Matrixd & getViewMatrix() const
Definition Camera:253
void setProjectionResizePolicy(ProjectionResizePolicy policy)
Definition Camera:184
virtual const Camera * asCamera() const
Definition Camera:57
RenderOrder _renderOrder
Definition Camera:839
virtual bool computeLocalToWorldMatrix(Matrix &matrix, NodeVisitor *) const
virtual void resizeGLObjectBuffers(unsigned int maxSize)
void removePreDrawCallback(const ref_ptr< T > &nc)
Definition Camera:710
void setDrawBuffer(GLenum buffer)
Definition Camera:313
ImplicitBufferAttachment
Definition Camera:473
DrawCallback * getFinalDrawCallback()
Definition Camera:754
void getViewMatrixAsLookAt(osg::Vec3f &eye, osg::Vec3f &center, osg::Vec3f &up, float lookDistance=1.0f) const
void setProjectionMatrixAsOrtho2D(double left, double right, double bottom, double top)
RenderTargetImplementation getRenderTargetFallback() const
Definition Camera:308
void getViewMatrixAsLookAt(osg::Vec3d &eye, osg::Vec3d &center, osg::Vec3d &up, double lookDistance=1.0) const
void setProcessorAffinity(const OpenThreads::Affinity &affinity)
GLenum _drawBuffer
Definition Camera:842
osg::ref_ptr< osg::DisplaySettings > _displaySettings
Definition Camera:822
void setColorMask(bool red, bool green, bool blue, bool alpha)
double getClearDepth() const
Definition Camera:125
void setPreDrawCallback(DrawCallback *cb)
Definition Camera:675
void setClearColor(const osg::Vec4 &color)
Definition Camera:108
void setCameraThread(OperationThread *gt)
RenderTargetImplementation _renderTargetFallback
Definition Camera:846
virtual Camera * asCamera()
Definition Camera:56
void setGraphicsContext(GraphicsContext *context)
virtual void inheritCullSettings(const CullSettings &settings, unsigned int inheritanceMask)
const OperationThread * getCameraThread() const
Definition Camera:559
RenderTargetImplementation _renderTargetImplementation
Definition Camera:845
const DrawCallback * getFinalDrawCallback() const
Definition Camera:757
void resize(int width, int height, int resizeMask=RESIZE_DEFAULT)
ref_ptr< ColorMask > _colorMask
Definition Camera:830
void setClearStencil(int stencil)
Definition Camera:129
void setPostDrawCallback(DrawCallback *cb)
Definition Camera:713
const OpenThreads::Affinity & getProcessorAffinity() const
Definition Camera:547
const osg::Vec4 & getClearAccum() const
Definition Camera:118
DrawCallback * getInitialDrawCallback()
Definition Camera:640
void setAttachmentMapModifiedCount(unsigned int v)
Definition Camera:424
ref_ptr< GraphicsOperation > _renderer
Definition Camera:858
void removePreDrawCallback(DrawCallback *nc)
Definition Camera:696
void addInitialDrawCallback(const ref_ptr< T > &nc)
Definition Camera:655
void setClearMask(GLbitfield mask)
Definition Camera:101
GLenum getDrawBuffer() const
Definition Camera:316
const osg::GraphicsOperation * getRenderer() const
Definition Camera:580
osg::GraphicsOperation * getRenderer()
Definition Camera:577
ref_ptr< DrawCallback > _initialDrawCallback
Definition Camera:861
void setViewMatrix(const osg::Matrixf &matrix)
Definition Camera:244
bool getProjectionMatrixAsPerspective(double &fovy, double &aspectRatio, double &zNear, double &zFar) const
const DrawCallback * getPreDrawCallback() const
Definition Camera:681
void setProjectionMatrixAsOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
ResizeMask
Definition Camera:434
bool isRenderToTextureCamera() const
TransformOrder _transformOrder
Definition Camera:833
OpenThreads::Mutex * getDataChangeMutex() const
Definition Camera:788
const osg::Stats * getStats() const
Definition Camera:77
void setImplicitBufferAttachmentResolveMask(ImplicitBufferAttachmentMask implicitBufferAttachmentResolveMask)
Definition Camera:493
void detach(BufferComponent buffer)
void addInitialDrawCallback(DrawCallback *nc)
Definition Camera:646
bool getProjectionMatrixAsFrustum(double &left, double &right, double &bottom, double &top, double &zNear, double &zFar) const
void setViewport(osg::Viewport *viewport)
void dirtyAttachmentMap()
Definition Camera:421
OpenThreads::Mutex _dataChangeMutex
Definition Camera:813
void setRenderer(osg::GraphicsOperation *rc)
Definition Camera:574
const Viewport * getViewport() const
Definition Camera:156
double _clearDepth
Definition Camera:827
GLbitfield getClearMask() const
Definition Camera:104
const View * getView() const
Definition Camera:66
std::map< BufferComponent, Attachment > BufferAttachmentMap
Definition Camera:411
ProjectionResizePolicy
Definition Camera:176
@ FIXED
Definition Camera:177
@ HORIZONTAL
Definition Camera:178
const osg::Matrixd & getProjectionMatrix() const
Definition Camera:219
void setImplicitBufferAttachmentMask(ImplicitBufferAttachmentMask renderMask=DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT, ImplicitBufferAttachmentMask resolveMask=DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT)
Definition Camera:482
virtual void releaseGLObjects(osg::State *=0) const
ref_ptr< DrawCallback > _finalDrawCallback
Definition Camera:864
ref_ptr< OperationThread > _cameraThread
Definition Camera:854
void setReadBuffer(GLenum buffer)
Definition Camera:320
void setImplicitBufferAttachmentRenderMask(ImplicitBufferAttachmentMask implicitBufferAttachmentRenderMask)
Definition Camera:488
void setStats(osg::Stats *stats)
Definition Camera:71
void addFinalDrawCallback(const ref_ptr< T > &nc)
Definition Camera:769
void setRenderingCache(osg::Object *rc)
Definition Camera:584
ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask(bool effectiveMask) const
Definition Camera:531
ref_ptr< Viewport > _viewport
Definition Camera:831
ref_ptr< GraphicsContext > _graphicsContext
Definition Camera:856
osg::Matrixd & getViewMatrix()
Definition Camera:250
ref_ptr< DrawCallback > _preDrawCallback
Definition Camera:862
const DrawCallback * getInitialDrawCallback() const
Definition Camera:643
ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask
Definition Camera:849
void addPreDrawCallback(const ref_ptr< T > &nc)
Definition Camera:693
GraphicsContext * getGraphicsContext()
Definition Camera:567
View * getView()
Definition Camera:63
int getClearStencil() const
Definition Camera:132
void setRenderOrder(RenderOrder order, int orderNum=0)
Definition Camera:278
ProjectionResizePolicy getProjectionResizePolicy() const
Definition Camera:187
void setTransformOrder(TransformOrder order)
Definition Camera:170
BufferComponent
Definition Camera:326
@ COLOR_BUFFER
Definition Camera:330
@ DEPTH_BUFFER
Definition Camera:327
@ PACKED_DEPTH_STENCIL_BUFFER
Definition Camera:329
@ STENCIL_BUFFER
Definition Camera:328
@ COLOR_BUFFER0
Definition Camera:331
const GraphicsContext * getGraphicsContext() const
Definition Camera:570
bool getAllowEventFocus() const
Definition Camera:86
void setView(View *view)
Definition Camera:60
Matrixd _viewMatrix
Definition Camera:837
TransformOrder
Definition Camera:164
@ PRE_MULTIPLY
Definition Camera:165
RenderOrder getRenderOrder() const
Definition Camera:281
void setAllowEventFocus(bool focus)
Definition Camera:82
void setProjectionMatrixAsPerspective(double fovy, double aspectRatio, double zNear, double zFar)
const BufferAttachmentMap & getBufferAttachmentMap() const
Definition Camera:417
Definition ColorMask:25
Definition CopyOp:41
Definition CullSettings:28
Definition DisplaySettings:34
ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask() const
Definition DisplaySettings:254
ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask() const
Definition DisplaySettings:251
Definition GraphicsContext:30
Definition Image:179
Definition Matrixd:27
Definition Matrixf:27
Definition NodeVisitor:82
Definition Object:61
Definition OperationThread:154
Definition RenderInfo:28
Definition State:80
Definition Stats:29
Definition Texture:422
Definition Transform:75
Definition Vec3d:30
Definition Vec3f:29
Definition Vec4f:28
Definition osg/View:30
Definition Viewport:24
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define NULL
Definition osg/Export:55
#define OSG_EXPORT
Definition osg/Export:39
Definition Camera:870
bool operator()(const Camera *lhs, const Camera *rhs) const
Definition Camera:871
Definition Camera:371
GLenum _internalFormat
Definition Camera:401
unsigned int _level
Definition Camera:404
ref_ptr< Texture > _texture
Definition Camera:403
Attachment()
Definition Camera:372
int height() const
Definition Camera:387
unsigned int _multisampleColorSamples
Definition Camera:408
bool _mipMapGeneration
Definition Camera:406
int width() const
Definition Camera:380
int depth() const
Definition Camera:394
unsigned int _face
Definition Camera:405
ref_ptr< Image > _image
Definition Camera:402
unsigned int _multisampleSamples
Definition Camera:407
Definition Camera:595
void run(osg::RenderInfo &renderInfo) const
Definition Camera:604
virtual void releaseGLObjects(osg::State *state=0) const
Definition Camera:628
META_Object(osg, DrawCallback)
DrawCallback(const DrawCallback &org, const CopyOp &copyop)
Definition Camera:598
DrawCallback()
Definition Camera:596
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Definition Camera:619
Definition GraphicsThread:36