├── Doxyfile ├── LICENSE ├── OpenVDBViewer.pro ├── README.md ├── include ├── AMDDefines.h ├── AboutWindow.h ├── BoundBox.h ├── Camera.h ├── CoreGLDefines.h ├── GLWindow.h ├── Grid.h ├── InformationWindow.h ├── MainWindow.h ├── NVidiaDefines.h ├── Plane.h ├── Shader.h ├── ShaderFamily.h ├── ShaderLibrary.h ├── Types.h ├── Utilities.h ├── VAO.h ├── VDB.h └── coregl │ ├── gl_core_3_2.h │ ├── gl_core_4_2.h │ ├── gl_core_4_3.h │ └── gl_core_4_4.h ├── manual └── openvdb_viewer_manual.pdf ├── qrc_ovdbv_resources.cpp ├── res ├── ovdbv.icns ├── ovdbv.iconset │ ├── icon_128x128.png │ ├── icon_128x128@2x.png │ ├── icon_16x16.png │ ├── icon_16x16@2x.png │ ├── icon_256x256.png │ ├── icon_256x256@2x.png │ ├── icon_32x32.png │ ├── icon_32x32@2x.png │ ├── icon_512x512.png │ └── icon_512x512@2x.png └── ovdbv_resources.qrc ├── shaders ├── VectorColourCropGeometry.glsl ├── VectorColourCropVertex.glsl ├── VectorColourFragment.glsl ├── VectorColourGeometry.glsl ├── VectorColourVertex.glsl ├── colourFragment.glsl ├── colourMapCropVertex.glsl ├── colourMapFragment.glsl ├── colourMapVertex.glsl ├── colourVertex.glsl ├── normalCropVertex.glsl ├── normalFragment.glsl ├── normalVertex.glsl ├── vdbTreeFragment.glsl └── vdbTreeVertex.glsl ├── src ├── AMDDefines.cpp ├── AboutWindow.cpp ├── BoundBox.cpp ├── Camera.cpp ├── GLWindow.cpp ├── Grid.cpp ├── InformationWindow.cpp ├── MainWindow.cpp ├── NVidiaDefines.cpp ├── Plane.cpp ├── Shader.cpp ├── ShaderFamily.cpp ├── ShaderLibrary.cpp ├── Utilities.cpp ├── VAO.cpp ├── VDB.cpp ├── coregl │ ├── gl_core_3_2.c │ ├── gl_core_4_2.c │ ├── gl_core_4_3.c │ └── gl_core_4_4.c └── main.cpp └── ui ├── AboutWindow.ui ├── Information.cpp ├── Information.h ├── Information.ui ├── MWindow.cpp ├── MWindow.h ├── MWindow.ui ├── ui_AboutWindow.h ├── ui_Information.h └── ui_MWindow.h /Doxyfile: -------------------------------------------------------------------------------- 1 | # Doxyfile 1.7.1 2 | 3 | #--------------------------------------------------------------------------- 4 | # Project related configuration options 5 | #--------------------------------------------------------------------------- 6 | DOXYFILE_ENCODING = UTF-8 7 | PROJECT_NAME = OpenVDB Viewer - OpenGL 8 | PROJECT_NUMBER = 1.0 9 | OUTPUT_DIRECTORY = Docs/ 10 | CREATE_SUBDIRS = YES 11 | OUTPUT_LANGUAGE = English 12 | BRIEF_MEMBER_DESC = YES 13 | REPEAT_BRIEF = YES 14 | ABBREVIATE_BRIEF = 15 | ALWAYS_DETAILED_SEC = NO 16 | INLINE_INHERITED_MEMB = NO 17 | FULL_PATH_NAMES = YES 18 | STRIP_FROM_PATH = 19 | STRIP_FROM_INC_PATH = 20 | SHORT_NAMES = NO 21 | JAVADOC_AUTOBRIEF = NO 22 | QT_AUTOBRIEF = NO 23 | MULTILINE_CPP_IS_BRIEF = NO 24 | INHERIT_DOCS = YES 25 | SEPARATE_MEMBER_PAGES = NO 26 | TAB_SIZE = 8 27 | ALIASES = 28 | OPTIMIZE_OUTPUT_FOR_C = NO 29 | OPTIMIZE_OUTPUT_JAVA = NO 30 | OPTIMIZE_FOR_FORTRAN = NO 31 | OPTIMIZE_OUTPUT_VHDL = NO 32 | EXTENSION_MAPPING = 33 | BUILTIN_STL_SUPPORT = NO 34 | CPP_CLI_SUPPORT = NO 35 | SIP_SUPPORT = NO 36 | IDL_PROPERTY_SUPPORT = YES 37 | DISTRIBUTE_GROUP_DOC = NO 38 | SUBGROUPING = YES 39 | TYPEDEF_HIDES_STRUCT = NO 40 | SYMBOL_CACHE_SIZE = 0 41 | #--------------------------------------------------------------------------- 42 | # Build related configuration options 43 | #--------------------------------------------------------------------------- 44 | EXTRACT_ALL = YES 45 | EXTRACT_PRIVATE = NO 46 | EXTRACT_STATIC = NO 47 | EXTRACT_LOCAL_CLASSES = YES 48 | EXTRACT_LOCAL_METHODS = NO 49 | EXTRACT_ANON_NSPACES = NO 50 | HIDE_UNDOC_MEMBERS = NO 51 | HIDE_UNDOC_CLASSES = NO 52 | HIDE_FRIEND_COMPOUNDS = NO 53 | HIDE_IN_BODY_DOCS = NO 54 | INTERNAL_DOCS = NO 55 | CASE_SENSE_NAMES = NO 56 | HIDE_SCOPE_NAMES = NO 57 | SHOW_INCLUDE_FILES = YES 58 | INLINE_INFO = YES 59 | SORT_MEMBER_DOCS = YES 60 | SORT_BRIEF_DOCS = NO 61 | SORT_MEMBERS_CTORS_1ST = NO 62 | SORT_GROUP_NAMES = NO 63 | SORT_BY_SCOPE_NAME = NO 64 | GENERATE_TODOLIST = YES 65 | GENERATE_TESTLIST = YES 66 | GENERATE_BUGLIST = YES 67 | GENERATE_DEPRECATEDLIST= YES 68 | ENABLED_SECTIONS = 69 | MAX_INITIALIZER_LINES = 30 70 | SHOW_USED_FILES = YES 71 | SHOW_DIRECTORIES = NO 72 | SHOW_FILES = YES 73 | SHOW_NAMESPACES = YES 74 | FILE_VERSION_FILTER = 75 | LAYOUT_FILE = 76 | #--------------------------------------------------------------------------- 77 | # configuration options related to warning and progress messages 78 | #--------------------------------------------------------------------------- 79 | QUIET = NO 80 | WARNINGS = YES 81 | WARN_IF_UNDOCUMENTED = YES 82 | WARN_IF_DOC_ERROR = YES 83 | WARN_NO_PARAMDOC = NO 84 | WARN_FORMAT = "$file:$line: $text" 85 | WARN_LOGFILE = 86 | #--------------------------------------------------------------------------- 87 | # configuration options related to the input files 88 | #--------------------------------------------------------------------------- 89 | INPUT = ./src \ 90 | ./include \ 91 | ./shaders 92 | INPUT_ENCODING = UTF-8 93 | FILE_PATTERNS = *.cpp \ 94 | *.h \ 95 | *.glsl 96 | 97 | RECURSIVE = YES 98 | EXCLUDE = 99 | EXCLUDE_SYMLINKS = NO 100 | EXCLUDE_PATTERNS = 101 | EXCLUDE_SYMBOLS = 102 | EXAMPLE_PATH = 103 | EXAMPLE_PATTERNS = 104 | EXAMPLE_RECURSIVE = NO 105 | IMAGE_PATH = 106 | INPUT_FILTER = 107 | FILTER_PATTERNS = 108 | FILTER_SOURCE_FILES = NO 109 | #--------------------------------------------------------------------------- 110 | # configuration options related to source browsing 111 | #--------------------------------------------------------------------------- 112 | SOURCE_BROWSER = NO 113 | INLINE_SOURCES = NO 114 | STRIP_CODE_COMMENTS = YES 115 | REFERENCED_BY_RELATION = NO 116 | REFERENCES_RELATION = NO 117 | REFERENCES_LINK_SOURCE = YES 118 | USE_HTAGS = NO 119 | VERBATIM_HEADERS = YES 120 | #--------------------------------------------------------------------------- 121 | # configuration options related to the alphabetical class index 122 | #--------------------------------------------------------------------------- 123 | ALPHABETICAL_INDEX = YES 124 | COLS_IN_ALPHA_INDEX = 5 125 | IGNORE_PREFIX = 126 | #--------------------------------------------------------------------------- 127 | # configuration options related to the HTML output 128 | #--------------------------------------------------------------------------- 129 | GENERATE_HTML = YES 130 | HTML_OUTPUT = html 131 | HTML_FILE_EXTENSION = .html 132 | HTML_HEADER = 133 | HTML_FOOTER = 134 | HTML_STYLESHEET = 135 | HTML_TIMESTAMP = YES 136 | HTML_ALIGN_MEMBERS = YES 137 | HTML_DYNAMIC_SECTIONS = NO 138 | GENERATE_DOCSET = NO 139 | DOCSET_FEEDNAME = "Doxygen generated docs" 140 | DOCSET_BUNDLE_ID = OpenVDBViewer 141 | GENERATE_HTMLHELP = NO 142 | CHM_FILE = 143 | HHC_LOCATION = 144 | GENERATE_CHI = NO 145 | CHM_INDEX_ENCODING = 146 | BINARY_TOC = NO 147 | TOC_EXPAND = NO 148 | GENERATE_QHP = NO 149 | QCH_FILE = 150 | QHP_NAMESPACE = org.doxygen.Project 151 | QHP_VIRTUAL_FOLDER = doc 152 | QHP_CUST_FILTER_NAME = 153 | QHP_CUST_FILTER_ATTRS = 154 | QHP_SECT_FILTER_ATTRS = 155 | QHG_LOCATION = 156 | DISABLE_INDEX = NO 157 | ENUM_VALUES_PER_LINE = 4 158 | GENERATE_TREEVIEW = NO 159 | USE_INLINE_TREES = NO 160 | TREEVIEW_WIDTH = 250 161 | FORMULA_FONTSIZE = 10 162 | SEARCHENGINE = YES 163 | #--------------------------------------------------------------------------- 164 | # configuration options related to the LaTeX output 165 | #--------------------------------------------------------------------------- 166 | GENERATE_LATEX = NO 167 | LATEX_OUTPUT = latex 168 | LATEX_CMD_NAME = latex 169 | MAKEINDEX_CMD_NAME = makeindex 170 | COMPACT_LATEX = NO 171 | PAPER_TYPE = a4wide 172 | EXTRA_PACKAGES = 173 | LATEX_HEADER = 174 | PDF_HYPERLINKS = YES 175 | USE_PDFLATEX = YES 176 | LATEX_BATCHMODE = NO 177 | LATEX_HIDE_INDICES = NO 178 | LATEX_SOURCE_CODE = NO 179 | #--------------------------------------------------------------------------- 180 | # configuration options related to the RTF output 181 | #--------------------------------------------------------------------------- 182 | GENERATE_RTF = NO 183 | RTF_OUTPUT = rtf 184 | COMPACT_RTF = NO 185 | RTF_HYPERLINKS = NO 186 | RTF_STYLESHEET_FILE = 187 | RTF_EXTENSIONS_FILE = 188 | #--------------------------------------------------------------------------- 189 | # configuration options related to the man page output 190 | #--------------------------------------------------------------------------- 191 | GENERATE_MAN = NO 192 | MAN_OUTPUT = man 193 | MAN_EXTENSION = .3 194 | MAN_LINKS = NO 195 | #--------------------------------------------------------------------------- 196 | # configuration options related to the XML output 197 | #--------------------------------------------------------------------------- 198 | GENERATE_XML = NO 199 | XML_OUTPUT = xml 200 | XML_SCHEMA = 201 | XML_DTD = 202 | XML_PROGRAMLISTING = YES 203 | #--------------------------------------------------------------------------- 204 | # configuration options for the AutoGen Definitions output 205 | #--------------------------------------------------------------------------- 206 | GENERATE_AUTOGEN_DEF = NO 207 | #--------------------------------------------------------------------------- 208 | # configuration options related to the Perl module output 209 | #--------------------------------------------------------------------------- 210 | GENERATE_PERLMOD = NO 211 | PERLMOD_LATEX = NO 212 | PERLMOD_PRETTY = YES 213 | PERLMOD_MAKEVAR_PREFIX = 214 | #--------------------------------------------------------------------------- 215 | # Configuration options related to the preprocessor 216 | #--------------------------------------------------------------------------- 217 | ENABLE_PREPROCESSING = YES 218 | MACRO_EXPANSION = NO 219 | EXPAND_ONLY_PREDEF = NO 220 | SEARCH_INCLUDES = YES 221 | INCLUDE_PATH = 222 | INCLUDE_FILE_PATTERNS = 223 | PREDEFINED = 224 | EXPAND_AS_DEFINED = 225 | SKIP_FUNCTION_MACROS = YES 226 | #--------------------------------------------------------------------------- 227 | # Configuration::additions related to external references 228 | #--------------------------------------------------------------------------- 229 | TAGFILES = 230 | GENERATE_TAGFILE = 231 | ALLEXTERNALS = NO 232 | EXTERNAL_GROUPS = YES 233 | PERL_PATH = /usr/bin/perl 234 | #--------------------------------------------------------------------------- 235 | # Configuration options related to the dot tool 236 | #--------------------------------------------------------------------------- 237 | CLASS_DIAGRAMS = YES 238 | MSCGEN_PATH = 239 | HIDE_UNDOC_RELATIONS = YES 240 | HAVE_DOT = NO 241 | DOT_FONTNAME = FreeSans.ttf 242 | DOT_FONTSIZE = 10 243 | DOT_FONTPATH = YEs 244 | CLASS_GRAPH = YES 245 | COLLABORATION_GRAPH = YES 246 | GROUP_GRAPHS = YES 247 | UML_LOOK = YES 248 | TEMPLATE_RELATIONS = NO 249 | INCLUDE_GRAPH = YES 250 | INCLUDED_BY_GRAPH = YES 251 | CALL_GRAPH = YES 252 | CALLER_GRAPH = YES 253 | GRAPHICAL_HIERARCHY = YES 254 | DIRECTORY_GRAPH = YES 255 | DOT_IMAGE_FORMAT = png 256 | DOT_PATH = 257 | DOTFILE_DIRS = 258 | DOT_GRAPH_MAX_NODES = 50 259 | MAX_DOT_GRAPH_DEPTH = 0 260 | DOT_TRANSPARENT = NO 261 | DOT_MULTI_TARGETS = NO 262 | GENERATE_LEGEND = YES 263 | DOT_CLEANUP = YES 264 | -------------------------------------------------------------------------------- /OpenVDBViewer.pro: -------------------------------------------------------------------------------- 1 | ###################################################################################################### 2 | # AUTOFIND will attempt to automatically locate the correct headers and libraries needed 3 | # by looking at the default most common folder for the required headers and libraries. 4 | # Set to 1 if you wish to use this or set to 0 to use the paths declared below 5 | AUTOFIND = 0 6 | ###################################################################################################### 7 | # DEBUG, if set to 1, will print out some more information about the workings of the application 8 | # and file as it runs. If set to 0, the application will be much quieter when running 9 | DEBUG = 0 10 | ###################################################################################################### 11 | # USE_EXT_GPU will tell the application if it is using an external device or onboard chipset. 12 | # Whilst it will make no differnce to the working of the application, it will change defines 13 | # used and enable/disable device query functions used within the application. 14 | # Currently the only supported external device is NVidia (automatically defined by this). This will 15 | # need to be changed in the future to be able to detect the hardware itself. Even though query support 16 | # is only available for NVidia devices, this application will work fine on all other device hardware 17 | USE_EXT_GPU = 1 18 | ###################################################################################################### 19 | 20 | ###################################################################################################### 21 | # The following path defines are the locations of the required headers and libraries for this 22 | # application. These paths will be used if AUTOFIND is set to 0. 23 | ###################################################################################################### 24 | # Set the root include path for the OpenVDB header files 25 | # normally {__path__}/openvdb 26 | OPENVDB_INC_PATH = /usr/local/OpenVDB/include 27 | # Set the library path where the openvdb library can be found 28 | OPENVDB_LIB_PATH = /usr/local/OpenVDB/lib 29 | ###################################################################################################### 30 | # Set the root include path for the tbb header files 31 | # Make sure you set the path one above the root folder as this application will look for headers 32 | # (through the OpenVDB library) in the following fashion 33 | # #include 34 | # So if your tbb headers are found in /usr/local/include/tbb, set the below value as /usr/local/include 35 | TBB_INC_PATH = /usr/local/include 36 | # Set the library path for the tbb library (required by the OpenVDB library) 37 | TBB_LIB_PATH = /usr/local/lib 38 | ###################################################################################################### 39 | # Set the include path for the Half header files 40 | HALF_INC_PATH = /usr/local/include 41 | #Set the path to where the libHalf library is located 42 | HALF_LIB_PATH = /usr/local/lib 43 | ###################################################################################################### 44 | # Set the root include path for the boost header files 45 | # Make sure you set the path one above the root folder as this application will look for headers 46 | # in the following fashion 47 | # #include 48 | # So if your boost headers are found in /usr/local/include/boost, set the below value as /usr/local/include 49 | BOOST_INC_DIR = /usr/local/include 50 | ###################################################################################################### 51 | 52 | TARGET=OpenVDBViewer 53 | 54 | MOC_DIR=moc 55 | OBJECTS_DIR = obj 56 | 57 | CONFIG+=x86_64 58 | UI_HEADERS_DIR=ui 59 | UI_DIR=ui 60 | QT+= gui opengl core 61 | 62 | INC_DIR = include 63 | SRC_DIR = src 64 | SHADER_DIR = shaders 65 | FORM_DIR = ui 66 | RESOURCE_DIR = res 67 | 68 | # this define must be changed to AMD if not using NVidia cards or drivers 69 | # I am setting a define on Linux and Windows here as for me it is only Linux machines I use that 70 | # have NVIDIA drivers, my Mac platform does not 71 | isEqual(USE_EXT_GPU,1){ 72 | DEFINES += EXT_GPU 73 | DEFINES += NVIDIA 74 | } 75 | 76 | isEqual(DEBUG,0){ 77 | DEFINES += RELEASE 78 | } 79 | isEqual(DEBUG,1){ 80 | DEFINES += DEBUG 81 | } 82 | 83 | # NOW REQUIRES BOOST TO BE INSTALLED AND INCLUDED IN THE INCLUDE PATH 84 | 85 | INCLUDEPATH +=. include include/coregl ui 86 | 87 | # set include paths dependant on the values set at the top of this .pro 88 | isEqual(AUTOFIND, 0){ 89 | INCLUDEPATH += $$OPENVDB_INC_PATH $$TBB_INC_PATH $$HALF_INC_PATH $$BOOST_INC_DIR 90 | } 91 | isEqual(AUTOFIND,1){ 92 | unix:!macx{ 93 | # include for boost - i think this is right but may have to change 94 | INCLUDEPATH += /usr/include 95 | INCLUDEPATH += /usr/local/include 96 | INCLUDEPATH += /usr/local/include/openvdb 97 | } 98 | macx:{ 99 | INCLUDEPATH += /usr/local/include 100 | } 101 | } 102 | 103 | macx:{ 104 | DEFINES += DARWIN 105 | LIBS += -framework OpenGL 106 | } 107 | unix:!macx{ 108 | DEFINES += LINUX 109 | LIBS += -lGL -lGLEW 110 | } 111 | 112 | QMAKE_CXXFLAGS_WARN_ON += "-Wno-unused-parameter" 113 | QMAKE_CXXFLAGS+= -msse -msse2 -msse3 114 | macx:QMAKE_CXXFLAGS+= -arch x86_64 115 | 116 | USEGL=42 117 | 118 | isEqual(USEGL, 44){ 119 | DEFINES+=GL44 120 | } 121 | isEqual(USEGL, 43){ 122 | DEFINES+=GL43 123 | } 124 | isEqual(USEGL, 42){ 125 | DEFINES+=GL42 126 | } 127 | isEqual(USEGL, 32){ 128 | DEFINES+=GL32 129 | } 130 | 131 | isEqual(AUTOFIND,0){ 132 | # set library paths dependant on values set above 133 | LIBS += -L$$OPENVDB_LIB_PATH -lopenvdb 134 | LIBS += -L$$HALF_LIB_PATH -lHalf 135 | LIBS += -L$$TBB_LIB_PATH -ltbb 136 | } 137 | isEqual(AUTOFIND,1){ 138 | unix:!macx{ 139 | LIBS += -L/usr/local/lib -lopenvdb -ltbb -lHalf 140 | } 141 | macx:{ 142 | LIBS += -L/usr/local/lib -lopenvdb 143 | LIBS += -L/usr/local/lib -lHalf -ltbb 144 | } 145 | } 146 | 147 | macx:{ 148 | # add frameworks required 149 | LIBS += -framework Cocoa 150 | } 151 | 152 | HEADERS+= $$INC_DIR/Shader.h \ 153 | $$INC_DIR/ShaderFamily.h \ 154 | $$INC_DIR/ShaderLibrary.h \ 155 | $$INC_DIR/GLWindow.h \ 156 | $$INC_DIR/Camera.h \ 157 | $$INC_DIR/Plane.h \ 158 | $$INC_DIR/Utilities.h \ 159 | $$INC_DIR/VAO.h \ 160 | $$INC_DIR/BoundBox.h \ 161 | $$INC_DIR/Types.h \ 162 | $$INC_DIR/Grid.h \ 163 | $$INC_DIR/VDB.h \ 164 | $$INC_DIR/NVidiaDefines.h \ 165 | $$INC_DIR/AMDDefines.h \ 166 | $$INC_DIR/MainWindow.h \ 167 | $$INC_DIR/InformationWindow.h \ 168 | $$INC_DIR/AboutWindow.h \ 169 | $$FORM_DIR/MWindow.h \ 170 | $$FORM_DIR/Information.h \ 171 | $$FORM_DIR/ui_MWindow.h \ 172 | $$FORM_DIR/ui_Information.h 173 | 174 | SOURCES += $$SRC_DIR/main.cpp \ 175 | $$SRC_DIR/Shader.cpp \ 176 | $$SRC_DIR/ShaderFamily.cpp \ 177 | $$SRC_DIR/ShaderLibrary.cpp \ 178 | $$SRC_DIR/GLWindow.cpp \ 179 | $$SRC_DIR/Camera.cpp \ 180 | $$SRC_DIR/Plane.cpp \ 181 | $$SRC_DIR/Utilities.cpp \ 182 | $$SRC_DIR/VAO.cpp \ 183 | $$SRC_DIR/BoundBox.cpp \ 184 | $$SRC_DIR/Grid.cpp \ 185 | $$SRC_DIR/VDB.cpp \ 186 | $$SRC_DIR/NVidiaDefines.cpp \ 187 | $$SRC_DIR/AMDDefines.cpp \ 188 | $$SRC_DIR/MainWindow.cpp \ 189 | $$SRC_DIR/InformationWindow.cpp \ 190 | $$SRC_DIR/AboutWindow.cpp \ 191 | $$FORM_DIR/MWindow.cpp \ 192 | $$FORM_DIR/Information.cpp 193 | 194 | OTHER_FILES += $$SHADER_DIR/normalVertex.glsl \ 195 | $$SHADER_DIR/normalFragment.glsl \ 196 | $$SHADER_DIR/normalCropVertex.glsl \ 197 | $$SHADER_DIR/colourVertex.glsl \ 198 | $$SHADER_DIR/colourFragment.glsl \ 199 | $$SHADER_DIR/colourMapVertex.glsl \ 200 | $$SHADER_DIR/colourMapCropVertex.glsl \ 201 | $$SHADER_DIR/colourMapFragment.glsl \ 202 | $$SHADER_DIR/VectorColourVertex.glsl \ 203 | $$SHADER_DIR/VectorColourGeometry.glsl \ 204 | $$SHADER_DIR/VectorColourCropVertex.glsl \ 205 | $$SHADER_DIR/VectorColourCropGeometry.glsl \ 206 | $$SHADER_DIR/VectorColourFragment.glsl \ 207 | $$SHADER_DIR/vdbTreeVertex.glsl \ 208 | $$SHADER_DIR/vdbTreeFragment.glsl 209 | FORMS += $$FORM_DIR/MWindow.ui \ 210 | $$FORM_DIR/Information.ui \ 211 | $$FORM_DIR/AboutWindow.ui 212 | 213 | macx:{ 214 | ICON_DIR = res/ovdbv.iconset 215 | 216 | ICONS += $$ICON_DIR/icon_16x16.png \ 217 | $$ICON_DIR/icon_16x16@2x.png \ 218 | $$ICON_DIR/icon_32x32.png \ 219 | $$ICON_DIR/icon_32x32@2x.png \ 220 | $$ICON_DIR/icon_128x128.png \ 221 | $$ICON_DIR/icon_128x128@2x.png \ 222 | $$ICON_DIR/icon_256x256.png \ 223 | $$ICON_DIR/icon_256x256@2x.png \ 224 | $$ICON_DIR/icon_512x512.png \ 225 | $$ICON_DIR/icon_512x512@2x.png 226 | 227 | APP_ICONS.path = Contents/$$ICON_DIR 228 | APP_ICONS.files += $$ICONS 229 | 230 | APP_SHADERS.path = Contents/Resources/shaders 231 | APP_SHADERS.files += $$OTHER_FILES 232 | 233 | QMAKE_BUNDLE_DATA += APP_SHADERS \ 234 | APP_ICONS 235 | } 236 | 237 | RESOURCES += $$RESOURCE_DIR/ovdbv_resources.qrc 238 | 239 | macx:ICON = res/ovdbv.icns 240 | 241 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OpenVDB Viewer - OpenGL 2 | version 1.0.0 3 | Callum James 2014 4 | 5 | ######################################################################################## 6 | 1. About OpenVDB Viewer - OpenGL 7 | 8 | This application is used to open and view VDB files associated with the OpenVDB 9 | library. Once open, a selection of tools can be used to visualise different 10 | aspects of the file in different ways. This tools is used to inspect and analyse the 11 | data within the file to help find problem areas or just find out how the data is stored. 12 | All VDB files are supported, although larger files can run into problems with hardware 13 | limitations dependant on the hardware you are using. 14 | 15 | OpenVDB Viewer has been built on OpenGL and GLSL and is compatible on OpenGL versions 16 | 4.0 and up - the same with GLSL. 17 | 18 | Currently, the OpenVDB Viewer builds and runs on MacOSX 10.9 Mavericks and Linux. 19 | Windows support has not been implemented but is one of the future development tracks. 20 | 21 | ######################################################################################## 22 | 2. Application Requirements 23 | 24 | There are a few dependencies needed to build and run the OpenVDB Viewer. These are 25 | listed below: 26 | 27 | -OpenVDB (http://www.openvdb.org/download/) 28 | -Qt 5.0 or later (for the UI) (http://qt-project.org/downloads) 29 | -TBB (https://www.threadingbuildingblocks.org/download) 30 | -OpenEXR/ ILMBase (http://www.openexr.com/downloads.html) 31 | -Boost (http://sourceforge.net/projects/boost/files/boost/1.55.0/) 32 | 33 | Once installed, the locations of these can be specified in the .pro file (explained 34 | below). 35 | 36 | On MacOSX you will also need to ensure you have the OpenGL framework installed. 37 | 38 | ######################################################################################## 39 | 3. Making the Application 40 | 41 | To make the application, you first need to tell it where headers and libraries of its 42 | dependancies are. There are two ways in which you can do this within the .pro file. 43 | 44 | At the top of the .pro file there are a few options you can set. The first one is 45 | AUTOFIND. This needs the value of either 0 or 1. IF set to 1, when building it will 46 | attempt to find the headers and libraries itself by looking in the most common default 47 | locations. In this case, the paths it will search are: 48 | 49 | Linux: 50 | Headers: 51 | /usr/include 52 | /usr/local/include 53 | /usr/local/include/openvdb 54 | Libraries: 55 | /usr/local/lib 56 | MacOSX: 57 | Headers: 58 | /usr/local/include 59 | Libraries: 60 | /usr/local/lib 61 | 62 | If your distributions of any of the dependencies in 2 are not in these locations, you 63 | will need to specify where they are. To do this, at the top of the .pro file, set the 64 | following variables: 65 | 66 | OPENVDB_INC_PATH - root directory for the OpenVDB headers 67 | OPENVDB_LIB_PATH - directory where libopenvdb is located 68 | 69 | TBB_INC_PATH - root directory for the tbb headers 70 | TBB_LIB_PATH - directory where the libtbb library is located 71 | 72 | HALF_INC_PATH - root directory for Half.h 73 | HALF_LIB_PATH - directory where libHalf is located 74 | 75 | BOOST_INC_DIR - root directory for the Boost headers 76 | 77 | The DEBUG option is default to 0. However if set to 1, the applicatio will print out 78 | more information about its processing as it goes along if you are interested. To 79 | enable this, set this option to 1, else leave it as 0. 80 | 81 | The other option you can set is the USE_EXT_GPU. Once set to 1, the application will 82 | attempt to query an external device on its memory. Currently this only works on NVIDIA 83 | cards. Therefore only set this to 1 if you have an external NVIDIA card attached and 84 | in use. If you do have this, set this to 0. The only functionality it will lose is the 85 | ability to query the total and currently used GPU memory and display in the UI. 86 | 87 | Once these have all been set, run in the directory: 88 | 89 | qmake 90 | make 91 | 92 | Once built, dependant on your platform, run the appropriate application (either 93 | executable on Linux or .app on MacOSX) 94 | 95 | ######################################################################################## 96 | 4. Quick Use Guide 97 | 98 | This is a very brief description of how to use the application. If you want a more 99 | detailed manual with diagrams (pretty pictures!), please refer to the Manual included 100 | within the Docs folder. 101 | 102 | Use the File->Open action to select and open a VDB file. Once selected, a dialog will 103 | ask you if you wish to load high resolution or not. If No, only the VDB tree and 104 | information will be loaded and loading times will be quicker with less memory 105 | consumption. If Yes is selected, the high resolution data will be loaded as well as 106 | the VDB tree and information. This will take slightly longer (dependant on the number of 107 | channels in the file) and will take more GPU and CPU memory. 108 | 109 | Once open, you can use the options on the right to toggle attributes and manipulate 110 | the data. For example to toggle the high resolution volume, use the 'Show High Resolution' 111 | check box. To select the channel to render use the drop down box below this. 112 | 113 | To rotate the volume, on the render window, left click and drag. To rotate the camera, 114 | on the render window, hold Alt and left click and drag. To translate the volume, 115 | on the render window, right click and drag. To zoom in and out, on the render window, 116 | scroll the mouse wheel up and down. 117 | 118 | To change the level of detail, use the slider at the bottom of the render tab. 119 | 120 | Rendering the channels as a vector can be achieved from the channels tab at the bottom. 121 | 122 | Colour ramps can be applied through the channels tab. 123 | 124 | Culling can be applied through the Cull tab. Up to three culls can be applied at any 125 | one time and the type of these culls selected with their corresponding drop down 126 | selections. 127 | 128 | The crop tab can be used to apply up to three crop boxes to the volume. 129 | 130 | To display information about the file loaded and the hardware being used, either use 131 | the Information menu item or click the Show Information button on the render tab. 132 | 133 | ######################################################################################## 134 | 5. Some Useful Quick Shortcuts 135 | 136 | There are a few useful shortcuts implemented into the application to make use easier. 137 | In the following list, the shortcuts specified are for Linux and MacOSX respectively: 138 | 139 | Mouse click and drag - rotate the volume 140 | Alt+Mouse click and drag - rotate the camera 141 | Ctrl+O/cmd+O - Open a file 142 | Ctrl+Shift+C/cmd+Shift+C - Clear the scene 143 | Esc/cmd+Q - Quit application 144 | Del/Del - Remove high resolution mesh if loaded 145 | Ctrl+R/cmd+R - Reset Volume transform 146 | R/R - Reset scene (volume transform and camera) 147 | Shift+R/Shift+R - Reset Camera 148 | 149 | ######################################################################################## 150 | -------------------------------------------------------------------------------- /include/AMDDefines.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __AMDDEFINES_H__ 20 | #define __AMDDEFINES_H__ 21 | 22 | /// @file AMDDefines.h 23 | /// @brief Functions that utilise AMD devices to query information about them 24 | /// @author Callum James 25 | /// @version 1.0 26 | /// @date 12/02/2014 27 | /// Revision History: 28 | /// Initial Version 05/01/2014 29 | 30 | #ifdef DARWIN 31 | #include 32 | #include 33 | #else 34 | #include 35 | #endif 36 | 37 | /* 38 | I am missing some defines here but as I do not have an AMD device to test on 39 | I do not know which defines should be here or what includes 40 | This will have the same functionality as the NVidia defines to allow the return of information 41 | on the current state of the GPU memory. 42 | I will also eventually need to write one of these to cope with all different card and OpenGL vendors 43 | */ 44 | 45 | namespace AMDDef 46 | { 47 | //int totalGPUMemKB(); 48 | //int usedGPUMemKB(); 49 | } 50 | 51 | #endif /* __AMDDEFINES_H__ */ 52 | -------------------------------------------------------------------------------- /include/AboutWindow.h: -------------------------------------------------------------------------------- 1 | #ifndef __ABOUTWINDOW_H__ 2 | #define __ABOUTWINDOW_H__ 3 | 4 | #include 5 | 6 | /// @file AboutWindow.h 7 | /// @brief About Window to give some development information and contact information 8 | /// @author Callum James 9 | /// @version 1.0 10 | /// @class AboutWindow 11 | /// @date 05/07/2014 12 | /// Revision History: 13 | /// Initial Version 05/07/2014 14 | 15 | namespace Ui 16 | { 17 | class AboutWindow; 18 | } 19 | 20 | class MainWindow; 21 | 22 | class AboutWindow : public QDialog 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | /// @brief ctr 28 | /// @param [in] parent QWidget* - the parent widget 29 | explicit AboutWindow(QWidget *parent = 0); 30 | /// @brief dtr 31 | ~AboutWindow(); 32 | /// @brief function to initialise the window and connect any signals to the correct slots 33 | void connectAndInit(); 34 | /// @brief function to set the parent window for this window 35 | /// @param [in] _parent MainWindow* - the parent main window 36 | void setParentWindow(MainWindow* _parent); 37 | 38 | private: 39 | /// @brief The UI object for the window 40 | Ui::AboutWindow *m_ui; 41 | /// @brief MainWindow pointer to the main window of this window 42 | MainWindow *m_parentWindow; 43 | /// @brief Boolean of whether or not the parent window has been set 44 | bool m_parentWindowConnected; 45 | }; 46 | 47 | #endif /* __ABOUTWINDOW_H__ */ 48 | -------------------------------------------------------------------------------- /include/Camera.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Jon Macey 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __CAMERA_H__ 20 | #define __CAMERA_H__ 21 | 22 | /* 23 | * This class has been taken from the Camera class of Jon Maceys NGL 24 | * A few modifications have been made to make it reliable only on GL and OpenVDB libraries 25 | * http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib 26 | */ 27 | 28 | #include 29 | #include "Plane.h" 30 | 31 | // camera enums used for intersects with frustrum taken from Jon Maceys NGL 32 | // http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib/ 33 | /// @enum CAMERAINTERCEPT 34 | enum CAMERAINTERCEPT {OUTSIDE, INTERSECT, INSIDE}; 35 | 36 | /// @file Camera.h 37 | /// @class Camera 38 | /// @brief simple camera class to allow movement in an opengl scene. 39 | /// a lot of this stuff is from the HILL book Computer Graphics with OpenGL 2nd Ed Prentice Hall 40 | /// a very good book 41 | /// fustrum culling modified from http://www.lighthouse3d.com/opengl/viewfrustum/index.php?defvf 42 | /// @author Jonathan Macey 43 | /// Modified by Callum James to work with pure OpenGL and OpenVDB math libraries as well as removing features 44 | /// and functions not used in this application 45 | /// @version 5.0 46 | /// @date 47 | /// Last Update added fustrum calculation 48 | /// Revision History : \n 49 | /// 27/08/08 Added experimental projection modes 50 | /// 28/09/09 Updated to NCCA Coding standard \n 51 | /// @todo Finish off the different projections modes at present persp and ortho work 52 | class Camera 53 | { 54 | public: 55 | /// @brief Constructor for Camera class 56 | Camera(); 57 | /// @brief Constructor for Camera class 58 | /// @param [in] _eye openvdb::Vec3f - position of the camera 59 | /// @param [in] _look openvdb::Vec3f - vector position for the camera to look at 60 | /// @param [in] _up openvdb::Vec3f - up vector for orientation 61 | Camera(openvdb::Vec3f _eye, openvdb::Vec3f _look, openvdb::Vec3f _up); 62 | 63 | /// @brief Set a default camera 64 | void setDefaultCamera(); 65 | 66 | /// @brief Roll the camera (around Z) 67 | /// @param [in] _angle float - angle to rotate by 68 | void roll(float _angle); 69 | /// @brief Pitch the camera (around X) 70 | /// @param [in] _angle float - angle to rotate by 71 | void pitch(float _angle); 72 | /// @brief Apply yaw to the camera (around Y) 73 | /// @param [in] _angle float - angle to rotate by 74 | void yaw(float _angle); 75 | /// @brief Slide the camera 76 | /// @param [in] _du float - amount to change in U 77 | /// @param [in] _dv float - amount to change in V 78 | /// @param [in] _dn float - amount to change in N 79 | void slide(float _du, float _dv, float _dn); 80 | 81 | /// @brief Set camera 82 | /// @param [in] _eye openvdb::Vec3f - position of the camera 83 | /// @param [in] _look openvdb::Vec3f - vector position for the camera to look at 84 | /// @param [in] _up openvdb::Vec3f - up vector for orientation 85 | void set(const openvdb::Vec3f &_eye, const openvdb::Vec3f &_look, const openvdb::Vec3f &_up); 86 | /// @brief Method to set the camera frustrums shape 87 | /// @param [in] _viewAngle float - viewing angle for the camera (FOV) 88 | /// @param [in] _aspect float - viewing aspect ratio of the camera 89 | /// @param [in] _near float - near clipping plane distance 90 | /// @param [in] _far float - far clipping plane distance 91 | void setShape(float _viewAngle, float _aspect, float _near, float _far); 92 | 93 | /// @brief Method to set aspect ratio 94 | /// @param _asp float - value to set aspect ratio to 95 | void setAspect(float _asp); 96 | 97 | /// @brief Moves both the camera and eye 98 | /// @param _dx float - amount to move in x 99 | /// @param _dy float - amount to move in y 100 | /// @param _dz float - amount to move in z 101 | void moveBoth(float _dx, float _dy, float _dz); 102 | /// @brief Move both camera and eye 103 | /// @param _move openvdb::Vec3f - vector to move by 104 | void moveBoth(openvdb::Vec3f _move); 105 | /// @brief Tranlsate the eye position 106 | /// @param _dx float - amount to move in x 107 | /// @param _dy float - amount to move in y 108 | /// @param _dz float - amount to move in z 109 | void moveEye(float _dx, float _dy, float _dz); 110 | /// @brief Tranlsate the look position 111 | /// @param _dx float - amount to move in x 112 | /// @param _dy float - amount to move in y 113 | /// @param _dz float - amount to move in z 114 | void moveLook(float _dx, float _dy, float _dz); 115 | /// @brief Set the viewing angle (FOV) 116 | /// @param [in] _angle float - viewing angle 117 | void setViewAngle(float _angle); 118 | /// @brief Update the camera 119 | void update(); 120 | 121 | /// @brief Set the eye position (camera position) 122 | /// @param _e openvdb::Vec4f - position to set eye to 123 | void setEye(openvdb::Vec4f _e); 124 | /// @brief Set the look position 125 | /// @param _e openvdb::Vec4f - position to set look to 126 | void setLook(openvdb::Vec4f _e); 127 | 128 | /// @brief Return the view matrix - returns openvdb::Mat4s 129 | inline openvdb::Mat4s getViewMatrix() {return m_viewMatrix;} 130 | /// @brief Return the projection matrix - returns openvdb::Mat4s 131 | inline openvdb::Mat4s getProjectionMatrix() {return m_projectionMatrix;} 132 | /// @brief Return the view*projection matrix - returns openvdb::Mat4s 133 | inline openvdb::Mat4s getViewProjectionMatrix() {return m_viewMatrix*m_projectionMatrix;} 134 | /// @brief Return the eye position - returns openvdb::Vec4f 135 | inline openvdb::Vec4f getEye() {return m_eye;} 136 | /// @brief Return the look position - returns openvdb::Vec4f 137 | inline openvdb::Vec4f getLook() {return m_look;} 138 | /// @brief Return U - returns openvdb::Vec4f 139 | inline openvdb::Vec4f getU() {return m_u;} 140 | /// @brief Return V - returns openvdb::Vec4f 141 | inline openvdb::Vec4f getV() {return m_v;} 142 | /// @brief Return N - returns openvdb::Vec4f 143 | inline openvdb::Vec4f getN() {return m_n;} 144 | /// @brief Return the Field of View - returns float 145 | inline float getFOV() {return m_FOV;} 146 | /// @brief Return the aspect ratio - returns float 147 | inline float getAspect() {return m_aspect;} 148 | /// @brief Return the near clipping distance - returns float 149 | inline float getNear() {return m_nearPlane;} 150 | /// @brief Return the Far clipping distance - returns float 151 | inline float getFar() {return m_farPlane;} 152 | 153 | /// @brief Set far clipping distance 154 | /// @param [in] _far float - far clipping distance 155 | inline void setFarPlane(float _far) {m_farPlane = _far;} 156 | /// @brief Set near clipping distance 157 | /// @param [in] _near float - near clipping distance 158 | inline void setNearPlane(float _near) {m_nearPlane = _near;} 159 | 160 | /// @brief Calculate the camera frustrum 161 | void calculateFrustum(); 162 | 163 | /// @brief Calculate if point is in frustrum or not - returns CAMERAINTERCEPT (Jon Macey NGL http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib/) 164 | /// @param [in] _p openvdb::Vec3f - point to evaluate 165 | // CAMERAINTERCEPT from Jon Maceys NGL http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib/ 166 | CAMERAINTERCEPT isPointInFrustum(openvdb::Vec3f &_p); 167 | 168 | protected: 169 | /// @brief Calculate perspective projection 170 | void setPerspProjection(); 171 | /// @brief Calculate new rotation vectors for the camera after a roll, pitch or yaw 172 | /// @param [in,out] io_a the first vector to be rotated 173 | /// @param [in,out] io_b the second vector to be rotated 174 | /// @param [in] _angle the angle to rotate 175 | void rotAxes(openvdb::Vec4f io_a, openvdb::Vec4f io_b, float _angle); 176 | 177 | private: 178 | /// @brief Vector U for local Camera coordinates 179 | openvdb::Vec4f m_u; 180 | /// @brief Vector V for local Camera coordinates 181 | openvdb::Vec4f m_v; 182 | /// @brief Vector N for local Camera coordinates 183 | openvdb::Vec4f m_n; 184 | /// @brief Eye position vector 185 | openvdb::Vec4f m_eye; 186 | /// @brief Look position vector 187 | openvdb::Vec4f m_look; 188 | /// @brief Up vector 189 | openvdb::Vec4f m_up; 190 | 191 | /// @brief Width of display images used for perspective projection 192 | float m_width; 193 | /// @brief Height of display images used for perspective projection 194 | float m_height; 195 | /// @brief Aspect ratio of camera 196 | float m_aspect; 197 | /// @brief Near clipping plane distance 198 | float m_nearPlane; 199 | /// @brief Far clipping plane distance 200 | float m_farPlane; 201 | /// @brief Field of View of camera 202 | float m_FOV; 203 | 204 | /// @brief Array of 6 plasnes making up the camera frustrum 205 | Plane m_planes[6]; 206 | 207 | // taken from Jon Maceys NGL 208 | // http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib/ 209 | /// @enum PROJPLANE 210 | enum PROJPLANE { TOP = 0,BOTTOM,LEFT,RIGHT,NEARP,FARP}; 211 | /// @brief index values for the planes array 212 | openvdb::Vec3f m_ntl,m_ntr,m_nbl,m_nbr,m_ftl,m_ftr,m_fbl,m_fbr; 213 | 214 | /// @brief Projection matrix of the camera 215 | openvdb::Mat4s m_projectionMatrix; 216 | /// @brief View matrix of the camera 217 | openvdb::Mat4s m_viewMatrix; 218 | 219 | /// @brief Method to set the view matrix 220 | void setViewMatrix(); 221 | /// @brief Method to set the projection matrix 222 | void setProjectionMatrix(); 223 | }; 224 | 225 | #endif /* __CAMERA_H__ */ 226 | -------------------------------------------------------------------------------- /include/CoreGLDefines.h: -------------------------------------------------------------------------------- 1 | #ifndef COREGLDEFINES_H 2 | #define COREGLDEFINES_H 3 | 4 | #ifndef CORE_GL_DEFINED 5 | #define CORE_GL_DEFINED 6 | #if defined (LINUX) || defined (WIN32) 7 | #ifdef GL44 8 | #include "gl_core_4_4.h" 9 | #endif 10 | 11 | #ifdef GL43 12 | #include "gl_core_4_3.h" 13 | #endif 14 | #ifdef GL42 15 | #include "gl_core_4_2.h" 16 | #endif 17 | 18 | #ifdef GL32 19 | #include "gl_core_3_2.h" 20 | #endif 21 | #endif 22 | #endif 23 | 24 | #endif // COREGLDEFINES_H 25 | -------------------------------------------------------------------------------- /include/Grid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __GRID_H__ 20 | #define __GRID_H__ 21 | 22 | #include "VAO.h" 23 | #include "Types.h" 24 | 25 | #include 26 | 27 | /// @file Grid.h 28 | /// @brief Grid class to create and draw a simple grid in the scene for reference 29 | /// @author Callum James 30 | /// @version 1.0 31 | /// @date 12/02/2014 32 | /// Revision History: 33 | /// Initial Version 05/01/2014 34 | /// @class Grid 35 | /// @brief This grid class creates and draw a simple reference grid into the scene. The creation algorithm was taken 36 | /// from Jon Maceys NGL http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib/ 37 | class Grid 38 | { 39 | public: 40 | /// @brief Constructor of Grid class 41 | /// @param _width float - width of the grid to make 42 | /// @param _depth float - depth of the grid to make 43 | /// @param _subdivs int - number of subdivisions to use in both axes when making the grid 44 | Grid(float _width, float _depth, int _subdivs); 45 | /// @brief Destructor of Grid 46 | ~Grid(); 47 | 48 | /// @brief Return the transform matrix of the grid - returns openvdb::Mat4s 49 | inline openvdb::Mat4s transform() {return m_transform;} 50 | 51 | /// @brief Method to create the grid 52 | void create(); 53 | /// @brief Draw the grid 54 | void draw(); 55 | private: 56 | /// @brief VAO used for drawing the grid 57 | VAO *m_vao; 58 | 59 | /// @brief Vector of vDat structure to hold the grid vertices and data to upload to VAO 60 | std::vector m_verts; 61 | 62 | /// @brief Grid transform matrix 63 | openvdb::Mat4s m_transform; 64 | 65 | /// @brief Width of the grid 66 | float m_width; 67 | /// @brief Depth of the grid 68 | float m_depth; 69 | /// @brief Subdivisions of the grid 70 | int m_subdivs; 71 | 72 | /// @brief Boolena of whether the grid has been created or not 73 | bool m_created; 74 | }; 75 | 76 | #endif /* __GRID_H__ */ 77 | -------------------------------------------------------------------------------- /include/InformationWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __INFORMATION_H__ 20 | #define __INFORMATION_H__ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace Ui 27 | { 28 | class Information; 29 | } 30 | 31 | /// @file InformationWindow.h 32 | /// @brief Simple class to control and display file and hardware information in a separate window 33 | /// @author Callum James 34 | /// @version 1.0 35 | /// @date 12/02/2014 36 | /// Revision History: 37 | /// Initial Version 05/01/2014 38 | /// @class InformationWindow 39 | /// @brief Class to control window context for the simple information window. Handles the display and control of data 40 | /// both for the hardware and for the file 41 | class InformationWindow : public QWidget 42 | { 43 | Q_OBJECT 44 | 45 | public: 46 | /// @brief Constructor of the InformationWindow class 47 | /// @param [in] parent QWidget* - parent of this class 48 | explicit InformationWindow(QWidget *parent = 0); 49 | /// @brief Destructor of the InformationWindow class 50 | ~InformationWindow(); 51 | 52 | /// @brief Method to set a pointer to the main window to allow communication 53 | /// @param _mainWindow QWidget* - QWidget pointer to set as main window 54 | void setMainWindow(QWidget *_mainWindow); 55 | 56 | /// @brief Set the GPU Vendor label field 57 | /// @param [in] _vendor std::string - value to write to UI 58 | void setGPUVendor(std::string _vendor); 59 | /// @brief Set the OpenGL Version label field 60 | /// @param [in] _version std::string - value to write to UI 61 | void setOpenGLVersion(std::string _version); 62 | /// @brief Set the Renderer label field 63 | /// @param [in] _renderer std::string - value to write to UI 64 | void setRenderer(std::string _renderer); 65 | /// @brief Set the Total GPU Memory label field 66 | /// @param [in] _total std::string - value to write to UI 67 | void setTotalGPUMem(std::string _total); 68 | /// @brief Set the Used GPU Memory label field 69 | /// @param [in] _used std::string - value to write to UI 70 | void setUsedGPUMem(std::string _used); 71 | 72 | /// @brief Method to clear the information table 73 | void clearInfoTable(); 74 | /// @brief Remove all items within the information table 75 | void removeInfoTable(); 76 | /// @brief Method to initialise the information table 77 | void initInfoTable(); 78 | /// @brief Insert a row into the information table at the given index 79 | /// @param [in] _row int - row to add new row at 80 | void insertTableRow(int _row); 81 | /// @brief Method to set the item within the table 82 | /// @param [in] _row int - row to add item at 83 | /// @param [in] _column int - column to add item at 84 | /// @param [in] _text QString - text to add to item 85 | void setTableItem(int _row, int _column, QString _text); 86 | 87 | /// @brief Quit the application 88 | /// @param [in] _status int - return exit status 89 | void quit(int _status); 90 | 91 | private: 92 | /// @brief Method to connect up the UI signals and slots 93 | void connectUI(); 94 | 95 | /// @brief Event handler for key presses 96 | /// @param _event QKeyEvent* - event that has occured 97 | void keyPressEvent(QKeyEvent *_event); 98 | 99 | /// @brief The ui in this window 100 | Ui::Information *m_ui; 101 | 102 | /// @brief Pointer to the main window widget 103 | QWidget *m_mainWindow; 104 | 105 | /// @brief Boolen of whether or not the main window has been set and connected 106 | bool m_mainWindowConnected; 107 | }; 108 | 109 | #endif /* __INFORMATION_H__ */ 110 | -------------------------------------------------------------------------------- /include/NVidiaDefines.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __NVIDIADEFINES_H__ 20 | #define __NVIDIADEFINES_H__ 21 | 22 | /// @file NVidiaDefines.h 23 | /// @brief Functions that utilise NVidia devices to query information about them 24 | /// @author Callum James 25 | /// @version 1.0 26 | /// @date 12/02/2014 27 | /// Revision History: 28 | /// Initial Version 05/01/2014 29 | 30 | /* 31 | Simple namespace definition to allow for platform specific extensions defines 32 | and functions to retrieve memory information from the graphics card. These functions 33 | and extensions are for NVidia cards. The type of card must currently be defined within 34 | the makefile, although in the future I want this to all be automatically detected. The 35 | information retieved from these functions are used to display to the user the state of 36 | their graphics memory. 37 | */ 38 | 39 | // two NVidia specific defines that enable me to query the memory on the GPU 40 | #define GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX 0x9048 41 | #define GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX 0x9049 42 | 43 | #ifdef DARWIN 44 | #include 45 | #include 46 | #else 47 | #include 48 | #endif 49 | 50 | namespace NVidiaDef 51 | { 52 | /// @brief Method to get the total GPU Memory available on your current device in KB - returns GLint 53 | GLint totalGPUMemKB(); 54 | /// @brief Method to get the current GPU Memory available on your current device in KB - returns GLint 55 | GLint currentAvailableGPUMemKB(); 56 | } 57 | 58 | #endif /* __NVIDIADEFINES_H__ */ 59 | -------------------------------------------------------------------------------- /include/Plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __PLANE_H__ 20 | #define __PLANE_H__ 21 | 22 | #include 23 | 24 | /// @file Plane.h 25 | /// @brief Simple class for a plane used within the camera class. Based on Jon Maceys NGL Plane class 26 | /// @author Jon Macey and modified by Callum James 27 | /// @version 1.0 28 | /// @date 12/02/2014 (of modifications) 29 | /// Revision History: 30 | /// Initial Version 21/03/2011 (Jon Maceys initial version) 31 | /// @class Plane 32 | /// @brief Plane class hevaily based on Jon Maceys NGL Camera class (http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib). 33 | /// Modified to rely on the OpenVDB math library and remove some features not needed. Used only within the Camera class for 34 | /// the frustrum. 35 | class Plane 36 | { 37 | public: 38 | /// @brief Constructor of the Plane class 39 | Plane(); 40 | /// @brief Constructor of the Plane class 41 | /// @param [in] _v1 const openvdb::Vec3f - vector 1 42 | /// @param [in] _v2 const openvdb::Vec3f - vector 2 43 | /// @param [in] _v3 const openvdb::Vec3f - vector 3 44 | Plane(const openvdb::Vec3f &_v1,const openvdb::Vec3f &_v2,const openvdb::Vec3f &_v3); 45 | 46 | /// @brief Destructor of the Plane class 47 | ~Plane(); 48 | 49 | /// @brief Set the plane 50 | /// @param [in] _v1 const openvdb::Vec3f - vector 1 51 | /// @param [in] _v2 const openvdb::Vec3f - vector 2 52 | /// @param [in] _v3 const openvdb::Vec3f - vector 3 53 | void set(const openvdb::Vec3f &_v1,const openvdb::Vec3f &_v2,const openvdb::Vec3f &_v3); 54 | 55 | /// @brief Set normal of the point on the plane 56 | /// @param [in] _normal const openvdb::Vec3f - normal to set to 57 | /// @param [in] _point const openvdb::Vec3f - point to set the normal on 58 | void setNormal(const openvdb::Vec3f &_normal, const openvdb::Vec3f &_point); 59 | 60 | /// @brief Method to set the plane floats 61 | /// @param [in] _a float - float a 62 | /// @param [in] _b float - float b 63 | /// @param [in] _c float - float c 64 | /// @param [in] _d float - float d 65 | void setFloats( float _a, float _b, float _c, float _d ); 66 | 67 | /// @brief Get the distance between this plane and a point - returns float 68 | /// @param _p const openvdb::Vec3f - point to calculate distance to 69 | float distance(const openvdb::Vec3f &_p); 70 | 71 | /// @brief Method to get the normal of the plane - return openvdb::Vec3f 72 | inline openvdb::Vec3f getNormal() {return m_normal;} 73 | /// @brief Method to get the point - returns openvdb::Vec3f 74 | inline openvdb::Vec3f getPoint() {return m_point;} 75 | 76 | /// @brief Return the value D - returns float 77 | inline float getD() {return m_d;} 78 | 79 | private: 80 | /// @brief Normal of the plane 81 | openvdb::Vec3f m_normal; 82 | /// @brief Point on the plane 83 | openvdb::Vec3f m_point; 84 | /// @brief Value D 85 | float m_d; 86 | 87 | }; 88 | 89 | #endif /* __PLANE_H__ */ 90 | -------------------------------------------------------------------------------- /include/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __SHADER_H__ 20 | #define __SHADER_H__ 21 | 22 | #ifdef DARWIN 23 | #include 24 | #include 25 | #else 26 | #include 27 | #include 28 | #endif 29 | 30 | #include 31 | #include 32 | 33 | // These enum definitions have been taken from Jon Maceys NGL Shader.h 34 | // http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib/ 35 | /// @enum SHADERTYPE 36 | enum SHADERTYPE{VERTEX,FRAGMENT,GEOMETRY,TESSCONTROL,TESSEVAL}; 37 | 38 | /// @file Shader.h 39 | /// @brief Class to handle one shader component and handle its compilation and loading 40 | /// @author Callum James 41 | /// @version 1.0 42 | /// @date 12/02/2014 43 | /// Revision History: 44 | /// Initial Version 05/01/2014 45 | /// @class Shader 46 | /// @brief Shader class to handle a single shader component as part of a larger shader family. Controls 47 | /// its compilation and loading and also the type of shader that it is 48 | class Shader 49 | { 50 | public: 51 | /// @brief Constructor of Shader class 52 | Shader(); 53 | /// @brief Constructor of Shader class 54 | /// @param [in] _name std::string - name of the shader 55 | /// @param [in] _type SHADERTYPE - type of the shader 56 | Shader(std::string _name, SHADERTYPE _type); 57 | 58 | /// @brief Destructor of the Shader class 59 | ~Shader(); 60 | 61 | // compile the current shader 62 | /// @brief Compile the current shader 63 | void compile(); 64 | 65 | // return if compiled or not 66 | /// @brief Return if the shader has been compiled or not - return true or false 67 | inline bool compiled() {return m_compiled;} 68 | 69 | // load the shader from file name 70 | /// @brief Load shader from a file 71 | /// @param [in] _fileName std::string - path to file 72 | void loadFromFile(std::string _fileName); 73 | // load the shader from shader contents - read in from a file previous 74 | // this will not set the file path attribute 75 | /// @brief Load shader from source 76 | /// @param [in] _shaderContents char* - Total shader source 77 | void loadFromSource(const char *_shaderContents); 78 | 79 | // return the handle id of the shader 80 | /// @brief Get the shader handle - returns GLuint 81 | inline GLuint getShaderHandle()const {return m_shaderHandle;} 82 | // return the source of the shader as a single string 83 | /// @brief Get the shader source - returns std::string 84 | inline const std::string getShaderSource() const {return m_shaderSource;} 85 | // if set return the shader file path, else return __file_path_not_set__ 86 | /// @brief Get the shader file path - returns std::string 87 | inline const std::string getShaderFilePath() const {return m_shaderFile;} 88 | 89 | private: 90 | 91 | // name of the shader 92 | /// @brief The shader name 93 | std::string m_shaderName; 94 | // file path to shader file 95 | /// @brief Path to the shader file 96 | std::string m_shaderFile; 97 | // source of the shader used for loading 98 | /// @brief Full shader source 99 | std::string m_shaderSource; 100 | 101 | // what type of shader this shader is 102 | /// @brief Shader type of this shader 103 | SHADERTYPE m_shaderType; 104 | // GL handle of the shader 105 | /// @brief The shader handle for this shader 106 | GLuint m_shaderHandle; 107 | 108 | // simple boolean flag to indicate whether the shader has been compiled or not 109 | /// @brief Boolean of if the shader is compiled or not 110 | bool m_compiled; 111 | 112 | // following two functions are utility functions designed to check and load the shaders from source 113 | // they will also check to see if it has compiled correctly 114 | // read in shader from source 115 | /// @brief Method to extract the text from a file - returns static char* 116 | /// @param [in] fileName const char* - the file path and name 117 | static char* textFileRead(const char *fileName); 118 | // validate the shader once compiled 119 | /// @brief Method to validate the shader read in - returns static bool 120 | /// @param [in] shader GLuint - the shader handle 121 | /// @param [in] _name std::string - the name of the shader 122 | static bool validateShader(GLuint shader, std::string _name); 123 | }; 124 | 125 | #endif /* __SHADER_H__ */ 126 | -------------------------------------------------------------------------------- /include/ShaderLibrary.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __SHADERLIBRARY_H__ 20 | #define __SHADERLIBRARY_H__ 21 | 22 | #include "Shader.h" 23 | #include "ShaderFamily.h" 24 | 25 | #include 26 | 27 | #include 28 | 29 | /// @struct NameID 30 | /// @brief Simple structure to map the shader family names to their IDs 31 | struct NameID 32 | { 33 | std::string a_name; 34 | unsigned int a_id; 35 | }; 36 | 37 | /// @file ShaderLibrary.h 38 | /// @brief ShaderLibrary class to store and switch all regsitered and compiled shaders 39 | /// @author Callum James 40 | /// @version 1.0 41 | /// @date 12/02/2014 42 | /// Revision History: 43 | /// Initial Version 05/01/2014 44 | /// @class ShaderLibrary 45 | /// @brief ShaderLibrary class to store all compiled and linked shaders and handle access to them 46 | /// for the setting of attributes and uniforms. Also allows the switching of the currently actively shader 47 | class ShaderLibrary 48 | { 49 | public: 50 | /// @brief Constructor for ShaderLibrary class 51 | ShaderLibrary(); 52 | /// @brief Destructor for ShaderLibrary class 53 | ~ShaderLibrary(); 54 | 55 | // create a new shader family 56 | /// @brief Method to create a shader family 57 | /// @param [in] _name std::string - name of new family 58 | void createShaderFamily(std::string _name); 59 | // create a new shader family and attach a vert and frag shader named correctly 60 | /// @brief Method to create a family with an autromatic vertex and fragment shader 61 | /// @param [in] _name std::string - name of family to create 62 | void createVertFragShaderFamily(std::string _name); 63 | // create a Vertex and a fragment shader for a basic defualt shader 64 | /// @brief Method to create a vertex and fragment shader 65 | /// @param [in] _name std::string - family to attach create for 66 | void createVertFragShader(std::string _name); 67 | // create a new shader 68 | /// @brief Create a shader for a specified family 69 | /// @param [in] _name std::string - name of family to create for 70 | /// @param [in] _type SHADERTYPE - type of shader to create 71 | void createShader(std::string _name, SHADERTYPE _type); 72 | // add, load, compile and link shader to family 73 | /// @brief Add, load, compile and link a shader to a family 74 | /// @param [in] _familyName std::string - name of family to add to 75 | /// @param [in] _type SHADERTYPE - type of shader to create 76 | /// @param [in] _file std::string - file of shader 77 | void addShader(std::string _familyName, SHADERTYPE _type, std::string _file); 78 | // add, load, compile and link shader to family 79 | /// @brief Add, load, compile and link a shader to a family 80 | /// @param [in] _familyName std::string - name of family to add to 81 | /// @param [in] _type SHADERTYPE - type of shader to create 82 | /// @param [in] _string char* - source of shader 83 | void addShader(std::string _familyName, SHADERTYPE _type, char *_string); 84 | // link a shader up to a family 85 | /// @brief Link shader to family 86 | /// @param [in] _shader std::string - shader to link 87 | /// @param [in] _family std::string - family to link to 88 | void linkShaderToFamily(std::string _shader, std::string _family); 89 | 90 | // get the ID of a certain family 91 | /// @brief Get ID of a family looked up by name - returns GLuint 92 | /// @param [in] _name std::string - name of family to get ID of 93 | GLuint getID(std::string _name); 94 | 95 | // compile all currently loaded shader families 96 | /// @brief Compile all families 97 | void compileAllFamiles(); 98 | 99 | // compile all shaders 100 | /// @brief Compile all shaders 101 | void compileAll(); 102 | 103 | // compile passed in named shader 104 | /// @brief Compile a shader found by name lookup 105 | /// @param [in] _name std::string - name of shadert to compile 106 | void compileShader(std::string _name); 107 | 108 | // link all sahder families 109 | /// @brief Link all families 110 | void linkAll(); 111 | 112 | // link passed in names shader 113 | /// @brief Link shader specified 114 | /// @param [in] _name std::string - shader to link 115 | void linkShader(std::string _name); 116 | 117 | // activate one shader family to use for now 118 | /// @brief Set specified shader as active 119 | /// @param [in] _name std::string - shader to set active 120 | void setActive(std::string _name); 121 | 122 | /// @brief Get the number of shaders - return int 123 | inline unsigned int getNumShaders() {return m_shaders.size();} 124 | 125 | /// @brief Return the specified family from name - returns ShaderFamily* 126 | /// @param [in] _name std::string - family to retrieve 127 | ShaderFamily *getFamily(std::string _name); 128 | 129 | // return location to an attribute location in a shader in the library 130 | /// @brief Retrieve attribute location - returns GLint 131 | /// @param [in] _shaderName std::string - shader 132 | /// @param [in] _paramName std::string - name of attribute to find 133 | GLint getAttribLocation(std::string _shaderName, std::string _paramName); 134 | // return location of a uniform in a shader in the library 135 | /// @brief Retrieve uniform location - returns GLint 136 | /// @param [in] _shaderName std::string - shader 137 | /// @param [in] _uniformName std::string - name of uniform to find 138 | GLint getUniformLocation(std::string _shaderName, std::string _uniformName); 139 | // load vert and frag files for one shader 140 | /// @brief Load a vertex and fragment shader from file 141 | /// @param [in] _shaderName std::string - name of the shader 142 | /// @param [in] _vertex std::string - vertex shader file path 143 | /// @param [in] _frag std::string - fragment shader file path 144 | void loadVertFragShaderFile(std::string _shaderName, std::string _vertex, std::string _frag); 145 | // load a shader from source file 146 | /// @brief Load shader from file 147 | /// @param [in] _shaderName std::string - name of shader 148 | /// @param [in] _sourceFile std::string - source file 149 | void loadShaderFile(std::string _shaderName, std::string _sourceFile); 150 | // load a shader from source string 151 | /// @brief Load shader from source 152 | /// @param [in] _shaderName std::string - name of shader 153 | /// @param [in] _string char* - source 154 | void loadShaderSource(std::string &_shaderName, char *_string); 155 | // load vert and frag source for one shader 156 | /// @brief Load a vertex and fragment shader from source 157 | /// @param [in] _shaderName std::string - name of the shader 158 | /// @param [in] _vertex char* - vertex shader source 159 | /// @param [in] _frag chjar* - fragment shader source 160 | void loadVertFragShaderSource(std::string _shaderName, char *_vertex, char *_frag); 161 | 162 | // remove all shaders 163 | /// @brief Remove all shaders 164 | void clean(); 165 | 166 | // functions to upload uniforms and parameters 167 | /// @brief Upload Matrix 3x3 uniform to shaders 168 | /// @param [in] _uniformName const std::string - name of uniform 169 | /// @param [in] _m openvdb::Mat3R - matrix to upload 170 | void setShaderUniformFromMat3(const std::string &_uniformName, openvdb::Mat3R _m); 171 | /// @brief Upload Matrix 4x4 uniform to shaders 172 | /// @param [in] _uniformName const std::string - name of uniform 173 | /// @param [in] _m openvdb::Mat4s - matrix to upload 174 | void setShaderUniformFromMat4(const std::string &_uniformName, openvdb::Mat4s _m); 175 | /// @brief Upload single float uniform to shaders 176 | /// @param [in] _paramName const std::string - name of uniform 177 | /// @param [in] _f float - float to upload 178 | void setShaderParam1f(const std::string &_paramName,float _f); 179 | /// @brief Upload single int uniform to shaders 180 | /// @param [in] _paramName const std::string - name of uniform 181 | /// @param [in] _i float - int to upload 182 | void setShaderParam1i(const std::string &_paramName,int _i); 183 | 184 | /// @brief Upload array of 3 float uniforms to shaders 185 | /// @param [in] _paramName const std::string - name of uniform 186 | /// @param [in] _f1 float - float to upload 187 | /// @param [in] _f2 float - float to upload 188 | /// @param [in] _f3 float - float to upload 189 | void setShaderParam3f(const std::string &_paramName,float _f1, float _f2, float _f3); 190 | /// @brief Upload array of 4 float uniforms to shaders 191 | /// @param [in] _paramName const std::string - name of uniform 192 | /// @param [in] _f1 float - float to upload 193 | /// @param [in] _f2 float - float to upload 194 | /// @param [in] _f3 float - float to upload 195 | /// @param [in] _f4 float - float to upload 196 | void setShaderParam4f(const std::string &_paramName,float _f1, float _f2, float _f3,float _f4); 197 | /// @brief Upload array of 4 int uniforms to shaders 198 | /// @param [in] _paramName const std::string - name of uniform 199 | /// @param [in] _i1 int - int to upload 200 | /// @param [in] _i2 int - int to upload 201 | /// @param [in] _i3 int - int to upload 202 | /// @param [in] _i4 int - int to upload 203 | void setShaderParam4i(const std::string &_paramName,int _i1, int _i2, int _i3,int _i4); 204 | 205 | private: 206 | // map of all shader families stored in the library 207 | /// @brief All shader families stored in this library 208 | std::vector m_shaderFamilies; 209 | // map of all shaders within the library 210 | /// @brief All shaders stored in this library 211 | std::vector m_shaders; 212 | 213 | /// @brief Names and ID of all shaders 214 | std::vector m_shaderMap; 215 | /// @brief Names and ID of all families 216 | std::vector m_familyMap; 217 | 218 | /// @brief Null family to return if null needed 219 | ShaderFamily* m_nullFamily; 220 | 221 | /// @brief Method to find a shaders ID - return int 222 | /// @param [in] _name std::string - shader to find 223 | int findShader(std::string _name); 224 | /// @brief Method to find a shader family's ID - return int 225 | /// @param [in] _name std::string - family to find 226 | int findShaderFamily(std::string _name); 227 | 228 | // name of the active shader 229 | /// @brief Name of the currently active shader 230 | std::string m_activeShader; 231 | 232 | /// @brief Method to return a suffix from the shader type to keep internal naming conventions - returns std::string 233 | /// @param [in] _type SHADERTYPE - type of shader being passed in 234 | std::string suffixFromType(SHADERTYPE _type); 235 | }; 236 | 237 | #endif /* __SHADERLIBRARY_H__ */ 238 | -------------------------------------------------------------------------------- /include/Types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __TYPES_H__ 20 | #define __TYPES_H__ 21 | 22 | #ifdef DARWIN 23 | #include 24 | #include 25 | #else 26 | #include 27 | #endif 28 | 29 | #include 30 | #include 31 | 32 | /// @file Types.h 33 | /// @brief Header file containing definitions of type structures used throughout the application 34 | /// @author Callum James 35 | /// @version 1.0 36 | /// @date 12/02/2014 37 | /// Revision History: 38 | /// Initial Version 05/01/2014 39 | 40 | /// @struct vDat 41 | /// @brief Structure taken from Jon Maceys NGL to allow for storage of data to upload 42 | /// to the graphics card in OpenGL (http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib) 43 | // structure taken from Jon Maceys NGL 44 | // http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib 45 | struct vDat 46 | { 47 | GLfloat u; 48 | GLfloat v; 49 | GLfloat nx; 50 | GLfloat ny; 51 | GLfloat nz; 52 | GLfloat x; 53 | GLfloat y; 54 | GLfloat z; 55 | }; 56 | 57 | /// @struct BBoxBare 58 | /// @brief Structure to simply hold min and max values of a bounding box and nothing else 59 | struct BBoxBare 60 | { 61 | float minx; 62 | float miny; 63 | float minz; 64 | float maxx; 65 | float maxy; 66 | float maxz; 67 | }; 68 | 69 | /// @struct Cull 70 | /// @brief Structure to store all information about a single Cull and can be used to upload 71 | /// to the graphics card and shaders 72 | struct Cull 73 | { 74 | bool _active; 75 | int _channelOffset; 76 | int _channelType; 77 | int _cullType; 78 | float _floatULimit; 79 | float _floatLLimit; 80 | openvdb::Vec3s _vecULimit; 81 | openvdb::Vec3s _vecLLimit; 82 | }; 83 | 84 | /// @struct TempVec3 85 | /// @brief Very simple structure to only store x, y and z positions to allow swapping of data 86 | /// without the need for allocation of a full Vec3 class 87 | struct TempVec3 88 | { 89 | float x; 90 | float y; 91 | float z; 92 | }; 93 | 94 | #endif /* __TYPES_H__ */ 95 | -------------------------------------------------------------------------------- /include/Utilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __UTILITIES_H__ 20 | #define __UTILITIES_H__ 21 | 22 | #include 23 | #include 24 | 25 | #ifdef DARWIN 26 | #include 27 | #include 28 | #else 29 | #include 30 | #endif 31 | 32 | #include 33 | 34 | /// @file Utilities.h 35 | /// @brief File containing generic utility functions used throughout the application 36 | /// @author Callum James 37 | /// @version 1.0 38 | /// @date 12/02/2014 39 | /// Revision History: 40 | /// Initial Version 05/01/2014 41 | 42 | /// @brief 2 times PI 43 | const static float ud_TWO_PI= float(2*M_PI); 44 | /// @brief Value of PI 45 | const static float ud_PI=float(M_PI); 46 | /// @brief PI divided by 2 47 | const static float ud_PI2=float(M_PI/2.0); 48 | /// @brief PI divided by 4 49 | const static float ud_PI4=float(M_PI/4.0); 50 | 51 | /// @namespace Utilities 52 | namespace Utilities 53 | { 54 | /// @brief Method to convert degrees to radians - returns float 55 | /// @param [in] _deg const float - degrees passed in 56 | float u_radians(const float _deg); 57 | /// @brief Method to convert radians into degrees - returns float 58 | /// @param [in] _rad const float - radians passed in 59 | float u_degrees(const float _rad); 60 | /// @brief Method to convert a GLubyte to a string - returns std::string 61 | /// @param [in] _in const GLubyte* - values passed in 62 | std::string glubyteToStdString(const GLubyte *_in); 63 | /// @brief Method to convert an openvdb::Coord to a string - returns std::string 64 | /// @param [in] _in const openvdb::Coord - coord to convert 65 | std::string vdbCoordToStdString(const openvdb::Coord _in); 66 | /// @brief convert a level to a colour value - returns openvdb::Vec3f 67 | /// @param [in] _level int - level to return as colour 68 | openvdb::Vec3f getColourFromLevel(int _level); 69 | /// @brief Check for a GLError - returns GLenum 70 | GLenum checkGLError(); 71 | /// @brief Expand Matrix3x3 to a float array - returns std::vector 72 | /// @param [in] _in openvdb::Mat3R - matrix to flatten 73 | std::vector u_Mat3ToFloatArray(openvdb::Mat3R _in); 74 | /// @brief Expand Matrix4x4 to a float array - returns std::vector 75 | /// @param [in] _in openvdb::Mat4s - matrix to flatten 76 | std::vector u_Mat4ToFloatArray(openvdb::Mat4s _in); 77 | /// @brief Report that not external GPU device is attached 78 | inline void printNoExtGPU() {std::cout<<"No external GPU connected - current available GPU memory is not available"<. 16 | */ 17 | 18 | 19 | #ifndef __VAO_H__ 20 | #define __VAO_H__ 21 | 22 | #ifndef DARWIN 23 | #include 24 | #else 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | 31 | /// @file VAO.h 32 | /// @brief VAO class to handle drawing of objects and VAO meshes and their upload to the GPU 33 | /// @author Callum James 34 | /// @version 1.0 35 | /// @date 12/02/2014 36 | /// Revision History: 37 | /// Initial Version 05/01/2014 38 | /// @class VAO 39 | /// @brief VAO class handles the drawing of VAO meshes and Vertex Array pointers. Also handles 40 | /// the switch between unindexed and indexed data for drawing. Used in all classes with a draw 41 | /// capability 42 | class VAO 43 | { 44 | public: 45 | /// @brief Constructor for VAO class 46 | /// @param [in] _drawMode GLenum - draw mode for the VAO to use when drawing 47 | VAO(GLenum _drawMode=GL_TRIANGLE_STRIP); 48 | /// @brief Destructor for VAO class 49 | ~VAO(); 50 | /// @brief Create the VAO 51 | void create(); 52 | /// @brief Bind the VAO 53 | void bind(); 54 | /// @brief Unbind the VAO 55 | void unbind(); 56 | /// @brief Draw the VAO 57 | void draw(); 58 | /// @brief Draw the VAO 59 | /// @param [in] _mode GLenum - draw mode 60 | void draw(GLenum _mode); 61 | /// @brief Set the data in the VAO 62 | /// @param [in] _size int - size of data being uploaded 63 | /// @param [in] _data GLfloat - data to upload 64 | /// @param [in] _mode GLenum - draw mode 65 | void setData(int _size, GLfloat &_data, GLenum _mode=GL_STATIC_DRAW); 66 | /// @brief Set the data indexed in the VAO 67 | /// @param [in] _size int - size of data being uploaded 68 | /// @param [in] _data GLfloat - data to upload 69 | /// @param [in] _indexSize unsigned int - size of index 70 | /// @param [in] _indexData const GLvoid* - index data 71 | /// @param [in] _indexType GLenum - the type of the index data being uploaded 72 | /// @param [in] _mode GLenum - draw mode 73 | void setIndexedData(unsigned int _size,const GLfloat &_data,unsigned int _indexSize,const GLvoid *_indexData,GLenum _indexType,GLenum _mode=GL_STATIC_DRAW); 74 | /// @brief Update indexed data when changed 75 | /// @param [in] _size unsigned int - size of data 76 | /// @param [in] _data const GLfloat - data to upload 77 | /// @param [in] _mode GLenum - draw mode 78 | void updateIndexedData(unsigned int _size, const GLfloat &_data,GLenum _mode); 79 | /// @brief Set the Vertex Attribute Pointer 80 | /// @param [in] _loc GLint - location of Vertex Attribute Pointer 81 | /// @param [in] _size GLint - size of data 82 | /// @param [in] _type GLenum - data type 83 | /// @param [in] _stride GLsizei - stride of data 84 | /// @param [in] _offset int - offset of this data 85 | /// @param [in] _normalise bool - normalise the data when uploading 86 | void vertexAttribPointer(GLint _loc, GLint _size, GLenum _type, GLsizei _stride, int _offset, bool _normalise=GL_FALSE); 87 | /// @brief Set the draw mode 88 | /// @param [in] _drawMode GLenum - draw mode to set 89 | inline void setDrawMode(GLenum _drawMode) {m_drawMode = _drawMode;} 90 | /// @brief Get the Vertext Array pointer - returns GLuint 91 | inline GLuint getVAPointer() {return m_vaPointer;} 92 | /// @brief Return if bound - returns true or false 93 | inline bool bound() {return m_arraysBound;} 94 | /// @brief Set the number of indices to draw 95 | /// @param [in] _count int - number to draw 96 | inline void setIndicesCount(int _count) {m_indicesCount = _count;} 97 | /// @brief Return the number of indices to draw - return int 98 | inline int indicesCount() const {return m_indicesCount;} 99 | /// @brief Remove the VAO 100 | void remove(); 101 | 102 | private: 103 | /// @brief The draw mode for this VAO 104 | GLenum m_drawMode; 105 | /// @brief Number of indices to draw 106 | int m_indicesCount; 107 | /// @brief The vertex array pointer 108 | GLuint m_vaPointer; 109 | 110 | // as there can be multiple vbo attached to one vao need a vector these 111 | /// @brief Array of Vertex Buffer pointers 112 | std::vector m_vboPointers; 113 | /// @brief Boolean of if the arrays are bound or not 114 | bool m_arraysBound; 115 | /// @brief Boolean of if the VAO is indexed or not 116 | bool m_indexed; 117 | /// @brief The index type 118 | GLenum m_indexType; 119 | /// @brief IBO ID (indexed buffer) 120 | GLuint m_iboID; 121 | /// @brief Return the VBO pointer at the specified index 122 | /// @param [in] _index unsigned int - infex to return the VBO id 123 | GLuint VBOid(unsigned int _index); 124 | }; 125 | 126 | #endif /* __VAO_H__ */ 127 | -------------------------------------------------------------------------------- /manual/openvdb_viewer_manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/manual/openvdb_viewer_manual.pdf -------------------------------------------------------------------------------- /res/ovdbv.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.icns -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_128x128.png -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_16x16.png -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_256x256.png -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_32x32.png -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_512x512.png -------------------------------------------------------------------------------- /res/ovdbv.iconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimJam42/OpenVDBViewer/4c28f36b3450a7c2a89caae9124306af19392bba/res/ovdbv.iconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /res/ovdbv_resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ovdbv.iconset/icon_16x16.png 4 | ovdbv.iconset/icon_16x16@2x.png 5 | ovdbv.iconset/icon_32x32.png 6 | ovdbv.iconset/icon_32x32@2x.png 7 | ovdbv.iconset/icon_128x128.png 8 | ovdbv.iconset/icon_128x128@2x.png 9 | ovdbv.iconset/icon_256x256.png 10 | ovdbv.iconset/icon_256x256@2x.png 11 | ovdbv.iconset/icon_512x512.png 12 | ovdbv.iconset/icon_512x512@2x.png 13 | 14 | 15 | -------------------------------------------------------------------------------- /shaders/VectorColourCropGeometry.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file VectorColourCropGeometry.glsl 20 | /// @brief Crop geometry shader for rendering vectors 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | // lines are passed in 30 | layout(points) in; 31 | // output a linestrip to draw a single line 32 | layout(line_strip, max_vertices = 2) out; 33 | 34 | uniform mat4 MVP; 35 | 36 | in vec3 o_direction[]; // direction of vector 37 | in vec2 o_index[]; 38 | 39 | uniform float u_s; // value of s used for LOD 40 | 41 | uniform float u_vectorSize; // length of vector 42 | 43 | out vec3 normalDirection; // to pass to fragment 44 | 45 | out vec2 UV; 46 | 47 | void main() 48 | { 49 | float m_s = u_s; // get value of s 50 | UV = o_index[0]; 51 | normalDirection = o_direction[0]; 52 | if (o_index[0].y == 1.0 || o_index[0].y == 2.0) // either in box or still valid - from vertex shader 53 | { 54 | if (mod(o_index[0].x,m_s) == 0.0) // check for LOD validity 55 | { 56 | gl_Position = MVP*(gl_in[0].gl_Position); 57 | // draw vertex 58 | EmitVertex(); 59 | // end 60 | 61 | // calculate the direction of the line 62 | vec4 v = vec4(o_direction[0],1.0) - gl_in[0].gl_Position; 63 | vec4 vNorm = normalize(v); // get length 1 64 | vec4 end = gl_in[0].gl_Position - (u_vectorSize*vNorm); // calculate end 65 | 66 | gl_Position = MVP*end; 67 | EmitVertex(); // emit a vertex at the end of the vector 68 | 69 | // finishes this primitive and starts the next 70 | EndPrimitive(); 71 | 72 | normalDirection = o_direction[0]; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /shaders/VectorColourCropVertex.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file VectorColourCropVertex.glsl 20 | /// @brief Crop vertex shader for rendering vectors 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | 30 | /// @brief the vertex passed in 31 | layout (location = 0) in vec3 inVert; 32 | /// @brief the normal passed in 33 | layout (location = 2) in vec3 inNormal; 34 | /// @brief the in uv 35 | layout (location = 1) in vec2 inUV; 36 | // crop structure to hold min and max 37 | struct CropBox 38 | { 39 | vec3 _min; 40 | vec3 _max; 41 | }; 42 | // three possible crop boxes in the shader 43 | uniform CropBox u_crop1; 44 | uniform CropBox u_crop2; 45 | uniform CropBox u_crop3; 46 | uniform int u_numCrops; 47 | // transform to use before calcuting if in box or not 48 | uniform mat4 u_transform; 49 | 50 | out vec3 o_direction; 51 | out vec2 o_index; 52 | 53 | int inBox() 54 | { 55 | int returnValue = 0; 56 | vec4 pos = u_transform*vec4(inVert,1.0); 57 | // going to use multiple if statements so that the check can be jumped 58 | // out of quicker if one fails on its own 59 | // need to check for each crop box being used 60 | if (u_numCrops >= 1 && returnValue == 0) 61 | { 62 | if (pos.x < u_crop1._max.x && pos.x > u_crop1._min.x) 63 | { 64 | if (pos.y < u_crop1._max.y && pos.y > u_crop1._min.y) 65 | { 66 | if (pos.z < u_crop1._max.z && pos.z > u_crop1._min.z) 67 | { 68 | returnValue = 1; 69 | } 70 | } 71 | } 72 | } 73 | else // calling a return here to be able to jump out of the check early if already known it is to be drawn 74 | { 75 | return returnValue; 76 | } 77 | if (u_numCrops >= 2 && returnValue == 0) 78 | { 79 | if (pos.x < u_crop2._max.x && pos.x > u_crop2._min.x) 80 | { 81 | if (pos.y < u_crop2._max.y && pos.y > u_crop2._min.y) 82 | { 83 | if (pos.z < u_crop2._max.z && pos.z > u_crop2._min.z) 84 | { 85 | returnValue = 1; 86 | } 87 | } 88 | } 89 | } 90 | else // calling a return here to be able to jump out of the check early if already known it is to be drawn 91 | { 92 | return returnValue; 93 | } 94 | if (u_numCrops >= 3 && returnValue == 0) 95 | { 96 | if (pos.x < u_crop3._max.x && pos.x > u_crop3._min.x) 97 | { 98 | if (pos.y < u_crop3._max.y && pos.y > u_crop3._min.y) 99 | { 100 | if (pos.z < u_crop3._max.z && pos.z > u_crop3._min.z) 101 | { 102 | returnValue = 1; 103 | } 104 | } 105 | } 106 | } 107 | else // calling a return here to be able to jump out of the check early if already known it is to be drawn 108 | { 109 | return returnValue; 110 | } 111 | return returnValue; 112 | } 113 | 114 | void main() 115 | { 116 | gl_Position = vec4(inVert,1.0); 117 | o_direction = inNormal; 118 | o_index = inUV; 119 | o_index.y = 2.0; 120 | 121 | o_index.y = float(inBox()); // calculate if in box or not 122 | } 123 | -------------------------------------------------------------------------------- /shaders/VectorColourFragment.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file VectorColourFragment.glsl 20 | /// @brief Fragment shader for rendering vectors 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | layout (location=0)out vec4 outColour; 30 | 31 | uniform vec4 u_colour; 32 | 33 | uniform int u_renderMode; 34 | uniform int u_invert; 35 | 36 | in vec3 normalDirection; 37 | in vec2 UV; 38 | // the texture buffer with the channel data for culling 39 | uniform samplerBuffer channelData; 40 | // whether culling in enabled or not 41 | uniform int u_cull; 42 | // cull structure to hold data on each cull 43 | struct Cull 44 | { 45 | int _active; 46 | int _channelOffset; 47 | int _channelType; 48 | int _cullType; 49 | float _floatULimit; 50 | float _floatLLimit; 51 | vec3 _vecULimit; 52 | vec3 _vecLLimit; 53 | }; 54 | // the three culls possible on the shader 55 | uniform Cull u_cull1; 56 | uniform Cull u_cull2; 57 | uniform Cull u_cull3; 58 | 59 | // check on a vector type cull 60 | bool vecCull(vec3 _l, vec3 _u, vec3 _value, int _type) 61 | { 62 | if (_type == 0) // less than cull 63 | { 64 | if (_value.x < _l.x && _value.y < _l.y && _value.z < _l.z) 65 | { 66 | return true; 67 | } 68 | return false; 69 | } 70 | else if (_type == 1) // between cull 71 | { 72 | if ((_value.x >= _l.x && _value.y >= _l.y && _value.z >= _l.z) 73 | && (_value.x <= _u.x && _value.y <= _u.y && _value.z <= _u.z)) 74 | { 75 | return false; 76 | } 77 | return true; 78 | } 79 | else // greater than cull 80 | { 81 | if (_value.x > _l.x && _value.y > _l.y && _value.z > _l.z) 82 | { 83 | return true; 84 | } 85 | return false; 86 | } 87 | return false; 88 | } 89 | 90 | // check on a float cull 91 | bool floatCull(float _l, float _u, float _value, int _type) 92 | { 93 | if (_type == 0) // less than cull 94 | { 95 | if (_value < _l) 96 | { 97 | return true; 98 | } 99 | return false; 100 | } 101 | else if (_type == 1) // between cull 102 | { 103 | if (_value >= _l && _value <= _u) 104 | { 105 | return false; 106 | } 107 | return true; 108 | } 109 | else // greater than cull 110 | { 111 | if (_value > _l) 112 | { 113 | return true; 114 | } 115 | return false; 116 | } 117 | return false; 118 | } 119 | 120 | bool culled() 121 | { 122 | bool cull = false; // assume to not be culled 123 | vec3 value; 124 | if (u_cull1._active == 1 && !cull) // if cull 1 is active and it hasnt already been determined that this point is to be culled 125 | { 126 | value= texelFetch(channelData,int(u_cull1._channelOffset+UV.x)).xyz; // get channel data out of texture buffer using the channel offset stored in the cull 127 | if (u_cull1._channelType == 0) // scalar 128 | { 129 | cull = floatCull(u_cull1._floatLLimit,u_cull1._floatULimit,value.x,u_cull1._cullType); 130 | } 131 | else // vector 132 | { 133 | cull = vecCull(u_cull1._vecLLimit,u_cull1._vecULimit,value,u_cull1._cullType); 134 | } 135 | } 136 | 137 | if (u_cull2._active == 1 && !cull) // if cull 2 is active and it hasnt already been determined that this point is to be culled 138 | { 139 | value= texelFetch(channelData,int(u_cull2._channelOffset+UV.x)).xyz; // get channel data out of texture buffer using the channel offset stored in the cull 140 | if (u_cull2._channelType == 0) // scalar 141 | { 142 | cull = floatCull(u_cull2._floatLLimit,u_cull2._floatULimit,value.x,u_cull2._cullType); 143 | } 144 | else // vector 145 | { 146 | cull = vecCull(u_cull2._vecLLimit,u_cull2._vecULimit,value,u_cull2._cullType); 147 | } 148 | } 149 | else 150 | { 151 | return cull; 152 | } 153 | 154 | if (u_cull3._active == 1 && !cull) // if cull 3 is active and it hasnt already been determined that this point is to be culled 155 | { 156 | value= texelFetch(channelData,int(u_cull3._channelOffset+UV.x)).xyz; // get channel data out of texture buffer using the channel offset stored in the cull 157 | if (u_cull3._channelType == 0) // scalar 158 | { 159 | cull = floatCull(u_cull3._floatLLimit,u_cull3._floatULimit,value.x,u_cull3._cullType); 160 | } 161 | else // vector 162 | { 163 | cull = vecCull(u_cull3._vecLLimit,u_cull3._vecULimit,value,u_cull3._cullType); 164 | } 165 | } 166 | else 167 | { 168 | return cull; 169 | } 170 | 171 | return cull; 172 | } 173 | 174 | void main() 175 | { 176 | if (u_cull == 1) 177 | { 178 | if (culled()) 179 | { 180 | discard; // discard if the point has been culled 181 | } 182 | } 183 | 184 | vec4 colour = vec4(0.0); 185 | if (u_renderMode == 0) // solid colour for the vectors 186 | { 187 | colour = u_colour; 188 | } 189 | else 190 | { 191 | colour = vec4(normalDirection,1.0); // colouring the vectors with the normal direction 192 | } 193 | if (u_invert == 1) 194 | { 195 | colour = vec4(1.0-colour.x,1.0-colour.y,1.0-colour.z,1.0); 196 | } 197 | outColour = vec4(colour); 198 | } 199 | -------------------------------------------------------------------------------- /shaders/VectorColourGeometry.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file VectorColourGeometry.glsl 20 | /// @brief Geometry shader for rendering vectors 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | // lines are passed in 30 | layout(points) in; 31 | // output a linestrip to draw a single line 32 | layout(line_strip, max_vertices = 2) out; 33 | // Model View Projection Matrix 34 | uniform mat4 MVP; 35 | 36 | in vec3 o_direction[]; 37 | in vec2 o_index[]; 38 | // value of s passed in 39 | uniform float u_s; 40 | 41 | uniform float u_vectorSize; 42 | 43 | out vec3 normalDirection; 44 | 45 | out vec2 UV; 46 | 47 | void main() 48 | { 49 | float m_s = u_s; // get value of s 50 | UV = o_index[0]; // vertex number stored in o_index[0].x 51 | normalDirection = o_direction[0]; 52 | if (mod(o_index[0].x,m_s) == 0.0) // if the modulus of the two is 0 then we cna draw this point 53 | { 54 | gl_Position = MVP*(gl_in[0].gl_Position); 55 | // draw vertex 56 | EmitVertex(); 57 | // end 58 | 59 | // calculate the direction of the line 60 | vec4 v = vec4(o_direction[0],1.0) - gl_in[0].gl_Position; 61 | vec4 vNorm = normalize(v); // create a length one vector of that direction 62 | vec4 end = gl_in[0].gl_Position - (u_vectorSize*vNorm); // multiply it by a factor to get the end point 63 | 64 | gl_Position = MVP*end; 65 | EmitVertex(); 66 | 67 | // finishes this primitive and starts the next 68 | EndPrimitive(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /shaders/VectorColourVertex.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file VectorColourVertex.glsl 20 | /// @brief Vertex shader for rendering vectors 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | 30 | /// @brief the vertex passed in 31 | layout (location = 0) in vec3 inVert; 32 | /// @brief the normal passed in 33 | layout (location = 2) in vec3 inNormal; 34 | /// @brief the in uv 35 | layout (location = 1) in vec2 inUV; 36 | 37 | out vec3 o_direction; 38 | out vec2 o_index; 39 | 40 | void main() 41 | { 42 | gl_Position = vec4(inVert,1.0); 43 | o_direction = inNormal; 44 | o_index = inUV; 45 | } 46 | -------------------------------------------------------------------------------- /shaders/colourFragment.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file colourFragment.glsl 20 | /// @brief Simple colour fragment shader 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | layout (location=0)out vec4 outColour; 30 | 31 | uniform vec4 u_colour; 32 | 33 | void main() 34 | { 35 | // set out colour to the colour passed in 36 | outColour = vec4(u_colour); 37 | } 38 | -------------------------------------------------------------------------------- /shaders/colourMapCropVertex.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file colourMapCropVertex.glsl 20 | /// @brief Crop Vertex for the Colour Map 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | /// @brief Model View Projection Matrix 30 | uniform mat4 MVP; 31 | uniform mat4 u_transform; 32 | 33 | layout (location=0)in vec3 inVert; 34 | layout (location=1)in vec2 inUV; 35 | layout (location=2)in vec3 inNormal; 36 | 37 | // crop structure to hold min and max 38 | struct CropBox 39 | { 40 | vec3 _min; 41 | vec3 _max; 42 | }; 43 | // three possible crop boxes in the shader 44 | uniform CropBox u_crop1; 45 | uniform CropBox u_crop2; 46 | uniform CropBox u_crop3; 47 | uniform int u_numCrops; 48 | 49 | // whether or not to ramp points 50 | uniform int u_rampPoints; 51 | // id of whether or not to draw due to LOD 52 | flat out int b_draw; 53 | 54 | out vec3 vert; 55 | out vec2 UV; 56 | 57 | uniform float u_s; 58 | 59 | // pretty crude method to check if point is within one of the crop boxes 60 | // simple in box check 61 | int inBox() 62 | { 63 | int returnValue = 0; 64 | vec4 pos = u_transform*vec4(inVert,1.0); 65 | // going to use multiple if statements so that the check can be jumped 66 | // out of quicker if one fails on its own 67 | // need to check for each crop box being used 68 | if (u_numCrops >= 1 && returnValue == 0) 69 | { 70 | if (pos.x < u_crop1._max.x && pos.x > u_crop1._min.x) 71 | { 72 | if (pos.y < u_crop1._max.y && pos.y > u_crop1._min.y) 73 | { 74 | if (pos.z < u_crop1._max.z && pos.z > u_crop1._min.z) 75 | { 76 | returnValue = 1; 77 | } 78 | } 79 | } 80 | } 81 | else // calling a return here to be able to jump out of the check early if already known it is to be drawn 82 | { 83 | return returnValue; 84 | } 85 | if (u_numCrops >= 2 && returnValue == 0) 86 | { 87 | if (pos.x < u_crop2._max.x && pos.x > u_crop2._min.x) 88 | { 89 | if (pos.y < u_crop2._max.y && pos.y > u_crop2._min.y) 90 | { 91 | if (pos.z < u_crop2._max.z && pos.z > u_crop2._min.z) 92 | { 93 | returnValue = 1; 94 | } 95 | } 96 | } 97 | } 98 | else // calling a return here to be able to jump out of the check early if already known it is to be drawn 99 | { 100 | return returnValue; 101 | } 102 | if (u_numCrops >= 3 && returnValue == 0) 103 | { 104 | if (pos.x < u_crop3._max.x && pos.x > u_crop3._min.x) 105 | { 106 | if (pos.y < u_crop3._max.y && pos.y > u_crop3._min.y) 107 | { 108 | if (pos.z < u_crop3._max.z && pos.z > u_crop3._min.z) 109 | { 110 | returnValue = 1; 111 | } 112 | } 113 | } 114 | } 115 | else // calling a return here to be able to jump out of the check early if already known it is to be drawn 116 | { 117 | return returnValue; 118 | } 119 | return returnValue; 120 | } 121 | 122 | void calculate() 123 | { 124 | float m_s = u_s; // get value of s 125 | int id = int(inUV.x); // vertex number stored in UV.x 126 | if (mod(id,m_s) == 0.0) // if the modulus of the two is 0 then we cna draw this point 127 | { 128 | gl_Position = MVP*vec4(inVert,1.0); // project 129 | b_draw = 1; // this will be drawn 130 | } 131 | else 132 | { 133 | b_draw = 0; 134 | } 135 | } 136 | 137 | void main() 138 | { 139 | int inCrop = inBox(); // calculate if in box 140 | UV = inUV; 141 | if (u_rampPoints == 1) 142 | { // ramping on coords 143 | vert = inVert.xyz; 144 | } 145 | else 146 | { // ramping on channel 147 | vert = inNormal.xyz; 148 | } 149 | if (inCrop == 1) 150 | { 151 | // if drawable, the calculate 152 | calculate(); 153 | } 154 | else 155 | { 156 | b_draw = 0; 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /shaders/colourMapFragment.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file colourMapFragment.glsl 20 | /// @brief Fragment shader for a standard colour map 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | layout (location=0)out vec4 outColour; 30 | 31 | uniform vec4 u_colour; 32 | // id of whether or not to draw due to LOD 33 | flat in int b_draw; 34 | 35 | in vec3 vert; 36 | in vec2 UV; 37 | // min and max uniforms for the colour ramp 38 | uniform vec3 u_Min; 39 | uniform vec3 u_Max; 40 | 41 | // the texture buffer with the channel data for culling 42 | uniform samplerBuffer channelData; 43 | // if culling is enabled or not 44 | uniform int u_cull; 45 | 46 | // cull structure to hold data on each cull 47 | struct Cull 48 | { 49 | int _active; 50 | int _channelOffset; 51 | int _channelType; 52 | int _cullType; 53 | float _floatULimit; 54 | float _floatLLimit; 55 | vec3 _vecULimit; 56 | vec3 _vecLLimit; 57 | }; 58 | // the three culls 59 | uniform Cull u_cull1; 60 | uniform Cull u_cull2; 61 | uniform Cull u_cull3; 62 | 63 | // check on a vector type cull 64 | bool vecCull(vec3 _l, vec3 _u, vec3 _value, int _type) 65 | { 66 | if (_type == 0) // less than cull 67 | { 68 | if (_value.x < _l.x && _value.y < _l.y && _value.z < _l.z) 69 | { 70 | return true; 71 | } 72 | return false; 73 | } 74 | else if (_type == 1) // between cull 75 | { 76 | if ((_value.x >= _l.x && _value.y >= _l.y && _value.z >= _l.z) 77 | && (_value.x <= _u.x && _value.y <= _u.y && _value.z <= _u.z)) 78 | { 79 | return false; 80 | } 81 | return true; 82 | } 83 | else // greater than cull 84 | { 85 | if (_value.x > _l.x && _value.y > _l.y && _value.z > _l.z) 86 | { 87 | return true; 88 | } 89 | return false; 90 | } 91 | return false; 92 | } 93 | 94 | // check on a float type cull 95 | bool floatCull(float _l, float _u, float _value, int _type) 96 | { 97 | if (_type == 0) // less than cull 98 | { 99 | if (_value < _l) 100 | { 101 | return true; 102 | } 103 | return false; 104 | } 105 | else if (_type == 1) // between cull 106 | { 107 | if (_value >= _l && _value <= _u) 108 | { 109 | return false; 110 | } 111 | return true; 112 | } 113 | else // greater than cull 114 | { 115 | if (_value > _l) 116 | { 117 | return true; 118 | } 119 | return false; 120 | } 121 | return false; 122 | } 123 | 124 | bool culled() 125 | { 126 | bool cull = false; 127 | vec3 value; 128 | if (u_cull1._active == 1 && !cull) // if cull 1 is active and it hasnt already been determined that this point is to be culled 129 | { 130 | value= texelFetch(channelData,int(u_cull1._channelOffset+UV.x)).xyz; // get channel data out of texture buffer using the channel offset stored in the cull 131 | if (u_cull1._channelType == 0) // scalar 132 | { 133 | cull = floatCull(u_cull1._floatLLimit,u_cull1._floatULimit,value.x,u_cull1._cullType); 134 | } 135 | else // vector 136 | { 137 | cull = vecCull(u_cull1._vecLLimit,u_cull1._vecULimit,value,u_cull1._cullType); 138 | } 139 | } 140 | 141 | if (u_cull2._active == 1 && !cull) // if cull 2 is active and it hasnt already been determined that this point is to be culled 142 | { 143 | value= texelFetch(channelData,int(u_cull2._channelOffset+UV.x)).xyz; // get channel data out of texture buffer using the channel offset stored in the cull 144 | if (u_cull2._channelType == 0) // scalar 145 | { 146 | cull = floatCull(u_cull2._floatLLimit,u_cull2._floatULimit,value.x,u_cull2._cullType); 147 | } 148 | else // vector 149 | { 150 | cull = vecCull(u_cull2._vecLLimit,u_cull2._vecULimit,value,u_cull2._cullType); 151 | } 152 | } 153 | else 154 | { 155 | return cull; 156 | } 157 | 158 | if (u_cull3._active == 1 && !cull) // if cull 3 is active and it hasnt already been determined that this point is to be culled 159 | { 160 | value= texelFetch(channelData,int(u_cull3._channelOffset+UV.x)).xyz; // get channel data out of texture buffer using the channel offset stored in the cull 161 | if (u_cull3._channelType == 0) // scalar 162 | { 163 | cull = floatCull(u_cull3._floatLLimit,u_cull3._floatULimit,value.x,u_cull3._cullType); 164 | } 165 | else // vector 166 | { 167 | cull = vecCull(u_cull3._vecLLimit,u_cull3._vecULimit,value,u_cull3._cullType); 168 | } 169 | } 170 | else 171 | { 172 | return cull; 173 | } 174 | 175 | return cull; 176 | } 177 | 178 | void main() 179 | { 180 | if (b_draw == 0) // if not draing due to LOD 181 | { 182 | discard; 183 | } 184 | 185 | if (u_cull == 1) 186 | { 187 | if (culled()) // if it has been culled 188 | { 189 | discard; 190 | } 191 | } 192 | 193 | /* 194 | (point - min)/(max-min) 195 | */ 196 | 197 | vec4 colour; 198 | 199 | if (UV.y == 0) // scalar type 200 | { 201 | float factor = ((vert.x-u_Min.x)/(u_Max.x-u_Min.x)); // caluclate place in colour ramp 202 | colour = u_colour*factor; 203 | } 204 | else // vector type 205 | { 206 | vec3 factor = ((vert-u_Min)/(u_Max-u_Min)); // calculate place in colour ramp 207 | colour = u_colour*vec4(factor,1.0); 208 | } 209 | 210 | 211 | outColour = colour; 212 | } 213 | -------------------------------------------------------------------------------- /shaders/colourMapVertex.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file colourMapVertex.glsl 20 | /// @brief Standard vertex shader for a colour map 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | /// @brief Model View Projection Matrix 30 | uniform mat4 MVP; 31 | 32 | layout (location=0)in vec3 inVert; 33 | layout (location=1)in vec2 inUV; 34 | layout (location=2)in vec3 inNormal; 35 | 36 | flat out int b_draw; // whether to draw or not due to LOD 37 | out vec3 vert; 38 | out vec2 UV; 39 | // whether ot not colour ramp points or channel 40 | uniform int u_rampPoints; 41 | 42 | // value of s 43 | uniform float u_s; 44 | 45 | void calculate() 46 | { 47 | float m_s = u_s; // get value of s 48 | int id = int(inUV.x); // vertex number stored in UV.x 49 | if (mod(id,m_s) == 0.0) // if the modulus of the two is 0 then we cna draw this point 50 | { 51 | gl_Position = MVP*vec4(inVert,1.0); 52 | b_draw = 1; // this will be drawn 53 | } 54 | else 55 | { 56 | b_draw = 0; 57 | } 58 | } 59 | 60 | void main() 61 | { 62 | calculate(); 63 | UV = inUV; 64 | if (u_rampPoints == 1) // ramp on coords 65 | { 66 | vert = inVert.xyz; 67 | } 68 | else // ramp on channel 69 | { 70 | vert = inNormal.xyz; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /shaders/colourVertex.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file colourVertex.glsl 20 | /// @brief Simple colour vertex shader 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | /// @brief Model View Projection Matrix 30 | uniform mat4 MVP; 31 | 32 | layout (location=0)in vec3 inVert; 33 | 34 | void main() 35 | { 36 | gl_Position = MVP*vec4(inVert,1.0); 37 | } 38 | -------------------------------------------------------------------------------- /shaders/normalCropVertex.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file normalCropVertex.glsl 20 | /// @brief Crop vertex for the normal shader 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | /// @brief Model View Projection Matrix 30 | uniform mat4 MVP; 31 | uniform mat4 u_transform; 32 | 33 | layout (location=0)in vec3 inVert; 34 | layout (location=1)in vec2 inUV; 35 | layout (location=2)in vec3 inNormal; 36 | 37 | out vec2 UV; 38 | out vec3 normal; 39 | // crop structure to hold min and max 40 | struct CropBox 41 | { 42 | vec3 _min; 43 | vec3 _max; 44 | }; 45 | // three possible crop boxes in the shader 46 | uniform CropBox u_crop1; 47 | uniform CropBox u_crop2; 48 | uniform CropBox u_crop3; 49 | uniform int u_numCrops; 50 | // id of whether or not to draw due to LOD 51 | flat out int b_draw; 52 | // value of s passed in 53 | uniform float u_s; 54 | 55 | // pretty crude method to check if point is within one of the crop boxes 56 | // simple in box check 57 | int inBox() 58 | { 59 | int returnValue = 0; 60 | vec4 pos = u_transform*vec4(inVert,1.0); 61 | // going to use multiple if statements so that the check can be jumped 62 | // out of quicker if one fails on its own 63 | // need to check for each crop box being used 64 | if (u_numCrops >= 1 && returnValue == 0) 65 | { 66 | if (pos.x < u_crop1._max.x && pos.x > u_crop1._min.x) 67 | { 68 | if (pos.y < u_crop1._max.y && pos.y > u_crop1._min.y) 69 | { 70 | if (pos.z < u_crop1._max.z && pos.z > u_crop1._min.z) 71 | { 72 | returnValue = 1; 73 | } 74 | } 75 | } 76 | } 77 | else // calling a return here to be able to jump out of the check early if already known it is to be drawn 78 | { 79 | return returnValue; 80 | } 81 | if (u_numCrops >= 2 && returnValue == 0) 82 | { 83 | if (pos.x < u_crop2._max.x && pos.x > u_crop2._min.x) 84 | { 85 | if (pos.y < u_crop2._max.y && pos.y > u_crop2._min.y) 86 | { 87 | if (pos.z < u_crop2._max.z && pos.z > u_crop2._min.z) 88 | { 89 | returnValue = 1; 90 | } 91 | } 92 | } 93 | } 94 | else // calling a return here to be able to jump out of the check early if already known it is to be drawn 95 | { 96 | return returnValue; 97 | } 98 | if (u_numCrops >= 3 && returnValue == 0) 99 | { 100 | if (pos.x < u_crop3._max.x && pos.x > u_crop3._min.x) 101 | { 102 | if (pos.y < u_crop3._max.y && pos.y > u_crop3._min.y) 103 | { 104 | if (pos.z < u_crop3._max.z && pos.z > u_crop3._min.z) 105 | { 106 | returnValue = 1; 107 | } 108 | } 109 | } 110 | } 111 | else // calling a return here to be able to jump out of the check early if already known it is to be drawn 112 | { 113 | return returnValue; 114 | } 115 | return returnValue; 116 | } 117 | 118 | void calculate() 119 | { 120 | float m_s = u_s; // get value of s 121 | int id = int(inUV.x); // vertex number stored in UV.x 122 | if (mod(id,m_s) == 0.0) // if the modulus of the two is 0 then we cna draw this point 123 | { 124 | gl_Position = MVP*vec4(inVert,1.0); 125 | 126 | UV = inUV; 127 | normal = inNormal; 128 | b_draw = 1; // this will be drawn 129 | } 130 | else 131 | { 132 | b_draw = 0; 133 | } 134 | } 135 | 136 | void main() 137 | { 138 | if (inBox() == 1) // if it is in crop box then calculate 139 | { 140 | calculate(); 141 | } 142 | else 143 | { 144 | b_draw = 0; // else dont draw 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /shaders/normalFragment.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file normalFragment.glsl 20 | /// @brief Fragment shader for normal rendering - includes culling 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | in vec2 UV; 30 | in vec3 normal; 31 | layout (location=0)out vec4 outColour; 32 | // id of whether or not to draw due to LOD 33 | flat in int b_draw; 34 | // the texture buffer with the channel data for culling 35 | uniform samplerBuffer channelData; 36 | // whether culling in enabled or not 37 | uniform int u_cull; 38 | // cull structure to hold data on each cull 39 | struct Cull 40 | { 41 | bool _active; 42 | int _channelOffset; 43 | int _channelType; 44 | int _cullType; 45 | float _floatULimit; 46 | float _floatLLimit; 47 | vec3 _vecULimit; 48 | vec3 _vecLLimit; 49 | }; 50 | // the three culls 51 | uniform Cull u_cull1; 52 | uniform Cull u_cull2; 53 | uniform Cull u_cull3; 54 | 55 | // check on a vector type cull 56 | bool vecCull(vec3 _l, vec3 _u, vec3 _value, int _type) 57 | { 58 | if (_type == 0) // less than cull 59 | { 60 | if (_value.x < _l.x && _value.y < _l.y && _value.z < _l.z) 61 | { 62 | return true; 63 | } 64 | return false; 65 | } 66 | else if (_type == 1) // between cull 67 | { 68 | if ((_value.x >= _l.x && _value.y >= _l.y && _value.z >= _l.z) 69 | && (_value.x <= _u.x && _value.y <= _u.y && _value.z <= _u.z)) 70 | { 71 | return false; 72 | } 73 | return true; 74 | } 75 | else // greater than cull 76 | { 77 | if (_value.x > _l.x && _value.y > _l.y && _value.z > _l.z) 78 | { 79 | return true; 80 | } 81 | return false; 82 | } 83 | return false; 84 | } 85 | 86 | // check on a float cull 87 | bool floatCull(float _l, float _u, float _value, int _type) 88 | { 89 | if (_type == 0) // less than cull 90 | { 91 | if (_value < _l) 92 | { 93 | return true; 94 | } 95 | return false; 96 | } 97 | else if (_type == 1) // between cull 98 | { 99 | if (_value >= _l && _value <= _u) 100 | { 101 | return false; 102 | } 103 | return true; 104 | } 105 | else // greater than cull 106 | { 107 | if (_value > _l) 108 | { 109 | return true; 110 | } 111 | return false; 112 | } 113 | return false; 114 | } 115 | 116 | bool culled() 117 | { 118 | bool cull = false; // assume to not be culled 119 | vec3 value; 120 | if (u_cull1._active && !cull) // if cull 1 is active and it hasnt already been determined that this point is to be culled 121 | { 122 | value= texelFetch(channelData,int(u_cull1._channelOffset+UV.x)).xyz; // get channel data out of texture buffer using the channel offset stored in the cull 123 | if (u_cull1._channelType == 0) // scalar 124 | { 125 | cull = floatCull(u_cull1._floatLLimit,u_cull1._floatULimit,value.x,u_cull1._cullType); 126 | } 127 | else // vector 128 | { 129 | cull = vecCull(u_cull1._vecLLimit,u_cull1._vecULimit,value,u_cull1._cullType); 130 | } 131 | } 132 | 133 | if (u_cull2._active && !cull) // if cull 2 is active and it hasnt already been determined that this point is to be culled 134 | { 135 | value= texelFetch(channelData,int(u_cull2._channelOffset+UV.x)).xyz; // get channel data out of texture buffer using the channel offset stored in the cull 136 | if (u_cull2._channelType == 0) // scalar 137 | { 138 | cull = floatCull(u_cull2._floatLLimit,u_cull2._floatULimit,value.x,u_cull2._cullType); 139 | } 140 | else 141 | { 142 | cull = vecCull(u_cull2._vecLLimit,u_cull2._vecULimit,value,u_cull2._cullType); 143 | } 144 | } 145 | else // vector 146 | { 147 | return cull; 148 | } 149 | 150 | if (u_cull3._active && !cull) // if cull 3 is active and it hasnt already been determined that this point is to be culled 151 | { 152 | value= texelFetch(channelData,int(u_cull3._channelOffset+UV.x)).xyz; // get channel data out of texture buffer using the channel offset stored in the cull 153 | if (u_cull3._channelType == 0) // scalar 154 | { 155 | cull = floatCull(u_cull3._floatLLimit,u_cull3._floatULimit,value.x,u_cull3._cullType); 156 | } 157 | else 158 | { 159 | cull = vecCull(u_cull3._vecLLimit,u_cull3._vecULimit,value,u_cull3._cullType); 160 | } 161 | } 162 | else // vector 163 | { 164 | return cull; 165 | } 166 | 167 | return cull; 168 | } 169 | 170 | void main() 171 | { 172 | if (b_draw == 0) // discarded due to LOD 173 | { 174 | discard; 175 | } 176 | 177 | if (u_cull == 1) 178 | { 179 | if (culled()) 180 | { 181 | discard; // discarded due to culling 182 | } 183 | } 184 | 185 | outColour = vec4(normal,1.0); 186 | } 187 | -------------------------------------------------------------------------------- /shaders/normalVertex.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file normalVertex.glsl 20 | /// @brief Vertex shader for the normal shader 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | /// @brief Model View Projection Matrix 30 | uniform mat4 MVP; 31 | 32 | layout (location=0)in vec3 inVert; 33 | layout (location=1)in vec2 inUV; 34 | layout (location=2)in vec3 inNormal; 35 | 36 | out vec2 UV; 37 | out vec3 normal; 38 | // id of whether or not to draw due to LOD 39 | flat out int b_draw; 40 | // value of s 41 | uniform float u_s; 42 | 43 | void calculate() 44 | { 45 | float m_s = u_s; // get value of s 46 | int id = int(inUV.x); // vertex number stored in UV.x 47 | if (mod(id,m_s) == 0.0) // if the modulus of the two is 0 then we cna draw this point 48 | { 49 | gl_Position = MVP*vec4(inVert,1.0); 50 | 51 | UV = inUV; 52 | normal = inNormal; 53 | b_draw = 1; // this will be drawn 54 | } 55 | else 56 | { 57 | b_draw = 0; 58 | } 59 | } 60 | 61 | void main() 62 | { 63 | calculate(); 64 | } 65 | -------------------------------------------------------------------------------- /shaders/vdbTreeFragment.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file vdbTreeFragment.glsl 20 | /// @brief Simple fragment shader for the VDB Tree rendering 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | uniform vec4 loadLevels; 30 | 31 | in vec2 UV; 32 | in vec3 normal; 33 | layout (location=0)out vec4 outColour; 34 | 35 | int queryDraw() // get if this level is to be drawn or not - if it is to be drawn, the corresponding vector value will be 1 36 | { 37 | if (UV.x == 0) 38 | { 39 | return int(loadLevels.x); 40 | } 41 | else if (UV.x == 1) 42 | { 43 | return int(loadLevels.y); 44 | } 45 | else if (UV.x == 2) 46 | { 47 | return int(loadLevels.z); 48 | } 49 | else if (UV.x == 3) 50 | { 51 | return int(loadLevels.w); 52 | } 53 | else 54 | { 55 | return -1; 56 | } 57 | } 58 | 59 | void main() 60 | { 61 | float query = queryDraw(); 62 | if (query != 1) 63 | { 64 | discard; // discard if not to be drawn 65 | } 66 | outColour = vec4(normal,1.0); 67 | } 68 | -------------------------------------------------------------------------------- /shaders/vdbTreeVertex.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /// @file vdbTreeVertex.glsl 20 | /// @brief Simple vertex shader for the VDB Tree rendering 21 | /// @author Callum James 22 | /// @version 1.0 23 | /// @date 12/02/2014 24 | /// Revision History: 25 | /// Initial Version 05/01/2014 26 | 27 | #version 400 core 28 | 29 | /// @brief Model View Projection Matrix 30 | uniform mat4 MVP; 31 | uniform vec4 loadLevels; 32 | 33 | layout (location=0)in vec3 inVert; 34 | layout (location=1)in vec2 inUV; 35 | layout (location=2)in vec3 inNormal; 36 | 37 | out vec2 UV; 38 | out vec3 normal; 39 | 40 | void main() 41 | { 42 | gl_Position = MVP*vec4(inVert,1.0); // simply project the point 43 | 44 | UV = inUV; 45 | normal = inNormal; 46 | } 47 | -------------------------------------------------------------------------------- /src/AMDDefines.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include "AMDDefines.h" 20 | 21 | // http://www.geeks3d.com/20100531/programming-tips-how-to-know-the-graphics-memory-size-and-usage-in-opengl/ 22 | 23 | //int AMDDef::totalGPUMemKB() 24 | //{ 25 | // // currently not supported as I have no AMD card to test on 26 | // // this code ha sbeen taken from the above website but I cannot gurantee it 27 | // // there has been commeneted out for now 28 | // /* 29 | // UINT n = wglGetGPUIDsAMD(0, 0); 30 | // UINT *ids = new UINT[n]; 31 | // size_t total_mem_mb = 0; 32 | // wglGetGPUIDsAMD(n, ids); 33 | // wglGetGPUInfoAMD(ids[0],WGL_GPU_RAM_AMD,GL_UNSIGNED_INT,sizeof(size_t),&total_mem_mb); 34 | // return total_mem_mb; 35 | // */ 36 | // return -1; 37 | //} 38 | -------------------------------------------------------------------------------- /src/AboutWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "AboutWindow.h" 2 | #include "ui_AboutWindow.h" 3 | 4 | #include "MainWindow.h" 5 | 6 | AboutWindow::AboutWindow(QWidget *parent) : QDialog(parent), m_ui(new Ui::AboutWindow) 7 | { 8 | m_ui->setupUi(this); 9 | connectAndInit(); 10 | } 11 | 12 | AboutWindow::~AboutWindow() 13 | { 14 | delete m_ui; 15 | } 16 | 17 | void AboutWindow::connectAndInit() 18 | { 19 | connect(m_ui->btn_close,SIGNAL(clicked(bool)),this,SLOT(close())); 20 | } 21 | 22 | void AboutWindow::setParentWindow(MainWindow *_parent) 23 | { 24 | if (_parent) 25 | { 26 | m_parentWindow = _parent; 27 | m_parentWindowConnected = true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Camera.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Jon Macey 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | /* 20 | * This class has been taken from the Camera class of Jon Maceys NGL 21 | * A few modifications have been made to make it reliable only on GL and openvdb libraries 22 | * http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib 23 | */ 24 | 25 | #include 26 | #include "Camera.h" 27 | #include "Utilities.h" 28 | 29 | const static float CAMERANEARLIMIT=0.00001f; 30 | 31 | Camera::Camera() 32 | { 33 | m_nearPlane=0.0001f; 34 | m_farPlane=350.0f; 35 | m_width=720.0f; 36 | m_height=576.0f; 37 | m_aspect=m_width/m_height; 38 | m_FOV=45.0f; 39 | m_eye[0] = 1.0; 40 | m_eye[1] = 1.0; 41 | m_eye[2]= 1.0; 42 | m_eye[3] = 1.0; 43 | } 44 | 45 | Camera::Camera(openvdb::Vec3f _eye, openvdb::Vec3f _look, openvdb::Vec3f _up) 46 | { 47 | setDefaultCamera(); 48 | set(_eye,_look,_up); 49 | } 50 | 51 | void Camera::setDefaultCamera() 52 | { 53 | m_eye[0] = 1.0; 54 | m_eye[1] = 1.0; 55 | m_eye[2] = 1.0; 56 | m_eye[3] = 1.0; 57 | 58 | m_look[0] = 0.0; 59 | m_look[1] = 0.0; 60 | m_look[2] = 0.0; 61 | m_look[3] = 0.0; 62 | 63 | m_up[0] = 0.0; 64 | m_up[1] = 1.0; 65 | m_up[2] = 0.0; 66 | m_up[3] = 1.0; 67 | 68 | m_nearPlane=0.0001f; 69 | m_farPlane=350.0f; 70 | m_aspect=720.0f/576.0f; 71 | m_FOV=45.0f; 72 | 73 | setShape(m_FOV, m_aspect, m_nearPlane, m_farPlane); 74 | set(openvdb::Vec3f(5.0, 5.0, 5.0),openvdb::Vec3f( 0.0, 0.0, 0.0),openvdb::Vec3f(0, 1, 0)); 75 | } 76 | 77 | void Camera::roll(float _angle) 78 | { 79 | rotAxes(m_u, m_v, -_angle); 80 | setViewMatrix(); 81 | } 82 | 83 | void Camera::pitch(float _angle) 84 | { 85 | rotAxes(m_n, m_v, _angle); 86 | setViewMatrix(); 87 | } 88 | 89 | void Camera::yaw(float _angle) 90 | { 91 | rotAxes(m_u, m_n, _angle); 92 | setViewMatrix(); 93 | } 94 | 95 | void Camera::slide(float _du, float _dv, float _dn) 96 | { 97 | m_eye[0] = m_eye.x() + (_du * m_u.x() + _dv * m_v.x() + _dn * m_n.x()); 98 | m_eye[1] = m_eye.y() + (_du * m_u.y() + _dv * m_v.y() + _dn * m_n.y()); 99 | m_eye[2] = m_eye.z() + (_du * m_u.z() + _dv * m_v.z() + _dn * m_n.z()); 100 | setViewMatrix(); 101 | } 102 | 103 | void Camera::set(const openvdb::Vec3f &_eye, const openvdb::Vec3f &_look, const openvdb::Vec3f &_up) 104 | { 105 | m_eye=openvdb::Vec4s(_eye.x(),_eye.y(),_eye.z(),0.0); 106 | m_look=openvdb::Vec4s(_look.x(),_look.y(),_look.z(),0.0); 107 | m_up=openvdb::Vec4s(_up.x(),_up.y(),_up.z(),0.0); 108 | m_n=m_eye-m_look; 109 | openvdb::Vec3f u3,v3; 110 | u3 = m_up.getVec3().cross(m_n.getVec3()); 111 | m_u=openvdb::Vec4f(u3.x(),u3.y(),u3.z(),0.0f); 112 | v3 = m_n.getVec3().cross(m_u.getVec3()); 113 | m_v=openvdb::Vec4f(v3.x(),v3.y(),v3.z(),0.0f); 114 | m_u.normalize(); 115 | m_v.normalize(); 116 | m_n.normalize(); 117 | setViewMatrix(); 118 | } 119 | 120 | void Camera::setShape(float _viewAngle, float _aspect, float _near, float _far) 121 | { 122 | if(_viewAngle >180.0) 123 | { 124 | _viewAngle=180.0; 125 | } 126 | ; 127 | if(_near. 16 | */ 17 | 18 | 19 | #include "Grid.h" 20 | 21 | Grid::Grid(float _width, float _depth, int _subdivs) 22 | { 23 | // init parameters 24 | m_width = _width; 25 | m_depth = _depth; 26 | m_subdivs = _subdivs; 27 | // ensure vertices vector is empty 28 | m_verts.resize(0); 29 | 30 | m_created = false; 31 | 32 | // zero the transform matrix 33 | m_transform.setIdentity(); 34 | } 35 | 36 | Grid::~Grid() 37 | { 38 | // empty destructor 39 | } 40 | 41 | void Grid::draw() 42 | { 43 | if (!m_created) 44 | { 45 | // if it hasnt been created then cant draw so just return 46 | return; 47 | } 48 | // bind, draw and then unbind 49 | m_vao->bind(); 50 | m_vao->draw(); 51 | m_vao->unbind(); 52 | } 53 | 54 | void Grid::create() 55 | { 56 | // ######################################################################### 57 | // function taken from Jon Maceys NGL function for creating a grid 58 | // http://nccastaff.bmth.ac.uk/jmacey/GraphicsLib 59 | m_vao = new VAO(GL_LINES); 60 | m_vao->create(); 61 | vDat vert; 62 | 63 | float wstep=m_width/(float)m_subdivs; 64 | 65 | float ws2=m_width/2.0f; 66 | 67 | float v1=-ws2; 68 | 69 | 70 | float dstep=m_depth/(float)m_subdivs; 71 | 72 | float ds2=m_depth/2.0f; 73 | 74 | float v2=-ds2; 75 | 76 | for(int i=0; i<=m_subdivs; ++i) 77 | { 78 | // vertex 1 x,y,z 79 | vert.x=-ws2; // x 80 | vert.z=v1; // y 81 | vert.y=0.0; // z 82 | m_verts.push_back(vert); 83 | // vertex 2 x,y,z 84 | vert.x=ws2; // x 85 | vert.z=v1; // y 86 | m_verts.push_back(vert); 87 | 88 | 89 | // vertex 1 x,y,z 90 | vert.x=v2; // x 91 | vert.z=ds2; // y 92 | m_verts.push_back(vert); 93 | // vertex 2 x,y,z 94 | vert.x=v2; // x 95 | vert.z=-ds2; // y 96 | m_verts.push_back(vert); 97 | 98 | 99 | 100 | // now change our step value 101 | v1+=wstep; 102 | v2+=dstep; 103 | } 104 | // ######################################################################### 105 | 106 | // bind and set data for the VAO 107 | m_vao->bind(); 108 | m_vao->setData(m_verts.size()*sizeof(vDat),m_verts[0].u); 109 | m_vao->vertexAttribPointer(0,3,GL_FLOAT,sizeof(vDat),5); 110 | m_vao->setIndicesCount(m_verts.size()); 111 | m_vao->unbind(); 112 | 113 | // set as created 114 | m_created = true; 115 | } 116 | -------------------------------------------------------------------------------- /src/InformationWindow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include "InformationWindow.h" 20 | #include "ui_Information.h" 21 | 22 | #include 23 | 24 | // Most of the functions in this class are setters for attributes and UI labels 25 | 26 | InformationWindow::InformationWindow(QWidget *parent) :QWidget(parent), m_ui(new Ui::Information) 27 | { 28 | m_ui->setupUi(this); 29 | m_mainWindowConnected = false; 30 | } 31 | 32 | InformationWindow::~InformationWindow() 33 | { 34 | // ensure table is removed before deletion 35 | removeInfoTable(); 36 | clearInfoTable(); 37 | delete m_ui; 38 | } 39 | 40 | void InformationWindow::setMainWindow(QWidget *_mainWindow) 41 | { 42 | // set main window parent 43 | m_mainWindow = _mainWindow; 44 | m_mainWindowConnected = true; 45 | // connect up signals and slots 46 | connectUI(); 47 | } 48 | 49 | void InformationWindow::setGPUVendor(std::string _vendor) 50 | { 51 | m_ui->lbl_GPUVendorValue->setText(_vendor.c_str()); 52 | } 53 | 54 | void InformationWindow::setOpenGLVersion(std::string _version) 55 | { 56 | m_ui->lbl_OpenGLVersionValue->setText(_version.c_str()); 57 | } 58 | 59 | void InformationWindow::setRenderer(std::string _renderer) 60 | { 61 | m_ui->lbl_RendererValue->setText(_renderer.c_str()); 62 | } 63 | 64 | void InformationWindow::setTotalGPUMem(std::string _total) 65 | { 66 | m_ui->lbl_TotalGPUMemValue->setText(_total.c_str()); 67 | } 68 | 69 | void InformationWindow::setUsedGPUMem(std::string _used) 70 | { 71 | m_ui->lbl_UsedGPUMemValue->setText(_used.c_str()); 72 | } 73 | 74 | void InformationWindow::clearInfoTable() 75 | { 76 | // clear the data 77 | m_ui->tble_FileInfo->clear(); 78 | // as you are removing a row, the count will keep changing so keep looping whilst there are still rows 79 | while (m_ui->tble_FileInfo->rowCount() > 0) 80 | { 81 | // remove a row 82 | m_ui->tble_FileInfo->removeRow(0); 83 | } 84 | } 85 | 86 | void InformationWindow::removeInfoTable() 87 | { 88 | for (int i = 0; i < m_ui->tble_FileInfo->rowCount(); ++i) 89 | { 90 | // delete each item in the table 91 | delete m_ui->tble_FileInfo->item(i,0); 92 | delete m_ui->tble_FileInfo->item(i,1); 93 | } 94 | } 95 | 96 | void InformationWindow::initInfoTable() 97 | { 98 | // set up auto resizing in the table 99 | m_ui->tble_FileInfo->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); 100 | } 101 | 102 | void InformationWindow::insertTableRow(int _row) 103 | { 104 | // insert row at the given index 105 | m_ui->tble_FileInfo->insertRow(_row); 106 | } 107 | 108 | void InformationWindow::setTableItem(int _row, int _column, QString _text) 109 | { 110 | // create pointer from the item to set 111 | QTableWidgetItem *item = m_ui->tble_FileInfo->item(_row,_column); 112 | if (!item) // if the item doesnt already exist, create a new one 113 | { 114 | item = new QTableWidgetItem; 115 | m_ui->tble_FileInfo->setItem(_row,_column,item); 116 | } 117 | item->setText(_text); // set text 118 | if (_column == 0) 119 | { 120 | // if title column, set to bold 121 | QFont bold; 122 | bold.setBold(true); 123 | item->setFont(bold); 124 | } 125 | } 126 | 127 | void InformationWindow::quit(int _status) 128 | { 129 | close(); 130 | exit(_status); 131 | } 132 | 133 | void InformationWindow::connectUI() 134 | { 135 | if (m_mainWindowConnected) 136 | { 137 | // allows update button to get right information 138 | connect(m_ui->btn_updateUsedMemory,SIGNAL(clicked(bool)),m_mainWindow,SLOT(updateUsedGPUMem())); 139 | } 140 | else 141 | { 142 | std::cerr<<"Attempting to connect update button on information window when no main window specified - aborting!!"<key()) 150 | { 151 | case Qt::Key_Escape : {close();break;} 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /src/NVidiaDefines.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include "NVidiaDefines.h" 20 | 21 | //http://www.geeks3d.com/20100531/programming-tips-how-to-know-the-graphics-memory-size-and-usage-in-opengl/ 22 | 23 | GLint NVidiaDef::totalGPUMemKB() 24 | { 25 | // get the amount of total memory on the GPU 26 | GLint mem = 0; 27 | glGetIntegerv(GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX, 28 | &mem); 29 | return mem; 30 | } 31 | 32 | GLint NVidiaDef::currentAvailableGPUMemKB() 33 | { 34 | GLint mem = 0; 35 | // get the current available memory on the GPU 36 | glGetIntegerv(GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX, 37 | &mem); 38 | return mem; 39 | } 40 | -------------------------------------------------------------------------------- /src/Plane.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include "Plane.h" 19 | 20 | #include 21 | 22 | Plane::Plane() 23 | { 24 | //std::cout<<"Plane constructor called with no passed in Vectors - 3 needed!!"<. 16 | */ 17 | 18 | #include "Shader.h" 19 | 20 | #include 21 | #include 22 | 23 | // include for use of memset 24 | #include 25 | 26 | Shader::Shader() 27 | { 28 | #ifdef DEBUG 29 | std::cerr<<"Please pass a name and shader type to the constructor"< 0) 132 | { 133 | text = (char*)malloc(sizeof(char) * (count + 1)); 134 | count = fread(text, sizeof(char), count, file); 135 | text[count] = '\0'; 136 | } 137 | fclose(file); 138 | } 139 | } 140 | return text; 141 | } 142 | 143 | bool Shader::validateShader(GLuint shader, std::string _name) 144 | { 145 | const unsigned int BUFFER_SIZE = 512; 146 | char buffer[BUFFER_SIZE]; 147 | memset(buffer, 0, BUFFER_SIZE); 148 | GLsizei length = 0; 149 | 150 | glGetShaderInfoLog(shader, BUFFER_SIZE, &length, buffer); 151 | if (length > 0) 152 | { 153 | std::cerr << "Shader " << shader << " (" << _name << ") compile error: " << buffer << std::endl; 154 | return false; 155 | } 156 | return true; 157 | } 158 | // ################################################################################### 159 | -------------------------------------------------------------------------------- /src/ShaderFamily.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "ShaderFamily.h" 23 | 24 | ShaderFamily::ShaderFamily() 25 | { 26 | #ifdef DEBUG 27 | std::cerr<<"A name is needed for this shader family - no name provided"<getShaderHandle()); 69 | } 70 | 71 | void ShaderFamily::bindAttrib(GLuint _index, const std::string &_attribName) 72 | { 73 | // bind an attribute location 74 | glBindAttribLocation(m_familyID,_index,_attribName.c_str()); 75 | } 76 | 77 | void ShaderFamily::compile() 78 | { 79 | std::vector::iterator it; 80 | 81 | // loop through all shaders and compile all 82 | for (it = m_shaders.begin(); it!= m_shaders.end(); it++) 83 | { 84 | if (!(*it)->compiled()) 85 | { 86 | (*it)->compile(); 87 | } 88 | } 89 | } 90 | 91 | void ShaderFamily::link() 92 | { 93 | // link this shader family 94 | glLinkProgram(m_familyID); 95 | if (!validateProgram(m_familyID)) 96 | { 97 | return; 98 | } 99 | m_link = true; 100 | } 101 | 102 | GLuint ShaderFamily::getUniformLocation(const char *_name) 103 | { 104 | GLint loc = glGetUniformLocation( m_familyID ,_name); 105 | if (loc == -1) 106 | { 107 | std::cerr<<"Uniform \""<<_name<<"\" not found in GL Program \""< 0) 272 | { 273 | std::cerr << "Program " << program << " link error: " << buffer << std::endl; 274 | return false; 275 | } 276 | 277 | glValidateProgram(program); 278 | GLint status; 279 | glGetProgramiv(program, GL_VALIDATE_STATUS, &status); 280 | if (status == GL_FALSE) { 281 | std::cerr << "Error validating shader " << program << std::endl; 282 | return false; 283 | } 284 | return true; 285 | } 286 | -------------------------------------------------------------------------------- /src/Utilities.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include "Utilities.h" 20 | 21 | #include 22 | 23 | #include 24 | 25 | #ifdef DARWIN 26 | #include 27 | #endif 28 | 29 | #ifdef WIN32 30 | #include 31 | #endif 32 | 33 | float Utilities::u_radians(const float _deg) 34 | { 35 | return (_deg/180.0f) * M_PI; 36 | } 37 | 38 | float Utilities::u_degrees(const float _rad) 39 | { 40 | return (_rad / M_PI) * 180.0f; 41 | } 42 | 43 | std::string Utilities::glubyteToStdString(const GLubyte *_in) 44 | { 45 | // cast a GLubyte to a QString 46 | QString temp = QString((const char*)_in); 47 | // return the QString as a std::string 48 | return temp.toStdString(); 49 | } 50 | 51 | std::string Utilities::vdbCoordToStdString(const openvdb::Coord _in) 52 | { 53 | // use boost to cast the x, y and z paramters of a openvdb::coord to a string 54 | std::string coordStr = ""; 55 | coordStr += "[" + boost::lexical_cast(_in.x()) + ", "; 56 | coordStr += boost::lexical_cast(_in.y()) + ", "; 57 | coordStr += boost::lexical_cast(_in.z()) + "]"; 58 | return coordStr; 59 | } 60 | 61 | openvdb::Vec3f Utilities::getColourFromLevel(int _level) 62 | { 63 | // colour values taken from viewer in OpenVDB library 64 | // RenderModules.cc 65 | switch(_level) 66 | { 67 | case(0): 68 | { 69 | return openvdb::Vec3f(0.00608299f,0.279541f,0.625f); 70 | }break; 71 | case(1): 72 | { 73 | return openvdb::Vec3f(0.871f,0.394f,0.01916f); 74 | }break; 75 | case(2): 76 | { 77 | return openvdb::Vec3f(0.0432f,0.33f,0.0411023f); 78 | }break; 79 | case(3): 80 | { 81 | return openvdb::Vec3f(0.045f,0.045f,0.045f); 82 | }break; 83 | default: 84 | { 85 | return openvdb::Vec3f(0.0f,0.0f,0.0f); 86 | }break; 87 | } 88 | } 89 | 90 | GLenum Utilities::checkGLError() 91 | { 92 | GLenum errCode; 93 | errCode = glGetError(); 94 | if (errCode != 0) 95 | { 96 | std::cerr<<"GL ERROR: "< Utilities::u_Mat3ToFloatArray(openvdb::Mat3R _in) 102 | { 103 | // flatten a Mat3 and return as a single array of values to upload to the GPU 104 | std::vector m; 105 | m.resize(9); 106 | 107 | m[0] = (GLfloat)_in(0,0); 108 | m[1] = (GLfloat)_in(0,1); 109 | m[2] = (GLfloat)_in(0,2); 110 | m[3] = (GLfloat)_in(1,0); 111 | m[4] = (GLfloat)_in(1,1); 112 | m[5] = (GLfloat)_in(1,2); 113 | m[6] = (GLfloat)_in(2,0); 114 | m[7] = (GLfloat)_in(2,1); 115 | m[8] = (GLfloat)_in(2,2); 116 | 117 | return m; 118 | } 119 | 120 | std::vector Utilities::u_Mat4ToFloatArray(openvdb::Mat4s _in) 121 | { 122 | // flatten a Mat4 and return as a single array of values to upload to the GPU 123 | std::vector m; 124 | m.resize(16); 125 | 126 | m[0] = (GLfloat)_in(0,0); 127 | m[1] = (GLfloat)_in(0,1); 128 | m[2] = (GLfloat)_in(0,2); 129 | m[3] = (GLfloat)_in(0,3); 130 | m[4] = (GLfloat)_in(1,0); 131 | m[5] = (GLfloat)_in(1,1); 132 | m[6] = (GLfloat)_in(1,2); 133 | m[7] = (GLfloat)_in(1,3); 134 | m[8] = (GLfloat)_in(2,0); 135 | m[9] = (GLfloat)_in(2,1); 136 | m[10] = (GLfloat)_in(2,2); 137 | m[11] = (GLfloat)_in(2,3); 138 | m[12] = (GLfloat)_in(3,0); 139 | m[13] = (GLfloat)_in(3,1); 140 | m[14] = (GLfloat)_in(3,2); 141 | m[15] = (GLfloat)_in(3,3); 142 | 143 | return m; 144 | } 145 | 146 | std::string Utilities::PLATFORM_FILE_PATH(std::string _path) 147 | { 148 | std::string prefixString; 149 | prefixString.clear(); 150 | 151 | #ifdef DARWIN 152 | char prefix[FILENAME_MAX]; 153 | CFBundleRef mainBundle = CFBundleGetMainBundle(); 154 | CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); 155 | 156 | if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)prefix, FILENAME_MAX)) 157 | { 158 | std::cerr<<"Could not get relative path of application bundle - exiting!"<. 16 | */ 17 | 18 | 19 | #include "VAO.h" 20 | #include "Utilities.h" 21 | 22 | #include 23 | 24 | VAO::VAO(GLenum _drawMode) 25 | { 26 | // set the draw mode 27 | m_drawMode = _drawMode; 28 | 29 | // default values 30 | m_arraysBound=false; 31 | m_indexed = false; 32 | m_indexType = GL_UNSIGNED_BYTE; 33 | m_indicesCount = 0; 34 | 35 | m_vboPointers.resize(0); 36 | } 37 | 38 | VAO::~VAO() 39 | { 40 | // empty destructor 41 | } 42 | 43 | void VAO::create() 44 | { 45 | // when create is called, a vertex array pointer is generated 46 | glGenVertexArrays(1,&m_vaPointer); 47 | Utilities::checkGLError(); 48 | } 49 | 50 | void VAO::bind() 51 | { 52 | // bind the VA and set bound to true 53 | glBindVertexArray(m_vaPointer); 54 | m_arraysBound = true; 55 | } 56 | 57 | void VAO::draw() 58 | { 59 | if (m_arraysBound) // only draw if bound 60 | { 61 | if (!m_indexed) 62 | { 63 | // draw without index 64 | glDrawArrays(m_drawMode,0,m_indicesCount); 65 | } 66 | else 67 | { 68 | // draw if indexed data 69 | glDrawElements(m_drawMode,m_indicesCount,m_indexType,(GLvoid*)((char*)NULL)); 70 | } 71 | } 72 | else 73 | { 74 | std::cerr<<"Attempting to draw without first binding!!"<. 16 | */ 17 | 18 | 19 | #include 20 | #include "MainWindow.h" 21 | 22 | int main(int argc, char **argv) 23 | { 24 | QApplication a(argc, argv); 25 | MainWindow w; 26 | w.show(); 27 | w.connectAndInit(); 28 | return a.exec(); 29 | } 30 | -------------------------------------------------------------------------------- /ui/AboutWindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AboutWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 279 10 | 363 11 | 12 | 13 | 14 | About OpenVDBViewer 15 | 16 | 17 | 18 | 19 | 20 | Qt::Horizontal 21 | 22 | 23 | 24 | 40 25 | 20 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Close 34 | 35 | 36 | 37 | 38 | 39 | 40 | Qt::Horizontal 41 | 42 | 43 | 44 | 40 45 | 20 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | Qt::Horizontal 56 | 57 | 58 | 59 | 40 60 | 20 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | :/res/icon_128 72 | 73 | 74 | 75 | 76 | 77 | 78 | Qt::Horizontal 79 | 80 | 81 | 82 | 40 83 | 20 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 20 93 | 75 94 | true 95 | 96 | 97 | 98 | OpenVDBViewer 99 | 100 | 101 | Qt::AlignCenter 102 | 103 | 104 | 105 | 106 | 107 | 108 | version 1.0.0 109 | 110 | 111 | Qt::AlignCenter 112 | 113 | 114 | 115 | 116 | 117 | 118 | Author: Callum James James 119 | 120 | 121 | Qt::AlignCenter 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 255 134 | 255 135 | 255 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 255 145 | 255 146 | 255 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 237 156 | 237 157 | 237 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | QFrame::NoFrame 166 | 167 | 168 | QFrame::Plain 169 | 170 | 171 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 172 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 173 | p, li { white-space: pre-wrap; } 174 | </style></head><body style=" font-family:'.Lucida Grande UI'; font-size:13pt; font-weight:400; font-style:normal;"> 175 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For any bug reports, improvements, fixes or anything else, email calj.james@btinternet.com</p></body></html> 176 | 177 | 178 | Qt::NoTextInteraction 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | -------------------------------------------------------------------------------- /ui/Information.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include "Information.h" 20 | #include "ui_Information.h" 21 | 22 | Information::Information(QWidget *parent) : 23 | QWidget(parent), 24 | ui(new Ui::Information) 25 | { 26 | ui->setupUi(this); 27 | } 28 | 29 | Information::~Information() 30 | { 31 | delete ui; 32 | } 33 | -------------------------------------------------------------------------------- /ui/Information.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __INFORMATION_H__ 20 | #define __INFORMATION_H__ 21 | 22 | #include 23 | 24 | namespace Ui { 25 | class Information; 26 | } 27 | 28 | /// @file Information.h 29 | /// @brief Information class is the information window 30 | /// @author Callum James 31 | /// @version 1.0 32 | /// @date 12/02/2014 33 | /// Revision History: 34 | /// Initial Version 05/01/2014 35 | /// @class Information 36 | /// @brief Class to contain the ui for the information window 37 | class Information : public QWidget 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | explicit Information(QWidget *parent = 0); 43 | ~Information(); 44 | 45 | private: 46 | Ui::Information *ui; 47 | }; 48 | 49 | #endif /* __INFORMATION_H__ */ 50 | -------------------------------------------------------------------------------- /ui/Information.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Information 4 | 5 | 6 | 7 | 0 8 | 0 9 | 354 10 | 628 11 | 12 | 13 | 14 | Information 15 | 16 | 17 | 18 | 19 | 20 | GPU Hardware Information 21 | 22 | 23 | 24 | 25 | 26 | 27 | 75 28 | true 29 | 30 | 31 | 32 | OpenGL Version 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 75 55 | true 56 | 57 | 58 | 59 | Renderer 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 75 | true 76 | 77 | 78 | 79 | Total GPU Memory 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 75 95 | true 96 | 97 | 98 | 99 | Used GPU Memory 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 75 108 | true 109 | 110 | 111 | 112 | GPU Vendor 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | Update Used Memory 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | Qt::Horizontal 137 | 138 | 139 | 140 | 141 | 142 | 143 | File Information 144 | 145 | 146 | 147 | 148 | 149 | QFrame::StyledPanel 150 | 151 | 152 | QFrame::Sunken 153 | 154 | 155 | QAbstractItemView::NoEditTriggers 156 | 157 | 158 | false 159 | 160 | 161 | false 162 | 163 | 164 | QAbstractItemView::SelectItems 165 | 166 | 167 | false 168 | 169 | 170 | true 171 | 172 | 173 | 0 174 | 175 | 176 | 2 177 | 178 | 179 | false 180 | 181 | 182 | false 183 | 184 | 185 | true 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /ui/MWindow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include "MWindow.h" 20 | #include "ui_MWindow.h" 21 | #include 22 | 23 | MWindow::MWindow(QWidget *parent) : 24 | QMainWindow(parent), 25 | ui(new Ui::MWindow) 26 | { 27 | ui->setupUi(this); 28 | } 29 | 30 | MWindow::~MWindow() 31 | { 32 | delete ui; 33 | } 34 | -------------------------------------------------------------------------------- /ui/MWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Callum James 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef __MWINDOW_H__ 20 | #define __MWINDOW_H__ 21 | 22 | #include 23 | 24 | namespace Ui { 25 | class MWindow; 26 | } 27 | 28 | /// @file MWindow.h 29 | /// @brief MWindow class is the class for the Main WIndow 30 | /// @author Callum James 31 | /// @version 1.0 32 | /// @date 12/02/2014 33 | /// Revision History: 34 | /// Initial Version 05/01/2014 35 | /// @class MWindow 36 | /// @brief MWindow class contains the ui and ui access for the main window of the application 37 | class MWindow : public QMainWindow 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | explicit MWindow(QWidget *parent = 0); 43 | ~MWindow(); 44 | 45 | private slots: 46 | 47 | private: 48 | Ui::MWindow *ui; 49 | }; 50 | 51 | #endif /* __MWINDOW_H__ */ 52 | -------------------------------------------------------------------------------- /ui/ui_AboutWindow.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'AboutWindow.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.2.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_ABOUTWINDOW_H 10 | #define UI_ABOUTWINDOW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class Ui_AboutWindow 27 | { 28 | public: 29 | QGridLayout *gridLayout; 30 | QSpacerItem *horizontalSpacer; 31 | QPushButton *btn_close; 32 | QSpacerItem *horizontalSpacer_2; 33 | QGridLayout *gridLayout_4; 34 | QSpacerItem *horizontalSpacer_3; 35 | QLabel *lbl_logo; 36 | QSpacerItem *horizontalSpacer_4; 37 | QLabel *lbl_ovdbv_3; 38 | QLabel *lbl_version_3; 39 | QLabel *lbl_author_3; 40 | QTextBrowser *textBrowser_3; 41 | 42 | void setupUi(QDialog *AboutWindow) 43 | { 44 | if (AboutWindow->objectName().isEmpty()) 45 | AboutWindow->setObjectName(QStringLiteral("AboutWindow")); 46 | AboutWindow->resize(279, 363); 47 | gridLayout = new QGridLayout(AboutWindow); 48 | gridLayout->setObjectName(QStringLiteral("gridLayout")); 49 | horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 50 | 51 | gridLayout->addItem(horizontalSpacer, 1, 0, 1, 1); 52 | 53 | btn_close = new QPushButton(AboutWindow); 54 | btn_close->setObjectName(QStringLiteral("btn_close")); 55 | 56 | gridLayout->addWidget(btn_close, 1, 1, 1, 1); 57 | 58 | horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 59 | 60 | gridLayout->addItem(horizontalSpacer_2, 1, 2, 1, 1); 61 | 62 | gridLayout_4 = new QGridLayout(); 63 | gridLayout_4->setObjectName(QStringLiteral("gridLayout_4")); 64 | horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 65 | 66 | gridLayout_4->addItem(horizontalSpacer_3, 1, 2, 1, 1); 67 | 68 | lbl_logo = new QLabel(AboutWindow); 69 | lbl_logo->setObjectName(QStringLiteral("lbl_logo")); 70 | lbl_logo->setPixmap(QPixmap(QString::fromUtf8(":/res/icon_128"))); 71 | 72 | gridLayout_4->addWidget(lbl_logo, 1, 1, 1, 1); 73 | 74 | horizontalSpacer_4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 75 | 76 | gridLayout_4->addItem(horizontalSpacer_4, 1, 0, 1, 1); 77 | 78 | lbl_ovdbv_3 = new QLabel(AboutWindow); 79 | lbl_ovdbv_3->setObjectName(QStringLiteral("lbl_ovdbv_3")); 80 | QFont font; 81 | font.setPointSize(20); 82 | font.setBold(true); 83 | font.setWeight(75); 84 | lbl_ovdbv_3->setFont(font); 85 | lbl_ovdbv_3->setAlignment(Qt::AlignCenter); 86 | 87 | gridLayout_4->addWidget(lbl_ovdbv_3, 0, 0, 1, 3); 88 | 89 | lbl_version_3 = new QLabel(AboutWindow); 90 | lbl_version_3->setObjectName(QStringLiteral("lbl_version_3")); 91 | lbl_version_3->setAlignment(Qt::AlignCenter); 92 | 93 | gridLayout_4->addWidget(lbl_version_3, 2, 0, 1, 3); 94 | 95 | lbl_author_3 = new QLabel(AboutWindow); 96 | lbl_author_3->setObjectName(QStringLiteral("lbl_author_3")); 97 | lbl_author_3->setAlignment(Qt::AlignCenter); 98 | 99 | gridLayout_4->addWidget(lbl_author_3, 3, 0, 1, 3); 100 | 101 | textBrowser_3 = new QTextBrowser(AboutWindow); 102 | textBrowser_3->setObjectName(QStringLiteral("textBrowser_3")); 103 | QPalette palette; 104 | QBrush brush(QColor(255, 255, 255, 0)); 105 | brush.setStyle(Qt::SolidPattern); 106 | palette.setBrush(QPalette::Active, QPalette::Base, brush); 107 | palette.setBrush(QPalette::Inactive, QPalette::Base, brush); 108 | QBrush brush1(QColor(237, 237, 237, 255)); 109 | brush1.setStyle(Qt::SolidPattern); 110 | palette.setBrush(QPalette::Disabled, QPalette::Base, brush1); 111 | textBrowser_3->setPalette(palette); 112 | textBrowser_3->setFrameShape(QFrame::NoFrame); 113 | textBrowser_3->setFrameShadow(QFrame::Plain); 114 | textBrowser_3->setTextInteractionFlags(Qt::NoTextInteraction); 115 | 116 | gridLayout_4->addWidget(textBrowser_3, 4, 0, 1, 3); 117 | 118 | 119 | gridLayout->addLayout(gridLayout_4, 0, 0, 1, 3); 120 | 121 | 122 | retranslateUi(AboutWindow); 123 | 124 | QMetaObject::connectSlotsByName(AboutWindow); 125 | } // setupUi 126 | 127 | void retranslateUi(QDialog *AboutWindow) 128 | { 129 | AboutWindow->setWindowTitle(QApplication::translate("AboutWindow", "About OpenVDBViewer", 0)); 130 | btn_close->setText(QApplication::translate("AboutWindow", "Close", 0)); 131 | lbl_logo->setText(QString()); 132 | lbl_ovdbv_3->setText(QApplication::translate("AboutWindow", "OpenVDBViewer", 0)); 133 | lbl_version_3->setText(QApplication::translate("AboutWindow", "version 1.0.0", 0)); 134 | lbl_author_3->setText(QApplication::translate("AboutWindow", "Author: Callum James James", 0)); 135 | textBrowser_3->setHtml(QApplication::translate("AboutWindow", "\n" 136 | "\n" 139 | "

For any bug reports, improvements, fixes or anything else, email calj.james@btinternet.com

", 0)); 140 | } // retranslateUi 141 | 142 | }; 143 | 144 | namespace Ui { 145 | class AboutWindow: public Ui_AboutWindow {}; 146 | } // namespace Ui 147 | 148 | QT_END_NAMESPACE 149 | 150 | #endif // UI_ABOUTWINDOW_H 151 | -------------------------------------------------------------------------------- /ui/ui_Information.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'Information.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.2.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_INFORMATION_H 10 | #define UI_INFORMATION_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | QT_BEGIN_NAMESPACE 27 | 28 | class Ui_Information 29 | { 30 | public: 31 | QVBoxLayout *verticalLayout; 32 | QGroupBox *gbox_hardwareInfo; 33 | QGridLayout *gridLayout_12; 34 | QLabel *lbl_OpenGLVersion; 35 | QLabel *lbl_RendererValue; 36 | QLabel *lbl_UsedGPUMemValue; 37 | QLabel *lbl_Renderer; 38 | QLabel *lbl_GPUVendorValue; 39 | QLabel *lbl_TotalGPUMem; 40 | QLabel *lbl_OpenGLVersionValue; 41 | QLabel *lbl_UsedGPUMem; 42 | QLabel *lbl_GPUVendor; 43 | QLabel *lbl_TotalGPUMemValue; 44 | QPushButton *btn_updateUsedMemory; 45 | QFrame *line; 46 | QGroupBox *gbox_fileInfo; 47 | QGridLayout *gridLayout_13; 48 | QTableWidget *tble_FileInfo; 49 | 50 | void setupUi(QWidget *Information) 51 | { 52 | if (Information->objectName().isEmpty()) 53 | Information->setObjectName(QStringLiteral("Information")); 54 | Information->resize(354, 628); 55 | verticalLayout = new QVBoxLayout(Information); 56 | verticalLayout->setObjectName(QStringLiteral("verticalLayout")); 57 | gbox_hardwareInfo = new QGroupBox(Information); 58 | gbox_hardwareInfo->setObjectName(QStringLiteral("gbox_hardwareInfo")); 59 | gridLayout_12 = new QGridLayout(gbox_hardwareInfo); 60 | gridLayout_12->setObjectName(QStringLiteral("gridLayout_12")); 61 | lbl_OpenGLVersion = new QLabel(gbox_hardwareInfo); 62 | lbl_OpenGLVersion->setObjectName(QStringLiteral("lbl_OpenGLVersion")); 63 | QFont font; 64 | font.setBold(true); 65 | font.setWeight(75); 66 | lbl_OpenGLVersion->setFont(font); 67 | 68 | gridLayout_12->addWidget(lbl_OpenGLVersion, 1, 0, 1, 1); 69 | 70 | lbl_RendererValue = new QLabel(gbox_hardwareInfo); 71 | lbl_RendererValue->setObjectName(QStringLiteral("lbl_RendererValue")); 72 | 73 | gridLayout_12->addWidget(lbl_RendererValue, 2, 1, 1, 1); 74 | 75 | lbl_UsedGPUMemValue = new QLabel(gbox_hardwareInfo); 76 | lbl_UsedGPUMemValue->setObjectName(QStringLiteral("lbl_UsedGPUMemValue")); 77 | 78 | gridLayout_12->addWidget(lbl_UsedGPUMemValue, 4, 1, 1, 1); 79 | 80 | lbl_Renderer = new QLabel(gbox_hardwareInfo); 81 | lbl_Renderer->setObjectName(QStringLiteral("lbl_Renderer")); 82 | lbl_Renderer->setFont(font); 83 | 84 | gridLayout_12->addWidget(lbl_Renderer, 2, 0, 1, 1); 85 | 86 | lbl_GPUVendorValue = new QLabel(gbox_hardwareInfo); 87 | lbl_GPUVendorValue->setObjectName(QStringLiteral("lbl_GPUVendorValue")); 88 | 89 | gridLayout_12->addWidget(lbl_GPUVendorValue, 0, 1, 1, 1); 90 | 91 | lbl_TotalGPUMem = new QLabel(gbox_hardwareInfo); 92 | lbl_TotalGPUMem->setObjectName(QStringLiteral("lbl_TotalGPUMem")); 93 | lbl_TotalGPUMem->setFont(font); 94 | 95 | gridLayout_12->addWidget(lbl_TotalGPUMem, 3, 0, 1, 1); 96 | 97 | lbl_OpenGLVersionValue = new QLabel(gbox_hardwareInfo); 98 | lbl_OpenGLVersionValue->setObjectName(QStringLiteral("lbl_OpenGLVersionValue")); 99 | 100 | gridLayout_12->addWidget(lbl_OpenGLVersionValue, 1, 1, 1, 1); 101 | 102 | lbl_UsedGPUMem = new QLabel(gbox_hardwareInfo); 103 | lbl_UsedGPUMem->setObjectName(QStringLiteral("lbl_UsedGPUMem")); 104 | lbl_UsedGPUMem->setFont(font); 105 | 106 | gridLayout_12->addWidget(lbl_UsedGPUMem, 4, 0, 1, 1); 107 | 108 | lbl_GPUVendor = new QLabel(gbox_hardwareInfo); 109 | lbl_GPUVendor->setObjectName(QStringLiteral("lbl_GPUVendor")); 110 | lbl_GPUVendor->setFont(font); 111 | 112 | gridLayout_12->addWidget(lbl_GPUVendor, 0, 0, 1, 1); 113 | 114 | lbl_TotalGPUMemValue = new QLabel(gbox_hardwareInfo); 115 | lbl_TotalGPUMemValue->setObjectName(QStringLiteral("lbl_TotalGPUMemValue")); 116 | 117 | gridLayout_12->addWidget(lbl_TotalGPUMemValue, 3, 1, 1, 1); 118 | 119 | btn_updateUsedMemory = new QPushButton(gbox_hardwareInfo); 120 | btn_updateUsedMemory->setObjectName(QStringLiteral("btn_updateUsedMemory")); 121 | 122 | gridLayout_12->addWidget(btn_updateUsedMemory, 5, 1, 1, 1); 123 | 124 | 125 | verticalLayout->addWidget(gbox_hardwareInfo); 126 | 127 | line = new QFrame(Information); 128 | line->setObjectName(QStringLiteral("line")); 129 | line->setFrameShape(QFrame::HLine); 130 | line->setFrameShadow(QFrame::Sunken); 131 | 132 | verticalLayout->addWidget(line); 133 | 134 | gbox_fileInfo = new QGroupBox(Information); 135 | gbox_fileInfo->setObjectName(QStringLiteral("gbox_fileInfo")); 136 | gridLayout_13 = new QGridLayout(gbox_fileInfo); 137 | gridLayout_13->setObjectName(QStringLiteral("gridLayout_13")); 138 | tble_FileInfo = new QTableWidget(gbox_fileInfo); 139 | if (tble_FileInfo->columnCount() < 2) 140 | tble_FileInfo->setColumnCount(2); 141 | tble_FileInfo->setObjectName(QStringLiteral("tble_FileInfo")); 142 | tble_FileInfo->setFrameShape(QFrame::StyledPanel); 143 | tble_FileInfo->setFrameShadow(QFrame::Sunken); 144 | tble_FileInfo->setEditTriggers(QAbstractItemView::NoEditTriggers); 145 | tble_FileInfo->setDragDropOverwriteMode(false); 146 | tble_FileInfo->setAlternatingRowColors(false); 147 | tble_FileInfo->setSelectionBehavior(QAbstractItemView::SelectItems); 148 | tble_FileInfo->setShowGrid(false); 149 | tble_FileInfo->setCornerButtonEnabled(true); 150 | tble_FileInfo->setRowCount(0); 151 | tble_FileInfo->setColumnCount(2); 152 | tble_FileInfo->horizontalHeader()->setVisible(false); 153 | tble_FileInfo->verticalHeader()->setVisible(false); 154 | tble_FileInfo->verticalHeader()->setHighlightSections(true); 155 | 156 | gridLayout_13->addWidget(tble_FileInfo, 0, 0, 1, 1); 157 | 158 | 159 | verticalLayout->addWidget(gbox_fileInfo); 160 | 161 | 162 | retranslateUi(Information); 163 | 164 | QMetaObject::connectSlotsByName(Information); 165 | } // setupUi 166 | 167 | void retranslateUi(QWidget *Information) 168 | { 169 | Information->setWindowTitle(QApplication::translate("Information", "Information", 0)); 170 | gbox_hardwareInfo->setTitle(QApplication::translate("Information", "GPU Hardware Information", 0)); 171 | lbl_OpenGLVersion->setText(QApplication::translate("Information", "OpenGL Version", 0)); 172 | lbl_RendererValue->setText(QString()); 173 | lbl_UsedGPUMemValue->setText(QString()); 174 | lbl_Renderer->setText(QApplication::translate("Information", "Renderer", 0)); 175 | lbl_GPUVendorValue->setText(QString()); 176 | lbl_TotalGPUMem->setText(QApplication::translate("Information", "Total GPU Memory", 0)); 177 | lbl_OpenGLVersionValue->setText(QString()); 178 | lbl_UsedGPUMem->setText(QApplication::translate("Information", "Used GPU Memory", 0)); 179 | lbl_GPUVendor->setText(QApplication::translate("Information", "GPU Vendor", 0)); 180 | lbl_TotalGPUMemValue->setText(QString()); 181 | btn_updateUsedMemory->setText(QApplication::translate("Information", "Update Used Memory", 0)); 182 | gbox_fileInfo->setTitle(QApplication::translate("Information", "File Information", 0)); 183 | } // retranslateUi 184 | 185 | }; 186 | 187 | namespace Ui { 188 | class Information: public Ui_Information {}; 189 | } // namespace Ui 190 | 191 | QT_END_NAMESPACE 192 | 193 | #endif // UI_INFORMATION_H 194 | --------------------------------------------------------------------------------