OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
mapped_property.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-2011 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_IMPL_MAPPED_PROPERTY_HH
20 #define OST_GFX_IMPL_MAPPED_PROPERTY_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 
26 #include <ost/mol/entity_view.hh>
27 #if OST_IMG_ENABLED
28 #include <ost/img/map.hh>
29 #endif
30 
31 #include <ost/gfx/module_config.hh>
32 #include <ost/gfx/gradient.hh>
33 
34 namespace ost { namespace gfx { namespace impl {
35 
36 inline float Normalize(float v, float min_v, float max_v)
37 {
38  return (v-min_v)/(max_v-min_v);
39 }
40 
41 inline float Clamp(float v, float min_v, float max_v)
42 {
43  return std::max(min_v,std::min(max_v,v));
44 }
45 
47  const String& prop,
48  const geom::Vec3& pos);
50  const String& prop,
51  const Gradient& g, float minv, float maxv,
52  const geom::Vec3& pos);
53 #if OST_IMG_ENABLED
55  const String& prop,
56  const geom::Vec3& pos);
58  const String& prop,
59  const Gradient& g, float minv, float maxv,
60  const geom::Vec3& pos);
61 #endif
62 
63 }}}
64 
65 #endif
std::string String
Definition: base.hh:54
#define DLLEXPORT_OST_GFX
float Normalize(float v, float min_v, float max_v)
Three dimensional vector class, using Real precision.
Definition: vec3.hh:42
float DLLEXPORT_OST_GFX MappedProperty(const mol::EntityView &ev, const String &prop, const geom::Vec3 &pos)
Manage shared instances of images.
definition of EntityView
Definition: entity_view.hh:86
color gradient
Definition: gradient.hh:59
float Clamp(float v, float min_v, float max_v)