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
surface.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_SURFACE_HH
20
#define OST_GFX_SURFACE_HH
21
22
/*
23
graphical representation of all kinds of surfaces
24
25
Author: Ansgar Philippsen
26
*/
27
28
#include <boost/shared_ptr.hpp>
29
30
#include <
ost/config.hh
>
31
#include <
ost/mol/surface.hh
>
32
#include "
gfx_object.hh
"
33
#include "
vertex_array.hh
"
34
35
#include <
ost/gfx/color_ops/uniform_color_op.hh
>
36
#include <
ost/gfx/color_ops/basic_gradient_color_op.hh
>
37
#include <
ost/gfx/color_ops/gradient_level_color_op.hh
>
38
#include <
ost/gfx/color_ops/entity_view_color_op.hh
>
39
40
#if OST_IMG_ENABLED
41
#include <
ost/gfx/color_ops/map_handle_color_op.hh
>
42
#endif //OST_IMG_ENABLED
43
44
namespace
ost {
namespace
gfx {
45
46
class
Surface
;
47
typedef
boost::shared_ptr<Surface>
SurfaceP
;
48
49
class
DLLEXPORT_OST_GFX
Surface
:
public
GfxObj
{
50
typedef
std::map<mol::SurfaceVertexID, VertexID> VMap;
51
52
public
:
53
Surface
(
const
String
& name,
const
mol::SurfaceHandle
& sh);
54
55
virtual
void
OnRenderModeChange();
56
57
virtual
void
CustomRenderGL(
RenderPass
pass);
58
virtual
void
CustomRenderPov(
PovState
& pov);
59
virtual
geom::AlignedCuboid
GetBoundingBox(
bool
use_global=
false
)
const
;
60
61
mol::SurfaceHandle
GetHandle()
const
;
62
63
void
Rebuild();
64
void
Replace(
const
mol::SurfaceHandle
& sh);
65
67
void
SetColor(
const
Color
& col,
const
String
& selection=
String
(
""
));
68
69
// GfxObj property interface
70
virtual
void
ColorBy(
const
mol::EntityView
& ev,
71
const
String
& prop,
72
const
Gradient
& g,
float
minv,
float
maxv);
73
#if OST_IMG_ENABLED
74
// GfxObj property interface
75
virtual
void
ColorBy(
const
img::MapHandle
& mh,
76
const
String
& prop,
77
const
Gradient
& g,
float
minv,
float
maxv);
78
#endif //OST_IMG_ENABLED
79
80
// map property to color gradient from minv to maxv
81
void
ColorBy(
const
String
& prop,
82
const
Gradient
& gradient,
83
float
minv,
float
maxv,
84
mol::Prop::Level
hint=
mol::Prop::UNSPECIFIED
);
85
86
// convenience
87
void
ColorBy(
const
String
& prop,
88
const
Gradient
& gradient,
89
mol::Prop::Level
hint=
mol::Prop::UNSPECIFIED
);
90
91
// convenience
92
void
ColorBy(
const
String
& prop,
93
const
Color
& c1,
const
Color
& c2,
94
float
min,
float
max,
95
mol::Prop::Level
hint=
mol::Prop::UNSPECIFIED
);
96
97
// convenience
98
void
ColorBy(
const
String
& prop,
99
const
Color
& c1,
const
Color
& c2,
100
mol::Prop::Level
hint=
mol::Prop::UNSPECIFIED
);
101
102
103
void
Apply(
const
gfx::UniformColorOp
& op,
bool
store=
true
);
104
void
Apply(
const
gfx::BasicGradientColorOp
& op,
bool
store=
true
);
105
void
Apply(
const
gfx::GradientLevelColorOp
& op,
bool
store=
true
);
106
void
Apply(
const
gfx::EntityViewColorOp
& op,
bool
store=
true
);
107
#if OST_IMG_ENABLED
108
void
Apply(
const
gfx::MapHandleColorOp
& op,
bool
store=
true
);
109
#endif
110
111
void
CleanColorOps();
112
void
ReapplyColorOps();
113
114
protected
:
115
virtual
void
CustomPreRenderGL(
bool
flag);
116
117
private
:
118
119
mol::SurfaceHandle
sh_;
120
VMap vmap_;
121
122
mutable
bool
recalc_bb_;
123
124
boost::ptr_vector<gfx::ColorOp> c_ops_;
125
};
126
127
}}
// ns
128
129
#endif
basic_gradient_color_op.hh
gradient_level_color_op.hh
ost::gfx::UniformColorOp
Definition:
uniform_color_op.hh:36
uniform_color_op.hh
String
std::string String
Definition:
base.hh:54
geom::AlignedCuboid
axis-aligned cuboid
Definition:
aligned_cuboid.hh:35
ost::gfx::BasicGradientColorOp
Definition:
basic_gradient_color_op.hh:36
ost::gfx::EntityViewColorOp
Definition:
entity_view_color_op.hh:37
vertex_array.hh
gfx_object.hh
config.hh
ost::gfx::GfxObj
main class for all graphic objects
Definition:
gfx_object.hh:51
map_handle_color_op.hh
ost::gfx::PovState
Definition:
povray.hh:35
DLLEXPORT_OST_GFX
#define DLLEXPORT_OST_GFX
Definition:
module_config.hh:27
ost::gfx::Surface
Definition:
surface.hh:49
ost::gfx::MapHandleColorOp
Definition:
map_handle_color_op.hh:37
ost::mol::SurfaceHandle
Definition:
surface_handle.hh:39
ost::gfx::GradientLevelColorOp
Definition:
gradient_level_color_op.hh:38
surface.hh
ost::mol::Prop::UNSPECIFIED
Definition:
property_id.hh:48
entity_view_color_op.hh
ost::gfx::SurfaceP
boost::shared_ptr< Surface > SurfaceP
Definition:
surface.hh:46
ost::mol::Prop::Level
Level
Definition:
property_id.hh:47
ost::img::ImageHandle
Manage shared instances of images.
Definition:
image_handle.hh:111
ost::mol::EntityView
definition of EntityView
Definition:
entity_view.hh:86
ost::gfx::RenderPass
RenderPass
Definition:
render_pass.hh:27
ost::gfx::Gradient
color gradient
Definition:
gradient.hh:59
ost::gfx::Color
Definition:
color.hh:52
Generated by
1.8.5