[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 |
|
---|
[2664] | 74 | float GetPixelError(int &pvsSize);
|
---|
| 75 |
|
---|
| 76 | int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const;
|
---|
| 77 |
|
---|
[2695] | 78 | /** quick hack in order to be able to render gvs pvs.
|
---|
| 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();
|
---|
[1942] | 116 | void ComputeVisibility();
|
---|
| 117 | void StopComputation();
|
---|
| 118 | void SetRandomViewPoint();
|
---|
[2584] | 119 | void StoreStatistics();
|
---|
[2643] | 120 | void ComputeGVS();
|
---|
[2609] | 121 | void LoadObject();
|
---|
[1942] | 122 | void UpdateAllPvs();
|
---|
| 123 | void SetViewCellGranularity(int);
|
---|
| 124 | void SetTransferFunction(int);
|
---|
| 125 | void SetSceneCut(int);
|
---|
| 126 | void SetTopDistance(int);
|
---|
[2562] | 127 | void SetHidingCost(int);
|
---|
[1942] | 128 | void SetVisibilityFilterSize(int);
|
---|
| 129 | void SetSpatialFilterSize(int);
|
---|
[2563] | 130 | void SetTransparency(int);
|
---|
[1252] | 131 |
|
---|
[1942] | 132 | void SetShowRays(bool);
|
---|
| 133 | void SetRenderFilter(bool);
|
---|
| 134 | void SetRenderVisibilityEstimates(bool);
|
---|
| 135 | void SetUseFilter(bool);
|
---|
| 136 | void SetUseSpatialFilter(bool);
|
---|
| 137 | void SetRenderErrors(bool);
|
---|
| 138 | void SetRenderBoxes(bool);
|
---|
| 139 | void SetShowViewCells(bool);
|
---|
| 140 | void SetShowRenderCost(bool);
|
---|
| 141 | void SetShowPvsSizes(bool);
|
---|
[2604] | 142 | void SetShowWireFrame(bool);
|
---|
[2560] | 143 | void SetShowPiercingRays(bool);
|
---|
[2566] | 144 | void SetShowWeightedRays(bool);
|
---|
[2604] | 145 | void SetShowComparison(bool);
|
---|
[2569] | 146 | void SetShowWeightedCost(bool);
|
---|
| 147 |
|
---|
[1942] | 148 | void SetTopView(bool);
|
---|
| 149 | void SetCutViewCells(bool);
|
---|
| 150 | void SetCutScene(bool);
|
---|
[2562] | 151 |
|
---|
| 152 | void SetHideByCost(bool);
|
---|
[2564] | 153 | void SetUseTransparency(bool);
|
---|
[2569] | 154 |
|
---|
| 155 | void SetShowDistanceWeightedTriangles(bool);
|
---|
| 156 | void SetShowWeightedTriangles(bool);
|
---|
| 157 | void SetShowDistanceWeightedPvs(bool);
|
---|
[2587] | 158 |
|
---|
| 159 | void UseConstColorForRayViz(bool);
|
---|
| 160 | void UseRayLengthForRayViz(bool);
|
---|
| 161 | void SetShowContribution(bool);
|
---|
| 162 | void SetShowDistribution(bool);
|
---|
[2591] | 163 |
|
---|
| 164 | void SetShowDistribution1(bool);
|
---|
| 165 | void SetShowDistribution2(bool);
|
---|
| 166 | void SetShowDistribution3(bool);
|
---|
| 167 | void SetShowDistribution4(bool);
|
---|
[2614] | 168 |
|
---|
| 169 | void SetTranslation(bool);
|
---|
| 170 | void SetRotation(bool);
|
---|
| 171 | void SetScale(bool);
|
---|
[1252] | 172 | };
|
---|
| 173 |
|
---|
[1926] | 174 |
|
---|
[2657] | 175 | class QtGlRendererWidget: public QGLWidget, public GlRendererWidget
|
---|
[1252] | 176 | {
|
---|
[2543] | 177 | Q_OBJECT
|
---|
[1252] | 178 | public:
|
---|
| 179 |
|
---|
[2543] | 180 | // point of the last mouse click used for movement in the scene
|
---|
| 181 | Vector3 mousePoint;
|
---|
[1252] | 182 |
|
---|
[2543] | 183 | bool mTopView;
|
---|
| 184 | bool mRenderViewCells;
|
---|
| 185 | bool mCutViewCells;
|
---|
| 186 | bool mCutScene;
|
---|
[2562] | 187 | bool mHideByCost;
|
---|
[2543] | 188 | bool mRenderErrors;
|
---|
| 189 | bool mRenderFilter;
|
---|
| 190 | bool mRenderVisibilityEstimates;
|
---|
| 191 | bool mUseFilter;
|
---|
| 192 | bool mUseSpatialFilter;
|
---|
| 193 | bool mShowRenderCost;
|
---|
[2560] | 194 | bool mShowPiercingRays;
|
---|
[2566] | 195 | bool mShowWeightedRays;
|
---|
[2604] | 196 | bool mUseStandardColors;
|
---|
[2543] | 197 | bool mShowRays;
|
---|
[1252] | 198 |
|
---|
[2543] | 199 | bool mShowPvsSizes;
|
---|
[2580] | 200 | bool mShowComparison;
|
---|
[2543] | 201 | float mSpatialFilterSize;
|
---|
[1252] | 202 |
|
---|
[2543] | 203 | Plane3 mSceneCutPlane;
|
---|
[2562] | 204 | float mHidingCost;
|
---|
| 205 |
|
---|
[2543] | 206 | float mTopDistance;
|
---|
[1252] | 207 |
|
---|
[2563] | 208 | float mTransparency;
|
---|
[2564] | 209 | bool mUseTransparency;
|
---|
[2563] | 210 |
|
---|
[2569] | 211 | bool mShowWeightedCost;
|
---|
| 212 |
|
---|
| 213 | bool mShowDistanceWeightedTriangles;
|
---|
| 214 | bool mShowDistanceWeightedPvs;
|
---|
| 215 | bool mShowWeightedTriangles;
|
---|
[2591] | 216 |
|
---|
| 217 | int mShowDistribution;
|
---|
[2569] | 218 |
|
---|
[2614] | 219 | int mCurrentDynamicObjectIdx;
|
---|
| 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 |
|
---|
[2702] | 250 | //DynamicObjectsContainer mPendingDynamicObjects;
|
---|
| 251 | DynamicObjectsContainer mDynamicPvsObjects;
|
---|
[2696] | 252 |
|
---|
[2543] | 253 | QtGlRendererWidget(SceneGraph *sceneGraph,
|
---|
[2580] | 254 | ViewCellsManager *viewcells,
|
---|
| 255 | KdTree *tree,
|
---|
| 256 | QWidget * parent = 0,
|
---|
| 257 | const QGLWidget *shareWidget = 0,
|
---|
| 258 | Qt::WFlags f = 0);
|
---|
[1997] | 259 |
|
---|
[2543] | 260 | QtGlRendererWidget() {};
|
---|
[1252] | 261 |
|
---|
[2695] | 262 | ~QtGlRendererWidget();
|
---|
[2694] | 263 |
|
---|
[2584] | 264 | void SetThread(QtPreprocessorThread *t)
|
---|
| 265 | {
|
---|
[2543] | 266 | mPreprocessorThread = t;
|
---|
| 267 | }
|
---|
[2695] | 268 |
|
---|
[2576] | 269 | void RenderRenderCost();
|
---|
[1252] | 270 |
|
---|
[2543] | 271 | virtual void SetupCamera();
|
---|
[1252] | 272 |
|
---|
[2695] | 273 | void initializeGL()
|
---|
| 274 | {
|
---|
[2543] | 275 | InitGL();
|
---|
| 276 | }
|
---|
[1252] | 277 |
|
---|
[2543] | 278 | virtual void InitGL();
|
---|
[1252] | 279 |
|
---|
[2543] | 280 | void resizeGL(int w, int h);
|
---|
| 281 | void paintGL();
|
---|
| 282 | void timerEvent(QTimerEvent *event);
|
---|
| 283 | void mousePressEvent(QMouseEvent *);
|
---|
| 284 | void mouseReleaseEvent(QMouseEvent *);
|
---|
| 285 | void mouseMoveEvent(QMouseEvent *);
|
---|
[1252] | 286 |
|
---|
[2543] | 287 | void keyPressEvent(QKeyEvent * e);
|
---|
[1252] | 288 |
|
---|
[2670] | 289 | void VisualizePvs();
|
---|
[1252] | 290 |
|
---|
[2543] | 291 | float RenderErrors();
|
---|
| 292 | void RenderInfo();
|
---|
[1252] | 293 |
|
---|
[2543] | 294 | virtual int GetWidth() const { return width(); }
|
---|
| 295 | virtual int GetHeight() const { return height(); }
|
---|
[1252] | 296 |
|
---|
[2686] | 297 | virtual void SetupCameraProjection(const int w,
|
---|
| 298 | const int h,
|
---|
| 299 | const float angle = 70.0f);
|
---|
[2538] | 300 |
|
---|
[2609] | 301 | void RenderViewCells();
|
---|
[1252] | 302 |
|
---|
[2609] | 303 | virtual void Show() { show(); }
|
---|
[1252] | 304 |
|
---|
[2543] | 305 | bool PvsChanged(ViewCell *viewcell) const;
|
---|
[1252] | 306 |
|
---|
[2576] | 307 | void ComputeMaxValues(const ViewCellContainer &viewCells,
|
---|
| 308 | int &maxPvs,
|
---|
| 309 | int &maxPiercingRays,
|
---|
| 310 | float &maxRelativeRays,
|
---|
| 311 | float &maxRcCost);
|
---|
| 312 |
|
---|
| 313 | void AssignImportanceByRelativeValue(const ViewCellContainer &viewCells,
|
---|
| 314 | int &maxPvs,
|
---|
| 315 | int &maxPiercingRays,
|
---|
| 316 | float &maxRelativeRays,
|
---|
| 317 | float &maxRcCost);
|
---|
| 318 |
|
---|
| 319 | void AssignColorByComparison(const ViewCellContainer &viewcells,
|
---|
[2580] | 320 | const ViewCellInfoContainer &compareInfo);
|
---|
[2576] | 321 |
|
---|
[2584] | 322 | void WriteViewCellInfos();
|
---|
[2693] | 323 | /** Unproject x/y screen coordinates.
|
---|
| 324 | */
|
---|
| 325 | Vector3 Unproject(int x, int y);
|
---|
[2686] | 326 |
|
---|
[2702] | 327 | int FindDynamicObject(float x, float y);
|
---|
[2584] | 328 |
|
---|
[2696] | 329 |
|
---|
[2543] | 330 | public slots:
|
---|
[2677] | 331 |
|
---|
[2686] | 332 | /** Replay the view points stored in the view points list.
|
---|
| 333 | */
|
---|
| 334 | void ReplayViewPoints();
|
---|
[2677] | 335 | void UpdateDynamicObjects();
|
---|
[2543] | 336 | void UpdateAllPvs();
|
---|
| 337 | void ComputeVisibility();
|
---|
| 338 | void StopComputation();
|
---|
| 339 | void SetRandomViewPoint();
|
---|
[2584] | 340 | void StoreStatistics();
|
---|
[2643] | 341 |
|
---|
[2609] | 342 | void LoadObject();
|
---|
[1926] | 343 |
|
---|
[2543] | 344 | void SetRenderErrors(bool b) {
|
---|
| 345 | mRenderErrors = b;
|
---|
| 346 | updateGL();
|
---|
| 347 | }
|
---|
[1926] | 348 |
|
---|
[2643] | 349 | void ComputeGVS() {
|
---|
| 350 | mComputeGVS = true;
|
---|
| 351 | updateGL();
|
---|
| 352 | }
|
---|
| 353 |
|
---|
[2543] | 354 | void SetRenderBoxes(bool b) {
|
---|
| 355 | mRenderBoxes = b;
|
---|
| 356 | updateGL();
|
---|
| 357 | }
|
---|
[1926] | 358 |
|
---|
[2543] | 359 | void SetRenderFilter(bool b) {
|
---|
| 360 | mRenderFilter = b;
|
---|
| 361 | updateGL();
|
---|
| 362 | }
|
---|
[1926] | 363 |
|
---|
[2543] | 364 | void SetRenderVisibilityEstimates(bool b) {
|
---|
| 365 | mRenderVisibilityEstimates = b;
|
---|
| 366 | updateGL();
|
---|
| 367 | }
|
---|
[1926] | 368 |
|
---|
[2543] | 369 | void SetUseFilter(bool b) {
|
---|
| 370 | mUseFilter = b;
|
---|
| 371 | mPvsCache.Reset();
|
---|
| 372 | updateGL();
|
---|
| 373 | }
|
---|
[1926] | 374 |
|
---|
[2543] | 375 | void SetUseSpatialFilter(bool b) {
|
---|
| 376 | mUseSpatialFilter = b;
|
---|
| 377 | mPvsCache.Reset();
|
---|
| 378 | updateGL();
|
---|
| 379 | }
|
---|
[1926] | 380 |
|
---|
[1942] | 381 |
|
---|
[2543] | 382 | void
|
---|
| 383 | SetViewCellGranularity(int number);
|
---|
[1942] | 384 |
|
---|
[2543] | 385 | void SetTransferFunction(int number)
|
---|
| 386 | {
|
---|
| 387 | mTransferFunction = number/1000.0f;
|
---|
| 388 | updateGL();
|
---|
| 389 | }
|
---|
[2538] | 390 |
|
---|
[2543] | 391 | void SetVisibilityFilterSize(int number);
|
---|
[2538] | 392 |
|
---|
[2543] | 393 | void
|
---|
| 394 | SetSpatialFilterSize(int number);
|
---|
| 395 |
|
---|
| 396 | void
|
---|
| 397 | SetSceneCut(int cut);
|
---|
| 398 |
|
---|
| 399 | void
|
---|
| 400 | SetTopDistance(int dist);
|
---|
| 401 |
|
---|
[2562] | 402 | void
|
---|
[2563] | 403 | SetTransparency(int dist);
|
---|
| 404 |
|
---|
| 405 | void
|
---|
[2562] | 406 | SetHidingCost(int dist);
|
---|
| 407 |
|
---|
[2543] | 408 | void SetShowViewCells(bool b) {
|
---|
| 409 | mRenderViewCells = b;
|
---|
| 410 | updateGL();
|
---|
| 411 | }
|
---|
| 412 |
|
---|
| 413 | void SetShowRays(bool b) {
|
---|
| 414 | mShowRays = b;
|
---|
| 415 | updateGL();
|
---|
| 416 | }
|
---|
| 417 |
|
---|
| 418 | void SetShowRenderCost(bool b) {
|
---|
| 419 | mShowRenderCost = b;
|
---|
| 420 | updateGL();
|
---|
| 421 | }
|
---|
| 422 |
|
---|
| 423 | void SetShowPvsSizes(bool b) {
|
---|
| 424 | mShowPvsSizes = b;
|
---|
| 425 | updateGL();
|
---|
| 426 | }
|
---|
| 427 |
|
---|
[2580] | 428 | void SetShowComparison(bool b) {
|
---|
| 429 | mShowComparison = b;
|
---|
| 430 | updateGL();
|
---|
| 431 | }
|
---|
| 432 |
|
---|
[2560] | 433 | void SetShowPiercingRays(bool b) {
|
---|
| 434 | mShowPiercingRays = b;
|
---|
| 435 | updateGL();
|
---|
| 436 | }
|
---|
| 437 |
|
---|
[2604] | 438 | void SetShowWireFrame(bool b) {
|
---|
| 439 | mUseStandardColors = b;
|
---|
| 440 | updateGL();
|
---|
| 441 | }
|
---|
| 442 |
|
---|
| 443 |
|
---|
[2566] | 444 | void SetShowWeightedRays(bool b) {
|
---|
| 445 | mShowWeightedRays = b;
|
---|
| 446 | updateGL();
|
---|
| 447 | }
|
---|
| 448 |
|
---|
[2543] | 449 | void SetTopView(bool b) {
|
---|
| 450 | mTopView = b;
|
---|
| 451 | updateGL();
|
---|
| 452 | }
|
---|
| 453 |
|
---|
| 454 | void SetCutViewCells(bool b) {
|
---|
| 455 | mCutViewCells = b;
|
---|
| 456 | updateGL();
|
---|
| 457 | }
|
---|
| 458 | void SetCutScene(bool b) {
|
---|
| 459 | mCutScene = b;
|
---|
| 460 | updateGL();
|
---|
| 461 | }
|
---|
| 462 |
|
---|
[2562] | 463 | void SetHideByCost(bool b) {
|
---|
| 464 | mHideByCost = b;
|
---|
| 465 | updateGL();
|
---|
| 466 | }
|
---|
| 467 |
|
---|
[2564] | 468 | void SetUseTransparency(bool b) {
|
---|
| 469 | mUseTransparency = b;
|
---|
| 470 | updateGL();
|
---|
| 471 | }
|
---|
| 472 |
|
---|
[2569] | 473 | void SetShowWeightedCost(bool b)
|
---|
| 474 | {
|
---|
| 475 | mShowWeightedCost = b;
|
---|
| 476 | updateGL();
|
---|
| 477 | }
|
---|
| 478 |
|
---|
| 479 | void SetShowDistanceWeightedPvs(bool b)
|
---|
| 480 | {
|
---|
| 481 | mShowDistanceWeightedPvs = b;
|
---|
| 482 | updateGL();
|
---|
| 483 | }
|
---|
| 484 |
|
---|
| 485 |
|
---|
| 486 | void SetShowDistanceWeightedTriangles(bool b)
|
---|
| 487 | {
|
---|
| 488 | mShowDistanceWeightedTriangles = b;
|
---|
| 489 | updateGL();
|
---|
| 490 | }
|
---|
| 491 |
|
---|
| 492 | void SetShowWeightedTriangles(bool b)
|
---|
| 493 | {
|
---|
| 494 | mShowWeightedTriangles = b;
|
---|
| 495 | updateGL();
|
---|
| 496 | }
|
---|
| 497 |
|
---|
[2587] | 498 | void UseConstColorForRayViz(bool b)
|
---|
| 499 | {
|
---|
| 500 | mRayVisualizationMethod = 0;
|
---|
| 501 | }
|
---|
| 502 |
|
---|
| 503 | void UseRayLengthForRayViz(bool b)
|
---|
| 504 | {
|
---|
| 505 | mRayVisualizationMethod = 1;
|
---|
| 506 | }
|
---|
[2569] | 507 |
|
---|
[2587] | 508 | void SetShowContribution(bool b)
|
---|
| 509 | {
|
---|
| 510 | mRayVisualizationMethod = 2;
|
---|
| 511 | }
|
---|
| 512 |
|
---|
| 513 | void SetShowDistribution(bool b)
|
---|
| 514 | {
|
---|
| 515 | mRayVisualizationMethod = 3;
|
---|
| 516 | }
|
---|
[2614] | 517 |
|
---|
| 518 | void SetTranslation(bool b)
|
---|
| 519 | {
|
---|
| 520 | mTrafoType = 0;
|
---|
| 521 | }
|
---|
| 522 |
|
---|
| 523 | void SetScale(bool b)
|
---|
| 524 | {
|
---|
| 525 | mTrafoType = 1;
|
---|
| 526 | }
|
---|
[2591] | 527 |
|
---|
[2614] | 528 | void SetRotation(bool b)
|
---|
| 529 | {
|
---|
| 530 | mTrafoType = 2;
|
---|
| 531 | }
|
---|
| 532 |
|
---|
[2591] | 533 | void SetShowDistribution1(bool b)
|
---|
| 534 | {
|
---|
| 535 | if (b)
|
---|
| 536 | mShowDistribution |= 1;
|
---|
| 537 | else
|
---|
| 538 | mShowDistribution ^= 1;
|
---|
[2587] | 539 |
|
---|
[2677] | 540 | std::cout << "b: "
|
---|
| 541 | << (mShowDistribution & 1) << " "
|
---|
| 542 | << (mShowDistribution & 2) << " "
|
---|
| 543 | << (mShowDistribution & 4) << " "
|
---|
| 544 | << (mShowDistribution & 8) << std::endl;
|
---|
[2591] | 545 | }
|
---|
[2587] | 546 |
|
---|
[2591] | 547 |
|
---|
| 548 | void SetShowDistribution2(bool b)
|
---|
| 549 | {
|
---|
| 550 | if (b)
|
---|
| 551 | mShowDistribution |= 2;
|
---|
| 552 | else
|
---|
| 553 | mShowDistribution ^= 2;
|
---|
| 554 | }
|
---|
| 555 |
|
---|
| 556 |
|
---|
| 557 | void SetShowDistribution3(bool b)
|
---|
| 558 | {
|
---|
| 559 | if (b)
|
---|
| 560 | mShowDistribution |= 4;
|
---|
| 561 | else
|
---|
| 562 | mShowDistribution ^= 4;
|
---|
| 563 | }
|
---|
| 564 |
|
---|
| 565 | void SetShowDistribution4(bool b)
|
---|
| 566 | {
|
---|
| 567 | if (b)
|
---|
| 568 | mShowDistribution |= 8;
|
---|
| 569 | else
|
---|
| 570 | mShowDistribution ^= 8;
|
---|
| 571 | }
|
---|
| 572 |
|
---|
[2686] | 573 |
|
---|
[2670] | 574 | /** Prepare pvs for rendering.
|
---|
| 575 | */
|
---|
| 576 | virtual void PreparePvs(const ObjectPvs &pvs);
|
---|
| 577 | /** Internal method rendering the pvs if it has been properly prepared.
|
---|
| 578 | */
|
---|
[2543] | 579 | void _RenderPvs();
|
---|
[2609] | 580 | /** Render pvs using false colors.
|
---|
| 581 | */
|
---|
| 582 | void _RenderColoredPvs();
|
---|
[2543] | 583 |
|
---|
[2569] | 584 | float ComputeRenderCost(ViewCell *vc);
|
---|
[2543] | 585 |
|
---|
[2584] | 586 |
|
---|
[2543] | 587 | /////////
|
---|
| 588 |
|
---|
| 589 | signals:
|
---|
| 590 | void PvsUpdated();
|
---|
[1252] | 591 | };
|
---|
| 592 |
|
---|
| 593 |
|
---|
[2657] | 594 | class QtGlDebuggerWidget: public QGLWidget
|
---|
[1252] | 595 | {
|
---|
| 596 | Q_OBJECT
|
---|
| 597 | public:
|
---|
[1942] | 598 | QtGlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent = NULL);
|
---|
| 599 | ~QtGlDebuggerWidget();
|
---|
| 600 | void initializeGL();
|
---|
| 601 | void resizeGL(int w, int h);
|
---|
| 602 | void paintGL();
|
---|
| 603 | void timerEvent(QTimerEvent *) { update(); }
|
---|
| 604 | void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
|
---|
| 605 | void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
|
---|
[1252] | 606 |
|
---|
[1942] | 607 | void initCommon();
|
---|
| 608 | void initPbuffer();
|
---|
[1252] | 609 |
|
---|
[1942] | 610 |
|
---|
| 611 | QtGlRendererBuffer *mRenderBuffer;
|
---|
[1252] | 612 |
|
---|
[1942] | 613 | Beam mBeam;
|
---|
| 614 | int mSamples;
|
---|
| 615 | Intersectable *mSourceObject;
|
---|
[1252] | 616 |
|
---|
| 617 | private:
|
---|
[2543] | 618 |
|
---|
[1942] | 619 | GLuint dynamicTexture;
|
---|
| 620 | int timerId;
|
---|
[1252] | 621 | };
|
---|
| 622 |
|
---|
[2543] | 623 |
|
---|
[1252] | 624 | extern QtGlDebuggerWidget *debuggerWidget;
|
---|
| 625 |
|
---|
| 626 | };
|
---|
| 627 |
|
---|
| 628 | #endif
|
---|