OpenStructure
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
stage
include
ost
gfx
impl
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
46
float
DLLEXPORT_OST_GFX
MappedProperty
(
const
mol::EntityView
& ev,
47
const
String
& prop,
48
const
geom::Vec3
& pos);
49
Color
DLLEXPORT_OST_GFX
MappedProperty
(
const
mol::EntityView
& ev,
50
const
String
& prop,
51
const
Gradient
& g,
float
minv,
float
maxv,
52
const
geom::Vec3
& pos);
53
#if OST_IMG_ENABLED
54
float
DLLEXPORT_OST_GFX
MappedProperty
(
const
img::MapHandle
& mh,
55
const
String
& prop,
56
const
geom::Vec3
& pos);
57
Color
DLLEXPORT_OST_GFX
MappedProperty
(
const
img::MapHandle
& mh,
58
const
String
& prop,
59
const
Gradient
& g,
float
minv,
float
maxv,
60
const
geom::Vec3
& pos);
61
#endif
62
63
}}}
64
65
#endif
Generated on Mon Nov 11 2013 09:56:11 for OpenStructure by
1.8.1.1