Canvas view camera element: Difference between revisions

m (→‎Roadmap: start adding high-level description for the reviewer/commit message)
Line 53: Line 53:
== Implementation / for the reviewer ==
== Implementation / for the reviewer ==


{{Note|This section provide a rough overview for the potentiaal reviewer, which is also intended to be used as the commit message when/if this should get committed}}
{{Note|This section provides a rough overview for the potentiaal reviewer, which is also intended to be used as the commit message when/if this should get committed}}


This set of patches implements a new Canvas::Element by creating a sub-class named Canvas::View. The meat of it is in the constructor, i.e. Canvas::View::View(), where an offscreen camera (RTT/FBO) is set up, the FGCanvasSystemAdapter file has been extended to provide access to the FlightGear view manager to compute/obtain the view specific view matrix, which is then updated in Canvas::View::update() accordingly.  
This set of patches implements a new Canvas::Element by creating a sub-class named Canvas::View. The meat of it is in the constructor, i.e. Canvas::View::View(), where an offscreen camera (RTT/FBO) is set up, the FGCanvasSystemAdapter file has been extended to provide access to the FlightGear view manager to compute/obtain the view specific view matrix, which is then updated in Canvas::View::update() accordingly.  
Line 60: Line 60:


<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
var (width,height) = (512,512);
var ELEMENT_NAME = "viewcamera";
var title = 'Canvas test';
var window = canvas.Window.new([width,height],"dialog").set('title',title);
var myCanvas = window.createCanvas().set("background", canvas.style.getColor("bg_color"));
var root = myCanvas.createGroup();
var child = root.createChild( ELEMENT_NAME );
child.set("view-number", 3);
</syntaxhighlight>
</syntaxhighlight>