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

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