Free Electron
OriginViewerSystem.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 namespace fe
8 {
9 namespace ext
10 {
11 
12 /**
13  * Displays world origin.
14  */
15 class OriginViewerSystem : virtual public ViewerSystem
16 {
17 public:
18  void draw(fe::Record viewportRecord) override
19  {
20  // Get the pointer to the draw interface.
22  m_viewportAccessorSet.draw(viewportRecord);
23 
24  // draw origin
25  const fe::Real pixelSizeOrigin = draw->view()->pixelSize(
26  fe::SpatialVector(0,0,0),
27  1.0f);
28  const fe::Real pixelDesiredOrigin = 48.0f;
29  fe::Real radiusOrigin = pixelDesiredOrigin/pixelSizeOrigin;
30  fe::SpatialTransform identity;
31  setIdentity(identity);
32 
33  const fe::Color black(0.0f,0.0f,0.0f);
34  draw->drawTransformedMarker(
35  identity,
36  radiusOrigin,
37  black);
38  };
39 };
40 
41 } /* namespace ext */
42 } /* namespace fe */
Base class for Viewer Systems.
Definition: ViewerSystem.h:21
kernel
Definition: namespace.dox:3
Displays world origin.
Definition: OriginViewerSystem.h:15
Special vector for color (RGBA)
Definition: Color.h:21
virtual sp< ViewI > view(void) const =0
Get current view.
Reference to an instance of a Layout.
Definition: RecordSB.h:35
void draw(fe::Record viewportRecord) override
Draw stuff into the viewport.
Definition: OriginViewerSystem.h:18
AsViewport m_viewportAccessorSet
Accessors for viewport data.
Definition: ViewerSystem.h:63
Accessor< hp< DrawI > > draw
Draw Interface for actually drawing stuff.
Definition: AsViewport.h:35