[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();
|
---|
[2703] | 121 | void NextObject();
|
---|
[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 |
|
---|
[2686] | 219 | bool mReplayMode;
|
---|
| 220 |
|
---|
[2543] | 221 | // some statistics
|
---|
| 222 | int mPvsSize;
|
---|
| 223 | float mRenderError;
|
---|
| 224 | float mTransferFunction;
|
---|
[1252] | 225 |
|
---|
[2566] | 226 | Vector3 mDummyViewPoint;
|
---|
| 227 |
|
---|
[2587] | 228 | int mRayVisualizationMethod;
|
---|
[2614] | 229 | int mTrafoType;
|
---|
[2587] | 230 |
|
---|
[2543] | 231 | QtRendererControlWidget *mControlWidget;
|
---|
[1252] | 232 |
|
---|
[2543] | 233 | QtPreprocessorThread *mPreprocessorThread;
|
---|
[1252] | 234 |
|
---|
[2580] | 235 | ViewCellInfoContainer mCompareInfo;
|
---|
[2576] | 236 |
|
---|
[2643] | 237 | int mCurrentPvsCost;
|
---|
| 238 |
|
---|
[2604] | 239 | vector<RgbColor> mColors;
|
---|
| 240 |
|
---|
| 241 | bool mUseRandomColorPerPvsObject;
|
---|
[2678] | 242 |
|
---|
[2686] | 243 | int mUpdateTimerId;
|
---|
| 244 | int mReplayTimerId;
|
---|
| 245 |
|
---|
[2694] | 246 | ObjectPlacer *mPlacer;
|
---|
| 247 |
|
---|
[2702] | 248 | //DynamicObjectsContainer mPendingDynamicObjects;
|
---|
| 249 | DynamicObjectsContainer mDynamicPvsObjects;
|
---|
[2696] | 250 |
|
---|
[2543] | 251 | QtGlRendererWidget(SceneGraph *sceneGraph,
|
---|
[2580] | 252 | ViewCellsManager *viewcells,
|
---|
| 253 | KdTree *tree,
|
---|
| 254 | QWidget * parent = 0,
|
---|
| 255 | const QGLWidget *shareWidget = 0,
|
---|
| 256 | Qt::WFlags f = 0);
|
---|
[1997] | 257 |
|
---|
[2543] | 258 | QtGlRendererWidget() {};
|
---|
[1252] | 259 |
|
---|
[2695] | 260 | ~QtGlRendererWidget();
|
---|
[2694] | 261 |
|
---|
[2584] | 262 | void SetThread(QtPreprocessorThread *t)
|
---|
| 263 | {
|
---|
[2543] | 264 | mPreprocessorThread = t;
|
---|
| 265 | }
|
---|
[2695] | 266 |
|
---|
[2576] | 267 | void RenderRenderCost();
|
---|
[1252] | 268 |
|
---|
[2543] | 269 | virtual void SetupCamera();
|
---|
[1252] | 270 |
|
---|
[2695] | 271 | void initializeGL()
|
---|
| 272 | {
|
---|
[2543] | 273 | InitGL();
|
---|
| 274 | }
|
---|
[1252] | 275 |
|
---|
[2543] | 276 | virtual void InitGL();
|
---|
[1252] | 277 |
|
---|
[2543] | 278 | void resizeGL(int w, int h);
|
---|
| 279 | void paintGL();
|
---|
| 280 | void timerEvent(QTimerEvent *event);
|
---|
| 281 | void mousePressEvent(QMouseEvent *);
|
---|
| 282 | void mouseReleaseEvent(QMouseEvent *);
|
---|
| 283 | void mouseMoveEvent(QMouseEvent *);
|
---|
[1252] | 284 |
|
---|
[2543] | 285 | void keyPressEvent(QKeyEvent * e);
|
---|
[1252] | 286 |
|
---|
[2670] | 287 | void VisualizePvs();
|
---|
[1252] | 288 |
|
---|
[2543] | 289 | float RenderErrors();
|
---|
| 290 | void RenderInfo();
|
---|
[1252] | 291 |
|
---|
[2543] | 292 | virtual int GetWidth() const { return width(); }
|
---|
| 293 | virtual int GetHeight() const { return height(); }
|
---|
[1252] | 294 |
|
---|
[2686] | 295 | virtual void SetupCameraProjection(const int w,
|
---|
| 296 | const int h,
|
---|
| 297 | const float angle = 70.0f);
|
---|
[2538] | 298 |
|
---|
[2609] | 299 | void RenderViewCells();
|
---|
[1252] | 300 |
|
---|
[2609] | 301 | virtual void Show() { show(); }
|
---|
[1252] | 302 |
|
---|
[2543] | 303 | bool PvsChanged(ViewCell *viewcell) const;
|
---|
[1252] | 304 |
|
---|
[2576] | 305 | void ComputeMaxValues(const ViewCellContainer &viewCells,
|
---|
| 306 | int &maxPvs,
|
---|
| 307 | int &maxPiercingRays,
|
---|
| 308 | float &maxRelativeRays,
|
---|
| 309 | float &maxRcCost);
|
---|
| 310 |
|
---|
| 311 | void AssignImportanceByRelativeValue(const ViewCellContainer &viewCells,
|
---|
| 312 | int &maxPvs,
|
---|
| 313 | int &maxPiercingRays,
|
---|
| 314 | float &maxRelativeRays,
|
---|
| 315 | float &maxRcCost);
|
---|
| 316 |
|
---|
| 317 | void AssignColorByComparison(const ViewCellContainer &viewcells,
|
---|
[2580] | 318 | const ViewCellInfoContainer &compareInfo);
|
---|
[2576] | 319 |
|
---|
[2584] | 320 | void WriteViewCellInfos();
|
---|
[2693] | 321 | /** Unproject x/y screen coordinates.
|
---|
| 322 | */
|
---|
| 323 | Vector3 Unproject(int x, int y);
|
---|
[2686] | 324 |
|
---|
[2702] | 325 | int FindDynamicObject(float x, float y);
|
---|
[2584] | 326 |
|
---|
[2703] | 327 | void LoadObjects();
|
---|
| 328 | void LoadObject(const std::string &filename);
|
---|
[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 |
|
---|
[2703] | 342 | //void LoadObject();
|
---|
| 343 | void NextObject();
|
---|
[1926] | 344 |
|
---|
[2543] | 345 | void SetRenderErrors(bool b) {
|
---|
| 346 | mRenderErrors = b;
|
---|
| 347 | updateGL();
|
---|
| 348 | }
|
---|
[1926] | 349 |
|
---|
[2643] | 350 | void ComputeGVS() {
|
---|
| 351 | mComputeGVS = true;
|
---|
| 352 | updateGL();
|
---|
| 353 | }
|
---|
| 354 |
|
---|
[2543] | 355 | void SetRenderBoxes(bool b) {
|
---|
| 356 | mRenderBoxes = b;
|
---|
| 357 | updateGL();
|
---|
| 358 | }
|
---|
[1926] | 359 |
|
---|
[2543] | 360 | void SetRenderFilter(bool b) {
|
---|
| 361 | mRenderFilter = b;
|
---|
| 362 | updateGL();
|
---|
| 363 | }
|
---|
[1926] | 364 |
|
---|
[2543] | 365 | void SetRenderVisibilityEstimates(bool b) {
|
---|
| 366 | mRenderVisibilityEstimates = b;
|
---|
| 367 | updateGL();
|
---|
| 368 | }
|
---|
[1926] | 369 |
|
---|
[2543] | 370 | void SetUseFilter(bool b) {
|
---|
| 371 | mUseFilter = b;
|
---|
| 372 | mPvsCache.Reset();
|
---|
| 373 | updateGL();
|
---|
| 374 | }
|
---|
[1926] | 375 |
|
---|
[2543] | 376 | void SetUseSpatialFilter(bool b) {
|
---|
| 377 | mUseSpatialFilter = b;
|
---|
| 378 | mPvsCache.Reset();
|
---|
| 379 | updateGL();
|
---|
| 380 | }
|
---|
[1926] | 381 |
|
---|
[1942] | 382 |
|
---|
[2543] | 383 | void
|
---|
| 384 | SetViewCellGranularity(int number);
|
---|
[1942] | 385 |
|
---|
[2543] | 386 | void SetTransferFunction(int number)
|
---|
| 387 | {
|
---|
| 388 | mTransferFunction = number/1000.0f;
|
---|
| 389 | updateGL();
|
---|
| 390 | }
|
---|
[2538] | 391 |
|
---|
[2543] | 392 | void SetVisibilityFilterSize(int number);
|
---|
[2538] | 393 |
|
---|
[2543] | 394 | void
|
---|
| 395 | SetSpatialFilterSize(int number);
|
---|
| 396 |
|
---|
| 397 | void
|
---|
| 398 | SetSceneCut(int cut);
|
---|
| 399 |
|
---|
| 400 | void
|
---|
| 401 | SetTopDistance(int dist);
|
---|
| 402 |
|
---|
[2562] | 403 | void
|
---|
[2563] | 404 | SetTransparency(int dist);
|
---|
| 405 |
|
---|
| 406 | void
|
---|
[2562] | 407 | SetHidingCost(int dist);
|
---|
| 408 |
|
---|
[2543] | 409 | void SetShowViewCells(bool b) {
|
---|
| 410 | mRenderViewCells = b;
|
---|
| 411 | updateGL();
|
---|
| 412 | }
|
---|
| 413 |
|
---|
| 414 | void SetShowRays(bool b) {
|
---|
| 415 | mShowRays = b;
|
---|
| 416 | updateGL();
|
---|
| 417 | }
|
---|
| 418 |
|
---|
| 419 | void SetShowRenderCost(bool b) {
|
---|
| 420 | mShowRenderCost = b;
|
---|
| 421 | updateGL();
|
---|
| 422 | }
|
---|
| 423 |
|
---|
| 424 | void SetShowPvsSizes(bool b) {
|
---|
| 425 | mShowPvsSizes = b;
|
---|
| 426 | updateGL();
|
---|
| 427 | }
|
---|
| 428 |
|
---|
[2580] | 429 | void SetShowComparison(bool b) {
|
---|
| 430 | mShowComparison = b;
|
---|
| 431 | updateGL();
|
---|
| 432 | }
|
---|
| 433 |
|
---|
[2560] | 434 | void SetShowPiercingRays(bool b) {
|
---|
| 435 | mShowPiercingRays = b;
|
---|
| 436 | updateGL();
|
---|
| 437 | }
|
---|
| 438 |
|
---|
[2604] | 439 | void SetShowWireFrame(bool b) {
|
---|
| 440 | mUseStandardColors = b;
|
---|
| 441 | updateGL();
|
---|
| 442 | }
|
---|
| 443 |
|
---|
| 444 |
|
---|
[2566] | 445 | void SetShowWeightedRays(bool b) {
|
---|
| 446 | mShowWeightedRays = b;
|
---|
| 447 | updateGL();
|
---|
| 448 | }
|
---|
| 449 |
|
---|
[2543] | 450 | void SetTopView(bool b) {
|
---|
| 451 | mTopView = b;
|
---|
| 452 | updateGL();
|
---|
| 453 | }
|
---|
| 454 |
|
---|
| 455 | void SetCutViewCells(bool b) {
|
---|
| 456 | mCutViewCells = b;
|
---|
| 457 | updateGL();
|
---|
| 458 | }
|
---|
| 459 | void SetCutScene(bool b) {
|
---|
| 460 | mCutScene = b;
|
---|
| 461 | updateGL();
|
---|
| 462 | }
|
---|
| 463 |
|
---|
[2562] | 464 | void SetHideByCost(bool b) {
|
---|
| 465 | mHideByCost = b;
|
---|
| 466 | updateGL();
|
---|
| 467 | }
|
---|
| 468 |
|
---|
[2564] | 469 | void SetUseTransparency(bool b) {
|
---|
| 470 | mUseTransparency = b;
|
---|
| 471 | updateGL();
|
---|
| 472 | }
|
---|
| 473 |
|
---|
[2569] | 474 | void SetShowWeightedCost(bool b)
|
---|
| 475 | {
|
---|
| 476 | mShowWeightedCost = b;
|
---|
| 477 | updateGL();
|
---|
| 478 | }
|
---|
| 479 |
|
---|
| 480 | void SetShowDistanceWeightedPvs(bool b)
|
---|
| 481 | {
|
---|
| 482 | mShowDistanceWeightedPvs = b;
|
---|
| 483 | updateGL();
|
---|
| 484 | }
|
---|
| 485 |
|
---|
| 486 |
|
---|
| 487 | void SetShowDistanceWeightedTriangles(bool b)
|
---|
| 488 | {
|
---|
| 489 | mShowDistanceWeightedTriangles = b;
|
---|
| 490 | updateGL();
|
---|
| 491 | }
|
---|
| 492 |
|
---|
| 493 | void SetShowWeightedTriangles(bool b)
|
---|
| 494 | {
|
---|
| 495 | mShowWeightedTriangles = b;
|
---|
| 496 | updateGL();
|
---|
| 497 | }
|
---|
| 498 |
|
---|
[2587] | 499 | void UseConstColorForRayViz(bool b)
|
---|
| 500 | {
|
---|
| 501 | mRayVisualizationMethod = 0;
|
---|
| 502 | }
|
---|
| 503 |
|
---|
| 504 | void UseRayLengthForRayViz(bool b)
|
---|
| 505 | {
|
---|
| 506 | mRayVisualizationMethod = 1;
|
---|
| 507 | }
|
---|
[2569] | 508 |
|
---|
[2587] | 509 | void SetShowContribution(bool b)
|
---|
| 510 | {
|
---|
| 511 | mRayVisualizationMethod = 2;
|
---|
| 512 | }
|
---|
| 513 |
|
---|
| 514 | void SetShowDistribution(bool b)
|
---|
| 515 | {
|
---|
| 516 | mRayVisualizationMethod = 3;
|
---|
| 517 | }
|
---|
[2614] | 518 |
|
---|
| 519 | void SetTranslation(bool b)
|
---|
| 520 | {
|
---|
| 521 | mTrafoType = 0;
|
---|
| 522 | }
|
---|
| 523 |
|
---|
| 524 | void SetScale(bool b)
|
---|
| 525 | {
|
---|
| 526 | mTrafoType = 1;
|
---|
| 527 | }
|
---|
[2591] | 528 |
|
---|
[2614] | 529 | void SetRotation(bool b)
|
---|
| 530 | {
|
---|
| 531 | mTrafoType = 2;
|
---|
| 532 | }
|
---|
| 533 |
|
---|
[2591] | 534 | void SetShowDistribution1(bool b)
|
---|
| 535 | {
|
---|
| 536 | if (b)
|
---|
| 537 | mShowDistribution |= 1;
|
---|
| 538 | else
|
---|
| 539 | mShowDistribution ^= 1;
|
---|
[2587] | 540 |
|
---|
[2677] | 541 | std::cout << "b: "
|
---|
| 542 | << (mShowDistribution & 1) << " "
|
---|
| 543 | << (mShowDistribution & 2) << " "
|
---|
| 544 | << (mShowDistribution & 4) << " "
|
---|
| 545 | << (mShowDistribution & 8) << std::endl;
|
---|
[2591] | 546 | }
|
---|
[2587] | 547 |
|
---|
[2591] | 548 |
|
---|
| 549 | void SetShowDistribution2(bool b)
|
---|
| 550 | {
|
---|
| 551 | if (b)
|
---|
| 552 | mShowDistribution |= 2;
|
---|
| 553 | else
|
---|
| 554 | mShowDistribution ^= 2;
|
---|
| 555 | }
|
---|
| 556 |
|
---|
| 557 |
|
---|
| 558 | void SetShowDistribution3(bool b)
|
---|
| 559 | {
|
---|
| 560 | if (b)
|
---|
| 561 | mShowDistribution |= 4;
|
---|
| 562 | else
|
---|
| 563 | mShowDistribution ^= 4;
|
---|
| 564 | }
|
---|
| 565 |
|
---|
| 566 | void SetShowDistribution4(bool b)
|
---|
| 567 | {
|
---|
| 568 | if (b)
|
---|
| 569 | mShowDistribution |= 8;
|
---|
| 570 | else
|
---|
| 571 | mShowDistribution ^= 8;
|
---|
| 572 | }
|
---|
| 573 |
|
---|
[2686] | 574 |
|
---|
[2670] | 575 | /** Prepare pvs for rendering.
|
---|
| 576 | */
|
---|
| 577 | virtual void PreparePvs(const ObjectPvs &pvs);
|
---|
| 578 | /** Internal method rendering the pvs if it has been properly prepared.
|
---|
| 579 | */
|
---|
[2543] | 580 | void _RenderPvs();
|
---|
[2609] | 581 | /** Render pvs using false colors.
|
---|
| 582 | */
|
---|
| 583 | void _RenderColoredPvs();
|
---|
[2543] | 584 |
|
---|
[2569] | 585 | float ComputeRenderCost(ViewCell *vc);
|
---|
[2543] | 586 |
|
---|
[2584] | 587 |
|
---|
[2543] | 588 | /////////
|
---|
| 589 |
|
---|
| 590 | signals:
|
---|
| 591 | void PvsUpdated();
|
---|
[1252] | 592 | };
|
---|
| 593 |
|
---|
| 594 |
|
---|
[2657] | 595 | class QtGlDebuggerWidget: public QGLWidget
|
---|
[1252] | 596 | {
|
---|
| 597 | Q_OBJECT
|
---|
| 598 | public:
|
---|
[1942] | 599 | QtGlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent = NULL);
|
---|
| 600 | ~QtGlDebuggerWidget();
|
---|
| 601 | void initializeGL();
|
---|
| 602 | void resizeGL(int w, int h);
|
---|
| 603 | void paintGL();
|
---|
| 604 | void timerEvent(QTimerEvent *) { update(); }
|
---|
| 605 | void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
|
---|
| 606 | void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
|
---|
[1252] | 607 |
|
---|
[1942] | 608 | void initCommon();
|
---|
| 609 | void initPbuffer();
|
---|
[1252] | 610 |
|
---|
[1942] | 611 |
|
---|
| 612 | QtGlRendererBuffer *mRenderBuffer;
|
---|
[1252] | 613 |
|
---|
[1942] | 614 | Beam mBeam;
|
---|
| 615 | int mSamples;
|
---|
| 616 | Intersectable *mSourceObject;
|
---|
[1252] | 617 |
|
---|
| 618 | private:
|
---|
[2543] | 619 |
|
---|
[1942] | 620 | GLuint dynamicTexture;
|
---|
| 621 | int timerId;
|
---|
[1252] | 622 | };
|
---|
| 623 |
|
---|
[2543] | 624 |
|
---|
[1252] | 625 | extern QtGlDebuggerWidget *debuggerWidget;
|
---|
| 626 |
|
---|
| 627 | };
|
---|
| 628 |
|
---|
| 629 | #endif
|
---|