660 |
khor |
1 |
/* ----------------------------------------------------------------------- *
|
|
|
2 |
* This file is part of GEL, http://www.imm.dtu.dk/GEL
|
|
|
3 |
* Copyright (C) the authors and DTU Informatics
|
|
|
4 |
* For license and list of authors, see ../../doc/intro.pdf
|
|
|
5 |
* ----------------------------------------------------------------------- */
|
|
|
6 |
|
|
|
7 |
/**
|
|
|
8 |
* @file draw.h
|
|
|
9 |
* @brief Draw various GEL entities.
|
|
|
10 |
*/
|
|
|
11 |
|
|
|
12 |
#ifndef __GLGRAPHICS_DRAW_H_
|
|
|
13 |
#define __GLGRAPHICS_DRAW_H_
|
|
|
14 |
|
|
|
15 |
#include "../Geometry/TriMesh.h"
|
|
|
16 |
#include "../Geometry/AABox.h"
|
|
|
17 |
#include "../Geometry/OBox.h"
|
|
|
18 |
#include "../Geometry/BoundingINode.h"
|
|
|
19 |
#include "../Geometry/BoundingLNode.h"
|
|
|
20 |
#include "../Geometry/BoundingTree.h"
|
|
|
21 |
|
|
|
22 |
namespace HMesh
|
|
|
23 |
{
|
|
|
24 |
class Manifold;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
namespace GLGraphics
|
|
|
28 |
{
|
|
|
29 |
/// Simply draw a tessellated ball.
|
|
|
30 |
void draw_ball();
|
|
|
31 |
|
|
|
32 |
/// Draw an indexed face set (just a triangle list) with normals computed on the fly.
|
|
|
33 |
void draw(const Geometry::IndexedFaceSet& geometry);
|
|
|
34 |
|
|
|
35 |
/// Draw a triangles mesh. Inefficient function that should be compiled into a display list.
|
|
|
36 |
void draw(const Geometry::TriMesh& tm, bool per_vertex_norms=true);
|
|
|
37 |
|
|
|
38 |
/// Load textures if available
|
|
|
39 |
void load_textures(Geometry::TriMesh& tm);
|
|
|
40 |
|
|
|
41 |
/// Draw a HMesh Manifold. Inefficient and should be compiled into display list
|
|
|
42 |
void draw(const HMesh::Manifold& m, bool per_vertex_norms=true);
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
/// Draw an axis aligned bounding box
|
|
|
46 |
void draw(const Geometry::AABox& box);
|
|
|
47 |
|
|
|
48 |
/// Draw an oriented bounding box
|
|
|
49 |
void draw(const Geometry::OBox& box);
|
|
|
50 |
|
|
|
51 |
/// Draw an object of type T which contains only triangles as wireframe. In practice T = Manifold or TriMesh.
|
|
|
52 |
template<typename T>
|
|
|
53 |
inline void draw_triangles_in_wireframe(T& m, bool per_vertex_norms, const CGLA::Vec3f& line_color);
|
|
|
54 |
|
|
|
55 |
/// Draw an object of type T as wireframe. In practice T = Manifold or TriMesh.
|
|
|
56 |
template<class T>
|
|
|
57 |
void draw_wireframe_oldfashioned(const T& m, bool per_vertex_norms, const CGLA::Vec3f& line_color);
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
template<class BoxType>
|
|
|
61 |
void draw(const Geometry::BoundingINode<BoxType>& node, int level, int max_level);
|
|
|
62 |
template<class BoxType>
|
|
|
63 |
void draw(const Geometry::BoundingLNode<BoxType>& node, int level, int max_level);
|
|
|
64 |
template<class BoxType>
|
|
|
65 |
void draw(const Geometry::BoundingTree<BoxType>& tree, int max_level = 1e6);
|
|
|
66 |
|
|
|
67 |
/// Read depth buffer and extract the depth of a pixel
|
|
|
68 |
bool depth_pick(int x, int y, float& depth);
|
|
|
69 |
|
|
|
70 |
/** Convert depth value to 3D point. Supposes that the modelview and projection matrices
|
|
|
71 |
are set in the same way as when rendering. */
|
|
|
72 |
CGLA::Vec3d screen2world(int x, int y, float depth);
|
|
|
73 |
|
|
|
74 |
/** Project the point given as argument using modelview and projection matrices */
|
|
|
75 |
CGLA::Vec3d world2screen(const CGLA::Vec3d& p);
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
}
|
|
|
79 |
#endif
|