source: GTP/trunk/Lib/Vis/Preprocessing/src/GlobalLinesRenderer.h @ 1968

Revision 1968, 3.1 KB checked in by mattausch, 18 years ago (diff)

early exit for global lines
preprocessor support

Line 
1#ifndef __GLOBALLINESRENDERER_H
2#define __GLOBALLINESRENDERER_H
3
4#include "common.h"
5#include "Containers.h"
6#include "Vector3.h"
7
8
9class RenderTexture;
10
11namespace GtpVisibilityPreprocessor {
12
13class Beam;
14class Intersectable;
15class Preprocessor;
16class GlRenderer;
17struct SimpleRay;
18
19struct VssRayContainer;
20
21class GlobalLinesRenderer
22{
23public:
24       
25        GlobalLinesRenderer(Preprocessor *preprocessor,
26                                                const int texHeight,
27                                                const int mTexWidth,
28                                                const float eps,
29                                                const int maxDepth,
30                                                const bool sampleReverse);
31
32        GlobalLinesRenderer(Preprocessor *preprocessor);
33
34        ~GlobalLinesRenderer();
35
36        /** Casts global lines in the angle specified by alpha and
37                beta.
38                @returns Computed samples in the container rays
39        */
40        void CastGlobalLines(const float alpha,
41                                                 const float beta,
42                                                 VssRayContainer &rays);
43
44        /** Casts global lines using the given ray as origin and
45                direction vector.
46                @returns Computed samples in the container rays
47        */
48        void CastGlobalLines(const SimpleRay &ray,
49                                                 VssRayContainer &rays);
50
51
52        void InitGl();
53
54        /** Computes rays from information gained with hw sampling
55        */
56        void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays);
57
58        float GetPixelError(int &pvsSize);
59
60        int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const;
61
62        void RenderObject(Intersectable *obj);
63
64       
65        /** Draws the geometry for one pass.
66        */
67        void DrawGeometry();
68        void Run();
69        void GrabDepthBuffer(float *data, RenderTexture *rt);
70        void GrabItemBuffer(unsigned char *data, RenderTexture *rt);
71        void ApplyDepthPeeling(VssRayContainer &rays);
72        void ExportDepthBuffer();
73        void ExportItemBuffer();
74        bool ProcessDepthBuffer(VssRayContainer &vssRays,
75                                                        const bool oldBufferInitialised,
76                                                        const int pass);
77
78        void DisplayBuffer(const bool isDepth);
79       
80        bool ClipToViewSpaceBox(const Vector3 &origin,
81                                                        const Vector3 &termination,
82                                                        Vector3 &clippedOrigin,
83                                                        Vector3 &clippedTermination);
84
85        Intersectable *ExtractSamplePoint(float *depthBuffer,
86                                                                          unsigned char *itemBuffer,
87                                                                          const int x,
88                                                                          const int y,
89                                                                          Vector3 &hitPoint,
90                                                                          const bool isFrontBuffer) const;
91
92        void Visualize(const VssRayContainer &vssRays);
93
94        int mMaxDepth;
95       
96        Vector3 mEyeVec;
97        Vector3 mLeftVec;
98        Vector3 mUpVec;
99        Vector3 mTermination;
100
101        float mFar;
102        float mNear;
103        float mWidth;
104
105        Vector3 mViewPoint;
106
107        float *mNewDepthBuffer;
108        float *mOldDepthBuffer;
109
110        unsigned char *mNewItemBuffer;
111        unsigned char *mOldItemBuffer;
112       
113        RenderTexture *mNewTexture;
114        RenderTexture *mOldTexture;
115
116        void ComputeLookAt(const float alpha,
117                                           const float beta,
118                                           Vector3 &eye,
119                                           Vector3 &up,
120                                           Vector3 &left);
121
122protected:
123
124        void SwitchRenderTextures();
125
126        void InitScene(const float alpha, const float beta);
127        void InitScene(const SimpleRay &ray);
128
129        void InitRenderTexture(RenderTexture *rt);
130
131        Preprocessor *mPreprocessor;
132
133        GlRenderer *mRenderer;
134
135        int mTexWidth;
136        int mTexHeight;
137        float mEpsilon;
138
139        bool mSampleReverse;
140};
141
142extern GlobalLinesRenderer *globalLinesRenderer;
143
144};
145
146#endif
147
Note: See TracBrowser for help on using the repository browser.