1 | #ifndef __GLOBALLINESRENDERER_H
|
---|
2 | #define __GLOBALLINESRENDERER_H
|
---|
3 |
|
---|
4 | #include "common.h"
|
---|
5 | #include "Containers.h"
|
---|
6 | #include "Vector3.h"
|
---|
7 |
|
---|
8 |
|
---|
9 | class RenderTexture;
|
---|
10 |
|
---|
11 | namespace GtpVisibilityPreprocessor {
|
---|
12 |
|
---|
13 | class Beam;
|
---|
14 | class Intersectable;
|
---|
15 | class Preprocessor;
|
---|
16 | class GlRenderer;
|
---|
17 |
|
---|
18 | struct VssRayContainer;
|
---|
19 |
|
---|
20 | class GlobalLinesRenderer
|
---|
21 | {
|
---|
22 | public:
|
---|
23 | /*GlobalLinesRenderer(RenderTexture *buffer1,
|
---|
24 | RenderTexture *buffer2,
|
---|
25 | Preprocessor *preprocessor,
|
---|
26 | GlRenderer *renderer);
|
---|
27 | */
|
---|
28 | GlobalLinesRenderer(Preprocessor *preprocessor, GlRenderer *renderer);
|
---|
29 |
|
---|
30 | ~GlobalLinesRenderer();
|
---|
31 |
|
---|
32 | void CastGlobalLines(Beam &beam, const int samples);
|
---|
33 |
|
---|
34 | void InitGl();
|
---|
35 |
|
---|
36 | /** Computes rays from information gained with hw sampling
|
---|
37 | */
|
---|
38 | void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays);
|
---|
39 |
|
---|
40 | float GetPixelError(int &pvsSize);
|
---|
41 |
|
---|
42 | int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const;
|
---|
43 |
|
---|
44 | void RenderObject(Intersectable *obj);
|
---|
45 |
|
---|
46 |
|
---|
47 | /** Draws the geometry for one pass.
|
---|
48 | */
|
---|
49 | void DrawGeometry();
|
---|
50 | void Run();
|
---|
51 | void GrabDepthBuffer(float *data, RenderTexture *rt);
|
---|
52 | void GrabItemBuffer(unsigned char *data, RenderTexture *rt);
|
---|
53 | void ApplyDepthPeeling(VssRayContainer &rays, Beam &beam, const int samples);
|
---|
54 | void ExportDepthBuffer();
|
---|
55 | void ExportItemBuffer();
|
---|
56 | void ProcessDepthBuffer(VssRayContainer &vssRays, const bool oldBufferInitialised, const int pass);
|
---|
57 | void DisplayBuffer(const bool isDepth);
|
---|
58 |
|
---|
59 | bool ClipToViewSpaceBox(const Vector3 &origin,
|
---|
60 | const Vector3 &termination,
|
---|
61 | Vector3 &clippedOrigin,
|
---|
62 | Vector3 &clippedTermination);
|
---|
63 |
|
---|
64 | Intersectable *ExtractSamplePoint(float *depthBuffer,
|
---|
65 | unsigned char *itemBuffer,
|
---|
66 | const int x,
|
---|
67 | const int y,
|
---|
68 | Vector3 &hitPoint,
|
---|
69 | const bool isFrontBuffer) const;
|
---|
70 |
|
---|
71 | void Visualize(const VssRayContainer &vssRays);
|
---|
72 |
|
---|
73 | int mMaxDepth;
|
---|
74 | Vector3 mEyeVec;
|
---|
75 | Vector3 mLeftVec;
|
---|
76 | Vector3 mUpVec;
|
---|
77 | float mFar;
|
---|
78 | float mNear;
|
---|
79 | float mWidth;
|
---|
80 |
|
---|
81 | Vector3 mViewPoint;
|
---|
82 |
|
---|
83 | float *mNewDepthBuffer;
|
---|
84 | float *mOldDepthBuffer;
|
---|
85 | unsigned char *mNewItemBuffer;
|
---|
86 | unsigned char *mOldItemBuffer;
|
---|
87 |
|
---|
88 | RenderTexture *mNewTexture;
|
---|
89 | RenderTexture *mOldTexture;
|
---|
90 |
|
---|
91 | void ComputeLookAt(const float alpha,
|
---|
92 | const float beta,
|
---|
93 | Vector3 &eye,
|
---|
94 | Vector3 &up,
|
---|
95 | Vector3 left);
|
---|
96 | protected:
|
---|
97 |
|
---|
98 | void SwitchRenderTextures();
|
---|
99 |
|
---|
100 | void SetupProjection(const Vector3 &viewPoint,
|
---|
101 | const Beam &beam);
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|
105 | Preprocessor *mPreprocessor;
|
---|
106 |
|
---|
107 | GlRenderer *mRenderer;
|
---|
108 | };
|
---|
109 |
|
---|
110 | extern GlobalLinesRenderer *globalLinesRenderer;
|
---|
111 |
|
---|
112 | };
|
---|
113 |
|
---|
114 | #endif
|
---|
115 |
|
---|