[1252] | 1 | #ifndef __QTGLRENDERER_H
|
---|
| 2 | #define __QTGLRENDERER_H
|
---|
| 3 |
|
---|
| 4 | #include <QtOpenGL>
|
---|
| 5 | #include <QWaitCondition>
|
---|
[2543] | 6 | #include <QMutex>
|
---|
[1252] | 7 |
|
---|
| 8 | #include "Vector3.h"
|
---|
| 9 | #include "Containers.h"
|
---|
| 10 | #include "Halton.h"
|
---|
| 11 | #include "Renderer.h"
|
---|
| 12 | #include "GlRenderer.h"
|
---|
| 13 | #include "Beam.h"
|
---|
[1942] | 14 | #include "QtPreprocessorThread.h"
|
---|
[2576] | 15 | #include "LogReader.h"
|
---|
[2604] | 16 | #include "Material.h"
|
---|
[2621] | 17 | #include "common.h"
|
---|
[2543] | 18 |
|
---|
| 19 |
|
---|
[1252] | 20 | class QWidget;
|
---|
| 21 |
|
---|
[2543] | 22 |
|
---|
[2644] | 23 | #define REMOVE_TEMPORARY 1
|
---|
[2543] | 24 |
|
---|
[2644] | 25 |
|
---|
[1252] | 26 | namespace GtpVisibilityPreprocessor {
|
---|
| 27 |
|
---|
[2576] | 28 |
|
---|
[1252] | 29 | class SceneGraph;
|
---|
| 30 | class ViewCellsManager;
|
---|
| 31 | class Mesh;
|
---|
| 32 | class MeshInstance;
|
---|
| 33 | class Intersectable;
|
---|
| 34 | class Material;
|
---|
| 35 | class Beam;
|
---|
| 36 | class KdTree;
|
---|
| 37 | class GlRendererBuffer;
|
---|
| 38 | class BeamSampleStatistics;
|
---|
| 39 | class OcclusionQuery;
|
---|
| 40 | class TransformedMeshInstance;
|
---|
[2694] | 41 | class ObjectPlacer;
|
---|
[1252] | 42 |
|
---|
[1942] | 43 |
|
---|
[1252] | 44 | struct VssRayContainer;
|
---|
| 45 | struct PvsRenderStatistics;
|
---|
| 46 | struct RenderCostSample;
|
---|
| 47 |
|
---|
[2580] | 48 | //class LogWriter;
|
---|
[1252] | 49 |
|
---|
[2580] | 50 |
|
---|
| 51 |
|
---|
[2657] | 52 | class QtGlRendererBuffer
|
---|
[2656] | 53 | : public QObject, public QGLPixelBuffer, public GlRendererBuffer
|
---|
[1252] | 54 | {
|
---|
| 55 | Q_OBJECT
|
---|
| 56 | public:
|
---|
[2664] | 57 | QtGlRendererBuffer(int w, int h,
|
---|
| 58 | SceneGraph *sceneGraph,
|
---|
| 59 | ViewCellsManager *viewcells,
|
---|
| 60 | KdTree *tree);
|
---|
[1252] | 61 |
|
---|
[2664] | 62 | ~QtGlRendererBuffer() {}
|
---|
[1252] | 63 |
|
---|
[2677] | 64 | virtual void MakeLive();
|
---|
| 65 | virtual void DoneLive();
|
---|
[1252] | 66 |
|
---|
[2664] | 67 | virtual int GetWidth() const { return width(); }
|
---|
| 68 | virtual int GetHeight() const { return height(); }
|
---|
[1252] | 69 |
|
---|
[2664] | 70 | int ComputePvs() const { return 0; }
|
---|
[2620] | 71 |
|
---|
[2664] | 72 | void RenderPvs(const ObjectPvs &pvs);
|
---|
[2620] | 73 |
|
---|
[2709] | 74 | float GetPixelError(int &pvsSize, int pass);
|
---|
[2664] | 75 |
|
---|
| 76 | int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const;
|
---|
| 77 |
|
---|
[2730] | 78 | /** quick hack in order to be able to render gvs based triangle pvs.
|
---|
[2695] | 79 | */
|
---|
| 80 | void RenderTrianglePvs();
|
---|
[2686] | 81 |
|
---|
[2696] | 82 |
|
---|
[1252] | 83 | public:
|
---|
[2664] | 84 |
|
---|
| 85 | signals:
|
---|
| 86 | void UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &);
|
---|
[1252] | 87 | };
|
---|
| 88 |
|
---|
| 89 |
|
---|
[2657] | 90 | class QtRendererControlWidget : public QWidget
|
---|
[1252] | 91 | {
|
---|
[1942] | 92 | Q_OBJECT
|
---|
[1252] | 93 | public:
|
---|
| 94 |
|
---|
[1942] | 95 | QListWidget *mPvsErrorWidget;
|
---|
[1252] | 96 |
|
---|
[1942] | 97 | QtRendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0);
|
---|
[1252] | 98 |
|
---|
[2569] | 99 | QGroupBox *CreateVisualizationPanel(QWidget *parent);
|
---|
[2614] | 100 | QGroupBox *CreateTrafoPanel(QWidget *parent);
|
---|
[2569] | 101 |
|
---|
[1942] | 102 | public slots:
|
---|
[1252] | 103 |
|
---|
[1942] | 104 | void FocusNextPvsErrorFrame();
|
---|
[2643] | 105 | void UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &);
|
---|
[1252] | 106 |
|
---|
[2569] | 107 |
|
---|
| 108 | QGroupBox *CreateRenderCostPanel(QWidget *parent);
|
---|
[2587] | 109 | QGroupBox *CreateRayVisualizationPanel(QWidget *parent);
|
---|
[2569] | 110 |
|
---|
| 111 |
|
---|
[1942] | 112 | signals:
|
---|
[2686] | 113 |
|
---|
| 114 | void ReplayViewPoints();
|
---|
[2636] | 115 | void UpdateDynamicObjects();
|
---|
[2709] | 116 | void DeleteDynamicObject();
|
---|
[1942] | 117 | void ComputeVisibility();
|
---|
| 118 | void StopComputation();
|
---|
| 119 | void SetRandomViewPoint();
|
---|
[2584] | 120 | void StoreStatistics();
|
---|
[2643] | 121 | void ComputeGVS();
|
---|
[2703] | 122 | void NextObject();
|
---|
[1942] | 123 | void UpdateAllPvs();
|
---|
| 124 | void SetViewCellGranularity(int);
|
---|
| 125 | void SetTransferFunction(int);
|
---|
| 126 | void SetSceneCut(int);
|
---|
| 127 | void SetTopDistance(int);
|
---|
[2725] | 128 | void SetMaxRenderCost(int);
|
---|
[2562] | 129 | void SetHidingCost(int);
|
---|
[1942] | 130 | void SetVisibilityFilterSize(int);
|
---|
| 131 | void SetSpatialFilterSize(int);
|
---|
[2563] | 132 | void SetTransparency(int);
|
---|
[1252] | 133 |
|
---|
[1942] | 134 | void SetShowRays(bool);
|
---|
| 135 | void SetRenderFilter(bool);
|
---|
| 136 | void SetRenderVisibilityEstimates(bool);
|
---|
| 137 | void SetUseFilter(bool);
|
---|
| 138 | void SetUseSpatialFilter(bool);
|
---|
| 139 | void SetRenderErrors(bool);
|
---|
| 140 | void SetRenderBoxes(bool);
|
---|
| 141 | void SetShowViewCells(bool);
|
---|
| 142 | void SetShowRenderCost(bool);
|
---|
| 143 | void SetShowPvsSizes(bool);
|
---|
[2604] | 144 | void SetShowWireFrame(bool);
|
---|
[2560] | 145 | void SetShowPiercingRays(bool);
|
---|
[2566] | 146 | void SetShowWeightedRays(bool);
|
---|
[2604] | 147 | void SetShowComparison(bool);
|
---|
[2569] | 148 | void SetShowWeightedCost(bool);
|
---|
| 149 |
|
---|
[1942] | 150 | void SetTopView(bool);
|
---|
| 151 | void SetCutViewCells(bool);
|
---|
| 152 | void SetCutScene(bool);
|
---|
[2562] | 153 |
|
---|
| 154 | void SetHideByCost(bool);
|
---|
[2564] | 155 | void SetUseTransparency(bool);
|
---|
[2569] | 156 |
|
---|
| 157 | void SetShowDistanceWeightedTriangles(bool);
|
---|
| 158 | void SetShowWeightedTriangles(bool);
|
---|
| 159 | void SetShowDistanceWeightedPvs(bool);
|
---|
[2587] | 160 |
|
---|
| 161 | void UseConstColorForRayViz(bool);
|
---|
| 162 | void UseRayLengthForRayViz(bool);
|
---|
| 163 | void SetShowContribution(bool);
|
---|
| 164 | void SetShowDistribution(bool);
|
---|
[2591] | 165 |
|
---|
| 166 | void SetShowDistribution1(bool);
|
---|
| 167 | void SetShowDistribution2(bool);
|
---|
| 168 | void SetShowDistribution3(bool);
|
---|
| 169 | void SetShowDistribution4(bool);
|
---|
[2614] | 170 |
|
---|
| 171 | void SetTranslation(bool);
|
---|
| 172 | void SetRotation(bool);
|
---|
| 173 | void SetScale(bool);
|
---|
[1252] | 174 | };
|
---|
| 175 |
|
---|
[1926] | 176 |
|
---|
[2657] | 177 | class QtGlRendererWidget: public QGLWidget, public GlRendererWidget
|
---|
[1252] | 178 | {
|
---|
[2543] | 179 | Q_OBJECT
|
---|
[1252] | 180 | public:
|
---|
| 181 |
|
---|
[2543] | 182 | // point of the last mouse click used for movement in the scene
|
---|
| 183 | Vector3 mousePoint;
|
---|
[1252] | 184 |
|
---|
[2543] | 185 | bool mTopView;
|
---|
| 186 | bool mRenderViewCells;
|
---|
| 187 | bool mCutViewCells;
|
---|
| 188 | bool mCutScene;
|
---|
[2562] | 189 | bool mHideByCost;
|
---|
[2543] | 190 | bool mRenderErrors;
|
---|
| 191 | bool mRenderFilter;
|
---|
| 192 | bool mRenderVisibilityEstimates;
|
---|
| 193 | bool mUseFilter;
|
---|
| 194 | bool mUseSpatialFilter;
|
---|
| 195 | bool mShowRenderCost;
|
---|
[2560] | 196 | bool mShowPiercingRays;
|
---|
[2566] | 197 | bool mShowWeightedRays;
|
---|
[2604] | 198 | bool mUseStandardColors;
|
---|
[2543] | 199 | bool mShowRays;
|
---|
[1252] | 200 |
|
---|
[2543] | 201 | bool mShowPvsSizes;
|
---|
[2580] | 202 | bool mShowComparison;
|
---|
[2543] | 203 | float mSpatialFilterSize;
|
---|
[1252] | 204 |
|
---|
[2543] | 205 | Plane3 mSceneCutPlane;
|
---|
[2562] | 206 | float mHidingCost;
|
---|
| 207 |
|
---|
[2543] | 208 | float mTopDistance;
|
---|
[1252] | 209 |
|
---|
[2563] | 210 | float mTransparency;
|
---|
[2564] | 211 | bool mUseTransparency;
|
---|
[2563] | 212 |
|
---|
[2569] | 213 | bool mShowWeightedCost;
|
---|
| 214 |
|
---|
| 215 | bool mShowDistanceWeightedTriangles;
|
---|
| 216 | bool mShowDistanceWeightedPvs;
|
---|
| 217 | bool mShowWeightedTriangles;
|
---|
[2591] | 218 |
|
---|
| 219 | int mShowDistribution;
|
---|
[2569] | 220 |
|
---|
[2686] | 221 | bool mReplayMode;
|
---|
| 222 |
|
---|
[2543] | 223 | // some statistics
|
---|
| 224 | int mPvsSize;
|
---|
| 225 | float mRenderError;
|
---|
| 226 | float mTransferFunction;
|
---|
[1252] | 227 |
|
---|
[2566] | 228 | Vector3 mDummyViewPoint;
|
---|
| 229 |
|
---|
[2587] | 230 | int mRayVisualizationMethod;
|
---|
[2614] | 231 | int mTrafoType;
|
---|
[2587] | 232 |
|
---|
[2543] | 233 | QtRendererControlWidget *mControlWidget;
|
---|
[1252] | 234 |
|
---|
[2543] | 235 | QtPreprocessorThread *mPreprocessorThread;
|
---|
[1252] | 236 |
|
---|
[2580] | 237 | ViewCellInfoContainer mCompareInfo;
|
---|
[2576] | 238 |
|
---|
[2643] | 239 | int mCurrentPvsCost;
|
---|
| 240 |
|
---|
[2604] | 241 | vector<RgbColor> mColors;
|
---|
| 242 |
|
---|
| 243 | bool mUseRandomColorPerPvsObject;
|
---|
[2678] | 244 |
|
---|
[2686] | 245 | int mUpdateTimerId;
|
---|
| 246 | int mReplayTimerId;
|
---|
| 247 |
|
---|
[2694] | 248 | ObjectPlacer *mPlacer;
|
---|
| 249 |
|
---|
[2709] | 250 | int mCurrentDynamicObjectIdx;
|
---|
| 251 |
|
---|
| 252 | bool mExportFrameBuffer;
|
---|
| 253 |
|
---|
[2725] | 254 | float mMaxRenderCost;
|
---|
| 255 |
|
---|
[2702] | 256 | DynamicObjectsContainer mDynamicPvsObjects;
|
---|
[2696] | 257 |
|
---|
[2543] | 258 | QtGlRendererWidget(SceneGraph *sceneGraph,
|
---|
[2580] | 259 | ViewCellsManager *viewcells,
|
---|
| 260 | KdTree *tree,
|
---|
| 261 | QWidget * parent = 0,
|
---|
| 262 | const QGLWidget *shareWidget = 0,
|
---|
| 263 | Qt::WFlags f = 0);
|
---|
[1997] | 264 |
|
---|
[2543] | 265 | QtGlRendererWidget() {};
|
---|
[1252] | 266 |
|
---|
[2695] | 267 | ~QtGlRendererWidget();
|
---|
[2694] | 268 |
|
---|
[2584] | 269 | void SetThread(QtPreprocessorThread *t)
|
---|
| 270 | {
|
---|
[2543] | 271 | mPreprocessorThread = t;
|
---|
| 272 | }
|
---|
[2695] | 273 |
|
---|
[2576] | 274 | void RenderRenderCost();
|
---|
[1252] | 275 |
|
---|
[2543] | 276 | virtual void SetupCamera();
|
---|
[1252] | 277 |
|
---|
[2695] | 278 | void initializeGL()
|
---|
| 279 | {
|
---|
[2543] | 280 | InitGL();
|
---|
| 281 | }
|
---|
[1252] | 282 |
|
---|
[2543] | 283 | virtual void InitGL();
|
---|
[1252] | 284 |
|
---|
[2543] | 285 | void resizeGL(int w, int h);
|
---|
| 286 | void paintGL();
|
---|
| 287 | void timerEvent(QTimerEvent *event);
|
---|
| 288 | void mousePressEvent(QMouseEvent *);
|
---|
| 289 | void mouseReleaseEvent(QMouseEvent *);
|
---|
| 290 | void mouseMoveEvent(QMouseEvent *);
|
---|
[1252] | 291 |
|
---|
[2543] | 292 | void keyPressEvent(QKeyEvent * e);
|
---|
[1252] | 293 |
|
---|
[2670] | 294 | void VisualizePvs();
|
---|
[1252] | 295 |
|
---|
[2543] | 296 | float RenderErrors();
|
---|
| 297 | void RenderInfo();
|
---|
[1252] | 298 |
|
---|
[2543] | 299 | virtual int GetWidth() const { return width(); }
|
---|
| 300 | virtual int GetHeight() const { return height(); }
|
---|
[1252] | 301 |
|
---|
[2686] | 302 | virtual void SetupCameraProjection(const int w,
|
---|
| 303 | const int h,
|
---|
| 304 | const float angle = 70.0f);
|
---|
[2538] | 305 |
|
---|
[2609] | 306 | void RenderViewCells();
|
---|
[1252] | 307 |
|
---|
[2609] | 308 | virtual void Show() { show(); }
|
---|
[1252] | 309 |
|
---|
[2543] | 310 | bool PvsChanged(ViewCell *viewcell) const;
|
---|
[1252] | 311 |
|
---|
[2576] | 312 | void ComputeMaxValues(const ViewCellContainer &viewCells,
|
---|
| 313 | int &maxPvs,
|
---|
| 314 | int &maxPiercingRays,
|
---|
| 315 | float &maxRelativeRays,
|
---|
| 316 | float &maxRcCost);
|
---|
| 317 |
|
---|
| 318 | void AssignImportanceByRelativeValue(const ViewCellContainer &viewCells,
|
---|
| 319 | int &maxPvs,
|
---|
| 320 | int &maxPiercingRays,
|
---|
| 321 | float &maxRelativeRays,
|
---|
| 322 | float &maxRcCost);
|
---|
| 323 |
|
---|
| 324 | void AssignColorByComparison(const ViewCellContainer &viewcells,
|
---|
[2580] | 325 | const ViewCellInfoContainer &compareInfo);
|
---|
[2576] | 326 |
|
---|
[2584] | 327 | void WriteViewCellInfos();
|
---|
[2693] | 328 | /** Unproject x/y screen coordinates.
|
---|
| 329 | */
|
---|
| 330 | Vector3 Unproject(int x, int y);
|
---|
[2686] | 331 |
|
---|
[2702] | 332 | int FindDynamicObject(float x, float y);
|
---|
[2584] | 333 |
|
---|
[2703] | 334 | void LoadObjects();
|
---|
| 335 | void LoadObject(const std::string &filename);
|
---|
[2696] | 336 |
|
---|
[2543] | 337 | public slots:
|
---|
[2677] | 338 |
|
---|
[2686] | 339 | /** Replay the view points stored in the view points list.
|
---|
| 340 | */
|
---|
| 341 | void ReplayViewPoints();
|
---|
[2677] | 342 | void UpdateDynamicObjects();
|
---|
[2709] | 343 | void DeleteDynamicObject();
|
---|
[2543] | 344 | void UpdateAllPvs();
|
---|
| 345 | void ComputeVisibility();
|
---|
| 346 | void StopComputation();
|
---|
| 347 | void SetRandomViewPoint();
|
---|
[2584] | 348 | void StoreStatistics();
|
---|
[2643] | 349 |
|
---|
[2703] | 350 | //void LoadObject();
|
---|
| 351 | void NextObject();
|
---|
[1926] | 352 |
|
---|
[2543] | 353 | void SetRenderErrors(bool b) {
|
---|
| 354 | mRenderErrors = b;
|
---|
| 355 | updateGL();
|
---|
| 356 | }
|
---|
[1926] | 357 |
|
---|
[2643] | 358 | void ComputeGVS() {
|
---|
| 359 | mComputeGVS = true;
|
---|
| 360 | updateGL();
|
---|
| 361 | }
|
---|
| 362 |
|
---|
[2543] | 363 | void SetRenderBoxes(bool b) {
|
---|
| 364 | mRenderBoxes = b;
|
---|
| 365 | updateGL();
|
---|
| 366 | }
|
---|
[1926] | 367 |
|
---|
[2543] | 368 | void SetRenderFilter(bool b) {
|
---|
| 369 | mRenderFilter = b;
|
---|
| 370 | updateGL();
|
---|
| 371 | }
|
---|
[1926] | 372 |
|
---|
[2543] | 373 | void SetRenderVisibilityEstimates(bool b) {
|
---|
| 374 | mRenderVisibilityEstimates = b;
|
---|
| 375 | updateGL();
|
---|
| 376 | }
|
---|
[1926] | 377 |
|
---|
[2543] | 378 | void SetUseFilter(bool b) {
|
---|
| 379 | mUseFilter = b;
|
---|
| 380 | mPvsCache.Reset();
|
---|
| 381 | updateGL();
|
---|
| 382 | }
|
---|
[1926] | 383 |
|
---|
[2543] | 384 | void SetUseSpatialFilter(bool b) {
|
---|
| 385 | mUseSpatialFilter = b;
|
---|
| 386 | mPvsCache.Reset();
|
---|
| 387 | updateGL();
|
---|
| 388 | }
|
---|
[1926] | 389 |
|
---|
[1942] | 390 |
|
---|
[2543] | 391 | void
|
---|
| 392 | SetViewCellGranularity(int number);
|
---|
[1942] | 393 |
|
---|
[2543] | 394 | void SetTransferFunction(int number)
|
---|
| 395 | {
|
---|
| 396 | mTransferFunction = number/1000.0f;
|
---|
| 397 | updateGL();
|
---|
| 398 | }
|
---|
[2538] | 399 |
|
---|
[2543] | 400 | void SetVisibilityFilterSize(int number);
|
---|
[2538] | 401 |
|
---|
[2543] | 402 | void
|
---|
| 403 | SetSpatialFilterSize(int number);
|
---|
| 404 |
|
---|
| 405 | void
|
---|
| 406 | SetSceneCut(int cut);
|
---|
| 407 |
|
---|
| 408 | void
|
---|
| 409 | SetTopDistance(int dist);
|
---|
| 410 |
|
---|
[2562] | 411 | void
|
---|
[2725] | 412 | SetMaxRenderCost(int dist);
|
---|
| 413 |
|
---|
| 414 | void
|
---|
[2563] | 415 | SetTransparency(int dist);
|
---|
| 416 |
|
---|
| 417 | void
|
---|
[2562] | 418 | SetHidingCost(int dist);
|
---|
| 419 |
|
---|
[2543] | 420 | void SetShowViewCells(bool b) {
|
---|
| 421 | mRenderViewCells = b;
|
---|
| 422 | updateGL();
|
---|
| 423 | }
|
---|
| 424 |
|
---|
| 425 | void SetShowRays(bool b) {
|
---|
| 426 | mShowRays = b;
|
---|
| 427 | updateGL();
|
---|
| 428 | }
|
---|
| 429 |
|
---|
| 430 | void SetShowRenderCost(bool b) {
|
---|
| 431 | mShowRenderCost = b;
|
---|
| 432 | updateGL();
|
---|
| 433 | }
|
---|
| 434 |
|
---|
| 435 | void SetShowPvsSizes(bool b) {
|
---|
| 436 | mShowPvsSizes = b;
|
---|
| 437 | updateGL();
|
---|
| 438 | }
|
---|
| 439 |
|
---|
[2580] | 440 | void SetShowComparison(bool b) {
|
---|
| 441 | mShowComparison = b;
|
---|
| 442 | updateGL();
|
---|
| 443 | }
|
---|
| 444 |
|
---|
[2560] | 445 | void SetShowPiercingRays(bool b) {
|
---|
| 446 | mShowPiercingRays = b;
|
---|
| 447 | updateGL();
|
---|
| 448 | }
|
---|
| 449 |
|
---|
[2604] | 450 | void SetShowWireFrame(bool b) {
|
---|
| 451 | mUseStandardColors = b;
|
---|
| 452 | updateGL();
|
---|
| 453 | }
|
---|
| 454 |
|
---|
| 455 |
|
---|
[2566] | 456 | void SetShowWeightedRays(bool b) {
|
---|
| 457 | mShowWeightedRays = b;
|
---|
| 458 | updateGL();
|
---|
| 459 | }
|
---|
| 460 |
|
---|
[2543] | 461 | void SetTopView(bool b) {
|
---|
| 462 | mTopView = b;
|
---|
| 463 | updateGL();
|
---|
| 464 | }
|
---|
| 465 |
|
---|
| 466 | void SetCutViewCells(bool b) {
|
---|
| 467 | mCutViewCells = b;
|
---|
| 468 | updateGL();
|
---|
| 469 | }
|
---|
| 470 | void SetCutScene(bool b) {
|
---|
| 471 | mCutScene = b;
|
---|
| 472 | updateGL();
|
---|
| 473 | }
|
---|
| 474 |
|
---|
[2562] | 475 | void SetHideByCost(bool b) {
|
---|
| 476 | mHideByCost = b;
|
---|
| 477 | updateGL();
|
---|
| 478 | }
|
---|
| 479 |
|
---|
[2564] | 480 | void SetUseTransparency(bool b) {
|
---|
| 481 | mUseTransparency = b;
|
---|
| 482 | updateGL();
|
---|
| 483 | }
|
---|
| 484 |
|
---|
[2569] | 485 | void SetShowWeightedCost(bool b)
|
---|
| 486 | {
|
---|
| 487 | mShowWeightedCost = b;
|
---|
| 488 | updateGL();
|
---|
| 489 | }
|
---|
| 490 |
|
---|
| 491 | void SetShowDistanceWeightedPvs(bool b)
|
---|
| 492 | {
|
---|
| 493 | mShowDistanceWeightedPvs = b;
|
---|
| 494 | updateGL();
|
---|
| 495 | }
|
---|
| 496 |
|
---|
| 497 |
|
---|
| 498 | void SetShowDistanceWeightedTriangles(bool b)
|
---|
| 499 | {
|
---|
| 500 | mShowDistanceWeightedTriangles = b;
|
---|
| 501 | updateGL();
|
---|
| 502 | }
|
---|
| 503 |
|
---|
| 504 | void SetShowWeightedTriangles(bool b)
|
---|
| 505 | {
|
---|
| 506 | mShowWeightedTriangles = b;
|
---|
| 507 | updateGL();
|
---|
| 508 | }
|
---|
| 509 |
|
---|
[2587] | 510 | void UseConstColorForRayViz(bool b)
|
---|
| 511 | {
|
---|
| 512 | mRayVisualizationMethod = 0;
|
---|
| 513 | }
|
---|
| 514 |
|
---|
| 515 | void UseRayLengthForRayViz(bool b)
|
---|
| 516 | {
|
---|
| 517 | mRayVisualizationMethod = 1;
|
---|
| 518 | }
|
---|
[2569] | 519 |
|
---|
[2587] | 520 | void SetShowContribution(bool b)
|
---|
| 521 | {
|
---|
| 522 | mRayVisualizationMethod = 2;
|
---|
| 523 | }
|
---|
| 524 |
|
---|
| 525 | void SetShowDistribution(bool b)
|
---|
| 526 | {
|
---|
| 527 | mRayVisualizationMethod = 3;
|
---|
| 528 | }
|
---|
[2614] | 529 |
|
---|
| 530 | void SetTranslation(bool b)
|
---|
| 531 | {
|
---|
| 532 | mTrafoType = 0;
|
---|
| 533 | }
|
---|
| 534 |
|
---|
| 535 | void SetScale(bool b)
|
---|
| 536 | {
|
---|
| 537 | mTrafoType = 1;
|
---|
| 538 | }
|
---|
[2591] | 539 |
|
---|
[2614] | 540 | void SetRotation(bool b)
|
---|
| 541 | {
|
---|
| 542 | mTrafoType = 2;
|
---|
| 543 | }
|
---|
| 544 |
|
---|
[2591] | 545 | void SetShowDistribution1(bool b)
|
---|
| 546 | {
|
---|
| 547 | if (b)
|
---|
| 548 | mShowDistribution |= 1;
|
---|
| 549 | else
|
---|
| 550 | mShowDistribution ^= 1;
|
---|
[2587] | 551 |
|
---|
[2677] | 552 | std::cout << "b: "
|
---|
| 553 | << (mShowDistribution & 1) << " "
|
---|
| 554 | << (mShowDistribution & 2) << " "
|
---|
| 555 | << (mShowDistribution & 4) << " "
|
---|
| 556 | << (mShowDistribution & 8) << std::endl;
|
---|
[2591] | 557 | }
|
---|
[2587] | 558 |
|
---|
[2591] | 559 |
|
---|
| 560 | void SetShowDistribution2(bool b)
|
---|
| 561 | {
|
---|
| 562 | if (b)
|
---|
| 563 | mShowDistribution |= 2;
|
---|
| 564 | else
|
---|
| 565 | mShowDistribution ^= 2;
|
---|
| 566 | }
|
---|
| 567 |
|
---|
| 568 |
|
---|
| 569 | void SetShowDistribution3(bool b)
|
---|
| 570 | {
|
---|
| 571 | if (b)
|
---|
| 572 | mShowDistribution |= 4;
|
---|
| 573 | else
|
---|
| 574 | mShowDistribution ^= 4;
|
---|
| 575 | }
|
---|
| 576 |
|
---|
| 577 | void SetShowDistribution4(bool b)
|
---|
| 578 | {
|
---|
| 579 | if (b)
|
---|
| 580 | mShowDistribution |= 8;
|
---|
| 581 | else
|
---|
| 582 | mShowDistribution ^= 8;
|
---|
| 583 | }
|
---|
| 584 |
|
---|
[2686] | 585 |
|
---|
[2670] | 586 | /** Prepare pvs for rendering.
|
---|
| 587 | */
|
---|
| 588 | virtual void PreparePvs(const ObjectPvs &pvs);
|
---|
| 589 | /** Internal method rendering the pvs if it has been properly prepared.
|
---|
| 590 | */
|
---|
[2543] | 591 | void _RenderPvs();
|
---|
[2609] | 592 | /** Render pvs using false colors.
|
---|
| 593 | */
|
---|
| 594 | void _RenderColoredPvs();
|
---|
[2543] | 595 |
|
---|
[2569] | 596 | float ComputeRenderCost(ViewCell *vc);
|
---|
[2543] | 597 |
|
---|
[2584] | 598 |
|
---|
[2543] | 599 | /////////
|
---|
| 600 |
|
---|
| 601 | signals:
|
---|
| 602 | void PvsUpdated();
|
---|
[1252] | 603 | };
|
---|
| 604 |
|
---|
| 605 |
|
---|
[2657] | 606 | class QtGlDebuggerWidget: public QGLWidget
|
---|
[1252] | 607 | {
|
---|
| 608 | Q_OBJECT
|
---|
| 609 | public:
|
---|
[1942] | 610 | QtGlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent = NULL);
|
---|
| 611 | ~QtGlDebuggerWidget();
|
---|
| 612 | void initializeGL();
|
---|
| 613 | void resizeGL(int w, int h);
|
---|
| 614 | void paintGL();
|
---|
| 615 | void timerEvent(QTimerEvent *) { update(); }
|
---|
| 616 | void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
|
---|
| 617 | void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
|
---|
[1252] | 618 |
|
---|
[1942] | 619 | void initCommon();
|
---|
| 620 | void initPbuffer();
|
---|
[1252] | 621 |
|
---|
[1942] | 622 |
|
---|
| 623 | QtGlRendererBuffer *mRenderBuffer;
|
---|
[1252] | 624 |
|
---|
[1942] | 625 | Beam mBeam;
|
---|
| 626 | int mSamples;
|
---|
| 627 | Intersectable *mSourceObject;
|
---|
[1252] | 628 |
|
---|
| 629 | private:
|
---|
[2543] | 630 |
|
---|
[1942] | 631 | GLuint dynamicTexture;
|
---|
| 632 | int timerId;
|
---|
[1252] | 633 | };
|
---|
| 634 |
|
---|
[2543] | 635 |
|
---|
[1252] | 636 | extern QtGlDebuggerWidget *debuggerWidget;
|
---|
| 637 |
|
---|
| 638 | };
|
---|
| 639 |
|
---|
| 640 | #endif
|
---|