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

Revision 1964, 2.8 KB checked in by mattausch, 17 years ago (diff)

worked on global lines

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;
17
18struct VssRayContainer;
19
20class GlobalLinesRenderer
21{
22public:
23       
24        GlobalLinesRenderer(Preprocessor *preprocessor,
25                                                GlRenderer *renderer,
26                                                const float texHeight,
27                                                const float mTexWidth,
28                                                const float eps);
29
30        GlobalLinesRenderer(Preprocessor *preprocessor, GlRenderer *renderer);
31
32        ~GlobalLinesRenderer();
33
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);
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);
53
54       
55        /** Draws the geometry for one pass.
56        */
57        void DrawGeometry();
58        void Run();
59        void GrabDepthBuffer(float *data, RenderTexture *rt);
60        void GrabItemBuffer(unsigned char *data, RenderTexture *rt);
61        void ApplyDepthPeeling(VssRayContainer &rays);
62        void ExportDepthBuffer();
63        void ExportItemBuffer();
64        void ProcessDepthBuffer(VssRayContainer &vssRays,
65                                                        const bool oldBufferInitialised,
66                                                        const int pass);
67
68        void DisplayBuffer(const bool isDepth);
69       
70        bool ClipToViewSpaceBox(const Vector3 &origin,
71                                                        const Vector3 &termination,
72                                                        Vector3 &clippedOrigin,
73                                                        Vector3 &clippedTermination);
74
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;
81
82        void Visualize(const VssRayContainer &vssRays);
83
84        int mMaxDepth;
85        Vector3 mEyeVec;
86        Vector3 mLeftVec;
87        Vector3 mUpVec;
88        float mFar;
89        float mNear;
90        float mWidth;
91
92        Vector3 mViewPoint;
93
94        float *mNewDepthBuffer;
95        float *mOldDepthBuffer;
96        unsigned char *mNewItemBuffer;
97        unsigned char *mOldItemBuffer;
98       
99        RenderTexture *mNewTexture;
100        RenderTexture *mOldTexture;
101
102        void ComputeLookAt(const float alpha,
103                                           const float beta,
104                                           Vector3 &eye,
105                                           Vector3 &up,
106                                           Vector3 &left);
107protected:
108
109        void SwitchRenderTextures();
110
111        void InitScene(const float alpha, const float beta);
112
113        Preprocessor *mPreprocessor;
114
115        GlRenderer *mRenderer;
116
117        int mTexWidth;
118        int mTexHeight;
119        float mEpsilon;
120};
121
122extern GlobalLinesRenderer *globalLinesRenderer;
123
124};
125
126#endif
127
Note: See TracBrowser for help on using the repository browser.