Canvas FAQs: Difference between revisions

Jump to navigation Jump to search
1,436 bytes added ,  9 July 2017
Line 137: Line 137:
If we don't do that, we will continue to see cool Canvas features implemented as spaghetti code monsters that reflect badly upon Nasal and Canvas due to lack of of design, and performance.<ref>{{cite web
If we don't do that, we will continue to see cool Canvas features implemented as spaghetti code monsters that reflect badly upon Nasal and Canvas due to lack of of design, and performance.<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=260810#p260810  
   |url    =  https://forum.flightgear.org/viewtopic.php?p=260810#p260810  
  |title  =  <nowiki> Re: WINDOW IN WINDOW </nowiki>
  |author =  <nowiki> Hooray </nowiki>
  |date  =  Oct 17th, 2015
  |added  =  Oct 17th, 2015
  |script_version = 0.40
  }}</ref>
tail cams are slaved cameras, so could be using code that already exists in FG, which would need to be integrated with the Canvas system, to be exposed as a dedicated Canvas element (kinda like the view manager rendering everything to a texture/osg::Geode).
There's window setup/handling code in CameraGroup.cxx which sets up these slaved views and renders the whole thing to a osg::TextureRectangle, which is pretty much what needs to be extracted and integrated with a new "CanvasCamera" element - the boilerplate for which can be seen at: [Canvas
The whole RTT/FBO texture setup can be seen here: http://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Viewer/CameraGroup.cxx#l994
That code would be redundant in the Canvas context, i.e. could be replaced by a Canvas FBO instead.
The next step would then be wrapping the whole thing in a CanvasCamera and exposing the corresponding view parameters as properties (propertyObject) so that slaved cameras can be controlled via Canvas.
Otherwise, there is only very little else needed, because the CanvasMgr would handle updating the Camera, and render everything to the texture that you specified.<ref>{{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=260812#p260812
   |title  =  <nowiki> Re: WINDOW IN WINDOW </nowiki>  
   |title  =  <nowiki> Re: WINDOW IN WINDOW </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  

Navigation menu