[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 |
|
---|
[2686] | 78 |
|
---|
[2696] | 79 |
|
---|
[1252] | 80 | public:
|
---|
[2664] | 81 |
|
---|
| 82 | signals:
|
---|
| 83 | void UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &);
|
---|
[1252] | 84 | };
|
---|
| 85 |
|
---|
| 86 |
|
---|
[2657] | 87 | class QtRendererControlWidget : public QWidget
|
---|
[1252] | 88 | {
|
---|
[1942] | 89 | Q_OBJECT
|
---|
[1252] | 90 | public:
|
---|
| 91 |
|
---|
[1942] | 92 | QListWidget *mPvsErrorWidget;
|
---|
[1252] | 93 |
|
---|
[1942] | 94 | QtRendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0);
|
---|
[1252] | 95 |
|
---|
[2569] | 96 | QGroupBox *CreateVisualizationPanel(QWidget *parent);
|
---|
[2614] | 97 | QGroupBox *CreateTrafoPanel(QWidget *parent);
|
---|
[2569] | 98 |
|
---|
[1942] | 99 | public slots:
|
---|
[1252] | 100 |
|
---|
[1942] | 101 | void FocusNextPvsErrorFrame();
|
---|
[2643] | 102 | void UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &);
|
---|
[1252] | 103 |
|
---|
[2569] | 104 |
|
---|
| 105 | QGroupBox *CreateRenderCostPanel(QWidget *parent);
|
---|
[2587] | 106 | QGroupBox *CreateRayVisualizationPanel(QWidget *parent);
|
---|
[2569] | 107 |
|
---|
| 108 |
|
---|
[1942] | 109 | signals:
|
---|
[2686] | 110 |
|
---|
| 111 | void ReplayViewPoints();
|
---|
[2636] | 112 | void UpdateDynamicObjects();
|
---|
[2709] | 113 | void DeleteDynamicObject();
|
---|
[1942] | 114 | void ComputeVisibility();
|
---|
| 115 | void StopComputation();
|
---|
| 116 | void SetRandomViewPoint();
|
---|
[2584] | 117 | void StoreStatistics();
|
---|
[2643] | 118 | void ComputeGVS();
|
---|
[2703] | 119 | void NextObject();
|
---|
[1942] | 120 | void UpdateAllPvs();
|
---|
| 121 | void SetViewCellGranularity(int);
|
---|
| 122 | void SetTransferFunction(int);
|
---|
| 123 | void SetSceneCut(int);
|
---|
| 124 | void SetTopDistance(int);
|
---|
[2725] | 125 | void SetMaxRenderCost(int);
|
---|
[2562] | 126 | void SetHidingCost(int);
|
---|
[1942] | 127 | void SetVisibilityFilterSize(int);
|
---|
| 128 | void SetSpatialFilterSize(int);
|
---|
[2563] | 129 | void SetTransparency(int);
|
---|
[1252] | 130 |
|
---|
[1942] | 131 | void SetShowRays(bool);
|
---|
| 132 | void SetRenderFilter(bool);
|
---|
| 133 | void SetRenderVisibilityEstimates(bool);
|
---|
| 134 | void SetUseFilter(bool);
|
---|
| 135 | void SetUseSpatialFilter(bool);
|
---|
| 136 | void SetRenderErrors(bool);
|
---|
| 137 | void SetRenderBoxes(bool);
|
---|
| 138 | void SetShowViewCells(bool);
|
---|
| 139 | void SetShowRenderCost(bool);
|
---|
| 140 | void SetShowPvsSizes(bool);
|
---|
[2604] | 141 | void SetShowWireFrame(bool);
|
---|
[2560] | 142 | void SetShowPiercingRays(bool);
|
---|
[2566] | 143 | void SetShowWeightedRays(bool);
|
---|
[2604] | 144 | void SetShowComparison(bool);
|
---|
[2569] | 145 | void SetShowWeightedCost(bool);
|
---|
| 146 |
|
---|
[1942] | 147 | void SetTopView(bool);
|
---|
| 148 | void SetCutViewCells(bool);
|
---|
| 149 | void SetCutScene(bool);
|
---|
[2562] | 150 |
|
---|
| 151 | void SetHideByCost(bool);
|
---|
[2564] | 152 | void SetUseTransparency(bool);
|
---|
[2569] | 153 |
|
---|
| 154 | void SetShowDistanceWeightedTriangles(bool);
|
---|
| 155 | void SetShowWeightedTriangles(bool);
|
---|
| 156 | void SetShowDistanceWeightedPvs(bool);
|
---|
[2587] | 157 |
|
---|
| 158 | void UseConstColorForRayViz(bool);
|
---|
| 159 | void UseRayLengthForRayViz(bool);
|
---|
| 160 | void SetShowContribution(bool);
|
---|
| 161 | void SetShowDistribution(bool);
|
---|
[2591] | 162 |
|
---|
| 163 | void SetShowDistribution1(bool);
|
---|
| 164 | void SetShowDistribution2(bool);
|
---|
| 165 | void SetShowDistribution3(bool);
|
---|
| 166 | void SetShowDistribution4(bool);
|
---|
[2614] | 167 |
|
---|
| 168 | void SetTranslation(bool);
|
---|
| 169 | void SetRotation(bool);
|
---|
| 170 | void SetScale(bool);
|
---|
[1252] | 171 | };
|
---|
| 172 |
|
---|
[1926] | 173 |
|
---|
[2657] | 174 | class QtGlRendererWidget: public QGLWidget, public GlRendererWidget
|
---|
[1252] | 175 | {
|
---|
[2543] | 176 | Q_OBJECT
|
---|
[1252] | 177 | public:
|
---|
| 178 |
|
---|
[2543] | 179 | // point of the last mouse click used for movement in the scene
|
---|
| 180 | Vector3 mousePoint;
|
---|
[1252] | 181 |
|
---|
[2543] | 182 | bool mTopView;
|
---|
| 183 | bool mRenderViewCells;
|
---|
| 184 | bool mCutViewCells;
|
---|
| 185 | bool mCutScene;
|
---|
[2562] | 186 | bool mHideByCost;
|
---|
[2543] | 187 | bool mRenderErrors;
|
---|
| 188 | bool mRenderFilter;
|
---|
| 189 | bool mRenderVisibilityEstimates;
|
---|
| 190 | bool mUseFilter;
|
---|
| 191 | bool mUseSpatialFilter;
|
---|
| 192 | bool mShowRenderCost;
|
---|
[2560] | 193 | bool mShowPiercingRays;
|
---|
[2566] | 194 | bool mShowWeightedRays;
|
---|
[2604] | 195 | bool mUseStandardColors;
|
---|
[2543] | 196 | bool mShowRays;
|
---|
[1252] | 197 |
|
---|
[2543] | 198 | bool mShowPvsSizes;
|
---|
[2580] | 199 | bool mShowComparison;
|
---|
[2543] | 200 | float mSpatialFilterSize;
|
---|
[1252] | 201 |
|
---|
[2543] | 202 | Plane3 mSceneCutPlane;
|
---|
[2562] | 203 | float mHidingCost;
|
---|
| 204 |
|
---|
[2543] | 205 | float mTopDistance;
|
---|
[1252] | 206 |
|
---|
[2563] | 207 | float mTransparency;
|
---|
[2564] | 208 | bool mUseTransparency;
|
---|
[2563] | 209 |
|
---|
[2569] | 210 | bool mShowWeightedCost;
|
---|
| 211 |
|
---|
| 212 | bool mShowDistanceWeightedTriangles;
|
---|
| 213 | bool mShowDistanceWeightedPvs;
|
---|
| 214 | bool mShowWeightedTriangles;
|
---|
[2591] | 215 |
|
---|
| 216 | int mShowDistribution;
|
---|
[2569] | 217 |
|
---|
[2686] | 218 | bool mReplayMode;
|
---|
| 219 |
|
---|
[2543] | 220 | // some statistics
|
---|
| 221 | int mPvsSize;
|
---|
| 222 | float mRenderError;
|
---|
| 223 | float mTransferFunction;
|
---|
[1252] | 224 |
|
---|
[2566] | 225 | Vector3 mDummyViewPoint;
|
---|
| 226 |
|
---|
[2587] | 227 | int mRayVisualizationMethod;
|
---|
[2614] | 228 | int mTrafoType;
|
---|
[2587] | 229 |
|
---|
[2543] | 230 | QtRendererControlWidget *mControlWidget;
|
---|
[1252] | 231 |
|
---|
[2543] | 232 | QtPreprocessorThread *mPreprocessorThread;
|
---|
[1252] | 233 |
|
---|
[2580] | 234 | ViewCellInfoContainer mCompareInfo;
|
---|
[2576] | 235 |
|
---|
[2643] | 236 | int mCurrentPvsCost;
|
---|
| 237 |
|
---|
[2604] | 238 | bool mUseRandomColorPerPvsObject;
|
---|
[2678] | 239 |
|
---|
[2686] | 240 | int mUpdateTimerId;
|
---|
| 241 | int mReplayTimerId;
|
---|
| 242 |
|
---|
[2694] | 243 | ObjectPlacer *mPlacer;
|
---|
| 244 |
|
---|
[2709] | 245 | int mCurrentDynamicObjectIdx;
|
---|
| 246 |
|
---|
| 247 | bool mExportFrameBuffer;
|
---|
| 248 |
|
---|
[2725] | 249 | float mMaxRenderCost;
|
---|
| 250 |
|
---|
[2702] | 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 |
|
---|
[2703] | 329 | void LoadObjects();
|
---|
| 330 | void LoadObject(const std::string &filename);
|
---|
[2696] | 331 |
|
---|
[2543] | 332 | public slots:
|
---|
[2677] | 333 |
|
---|
[2686] | 334 | /** Replay the view points stored in the view points list.
|
---|
| 335 | */
|
---|
| 336 | void ReplayViewPoints();
|
---|
[2677] | 337 | void UpdateDynamicObjects();
|
---|
[2709] | 338 | void DeleteDynamicObject();
|
---|
[2543] | 339 | void UpdateAllPvs();
|
---|
| 340 | void ComputeVisibility();
|
---|
| 341 | void StopComputation();
|
---|
| 342 | void SetRandomViewPoint();
|
---|
[2584] | 343 | void StoreStatistics();
|
---|
[2643] | 344 |
|
---|
[2703] | 345 | //void LoadObject();
|
---|
| 346 | void NextObject();
|
---|
[1926] | 347 |
|
---|
[2543] | 348 | void SetRenderErrors(bool b) {
|
---|
| 349 | mRenderErrors = b;
|
---|
| 350 | updateGL();
|
---|
| 351 | }
|
---|
[1926] | 352 |
|
---|
[2643] | 353 | void ComputeGVS() {
|
---|
| 354 | mComputeGVS = true;
|
---|
| 355 | updateGL();
|
---|
| 356 | }
|
---|
| 357 |
|
---|
[2543] | 358 | void SetRenderBoxes(bool b) {
|
---|
| 359 | mRenderBoxes = b;
|
---|
| 360 | updateGL();
|
---|
| 361 | }
|
---|
[1926] | 362 |
|
---|
[2543] | 363 | void SetRenderFilter(bool b) {
|
---|
| 364 | mRenderFilter = b;
|
---|
| 365 | updateGL();
|
---|
| 366 | }
|
---|
[1926] | 367 |
|
---|
[2543] | 368 | void SetRenderVisibilityEstimates(bool b) {
|
---|
| 369 | mRenderVisibilityEstimates = b;
|
---|
| 370 | updateGL();
|
---|
| 371 | }
|
---|
[1926] | 372 |
|
---|
[2543] | 373 | void SetUseFilter(bool b) {
|
---|
| 374 | mUseFilter = b;
|
---|
| 375 | mPvsCache.Reset();
|
---|
| 376 | updateGL();
|
---|
| 377 | }
|
---|
[1926] | 378 |
|
---|
[2543] | 379 | void SetUseSpatialFilter(bool b) {
|
---|
| 380 | mUseSpatialFilter = b;
|
---|
| 381 | mPvsCache.Reset();
|
---|
| 382 | updateGL();
|
---|
| 383 | }
|
---|
[1926] | 384 |
|
---|
[1942] | 385 |
|
---|
[2543] | 386 | void
|
---|
| 387 | SetViewCellGranularity(int number);
|
---|
[1942] | 388 |
|
---|
[2543] | 389 | void SetTransferFunction(int number)
|
---|
| 390 | {
|
---|
| 391 | mTransferFunction = number/1000.0f;
|
---|
| 392 | updateGL();
|
---|
| 393 | }
|
---|
[2538] | 394 |
|
---|
[2543] | 395 | void SetVisibilityFilterSize(int number);
|
---|
[2538] | 396 |
|
---|
[2543] | 397 | void
|
---|
| 398 | SetSpatialFilterSize(int number);
|
---|
| 399 |
|
---|
| 400 | void
|
---|
| 401 | SetSceneCut(int cut);
|
---|
| 402 |
|
---|
| 403 | void
|
---|
| 404 | SetTopDistance(int dist);
|
---|
| 405 |
|
---|
[2562] | 406 | void
|
---|
[2725] | 407 | SetMaxRenderCost(int dist);
|
---|
| 408 |
|
---|
| 409 | void
|
---|
[2563] | 410 | SetTransparency(int dist);
|
---|
| 411 |
|
---|
| 412 | void
|
---|
[2562] | 413 | SetHidingCost(int dist);
|
---|
| 414 |
|
---|
[2543] | 415 | void SetShowViewCells(bool b) {
|
---|
| 416 | mRenderViewCells = b;
|
---|
| 417 | updateGL();
|
---|
| 418 | }
|
---|
| 419 |
|
---|
| 420 | void SetShowRays(bool b) {
|
---|
| 421 | mShowRays = b;
|
---|
| 422 | updateGL();
|
---|
| 423 | }
|
---|
| 424 |
|
---|
| 425 | void SetShowRenderCost(bool b) {
|
---|
| 426 | mShowRenderCost = b;
|
---|
| 427 | updateGL();
|
---|
| 428 | }
|
---|
| 429 |
|
---|
| 430 | void SetShowPvsSizes(bool b) {
|
---|
| 431 | mShowPvsSizes = b;
|
---|
| 432 | updateGL();
|
---|
| 433 | }
|
---|
| 434 |
|
---|
[2580] | 435 | void SetShowComparison(bool b) {
|
---|
| 436 | mShowComparison = b;
|
---|
| 437 | updateGL();
|
---|
| 438 | }
|
---|
| 439 |
|
---|
[2560] | 440 | void SetShowPiercingRays(bool b) {
|
---|
| 441 | mShowPiercingRays = b;
|
---|
| 442 | updateGL();
|
---|
| 443 | }
|
---|
| 444 |
|
---|
[2604] | 445 | void SetShowWireFrame(bool b) {
|
---|
| 446 | mUseStandardColors = b;
|
---|
| 447 | updateGL();
|
---|
| 448 | }
|
---|
| 449 |
|
---|
| 450 |
|
---|
[2566] | 451 | void SetShowWeightedRays(bool b) {
|
---|
| 452 | mShowWeightedRays = b;
|
---|
| 453 | updateGL();
|
---|
| 454 | }
|
---|
| 455 |
|
---|
[2543] | 456 | void SetTopView(bool b) {
|
---|
| 457 | mTopView = b;
|
---|
| 458 | updateGL();
|
---|
| 459 | }
|
---|
| 460 |
|
---|
| 461 | void SetCutViewCells(bool b) {
|
---|
| 462 | mCutViewCells = b;
|
---|
| 463 | updateGL();
|
---|
| 464 | }
|
---|
| 465 | void SetCutScene(bool b) {
|
---|
| 466 | mCutScene = b;
|
---|
| 467 | updateGL();
|
---|
| 468 | }
|
---|
| 469 |
|
---|
[2562] | 470 | void SetHideByCost(bool b) {
|
---|
| 471 | mHideByCost = b;
|
---|
| 472 | updateGL();
|
---|
| 473 | }
|
---|
| 474 |
|
---|
[2564] | 475 | void SetUseTransparency(bool b) {
|
---|
| 476 | mUseTransparency = b;
|
---|
| 477 | updateGL();
|
---|
| 478 | }
|
---|
| 479 |
|
---|
[2569] | 480 | void SetShowWeightedCost(bool b)
|
---|
| 481 | {
|
---|
| 482 | mShowWeightedCost = b;
|
---|
| 483 | updateGL();
|
---|
| 484 | }
|
---|
| 485 |
|
---|
| 486 | void SetShowDistanceWeightedPvs(bool b)
|
---|
| 487 | {
|
---|
| 488 | mShowDistanceWeightedPvs = b;
|
---|
| 489 | updateGL();
|
---|
| 490 | }
|
---|
| 491 |
|
---|
| 492 |
|
---|
| 493 | void SetShowDistanceWeightedTriangles(bool b)
|
---|
| 494 | {
|
---|
| 495 | mShowDistanceWeightedTriangles = b;
|
---|
| 496 | updateGL();
|
---|
| 497 | }
|
---|
| 498 |
|
---|
| 499 | void SetShowWeightedTriangles(bool b)
|
---|
| 500 | {
|
---|
| 501 | mShowWeightedTriangles = b;
|
---|
| 502 | updateGL();
|
---|
| 503 | }
|
---|
| 504 |
|
---|
[2587] | 505 | void UseConstColorForRayViz(bool b)
|
---|
| 506 | {
|
---|
| 507 | mRayVisualizationMethod = 0;
|
---|
| 508 | }
|
---|
| 509 |
|
---|
| 510 | void UseRayLengthForRayViz(bool b)
|
---|
| 511 | {
|
---|
| 512 | mRayVisualizationMethod = 1;
|
---|
| 513 | }
|
---|
[2569] | 514 |
|
---|
[2587] | 515 | void SetShowContribution(bool b)
|
---|
| 516 | {
|
---|
| 517 | mRayVisualizationMethod = 2;
|
---|
| 518 | }
|
---|
| 519 |
|
---|
| 520 | void SetShowDistribution(bool b)
|
---|
| 521 | {
|
---|
| 522 | mRayVisualizationMethod = 3;
|
---|
| 523 | }
|
---|
[2614] | 524 |
|
---|
| 525 | void SetTranslation(bool b)
|
---|
| 526 | {
|
---|
| 527 | mTrafoType = 0;
|
---|
| 528 | }
|
---|
| 529 |
|
---|
| 530 | void SetScale(bool b)
|
---|
| 531 | {
|
---|
| 532 | mTrafoType = 1;
|
---|
| 533 | }
|
---|
[2591] | 534 |
|
---|
[2614] | 535 | void SetRotation(bool b)
|
---|
| 536 | {
|
---|
| 537 | mTrafoType = 2;
|
---|
| 538 | }
|
---|
| 539 |
|
---|
[2591] | 540 | void SetShowDistribution1(bool b)
|
---|
| 541 | {
|
---|
| 542 | if (b)
|
---|
| 543 | mShowDistribution |= 1;
|
---|
| 544 | else
|
---|
| 545 | mShowDistribution ^= 1;
|
---|
[2587] | 546 |
|
---|
[2677] | 547 | std::cout << "b: "
|
---|
| 548 | << (mShowDistribution & 1) << " "
|
---|
| 549 | << (mShowDistribution & 2) << " "
|
---|
| 550 | << (mShowDistribution & 4) << " "
|
---|
| 551 | << (mShowDistribution & 8) << std::endl;
|
---|
[2591] | 552 | }
|
---|
[2587] | 553 |
|
---|
[2591] | 554 |
|
---|
| 555 | void SetShowDistribution2(bool b)
|
---|
| 556 | {
|
---|
| 557 | if (b)
|
---|
| 558 | mShowDistribution |= 2;
|
---|
| 559 | else
|
---|
| 560 | mShowDistribution ^= 2;
|
---|
| 561 | }
|
---|
| 562 |
|
---|
| 563 |
|
---|
| 564 | void SetShowDistribution3(bool b)
|
---|
| 565 | {
|
---|
| 566 | if (b)
|
---|
| 567 | mShowDistribution |= 4;
|
---|
| 568 | else
|
---|
| 569 | mShowDistribution ^= 4;
|
---|
| 570 | }
|
---|
| 571 |
|
---|
| 572 | void SetShowDistribution4(bool b)
|
---|
| 573 | {
|
---|
| 574 | if (b)
|
---|
| 575 | mShowDistribution |= 8;
|
---|
| 576 | else
|
---|
| 577 | mShowDistribution ^= 8;
|
---|
| 578 | }
|
---|
| 579 |
|
---|
[2686] | 580 |
|
---|
[2670] | 581 | /** Prepare pvs for rendering.
|
---|
| 582 | */
|
---|
| 583 | virtual void PreparePvs(const ObjectPvs &pvs);
|
---|
| 584 | /** Internal method rendering the pvs if it has been properly prepared.
|
---|
| 585 | */
|
---|
[2543] | 586 | void _RenderPvs();
|
---|
| 587 |
|
---|
[2569] | 588 | float ComputeRenderCost(ViewCell *vc);
|
---|
[2543] | 589 |
|
---|
[2584] | 590 |
|
---|
[2543] | 591 | /////////
|
---|
| 592 |
|
---|
| 593 | signals:
|
---|
| 594 | void PvsUpdated();
|
---|
[1252] | 595 | };
|
---|
| 596 |
|
---|
| 597 |
|
---|
[2657] | 598 | class QtGlDebuggerWidget: public QGLWidget
|
---|
[1252] | 599 | {
|
---|
| 600 | Q_OBJECT
|
---|
| 601 | public:
|
---|
[1942] | 602 | QtGlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent = NULL);
|
---|
| 603 | ~QtGlDebuggerWidget();
|
---|
| 604 | void initializeGL();
|
---|
| 605 | void resizeGL(int w, int h);
|
---|
| 606 | void paintGL();
|
---|
| 607 | void timerEvent(QTimerEvent *) { update(); }
|
---|
| 608 | void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
|
---|
| 609 | void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
|
---|
[1252] | 610 |
|
---|
[1942] | 611 | void initCommon();
|
---|
| 612 | void initPbuffer();
|
---|
[1252] | 613 |
|
---|
[1942] | 614 |
|
---|
| 615 | QtGlRendererBuffer *mRenderBuffer;
|
---|
[1252] | 616 |
|
---|
[1942] | 617 | Beam mBeam;
|
---|
| 618 | int mSamples;
|
---|
| 619 | Intersectable *mSourceObject;
|
---|
[1252] | 620 |
|
---|
| 621 | private:
|
---|
[2543] | 622 |
|
---|
[1942] | 623 | GLuint dynamicTexture;
|
---|
| 624 | int timerId;
|
---|
[1252] | 625 | };
|
---|
| 626 |
|
---|
[2543] | 627 |
|
---|
[1252] | 628 | extern QtGlDebuggerWidget *debuggerWidget;
|
---|
| 629 |
|
---|
| 630 | };
|
---|
| 631 |
|
---|
| 632 | #endif
|
---|