MEPP2 Project
OSGHelpers.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
13 #include <osg/Vec3>
14 #include <osg/Vec4>
15 #include <osg/Group>
16 #include <osg/Geode>
17 #include <osg/Geometry>
18 #include <osg/Material>
19 
20 #include "Base/Color.hpp"
22 
23 #include <boost/graph/graph_traits.hpp>
24 #include <boost/graph/properties.hpp>
26 
27 namespace FEVV {
28 
29 namespace Helpers {
30 
31 //static unsigned int nbMeshDrawed = 0;
32 
33 osg::Vec4
34 ColorConverter(const Color &_color);
35 
36 template<
37  typename HalfedgeGraph,
39 osg::Vec4
41 {
42  osg::Vec4 color((float)_color[0], (float)_color[1], (float)_color[2], 1.0f);
43 
44  return color;
45 }
46 
47 template<
48  typename HalfedgeGraph,
50 osg::Vec3
51 VectorConverter(const Vector &_vector)
52 {
53  osg::Vec3 vec(_vector[0], _vector[1], _vector[2]);
54 
55  return vec;
56 }
57 
58 inline osg::Vec4
59 ColorConverter(const Color &_color)
60 {
61  osg::Vec4 color((float)_color.red() / 255.0f,
62  (float)_color.green() / 255.0f,
63  (float)_color.blue() / 255.0f,
64  (float)_color.alpha() / 255.0f);
65 
66  return color;
67 }
68 
69 } // namespace Helpers
70 
71 } // namespace FEVV
FEVV::Helpers::VectorConverter
osg::Vec3 VectorConverter(const Vector &_vector)
Definition: OSGHelpers.h:51
FEVV::Color::blue
void blue(const unsigned char _blueValue)
Definition: Color.inl:94
FEVV::Color::alpha
void alpha(const unsigned char _alphaValue)
Definition: Color.inl:101
FEVV::Geometry_traits
Refer to Geometry_traits_documentation_dummy for further documentation on provided types and algorith...
Definition: Geometry_traits.h:162
FEVV::Color::green
void green(const unsigned char _greenValue)
Definition: Color.inl:87
BaseViewer.h
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::Color
Definition: Color.hpp:18
Geometry_traits.h
FEVV::Helpers::VectorColorConverter
osg::Vec4 VectorColorConverter(const Vector &_color)
Definition: OSGHelpers.h:40
FEVV::DataStructures::AIF::AIFVector
Definition: AIFProperties.h:173
Color.hpp
FEVV::Color::red
void red(const unsigned char _redValue)
Definition: Color.inl:80
FEVV::Helpers::ColorConverter
osg::Vec4 ColorConverter(const Color &_color)
Definition: OSGHelpers.h:59