├── ext ├── CMakeLists.txt └── GTEngine │ ├── Include │ ├── Mathematics │ │ ├── GteMinimumAreaCircle2.h │ │ ├── GteMinimumVolumeSphere3.h │ │ ├── GteEdgeKey.h │ │ ├── GteFIQuery.h │ │ ├── GteTIQuery.h │ │ ├── GteDCPQuery.h │ │ ├── GteASinEstimate.h │ │ ├── GteAxisAngle.h │ │ ├── GteIntrSphere3Frustum3.h │ │ ├── GteTriangleKey.h │ │ ├── GteDistPoint3Plane3.h │ │ ├── GteIntrCapsule3Capsule3.h │ │ └── GteIntrPlane3Ellipsoid3.h │ ├── Graphics │ │ ├── GL4 │ │ │ ├── GteOpenGLHelper.h │ │ │ ├── GteGL4DrawingState.h │ │ │ ├── GteGL4GraphicsObject.h │ │ │ ├── GteGL4TextureRT.h │ │ │ ├── GteGL4IndexBuffer.h │ │ │ ├── GteGL4TextureDS.h │ │ │ ├── GteGL4AtomicCounterBuffer.h │ │ │ ├── GteGL4ConstantBuffer.h │ │ │ ├── GteGL4SamplerState.h │ │ │ ├── GteGL4Texture1.h │ │ │ ├── GteGL4Texture2.h │ │ │ ├── GteGL4Texture3.h │ │ │ ├── GteGL4VertexBuffer.h │ │ │ ├── GteGL4TextureCube.h │ │ │ ├── GteGL4Texture2Array.h │ │ │ ├── GteGL4Texture1Array.h │ │ │ ├── GteGL4TextureCubeArray.h │ │ │ ├── GteGL4InputLayout.h │ │ │ ├── GteGLSLComputeProgram.h │ │ │ └── GteGL4Resource.h │ │ ├── GteTypedBuffer.h │ │ ├── DX11 │ │ │ ├── GteDX11DrawingState.h │ │ │ ├── GteHLSLSamplerState.h │ │ │ ├── GteHLSLByteAddressBuffer.h │ │ │ ├── GteHLSLTextureBuffer.h │ │ │ ├── GteHLSLResourceBindInfo.h │ │ │ ├── GteHLSLVisualProgram.h │ │ │ ├── GteHLSLComputeProgram.h │ │ │ ├── GteDX11TextureArray.h │ │ │ ├── GteDX11TextureSingle.h │ │ │ ├── GteDX11ConstantBuffer.h │ │ │ ├── GteHLSLFactory.h │ │ │ ├── GteHLSLTexture.h │ │ │ ├── GteDX11IndirectArgumentsBuffer.h │ │ │ ├── GteDX11VertexBuffer.h │ │ │ ├── GteHLSLTextureArray.h │ │ │ ├── GteDX11IndexBuffer.h │ │ │ ├── GteHLSLStructuredBuffer.h │ │ │ ├── GteDXGIAdapter.h │ │ │ ├── GteDX11BlendState.h │ │ │ ├── GteDX11SamplerState.h │ │ │ ├── GteDX11Texture1.h │ │ │ ├── GteDX11Texture3.h │ │ │ ├── GteDX11TextureRT.h │ │ │ ├── GteDX11TextureCube.h │ │ │ ├── GteDX11Texture1Array.h │ │ │ ├── GteDX11Texture2Array.h │ │ │ ├── GteDX11RasterizerState.h │ │ │ └── GteDX11GraphicsObject.h │ │ ├── GtePixelShader.h │ │ ├── GteTextureRT.h │ │ ├── GteVertexShader.h │ │ ├── GteComputeShader.h │ │ ├── GteGeometryShader.h │ │ ├── GteDrawingState.h │ │ ├── GteTexture1.h │ │ ├── GteBuffer.h │ │ ├── GteTexture1Array.h │ │ ├── GteRawBuffer.h │ │ ├── GteTextureDS.h │ │ ├── GteTexture2Array.h │ │ ├── GteMaterial.h │ │ ├── GteGEInputLayoutManager.h │ │ ├── GteTexture3.h │ │ ├── GteTextureCube.h │ │ ├── GteFontArialW400H18.h │ │ ├── GteGEDrawTarget.h │ │ ├── GteLight.h │ │ ├── GteMemberLayout.h │ │ ├── GteTexture2.h │ │ ├── GteLightCameraGeometry.h │ │ ├── GteGEObject.h │ │ ├── GteBillboardNode.h │ │ ├── GteControlledObject.h │ │ ├── GteComputeProgram.h │ │ ├── GteIndexFormat.h │ │ ├── GteTransformController.h │ │ ├── GteIndirectArgumentsBuffer.h │ │ ├── GteLighting.h │ │ └── GteRasterizerState.h │ ├── GTEnginePCH.h │ ├── Imagics │ │ └── GteMarchingCubesTable.h │ ├── Applications │ │ ├── GteTextureIO.h │ │ ├── MSW │ │ │ ├── DX11 │ │ │ │ ├── GteWindowSystem.h │ │ │ │ └── GteWindow.h │ │ │ └── WGL │ │ │ │ ├── GteWindowSystem.h │ │ │ │ └── GteWindow.h │ │ └── GLX │ │ │ └── GteWICFileIO.h │ ├── GTApplications.h │ ├── LowLevel │ │ ├── GteLogToStdout.h │ │ ├── MSW │ │ │ ├── GteLogToMessageBox.h │ │ │ └── GteLogToOutputWindow.h │ │ ├── GteWrapper.h │ │ ├── GteLogToFile.h │ │ ├── GteLogToStringArray.h │ │ ├── GteAtomicMinMax.h │ │ └── GteLogReporter.h │ ├── GTImagics.h │ ├── Physics │ │ ├── GteFluid2Parameters.h │ │ └── GteFluid3Parameters.h │ ├── GTEngine.h │ ├── GTWindows.h │ └── GTLowLevel.h │ ├── Source │ ├── GTEnginePCH.cpp │ ├── Graphics │ │ ├── GteDrawingState.cpp │ │ ├── DX11 │ │ │ ├── GteDX11Shader.cpp │ │ │ ├── GteDX11DrawingState.cpp │ │ │ ├── GteDX11TextureArray.cpp │ │ │ ├── GteHLSLVisualProgram.cpp │ │ │ ├── GteDX11TextureSingle.cpp │ │ │ ├── GteHLSLComputeProgram.cpp │ │ │ ├── GteHLSLSamplerState.cpp │ │ │ ├── GteHLSLTextureBuffer.cpp │ │ │ ├── GteHLSLConstantBuffer.cpp │ │ │ ├── GteHLSLResourceBindInfo.cpp │ │ │ └── GteHLSLByteAddressBuffer.cpp │ │ ├── GteVisualProgram.cpp │ │ ├── GteComputeProgram.cpp │ │ ├── GL4 │ │ │ ├── GteGL4DrawingState.cpp │ │ │ ├── GteGL4GraphicsObject.cpp │ │ │ ├── GLX │ │ │ │ └── GteGLXExtensions.cpp │ │ │ ├── GteGL4VertexBuffer.cpp │ │ │ ├── GteGL4TextureDS.cpp │ │ │ ├── GteGLSLComputeProgram.cpp │ │ │ ├── GteGL4TextureRT.cpp │ │ │ ├── GteGL4ConstantBuffer.cpp │ │ │ ├── GteGL4IndexBuffer.cpp │ │ │ ├── GteGL4AtomicCounterBuffer.cpp │ │ │ └── GteGLSLVisualProgram.cpp │ │ ├── GteRawBuffer.cpp │ │ ├── GteBuffer.cpp │ │ ├── GteGEDrawTarget.cpp │ │ ├── GteGEObject.cpp │ │ ├── GteMaterial.cpp │ │ ├── GteTypedBuffer.cpp │ │ ├── GteVisualEffect.cpp │ │ ├── GteTextureRT.cpp │ │ ├── GteIndirectArgumentsBuffer.cpp │ │ ├── GteLight.cpp │ │ ├── GteLighting.cpp │ │ ├── GteTexture1.cpp │ │ ├── GteTextureSingle.cpp │ │ ├── GtePixelShader.cpp │ │ ├── GteVertexShader.cpp │ │ ├── GteComputeShader.cpp │ │ ├── GteTextureArray.cpp │ │ ├── GteTextureCube.cpp │ │ ├── GteGeometryShader.cpp │ │ ├── GteTexture1Array.cpp │ │ ├── GteRasterizerState.cpp │ │ ├── GteSamplerState.cpp │ │ ├── GteTextureDS.cpp │ │ ├── GtePickRecord.cpp │ │ ├── GteLightCameraGeometry.cpp │ │ ├── GteTransformController.cpp │ │ ├── GteTexture2Array.cpp │ │ ├── GteTextureCubeArray.cpp │ │ ├── GteDepthStencilState.cpp │ │ ├── GteTexture3.cpp │ │ ├── GteBlendState.cpp │ │ ├── GteTextureBuffer.cpp │ │ ├── GteTexture2.cpp │ │ ├── GteProgramDefines.cpp │ │ ├── GteGraphicsObject.cpp │ │ └── GteStructuredBuffer.cpp │ ├── LowLevel │ │ ├── GteLogToStdout.cpp │ │ ├── MSW │ │ │ ├── GteLogToOutputWindow.cpp │ │ │ └── GteLogToMessageBox.cpp │ │ ├── GteLogToStringArray.cpp │ │ └── GteWrapper.cpp │ ├── Mathematics │ │ └── GteEdgeKey.cpp │ └── Applications │ │ └── MSW │ │ ├── WGL │ │ └── GteWindow.cpp │ │ └── DX11 │ │ ├── GteWindow.cpp │ │ └── GteWindowSystem.cpp │ └── CMakeLists.txt ├── src ├── framefab │ ├── res │ │ └── images │ │ │ ├── copy.png │ │ │ ├── cut.png │ │ │ ├── new.png │ │ │ ├── open.png │ │ │ ├── paste.png │ │ │ └── save.png │ ├── QP.cpp │ ├── main.cpp │ ├── mainwindow.qrc │ ├── GraphCut.cpp │ ├── Loader.h │ ├── Loader.cpp │ ├── QPFactory.cpp │ ├── TSPLIB_Loader.h │ ├── mainwindow.ui │ ├── Timer.cpp │ ├── NormalCut.cpp │ ├── FiberPrintPARM.cpp │ └── CMakeLists.txt └── CMakeLists.txt ├── .gitignore ├── cmake ├── QtCommon.cmake └── modules │ ├── FindMOSEK8.cmake~ │ ├── FindEigen.cmake │ └── FindMOSEK.cmake └── .gitattributes /ext/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(GTEngine) -------------------------------------------------------------------------------- /src/framefab/res/images/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exiinuh/FrameFab/HEAD/src/framefab/res/images/copy.png -------------------------------------------------------------------------------- /src/framefab/res/images/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exiinuh/FrameFab/HEAD/src/framefab/res/images/cut.png -------------------------------------------------------------------------------- /src/framefab/res/images/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exiinuh/FrameFab/HEAD/src/framefab/res/images/new.png -------------------------------------------------------------------------------- /src/framefab/res/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exiinuh/FrameFab/HEAD/src/framefab/res/images/open.png -------------------------------------------------------------------------------- /src/framefab/res/images/paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exiinuh/FrameFab/HEAD/src/framefab/res/images/paste.png -------------------------------------------------------------------------------- /src/framefab/res/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exiinuh/FrameFab/HEAD/src/framefab/res/images/save.png -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${CMAKE_SOURCE_DIR}/ext 3 | ${CMAKE_SOURCE_DIR}/src 4 | ) 5 | 6 | add_subdirectory(framefab) 7 | -------------------------------------------------------------------------------- /src/framefab/QP.cpp: -------------------------------------------------------------------------------- 1 | #include "QP.h" 2 | 3 | std::ostream& operator<<(std::ostream& out, const QP& qp) 4 | { 5 | out << qp.report(); 6 | return out; 7 | } -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteMinimumAreaCircle2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exiinuh/FrameFab/HEAD/ext/GTEngine/Include/Mathematics/GteMinimumAreaCircle2.h -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteMinimumVolumeSphere3.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exiinuh/FrameFab/HEAD/ext/GTEngine/Include/Mathematics/GteMinimumVolumeSphere3.h -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # no .a files 2 | *.a 3 | **.o 4 | 5 | **.cmake~ 6 | **.txt~ 7 | **.qrc~ 8 | 9 | ext/GTEngine/build/** 10 | 11 | build/** 12 | .idea/** 13 | cmake-build-debug/** 14 | -------------------------------------------------------------------------------- /src/framefab/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); 7 | 8 | QApplication a(argc, argv); 9 | MainWindow w; 10 | w.show(); 11 | return a.exec(); 12 | } 13 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/GTEnginePCH.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /src/framefab/mainwindow.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | res/images/copy.png 4 | res/images/cut.png 5 | res/images/new.png 6 | res/images/open.png 7 | res/images/paste.png 8 | res/images/save.png 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/framefab/GraphCut.cpp: -------------------------------------------------------------------------------- 1 | #include "GraphCut.h" 2 | 3 | 4 | GraphCut::GraphCut() 5 | { 6 | ptr_frame_ = NULL; 7 | ptr_path_ = NULL; 8 | 9 | terminal_output_ = false; 10 | file_output_ = false; 11 | } 12 | 13 | 14 | GraphCut::~GraphCut() 15 | { 16 | } 17 | 18 | 19 | void GraphCut::MakeLayers() 20 | { 21 | } 22 | 23 | 24 | void GraphCut::PrintOutTimer() 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /cmake/QtCommon.cmake: -------------------------------------------------------------------------------- 1 | macro(add_project_meta FILES_TO_INCLUDE) 2 | if (NOT RESOURCE_FOLDER) 3 | set(RESOURCE_FOLDER ${CMAKE_SOURCE_DIR}/res) 4 | endif() 5 | endmacro() 6 | 7 | macro(init_qt) 8 | # Let's do the CMake job for us 9 | set(CMAKE_AUTOMOC ON) # For meta object compiler 10 | set(CMAKE_AUTORCC ON) # Resource files 11 | set(CMAKE_AUTOUIC ON) # UI files 12 | endmacro() 13 | 14 | init_qt() 15 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteOpenGLHelper.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /cmake/modules/FindMOSEK8.cmake~: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find MOSEK8 3 | # Once done this will define 4 | # 5 | # MOSEK8_FOUND - system has MOSEK 6 | # MOSEK8_INCLUDE_DIRS - the MOSEK include directories 7 | # MOSEK8_LIBRARIES - Link these to use MOSEK 8 | # 9 | 10 | FIND_PATH(MOSEK_INCLUDE_DIR mosek.h 11 | PATHS /usr/local/mosek/8/tools/platform/osx64x86/h/ 12 | PATHS ~/mosek/8/tools/platform/osx64x86/h/ 13 | ) 14 | -------------------------------------------------------------------------------- /src/framefab/Loader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef SELF_ASSEMBLY_LOADER_H 4 | #define SELF_ASSEMBLY_LOADER_H 5 | 6 | #include 7 | 8 | 9 | class Loader{ 10 | 11 | private: 12 | Loader(){ ; } 13 | ~Loader(){ ; } 14 | 15 | public: 16 | 17 | static bool uniqueFilename(const std::string& filePathName, 18 | const std::string& fileExtension, 19 | std::string& uniqueFullFileName); 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/GTEnginePCH.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | // Define GTE_DISABLE_PCH to turn off the precompiled header system. 9 | #ifndef GTE_DISABLE_PCH 10 | #include 11 | #endif 12 | 13 | 14 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Imagics/GteMarchingCubesTable.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | extern GTE_IMPEXP int const gMarchingCubesTable[256][41]; 15 | } 16 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteDrawingState.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | DrawingState::DrawingState() 14 | { 15 | mType = GT_DRAWING_STATE; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteDX11Shader.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | DX11Shader::DX11Shader (Shader const* shader) 13 | : 14 | DX11GraphicsObject(shader) 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteVisualProgram.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | VisualProgram::~VisualProgram() 14 | { 15 | } 16 | 17 | VisualProgram::VisualProgram() 18 | { 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteComputeProgram.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | ComputeProgram::~ComputeProgram() 14 | { 15 | } 16 | 17 | ComputeProgram::ComputeProgram() 18 | { 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Applications/GteTextureIO.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #if defined(__MSWINDOWS__) 13 | #include 14 | #endif 15 | 16 | #if defined(__LINUX__) 17 | #include 18 | #endif 19 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGL4DrawingState.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | GL4DrawingState::GL4DrawingState(DrawingState const* gtState) 13 | : 14 | GL4GraphicsObject(gtState) 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteDX11DrawingState.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | DX11DrawingState::DX11DrawingState(DrawingState const* gtState) 13 | : 14 | DX11GraphicsObject(gtState) 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/GTApplications.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteDX11TextureArray.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | DX11TextureArray::DX11TextureArray(TextureArray const* gtTextureArray) 13 | : 14 | DX11Texture(gtTextureArray) 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteHLSLVisualProgram.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | HLSLVisualProgram::~HLSLVisualProgram() 14 | { 15 | } 16 | 17 | HLSLVisualProgram::HLSLVisualProgram() 18 | { 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteDX11TextureSingle.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | DX11TextureSingle::DX11TextureSingle(TextureSingle const* gtTextureSingle) 13 | : 14 | DX11Texture(gtTextureSingle) 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteHLSLComputeProgram.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | HLSLComputeProgram::~HLSLComputeProgram() 14 | { 15 | } 16 | 17 | HLSLComputeProgram::HLSLComputeProgram() 18 | { 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteRawBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | RawBuffer::RawBuffer(unsigned int numElements, bool createStorage) 14 | : 15 | Buffer(numElements, 4, createStorage) 16 | { 17 | mType = GT_RAW_BUFFER; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/LowLevel/GteLogToStdout.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP LogToStdout : public Logger::Listener 16 | { 17 | public: 18 | LogToStdout(int flags); 19 | 20 | private: 21 | virtual void Report(std::string const& message); 22 | }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | Buffer::Buffer(unsigned int numElements, size_t elementSize, 14 | bool createStorage) 15 | : 16 | Resource(numElements, elementSize, createStorage) 17 | { 18 | mType = GT_BUFFER; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteGEDrawTarget.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | GEDrawTarget::~GEDrawTarget() 13 | { 14 | } 15 | 16 | GEDrawTarget::GEDrawTarget(DrawTarget const* gtTarget) 17 | : 18 | mTarget(const_cast(gtTarget)) // conceptual constness 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/LowLevel/MSW/GteLogToMessageBox.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP LogToMessageBox : public Logger::Listener 16 | { 17 | public: 18 | LogToMessageBox(int flags); 19 | 20 | private: 21 | virtual void Report(std::string const& message); 22 | }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteGEObject.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | GEObject::~GEObject() 13 | { 14 | } 15 | 16 | GEObject::GEObject(GraphicsObject const* gtObject) 17 | : 18 | mGTObject(const_cast(gtObject)), // conceptual constness 19 | mName("") 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTypedBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP TypedBuffer : public Buffer 16 | { 17 | protected: 18 | // Abstract base class. 19 | TypedBuffer(unsigned int numElements, size_t elementSize, 20 | bool createStorage = true); 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/LowLevel/GteWrapper.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | // Wrappers around platform-specific low-level library calls. 14 | 15 | namespace gte 16 | { 17 | 18 | void Memcpy(void* target, void const* source, size_t count); 19 | void Memcpy(wchar_t* target, wchar_t const* source, size_t count); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/LowLevel/MSW/GteLogToOutputWindow.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP LogToOutputWindow : public Logger::Listener 16 | { 17 | public: 18 | LogToOutputWindow(int flags); 19 | 20 | private: 21 | virtual void Report(std::string const& message); 22 | }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteMaterial.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | Material::Material() 13 | : 14 | emissive({ 0.0f, 0.0f, 0.0f, 1.0f }), 15 | ambient({ 0.0f, 0.0f, 0.0f, 1.0f }), 16 | diffuse({ 0.0f, 0.0f, 0.0f, 1.0f }), 17 | specular({ 0.0f, 0.0f, 0.0f, 1.0f }) 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTypedBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | TypedBuffer::TypedBuffer(unsigned int numElements, size_t elementSize, 14 | bool createStorage) 15 | : 16 | Buffer(numElements, elementSize, createStorage) 17 | { 18 | mType = GT_TYPED_BUFFER; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteVisualEffect.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | VisualEffect::~VisualEffect() 14 | { 15 | } 16 | 17 | VisualEffect::VisualEffect() 18 | { 19 | } 20 | 21 | VisualEffect::VisualEffect(std::shared_ptr const& program) 22 | : 23 | mProgram(program) 24 | { 25 | } 26 | 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4DrawingState.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4DrawingState : public GL4GraphicsObject 17 | { 18 | protected: 19 | // Abstract base class. 20 | GL4DrawingState(DrawingState const* gtState); 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTextureRT.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | TextureRT::TextureRT(DFType format, unsigned int width, unsigned int height, 14 | bool hasMipmaps, bool createStorage) 15 | : 16 | Texture2(format, width, height, hasMipmaps, createStorage) 17 | { 18 | mType = GT_TEXTURE_RT; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11DrawingState.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11DrawingState : public DX11GraphicsObject 17 | { 18 | protected: 19 | // Abstract base class. 20 | DX11DrawingState(DrawingState const* gtState); 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteIndirectArgumentsBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | IndirectArgumentsBuffer::IndirectArgumentsBuffer(unsigned int numElements, 14 | bool createStorage) 15 | : 16 | Buffer(numElements, 4, createStorage) 17 | { 18 | mType = GT_INDIRECT_ARGUMENTS_BUFFER; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GtePixelShader.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP PixelShader : public Shader 16 | { 17 | public: 18 | // Construction. 19 | #if defined(GTE_DEV_OPENGL) 20 | PixelShader(GLSLReflection const& reflector); 21 | #else 22 | PixelShader(HLSLShader const& program); 23 | #endif 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTextureRT.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP TextureRT : public Texture2 16 | { 17 | public: 18 | // Construction for render targets. 19 | TextureRT(DFType format, unsigned int width, unsigned int height, 20 | bool hasMipmaps = false, bool createStorage = true); 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/LowLevel/GteLogToFile.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP LogToFile : public Logger::Listener 16 | { 17 | public: 18 | LogToFile(std::string const& filename, int flags); 19 | 20 | private: 21 | virtual void Report(std::string const& message); 22 | 23 | std::string mFilename; 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/LowLevel/GteLogToStdout.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | 14 | LogToStdout::LogToStdout(int flags) 15 | : 16 | Logger::Listener(flags) 17 | { 18 | } 19 | 20 | void LogToStdout::Report(std::string const& message) 21 | { 22 | std::cout << message.c_str() << std::flush; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/GTImagics.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteVertexShader.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP VertexShader : public Shader 16 | { 17 | public: 18 | // Construction. 19 | #if defined(GTE_DEV_OPENGL) 20 | VertexShader(GLSLReflection const& reflector); 21 | #else 22 | VertexShader(HLSLShader const& program); 23 | #endif 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteComputeShader.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP ComputeShader : public Shader 16 | { 17 | public: 18 | // Construction. 19 | #if defined(GTE_DEV_OPENGL) 20 | ComputeShader(GLSLReflection const& reflector); 21 | #else 22 | ComputeShader(HLSLShader const& program); 23 | #endif 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteGeometryShader.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP GeometryShader : public Shader 16 | { 17 | public: 18 | // Construction. 19 | #if defined(GTE_DEV_OPENGL) 20 | GeometryShader(GLSLReflection const& reflector); 21 | #else 22 | GeometryShader(HLSLShader const& program); 23 | #endif 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/framefab/Loader.cpp: -------------------------------------------------------------------------------- 1 | #include "Loader.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | #define MYOUT std::cout 9 | #define MYERR std::cerr 10 | 11 | bool Loader::uniqueFilename(const std::string &filePathName, 12 | const std::string &fileExtension, 13 | std::string &uniqueFullFileName) 14 | { 15 | int filen = 0; 16 | bool fexists = true; 17 | do{ //skip existing sequence files 18 | uniqueFullFileName = filePathName + std::to_string(filen) + fileExtension; 19 | std::ifstream iff(uniqueFullFileName); 20 | if (!iff.good()){ 21 | fexists = false; 22 | break; 23 | } 24 | ++filen; 25 | } while (filen < 100000); 26 | 27 | return !fexists; 28 | } -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteLight.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | //---------------------------------------------------------------------------- 13 | Light::Light(bool isPerspective, bool isDepthRangeZeroOne) 14 | : 15 | ViewVolume(isPerspective, isDepthRangeZeroOne) 16 | { 17 | } 18 | //---------------------------------------------------------------------------- 19 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteEdgeKey.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | template 16 | class EdgeKey : public FeatureKey<2, Ordered> 17 | { 18 | public: 19 | // An ordered edge has (V[0],V[1]) = (v0,v1). An unordered edge has 20 | // (V[0],V[1]) = (min(V[0],V[1]),max(V[0],V[1])). 21 | EdgeKey(int v0 = -1, int v1 = -1); 22 | }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteDrawingState.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP DrawingState : public GraphicsObject 16 | { 17 | protected: 18 | // Abstract base class for grouping state classes. This supports 19 | // simplification and reduction of member functions in the graphics engine 20 | // code. 21 | DrawingState(); 22 | }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/framefab/QPFactory.cpp: -------------------------------------------------------------------------------- 1 | #include "QPFactory.h" 2 | 3 | 4 | QP *QPFactory::make(QPFactory::QPType t, bool _storeVariables) 5 | { 6 | QP* qp = NULL; 7 | 8 | switch (t){ 9 | 10 | case QPTYPE_BEGIN: 11 | return qp; 12 | 13 | case QPMOSEKT: 14 | qp = new QPMosek(); 15 | break; 16 | 17 | case QPTYPE_END: 18 | return qp; 19 | } 20 | 21 | qp->setStoreVariables(_storeVariables); 22 | return qp; 23 | } 24 | 25 | void QPFactory::typeToString(QPFactory::QPType t, std::string &s) 26 | { 27 | switch (t){ 28 | case QPTYPE_BEGIN: s = std::string("Invalid QP Type"); 29 | break; 30 | case QPTYPE_END: s = std::string("Invalid QP Type"); 31 | break; 32 | break; 33 | case QPMOSEKT: s = std::string("QPMosek"); 34 | break; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTexture1.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP Texture1 : public TextureSingle 16 | { 17 | public: 18 | // Construction. 19 | Texture1(DFType format, unsigned int length, bool hasMipmaps = false, 20 | bool createStorage = true); 21 | 22 | // Texture dimensions. 23 | unsigned int GetLength() const; 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP Buffer : public Resource 17 | { 18 | protected: 19 | // Abstract base class. 20 | Buffer(unsigned int numElements, size_t elementSize, 21 | bool createStorage = true); 22 | }; 23 | 24 | typedef std::function const&)> BufferUpdater; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteLighting.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | Lighting::Lighting() 14 | : 15 | ambient({ 1.0f, 1.0f, 1.0f, 1.0f }), 16 | diffuse({ 1.0f, 1.0f, 1.0f, 1.0f }), 17 | specular({ 1.0f, 1.0f, 1.0f, 1.0f }), 18 | spotCutoff({ (float)GTE_C_HALF_PI, 0.0f, 1.0f, 1.0f }), 19 | attenuation({ 1.0f, 0.0f, 0.0f, 1.0f }) 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGL4GraphicsObject.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | GL4GraphicsObject::GL4GraphicsObject(GraphicsObject const* gtObject) 13 | : 14 | GEObject(gtObject), 15 | mGLHandle(0) 16 | { 17 | } 18 | 19 | void GL4GraphicsObject::SetName(std::string const& name) 20 | { 21 | // TODO: Determine how to tag OpenGL objects with names? 22 | mName = name; 23 | } 24 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/LowLevel/MSW/GteLogToOutputWindow.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | LogToOutputWindow::LogToOutputWindow(int flags) 14 | : 15 | Logger::Listener(flags) 16 | { 17 | } 18 | 19 | void LogToOutputWindow::Report(std::string const& message) 20 | { 21 | std::wstring text(message.begin(), message.end()); 22 | OutputDebugString(text.c_str()); 23 | } 24 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTexture1Array.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP Texture1Array : public TextureArray 16 | { 17 | public: 18 | // Construction. 19 | Texture1Array(unsigned int numItems, DFType format, unsigned int length, 20 | bool hasMipmaps = false, bool createStorage = true); 21 | 22 | // Texture dimensions. 23 | unsigned int GetLength() const; 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTexture1.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | Texture1::Texture1(DFType format, unsigned int length, bool hasMipmaps, 14 | bool createStorage) 15 | : 16 | TextureSingle(format, 1, length, 1, 1, hasMipmaps, createStorage) 17 | { 18 | mType = GT_TEXTURE1; 19 | } 20 | 21 | unsigned int Texture1::GetLength() const 22 | { 23 | return TextureSingle::GetDimension(0); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteRawBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP RawBuffer : public Buffer 16 | { 17 | public: 18 | // Construction. The element size is always 4 bytes. 19 | RawBuffer(unsigned int numElements, bool createStorage = true); 20 | 21 | public: 22 | // For use by the Shader class for storing reflection information. 23 | static int const shaderDataLookup = 3; 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTextureSingle.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | TextureSingle::TextureSingle(DFType format, unsigned int numDimensions, 14 | unsigned int dim0, unsigned int dim1, unsigned int dim2, bool hasMipmaps, 15 | bool createStorage) 16 | : 17 | Texture(1, format, numDimensions, dim0, dim1, dim2, hasMipmaps, 18 | createStorage) 19 | { 20 | mType = GT_TEXTURE_SINGLE; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLSamplerState.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP HLSLSamplerState : public HLSLResource 16 | { 17 | public: 18 | // Construction and destruction. 19 | virtual ~HLSLSamplerState(); 20 | 21 | HLSLSamplerState(D3D_SHADER_INPUT_BIND_DESC const& desc); 22 | 23 | HLSLSamplerState(D3D_SHADER_INPUT_BIND_DESC const& desc, 24 | unsigned int index); 25 | }; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GtePixelShader.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | #if defined(GTE_DEV_OPENGL) 13 | PixelShader::PixelShader(GLSLReflection const& reflector) 14 | : 15 | Shader(reflector, GLSLReflection::ST_PIXEL) 16 | { 17 | mType = GT_PIXEL_SHADER; 18 | } 19 | #else 20 | PixelShader::PixelShader(HLSLShader const& program) 21 | : 22 | Shader(program) 23 | { 24 | mType = GT_PIXEL_SHADER; 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTextureDS.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/11/13) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP TextureDS : public Texture2 16 | { 17 | public: 18 | // Construction for depth-stencil textures. 19 | TextureDS(DFType format, unsigned int width, unsigned int height, 20 | bool createStorage = true); 21 | 22 | void MakeShaderInput(); 23 | bool IsShaderInput() const; 24 | 25 | private: 26 | bool mShaderInput; 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteVertexShader.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | #if defined(GTE_DEV_OPENGL) 13 | VertexShader::VertexShader(GLSLReflection const& reflector) 14 | : 15 | Shader(reflector, GLSLReflection::ST_VERTEX) 16 | { 17 | mType = GT_VERTEX_SHADER; 18 | } 19 | #else 20 | VertexShader::VertexShader(HLSLShader const& program) 21 | : 22 | Shader(program) 23 | { 24 | mType = GT_VERTEX_SHADER; 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteComputeShader.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | #if defined(GTE_DEV_OPENGL) 13 | ComputeShader::ComputeShader(GLSLReflection const& reflector) 14 | : 15 | Shader(reflector, GLSLReflection::ST_COMPUTE) 16 | { 17 | mType = GT_COMPUTE_SHADER; 18 | } 19 | #else 20 | ComputeShader::ComputeShader(HLSLShader const& program) 21 | : 22 | Shader(program) 23 | { 24 | mType = GT_COMPUTE_SHADER; 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /src/framefab/TSPLIB_Loader.h: -------------------------------------------------------------------------------- 1 | // this loader class is specified for TSP loader to dataset : 2 | // http://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/ 3 | // Relative document of TSP MTZ formulation can be found at : 4 | // https://lost-contact.mit.edu/afs/md.kth.se/pkg/mosek/4/tools/doc/html/tools/node15.html 5 | 6 | #ifndef TSP_LOADER_H 7 | #define TSP_LOADER_H 8 | 9 | #include "iostream" 10 | #include 11 | #include 12 | #include "framefab/Statistics.h" 13 | 14 | class TSPLIB_Loader 15 | { 16 | public: 17 | typedef Eigen::SparseMatrix SpMat; 18 | 19 | public: 20 | TSPLIB_Loader(){ ; } 21 | virtual ~TSPLIB_Loader(){ ; } 22 | 23 | public: 24 | virtual bool loadFromFile(char *filename, int &N, SpMat *CostMatrix); // N : number of nodes in graph 25 | }; 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTextureArray.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | TextureArray::TextureArray(unsigned int numItems, DFType format, 14 | unsigned int numDimensions, unsigned int dim0, unsigned int dim1, 15 | unsigned int dim2, bool hasMipmaps, bool createStorage) 16 | : 17 | Texture(numItems, format, numDimensions, dim0, dim1, dim2, 18 | hasMipmaps, createStorage) 19 | { 20 | mType = GT_TEXTURE_ARRAY; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTextureCube.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | TextureCube::TextureCube(DFType format, unsigned int length, bool hasMipmaps, 14 | bool createStorage) 15 | : 16 | TextureArray(CubeFaceCount, format, 2, length, length, 1, hasMipmaps, createStorage) 17 | { 18 | mType = GT_TEXTURE_CUBE; 19 | } 20 | 21 | unsigned int TextureCube::GetLength() const 22 | { 23 | return TextureArray::GetDimension(0); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteGeometryShader.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | #if defined(GTE_DEV_OPENGL) 13 | GeometryShader::GeometryShader(GLSLReflection const& reflector) 14 | : 15 | Shader(reflector, GLSLReflection::ST_GEOMETRY) 16 | { 17 | mType = GT_GEOMETRY_SHADER; 18 | } 19 | #else 20 | GeometryShader::GeometryShader(HLSLShader const& program) 21 | : 22 | Shader(program) 23 | { 24 | mType = GT_GEOMETRY_SHADER; 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Applications/MSW/DX11/GteWindowSystem.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP WindowSystem : public MSWWindowSystem 17 | { 18 | public: 19 | virtual ~WindowSystem(); 20 | WindowSystem(); 21 | 22 | private: 23 | virtual void CreateEngineAndProgramFactory(MSWWindow::Parameters& parameters) override; 24 | }; 25 | 26 | extern GTE_IMPEXP WindowSystem TheWindowSystem; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Applications/MSW/WGL/GteWindowSystem.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP WindowSystem : public MSWWindowSystem 17 | { 18 | public: 19 | virtual ~WindowSystem(); 20 | WindowSystem(); 21 | 22 | private: 23 | virtual void CreateEngineAndProgramFactory(MSWWindow::Parameters& parameters) override; 24 | }; 25 | 26 | extern GTE_IMPEXP WindowSystem TheWindowSystem; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteHLSLSamplerState.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | HLSLSamplerState::~HLSLSamplerState() 14 | { 15 | } 16 | 17 | HLSLSamplerState::HLSLSamplerState(D3D_SHADER_INPUT_BIND_DESC const& desc) 18 | : 19 | HLSLResource(desc, 0) 20 | { 21 | } 22 | 23 | HLSLSamplerState::HLSLSamplerState(D3D_SHADER_INPUT_BIND_DESC const& desc, 24 | unsigned int index) 25 | : 26 | HLSLResource(desc, index, 0) 27 | { 28 | } 29 | 30 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GLX/GteGLXExtensions.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.2 (2016/07/06) 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | void* GetOpenGLFunctionPointer(char const* name) 13 | { 14 | return (void*)(*glXGetProcAddress)((GLubyte const*)name); 15 | } 16 | 17 | //void InitializeGLX() 18 | //{ 19 | //} 20 | 21 | //template 22 | //static void GetGLXFunction(char const* name, PGLXFunction& function) 23 | //{ 24 | // function = (PGLXFunction)glXGetProcAddress(name); 25 | //} 26 | 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTexture2Array.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP Texture2Array : public TextureArray 16 | { 17 | public: 18 | // Construction. 19 | Texture2Array(unsigned int numItems, DFType format, unsigned int width, 20 | unsigned int height, bool hasMipmaps = false, 21 | bool createStorage = true); 22 | 23 | // Texture dimensions. 24 | unsigned int GetWidth() const; 25 | unsigned int GetHeight() const; 26 | }; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTexture1Array.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | Texture1Array::Texture1Array(unsigned int numItems, DFType format, 14 | unsigned int length, bool hasMipmaps, bool createStorage) 15 | : 16 | TextureArray(numItems, format, 1, length, 1, 1, hasMipmaps, 17 | createStorage) 18 | { 19 | mType = GT_TEXTURE1_ARRAY; 20 | } 21 | 22 | unsigned int Texture1Array::GetLength() const 23 | { 24 | return TextureArray::GetDimension(0); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteRasterizerState.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | RasterizerState::RasterizerState() 14 | : 15 | fillMode(FILL_SOLID), 16 | cullMode(CULL_BACK), 17 | frontCCW(true), 18 | depthBias(0), 19 | depthBiasClamp(0.0f), 20 | slopeScaledDepthBias(0.0f), 21 | enableDepthClip(true), 22 | enableScissor(false), 23 | enableMultisample(false), 24 | enableAntialiasedLine(false) 25 | { 26 | mType = GT_RASTERIZER_STATE; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteMaterial.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP Material 16 | { 17 | public: 18 | // Construction. 19 | Material(); 20 | 21 | // (r,g,b,*): default (0,0,0,1) 22 | Vector4 emissive; 23 | 24 | // (r,g,b,*): default (0,0,0,1) 25 | Vector4 ambient; 26 | 27 | // (r,g,b,a): default (0,0,0,1) 28 | Vector4 diffuse; 29 | 30 | // (r,g,b,specularPower): default (0,0,0,1) 31 | Vector4 specular; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Physics/GteFluid2Parameters.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | struct GTE_IMPEXP Fluid2Parameters 16 | { 17 | Vector4 spaceDelta; // (dx, dy, 0, 0) 18 | Vector4 halfDivDelta; // (0.5/dx, 0.5/dy, 0, 0) 19 | Vector4 timeDelta; // (dt/dx, dt/dy, 0, dt) 20 | Vector4 viscosityX; // (velVX, velVX, 0, denVX) 21 | Vector4 viscosityY; // (velVY, velVY, 0, denVY) 22 | Vector4 epsilon; // (epsX, epsY, 0, eps0) 23 | }; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteGEInputLayoutManager.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class Shader; 16 | class VertexBuffer; 17 | 18 | class GTE_IMPEXP GEInputLayoutManager 19 | { 20 | public: 21 | // Abstract base interface. 22 | virtual ~GEInputLayoutManager() {} 23 | GEInputLayoutManager() {} 24 | 25 | virtual bool Unbind(VertexBuffer const* vbuffer) = 0; 26 | virtual bool Unbind(Shader const* vshader) = 0; 27 | virtual void UnbindAll() = 0; 28 | virtual bool HasElements() const = 0; 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTexture3.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP Texture3 : public TextureSingle 16 | { 17 | public: 18 | // Construction. 19 | Texture3(DFType format, unsigned int width, unsigned int height, 20 | unsigned int thickness, bool hasMipmaps = false, 21 | bool createStorage = true); 22 | 23 | // Texture dimensions. 24 | unsigned int GetWidth() const; 25 | unsigned int GetHeight() const; 26 | unsigned int GetThickness() const; 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTextureCube.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP TextureCube : public TextureArray 16 | { 17 | public: 18 | // Construction. Cube maps must be square; the 'length' parameter is the 19 | // shared value for width and height. 20 | TextureCube(DFType format, unsigned int length, bool hasMipmaps = false, 21 | bool createStorage = true); 22 | 23 | // The texture width and height are the same value. 24 | unsigned int GetLength() const; 25 | }; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Mathematics/GteEdgeKey.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | 11 | namespace gte 12 | { 13 | 14 | 15 | template<> 16 | EdgeKey::EdgeKey(int v0, int v1) 17 | { 18 | V[0] = v0; 19 | V[1] = v1; 20 | } 21 | 22 | template<> 23 | EdgeKey::EdgeKey(int v0, int v1) 24 | { 25 | if (v0 < v1) 26 | { 27 | // v0 is minimum 28 | V[0] = v0; 29 | V[1] = v1; 30 | } 31 | else 32 | { 33 | // v1 is minimum 34 | V[0] = v1; 35 | V[1] = v0; 36 | } 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteFontArialW400H18.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP FontArialW400H18 : public Font 16 | { 17 | public: 18 | // Construction. This is an embedded font that is generated by the 19 | // BitmapFontCreator tool. 20 | FontArialW400H18(std::shared_ptr const& factory, int maxMessageLength); 21 | 22 | private: 23 | static int msWidth; 24 | static int msHeight; 25 | static unsigned char msTexels[]; 26 | static float msCharacterData[]; 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteGEDrawTarget.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP GEDrawTarget 16 | { 17 | public: 18 | // Abstract base class. 19 | virtual ~GEDrawTarget(); 20 | protected: 21 | GEDrawTarget(DrawTarget const* gtTarget); 22 | 23 | public: 24 | // Member access. 25 | inline DrawTarget* GetDrawTarget() const; 26 | 27 | protected: 28 | DrawTarget* mTarget; 29 | }; 30 | 31 | inline DrawTarget* GEDrawTarget::GetDrawTarget() const 32 | { 33 | return mTarget; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteLight.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace gte 15 | { 16 | 17 | class GTE_IMPEXP Light : public ViewVolume 18 | { 19 | public: 20 | // Construction. The depth range for DirectX is [0,1] and for OpenGL is 21 | // [-1,1]. For DirectX, set isDepthRangeZeroToOne to true. For OpenGL, 22 | // set isDepthRangeZeroOne to false. 23 | Light(bool isPerspective, bool isDepthRangeZeroOne); 24 | 25 | std::shared_ptr lighting; 26 | }; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteSamplerState.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | SamplerState::SamplerState() 14 | : 15 | filter(MIN_P_MAG_P_MIP_P), 16 | mipLODBias(0.0f), 17 | maxAnisotropy(1), 18 | comparison(NEVER), 19 | borderColor({ 1.0f, 1.0f, 1.0f, 1.0f }), 20 | minLOD(-std::numeric_limits::max()), 21 | maxLOD(std::numeric_limits::max()) 22 | { 23 | mType = GT_SAMPLER_STATE; 24 | 25 | mode[0] = CLAMP; 26 | mode[1] = CLAMP; 27 | mode[2] = CLAMP; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/framefab/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | MainWindowClass 3 | 4 | 5 | MainWindowClass 6 | 7 | 8 | 9 | 0 10 | 0 11 | 600 12 | 400 13 | 14 | 15 | 16 | MainWindow 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/GTEngine.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.3 (2016/11/14) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #if !defined(__APPLE__) 15 | #include 16 | #include 17 | #endif 18 | 19 | #if defined(__MSWINDOWS__) 20 | #if defined(GTE_DEV_OPENGL) 21 | #include 22 | #elif defined(GTE_USE_DX12) 23 | #include 24 | #else 25 | #include 26 | #endif 27 | #endif 28 | 29 | #if defined(__LINUX__) 30 | #include 31 | #endif 32 | 33 | #if !defined(__APPLE__) 34 | #include 35 | #endif 36 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/LowLevel/GteLogToStringArray.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP LogToStringArray : public Logger::Listener 17 | { 18 | public: 19 | LogToStringArray(std::string const& name, int flags); 20 | 21 | std::string const& GetName() const; 22 | std::vector const& GetMessages() const; 23 | std::vector& GetMessages(); 24 | 25 | private: 26 | virtual void Report(std::string const& message); 27 | 28 | std::string mName; 29 | std::vector mMessages; 30 | }; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTextureDS.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/11/13) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | TextureDS::TextureDS(DFType format, unsigned int width, unsigned int height, 14 | bool createStorage) 15 | : 16 | Texture2(DataFormat::IsDepth(format) ? format : DF_D24_UNORM_S8_UINT, 17 | width, height, false, createStorage), 18 | mShaderInput(false) 19 | { 20 | mType = GT_TEXTURE_DS; 21 | } 22 | 23 | void TextureDS::MakeShaderInput() 24 | { 25 | mShaderInput = true; 26 | } 27 | 28 | bool TextureDS::IsShaderInput() const 29 | { 30 | return mShaderInput; 31 | } 32 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLByteAddressBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP HLSLByteAddressBuffer : public HLSLResource 16 | { 17 | public: 18 | // Construction and destruction. 19 | virtual ~HLSLByteAddressBuffer(); 20 | 21 | HLSLByteAddressBuffer(D3D_SHADER_INPUT_BIND_DESC const& desc); 22 | 23 | HLSLByteAddressBuffer(D3D_SHADER_INPUT_BIND_DESC const& desc, 24 | unsigned int index); 25 | 26 | // Member access. 27 | bool IsGpuWritable() const; 28 | 29 | private: 30 | bool mGpuWritable; 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GtePickRecord.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/06/26) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | PickRecord::~PickRecord() 13 | { 14 | } 15 | 16 | PickRecord::PickRecord() 17 | : 18 | primitiveType(IP_NONE), 19 | primitiveIndex(0), 20 | t(0.0f), 21 | linePoint({ 0.0f, 0.0f, 0.0f, 1.0f }), 22 | primitivePoint({ 0.0f, 0.0f, 0.0f, 1.0f }), 23 | distanceToLinePoint(0.0f), 24 | distanceToPrimitivePoint(0.0f), 25 | distanceBetweenLinePrimitive(0.0f) 26 | { 27 | for (int i = 0; i < 3; ++i) 28 | { 29 | vertexIndex[i] = 0; 30 | bary[i] = 0.0f; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLTextureBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP HLSLTextureBuffer : public HLSLBaseBuffer 16 | { 17 | public: 18 | // Construction and destruction. 19 | virtual ~HLSLTextureBuffer(); 20 | 21 | HLSLTextureBuffer(D3D_SHADER_INPUT_BIND_DESC const& desc, 22 | unsigned int numBytes, std::vector const& members); 23 | 24 | HLSLTextureBuffer(D3D_SHADER_INPUT_BIND_DESC const& desc, 25 | unsigned int index, unsigned int numBytes, 26 | std::vector const& members); 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteMemberLayout.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace gte 15 | { 16 | 17 | // Support for generation of lookup tables for constant buffers and texture 18 | // buffers. Given the name of a member of a buffer, get the offset into the 19 | // buffer memory where the member lives. The layout is specific to the 20 | // shading language (HLSL, GLSL). 21 | struct GTE_IMPEXP MemberLayout 22 | { 23 | std::string name; 24 | unsigned int offset; 25 | unsigned int numElements; 26 | }; 27 | 28 | typedef std::vector BufferLayout; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteLightCameraGeometry.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | LightCameraGeometry::LightCameraGeometry() 13 | : 14 | lightModelPosition({ 0.0f, 0.0f, 0.0f, 1.0f }), 15 | lightModelDirection({ 0.0f, 0.0f, -1.0f, 0.0f }), 16 | lightModelUp({ 0.0f, 1.0f, 0.0f, 0.0f }), 17 | lightModelRight({ 1.0f, 0.0f, 0.0f, 0.0f }), 18 | cameraModelPosition({ 0.0f, 0.0f, 0.0f, 1.0f }), 19 | cameraModelDirection({ 0.0f, 0.0f, -1.0f, 0.0f }), 20 | cameraModelUp({ 0.0f, 1.0f, 0.0f, 0.0f }), 21 | cameraModelRight({ 1.0f, 0.0f, 0.0f, 0.0f }) 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTransformController.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | 14 | TransformController::TransformController(Transform const& localTransform) 15 | : 16 | mLocalTransform(localTransform) 17 | { 18 | } 19 | 20 | bool TransformController::Update(double applicationTime) 21 | { 22 | if (!Controller::Update(applicationTime)) 23 | { 24 | return false; 25 | } 26 | 27 | Spatial* spatial = reinterpret_cast(mObject); 28 | spatial->localTransform = mLocalTransform; 29 | return true; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLResourceBindInfo.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP HLSLResourceBindInfo : public HLSLBaseBuffer 16 | { 17 | public: 18 | // Construction and destruction. 19 | virtual ~HLSLResourceBindInfo(); 20 | 21 | HLSLResourceBindInfo(D3D_SHADER_INPUT_BIND_DESC const& desc, 22 | unsigned int numBytes, std::vector const& members); 23 | 24 | HLSLResourceBindInfo(D3D_SHADER_INPUT_BIND_DESC const& desc, 25 | unsigned int index, unsigned int numBytes, 26 | std::vector const& members); 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Physics/GteFluid3Parameters.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | struct GTE_IMPEXP Fluid3Parameters 16 | { 17 | Vector4 spaceDelta; // (dx, dy, dz, 0) 18 | Vector4 halfDivDelta; // (0.5/dx, 0.5/dy, 0.5/dz, 0) 19 | Vector4 timeDelta; // (dt/dx, dt/dy, dt/dz, dt) 20 | Vector4 viscosityX; // (velVX, velVX, velVX, denVX) 21 | Vector4 viscosityY; // (velVX, velVY, velVY, denVY) 22 | Vector4 viscosityZ; // (velVZ, velVZ, velVZ, denVZ) 23 | Vector4 epsilon; // (epsX, epsY, epsZ, eps0) 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLVisualProgram.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP HLSLVisualProgram : public VisualProgram 16 | { 17 | public: 18 | // A simple stub to add HLSL as part of the program type. This allows 19 | // polymorphism for the program factory classes, which in turn allows 20 | // us to hide the graphics-API-dependent program factory used by the 21 | // Window class (have a member mProgramFactory similar to mEngine that 22 | // is created according to the desired graphics API). 23 | virtual ~HLSLVisualProgram(); 24 | HLSLVisualProgram(); 25 | }; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLComputeProgram.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP HLSLComputeProgram : public ComputeProgram 16 | { 17 | public: 18 | // A simple stub to add HLSL as part of the program type. This allows 19 | // polymorphism for the program factory classes, which in turn allows 20 | // us to hide the graphics-API-dependent program factory used by the 21 | // Window class (have a member mProgramFactory similar to mEngine that 22 | // is created according to the desired graphics API). 23 | virtual ~HLSLComputeProgram(); 24 | HLSLComputeProgram(); 25 | }; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11TextureArray.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11TextureArray : public DX11Texture 17 | { 18 | protected: 19 | // Abstract base class, a shim to distinguish between single textures and 20 | // texture arrays. 21 | DX11TextureArray(TextureArray const* gtTextureArray); 22 | 23 | public: 24 | // Member access. 25 | inline TextureArray* GetTextureArray() const; 26 | }; 27 | 28 | inline TextureArray* DX11TextureArray::GetTextureArray() const 29 | { 30 | return static_cast(mGTObject); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTexture2Array.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | Texture2Array::Texture2Array(unsigned int numItems, DFType format, 14 | unsigned int width, unsigned int height, bool hasMipmaps, 15 | bool createStorage) 16 | : 17 | TextureArray(numItems, format, 2, width, height, 1, hasMipmaps, 18 | createStorage) 19 | { 20 | mType = GT_TEXTURE2_ARRAY; 21 | } 22 | 23 | unsigned int Texture2Array::GetWidth() const 24 | { 25 | return TextureArray::GetDimension(0); 26 | } 27 | 28 | unsigned int Texture2Array::GetHeight() const 29 | { 30 | return TextureArray::GetDimension(1); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/framefab/Timer.cpp: -------------------------------------------------------------------------------- 1 | #include "Timer.h" 2 | 3 | Timer::Timer() 4 | { 5 | Reset(); 6 | } 7 | 8 | 9 | Timer::~Timer() 10 | { 11 | } 12 | 13 | 14 | void Timer::Start() 15 | { 16 | start_time_ = std::chrono::system_clock::now(); 17 | } 18 | 19 | 20 | void Timer::Stop() 21 | { 22 | end_time_ = std::chrono::system_clock::now(); 23 | sum_time_ += std::chrono::duration_cast> 24 | (end_time_ - start_time_).count(); 25 | count_++; 26 | } 27 | 28 | 29 | void Timer::Reset() 30 | { 31 | sum_time_ = 0; 32 | count_ = 0; 33 | } 34 | 35 | 36 | void Timer::Print(char *item) 37 | { 38 | printf("%s total-time:%3.4lf count:%4d avg-time:%3.4lf\n", 39 | item, sum_time_, count_, sum_time_ / count_); 40 | } 41 | 42 | 43 | std::string Timer::ToString() const 44 | { 45 | std::string s = std::to_string(sum_time_); 46 | s.append(" s"); 47 | return s; 48 | } 49 | 50 | 51 | std::ostream & operator << (std::ostream& os, const Timer& t) 52 | { 53 | os << t.ToString(); 54 | return os; 55 | } -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11TextureSingle.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11TextureSingle : public DX11Texture 17 | { 18 | protected: 19 | // Abstract base class, a shim to distinguish between single textures and 20 | // texture arrays. 21 | DX11TextureSingle(TextureSingle const* gtTextureSingle); 22 | 23 | public: 24 | // Member access. 25 | inline TextureSingle* GetTextureSingle() const; 26 | }; 27 | 28 | inline TextureSingle* DX11TextureSingle::GetTextureSingle() const 29 | { 30 | return static_cast(mGTObject); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGL4VertexBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | GL4VertexBuffer::GL4VertexBuffer(VertexBuffer const* vbuffer) 14 | : 15 | GL4Buffer(vbuffer, GL_ARRAY_BUFFER) 16 | { 17 | Initialize(); 18 | } 19 | 20 | std::shared_ptr GL4VertexBuffer::Create(void*, GraphicsObject const* object) 21 | { 22 | if (object->GetType() == GT_VERTEX_BUFFER) 23 | { 24 | return std::make_shared( 25 | static_cast(object)); 26 | } 27 | 28 | LogError("Invalid object type."); 29 | return nullptr; 30 | } 31 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4GraphicsObject.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4GraphicsObject : public GEObject 17 | { 18 | protected: 19 | // Abstract base class. 20 | GL4GraphicsObject(GraphicsObject const* gtObject); 21 | 22 | public: 23 | // Member access. 24 | inline GLuint GetGLHandle() const; 25 | 26 | // Support for debugging. 27 | virtual void SetName(std::string const& name) override; 28 | 29 | protected: 30 | GLuint mGLHandle; 31 | }; 32 | 33 | inline GLuint GL4GraphicsObject::GetGLHandle() const 34 | { 35 | return mGLHandle; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteHLSLTextureBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | HLSLTextureBuffer::~HLSLTextureBuffer() 14 | { 15 | } 16 | 17 | HLSLTextureBuffer::HLSLTextureBuffer( 18 | D3D_SHADER_INPUT_BIND_DESC const& desc, unsigned int numBytes, 19 | std::vector const& members) 20 | : 21 | HLSLBaseBuffer(desc, numBytes, members) 22 | { 23 | } 24 | 25 | HLSLTextureBuffer::HLSLTextureBuffer( 26 | D3D_SHADER_INPUT_BIND_DESC const& desc, unsigned int index, 27 | unsigned int numBytes, std::vector const& members) 28 | : 29 | HLSLBaseBuffer(desc, index, numBytes, members) 30 | { 31 | } 32 | 33 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Applications/MSW/WGL/GteWindow.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | Window::Parameters::Parameters() 13 | : 14 | deviceCreationFlags(0) 15 | { 16 | } 17 | 18 | Window::Parameters::Parameters(std::wstring const& inTitle, 19 | int inXOrigin, int inYOrigin, int inXSize, int inYSize) 20 | : 21 | MSWWindow::Parameters(inTitle, inXOrigin, inYOrigin, inXSize, inYSize), 22 | deviceCreationFlags(0) 23 | { 24 | } 25 | 26 | Window::Window(Parameters& parameters) 27 | : 28 | MSWWindow(parameters), 29 | mEngine(std::static_pointer_cast(mBaseEngine)) 30 | { 31 | } 32 | 33 | Window::~Window() 34 | { 35 | } 36 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTextureCubeArray.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | TextureCubeArray::TextureCubeArray(unsigned int numCubes, DFType format, 14 | unsigned int length, bool hasMipmaps, bool createStorage) 15 | : 16 | TextureArray(CubeFaceCount * numCubes, format, 2, length, length, 1, hasMipmaps, 17 | createStorage), 18 | mNumCubes(numCubes) 19 | { 20 | mType = GT_TEXTURE_CUBE_ARRAY; 21 | } 22 | 23 | unsigned int TextureCubeArray::GetNumCubes() const 24 | { 25 | return mNumCubes; 26 | } 27 | 28 | unsigned int TextureCubeArray::GetLength() const 29 | { 30 | return TextureArray::GetDimension(0); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11ConstantBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11ConstantBuffer : public DX11Buffer 17 | { 18 | public: 19 | // Construction. 20 | DX11ConstantBuffer(ID3D11Device* device, ConstantBuffer const* cbuffer); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline ConstantBuffer* GetConstantBuffer() const; 25 | }; 26 | 27 | inline ConstantBuffer* DX11ConstantBuffer::GetConstantBuffer() const 28 | { 29 | return static_cast(mGTObject); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteHLSLConstantBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | HLSLConstantBuffer::~HLSLConstantBuffer() 14 | { 15 | } 16 | 17 | HLSLConstantBuffer::HLSLConstantBuffer( 18 | D3D_SHADER_INPUT_BIND_DESC const& desc, unsigned int numBytes, 19 | std::vector const& members) 20 | : 21 | HLSLBaseBuffer(desc, numBytes, members) 22 | { 23 | } 24 | 25 | HLSLConstantBuffer::HLSLConstantBuffer( 26 | D3D_SHADER_INPUT_BIND_DESC const& desc, unsigned int index, 27 | unsigned int numBytes, std::vector const& members) 28 | : 29 | HLSLBaseBuffer(desc, index, numBytes, members) 30 | { 31 | } 32 | 33 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGL4TextureDS.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | GL4TextureDS::GL4TextureDS(TextureDS const* texture) 14 | : 15 | GL4Texture2(texture) 16 | { 17 | } 18 | 19 | std::shared_ptr GL4TextureDS::Create(void*, GraphicsObject const* object) 20 | { 21 | if (object->GetType() == GT_TEXTURE_DS) 22 | { 23 | return std::make_shared( 24 | static_cast(object)); 25 | } 26 | 27 | LogError("Invalid object type."); 28 | return nullptr; 29 | } 30 | 31 | bool GL4TextureDS::CanAutoGenerateMipmaps() const 32 | { 33 | return false; 34 | } 35 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteHLSLResourceBindInfo.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | HLSLResourceBindInfo::~HLSLResourceBindInfo() 14 | { 15 | } 16 | 17 | HLSLResourceBindInfo::HLSLResourceBindInfo( 18 | D3D_SHADER_INPUT_BIND_DESC const& desc, unsigned int numBytes, 19 | std::vector const& members) 20 | : 21 | HLSLBaseBuffer(desc, numBytes, members) 22 | { 23 | } 24 | 25 | HLSLResourceBindInfo::HLSLResourceBindInfo( 26 | D3D_SHADER_INPUT_BIND_DESC const& desc, unsigned int index, 27 | unsigned int numBytes, std::vector const& members) 28 | : 29 | HLSLBaseBuffer(desc, index, numBytes, members) 30 | { 31 | } 32 | 33 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGLSLComputeProgram.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | GLSLComputeProgram::~GLSLComputeProgram() 13 | { 14 | if (glIsProgram(mProgramHandle)) 15 | { 16 | if (glIsShader(mCShaderHandle)) 17 | { 18 | glDetachShader(mProgramHandle, mCShaderHandle); 19 | glDeleteShader(mCShaderHandle); 20 | } 21 | 22 | glDeleteProgram(mProgramHandle); 23 | } 24 | } 25 | 26 | GLSLComputeProgram::GLSLComputeProgram(GLuint programHandle, GLuint cshaderHandle) 27 | : 28 | mProgramHandle(programHandle), 29 | mCShaderHandle(cshaderHandle), 30 | mReflector(programHandle) 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /cmake/modules/FindEigen.cmake: -------------------------------------------------------------------------------- 1 | find_package(PkgConfig) 2 | pkg_check_modules(PC_EIGEN eigen3) 3 | set(EIGEN_DEFINITIONS ${PC_EIGEN_CFLAGS_OTHER}) 4 | 5 | find_path(EIGEN_INCLUDE_DIR Eigen/Core 6 | HINTS ${PC_EIGEN_INCLUDEDIR} ${PC_EIGEN_INCLUDE_DIRS} "${EIGEN_ROOT}" "$ENV{EIGEN_ROOT}" 7 | PATHS "$ENV{PROGRAMFILES}/Eigen" "$ENV{PROGRAMW6432}/Eigen" 8 | "$ENV{PROGRAMFILES}/Eigen 3.0.0" "$ENV{PROGRAMW6432}/Eigen 3.0.0" 9 | PATH_SUFFIXES eigen3 include/eigen3 include) 10 | 11 | set(EIGEN_INCLUDE_DIRS ${EIGEN_INCLUDE_DIR}) 12 | 13 | include(FindPackageHandleStandardArgs) 14 | find_package_handle_standard_args(Eigen DEFAULT_MSG EIGEN_INCLUDE_DIR) 15 | 16 | mark_as_advanced(EIGEN_INCLUDE_DIR) 17 | 18 | if(EIGEN_FOUND) 19 | message(STATUS "Eigen found (include: ${EIGEN_INCLUDE_DIRS})") 20 | set(Eigen_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}) 21 | set(Eigen_FOUND ${EIGEN_FOUND}) 22 | else (EIGEN_FOUND) 23 | message(ERROR "could NOT found Eigen") 24 | endif(EIGEN_FOUND) 25 | 26 | set(Eigen_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}) 27 | set(Eigen_FOUND ${EIGEN_FOUND}) 28 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/LowLevel/GteLogToStringArray.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | LogToStringArray::LogToStringArray(std::string const& name, int flags) 14 | : 15 | Logger::Listener(flags), 16 | mName(name) 17 | { 18 | } 19 | 20 | std::string const& LogToStringArray::GetName() const 21 | { 22 | return mName; 23 | } 24 | 25 | std::vector const& LogToStringArray::GetMessages() const 26 | { 27 | return mMessages; 28 | } 29 | 30 | std::vector& LogToStringArray::GetMessages() 31 | { 32 | return mMessages; 33 | } 34 | 35 | void LogToStringArray::Report(std::string const& message) 36 | { 37 | mMessages.push_back(message); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/LowLevel/GteWrapper.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | void Memcpy(void* target, void const* source, size_t count) 17 | { 18 | #if defined(__MSWINDOWS__) 19 | errno_t result = memcpy_s(target, count, source, count); 20 | (void)result; // 0 on success 21 | #else 22 | memcpy(target, source, count); 23 | #endif 24 | } 25 | 26 | void Memcpy(wchar_t* target, wchar_t const* source, size_t count) 27 | { 28 | #if defined(__MSWINDOWS__) 29 | errno_t result = wmemcpy_s(target, count, source, count); 30 | (void)result; // 0 on success 31 | #else 32 | wmemcpy(target, source, count); 33 | #endif 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/framefab/NormalCut.cpp: -------------------------------------------------------------------------------- 1 | #include "NormalCut.h" 2 | 3 | 4 | NormalCut::NormalCut() 5 | { 6 | } 7 | 8 | 9 | NormalCut::NormalCut(WireFrame *ptr_frame, char *ptr_path) 10 | { 11 | ptr_frame_ = ptr_frame; 12 | ptr_path_ = ptr_path; 13 | } 14 | 15 | 16 | NormalCut::~NormalCut() 17 | { 18 | } 19 | 20 | 21 | void NormalCut::MakeLayers() 22 | { 23 | int M = ptr_frame_->SizeOfEdgeList(); 24 | 25 | for (int i = 0; i < M; i++) 26 | { 27 | WF_edge *e = ptr_frame_->GetEdge(i); 28 | if (e->ID() < e->ppair_->ID()) 29 | { 30 | double lower_z = min(e->pvert_->Position().z(), 31 | e->ppair_->pvert_->Position().z()); 32 | sweep_queue_.insert(make_pair(lower_z, e)); 33 | } 34 | } 35 | 36 | int layer_gap = 35; 37 | int l = 0; 38 | multimap::iterator it; 39 | for (it = sweep_queue_.begin(); it != sweep_queue_.end(); l++) 40 | { 41 | for (int j = 0; j < layer_gap && it != sweep_queue_.end(); j++, it++) 42 | { 43 | it->second->SetLayer(l); 44 | it->second->ppair_->SetLayer(l); 45 | } 46 | } 47 | 48 | ptr_frame_->Unify(); 49 | } -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteDepthStencilState.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | DepthStencilState::DepthStencilState() 14 | : 15 | depthEnable(true), 16 | writeMask(MASK_ALL), 17 | comparison(LESS_EQUAL), 18 | stencilEnable(false), 19 | stencilReadMask(0xFF), 20 | stencilWriteMask(0xFF), 21 | reference(0) 22 | { 23 | mType = GT_DEPTH_STENCIL_STATE; 24 | 25 | frontFace.fail = OP_KEEP; 26 | frontFace.depthFail = OP_KEEP; 27 | frontFace.pass = OP_KEEP; 28 | frontFace.comparison = ALWAYS; 29 | backFace.fail = OP_KEEP; 30 | backFace.depthFail = OP_KEEP; 31 | backFace.pass = OP_KEEP; 32 | backFace.comparison = ALWAYS; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4TextureRT.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4TextureRT : public GL4Texture2 17 | { 18 | public: 19 | // Construction. 20 | GL4TextureRT(TextureRT const* texture); 21 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline TextureRT* GetTexture() const; 25 | 26 | // Returns true of mipmaps need to be generated. 27 | virtual bool CanAutoGenerateMipmaps() const override; 28 | }; 29 | 30 | inline TextureRT* GL4TextureRT::GetTexture() const 31 | { 32 | return static_cast(mGTObject); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4IndexBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4IndexBuffer : public GL4Buffer 17 | { 18 | public: 19 | // Construction. 20 | GL4IndexBuffer(IndexBuffer const* ibuffer); 21 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline IndexBuffer* GetIndexBuffer() const; 25 | 26 | // Support for drawing geometric primitives. 27 | void Enable(); 28 | void Disable(); 29 | }; 30 | 31 | inline IndexBuffer* GL4IndexBuffer::GetIndexBuffer() const 32 | { 33 | return static_cast(mGTObject); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTexture3.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | Texture3::Texture3(DFType format, unsigned int width, unsigned int height, 14 | unsigned int thickness, bool hasMipmaps, bool createStorage) 15 | : 16 | TextureSingle(format, 3, width, height, thickness, hasMipmaps, 17 | createStorage) 18 | { 19 | mType = GT_TEXTURE3; 20 | } 21 | 22 | unsigned int Texture3::GetWidth() const 23 | { 24 | return TextureSingle::GetDimension(0); 25 | } 26 | 27 | unsigned int Texture3::GetHeight() const 28 | { 29 | return TextureSingle::GetDimension(1); 30 | } 31 | 32 | unsigned int Texture3::GetThickness() const 33 | { 34 | return TextureSingle::GetDimension(2); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /cmake/modules/FindMOSEK.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find MOSEK8 3 | # Once done this will define 4 | # 5 | # MOSEK_FOUND - system has MOSEK 6 | # MOSEK_INCLUDE_DIRS - the MOSEK include directories 7 | # MOSEK_LIBRARIES - Link these to use MOSEK 8 | # 9 | 10 | FIND_PATH(MOSEK_INCLUDE_DIR mosek.h 11 | PATHS /usr/local/mosek/8/tools/platform/linux64x86/h/ 12 | PATHS ~/mosek/8/tools/platform/linux64x86/h/ 13 | ) 14 | 15 | SET(SEARCH_PATHS "${MOSEK_INCLUDE_DIR}" "${MOSEK_INCLUDE_DIR}/../bin" "${MOSEK_INCLUDE_DIR}/lib") 16 | 17 | set(MOSEK_LIBRARIES) 18 | FIND_LIBRARY(MOSEK_LIBRARIES NAMES mosek64 PATHS ${SEARCH_PATHS} NO_DEFAULT_PATH DPATH_SUFFIXES a lib dylib) 19 | 20 | if(MOSEK_LIBRARIES AND MOSEK_INCLUDE_DIR) 21 | message(STATUS "Found MOSEK: ${MOSEK_LIBRARIES}") 22 | set(MOSEK_FOUND TRUE) 23 | endif(MOSEK_LIBRARIES AND MOSEK_INCLUDE_DIR) 24 | 25 | IF (MOSEK_FOUND) 26 | message(STATUS "Found MOSEK: ${MOSEK_INCLUDE_DIR}") 27 | SET(MOSEK_INCLUDE_DIRS ${MOSEK_INCLUDE_DIR} ) 28 | ELSE (MOSEK_FOUND) 29 | message(WARNING "could NOT find MOSEK") 30 | ENDIF (MOSEK_FOUND) 31 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteBlendState.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | BlendState::BlendState() 14 | : 15 | enableAlphaToCoverage(false), 16 | enableIndependentBlend(false), 17 | blendColor({ 0.0f, 0.0f, 0.0f, 0.0f }), 18 | sampleMask(0xFFFFFFFFu) 19 | { 20 | mType = GT_BLEND_STATE; 21 | 22 | for (int i = 0; i < NUM_TARGETS; ++i) 23 | { 24 | Target& trg = target[i]; 25 | trg.enable = false; 26 | trg.srcColor = BM_ONE; 27 | trg.dstColor = BM_ZERO; 28 | trg.opColor = OP_ADD; 29 | trg.srcAlpha = BM_ONE; 30 | trg.dstAlpha = BM_ZERO; 31 | trg.opAlpha = OP_ADD; 32 | trg.mask = CW_ENABLE_ALL; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Applications/GLX/GteWICFileIO.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | // The supported texture types are DF_R8G8B8A8_UNORM, DF_R8_UNORM, and 14 | // DF_R8G8_UNORM (gray+alpha). 15 | 16 | namespace gte 17 | { 18 | 19 | class GTE_IMPEXP WICFileIO 20 | { 21 | public: 22 | // Support for loading from PNG. If the load is not successful, the 23 | // function returns a null object. 24 | static std::shared_ptr Load(std::string const& filename, 25 | bool wantMipmaps); 26 | 27 | // Support for saving to PNG format. The function returns true when 28 | // successful. 29 | static bool SaveToPNG(std::string const& filename, 30 | std::shared_ptr const& texture); 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4TextureDS.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4TextureDS : public GL4Texture2 17 | { 18 | public: 19 | // Construction. 20 | GL4TextureDS(TextureDS const* texture); 21 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline TextureDS* GetTexture() const; 25 | 26 | // Returns true of mipmaps need to be generated. 27 | virtual bool CanAutoGenerateMipmaps() const override; 28 | 29 | private: 30 | }; 31 | 32 | inline TextureDS* GL4TextureDS::GetTexture() const 33 | { 34 | return static_cast(mGTObject); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/DX11/GteHLSLByteAddressBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | HLSLByteAddressBuffer::~HLSLByteAddressBuffer() 14 | { 15 | } 16 | 17 | HLSLByteAddressBuffer::HLSLByteAddressBuffer( 18 | D3D_SHADER_INPUT_BIND_DESC const& desc) 19 | : 20 | HLSLResource(desc, 0), 21 | mGpuWritable(desc.Type == D3D_SIT_UAV_RWBYTEADDRESS) 22 | { 23 | } 24 | 25 | HLSLByteAddressBuffer::HLSLByteAddressBuffer( 26 | D3D_SHADER_INPUT_BIND_DESC const& desc, unsigned int index) 27 | : 28 | HLSLResource(desc, index, 0), 29 | mGpuWritable(desc.Type == D3D_SIT_UAV_RWBYTEADDRESS) 30 | { 31 | } 32 | 33 | bool HLSLByteAddressBuffer::IsGpuWritable() const 34 | { 35 | return mGpuWritable; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTexture2.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP Texture2 : public TextureSingle 16 | { 17 | public: 18 | // Construction. 19 | Texture2(DFType format, unsigned int width, unsigned int height, 20 | bool hasMipmaps = false, bool createStorage = true); 21 | 22 | // Texture dimensions. 23 | unsigned int GetWidth() const; 24 | unsigned int GetHeight() const; 25 | 26 | // If you intend to share this texture among DX11Engine objects, call this 27 | // function before binding the texture to the engine. The Texture2 usage 28 | // must be Resource::GPU_RW. 29 | void MakeShared(); 30 | bool IsShared() const; 31 | 32 | protected: 33 | bool mShared; 34 | }; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLFactory.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 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 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLTexture.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP HLSLTexture : public HLSLResource 16 | { 17 | public: 18 | // Construction and destruction. 19 | virtual ~HLSLTexture(); 20 | 21 | HLSLTexture(D3D_SHADER_INPUT_BIND_DESC const& desc); 22 | 23 | HLSLTexture(D3D_SHADER_INPUT_BIND_DESC const& desc, unsigned int index); 24 | 25 | // Member access. 26 | unsigned int GetNumComponents() const; 27 | unsigned int GetNumDimensions() const; 28 | bool IsGpuWritable() const; 29 | 30 | private: 31 | void Initialize(D3D_SHADER_INPUT_BIND_DESC const& desc); 32 | 33 | unsigned int mNumComponents; 34 | unsigned int mNumDimensions; 35 | bool mGpuWritable; 36 | }; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11IndirectArgumentsBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11IndirectArgumentsBuffer : public DX11Buffer 17 | { 18 | public: 19 | // Construction. 20 | DX11IndirectArgumentsBuffer(ID3D11Device* device, IndirectArgumentsBuffer const* iabuffer); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline IndirectArgumentsBuffer* GetIndirectArgumentsBuffer() const; 25 | }; 26 | 27 | inline IndirectArgumentsBuffer* DX11IndirectArgumentsBuffer::GetIndirectArgumentsBuffer() const 28 | { 29 | return static_cast(mGTObject); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4AtomicCounterBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4AtomicCounterBuffer : public GL4Buffer 17 | { 18 | public: 19 | // Construction. 20 | GL4AtomicCounterBuffer(RawBuffer const* cbuffer); 21 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline RawBuffer* GetRawBuffer() const; 25 | 26 | // Bind the raw buffer data to the specified atomic counter buffer unit. 27 | void AttachToUnit(GLint atomicCounterBufferUnit); 28 | }; 29 | 30 | 31 | inline RawBuffer* GL4AtomicCounterBuffer::GetRawBuffer() const 32 | { 33 | return static_cast(mGTObject); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4ConstantBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4ConstantBuffer : public GL4Buffer 17 | { 18 | public: 19 | // Construction. 20 | GL4ConstantBuffer(ConstantBuffer const* cbuffer); 21 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline ConstantBuffer* GetConstantBuffer() const; 25 | 26 | // Bind the constant buffer data to the specified uniform buffer unit. 27 | void AttachToUnit(GLint uniformBufferUnit); 28 | }; 29 | 30 | inline ConstantBuffer* GL4ConstantBuffer::GetConstantBuffer() const 31 | { 32 | return static_cast(mGTObject); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteLightCameraGeometry.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | struct GTE_IMPEXP LightCameraGeometry 16 | { 17 | // Construction. 18 | LightCameraGeometry(); 19 | 20 | Vector4 lightModelPosition; // default: (0,0,0,1) 21 | Vector4 lightModelDirection; // default: (0,0,-1,0) 22 | Vector4 lightModelUp; // default: (0,1,0,0) 23 | Vector4 lightModelRight; // default: (1,0,0,0) 24 | 25 | Vector4 cameraModelPosition; // default: (0,0,0,1) 26 | Vector4 cameraModelDirection; // default: (0,0,-1,0) 27 | Vector4 cameraModelUp; // default: (0,1,0,0) 28 | Vector4 cameraModelRight; // default: (1,0,0,0) 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteFIQuery.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | // Find-intersection queries. 16 | 17 | template 18 | class FIQuery 19 | { 20 | public: 21 | struct Result 22 | { 23 | // A FIQuery-base class B must define a B::Result struct with member 24 | // 'bool intersect'. A FIQuery-derived class D must also derive a 25 | // D::Result from B:Result but may have no members. The member 26 | // 'intersect' is 'true' iff the primitives intersect. The operator() 27 | // is non-const to allow FIQuery to store and modify private state 28 | // that supports the query. 29 | }; 30 | Result operator()(Type0 const& primitive0, Type1 const& primitive1); 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteTIQuery.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | // Test-intersection queries. 16 | 17 | template 18 | class TIQuery 19 | { 20 | public: 21 | struct Result 22 | { 23 | // A TIQuery-base class B must define a B::Result struct with member 24 | // 'bool intersect'. A TIQuery-derived class D must also derive a 25 | // D::Result from B:Result but may have no members. The member 26 | // 'intersect' is 'true' iff the primitives intersect. The operator() 27 | // is non-const to allow TIQuery to store and modify private state 28 | // that supports the query. 29 | }; 30 | Result operator()(Type0 const& primitive0, Type1 const& primitive1); 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11VertexBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11VertexBuffer : public DX11Buffer 17 | { 18 | public: 19 | // Construction. 20 | DX11VertexBuffer(ID3D11Device* device, VertexBuffer const* vbuffer); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline VertexBuffer* GetVertexBuffer() const; 25 | 26 | // Drawing support. 27 | void Enable(ID3D11DeviceContext* context); 28 | void Disable(ID3D11DeviceContext* context); 29 | }; 30 | 31 | inline VertexBuffer* DX11VertexBuffer::GetVertexBuffer() const 32 | { 33 | return static_cast(mGTObject); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4SamplerState.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4SamplerState : public GL4DrawingState 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~GL4SamplerState(); 21 | GL4SamplerState(SamplerState const* samplerState); 22 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 23 | 24 | // Member access. 25 | inline SamplerState* GetSamplerState(); 26 | 27 | private: 28 | // Conversions from GTEngine values to GL4 values. 29 | static GLint const msMode[]; 30 | }; 31 | 32 | inline SamplerState* GL4SamplerState::GetSamplerState() 33 | { 34 | return static_cast(mGTObject); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGL4TextureRT.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | GL4TextureRT::GL4TextureRT(TextureRT const* texture) 14 | : 15 | GL4Texture2(texture) 16 | { 17 | } 18 | 19 | std::shared_ptr GL4TextureRT::Create(void*, GraphicsObject const* object) 20 | { 21 | if (object->GetType() == GT_TEXTURE_RT) 22 | { 23 | return std::make_shared( 24 | static_cast(object)); 25 | } 26 | 27 | LogError("Invalid object type."); 28 | return nullptr; 29 | } 30 | 31 | bool GL4TextureRT::CanAutoGenerateMipmaps() const 32 | { 33 | auto texture = GetTexture(); 34 | 35 | return texture && texture->HasMipmaps() && texture->WantAutogenerateMipmaps(); 36 | } 37 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLTextureArray.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP HLSLTextureArray : public HLSLResource 16 | { 17 | public: 18 | // Construction and destruction. 19 | virtual ~HLSLTextureArray(); 20 | 21 | HLSLTextureArray(D3D_SHADER_INPUT_BIND_DESC const& desc); 22 | 23 | HLSLTextureArray(D3D_SHADER_INPUT_BIND_DESC const& desc, 24 | unsigned int index); 25 | 26 | // Member access. 27 | unsigned int GetNumComponents() const; 28 | unsigned int GetNumDimensions() const; 29 | bool IsGpuWritable() const; 30 | 31 | private: 32 | void Initialize(D3D_SHADER_INPUT_BIND_DESC const& desc); 33 | 34 | unsigned int mNumComponents; 35 | unsigned int mNumDimensions; 36 | bool mGpuWritable; 37 | }; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteGEObject.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP GEObject 16 | { 17 | public: 18 | // Abstract base class. 19 | virtual ~GEObject(); 20 | protected: 21 | GEObject(GraphicsObject const* gtObject); 22 | 23 | public: 24 | // Member access. 25 | inline GraphicsObject* GetGraphicsObject() const; 26 | 27 | // Support for debugging. 28 | virtual void SetName(std::string const& name) = 0; 29 | inline std::string const& GetName() const; 30 | 31 | protected: 32 | GraphicsObject* mGTObject; 33 | std::string mName; 34 | }; 35 | 36 | inline GraphicsObject* GEObject::GetGraphicsObject() const 37 | { 38 | return mGTObject; 39 | } 40 | 41 | inline std::string const& GEObject::GetName() const 42 | { 43 | return mName; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/GTWindows.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #if defined(__MSWINDOWS__) 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #if defined(GTE_DEV_OPENGL) 19 | #include 20 | #include 21 | #elif defined(GTE_USE_DX12) 22 | #include 23 | #include 24 | #else 25 | #include 26 | #include 27 | #endif 28 | 29 | #endif 30 | 31 | #if defined(__LINUX__) 32 | #include 33 | #include 34 | #include 35 | #endif 36 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11IndexBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11IndexBuffer : public DX11Buffer 17 | { 18 | public: 19 | // Construction. 20 | DX11IndexBuffer(ID3D11Device* device, IndexBuffer const* vbuffer); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline IndexBuffer* GetIndexBuffer() const; 25 | 26 | // Drawing support. 27 | void Enable(ID3D11DeviceContext* context); 28 | void Disable(ID3D11DeviceContext* context); 29 | 30 | private: 31 | DXGI_FORMAT mFormat; 32 | }; 33 | 34 | inline IndexBuffer* DX11IndexBuffer::GetIndexBuffer() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteDCPQuery.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | // Distance and closest-point queries. 16 | template 17 | class DCPQuery 18 | { 19 | public: 20 | struct Result 21 | { 22 | // A DCPQuery-base class B must define a B::Result struct with member 23 | // 'Real distance'. A DCPQuery-derived class D must also derive a 24 | // D::Result from B:Result but may have no members. The idea is to 25 | // allow Result to store closest-point information in addition to the 26 | // distance. The operator() is non-const to allow DCPQuery to store 27 | // and modify private state that supports the query. 28 | }; 29 | Result operator()(Type0 const& primitive0, Type1 const& primitive1); 30 | }; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteBillboardNode.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP BillboardNode : public Node 16 | { 17 | public: 18 | // The model space of the billboard has an up vector of (0,1,0) that is 19 | // chosen to be the billboard's axis of rotation. 20 | 21 | // Construction. 22 | BillboardNode(std::shared_ptr const& camera); 23 | 24 | // The camera to which the billboard is aligned. 25 | inline void AlignTo(std::shared_ptr const& camera); 26 | 27 | protected: 28 | // Support for the geometric update. 29 | virtual void UpdateWorldData(double applicationTime); 30 | 31 | std::shared_ptr mCamera; 32 | }; 33 | 34 | 35 | inline void BillboardNode::AlignTo(std::shared_ptr const& camera) 36 | { 37 | mCamera = camera; 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGL4ConstantBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | GL4ConstantBuffer::GL4ConstantBuffer(ConstantBuffer const* cbuffer) 14 | : 15 | GL4Buffer(cbuffer, GL_UNIFORM_BUFFER) 16 | { 17 | Initialize(); 18 | } 19 | 20 | std::shared_ptr GL4ConstantBuffer::Create(void*, GraphicsObject const* object) 21 | { 22 | if (object->GetType() == GT_CONSTANT_BUFFER) 23 | { 24 | return std::make_shared( 25 | static_cast(object)); 26 | } 27 | 28 | LogError("Invalid object type."); 29 | return nullptr; 30 | } 31 | 32 | void GL4ConstantBuffer::AttachToUnit(GLint uniformBufferUnit) 33 | { 34 | glBindBufferBase(GL_UNIFORM_BUFFER, uniformBufferUnit, mGLHandle); 35 | } 36 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTextureBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | TextureBuffer::TextureBuffer(DFType format, unsigned int numElements, 14 | bool allowDynamicUpdate) 15 | : 16 | Buffer(numElements, DataFormat::GetNumBytesPerStruct(format), true), 17 | mFormat(format) 18 | { 19 | mType = GT_TEXTURE_BUFFER; 20 | mUsage = (allowDynamicUpdate ? DYNAMIC_UPDATE : IMMUTABLE); 21 | memset(mData, 0, mNumBytes); 22 | } 23 | 24 | DFType TextureBuffer::GetFormat() const 25 | { 26 | return mFormat; 27 | } 28 | 29 | bool TextureBuffer::HasMember(std::string const& name) const 30 | { 31 | auto iter = std::find_if(mLayout.begin(), mLayout.end(), 32 | [&name](MemberLayout const& item){ return name == item.name; }); 33 | return iter != mLayout.end(); 34 | } 35 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGL4IndexBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | GL4IndexBuffer::GL4IndexBuffer(IndexBuffer const* ibuffer) 14 | : 15 | GL4Buffer(ibuffer, GL_ELEMENT_ARRAY_BUFFER) 16 | { 17 | Initialize(); 18 | } 19 | 20 | std::shared_ptr GL4IndexBuffer::Create(void*, GraphicsObject const* object) 21 | { 22 | if (object->GetType() == GT_INDEX_BUFFER) 23 | { 24 | return std::make_shared( 25 | static_cast(object)); 26 | } 27 | 28 | LogError("Invalid object type."); 29 | return nullptr; 30 | } 31 | 32 | void GL4IndexBuffer::Enable() 33 | { 34 | glBindBuffer(mType, mGLHandle); 35 | } 36 | 37 | void GL4IndexBuffer::Disable() 38 | { 39 | glBindBuffer(mType, 0); 40 | } 41 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteTexture2.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | Texture2::Texture2(DFType format, unsigned int width, unsigned int height, 14 | bool hasMipmaps, bool createStorage) 15 | : 16 | TextureSingle(format, 2, width, height, 1, hasMipmaps, createStorage), 17 | mShared(false) 18 | { 19 | mType = GT_TEXTURE2; 20 | } 21 | 22 | unsigned int Texture2::GetWidth() const 23 | { 24 | return TextureSingle::GetDimension(0); 25 | } 26 | 27 | unsigned int Texture2::GetHeight() const 28 | { 29 | return TextureSingle::GetDimension(1); 30 | } 31 | 32 | void Texture2::MakeShared() 33 | { 34 | // Shared textures are required to be GPU writable. 35 | mUsage = SHADER_OUTPUT; 36 | mShared = true; 37 | } 38 | 39 | bool Texture2::IsShared() const 40 | { 41 | return mShared; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/GTLowLevel.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | // DataTypes 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | // Logger 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #if defined(__MSWINDOWS__) 30 | #include 31 | #include 32 | #endif 33 | 34 | // Timer 35 | #include 36 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4Texture1.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4Texture1 : public GL4TextureSingle 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~GL4Texture1(); 21 | GL4Texture1(Texture1 const* texture); 22 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 23 | 24 | // Member access. 25 | inline Texture1* GetTexture() const; 26 | 27 | // Returns true if mipmaps need to be generated. 28 | virtual bool CanAutoGenerateMipmaps() const override; 29 | 30 | protected: 31 | virtual void LoadTextureLevel(unsigned int level, void const* data) override; 32 | }; 33 | 34 | inline Texture1* GL4Texture1::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4Texture2.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4Texture2 : public GL4TextureSingle 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~GL4Texture2(); 21 | GL4Texture2(Texture2 const* texture); 22 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 23 | 24 | // Member access. 25 | inline Texture2* GetTexture() const; 26 | 27 | // Returns true if mipmaps need to be generated. 28 | virtual bool CanAutoGenerateMipmaps() const override; 29 | 30 | protected: 31 | virtual void LoadTextureLevel(unsigned int level, void const* data) override; 32 | }; 33 | 34 | inline Texture2* GL4Texture2::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4Texture3.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4Texture3 : public GL4TextureSingle 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~GL4Texture3(); 21 | GL4Texture3(Texture3 const* texture); 22 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 23 | 24 | // Member access. 25 | inline Texture3* GetTexture() const; 26 | 27 | // Returns true if mipmaps need to be generated. 28 | virtual bool CanAutoGenerateMipmaps() const override; 29 | 30 | protected: 31 | virtual void LoadTextureLevel(unsigned int level, void const* data) override; 32 | }; 33 | 34 | inline Texture3* GL4Texture3::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Applications/MSW/WGL/GteWindow.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP Window : public MSWWindow 17 | { 18 | public: 19 | struct GTE_IMPEXP Parameters : public MSWWindow::Parameters 20 | { 21 | Parameters(); 22 | 23 | Parameters(std::wstring const& inTitle, 24 | int inXOrigin, int inYOrigin, int inXSize, int inYSize); 25 | 26 | UINT deviceCreationFlags; 27 | }; 28 | 29 | protected: 30 | // Abstract base class. Only WindowSystem may create windows. 31 | Window(Parameters& parameters); 32 | public: 33 | virtual ~Window(); 34 | 35 | protected: 36 | // This is assigned mBaseEngine, which allows development of the DX12 37 | // engine independently of DX11 and WGL. 38 | std::shared_ptr mEngine; 39 | }; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGL4AtomicCounterBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | GL4AtomicCounterBuffer::GL4AtomicCounterBuffer(RawBuffer const* cbuffer) 14 | : 15 | GL4Buffer(cbuffer, GL_ATOMIC_COUNTER_BUFFER) 16 | { 17 | Initialize(); 18 | } 19 | 20 | std::shared_ptr GL4AtomicCounterBuffer::Create(void*, GraphicsObject const* object) 21 | { 22 | if (object->GetType() == GT_RAW_BUFFER) 23 | { 24 | return std::make_shared( 25 | static_cast(object)); 26 | } 27 | 28 | LogError("Invalid object type."); 29 | return nullptr; 30 | } 31 | 32 | void GL4AtomicCounterBuffer::AttachToUnit(GLint atomicCounterBufferUnit) 33 | { 34 | glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, atomicCounterBufferUnit, mGLHandle); 35 | } 36 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteHLSLStructuredBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/09/12) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP HLSLStructuredBuffer : public HLSLResource 16 | { 17 | public: 18 | enum GTE_IMPEXP Type 19 | { 20 | SBT_INVALID, 21 | SBT_BASIC, 22 | SBT_APPEND, 23 | SBT_CONSUME, 24 | SBT_COUNTER 25 | }; 26 | 27 | // Construction and destruction. 28 | virtual ~HLSLStructuredBuffer(); 29 | 30 | HLSLStructuredBuffer(D3D_SHADER_INPUT_BIND_DESC const& desc); 31 | 32 | HLSLStructuredBuffer(D3D_SHADER_INPUT_BIND_DESC const& desc, 33 | unsigned int index); 34 | 35 | // Member access. 36 | Type GetType() const; 37 | bool IsGpuWritable() const; 38 | 39 | private: 40 | void Initialize(D3D_SHADER_INPUT_BIND_DESC const& desc); 41 | 42 | Type mType; 43 | bool mGpuWritable; 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4VertexBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4VertexBuffer : public GL4Buffer 17 | { 18 | public: 19 | // Construction. 20 | GL4VertexBuffer(VertexBuffer const* vbuffer); 21 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline VertexBuffer* GetVertexBuffer() const; 25 | 26 | // TODO: Drawing support? Currently, the enable/disable is in the 27 | // GL4InputLayout class, which assumes OpenGL 4.3 or later. What if the 28 | // application machine does not have OpenGL 4.3? Fall back to the 29 | // glBindBuffer paradigm? 30 | }; 31 | 32 | inline VertexBuffer* GL4VertexBuffer::GetVertexBuffer() const 33 | { 34 | return static_cast(mGTObject); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteASinEstimate.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | // Approximations to asin(x) of the form f(x) = pi/2 - sqrt(1-x)*p(x) 13 | // where the polynomial p(x) of degree D minimizes the quantity 14 | // maximum{|acos(x)/sqrt(1-x) - p(x)| : x in [0,1]} over all 15 | // polynomials of degree D. We use the identity asin(x) = pi/2 - acos(x). 16 | 17 | namespace gte 18 | { 19 | 20 | template 21 | class ASinEstimate 22 | { 23 | public: 24 | // The input constraint is x in [0,1]. For example, 25 | // float x; // in [0,1] 26 | // float result = ASinEstimate::Degree<3>(x); 27 | template 28 | inline static Real Degree(Real x); 29 | }; 30 | 31 | 32 | template 33 | template 34 | inline Real ASinEstimate::Degree(Real x) 35 | { 36 | return (Real)GTE_C_HALF_PI - ACosEstimate::Degree(x); 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4TextureCube.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4TextureCube : public GL4TextureArray 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~GL4TextureCube(); 21 | GL4TextureCube(TextureCube const* textureArray); 22 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 23 | 24 | // Member access. 25 | inline TextureCube* GetTexture() const; 26 | 27 | // Returns true if mipmaps need to be generated. 28 | virtual bool CanAutoGenerateMipmaps() const override; 29 | 30 | protected: 31 | virtual void LoadTextureLevel(unsigned int item, unsigned int level, void const* data) override; 32 | }; 33 | 34 | inline TextureCube* GL4TextureCube::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ext/GTEngine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | set(BUILD_SHARED_LIBRARY true) 3 | 4 | project(GTEngine) 5 | 6 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -D__LINUX__ -DGTE_DEV_OPENGL -DGTE_DISABLE_PCH") 7 | 8 | # SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") 9 | 10 | INCLUDE_DIRECTORIES ( 11 | ${CMAKE_CURRENT_BINARY_DIR}/Include 12 | ${CMAKE_CURRENT_BINARY_DIR}/src 13 | ) 14 | 15 | SET_TARGET_PROPERTIES ( ${PROJECT_EXECUTABLES} PROPERTIES 16 | LINKER_LANGUAGE CXX 17 | ) 18 | 19 | include_directories(Include) 20 | 21 | file(GLOB GTE_ROOT_SRC Source/*.cpp) 22 | file(GLOB GTE_LOWLEVEL_SRC Source/LowLevel/*.cpp) 23 | file(GLOB GTE_MATHEMATICS_SRC Source/Mathematics/*.cpp) 24 | file(GLOB GTE_IMAGES_SRC Source/Imagics/*.cpp) 25 | file(GLOB GTE_PHYSICS_SRC Source/Physics/*.cpp) 26 | file(GLOB GTE_GRAPHICS_SRC Source/Graphics/*.cpp) 27 | file(GLOB GTE_GRAPHICS_OPENGL_SRC Source/Graphics/GL4/*.cpp) 28 | file(GLOB GTE_GRAPHICS_GLX_SRC Source/Graphics/GL4/GLX/*.cpp) 29 | file(GLOB GTE_Applications_SRC Source/Applications/*.cpp) 30 | file(GLOB GTE_Applications_GLX_SRC Source/Applications/GLX/*.cpp) 31 | 32 | add_library(GTEngine ${GTE_ROOT_SRC} ${GTE_MATHEMATICS_SRC}) 33 | 34 | set_target_properties(GTEngine PROPERTIES COMPILE_FLAGS -fPIC) 35 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Applications/MSW/DX11/GteWindow.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/07/16) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | Window::Parameters::Parameters() 13 | : 14 | deviceCreationFlags(0), 15 | featureLevel(D3D_FEATURE_LEVEL_11_0) 16 | { 17 | } 18 | 19 | Window::Parameters::Parameters(std::wstring const& inTitle, 20 | int inXOrigin, int inYOrigin, int inXSize, int inYSize) 21 | : 22 | MSWWindow::Parameters(inTitle, inXOrigin, inYOrigin, inXSize, inYSize), 23 | deviceCreationFlags(0), 24 | featureLevel(D3D_FEATURE_LEVEL_11_0) 25 | { 26 | } 27 | 28 | Window::Window(Parameters& parameters) 29 | : 30 | MSWWindow(parameters), 31 | mEngine(std::static_pointer_cast(mBaseEngine)) 32 | { 33 | } 34 | 35 | Window::~Window() 36 | { 37 | if (mEngine) 38 | { 39 | auto dxengine = std::static_pointer_cast(mEngine); 40 | dxengine->ExitFullscreen(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteControlledObject.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace gte 15 | { 16 | 17 | class GTE_IMPEXP ControlledObject 18 | { 19 | protected: 20 | // Abstract base class. 21 | ControlledObject(); 22 | public: 23 | virtual ~ControlledObject(); 24 | 25 | // Access to the controllers that control this object. 26 | typedef std::list> List; 27 | inline List const& GetControllers() const; 28 | void AttachController(std::shared_ptr const& controller); 29 | void DetachController(std::shared_ptr const& controller); 30 | void DetachAllControllers(); 31 | bool UpdateControllers(double applicationTime); 32 | 33 | private: 34 | List mControllers; 35 | }; 36 | 37 | 38 | inline ControlledObject::List const& ControlledObject::GetControllers() const 39 | { 40 | return mControllers; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/LowLevel/MSW/GteLogToMessageBox.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace gte; 12 | 13 | LogToMessageBox::LogToMessageBox(int flags) 14 | : 15 | Logger::Listener(flags) 16 | { 17 | } 18 | 19 | void LogToMessageBox::Report(std::string const& message) 20 | { 21 | std::string output = message + "Do you want to debug?"; 22 | 23 | std::wstring text(output.begin(), output.end()); 24 | int selection = MessageBox(nullptr, text.c_str(), L"Report", 25 | MB_ICONERROR | MB_YESNOCANCEL | MB_APPLMODAL | MB_TOPMOST); 26 | 27 | switch (selection) 28 | { 29 | case IDYES: 30 | // Break and debug. 31 | __debugbreak(); 32 | break; 33 | 34 | case IDNO: 35 | // Continue execution. 36 | break; 37 | 38 | case IDCANCEL: 39 | default: 40 | // Terminate execution. 41 | exit(0); 42 | break; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4Texture2Array.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4Texture2Array : public GL4TextureArray 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~GL4Texture2Array(); 21 | GL4Texture2Array(Texture2Array const* texture); 22 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 23 | 24 | // Member access. 25 | inline Texture2Array* GetTexture() const; 26 | 27 | // Returns true if mipmaps need to be generated. 28 | virtual bool CanAutoGenerateMipmaps() const override; 29 | 30 | protected: 31 | virtual void LoadTextureLevel(unsigned int item, unsigned int level, void const* data) override; 32 | }; 33 | 34 | inline Texture2Array* GL4Texture2Array::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4Texture1Array.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4Texture1Array : public GL4TextureArray 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~GL4Texture1Array(); 21 | GL4Texture1Array(Texture1Array const* textureArray); 22 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 23 | 24 | // Member access. 25 | inline Texture1Array* GetTexture() const; 26 | 27 | // Returns true if mipmaps need to be generated. 28 | virtual bool CanAutoGenerateMipmaps() const override; 29 | 30 | protected: 31 | virtual void LoadTextureLevel(unsigned int item, unsigned int level, void const* data) override; 32 | }; 33 | 34 | inline Texture1Array* GL4Texture1Array::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDXGIAdapter.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | // A simple wrapper for IDXGIAdapter1 objects and enumeration of them. 16 | 17 | class GTE_IMPEXP DXGIAdapter 18 | { 19 | public: 20 | // Construction and destruction. 21 | ~DXGIAdapter(); 22 | DXGIAdapter(DXGIAdapter const& object); 23 | DXGIAdapter(IDXGIAdapter1* adapter = nullptr); 24 | 25 | // Assignment. 26 | DXGIAdapter& operator=(DXGIAdapter const& object); 27 | 28 | // Member access. 29 | IDXGIAdapter1* GetAdapter() const; 30 | DXGI_ADAPTER_DESC1 const& GetDescription() const; 31 | std::vector const& GetOutputs() const; 32 | 33 | // Enumeration of adapters on a machine. 34 | static void Enumerate(std::vector& adapters); 35 | 36 | private: 37 | IDXGIAdapter1* mAdapter; 38 | DXGI_ADAPTER_DESC1 mDescription; 39 | std::vector mOutputs; 40 | }; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteAxisAngle.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | // Axis-angle representation for N = 3 or N = 4. When N = 4, the axis 16 | // must be a vector of the form (x,y,z,0) [affine representation of the 17 | // 3-tuple direction]. 18 | 19 | template 20 | class AxisAngle 21 | { 22 | public: 23 | AxisAngle(); 24 | AxisAngle(Vector const& inAxis, Real inAngle); 25 | 26 | Vector axis; 27 | Real angle; 28 | }; 29 | 30 | 31 | template 32 | AxisAngle::AxisAngle() 33 | { 34 | static_assert(N == 3 || N == 4, "Dimension must be 3 or 4."); 35 | // Uninitialized. 36 | } 37 | 38 | template 39 | AxisAngle::AxisAngle(Vector const& inAxis, Real inAngle) 40 | : 41 | axis(inAxis), 42 | angle(inAngle) 43 | { 44 | static_assert(N == 3 || N == 4, "Dimension must be 3 or 4."); 45 | } 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4TextureCubeArray.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4TextureCubeArray : public GL4TextureArray 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~GL4TextureCubeArray(); 21 | GL4TextureCubeArray(TextureCubeArray const* texture); 22 | static std::shared_ptr Create(void* unused, GraphicsObject const* object); 23 | 24 | // Member access. 25 | inline TextureCubeArray* GetTexture() const; 26 | 27 | // Returns true if mipmaps need to be generated. 28 | virtual bool CanAutoGenerateMipmaps() const override; 29 | 30 | protected: 31 | virtual void LoadTextureLevel(unsigned int item, unsigned int level, void const* data) override; 32 | }; 33 | 34 | inline TextureCubeArray* GL4TextureCubeArray::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Applications/MSW/DX11/GteWindow.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace gte 15 | { 16 | 17 | class GTE_IMPEXP Window : public MSWWindow 18 | { 19 | public: 20 | struct GTE_IMPEXP Parameters : public MSWWindow::Parameters 21 | { 22 | Parameters(); 23 | 24 | Parameters(std::wstring const& inTitle, 25 | int inXOrigin, int inYOrigin, int inXSize, int inYSize); 26 | 27 | UINT deviceCreationFlags; 28 | D3D_FEATURE_LEVEL featureLevel; 29 | }; 30 | 31 | protected: 32 | // Abstract base class. Only WindowSystem may create windows. 33 | Window(Parameters& parameters); 34 | public: 35 | virtual ~Window(); 36 | 37 | protected: 38 | // This is assigned mBaseEngine, which allows development of the DX12 39 | // engine independently of DX11 and WGL. 40 | std::shared_ptr mEngine; 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteIntrSphere3Frustum3.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace gte 15 | { 16 | 17 | template 18 | class TIQuery, Frustum3> 19 | { 20 | public: 21 | struct Result 22 | { 23 | bool intersect; 24 | }; 25 | 26 | Result operator()(Sphere3 const& sphere, 27 | Frustum3 const& frustum); 28 | }; 29 | 30 | 31 | template 32 | typename TIQuery, Frustum3>::Result 33 | TIQuery, Frustum3>::operator()( 34 | Sphere3 const& sphere, Frustum3 const& frustum) 35 | { 36 | Result result; 37 | DCPQuery, Frustum3> vfQuery; 38 | Real distance = vfQuery(sphere.center, frustum).distance; 39 | result.intersect = (distance <= sphere.radius); 40 | return result; 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteTriangleKey.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | template 16 | class TriangleKey : public FeatureKey<3, Ordered> 17 | { 18 | public: 19 | // An ordered triangle has V[0] = min(v0,v1,v2). Choose (V[0],V[1],V[2]) 20 | // to be a permutation of (v0,v1,v2) so that the final storage is one of 21 | // (v0,v1,v2), (v1,v2,v0), (v2,v0,v1) 22 | // The idea is that if v0 corresponds to (1,0,0), v1 corresponds to 23 | // (0,1,0), and v2 corresponds to (0,0,1), the ordering (v0,v1,v2) 24 | // corresponds to the 3x3 identity matrix I; the rows are the specified 25 | // 3-tuples. The permutation (V[0],V[1],V[2]) induces a permutation of 26 | // the rows of the identity matrix to form a permutation matrix P with 27 | // det(P) = 1 = det(I). 28 | // 29 | // An unordered triangle stores a permutation of (v0,v1,v2) so that 30 | // V[0] < V[1] < V[2]. 31 | TriangleKey(int v0 = -1, int v1 = -1, int v2 = -1); 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteDistPoint3Plane3.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace gte 15 | { 16 | 17 | template 18 | class DCPQuery, Plane3> 19 | { 20 | public: 21 | struct Result 22 | { 23 | Real distance, signedDistance; 24 | Vector3 planeClosestPoint; 25 | }; 26 | 27 | Result operator()(Vector3 const& point, Plane3 const& plane); 28 | }; 29 | 30 | 31 | template 32 | typename DCPQuery, Plane3>::Result 33 | DCPQuery, Plane3>::operator()( 34 | Vector3 const& point, Plane3 const& plane) 35 | { 36 | Result result; 37 | result.signedDistance = Dot(plane.normal, point) - plane.constant; 38 | result.distance = std::abs(result.signedDistance); 39 | result.planeClosestPoint = point - result.signedDistance*plane.normal; 40 | return result; 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteProgramDefines.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | ProgramDefines::ProgramDefines() 14 | { 15 | } 16 | 17 | void ProgramDefines::Update(std::string const& name, std::string const& value) 18 | { 19 | // If an item already exists with the specified name, update it. 20 | for (auto& definition : mDefinitions) 21 | { 22 | if (name == definition.first) 23 | { 24 | definition.second = value; 25 | return; 26 | } 27 | } 28 | 29 | // The item is new, so append it. 30 | mDefinitions.push_back(std::make_pair(name, value)); 31 | } 32 | 33 | void ProgramDefines::Remove(std::string const& name) 34 | { 35 | for (auto iter = mDefinitions.begin(); iter != mDefinitions.end(); ++iter) 36 | { 37 | if (name == iter->first) 38 | { 39 | mDefinitions.erase(iter); 40 | break; 41 | } 42 | } 43 | } 44 | 45 | void ProgramDefines::Clear() 46 | { 47 | mDefinitions.clear(); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteIntrCapsule3Capsule3.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace gte 15 | { 16 | 17 | template 18 | class TIQuery, Capsule3> 19 | { 20 | public: 21 | struct Result 22 | { 23 | bool intersect; 24 | }; 25 | 26 | Result operator()(Capsule3 const& capsule0, 27 | Capsule3 const& capsule1); 28 | }; 29 | 30 | 31 | template 32 | typename TIQuery, Capsule3>::Result 33 | TIQuery, Capsule3>::operator()( 34 | Capsule3 const& capsule0, Capsule3 const& capsule1) 35 | { 36 | Result result; 37 | DCPQuery, Segment3> ssQuery; 38 | auto ssResult = ssQuery(capsule0.segment, capsule1.segment); 39 | Real rSum = capsule0.radius + capsule1.radius; 40 | result.intersect = (ssResult.distance <= rSum); 41 | return result; 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4InputLayout.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GL4InputLayout 17 | { 18 | public: 19 | // Construction and destruction. 20 | ~GL4InputLayout(); 21 | GL4InputLayout(GLuint programHandle, GLuint vbufferHandle, 22 | VertexBuffer const* vbuffer); 23 | 24 | // Support for drawing geometric primitives. 25 | void Enable(); 26 | void Disable(); 27 | 28 | private: 29 | GLuint mProgramHandle; 30 | GLuint mVBufferHandle; 31 | GLuint mVArrayHandle; 32 | 33 | struct Attribute 34 | { 35 | VASemantic semantic; 36 | GLint numChannels; 37 | GLint channelType; 38 | GLboolean normalize; 39 | GLint location; 40 | GLintptr offset; 41 | GLsizei stride; 42 | }; 43 | 44 | int mNumAttributes; 45 | Attribute mAttributes[VA_MAX_ATTRIBUTES]; 46 | 47 | // Conversions from GTEngine values to GL4 values. 48 | static GLenum const msChannelType[]; 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteGraphicsObject.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | GraphicsObject::~GraphicsObject() 13 | { 14 | msLFDMutex.lock(); 15 | { 16 | for (auto listener : msLFDSet) 17 | { 18 | listener->OnDestroy(this); 19 | } 20 | } 21 | msLFDMutex.unlock(); 22 | } 23 | 24 | GraphicsObject::GraphicsObject() 25 | : 26 | mType(GT_GRAPHICS_OBJECT) 27 | { 28 | } 29 | 30 | void GraphicsObject::SubscribeForDestruction(std::shared_ptr const& listener) 31 | { 32 | msLFDMutex.lock(); 33 | { 34 | msLFDSet.insert(listener); 35 | } 36 | msLFDMutex.unlock(); 37 | } 38 | 39 | void GraphicsObject::UnsubscribeForDestruction(std::shared_ptr const& listener) 40 | { 41 | msLFDMutex.lock(); 42 | { 43 | msLFDSet.erase(listener); 44 | } 45 | msLFDMutex.unlock(); 46 | } 47 | 48 | 49 | std::mutex GraphicsObject::msLFDMutex; 50 | std::set> GraphicsObject::msLFDSet; 51 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/LowLevel/GteAtomicMinMax.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | // Implementations of atomic minimum and atomic maximum computations. These 15 | // are based on std::atomic_compare_exchange_strong. 16 | 17 | namespace gte 18 | { 19 | 20 | template 21 | T AtomicMin(std::atomic& v0, T const& v1); 22 | 23 | template 24 | T AtomicMax(std::atomic& v0, T const& v1); 25 | 26 | 27 | template 28 | T AtomicMin(std::atomic& v0, T const& v1) 29 | { 30 | T vInitial, vMin; 31 | do 32 | { 33 | vInitial = v0; 34 | vMin = std::min(vInitial, v1); 35 | } while (!std::atomic_compare_exchange_strong(&v0, &vInitial, vMin)); 36 | return vInitial; 37 | } 38 | 39 | template 40 | T AtomicMax(std::atomic& v0, T const& v1) 41 | { 42 | T vInitial, vMax; 43 | do 44 | { 45 | vInitial = v0; 46 | vMax = std::max(vInitial, v1); 47 | } while (!std::atomic_compare_exchange_strong(&v0, &vInitial, vMax)); 48 | return vInitial; 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteComputeProgram.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP ComputeProgram 16 | { 17 | public: 18 | // HLSL uses the class as is. GLSL derives from the class to store 19 | // the shader and program handles. 20 | virtual ~ComputeProgram(); 21 | ComputeProgram(); 22 | 23 | // Member access. 24 | inline std::shared_ptr const& GetCShader() const; 25 | 26 | public: 27 | // INTERNAL USE ONLY. This is used during factory creation of shaders 28 | // and programs. The graphics engines need only const-access to the 29 | // shader objects. 30 | inline void SetCShader(std::shared_ptr const& shader); 31 | 32 | private: 33 | std::shared_ptr mCShader; 34 | }; 35 | 36 | 37 | inline std::shared_ptr const& ComputeProgram::GetCShader() 38 | const 39 | { 40 | return mCShader; 41 | } 42 | 43 | inline void ComputeProgram::SetCShader( 44 | std::shared_ptr const& shader) 45 | { 46 | mCShader = shader; 47 | } 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11BlendState.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11BlendState : public DX11DrawingState 17 | { 18 | public: 19 | // Construction. 20 | DX11BlendState(ID3D11Device* device, BlendState const* blendState); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline BlendState* GetBlendState(); 25 | inline ID3D11BlendState* GetDXBlendState(); 26 | 27 | // Enable the blend state. 28 | void Enable(ID3D11DeviceContext* context); 29 | 30 | private: 31 | // Conversions from GTEngine values to DX11 values. 32 | static D3D11_BLEND const msMode[]; 33 | static D3D11_BLEND_OP const msOperation[]; 34 | }; 35 | 36 | inline BlendState* DX11BlendState::GetBlendState() 37 | { 38 | return static_cast(mGTObject); 39 | } 40 | 41 | inline ID3D11BlendState* DX11BlendState::GetDXBlendState() 42 | { 43 | return static_cast(mDXObject); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteIndexFormat.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.1 (2016/12/09) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | // Types of primitives supported by index buffers. 16 | enum GTE_IMPEXP IPType 17 | { 18 | IP_NONE = 0xFFFFFFFF, 19 | IP_POLYPOINT = 0x00000001, 20 | IP_POLYSEGMENT_DISJOINT = 0x00000002, 21 | IP_POLYSEGMENT_CONTIGUOUS = 0x00000004, 22 | IP_TRIMESH = 0x00000008, 23 | IP_TRISTRIP = 0x00000010, 24 | IP_POLYSEGMENT_DISJOINT_ADJ = 0x00000020, 25 | IP_POLYSEGMENT_CONTIGUOUS_ADJ = 0x00000040, 26 | IP_TRIMESH_ADJ = 0x00000080, 27 | IP_TRISTRIP_ADJ = 0x00000100, 28 | 29 | IP_HAS_POINTS = IP_POLYPOINT, 30 | 31 | IP_HAS_SEGMENTS = IP_POLYSEGMENT_DISJOINT | IP_POLYSEGMENT_CONTIGUOUS 32 | | IP_POLYSEGMENT_DISJOINT_ADJ | IP_POLYSEGMENT_CONTIGUOUS_ADJ, 33 | 34 | IP_HAS_TRIANGLES = IP_TRIMESH | IP_TRISTRIP 35 | | IP_TRIMESH_ADJ | IP_TRISTRIP_ADJ, 36 | 37 | IP_NUM_TYPES = 9 // IP_POLYPOINT through IP_TRISTRIP_ADJ 38 | }; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11SamplerState.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11SamplerState : public DX11DrawingState 17 | { 18 | public: 19 | // Construction. 20 | DX11SamplerState(ID3D11Device* device, SamplerState const* samplerState); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline SamplerState* GetSamplerState(); 25 | inline ID3D11SamplerState* GetDXSamplerState(); 26 | 27 | private: 28 | // Conversions from GTEngine values to DX11 values. 29 | static D3D11_FILTER const msFilter[]; 30 | static D3D11_TEXTURE_ADDRESS_MODE const msMode[]; 31 | static D3D11_COMPARISON_FUNC const msComparison[]; 32 | }; 33 | 34 | inline SamplerState* DX11SamplerState::GetSamplerState() 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | inline ID3D11SamplerState* DX11SamplerState::GetDXSamplerState() 40 | { 41 | return static_cast(mDXObject); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GteStructuredBuffer.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | 13 | StructuredBuffer::StructuredBuffer(unsigned int numElements, 14 | size_t elementSize, bool createStorage) 15 | : 16 | Buffer(numElements, elementSize, createStorage), 17 | mCounterType(CT_NONE), 18 | mKeepInternalCount(false) 19 | { 20 | mType = GT_STRUCTURED_BUFFER; 21 | } 22 | 23 | StructuredBuffer::CounterType StructuredBuffer::GetCounterType() const 24 | { 25 | return mCounterType; 26 | } 27 | 28 | void StructuredBuffer::MakeAppendConsume() 29 | { 30 | mCounterType = CT_APPEND_CONSUME; 31 | mUsage = SHADER_OUTPUT; 32 | } 33 | 34 | void StructuredBuffer::MakeCounter() 35 | { 36 | mCounterType = CT_COUNTER; 37 | mUsage = SHADER_OUTPUT; 38 | } 39 | 40 | bool StructuredBuffer::GetKeepInternalCount() const 41 | { 42 | return mKeepInternalCount; 43 | } 44 | 45 | void StructuredBuffer::SetKeepInternalCount(bool keepInternalCount) 46 | { 47 | if (mCounterType != CT_NONE) 48 | { 49 | mKeepInternalCount = keepInternalCount; 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11Texture1.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11Texture1 : public DX11TextureSingle 17 | { 18 | public: 19 | // Construction. 20 | DX11Texture1(ID3D11Device* device, Texture1 const* texture); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline Texture1* GetTexture() const; 25 | inline ID3D11Texture1D* GetDXTexture() const; 26 | 27 | private: 28 | // Support for construction. 29 | void CreateStaging(ID3D11Device* device, D3D11_TEXTURE1D_DESC const& tx); 30 | void CreateSRView(ID3D11Device* device, D3D11_TEXTURE1D_DESC const& tx); 31 | void CreateUAView(ID3D11Device* device, D3D11_TEXTURE1D_DESC const& tx); 32 | }; 33 | 34 | inline Texture1* DX11Texture1::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | inline ID3D11Texture1D* DX11Texture1::GetDXTexture() const 40 | { 41 | return static_cast(mDXObject); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11Texture3.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11Texture3 : public DX11TextureSingle 17 | { 18 | public: 19 | // Construction. 20 | DX11Texture3(ID3D11Device* device, Texture3 const* texture); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline Texture3* GetTexture() const; 25 | inline ID3D11Texture3D* GetDXTexture() const; 26 | 27 | private: 28 | // Support for construction. 29 | void CreateStaging(ID3D11Device* device, D3D11_TEXTURE3D_DESC const& tx); 30 | void CreateSRView(ID3D11Device* device, D3D11_TEXTURE3D_DESC const& tx); 31 | void CreateUAView(ID3D11Device* device, D3D11_TEXTURE3D_DESC const& tx); 32 | }; 33 | 34 | inline Texture3* DX11Texture3::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | inline ID3D11Texture3D* DX11Texture3::GetDXTexture() const 40 | { 41 | return static_cast(mDXObject); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11TextureRT.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11TextureRT : public DX11Texture2 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~DX11TextureRT(); 21 | DX11TextureRT(ID3D11Device* device, TextureRT const* texture); 22 | DX11TextureRT(ID3D11Device* device, DX11TextureRT const* dxSharedTexture); 23 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 24 | 25 | // Member access. 26 | inline ID3D11RenderTargetView* GetRTView() const; 27 | 28 | // Support for the DX11 debug layer; see comments in the file 29 | // GteDX11GraphicsObject.h about usage. 30 | virtual void SetName(std::string const& name); 31 | 32 | private: 33 | // Support for construction. 34 | void CreateRTView(ID3D11Device* device, D3D11_TEXTURE2D_DESC const& tx); 35 | 36 | ID3D11RenderTargetView* mRTView; 37 | }; 38 | 39 | inline ID3D11RenderTargetView* DX11TextureRT::GetRTView() const 40 | { 41 | return mRTView; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteTransformController.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP TransformController : public Controller 17 | { 18 | public: 19 | TransformController(Transform const& localTransform); 20 | 21 | // Member access. 22 | inline void SetTransform(Transform const& localTransform); 23 | inline Transform const& GetTransform() const; 24 | 25 | // The animation update. The application time is in milliseconds. 26 | // The update simply copies mLocalTransform to the Spatial mObject's 27 | // LocalTransform. In this sense, TransformController represents a 28 | // transform that is constant for all time. 29 | virtual bool Update(double applicationTime); 30 | 31 | protected: 32 | Transform mLocalTransform; 33 | }; 34 | 35 | 36 | inline void TransformController::SetTransform(Transform const& localTransform) 37 | { 38 | mLocalTransform = localTransform; 39 | } 40 | 41 | inline Transform const& TransformController::GetTransform() const 42 | { 43 | return mLocalTransform; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/framefab/FiberPrintPARM.cpp: -------------------------------------------------------------------------------- 1 | #include "FiberPrintPARM.h" 2 | 3 | 4 | FiberPrintPARM::FiberPrintPARM( 5 | double Wp, double Wa, double Wi, double seq_D_tol, 6 | double ADMM_D_tol , double penalty, double pri_tol, double dual_tol, 7 | double radius, double density, double g, 8 | double youngs_modulus, double shear_modulus, double poisson_ratio 9 | ) 10 | { 11 | /* 12 | * For Your Inference; Unit Transfer 13 | * Gpa = 10^3Mpa = 10^9pa 14 | * 1 kg/m^3 = 1e-3 g/cm^3 = 1e-12 Ton/mm^3 15 | * 1 Pa = 1 N/mm^2 16 | * 1 N = kg/(m * s^2) 17 | * 1 Giga = 10^3 Mega = 10^6 18 | */ 19 | 20 | /* 21 | * Test case 1: Acrylonitrile Butadiene Styrene (ABS) 22 | * Data Source : http://www.grantadesign.com/education/datasheets/ABS.htm 23 | * Density ; 1210 * 1e-12 Ton/mm^3 24 | * Elastic(Young's) Modulus : 1100 Mpa 25 | * Shear Modulus : 1032 Mpa 26 | * radius of the element : 0.6 mm 27 | * poisson ratio : 0.39 28 | */ 29 | 30 | /* 31 | * Gravity acceleration along Z axis: gZ = -9806.33 mm/s^2 32 | */ 33 | 34 | radius_ = radius; 35 | density_ = density; 36 | g_ = g; 37 | youngs_modulus_ = youngs_modulus; 38 | shear_modulus_ = shear_modulus; 39 | poisson_ratio_ = poisson_ratio; 40 | 41 | ADMM_D_tol_ = ADMM_D_tol; 42 | penalty_ = penalty; 43 | pri_tol_ = pri_tol; 44 | dual_tol_ = dual_tol; 45 | 46 | Wp_ = Wp; 47 | Wa_ = Wa; 48 | Wi_ = Wi; 49 | seq_D_tol_ = seq_D_tol; 50 | } 51 | 52 | 53 | FiberPrintPARM::~FiberPrintPARM() 54 | { 55 | } 56 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/LowLevel/GteLogReporter.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #if defined(__MSWINDOWS__) 13 | #include 14 | #include 15 | #endif 16 | #include 17 | 18 | namespace gte 19 | { 20 | 21 | class GTE_IMPEXP LogReporter 22 | { 23 | public: 24 | // Construction and destruction. Create one of these objects in an 25 | // application for logging. The GenerateProject tool creates such code. 26 | // If you do not want a particular logger, set the flags to 27 | // LISTEN_FOR_NOTHING and set logFile to "" if you do not want a file. 28 | ~LogReporter(); 29 | 30 | LogReporter(std::string const& logFile, int logFileFlags, int logStdoutFlags, 31 | int logMessageBoxFlags = 0, int logOutputWindowFlags = 0); 32 | 33 | private: 34 | std::unique_ptr mLogToFile; 35 | std::unique_ptr mLogToStdout; 36 | 37 | #if defined(__MSWINDOWS__) 38 | std::unique_ptr mLogToMessageBox; 39 | std::unique_ptr mLogToOutputWindow; 40 | #endif 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11TextureCube.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11TextureCube : public DX11TextureArray 17 | { 18 | public: 19 | // Construction. 20 | DX11TextureCube(ID3D11Device* device, TextureCube const* textureCube); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline TextureCube* GetTexture() const; 25 | inline ID3D11Texture2D* GetDXTexture() const; 26 | 27 | private: 28 | // Support for construction. 29 | void CreateStaging(ID3D11Device* device, D3D11_TEXTURE2D_DESC const& tx); 30 | void CreateSRView(ID3D11Device* device, D3D11_TEXTURE2D_DESC const& tx); 31 | void CreateUAView(ID3D11Device* device, D3D11_TEXTURE2D_DESC const& tx); 32 | }; 33 | 34 | inline TextureCube* DX11TextureCube::GetTexture() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | inline ID3D11Texture2D* DX11TextureCube::GetDXTexture() const 40 | { 41 | return static_cast(mDXObject); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/framefab/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | SYSTEM 3 | ${Qt_INCLUDE_DIRS} 4 | ${Eigen_INCLUDE_DIRS} 5 | ${MOSEK_INCLUDE_DIRS} 6 | ${GTENGINE_INCLUDE_DIRS} 7 | ${CMAKE_CURRENT_BINARY_DIR} 8 | ${CMAKE_SOURCE_DIR}/src 9 | ${CMAKE_SOURCE_DIR}/ext 10 | ) 11 | 12 | #if (NOT APPLE) 13 | # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") 14 | #endif() 15 | 16 | # include Qt basic make functions 17 | include(QtCommon) 18 | 19 | add_project_meta(META_FILES_TO_INCLUDE) 20 | 21 | set(RESOURCES_FILES mainwindow.qrc) 22 | 23 | # https://cmake.org/Wiki/CMake:How_To_Find_Libraries 24 | # find_package(Qt5 COMPONENTS Core Widgets Gui OpenGL REQUIRED) 25 | find_package(Qt5Core REQUIRED) 26 | find_package(Qt5Widgets REQUIRED) 27 | find_package(Qt5Gui REQUIRED) 28 | find_package(Qt5OpenGL REQUIRED) 29 | 30 | ## http://stackoverflow.com/questions/3201154/cmake-automatically-add-all-files-in-a-folder-to-a-target 31 | file(GLOB FRAMEFAB_SRC ${CMAKE_SOURCE_DIR}/src/framefab/*.h ${CMAKE_SOURCE_DIR}/src/framefab/*.cpp) 32 | file(GLOB FRAMEFAB_UI ${CMAKE_SOURCE_DIR}/src/framefab/*.ui) 33 | 34 | ## http://stackoverflow.com/questions/29968264/linking-and-uic-order-in-a-cmake-qt-project 35 | QT5_WRAP_UI(FRAMEFAB_UI_H ${FRAMEFAB_UI}) 36 | 37 | add_executable(framefab ${FRAMEFAB_SRC} ${FRAMEFAB_UI_H}) 38 | 39 | qt5_use_modules(framefab Widgets OpenGL) 40 | 41 | target_link_libraries(framefab ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${QT_LIBRARIES} ${LAPACK_LIBRARIES} ${MOSEK_LIBRARIES} GTEngine) 42 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGLSLComputeProgram.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP GLSLComputeProgram : public ComputeProgram 17 | { 18 | public: 19 | // Construction and destruction. 20 | virtual ~GLSLComputeProgram(); 21 | GLSLComputeProgram(GLuint programHandle, GLuint cshaderHandle); 22 | 23 | // Member access. GLEngine needs the program handle for enabling and 24 | // disabling the program. TODO: Do we need the GetCShaderHandle 25 | // function? 26 | inline GLuint GetProgramHandle() const; 27 | inline GLuint GetCShaderHandle() const; 28 | inline GLSLReflection const& GetReflector() const; 29 | 30 | private: 31 | GLuint mProgramHandle, mCShaderHandle; 32 | GLSLReflection mReflector; 33 | }; 34 | 35 | inline GLuint GLSLComputeProgram::GetProgramHandle() const 36 | { 37 | return mProgramHandle; 38 | } 39 | 40 | inline GLuint GLSLComputeProgram::GetCShaderHandle() const 41 | { 42 | return mCShaderHandle; 43 | } 44 | 45 | inline GLSLReflection const& GLSLComputeProgram::GetReflector() const 46 | { 47 | return mReflector; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11Texture1Array.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11Texture1Array : public DX11TextureArray 17 | { 18 | public: 19 | // Construction. 20 | DX11Texture1Array(ID3D11Device* device, Texture1Array const* textureArray); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline Texture1Array* GetTextureArray() const; 25 | inline ID3D11Texture1D* GetDXTextureArray() const; 26 | 27 | private: 28 | // Support for construction. 29 | void CreateStaging(ID3D11Device* device, D3D11_TEXTURE1D_DESC const& tx); 30 | void CreateSRView(ID3D11Device* device, D3D11_TEXTURE1D_DESC const& tx); 31 | void CreateUAView(ID3D11Device* device, D3D11_TEXTURE1D_DESC const& tx); 32 | }; 33 | 34 | inline Texture1Array* DX11Texture1Array::GetTextureArray() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | inline ID3D11Texture1D* DX11Texture1Array::GetDXTextureArray() const 40 | { 41 | return static_cast(mDXObject); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11Texture2Array.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11Texture2Array : public DX11TextureArray 17 | { 18 | public: 19 | // Construction. 20 | DX11Texture2Array(ID3D11Device* device, Texture2Array const* textureArray); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline Texture2Array* GetTextureArray() const; 25 | inline ID3D11Texture2D* GetDXTextureArray() const; 26 | 27 | private: 28 | // Support for construction. 29 | void CreateStaging(ID3D11Device* device, D3D11_TEXTURE2D_DESC const& tx); 30 | void CreateSRView(ID3D11Device* device, D3D11_TEXTURE2D_DESC const& tx); 31 | void CreateUAView(ID3D11Device* device, D3D11_TEXTURE2D_DESC const& tx); 32 | }; 33 | 34 | inline Texture2Array* DX11Texture2Array::GetTextureArray() const 35 | { 36 | return static_cast(mGTObject); 37 | } 38 | 39 | inline ID3D11Texture2D* DX11Texture2Array::GetDXTextureArray() const 40 | { 41 | return static_cast(mDXObject); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteIndirectArgumentsBuffer.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP IndirectArgumentsBuffer : public Buffer 16 | { 17 | public: 18 | // Construction. Each element is a 4-byte value. For storing a 19 | // single set of input parameters to a draw call, the layout of 20 | // the buffer should be as shown next. The parameters are in the 21 | // order expected by the Draw* call without the 'Indirect' suffix. 22 | // 23 | // DrawInstancedIndirect: 24 | // UINT VertexCountPerInstance; 25 | // UINT InstanceCount; 26 | // UINT StartVertexLocation; 27 | // UINT StartInstanceLocation; 28 | // 29 | // DrawIndexedInstancedIndirect: 30 | // UINT IndexCountPerInstance; 31 | // UINT InstanceCount; 32 | // UINT StartIndexLocation; 33 | // INT BaseVertexLocation; 34 | // UINT StartInstanceLocation; 35 | // 36 | // DispatchIndirect: 37 | // UINT ThreadsGroupCountX; 38 | // UINT ThreadsGroupCountY; 39 | // UINT ThreadsGroupCountZ; 40 | 41 | IndirectArgumentsBuffer(unsigned int numElements, 42 | bool createStorage = true); 43 | }; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteLighting.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | struct GTE_IMPEXP Lighting 16 | { 17 | // Construction. The defaults are listed for each member. The '*' 18 | // channels are not used but are included to match shader-constant 19 | // packing rules. 20 | Lighting(); 21 | 22 | // (r,g,b,*): default (1,1,1,1) 23 | Vector4 ambient; 24 | 25 | // (r,g,b,*): default (1,1,1,1) 26 | Vector4 diffuse; 27 | 28 | // (r,g,b,*): default (1,1,1,1) 29 | Vector4 specular; 30 | 31 | // (angle,cosAngle,sinAngle,exponent): default (pi/2,0,1,1) 32 | Vector4 spotCutoff; 33 | 34 | // Attenuation is: intensity/(constant + linear * (d + quadratic * d) 35 | // where d is the distance from the light position to the vertex position. 36 | // The distance is in model space. If the transformation from model space 37 | // to world space involves uniform scaling, you can include the scaling 38 | // factor in the 'intensity' component (by multiplication). 39 | // 40 | // (constant,linear,quadratic,intensity): default (1,0,0,1) 41 | Vector4 attenuation; 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GteRasterizerState.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gte 13 | { 14 | 15 | class GTE_IMPEXP RasterizerState : public DrawingState 16 | { 17 | public: 18 | enum GTE_IMPEXP FillMode 19 | { 20 | FILL_SOLID, 21 | FILL_WIREFRAME 22 | }; 23 | 24 | enum GTE_IMPEXP CullMode 25 | { 26 | CULL_NONE, 27 | CULL_FRONT, 28 | CULL_BACK 29 | }; 30 | 31 | // Construction. 32 | RasterizerState(); 33 | 34 | // Member access. The members are intended to be write-once before 35 | // you create an associated graphics state. 36 | FillMode fillMode; // default: FILL_SOLID 37 | CullMode cullMode; // default: CULL_BACK 38 | bool frontCCW; // default: true 39 | int depthBias; // default: 0 40 | float depthBiasClamp; // default: 0 41 | float slopeScaledDepthBias; // default: 0 42 | bool enableDepthClip; // default: true 43 | bool enableScissor; // default: false 44 | bool enableMultisample; // default: false 45 | bool enableAntialiasedLine; // default: false 46 | }; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11RasterizerState.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11RasterizerState : public DX11DrawingState 17 | { 18 | public: 19 | // Construction. 20 | DX11RasterizerState(ID3D11Device* device, RasterizerState const* rasterizerState); 21 | static std::shared_ptr Create(void* device, GraphicsObject const* object); 22 | 23 | // Member access. 24 | inline RasterizerState* GetRasterizerState(); 25 | inline ID3D11RasterizerState* GetDXRasterizerState(); 26 | 27 | // Enable the rasterizer state. 28 | void Enable(ID3D11DeviceContext* context); 29 | 30 | private: 31 | // Conversions from GTEngine values to DX11 values. 32 | static D3D11_FILL_MODE const msFillMode[]; 33 | static D3D11_CULL_MODE const msCullMode[]; 34 | }; 35 | 36 | inline RasterizerState* DX11RasterizerState::GetRasterizerState() 37 | { 38 | return static_cast(mGTObject); 39 | } 40 | 41 | inline ID3D11RasterizerState* DX11RasterizerState::GetDXRasterizerState() 42 | { 43 | return static_cast(mDXObject); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/DX11/GteDX11GraphicsObject.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace gte 14 | { 15 | 16 | class GTE_IMPEXP DX11GraphicsObject : public GEObject 17 | { 18 | public: 19 | // Abstract base class. 20 | virtual ~DX11GraphicsObject(); 21 | protected: 22 | DX11GraphicsObject(GraphicsObject const* gtObject); 23 | 24 | public: 25 | // Member access. 26 | inline ID3D11DeviceChild* GetDXDeviceChild() const; 27 | 28 | // Support for the DX11 debug layer. Set the name if you want to have 29 | // ID3D11DeviceChild destruction messages show your name rather than 30 | // "". The typical usage is 31 | // std::shared_ptr texture = std::make_shared(...); 32 | // engine->Bind(texture)->SetName("MyTexture"); 33 | // The virtual override is used to allow derived classes to use the 34 | // same name for associated resources. 35 | virtual void SetName(std::string const& name) override; 36 | 37 | protected: 38 | ID3D11DeviceChild* mDXObject; 39 | }; 40 | 41 | inline ID3D11DeviceChild* DX11GraphicsObject::GetDXDeviceChild() const 42 | { 43 | return mDXObject; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Graphics/GL4/GteGLSLVisualProgram.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | using namespace gte; 11 | 12 | GLSLVisualProgram::~GLSLVisualProgram() 13 | { 14 | if (glIsProgram(mProgramHandle)) 15 | { 16 | if (glIsShader(mVShaderHandle)) 17 | { 18 | glDetachShader(mProgramHandle, mVShaderHandle); 19 | glDeleteShader(mVShaderHandle); 20 | } 21 | 22 | if (glIsShader(mPShaderHandle)) 23 | { 24 | glDetachShader(mProgramHandle, mPShaderHandle); 25 | glDeleteShader(mPShaderHandle); 26 | } 27 | 28 | if (glIsShader(mGShaderHandle)) 29 | { 30 | glDetachShader(mProgramHandle, mGShaderHandle); 31 | glDeleteShader(mGShaderHandle); 32 | } 33 | 34 | glDeleteProgram(mProgramHandle); 35 | } 36 | } 37 | 38 | GLSLVisualProgram::GLSLVisualProgram(GLuint programHandle, 39 | GLuint vshaderHandle, GLuint pshaderHandle, GLuint gshaderHandle) 40 | : 41 | mProgramHandle(programHandle), 42 | mVShaderHandle(vshaderHandle), 43 | mPShaderHandle(pshaderHandle), 44 | mGShaderHandle(gshaderHandle), 45 | mReflector(programHandle) 46 | { 47 | } 48 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Graphics/GL4/GteGL4Resource.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace gte 15 | { 16 | 17 | class GTE_IMPEXP GL4Resource : public GL4GraphicsObject 18 | { 19 | protected: 20 | // Abstract base class. 21 | GL4Resource(Resource const* gtResource); 22 | 23 | public: 24 | // Member access. 25 | inline Resource* GetResource() const; 26 | 27 | // TODO: TENTATIVE INTERFACE (modify as needed). Make these pure 28 | // virtual latter (if relevant). 29 | void* MapForWrite(GLenum target); 30 | void Unmap(GLenum target); 31 | virtual bool Update() { return false; } 32 | virtual bool CopyCpuToGpu() { return false; } 33 | virtual bool CopyGpuToCpu() { return false; } 34 | 35 | virtual void CopyGpuToGpu(GL4Resource* target) 36 | { 37 | (void)target; 38 | LogError("Not yet implemented."); 39 | } 40 | 41 | protected: 42 | // Support for copying between CPU and GPU. 43 | bool PreparedForCopy(GLenum access) const; 44 | }; 45 | 46 | inline Resource* GL4Resource::GetResource() const 47 | { 48 | return static_cast(mGTObject); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /ext/GTEngine/Include/Mathematics/GteIntrPlane3Ellipsoid3.h: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace gte 16 | { 17 | 18 | template 19 | class TIQuery, Ellipsoid3> 20 | { 21 | public: 22 | struct Result 23 | { 24 | bool intersect; 25 | }; 26 | 27 | Result operator()(Plane3 const& plane, 28 | Ellipsoid3 const& ellipsoid); 29 | }; 30 | 31 | 32 | template 33 | typename TIQuery, Ellipsoid3>::Result 34 | TIQuery, Ellipsoid3>::operator()( 35 | Plane3 const& plane, Ellipsoid3 const& ellipsoid) 36 | { 37 | Result result; 38 | Matrix3x3 MInverse; 39 | ellipsoid.GetMInverse(MInverse); 40 | Real discr = Dot(plane.normal, MInverse * plane.normal); 41 | Real root = sqrt(std::max(discr, (Real)0)); 42 | DCPQuery, Plane3> vpQuery; 43 | Real distance = vpQuery(ellipsoid.center, plane).distance; 44 | result.intersect = (distance <= root); 45 | return result; 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /ext/GTEngine/Source/Applications/MSW/DX11/GteWindowSystem.cpp: -------------------------------------------------------------------------------- 1 | // David Eberly, Geometric Tools, Redmond WA 98052 2 | // Copyright (c) 1998-2017 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // http://www.boost.org/LICENSE_1_0.txt 5 | // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt 6 | // File Version: 3.0.0 (2016/06/19) 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | using namespace gte; 14 | 15 | WindowSystem gte::TheWindowSystem; 16 | 17 | WindowSystem::~WindowSystem() 18 | { 19 | } 20 | 21 | WindowSystem::WindowSystem() 22 | { 23 | } 24 | 25 | void WindowSystem::CreateEngineAndProgramFactory(MSWWindow::Parameters& parameters) 26 | { 27 | Window::Parameters& p = static_cast(parameters); 28 | 29 | auto engine = std::make_shared(nullptr, p.handle, p.xSize, 30 | p.ySize, D3D_DRIVER_TYPE_HARDWARE, nullptr, p.deviceCreationFlags, 31 | p.featureLevel); 32 | 33 | if (engine->GetDevice()) 34 | { 35 | parameters.engine = engine; 36 | parameters.factory = std::make_shared(); 37 | parameters.created = true; 38 | } 39 | else 40 | { 41 | LogError("Cannot create graphics engine."); 42 | parameters.engine = nullptr; 43 | parameters.factory = nullptr; 44 | parameters.created = false; 45 | } 46 | } 47 | --------------------------------------------------------------------------------