Molecular Vis
Improving perception of molecular visualization
FrustumCull.h
1 // inspired by http://www.lighthouse3d.com/tutorials/view-frustum-culling/
2 #pragma once
3 #include "glm/glm.hpp"
4 #include "FrustumPlane.h"
5 
10 class FrustumCull {
11 
12 public:
17  enum Classification { OUTSIDE, INTERSECT, INSIDE };
18 
28  void setCamInternals(float angle, float ratio, float nearD, float farD);
29 
39  void setCamDef(const glm::vec3 &p, const glm::vec3 &l, const glm::vec3 &u);
40 
47  Classification pointInFrustum(const glm::vec3 &p) const;
48 
57  Classification sphereInFrustum(const glm::vec3 &p, float raio) const;
58 
59 private:
60 
61  FrustumPlane pl[6];
62 
63  glm::vec3 ntl, ntr, nbl, nbr, ftl, ftr, fbl, fbr;
64  float nearD, farD, ratio, angle, tang;
65  float nw, nh, fw, fh;
66 
67  enum {
68  TOP = 0,
69  BOTTOM,
70  LEFT,
71  RIGHT,
72  NEARP,
73  FARP
74  };
75 
76 };
Classification sphereInFrustum(const glm::vec3 &p, float raio) const
Definition: FrustumCull.cpp:67
Classification
Definition: FrustumCull.h:17
void setCamDef(const glm::vec3 &p, const glm::vec3 &l, const glm::vec3 &u)
Definition: FrustumCull.cpp:19
void setCamInternals(float angle, float ratio, float nearD, float farD)
Definition: FrustumCull.cpp:4
Class for frustum-culling.
Definition: FrustumCull.h:10
Class for Frustum plane.
Definition: FrustumPlane.h:9
Classification pointInFrustum(const glm::vec3 &p) const
Definition: FrustumCull.cpp:55