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(float *data, RenderTexture *rt);
|
---|
53 | void ApplyDepthPeeling(Beam &beam, const int samples);
|
---|
54 | void ExportDepthBuffer();
|
---|
55 | void ProcessDepthBuffer(VssRayContainer &vssRays);
|
---|
56 |
|
---|
57 | int mMaxDepth;
|
---|
58 | Vector3 mEyeVec;
|
---|
59 | Vector3 mLeftVec;
|
---|
60 | Vector3 mUpVec;
|
---|
61 | float mFar;
|
---|
62 | float mNear;
|
---|
63 |
|
---|
64 | float *mNewDepthBuffer;
|
---|
65 | float *mOldDepthBuffer;
|
---|
66 | float *mNewItemBuffer;
|
---|
67 | float *mOldItemBuffer;
|
---|
68 | RenderTexture *mNewTexture;
|
---|
69 | RenderTexture *mOldTexture;
|
---|
70 | protected:
|
---|
71 |
|
---|
72 | void ProcessDepthBuffer();
|
---|
73 |
|
---|
74 | void SwitchRenderTextures();
|
---|
75 |
|
---|
76 | void SetupProjection(const Vector3 &viewPoint,
|
---|
77 | const Beam &beam);
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|
81 | Preprocessor *mPreprocessor;
|
---|
82 |
|
---|
83 | GlRenderer *mRenderer;
|
---|
84 | };
|
---|
85 |
|
---|
86 | extern GlobalLinesRenderer *globalLinesRenderer;
|
---|
87 |
|
---|
88 | };
|
---|
89 |
|
---|
90 | #endif
|
---|
91 |
|
---|