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);
|
---|
57 | void DisplayBuffer(const bool isDepth);
|
---|
58 |
|
---|
59 | Intersectable *ExtractSamplePoint(float *depthBuffer,
|
---|
60 | unsigned char *itemBuffer,
|
---|
61 | const int x,
|
---|
62 | const int y,
|
---|
63 | Vector3 &hitPoint,
|
---|
64 | const bool isFrontBuffer) const;
|
---|
65 |
|
---|
66 | void Visualize(const VssRayContainer &vssRays);
|
---|
67 |
|
---|
68 | int mMaxDepth;
|
---|
69 | Vector3 mEyeVec;
|
---|
70 | Vector3 mLeftVec;
|
---|
71 | Vector3 mUpVec;
|
---|
72 | float mFar;
|
---|
73 | float mNear;
|
---|
74 | float mWidth;
|
---|
75 |
|
---|
76 | Vector3 mViewPoint;
|
---|
77 |
|
---|
78 | float *mNewDepthBuffer;
|
---|
79 | float *mOldDepthBuffer;
|
---|
80 | unsigned char *mNewItemBuffer;
|
---|
81 | unsigned char *mOldItemBuffer;
|
---|
82 |
|
---|
83 | RenderTexture *mNewTexture;
|
---|
84 | RenderTexture *mOldTexture;
|
---|
85 |
|
---|
86 | void ComputeLookAt(const float alpha,
|
---|
87 | const float beta,
|
---|
88 | Vector3 &eye,
|
---|
89 | Vector3 &up,
|
---|
90 | Vector3 left);
|
---|
91 | protected:
|
---|
92 |
|
---|
93 | void SwitchRenderTextures();
|
---|
94 |
|
---|
95 | void SetupProjection(const Vector3 &viewPoint,
|
---|
96 | const Beam &beam);
|
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|
100 | Preprocessor *mPreprocessor;
|
---|
101 |
|
---|
102 | GlRenderer *mRenderer;
|
---|
103 | };
|
---|
104 |
|
---|
105 | extern GlobalLinesRenderer *globalLinesRenderer;
|
---|
106 |
|
---|
107 | };
|
---|
108 |
|
---|
109 | #endif
|
---|
110 |
|
---|