OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
primitives.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GFX_PRIMITIVES_HH
20 #define OST_GFX_PRIMITIVES_HH
21 
22 #include <ost/geom/geom.hh>
23 #include <ost/gfx/module_config.hh>
24 #include <ost/gfx/color.hh>
25 #include <ost/gfx/gfx_node.hh>
26 
27 /*
28  Author: Marco Biasini
29  */
30 namespace ost { namespace gfx {
31 
44 public GfxNode {
45 protected:
46  Primitive(const String& name);
47 public:
48  void SetFill(const Color& color, bool fill=true);
49  void SetOutline(const Color& color, bool line=true, float width=1.0);
50  void SetFillColor(const Color& color);
51  void SetOutlineColor(const Color& color);
52  const Color& GetFillColor() const;
53  const Color& GetOutlineColor() const;
54  bool HasFill() const;
55  bool HasOutline() const;
56  float GetLineWidth() const;
57 
58  void SetLineWidth(float width);
59 private:
60  bool fill_;
61  bool line_;
62  Color outline_color_;
63  Color fill_color_;
64  float line_width_;
65 };
67 
69 public:
70  Cuboid(const String& name, const geom::Cuboid& cuboid);
71  virtual void RenderGL(RenderPass pass);
72 private:
73  geom::Cuboid cuboid_;
74 };
75 
80 public:
81  Quad(const String& name, const geom::Vec3& a, const geom::Vec3& b,
82  const geom::Vec3& c, const geom::Vec3& d);
83  virtual void RenderGL(RenderPass pass);
84 private:
85  geom::Vec3 corner_points_ [4];
86 };
87 
91 
92 }}
93 
94 #endif
arbitrary oriented bounding cuboid
Definition: composite3.hh:116
a rendered cuboid in 3D space
Definition: primitives.hh:68
a simple rendered quad in 3D space.
Definition: primitives.hh:79
std::string String
Definition: base.hh:54
#define DLLEXPORT_OST_GFX
Three dimensional vector class, using Real precision.
Definition: vec3.hh:43
base class for geometric primitives such as cuboids, and circles
Definition: primitives.hh:43