[1941] | 1 | #ifndef __GLOBALLINESRENDERER_H
|
---|
| 2 | #define __GLOBALLINESRENDERER_H
|
---|
| 3 |
|
---|
| 4 | #include "common.h"
|
---|
| 5 | #include "Containers.h"
|
---|
[1953] | 6 | #include "Vector3.h"
|
---|
[1941] | 7 |
|
---|
[1953] | 8 |
|
---|
[1941] | 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:
|
---|
[1964] | 23 |
|
---|
| 24 | GlobalLinesRenderer(Preprocessor *preprocessor,
|
---|
| 25 | GlRenderer *renderer,
|
---|
| 26 | const float texHeight,
|
---|
| 27 | const float mTexWidth,
|
---|
| 28 | const float eps);
|
---|
| 29 |
|
---|
[1941] | 30 | GlobalLinesRenderer(Preprocessor *preprocessor, GlRenderer *renderer);
|
---|
| 31 |
|
---|
| 32 | ~GlobalLinesRenderer();
|
---|
| 33 |
|
---|
[1964] | 34 | /** Casts global lines in the angle specified by alpha and
|
---|
| 35 | beta.
|
---|
| 36 | @returns Computed samples in the container rays
|
---|
| 37 | */
|
---|
| 38 | void CastGlobalLines(const float alpha,
|
---|
| 39 | const float beta,
|
---|
| 40 | VssRayContainer &rays);
|
---|
[1941] | 41 |
|
---|
| 42 | void InitGl();
|
---|
| 43 |
|
---|
| 44 | /** Computes rays from information gained with hw sampling
|
---|
| 45 | */
|
---|
| 46 | void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays);
|
---|
| 47 |
|
---|
| 48 | float GetPixelError(int &pvsSize);
|
---|
| 49 |
|
---|
| 50 | int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const;
|
---|
| 51 |
|
---|
| 52 | void RenderObject(Intersectable *obj);
|
---|
[1953] | 53 |
|
---|
| 54 |
|
---|
| 55 | /** Draws the geometry for one pass.
|
---|
| 56 | */
|
---|
| 57 | void DrawGeometry();
|
---|
[1960] | 58 | void Run();
|
---|
| 59 | void GrabDepthBuffer(float *data, RenderTexture *rt);
|
---|
| 60 | void GrabItemBuffer(unsigned char *data, RenderTexture *rt);
|
---|
[1964] | 61 | void ApplyDepthPeeling(VssRayContainer &rays);
|
---|
[1960] | 62 | void ExportDepthBuffer();
|
---|
| 63 | void ExportItemBuffer();
|
---|
[1964] | 64 | void ProcessDepthBuffer(VssRayContainer &vssRays,
|
---|
| 65 | const bool oldBufferInitialised,
|
---|
| 66 | const int pass);
|
---|
| 67 |
|
---|
[1960] | 68 | void DisplayBuffer(const bool isDepth);
|
---|
| 69 |
|
---|
[1963] | 70 | bool ClipToViewSpaceBox(const Vector3 &origin,
|
---|
| 71 | const Vector3 &termination,
|
---|
| 72 | Vector3 &clippedOrigin,
|
---|
| 73 | Vector3 &clippedTermination);
|
---|
| 74 |
|
---|
[1960] | 75 | Intersectable *ExtractSamplePoint(float *depthBuffer,
|
---|
| 76 | unsigned char *itemBuffer,
|
---|
| 77 | const int x,
|
---|
| 78 | const int y,
|
---|
| 79 | Vector3 &hitPoint,
|
---|
| 80 | const bool isFrontBuffer) const;
|
---|
[1953] | 81 |
|
---|
[1960] | 82 | void Visualize(const VssRayContainer &vssRays);
|
---|
| 83 |
|
---|
[1953] | 84 | int mMaxDepth;
|
---|
| 85 | Vector3 mEyeVec;
|
---|
| 86 | Vector3 mLeftVec;
|
---|
| 87 | Vector3 mUpVec;
|
---|
| 88 | float mFar;
|
---|
| 89 | float mNear;
|
---|
[1960] | 90 | float mWidth;
|
---|
[1953] | 91 |
|
---|
[1958] | 92 | Vector3 mViewPoint;
|
---|
| 93 |
|
---|
[1953] | 94 | float *mNewDepthBuffer;
|
---|
| 95 | float *mOldDepthBuffer;
|
---|
[1960] | 96 | unsigned char *mNewItemBuffer;
|
---|
| 97 | unsigned char *mOldItemBuffer;
|
---|
| 98 |
|
---|
| 99 | RenderTexture *mNewTexture;
|
---|
[1953] | 100 | RenderTexture *mOldTexture;
|
---|
[1958] | 101 |
|
---|
| 102 | void ComputeLookAt(const float alpha,
|
---|
| 103 | const float beta,
|
---|
| 104 | Vector3 &eye,
|
---|
| 105 | Vector3 &up,
|
---|
[1964] | 106 | Vector3 &left);
|
---|
[1941] | 107 | protected:
|
---|
| 108 |
|
---|
| 109 | void SwitchRenderTextures();
|
---|
| 110 |
|
---|
[1964] | 111 | void InitScene(const float alpha, const float beta);
|
---|
[1941] | 112 |
|
---|
| 113 | Preprocessor *mPreprocessor;
|
---|
| 114 |
|
---|
| 115 | GlRenderer *mRenderer;
|
---|
[1964] | 116 |
|
---|
| 117 | int mTexWidth;
|
---|
| 118 | int mTexHeight;
|
---|
| 119 | float mEpsilon;
|
---|
[1941] | 120 | };
|
---|
| 121 |
|
---|
| 122 | extern GlobalLinesRenderer *globalLinesRenderer;
|
---|
| 123 |
|
---|
| 124 | };
|
---|
| 125 |
|
---|
| 126 | #endif
|
---|
| 127 |
|
---|