00001 /* 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, *** 00017 *** MERIGNAC, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 */ 00020 00021 #pragma once 00022 00023 #include <Inventor/misc/SoRefCounter.h> 00024 #include <Inventor/actions/SoGLRenderAction.h> 00025 #include <Inventor/SbColorRGBA.h> 00026 #include <Inventor/SbVec.h> 00027 #include <Inventor/SbString.h> 00028 #include <Inventor/SbViewportRegion.h> 00029 #include <Inventor/SbEventHandler.h> 00030 #include <Inventor/SbEventArg.h> 00031 #include <Inventor/SbPImpl.h> 00032 #include <Inventor/image/SbRasterImage.h> 00033 #include <Inventor/ViewerComponents/SoRenderAreaCore.h> 00034 00035 class SoGLContext; 00036 class SoBufferObject; 00037 class SoRenderAreaCore; 00038 class SoNode; 00039 class SoSceneManager; 00040 00041 00042 SO_PIMPL_BASE_PUBLIC_DECLARATION(SoOffscreenRenderArea); 00043 00150 class SoOffscreenRenderArea : public SoRefCounter, public SiRenderArea, public SiRenderAreaAntialiasing, public SiRenderAreaTransparency 00151 { 00152 SO_PIMPL_BASE_PUBLIC_HEADER(SoOffscreenRenderArea); 00153 00154 public: 00160 SoOffscreenRenderArea(); 00161 00165 SoOffscreenRenderArea(SoGLContext* glContex); 00166 00171 SoOffscreenRenderArea(SoRenderAreaCore* renderAreaCore); 00172 00176 ~SoOffscreenRenderArea(); 00177 00181 virtual void setSceneGraph(SoNode *newScene); 00182 00186 virtual SoNode* getSceneGraph() const; 00187 00191 void setViewportRegion(const SbViewportRegion &newRegion); 00192 00196 SbViewportRegion getViewportRegion() const; 00197 00207 virtual void setTransparencyType(SoGLRenderAction::TransparencyType type); 00208 00212 virtual SoGLRenderAction::TransparencyType getTransparencyType() const; 00213 00217 SoSceneManager* getSceneManager() const; 00218 00250 bool renderToFile(const SbString& filename) const; 00251 00252 00265 bool renderToBuffer(SoBufferObject* buffer) const; 00266 00280 void setTile(SbVec2i32 size, int numEdgePixels); 00281 00285 SbVec2i32 getTileSize() const; 00286 00290 int getNumEdgePixels() const; 00291 00295 virtual ClearPolicy getClearPolicy() const; 00296 00304 virtual void setClearPolicy(ClearPolicy policy); 00305 00314 virtual void setClearColor(const SbColorRGBA& color); 00315 00319 virtual SbColorRGBA getClearColor() const; 00320 00329 virtual void setClearDepth(float depth); 00330 00334 virtual float getClearDepth() const; 00335 00339 virtual void setSize(const SbVec2i32& size); 00340 00344 virtual SbVec2i32 getSize() const; 00345 00349 virtual SbEventHandler<RenderEventArg&>& onStartRender(); 00350 00354 static SbVec2i32 getMaxTileSize(); 00355 00360 virtual void setAntialiasingMode(SoSceneManager::AntialiasingMode mode); 00361 00365 virtual SoSceneManager::AntialiasingMode getAntialiasingMode() const; 00366 00372 virtual void setAntialiasingQuality(float quality); 00373 00377 virtual float getAntialiasingQuality() const; 00378 00385 virtual RenderStatus render(); 00386 00391 struct EventArg : public SbEventArg 00392 { 00393 public: 00394 00398 const SoOffscreenRenderArea* getSource() const; 00399 00403 int getNumTiles() const; 00404 00408 const SbVec2i32& getOrigin() const; 00409 00414 const SbRasterImage& getTile() const; 00415 00416 private: 00417 friend class inventor::impl::SoOffscreenRenderAreaImpl; 00418 00420 EventArg(const SoOffscreenRenderArea* renderarea, int numTiles, SoBufferObject* buffer); 00421 ~EventArg(); 00422 00423 const SoOffscreenRenderArea* m_renderarea; 00424 SbVec2i32 m_origin; 00425 int m_numTiles; 00426 SbRasterImage* m_tile; 00427 }; 00428 00432 SbEventHandler<EventArg&> onTileRendered; 00433 00434 private: 00435 00442 virtual RenderStatus render( const SbVec4i32& window ); 00443 00444 #if 1 SoDEPRECATED 00452 virtual RenderStatus render( const SbVec4s &window ) 00453 { 00454 return render( SbVec4i32( window ) ); 00455 } 00456 #endif /* 1 */ 00457 00458 }; 00459 00460 00461