NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Visualization.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, FI MUNI CZ
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the <organization> nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * Authors:
28  * Vilem Otte <vilem.otte@post.cz>
29  *
30  */
31 
36 #pragma once
37 #include "gui/Window.hpp"
38 #include "base/Array.hpp"
39 #include "3d/CameraControls.hpp"
40 #include "cuda/CudaBVH.hpp"
41 #include "cuda/CudaKDTree.hpp"
42 
43 namespace FW
44 {
45 //------------------------------------------------------------------------
46 
51 {
52 public:
53  Visualization (Scene* scene);
54  virtual ~Visualization ();
55 
61  virtual void draw (GLContext* gl, CameraControls& camera) = 0;
62 
67  bool isVisible () const { return m_visible; }
68 
73  void setVisible (bool visible) { m_visible = visible; }
74 
75 protected:
80  // Currently visible node data
81  //NodeData m_node; //!< Current node.
83  //NodeData m_sibling; //!< Sibling of the current node.
85  //NodeData m_left; //!< Left child of the current node.
88  //NodeData m_right; //!< Right child of the current node.
91  // Buffered "special" data
100  // Visualization setting
101  bool m_visible;
102  bool m_showRays;
106  bool m_showEmpty;
109 };
110 
111 }
Class for the visualization.
virtual void draw(GLContext *gl, CameraControls &camera)=0
The method used to draw the current state of visualization to the OpenGL context. ...
S32 m_currentDepth
Current node's depth information.
Buffer m_emptyLineColors
Buffer holding line colors of empty boxes as quad primitives.
virtual ~Visualization()
U32 m_nodeColor
Color of the current node.
bool m_showEmpty
Flag whether to show empty nodes.
S32 m_osahSplits[3]
Counters of the number of OSAH splits in the subtree under the set node in the x, y and z dimensions...
Buffer m_rays
Buffer holding some rays as line segments.
U32 m_leftColor
Color of the left child of the current node.
Buffer m_emptyBoxes
Buffer holding empty boxes as quad primitives.
bool m_splitColors
Flag whether to map left/right children colors based on the split type.
bool m_showAllOSAH
Flag whether to show all OSAH split nodes.
Buffer m_visTris
Buffer holding invisible selected triangles.
Declarations for the Cuda version of the BVH.
signed int S32
Definition: Defs.hpp:88
U32 m_rayColor
Color of the ray line indices.
Array< String > m_splitPath
Text representation of the VisualizationBVH::m_nodeStack path.
bool isVisible() const
Return whether the visualization renders its output.
void setVisible(bool visible)
Sets whether the visualization should be rendered or not.
unsigned int U32
Definition: Defs.hpp:85
Class holding 3d scene.
Definition: Scene.hpp:44
bool m_showRays
Flag whether to show the ray segments.
Buffer m_emptyColors
Buffer holding colors of empty boxes as quad primitives.
U32 m_rightPrims
Number of primitives in the right child of the current node.
Definitions for Cuda KDTree.
bool m_showChildren
Flag whether to show children of the current node.
Buffer m_boxes
Buffer holding selected boxes as quad primitives.
U32 m_rightColor
Color of the right child of the current node.
bool m_showCurrTris
Flag whether to show triangles of the current node.};.
U32 m_siblingColor
Color of the sibling of the current node.
bool m_visible
Flag whether to show the BVH visualization.
Visualization(Scene *scene)
U32 m_leftPrims
Number of primitives in the left child of the current node.
Array< S32 > m_visibility
Visibility of individual triangles.
Buffer m_invisTris
Buffer holding visible selected triangles.