From 838407ba4fd36d50f04a7012f25d5a3c10e1ac1b Mon Sep 17 00:00:00 2001 From: David Williams Date: Fri, 20 Feb 2015 16:20:09 +0100 Subject: [PATCH] Started splitting example framework into to two classes. One will be general purpose (for use in Cubiquity, etc), and the other will have PolyVox specific stuff. --- examples/Basic/CMakeLists.txt | 2 ++ examples/Basic/main.cpp | 6 ++--- examples/DecodeOnGPU/CMakeLists.txt | 2 ++ examples/DecodeOnGPU/main.cpp | 6 ++--- examples/OpenGL/CMakeLists.txt | 2 ++ examples/OpenGL/main.cpp | 6 ++--- examples/Paging/CMakeLists.txt | 2 ++ examples/Paging/main.cpp | 6 ++--- examples/SmoothLOD/CMakeLists.txt | 2 ++ examples/SmoothLOD/main.cpp | 6 ++--- examples/common/PolyVoxExample.cpp | 1 + examples/common/PolyVoxExample.h | 38 +++++++++++++++++++++++++++++ 12 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 examples/common/PolyVoxExample.cpp create mode 100644 examples/common/PolyVoxExample.h diff --git a/examples/Basic/CMakeLists.txt b/examples/Basic/CMakeLists.txt index 93fadf85..51156dc9 100644 --- a/examples/Basic/CMakeLists.txt +++ b/examples/Basic/CMakeLists.txt @@ -25,11 +25,13 @@ PROJECT(BasicExample) SET(SRC_FILES main.cpp ../common/OpenGLWidget.cpp + ../common/PolyVoxExample.cpp ) #Projects headers files SET(INC_FILES ../common/OpenGLWidget.h + ../common/PolyVoxExample.h ) #"Sources" and "Headers" are the group names in Visual Studio. diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index 9253ce30..8214574e 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "OpenGLWidget.h" +#include "PolyVoxExample.h" #include "PolyVox/CubicSurfaceExtractor.h" #include "PolyVox/MarchingCubesSurfaceExtractor.h" @@ -66,11 +66,11 @@ void createSphereInVolume(PagedVolume& volData, float fRadius) } } -class BasicExample : public OpenGLWidget +class BasicExample : public PolyVoxExample { public: BasicExample(QWidget *parent) - :OpenGLWidget(parent) + :PolyVoxExample(parent) { } diff --git a/examples/DecodeOnGPU/CMakeLists.txt b/examples/DecodeOnGPU/CMakeLists.txt index 7bbff8ba..063c2ffd 100644 --- a/examples/DecodeOnGPU/CMakeLists.txt +++ b/examples/DecodeOnGPU/CMakeLists.txt @@ -25,11 +25,13 @@ PROJECT(DecodeOnGPUExample) SET(SRC_FILES main.cpp ../common/OpenGLWidget.cpp + ../common/PolyVoxExample.cpp ) #Projects headers files SET(INC_FILES ../common/OpenGLWidget.h + ../common/PolyVoxExample.h ) #"Sources" and "Headers" are the group names in Visual Studio. diff --git a/examples/DecodeOnGPU/main.cpp b/examples/DecodeOnGPU/main.cpp index 74329df8..393d37fa 100644 --- a/examples/DecodeOnGPU/main.cpp +++ b/examples/DecodeOnGPU/main.cpp @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "OpenGLWidget.h" +#include "PolyVoxExample.h" #include "PolyVox/CubicSurfaceExtractor.h" #include "PolyVox/MarchingCubesSurfaceExtractor.h" @@ -66,11 +66,11 @@ void createSphereInVolume(PagedVolume& volData, float fRadius) } } -class DecodeOnGPUExample : public OpenGLWidget +class DecodeOnGPUExample : public PolyVoxExample { public: DecodeOnGPUExample(QWidget *parent) - :OpenGLWidget(parent) + :PolyVoxExample(parent) { } diff --git a/examples/OpenGL/CMakeLists.txt b/examples/OpenGL/CMakeLists.txt index 1fab7c69..c63ee818 100644 --- a/examples/OpenGL/CMakeLists.txt +++ b/examples/OpenGL/CMakeLists.txt @@ -30,6 +30,7 @@ SET(SRC_FILES #OpenGLSupport.cpp #OpenGLVertexBufferObjectSupport.cpp ../common/OpenGLWidget.cpp + ../common/PolyVoxExample.cpp Shapes.cpp ) @@ -39,6 +40,7 @@ SET(INC_FILES #OpenGLSupport.h #OpenGLVertexBufferObjectSupport.h ../common/OpenGLWidget.h + ../common/PolyVoxExample.h Shapes.h ) diff --git a/examples/OpenGL/main.cpp b/examples/OpenGL/main.cpp index 94802c4b..ce0fbfa3 100644 --- a/examples/OpenGL/main.cpp +++ b/examples/OpenGL/main.cpp @@ -31,7 +31,7 @@ freely, subject to the following restrictions: #include "Shapes.h" -#include "OpenGLWidget.h" +#include "PolyVoxExample.h" #ifdef WIN32 #include // Standard Header For Most Programs @@ -47,11 +47,11 @@ using namespace std; const int32_t g_uVolumeSideLength = 128; -class OpenGLExample : public OpenGLWidget +class OpenGLExample : public PolyVoxExample { public: OpenGLExample(QWidget *parent) - :OpenGLWidget(parent) + :PolyVoxExample(parent) { } diff --git a/examples/Paging/CMakeLists.txt b/examples/Paging/CMakeLists.txt index a0c626ac..f5fffe89 100644 --- a/examples/Paging/CMakeLists.txt +++ b/examples/Paging/CMakeLists.txt @@ -26,12 +26,14 @@ SET(SRC_FILES main.cpp ../common/OpenGLWidget.cpp Perlin.cpp + ../common/PolyVoxExample.cpp ) #Projects headers files SET(INC_FILES ../common/OpenGLWidget.h Perlin.h + ../common/PolyVoxExample.h ) #"Sources" and "Headers" are the group names in Visual Studio. diff --git a/examples/Paging/main.cpp b/examples/Paging/main.cpp index 8436d27e..012fb9d0 100644 --- a/examples/Paging/main.cpp +++ b/examples/Paging/main.cpp @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "OpenGLWidget.h" +#include "PolyVoxExample.h" #include "Perlin.h" #include "PolyVox/MaterialDensityPair.h" @@ -139,11 +139,11 @@ public: } }; -class PagingExample : public OpenGLWidget +class PagingExample : public PolyVoxExample { public: PagingExample(QWidget *parent) - :OpenGLWidget(parent) + :PolyVoxExample(parent) { } diff --git a/examples/SmoothLOD/CMakeLists.txt b/examples/SmoothLOD/CMakeLists.txt index 9b1ef6fc..492662bb 100644 --- a/examples/SmoothLOD/CMakeLists.txt +++ b/examples/SmoothLOD/CMakeLists.txt @@ -25,11 +25,13 @@ PROJECT(SmoothLODExample) SET(SRC_FILES main.cpp ../common/OpenGLWidget.cpp + ../common/PolyVoxExample.cpp ) #Projects headers files SET(INC_FILES ../common/OpenGLWidget.h + ../common/PolyVoxExample.h ) #"Sources" and "Headers" are the group names in Visual Studio. diff --git a/examples/SmoothLOD/main.cpp b/examples/SmoothLOD/main.cpp index 34b3a511..b6888334 100644 --- a/examples/SmoothLOD/main.cpp +++ b/examples/SmoothLOD/main.cpp @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "OpenGLWidget.h" +#include "PolyVoxExample.h" #include "PolyVox/Density.h" #include "PolyVox/MarchingCubesSurfaceExtractor.h" @@ -68,11 +68,11 @@ void createSphereInVolume(PagedVolume& volData, float fRadius) } } -class SmoothLODExample : public OpenGLWidget +class SmoothLODExample : public PolyVoxExample { public: SmoothLODExample(QWidget *parent) - :OpenGLWidget(parent) + :PolyVoxExample(parent) { } diff --git a/examples/common/PolyVoxExample.cpp b/examples/common/PolyVoxExample.cpp new file mode 100644 index 00000000..5dc86fd9 --- /dev/null +++ b/examples/common/PolyVoxExample.cpp @@ -0,0 +1 @@ +#include "PolyVoxExample.h" diff --git a/examples/common/PolyVoxExample.h b/examples/common/PolyVoxExample.h new file mode 100644 index 00000000..ee7231b2 --- /dev/null +++ b/examples/common/PolyVoxExample.h @@ -0,0 +1,38 @@ +/******************************************************************************* +Copyright (c) 2005-2009 David Williams + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not +claim that you wrote the original software. If you use this software +in a product, an acknowledgment in the product documentation would be +appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*******************************************************************************/ + +#ifndef __PolyVoxExample_H__ +#define __PolyVoxExample_H__ + +#include "OpenGLWidget.h" + +class PolyVoxExample : public OpenGLWidget +{ +public: + PolyVoxExample(QWidget *parent) + :OpenGLWidget(parent) + { + } +}; + +#endif //__PolyVoxExample_H__ \ No newline at end of file