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
prim_list.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_PRIM_LIST_HH
20
#define OST_GFX_PRIM_LIST_HH
21
22
/*
23
Author: Ansgar Philippsen
24
*/
25
26
#include <boost/shared_ptr.hpp>
27
28
#include <
ost/geom/geom.hh
>
29
30
#include "
gfx_object.hh
"
31
#include "
gfx_prim.hh
"
32
33
namespace
ost {
namespace
gfx {
34
38
class
DLLEXPORT_OST_GFX
PrimList
:
public
GfxObj
39
{
40
struct
PointEntry {
41
PointEntry(
const
geom::Vec3
& p,
float
r,
const
Color
& c):
42
pos(p), rad(r), col(c) {}
43
geom::Vec3
pos;
44
float
rad;
45
Color
col;
46
};
47
48
typedef
std::vector<PointEntry> PointEntryList;
49
50
struct
LineEntry {
51
LineEntry(
const
geom::Vec3
& p1,
const
geom::Vec3
& p2,
float
r1,
float
r2,
const
Color
& c1,
const
Color
& c2):
52
pos1(p1), pos2(p2), rad1(r1), rad2(r2), col1(c1), col2(c2) {}
53
geom::Vec3
pos1, pos2;
54
float
rad1, rad2;
55
Color
col1, col2;
56
};
57
58
typedef
std::vector<LineEntry> LineEntryList;
59
60
public
:
62
PrimList
(
const
String
& name);
63
64
virtual
geom::AlignedCuboid
GetBoundingBox()
const
;
65
66
virtual
void
ProcessLimits(
geom::Vec3
& minc,
geom::Vec3
& maxc,
67
const
mol::Transform
& tf)
const
;
69
virtual
geom::Vec3
GetCenter()
const
;
70
71
virtual
void
CustomRenderPov(
PovState
& pov);
72
73
virtual
void
CustomRenderGL(
RenderPass
pass);
74
75
virtual
void
OnRenderModeChange();
76
78
void
Clear
();
79
87
void
AddPoint(
const
geom::Vec3
& p,
const
Color
& col);
88
96
void
AddLine(
const
geom::Vec3
& p1,
const
geom::Vec3
& p2,
const
Color
& col1,
const
Color
& col2);
97
105
void
AddSphere(
const
geom::Vec3
& cen,
float
rad,
const
Color
& col);
106
114
void
AddCyl(
const
geom::Vec3
& p0,
const
geom::Vec3
& p1,
float
r1,
float
r2,
const
Color
& col1,
const
Color
& col2);
115
123
void
AddText(
const
std::string& text,
const
geom::Vec3
& pos,
const
Color
& col,
float
point_size);
124
126
void
SetDiameter(
float
d);
127
129
void
SetRadius(
float
r);
130
132
void
SetColor(
const
Color
& c);
133
134
void
SetSphereDetail(
unsigned
int
d);
135
unsigned
int
GetSphereDetail
()
const
{
return
sphere_detail_;}
136
137
void
SetArcDetail(
unsigned
int
d);
138
unsigned
int
GetArcDetail
()
const
{
return
arc_detail_;}
139
140
// TODO: add point and line pixel width
141
158
void
AddMesh(
float
* v,
float
* n,
float
* c,
size_t
nv,
unsigned
int
* i,
size_t
ni);
159
160
protected
:
161
virtual
void
CustomPreRenderGL(
bool
flag);
162
163
private
:
164
SpherePrimList
points_;
165
CylinderPrimList
lines_;
166
SpherePrimList
spheres_;
167
CylinderPrimList
cyls_;
168
TextPrimList
texts_;
169
unsigned
int
sphere_detail_;
170
unsigned
int
arc_detail_;
171
172
IndexedVertexArray
simple_va_;
173
174
std::vector<IndexedVertexArray> vas_;
175
176
void
prep_simple_va();
177
void
prep_va();
178
void
render_text();
179
};
180
186
191
}}
// ns
192
193
#endif
Generated on Mon Nov 5 2012 13:30:58 for OpenStructure by
1.8.1.1