diff --git a/.gitignore b/.gitignore
index 5e5e76e..c737040 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,16 @@
+# Makefiles + RPI Executable
+*
+!Makefile
+!makefile
+!*/
+!*.*
+
# Prerequisites
*.d
.vs
Debug
Release
+MyProjects
# Compiled Object files
*.slo
@@ -32,4 +40,4 @@ Release
# Executables
*.exe
*.out
-*.app
+*.app
\ No newline at end of file
diff --git a/Examples/3D modeller/3D Modeller Targets.txt b/Examples/3D modeller/3D Modeller Targets.txt
deleted file mode 100644
index 121789f..0000000
--- a/Examples/3D modeller/3D Modeller Targets.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-3D modeller targets
--------------------
-
-*=Done
-+=working on it
-
-+ 2/3/4 point modelling of shapes
- * All shapes now have multi-point creation
- * Shape creation needs to rotate into view
- * Info whilst generating shapes
-* Speed up UI/editing esp. for Pi Zero
-- OBJ grouping
-- Group / Ungroup selection
-- Rotate selection
-+ Line/curve drawing to create Extrude & Lathe
-- Create line / pipe
-- Slices for shapes (Enter parameters)
-- Point/Facet/Line editing
-* Flight mode
- * WASDRF keys
- * Fullscreen
-- Walk in scene (with colliders)
-+ View points & navigation
- * Jump to point
-- Flight path
-- Animate selection;
- - Rotate
- - Slide
- - Oscillate
- - Hit button(s) to start/stop animation
- - Animate shape on path
- - tilt along path
-- Add/replace texture (drag and drop initially)
-- Material selection menu + options
-- Drop OBJ on scene object and align with normal direction of object face
-- Add behaviour to shape paths (e.g. pause or wait for interaction) - keyframe system
-- Merge lightmaps with texture UV's tool and shaders
-- Add UV mappers
-- Transparencies need to merge with other file imports
-- LOD
- - Appear from distance / hide other object(s)
- - Appear only when inside / exclude outside objects (show visible triangle count)
- - Appear only when arriving at specific volume(s)
- - Simulated testing
- - Swap textures in/out
- - Pause states while loading
-- Write generic file dialog window
-- Clean up
- * models (non system)
- * materials & textures (non system)
- - VBO's (non system)
diff --git a/Examples/3D modeller/DefaultStyle.json b/Examples/3D modeller/DefaultStyle.json
deleted file mode 100644
index 1f7334e..0000000
--- a/Examples/3D modeller/DefaultStyle.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "GUIcolours": {
- "BackCol": "Raspberry",
- "IconCol": "Linen",
- "SelectCol": "LightCoral",
- "HighlightCol": "Salmon",
- "BorderCol": "Red"
- }
-}
\ No newline at end of file
diff --git a/Examples/3D modeller/Modeller.sln b/Examples/3D modeller/Modeller.sln
deleted file mode 100644
index 11d52ff..0000000
--- a/Examples/3D modeller/Modeller.sln
+++ /dev/null
@@ -1,33 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{DA75C201-04BB-4D48-8DCC-C336AE6D4305}") = "Modeller", "Modeller.vcxproj", "{86B9CF91-8738-B044-A7BF-A295F9323D12}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|ARM = Debug|ARM
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|ARM = Release|ARM
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|ARM.ActiveCfg = Debug|ARM
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|ARM.Build.0 = Debug|ARM
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|x64.ActiveCfg = Debug|x64
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|x64.Build.0 = Debug|x64
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|x86.ActiveCfg = Debug|Win32
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|x86.Build.0 = Debug|Win32
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|ARM.ActiveCfg = Release|ARM
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|ARM.Build.0 = Release|ARM
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|x64.ActiveCfg = Release|x64
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|x64.Build.0 = Release|x64
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|x86.ActiveCfg = Release|Win32
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Examples/3D modeller/Modeller.vcxproj b/Examples/3D modeller/Modeller.vcxproj
deleted file mode 100644
index 91fee9f..0000000
--- a/Examples/3D modeller/Modeller.vcxproj
+++ /dev/null
@@ -1,355 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- ARM
-
-
- Release
- ARM
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- {86B9CF91-8738-B044-A7BF-A295F9323D12}
- CastleCreator
- 10.0
-
-
-
- Application
- true
- v143
- MultiByte
-
-
- Application
- true
- v143
- MultiByte
-
-
- Application
- false
- v143
- true
- MultiByte
-
-
- Application
- false
- v143
- true
- MultiByte
-
-
- Application
- true
- v143
- MultiByte
-
-
- Application
- false
- v143
- true
- MultiByte
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\include;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\include;$(ProjectDir)\..\..\ThirdParty\glew\include;$(ProjectDir)\..\..\SharedCode\core;$(ProjectDir)\..\..\SharedCode\ui;$(ProjectDir)\..\..\SharedCode\file;$(ProjectDir)\..\..\SharedCode\helpers;$(ProjectDir)\..\..\SharedCode\glutess;$(ProjectDir)\..\..\SharedCode\editing;$(ProjectDir)\..\..\ThirdParty\rapidjson;$(ProjectDir)\..\..\ThirdParty\openFBX;$(ProjectDir)\..\..\ThirdParty\fbx\src;$(ProjectDir)\..\..\ThirdParty\gltf\fx;$(ProjectDir)\..\..\ThirdParty\gltf;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\SharedCode;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2_net\lib\x86;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\include;$(ProjectDir)\..\..\ThirdParty\glew\include;$(ProjectDir)\..\..\SharedCode\ui;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\include;$(ProjectDir)\..\..\SharedCode\file;$(ProjectDir)\..\..\SharedCode\core;$(ProjectDir)\..\..\SharedCode\helpers;$(ProjectDir)\..\..\SharedCode\glutess;$(ProjectDir)\..\..\ThirdParty\rapidjson;$(ProjectDir)\..\..\SharedCode\editing;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_net\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\Shared\SDLwin\include;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2_net\lib\x86;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\include;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\include;$(ProjectDir)\..\..\ThirdParty\glew\include;$(ProjectDir)\..\..\SharedCode\core;$(ProjectDir)\..\..\SharedCode\ui;$(ProjectDir)\..\..\SharedCode\file;$(ProjectDir)\..\..\SharedCode\helpers;$(ProjectDir)\..\..\SharedCode\glutess;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x64;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x64;$(ProjectDir)\..\..\ThirdParty\glew\lib\Release\x64;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x64;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x64;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\Shared\SDLwin\include;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x64;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x64;$(ProjectDir)\..\..\ThirdParty\\SDL2_net\lib\x64;$(LibraryPath)
- $(SourcePath)
-
-
-
- Level3
- Disabled
- true
- ..\..\Shared\glutess;%(AdditionalIncludeDirectories)
- stdcpp17
-
-
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;SDL2_mixer.lib;SDL2_ttf.lib;glew32s.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
- Level3
- Disabled
- true
-
-
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
- Level3
- Disabled
- true
-
-
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;SDL2_mixer.lib;SDL2_ttf.lib;glew32s.lib;%(AdditionalDependencies)
- Windows
- %(AdditionalOptions) /machine:x64
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
- ..\..\Shared\glutess;%(AdditionalIncludeDirectories)
-
-
- true
- true
- SDL2.lib;SDL2main.lib;SDL2_mixer.lib;OpenGL32.lib;SDL2_image.lib;SDL2_ttf.lib;glew32s.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
-
-
- true
- true
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
-
-
- true
- true
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Examples/3D modeller/Modeller.vcxproj.filters b/Examples/3D modeller/Modeller.vcxproj.filters
deleted file mode 100644
index 6397a3d..0000000
--- a/Examples/3D modeller/Modeller.vcxproj.filters
+++ /dev/null
@@ -1,443 +0,0 @@
-
-
-
-
- {1E142D47-36D3-7740-9C7D-5F7ABC070098}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {6AC69C4B-9960-4D43-A898-F590CE31D5AC}
- h;hh;hpp;hxx;hm;inl;inc;xsd
-
-
- {2A9CF5DA-7433-EF49-AEB2-18C6C9D06AA0}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
- {6678c446-5457-4565-9e43-a2ea2aafd732}
-
-
- {e485b0ed-ffb5-419e-8327-96ab507b5935}
-
-
- {fc74154a-6b0d-4488-9aa3-04b6b3d75e26}
-
-
- {aae40517-da35-437f-98a3-b87096ca01a1}
-
-
- {b988fb8c-7b5d-47ab-8dc2-fa719d29b0e1}
-
-
- {700f6998-0c93-45f9-a739-780b60031288}
-
-
- {56c8bfdf-a7a9-4bd3-b007-cdd71b5aa6fd}
-
-
- {6c124c5a-213e-4cfb-b012-8286cf8fb4f6}
-
-
- {7aaa0e49-3d75-4a00-98d3-b29a689ef2aa}
-
-
- {3f7e7ed2-b5fb-463b-9565-e149acc99d0c}
-
-
-
-
- Source Files
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Source Files
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\ui
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Source Files
-
-
- Shared Code\helpers
-
-
- Shared Code\editing
-
-
- Shared Code\editing
-
-
- Shared Code\editing
-
-
- Shared Code\helpers
-
-
- Shared Code\core
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Source Files
-
-
- Shared Code\helpers
-
-
- Shared Code\file
-
-
- Source Files
-
-
- Shared Code\file
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\OpenFBX
-
-
- Shared Code\OpenFBX
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\file
-
-
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Source Files
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\ui
-
-
- Shared Code\file
-
-
- Shared Code\core
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Source Files
-
-
- Shared Code\helpers
-
-
- Shared Code\editing
-
-
- Shared Code\editing
-
-
- Shared Code\editing
-
-
- Shared Code\helpers
-
-
- Shared Code\core
-
-
- Shared Code\helpers
-
-
- Shared Code\core
-
-
- Shared Code\helpers
-
-
- Shared Code\core
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\core
-
-
- Shared Code\file
-
-
- Source Files
-
-
- Shared Code\file
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\OpenFBX
-
-
- Shared Code\OpenFBX
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\file
-
-
- Shared Code\fxgltf
-
-
- Shared Code\file
-
-
-
-
- Assets
-
-
- Assets
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
-
\ No newline at end of file
diff --git a/Examples/3D modeller/Modeller.vcxproj.user b/Examples/3D modeller/Modeller.vcxproj.user
deleted file mode 100644
index 9c881d9..0000000
--- a/Examples/3D modeller/Modeller.vcxproj.user
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- PATH=$(ProjectDir)\..\..\ThirdParty\\SDL_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\bin\Release\Win32;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86
- WindowsLocalDebugger
- options.txt
-
-
- PATH=$(ProjectDir)\..\..\ThirdParty\SDL_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\bin\Release\Win32;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86;
- WindowsLocalDebugger
- options.txt
-
-
- PATH=$(ProjectDir)\..\..\ThirdParty\\SDL_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\bin\Release\Win32;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86
- WindowsLocalDebugger
-
-
\ No newline at end of file
diff --git a/Examples/3D modeller/Source/Modeller.cpp b/Examples/3D modeller/Source/Modeller.cpp
deleted file mode 100644
index ed84978..0000000
--- a/Examples/3D modeller/Source/Modeller.cpp
+++ /dev/null
@@ -1,1353 +0,0 @@
-#include "Modeller.h"
-#include "Pi3Cshapes.h"
-#include "Pi3Cblocks.h"
-#include "Pi3CfileFBX.h"
-//#include "Pi3CfileGLTF.h"
-#include "Pi3CfileFXGLTF.h"
-
-#include
-#include
-
-using std::placeholders::_1;
-
-Modeller::Modeller(Pi3Cresource *resource, Pi3Cwindow *window)
-{
- // Setup shader ..
- int32_t basicShaderRef = resource->addShader("assets/shaders/vs1.glsl", "assets/shaders/fs1.glsl");
- if (basicShaderRef < 0) {
- window->showErrorMessage("Shader Error!", resource->error());
- return;
- }
-
- this->resource = resource;
- this->window = window;
-
- // Setup scene ...
- scene.init(resource);
- scene.selectShader(basicShaderRef);
- scene.setViewport2D(Pi3Crecti(0, 0, window->getWidth(), window->getHeight()),-200.f, 2000.f);
- window->setClearColour(Pi3Ccolours::DimGray);
-
- //scene.renderOffscreen(1200,800,resource->shaders[0]);
-
-}
-
-Modeller::~Modeller()
-{
- DeleteCursors();
-}
-
-void Modeller::ClearScene()
-{
- for (auto &model : scene.models) {
- if (model.touchable) model.deleted = true;
- }
- resource->deleteMaterialTexturesByID(modelGroupId);
- resource->deleteMaterialsByID(modelGroupId);
- resource->deleteVertsBuffer(modelGroupId);
- ClearGizmos();
-}
-
-void Modeller::ClearGizmos()
-{
- touch.reset();
- scene.models[brushref].visible = false;
- scene.models[selboxRef].visible = false;
- scene.models[moveGizmoRef].visible = false;
- selectedName = "";
-}
-
-void Modeller::SetupGUI(loadOptions &opts)
-{
-
- mgui.Init(opts, resource, window, "DefaultStyle.json");
-
- views[viewInfo::TOPLEFT] = SetupView(viewInfo::VIEW_FRONT);
- views[viewInfo::TOPRIGHT] = SetupView(viewInfo::VIEW_LEFT);
- views[viewInfo::BOTTOMLEFT] = SetupView(viewInfo::VIEW_TOP);
- views[viewInfo::BOTTOMRIGHT] = SetupView(viewInfo::VIEW_PERSPECTIVE);
- views[viewInfo::FULL] = SetupView(viewInfo::VIEW_PERSPECTIVE);
- views[viewInfo::FULLSCREEN] = SetupView(viewInfo::VIEW_PERSPECTIVE);
-}
-
-void Modeller::Init()
-{
- // Load 3D models and scene ...
- loadOptions opts("options.txt");
-
- SetupGUI(opts);
-
- //nearzfarz = opts.asVec2f("nearzfarz");
- scene.setFog(0xffffff, 25000.f, 35000.f);
- //scene.setPerspective3D(window->getWidth(), window->getHeight(), PSPVALUE, nearzfarz.x, nearzfarz.y);
-
- // Setup player's avatar ...
- //Pi3Cavatar::avatarParams avparams;
- //avparams.movement = Pi3Cavatar::move_walk;
- //avparams.position = opts.asVec3f("startpos");
- //avparams.rotation = opts.asVec3f("rotation");
- //avparams.size = { 1.f, opts.asFloat("avatarHeight"), 1.f };
- //avparams.walkSpeed = opts.asFloat("avatarWalkSpeed");
- //avparams.runSpeed = opts.asFloat("avatarRunSpeed");
- //avparams.fallSpeed = opts.asFloat("avatarFallSpeed");
- //player.init(avparams);
-
- // Load Skybox ...
- std::string skyboxfile = opts.asString("skybox");
- if (skyboxfile != "") {
- skybox = scene.loadModelOBJ(opts.asString("skyboxPath"),skyboxfile , vec3f(), true); // false, loadbarCallback);
- scene.models[skybox].matrix.SetScale(opts.asFloat("skyboxScale"));
- scene.models[skybox].touchable = false;
- }
-
- // Create a brush for touching objects ...
- Pi3Cmodel brush = Pi3Cmodel(resource, Pi3Cshapes::sphere(vec3f(), 0.5f, 0.f, 10, 10),-1, 0xff00ffff);
- brush.touchable = false;
- brush.visible = false;
- brushref = scene.append3D(brush);
-
- // Create grid
- Pi3Cmodel gridModel = Pi3Cmodel(resource, Pi3Cshapes::grid(vec2f(100.f, 100.f), 10.f, 1.f, Pi3Ccolours::Graphite, Pi3Ccolours::Black),-1);
- gridModel.touchable = false;
- gridRef = scene.append3D(gridModel);
-
- // Create selection box
- Pi3Cmodel selboxModel = Pi3Cmodel(resource, Pi3Cgizmos::selectBoxGizmo(vec3f(), vec3f(), 0xffffff),-1);
- selboxModel.touchable = false;
- selboxRef = scene.append3D(selboxModel);
-
- Pi3Cmodel selRectModel = Pi3Cmodel(resource, Pi3Cshapes::rectLine(vec2f(0, 0), vec2f(0, 0)), -1);
- selRectModel.touchable = false;
- selRectModel.material.SetColAmbient(0xffffffff);
- selRectRef = scene.append2D(selRectModel);
-
- //Create outline shape
- Pi3Cmesh lmesh;
- for (uint32_t l = 0; l < 100000; l++) {
- lmesh.addPackedVert(vec3f(), vec3f(), vec2f(), 0xffffff);
- }
- lmesh.updateBounds();
- lmesh.materialRef = 0;
- lmesh.mode = GL_LINES;
-
- Pi3Cmodel outlineModel = Pi3Cmodel(resource, lmesh, 0xffffff);
- outlineModel.touchable = false;
- outlineModel.material.rendermode = GL_LINES;
- outlineRef = scene.append3D(outlineModel);
-
- // Create move gizmo
- Pi3Cmodel moveGizmo = Pi3Cmodel(resource, Pi3Cgizmos::moveGizmo(vec3f(), vec3f(), 0xffffffff),-1);
- moveGizmo.touchable = false;
- moveGizmo.visible = false;
- moveGizmo.material.rendermode = GL_LINES;
- moveGizmo.material.illum = 0;
- moveGizmoRef = scene.append3D(moveGizmo);
-
- outlines = *resource->defaultMaterial();
- outlines.rendermode = GL_LINE_STRIP;
- outlines.illum = 1;
-
- CreateCursors();
- currentCursor = arrowCursor;
-}
-
-void Modeller::CreateCursors()
-{
- handCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
- arrowCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
- crossCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_CROSSHAIR);
- moveCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL);
- textCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
- NSCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS);
- WECursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
-}
-
-void Modeller::DeleteCursors()
-{
- if (handCursor) SDL_FreeCursor(handCursor);
- if (arrowCursor) SDL_FreeCursor(arrowCursor);
- if (moveCursor) SDL_FreeCursor(moveCursor);
- if (crossCursor) SDL_FreeCursor(crossCursor);
- if (textCursor) SDL_FreeCursor(textCursor);
- if (WECursor) SDL_FreeCursor(WECursor);
- if (NSCursor) SDL_FreeCursor(NSCursor);
-}
-
-viewInfo Modeller::SetupView(const viewInfo::ViewProject proj)
-{
- const static float PIDIV2 = PI / 2.f;
- const static vec3f viewDir[8] = { { 0, PIDIV2, 0 }, { 0, -PIDIV2, 0 }, { PIDIV2, 0, 0 },{ -PIDIV2, 0, 0 },{}, { 0, PI, 0 },{ .7f, .7f, 0 },{ .7f, .7f, 0 } };
-
- viewInfo view;
- view.viewProject = proj;
- view.projection = (proj== viewInfo::VIEW_PERSPECTIVE) ? viewInfo::PERSPECTIVE : viewInfo::ORTHOGRAPHIC;
- view.setRot(viewDir[proj]);
- return view;
-}
-
-void Modeller::HandleKeys()
-{
- const uint8_t *keystate = window->getKeys();
-}
-
-void Modeller::ResetZoom()
-{
- viewInfo& view = views[currentView];
- view.pos = vec3f();
- if (view.zoom != 0) {
- view.pan += view.rotInvertMatrix.transformRotateVec(vec3f(0, 0, -view.zoom));
- view.zoom = 0;
- }
-}
-
-void Modeller::DeleteSelection()
-{
- editUndo.deleteSelection(scene.models);
- SetTouchFlags(false);
- brush()->visible = false;
-}
-
-void Modeller::DuplicateSelection()
-{
- editUndo.duplicateSelection(scene.models);
- window->waitForMouseUp();
-}
-
-void Modeller::HandleKeyPresses()
-{
- SDL_Scancode kp = window->getKeyPress();
-
- if (window->ctrlKey) {
- switch (kp) {
- case SDL_SCANCODE_X:
- DeleteSelection();
- break;
- case SDL_SCANCODE_Z:
- if (window->shiftKey)
- editUndo.redo(scene.models);
- else
- editUndo.undo(scene.models);
- break;
- case SDL_SCANCODE_Y:
- editUndo.redo(scene.models);
- break;
- case SDL_SCANCODE_A:
- SelectAll();
- break;
- case SDL_SCANCODE_V:
- DuplicateSelection();
- break;
- }
- }
- else {
- switch (kp) {
- case SDL_SCANCODE_DELETE:
- if (editMode == ED_CREATE && maxSteps == 0) {
- DeleteLinePoint();
- }
- if (editMode == ED_SELECT) {
- editUndo.deleteSelection(scene.models);
- ClearGizmos();
- }
- break;
- case SDL_SCANCODE_G:
- scene.models[gridRef].visible = !scene.models[gridRef].visible;
- window->waitForMouseUp();
- break;
- case SDL_SCANCODE_P:
- scene.renderOffscreen(views[currentSelView], &outlines);
- window->waitForMouseUp();
- break;
- case SDL_SCANCODE_T:
- scene.renderOffscreen(views[currentSelView], &outlines, 160, 128);
- window->waitForMouseUp();
- break;
- case SDL_SCANCODE_W:
- case SDL_SCANCODE_S:
- Navikeys(kp, SDL_SCANCODE_W, SDL_SCANCODE_S);
- break;
- case SDL_SCANCODE_A:
- case SDL_SCANCODE_D:
- Navikeys(kp, SDL_SCANCODE_A, SDL_SCANCODE_D);
- break;
- case SDL_SCANCODE_R:
- case SDL_SCANCODE_F:
- Navikeys(kp, SDL_SCANCODE_F, SDL_SCANCODE_R);
- break;
- case SDL_SCANCODE_ESCAPE:
- if (fullscreen)
- SetFullScreen();
- else
- if (editMode == ED_CREATE && maxSteps == 0) ResetLineDrawing();
- break;
- }
- }
- //keyPress = ev.key.keysym.scancode;
-}
-
-void Modeller::Navikeys(SDL_Scancode key, SDL_Scancode keyA, SDL_Scancode KeyB)
-{
- if (currentViewIsActive()) {
- viewInfo& view = views[currentView];
- float speed = (window->shiftKey) ? 5.f : 0.5f;
- float dirspd = (key == keyA) ? speed : -speed;
- vec3f dir = (keyA == SDL_SCANCODE_F) ? vec3f(0, dirspd, 0) : (keyA == SDL_SCANCODE_A) ? vec3f(dirspd, 0, 0) : vec3f(0, 0, dirspd);
- ResetZoom();
- view.pan += view.rotInvertMatrix.transformRotateVec(dir);
- SetCurrentSelView(currentView);
- }
-}
-
-void Modeller::CreateBlocks(const vec3f pos)
-{
- int mapSize = 10;
- blockMap.createBlocks(mapSize);
-
- for (int zb = 0; zb < mapSize; zb++) {
- for (int xb = 0; xb < mapSize; xb++) {
- blockMap.createMapChunk(xb, zb, 3);
- }
- }
-
- for (int zb = 0; zb < mapSize; zb++) {
- for (int xb = 0; xb < mapSize; xb++) {
- blockMap.createTrees(xb, zb, 5);
- }
- }
-
- int blocksId = modelGroupId;
- int texRef = resource->loadTexture("assets/maps/", "SurvivalCraft256x256.png", false);
-
- for (int zb = 1; zb < mapSize-1; zb++) {
- for (int xb = 1; xb < mapSize-1; xb++) {
-
- Pi3Cmesh blockmesh("ChunkMesh");
- blockMap.createMeshChunk(resource, blockmesh, xb, zb);
-
- CreateModel(blockmesh, pos, blocksId, 0xffffffff);
- Pi3Cmodel& model = scene.models.back();
- model.name = "ChunkModel";
- model.material.texRef = texRef;
- model.material.texID = resource->getTextureID(texRef);
- blocksId++; //TODO: Clear scene doesn't delete these block ID's ATM
- }
- }
-}
-
-std::function Modeller::SetCallback()
-{
- mgui.takeSnapshot();
- scene.setup2D();
- return std::bind(&Modeller::ShowLoadingBar, this, _1);
-}
-
-void Modeller::CreateLandscape(const vec3f pos, const uint32_t colour)
-{
- //scene.setup2D();
- //std::function loadbarCallback = setCallback();
-
- Pi3Ctexture maptex = Pi3Ctexture("assets/maps/mahe2.png", false);
- CreateModel(Pi3Cshapes::elevationMap(maptex, vec3f(0, -150.f, 0), vec3f(3000.f, 300.f, 3000.f), 764/2, 922 /2, 0,vec2f(1.f,1.f), SetCallback()), pos, modelGroupId, colour);
-
- //createModel(Pi3Cshapes::readSRTM("assets/maps/S05E055.hgt"), pos, modelGroupId, colour);
-}
-
-void Modeller::CreateModel(const Pi3Cmesh& mesh, const vec3f& pos, int32_t groupId, const uint32_t colour, const std::string txfile)
-{
- Pi3Cmodel shape = Pi3Cmodel(resource, mesh, groupId, colour);
- if (shape.meshRef >= 0) {
- ClearSelections();
- //Give unique name for each shape ...
- shapeCounts[createTool]++;
- Pi3Cmesh* mesh = shape.getMesh(resource);
- vertsPtr vp = shape.getMeshVerts(resource);
- mesh->updateBounds(&vp);
- shape.name = mesh->name + std::to_string(shapeCounts[createTool]);
- shape.move(pos);
- shape.selected = true;
- int32_t modelRef = scene.append3D(shape, txfile);
- if (modelRef >= 0) editUndo.create(scene.models);
- }
-}
-
-uint32_t RandomColour()
-{
- uint32_t r = (rand() % 255);// +55;
- uint32_t g = (rand() % 255);// +55;
- uint32_t b = (rand() % 255);// +55;
- return r + (g << 8) + (b << 16);
-}
-
-void Modeller::CreateShapes()
-{
- if (createTool != CT_NONE) {
-
- currentColour = RandomColour();
-
- vec3f pos = -currentPos;
- createFirstPoint = pos;
- maxSteps = 0;
-
- switch (createTool) {
- case CT_CUBOID: CreateModel(Pi3Cshapes::cuboid(vec3f(), vec3f(.01f, .01f, .01f)), pos, modelGroupId, currentColour); maxSteps = 2; break;
- case CT_CYLINDER: CreateModel(Pi3Cshapes::cylinder(vec3f(), .01f, .01f), pos, modelGroupId, currentColour); maxSteps = 2; break;
- case CT_TUBE: CreateModel(Pi3Cshapes::tube(vec3f(), 0.005f, .01f, .01f), pos, modelGroupId, currentColour); maxSteps = 3; break;
- case CT_CONE: CreateModel(Pi3Cshapes::cone(vec3f(), .01f, .01f), pos, modelGroupId, currentColour); maxSteps = 2; break;
- case CT_TCONE: CreateModel(Pi3Cshapes::tcone(vec3f(), .01f, .01f, .01f), pos, modelGroupId, currentColour); maxSteps = 3; break;
- case CT_SPHERE: CreateModel(Pi3Cshapes::sphere(vec3f(), 0.05f), pos, modelGroupId, currentColour); maxSteps = 1; break;
- case CT_TORUS: CreateModel(Pi3Cshapes::torus(vec3f(), .01f, .01f), pos, modelGroupId, currentColour); maxSteps = 2; break;
- case CT_WEDGE: break;
- case CT_EXTRUDE: maxSteps = 0; break;
- case CT_LATHE: maxSteps = 0; break;
- case CT_LINE: maxSteps = 0; break;
- case CT_BLOCKS: CreateBlocks(pos); break;
- case CT_LANDSCAPE: CreateLandscape(pos, currentColour); break;
- }
- }
-}
-
-void Modeller::DeleteLinePoint()
-{
- if (lineCount <= lastMovePoint) return;
-
- Pi3Cmodel& model = scene.models[outlineRef];
- Pi3Cmesh* mesh = model.getMesh(resource);
- vertsPtr vp = model.getMeshVerts(resource);
-
- lines.pop_back();
- vp.offset = lines.size() * mesh->stride;
- mesh->vc = (lines.size() + 2) * mesh->stride;
- lineCount--;
-
- UpdateLineIndexes();
-}
-
-void Modeller::AddLinePoint(const vec3f point)
-{
- Pi3Cmodel& model = scene.models[outlineRef];
- Pi3Cmesh* mesh = model.getMesh(resource);
- vertsPtr vp = model.getMeshVerts(resource);
-
- float snapDistance = 3.f / views[currentView].zoomFactor();
- vec3f newPoint = (lineCount > (lastMovePoint + 1) && (point - createFirstPoint).length() < snapDistance) ? createFirstPoint : point;
-
- //work out mesh offsets and vert sizes for line contours ...
- vp.offset = lines.size() * mesh->stride;
- mesh->vc = (lines.size() + 2) * mesh->stride;
-
- //vec3f cp;
- //if (lines.size() > 1) {
- // cp = (lines[lineCount - 1] ^ lines[(lineCount) % lines.size()]); // .unit() * 10.f;
- //}
-
- if (createCount != lastCreateCount) {
-
- //create new point (left mouse button) ...
-
- if (lineCount == lastMovePoint) {
- createFirstPoint = point;
- model.visible = true;
- }
- lines.push_back(newPoint);
-
- switch (createTool) {
- case CT_EXTRUDE:
- //Join points?
- if (lineCount > (lastMovePoint+1) && newPoint == createFirstPoint) {
- linePaths.emplace_back();
- std::vector& pline = linePaths.back();
- for (int32_t i = lastMovePoint + 1; i < lines.size(); i++) {
- pline.push_back(lines[i]);
- }
- lastMovePoint = lineCount+1;
- }
- break;
- case CT_LATHE:
- break;
- }
-
- lineCount++;
- lastCreateCount = createCount;
- }
-
- Pi3Cshapes::addPoint(vp, newPoint);
- Pi3Cshapes::addPoint(vp, newPoint);
-
- UpdateLineIndexes();
-}
-
-void Modeller::UpdateLineIndexes()
-{
- Pi3Cmodel& model = scene.models[outlineRef];
- Pi3Cmesh& mesh = *(model.getMesh(resource));
-
- mesh.lineIndexes.clear();
- int sc = 0;
- for (auto& c : linePaths) {
- for (int i = 0; i < c.size(); i++) {
- mesh.lineIndexes.push_back(sc + i);
- mesh.lineIndexes.push_back(sc + (i + 1) % c.size());
- }
- sc += c.size() + 1;
- }
-
- int c = lineCount - lastMovePoint;
- for (int i = 0; i < c; i++) {
- mesh.lineIndexes.push_back(sc + i);
- mesh.lineIndexes.push_back(sc + i + 1);
- }
-
- resource->updateMesh(model.meshRef);
-}
-
-void Modeller::TransformLines(std::vector& lines, std::vector& contour, Pi3Cmatrix& matrix, int32_t start)
-{
- for (int32_t i=start; i 2) {
-
- switch (createTool) {
- case CT_EXTRUDE:
- if (lineCount > (lastMovePoint + 1)) {
- //lines.push_back(createFirstPoint); //close current contour
- linePaths.push_back(lines);
- //contours.emplace_back();
- //std::vector& contour = contours.back();
- //transformLines(lines, contour, views[currentView].rotInvertMatrix, lastMovePoint + 1);
- }
-
- //int lm = 0;
- for (auto& lp : linePaths) {
- contours.emplace_back();
- std::vector& contour = contours.back();
- TransformLines(lp, contour, views[currentView].rotInvertMatrix, 0);
- //lm = lp.size();
- }
-
- CreateModel(Pi3Cshapes::extrude("Extrude", vec3f(), contours, 1.f, 1), vec3f(), modelGroupId, currentColour);
- scene.lastModel()->transformVerts(resource, views[currentView].rotMatrix);
- break;
- case CT_LATHE:
- {
- std::vector contour;
- Pi3Cmatrix matrix;
- TransformLines(lines, contour, views[currentView].rotInvertMatrix);
- //Rotate around first point ...
- vec2f fp = contour[0];
- for (auto& p : contour) {
- p.x -= fp.x;
- }
- CreateModel(Pi3Cshapes::lathe("Lathe", vec3f(fp.x, 0, 0.f), contour, true), vec3f(0, 0, 0.f), modelGroupId, currentColour);
- scene.lastModel()->transformVerts(resource, views[currentView].rotMatrix);
- }
- break;
- case CT_LINE:
- break;
- }
-
- }
- ResetLineDrawing();
-}
-
-void Modeller::ResetLineDrawing()
-{
- createCount = 0;
- lineCount = 0;
- lastMovePoint = 0;
- maxSteps = 1;
- contours.clear();
- lines.clear();
- linePaths.clear();
- scene.models[outlineRef].visible = false;
-}
-
-float Modeller::GetShapeHeight(vec3f& pos, vec3f& v1, vec3f& v2)
-{
- float ht = 0;
- if (abs(oldPos.x - createFirstPoint.x) < 0.001f) {
- ht = -(pos.y - oldPos.y);
- pos.x = ht; pos.y = oldPos.y; pos.z = oldPos.z;
- }
- if (abs(oldPos.y - createFirstPoint.y) < 0.001f) {
- ht = -(pos.z - oldPos.z);
- pos.y = ht; pos.x = oldPos.x; pos.z = oldPos.z;
- }
- if (abs(oldPos.z - createFirstPoint.z) < 0.001f) {
- ht = -(pos.y - oldPos.y);
- pos.z = ht; pos.y = oldPos.y; pos.x = oldPos.x;
- }
-
- v1 = pos - createFirstPoint;
- v2 = vec3f(0, 0, 0);
- if (pos.x < createFirstPoint.x) { v2.x = v1.x; v1.x = -v1.x; }
- if (pos.y < createFirstPoint.y) { v2.y = v1.y; v1.y = -v1.y; }
- if (pos.z < createFirstPoint.z) { v2.z = v1.z; v1.z = -v1.z; }
-
- return ht;
-}
-
-void Modeller::CreatingShape()
-{
- vec3f pos = -currentPos;
-
- //if (selectRect) {
- // selRect.width = window->mouse.x - selRect.x;
- // selRect.height = (window->getHeight()-window->mouse.y) - selRect.y;
- // setSelectionRect();
- // SDL_Log("Sel rect: %d,%d,%d,%d", selRect.x, selRect.y, selRect.width, selRect.height);
- // return;
- //}
-
- if (maxSteps == 0) {
- switch (createTool) {
- case CT_EXTRUDE:
- case CT_LATHE:
- case CT_LINE:
- AddLinePoint(pos);
- return;
- default:
- return;
- }
- }
-
- Pi3Cmodel* currentModel = scene.lastModel();
- vertsPtr vp = currentModel->getMeshVerts(resource);
- vec3f v1, v2, csize;
-
- if (createCount == 1) {
- float dist = (pos - createFirstPoint).length();
- switch (createTool) {
- case CT_CUBOID:
- csize = pos - createFirstPoint;
- info = "Cuboid x:" + Pi3Cutils::ftostrdp(csize.x, 2) + " y:" + Pi3Cutils::ftostrdp(csize.y, 2) + " z:" + Pi3Cutils::ftostrdp(csize.z, 2);
- Pi3Cshapes::cube_verts(*vp.verts, vp.offset, (pos - createFirstPoint) / 2.f, csize, 1, 1, 1, 0xffffffff);
- break;
- case CT_CYLINDER:
- info = "Cylinder radius:" + Pi3Cutils::ftostrdp(dist, 2);
- Pi3Cshapes::cylinder_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist, 0.1f);
- break;
- case CT_SPHERE:
- info = "Sphere radius:" + Pi3Cutils::ftostrdp(dist, 2);
- Pi3Cshapes::sphere_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist);
- break;
- case CT_TORUS:
- info = "Torus radius:" + Pi3Cutils::ftostrdp(dist, 2);
- Pi3Cshapes::torus_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist, 0.01f);
- break;
- case CT_CONE:
- info = "Cone radius:" + Pi3Cutils::ftostrdp(dist, 2);
- Pi3Cshapes::cone_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist, 0.01f);
- break;
- case CT_TCONE:
- info = "Truncated cone bottom radius:" + Pi3Cutils::ftostrdp(dist, 2);
- Pi3Cshapes::tcone_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist, dist, 0.01f);
- break;
- case CT_TUBE:
- info = "Tube inner radius:" + Pi3Cutils::ftostrdp(dist, 2);
- Pi3Cshapes::tube_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist, dist *1.01f, 0.01f);
- break;
- }
- oldPos = pos;
- oldPos2 = pos;
- if (createTool != CT_CUBOID) currentModel->transformVerts(resource, views[currentView].rotInvertMatrix);
- }
- else if (createCount == 2) {
- float dist1 = (oldPos - createFirstPoint).length();
- float dist2 = views[currentView].rotInvertMatrix.transformVec(pos - oldPos).y;
- float ht = GetShapeHeight(pos, v1, v2);
- switch (createTool) {
- case CT_CUBOID:
- {
- info = "Cuboid height:" + Pi3Cutils::ftostrdp(ht, 2);
- Pi3Cshapes::cube_verts(*vp.verts, vp.offset, v1 / 2.f + v2, v1, 1, 1, 1, 0xffffffff);
- }
- break;
- case CT_CYLINDER:
- {
- info = "Cylinder height:" + Pi3Cutils::ftostrdp(ht, 2);
- Pi3Cshapes::cylinder_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist1, ht); break;
- }
- break;
- case CT_CONE:
- {
- info = "Cone height:" + Pi3Cutils::ftostrdp(ht, 2);
- Pi3Cshapes::cone_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist1, ht); break;
- }
- break;
- case CT_TORUS:
- info = "Torus thickness:" + Pi3Cutils::ftostrdp(dist2*2.f, 2);
- Pi3Cshapes::torus_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist1, dist2);
- break;
- case CT_TCONE:
- info = "Truncated cone top radius:" + Pi3Cutils::ftostrdp(ht, 2);
- Pi3Cshapes::tcone_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist1, dist1, ht); // (oldPos2 - createFirstPoint).length(), .1f);
- break;
- case CT_TUBE:
- {
- float r1 = dist1;
- float r2 = dist1+ht; // (oldPos2 - createFirstPoint).length();
- //if (r1 > r2) std::swap(r1, r2);
- info = "Tube outer radius:" + Pi3Cutils::ftostrdp(r2, 2);
- Pi3Cshapes::tube_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), r1, r2, .1f);
- }
- break;
- }
- if (createTool != CT_CUBOID) currentModel->transformVerts(resource, views[currentView].rotInvertMatrix);
- oldPos2 = pos;
- oldht = ht;
- }
- else if (createCount == 3) {
- float dist1 = (oldPos - createFirstPoint).length();
- //float dist2 = (oldPos2 - createFirstPoint).length();
- //float ht = (pos - oldPos2).length();
- float ht = GetShapeHeight(pos, v1, v2);
-
- switch (createTool) {
- case CT_TCONE:
- {
- info = "Truncated cone height:" + Pi3Cutils::ftostrdp(ht, 2);
- Pi3Cshapes::tcone_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist1, dist1 + ht-oldht, oldht);
- }
- break;
- case CT_TUBE:
- {
- //if (dist1 > dist2) std::swap(dist1, dist2);
- info = "Tube height:" + Pi3Cutils::ftostrdp(ht, 2);
- Pi3Cshapes::tube_verts(*vp.verts, vp.offset, vec3f(0, 0, 0), dist1, dist1 + oldht, ht - oldht);
- }
- break;
- }
- currentModel->transformVerts(resource, views[currentView].rotInvertMatrix);
- }
- currentModel->refreshMesh(resource);
- //vp = resource->getMeshVerts(scene.lastModel().meshRef);
- //mesh.updateBounds(&vp);
- //model.bbox = mesh.bbox;
- ////mesh.bbox.bboxFromVerts(*vp.verts, vp.offset, mesh.vc, mesh.stride);
- //resource->updateMesh(model.meshRef);
-
- //if (nextStep) createCount++;
-}
-
-void Modeller::MouseButtonUp()
-{
- sceneAction = SA_NONE;
-}
-
-void Modeller::DragMiddleMouseButton(viewInfo& view, vec3f& mouseXYZ)
-{
- SetCurrentSelView(currentView);
- view.pan += view.viewCoords(mouseXYZ);
- sceneAction = SA_PANNING;
-}
-
-void Modeller::DragLeftMouseButton(viewInfo& view, vec3f& mouseXYZ)
-{
- switch (editMode) {
- case ED_SELECT:
- if (selectRect) {
- selRect.width = window->mouse.x - selRect.x;
- selRect.height = (window->getHeight() - window->mouse.y) - selRect.y;
- SetSelectionRect();
- if (selRect.width != 0 || selRect.height != 0) scene.models2D[selRectRef].visible = true;
- //SDL_Log("Sel rect: %d,%d,%d,%d", selRect.x, selRect.y, selRect.width, selRect.height);
- }
- break;
- case ED_CREATE:
- break;
- case ED_MOVE:
- MoveSelections(view.viewCoords(mouseXYZ));
- SetSelectionBox();
- break;
- case ED_ROTATE:
- break;
- case ED_SCALE:
- {
- float sc = -window->mouse.deltaXY.y * 0.1f;
- editUndo.scaleSelections(scene.models, vec3f(sc, sc, sc)); //view.viewCoords(mouseXYZ)*0.5f
- SetSelectionBox();
- }
- break;
- case ED_ROTATESCENE:
- if (view.projection == viewInfo::PERSPECTIVE) {
- view.addRot(vec3f(mouseXYZ.y, mouseXYZ.x, 0) * -0.01f);
- //view.setRotMatrix(view.rot);
- sceneAction = SA_ROTATING;
- //rotating = true;
- }
- break;
- }
-}
-
-void Modeller::ClickLeftMouseButton(viewInfo& view)
-{
- if ((currentViewIsActive() && window->mouse.LeftButton && sceneAction != SA_DRAGBAR)) {
-
- SetCurrentSelView(currentView);
-
- switch (editMode) {
- case ED_CREATE:
- if (createCount == maxSteps) {
- info = "";
- createCount = 0;
- }
- else {
- if (createCount==0) CreateShapes();
- createCount++;
- CreatingShape();
- }
-
- window->waitForMouseUp();
- break;
- case ED_SELECT:
- if (!window->ctrlKey) ClearSelections();
- TouchScene();
- if (touch.selmodel) {
- brush()->matrix.move(touch.intersection);
- editUndo.selectModel(scene.models, &scene.models[touch.parent()], window->ctrlKey);
- }
- else
- {
- selectRect = true;
- brush()->visible = false;
- selRect.x = window->mouse.x;
- selRect.y = window->getHeight() - window->mouse.y;
- }
- //clearSelections();
- break;
- case ED_MOVE:
- //if (!window->ctrlKey) clearSelections();
- TouchScene();
- if (touch.selmodel) {
- editUndo.selectModel(scene.models, touch.selmodel, window->ctrlKey);
- scene.models[touch.parent()].selected = true;
- }
- else ClearSelections();
- break;
- case ED_DROPMAN:
- TouchScene();
- break;
- case ED_ROTATE:
- case ED_ROTATESCENE:
- SetCursor(handCursor);
- break;
- case ED_SCALE:
- editUndo.setSelectionCentre(scene.models);
- //scene.models[selboxRef].visible = false;
- break;
- }
-
- }
-}
-
-void Modeller::ClickRightMouseButton(viewInfo& view)
-{
- if (currentViewIsActive() && window->mouse.RightButton) {
-
- SetCurrentSelView(currentView);
-
- switch (editMode) {
- case ED_CREATE:
- if (maxSteps == 0) {
- FinishLine();
- }
- window->waitForMouseUp();
- break;
- case ED_SELECT:
- TouchScene();
- if (touch.selmodel) {
- brush()->matrix.move(touch.intersection);
- editUndo.selectModel(scene.models, &scene.models[touch.parent()], window->ctrlKey);
- //scene.models[touch.groupRefs[0]].selected = touch.selmodel->selected;
- }
- else
- ClearSelections();
- break;
- case ED_MOVE:
- TouchScene();
- if (touch.selmodel) {
- editUndo.selectModel(scene.models, touch.selmodel, window->ctrlKey);
- scene.models[touch.parent()].selected = true;
- }
- else ClearSelections();
- break;
- case ED_DROPMAN:
- TouchScene();
- break;
- case ED_ROTATE:
- break;
- case ED_SCALE:
- editUndo.setSelectionCentre(scene.models);
- //scene.models[selboxRef].visible = false;
- break;
- }
-
- }
-}
-
-void Modeller::TouchScene()
-{
- if (sceneAction != SA_NONE) return;
-
- if (currentViewIsActive()) {
-
- TouchView(views[currentView]);
-
- if (editMode == ED_CREATE) SetCursor(crossCursor);
-
- //Pi3Cmodel& brush = scene.models[brushref];
- //Pi3Cmodel& selmodel = scene.models[touch.parent()];
-
- if (touch.selmodel) {
-
- //move 3D pointer (sphere) to touch intersetion point ...
- currentPos = -touch.intersection;
-
- //brush()->matrix.move(touch.intersection);
- SetTouchFlags(true);
- touch.selmodel->selected = true;
- brush()->visible = false;
-
- switch (editMode) {
- case ED_SELECT:
- brush()->visible = true;
- TouchObject(*touch.selmodel);
- SetCursor(arrowCursor);
- break;
- case ED_MOVE:
- SetCursor(moveCursor);
- break;
- case ED_ROTATE:
- SetCursor(handCursor);
- break;
- case ED_SCALE:
- SetCursor(handCursor);
- break;
- case ED_DROPMAN:
- DropMan();
- break;
- }
-
- }
- else {
- SetTouchFlags(false);
- selectedName = "";
- }
- }
- else {
- SetCursor(arrowCursor);
- }
-}
-
-void Modeller::ShowLoadingBar(float perc)
-{
- mgui.ShowProgressCB(window, "Loading ", perc);
-}
-
-void Modeller::HandleEvents(std::vector& eventList)
-{
- if (eventList.size() == 0) return;
-
- // process window events ...
- viewInfo& view = views[currentView];
-
- for (auto& ev : eventList) {
- switch (ev)
- {
- case SDL_MOUSEBUTTONDOWN:
- //SDL_Log("MouseDown");
- if (window->mouse.LeftButton) ClickLeftMouseButton(view);
- if (window->mouse.RightButton) ClickRightMouseButton(view);
- break;
- case SDL_MOUSEBUTTONUP:
- SDL_Log("MouseUp");
- if (selectRect) {
- //vec2f p1 = views[currentView].getMouseToWorldCoords(selRect.x, selRect.y);
- //vec2f p2 = views[currentView].getMouseToWorldCoords(selRect.x + selRect.width, selRect.y + selRect.height);
- //scene.touchRect(Pi3Crect(p1.x, p1.y, p2.x - p1.x, p2.y - p1.y), views[currentView]);
- scene.touchRect(Pi3Crect(selRect.x, selRect.y, selRect.width, selRect.height), views[currentView]);
- selRectangle()->visible = false;
- selectRect = false;
- }
- MouseButtonUp();
- break;
- case SDL_MOUSEMOTION:
- //SDL_Log("MouseMove");
- if (currentViewIsActive() && sceneAction != SA_DRAGBAR) {
- if (window->mouse.anyButton()) {
- vec3f mouseXYZ = vec3f(window->mouse.deltaXY.x, -window->mouse.deltaXY.y, 0);
- //float sc = -window->mouse.deltaXY.y * 0.1f;
- if (window->mouse.MiddleButton) DragMiddleMouseButton(view, mouseXYZ);
- if (window->mouse.LeftButton) DragLeftMouseButton(view, mouseXYZ);
- } else if (createCount > 0) {
- CreatingShape();
- window->waitForMouseUp();
- break;
- }
- }
- break;
- case SDL_MOUSEWHEEL:
- if (currentViewIsActive()) {
- view.zoom += window->mouse.wheel * view.zoomFactor();
- SetCurrentSelView(currentView);
- sceneAction = SA_ZOOMING;
- }
- break;
- case SDL_WINDOWEVENT:
- if (window->resized) {
- mgui.resize();
- window->resized = false;
- }
- break;
- case SDL_KEYDOWN:
- HandleKeyPresses();
- break;
- case SDL_DROPFILE:
- std::string file = window->dropfile;
- std::string ext = Pi3Cutils::getExt(file); // .substr(file.size() - 4, 4);
-
- if (LoadModelAtPosition(file, touch.touching ? touch.intersection : vec3f(), SetCallback())) { }
-
- else if (ext == "png" || ext == "jpg") {
- SetCurrentSelView(currentView);
- SetMousePosition(window->mouse.x, window->getHeight() - window->mouse.y);
- TouchView(views[currentView]);
- if (touch.touching) {
- touch.selmodel->addTexture(resource, file.c_str());
- touch.selmodel->material.SetColDiffuse(0xffffffff);
- }
- }
- mgui.startSnapshot();
- break;
- }
- }
-
-}
-
-void Modeller::SaveFileOBJ(const std::string& path, const std::string& filename, bool selected)
-{
- std::string err;
- Pi3CfileOBJ::save(path, filename, &scene, selected, nullptr, err);
-}
-
-void Modeller::SaveScene(const std::string& path, const std::string& filename, bool selected, Pi3Cscene& scene)
-{
- //Pi3CfileScene fs(path, filename, selected, scene);
-}
-
-bool Modeller::LoadModelAtPosition(const std::string& modelfile, const vec3f pos, const std::function showProgressCB)
-{
- std::string ext = Pi3Cutils::getExt(modelfile);
- if (ext == "obj") {
- int32_t modelRef = scene.loadModelOBJ("", modelfile, pos, true, modelGroupId, false, showProgressCB);
- return true;
- }
- else if (ext == "fbx") {
- Pi3CopenFBX fbx(modelfile);
- fbx.importToScene(resource, &scene);
- return true;
- }
- else if (ext == "gltf" || ext == "glb") {
- //Pi3Cgltf gltf(resource, &scene, modelfile);
- Pi3Cfxgltf gltf(resource, &scene, modelfile, showProgressCB);
- return true;
- }
- return false;
-}
-
-void Modeller::MoveSelections(const vec3f& vec)
-{
- editUndo.moveSelections(scene.models, vec);
- sceneAction = SA_ZOOMING;
-}
-
-void Modeller::SetCurrentSelView(int32_t selview)
-{
- if (currentSelView != selview) currentSelView = selview;
-}
-
-void Modeller::DropMan()
-{
- viewInfo& view = views[currentView];
- view.pos = vec3f(0, 0, 0);
- view.zoom = 0.f;
- view.pan = currentPos + vec3f(0,-2.f,0);
-}
-
-void Modeller::SetFullScreen()
-{
- if (fullscreen) {
- SDL_SetWindowFullscreen(window->handle(), 0);
- views[viewInfo::BOTTOMRIGHT].pan = views[viewInfo::FULLSCREEN].pan;
- views[viewInfo::BOTTOMRIGHT].rot = views[viewInfo::FULLSCREEN].rot;
- views[viewInfo::BOTTOMRIGHT].pos = views[viewInfo::FULLSCREEN].pos;
- views[viewInfo::BOTTOMRIGHT].zoom = views[viewInfo::FULLSCREEN].zoom;
- currentView = viewInfo::FULL;
- views[currentView] = views[viewInfo::BOTTOMRIGHT];
- SetCurrentSelView(currentView);
- }
- else {
-
- int r = SDL_SetWindowFullscreen(window->handle(), SDL_WINDOW_FULLSCREEN);
- if (r < 0) {
- r = SDL_SetWindowFullscreen(window->handle(), SDL_WINDOW_FULLSCREEN_DESKTOP);
- if (r < 0) {
- SDL_SetWindowFullscreen(window->handle(), 0);
- }
- else {
- SDL_DisplayMode dm;
- SDL_GetCurrentDisplayMode(0, &dm);
- window->resizeWindow(dm.w, dm.h);
- }
- }
- else
- {
- window->resizeWindow(1440, 900); //RPi can't seem to go fullscreen with a specified res - just drop it
- }
-
- currentView = viewInfo::FULLSCREEN;
- views[viewInfo::FULLSCREEN].pan = views[viewInfo::BOTTOMRIGHT].pan;
- views[viewInfo::FULLSCREEN].rot = views[viewInfo::BOTTOMRIGHT].rot;
- views[viewInfo::FULLSCREEN].pos = views[viewInfo::BOTTOMRIGHT].pos;
- views[viewInfo::FULLSCREEN].zoom = views[viewInfo::BOTTOMRIGHT].zoom;
- editMode = ED_ROTATESCENE;
- views[currentView].viewport = window->getRect();
- SetCurrentSelView(currentView);
- }
- fullscreen = !fullscreen;
-
- //window->waitForMouseUp();
-}
-
-void Modeller::SetFullScene()
-{
- if (window->mouse.up) {
- if (fullview == viewInfo::INACTIVE) {
- fullview = currentSelView;
- views[viewInfo::FULL] = views[currentSelView];
- SetCurrentSelView(viewInfo::FULL);
- }
- else {
- SetCurrentSelView(fullview);
- fullview = viewInfo::INACTIVE;
- }
- }
- window->waitForMouseUp();
-}
-
-void Modeller::SetCursor(SDL_Cursor *newCursor)
-{
- if (newCursor != currentCursor) {
- currentCursor = newCursor;
- SDL_SetCursor(currentCursor);
- }
-}
-
-void Modeller::SetDragBar(bool on, SDL_Cursor *newCursor)
-{
- if (!selectRect) {
- if (on && sceneAction != SA_DRAGBAR) {
- sceneAction = SA_DRAGBAR;
- SDL_SetCursor(newCursor);
- }
- else if (!on && sceneAction == SA_DRAGBAR) {
- sceneAction = SA_NONE;
- SDL_SetCursor(currentCursor);
- }
- }
-}
-
-void Modeller::TouchView(viewInfo& vi)
-{
- switch (vi.projection) {
- case viewInfo::PERSPECTIVE: TouchPerspectiveView(vi); break;
- case viewInfo::ORTHOGRAPHIC: TouchOrthoView(vi); break;
- }
-}
-
-void Modeller::TouchPerspectiveView(viewInfo &vi)
-{
- scene.setMatrix(vi.pan, vec3f(0, 0, -vi.zoom), vi.rot);
- scene.setPerspective3D(vi.viewport.width, vi.viewport.height, vi.pspvalue, vi.psp_nearz, vi.psp_farz);
- float iy = window->getHeight() - window->mouse.y;
- vec3f mousexyz(vi.viewport.width*0.5f - (window->mouse.x - vi.viewport.x), vi.viewport.height*0.5f - (iy - vi.viewport.y), 0);
- touch = scene.touch(mousexyz, true);
-}
-
-void Modeller::TouchOrthoView(viewInfo &vi)
-{
- scene.setMatrix(vi.pos, vec3f(0, 0, 0), vi.rot);
- scene.setOrthographic3D(vi.viewport, vi.zoom, vi.ortho_nearz, vi.ortho_farz);
- vec3f mousexyz = -currentPos;
- touch = scene.touch(mousexyz, false);
-}
-
-void Modeller::SetSelectionBox()
-{
- Pi3Cbbox3d bbox = scene.getSelectedBounds();
- Pi3Cmodel& selBox = scene.models[selboxRef];
- vertsPtr vp = selBox.getMeshVerts(resource);
- Pi3Cgizmos::select_box_verts(*vp.verts, vp.offset, bbox.min, bbox.size(), 0xffffff);
- resource->updateMesh(selBox.meshRef);
-}
-
-void Modeller::SetSelectionRect()
-{
- Pi3Cmodel& srm = scene.models2D[selRectRef];
- vertsPtr vp = srm.getMeshVerts(resource);
- Pi3Cshapes::rectLine_verts(*vp.verts, vp.offset, vec2f((float)selRect.x, (float)selRect.y), vec2f((float)selRect.width, (float)selRect.height), vec2f(), vec2f(), 0xffffff);
- resource->updateMesh(srm.meshRef);
-}
-
-void Modeller::TouchObject(Pi3Cmodel& selmodel)
-{
- SetSelectionBox();
- selectedName = selmodel.name;
- scene.models[moveGizmoRef].matrix.move(selmodel.bbox.center());
-}
-
-void Modeller::SetTouchFlags(bool val)
-{
- //scene.models[brushref].visible = val;
- scene.models[selboxRef].visible = val;
- scene.models[moveGizmoRef].visible = val;
-}
-
-
-
-void Modeller::ClearSelections()
-{
- editUndo.clearSelections(scene.models);
-}
-
-void Modeller::SelectAll()
-{
- editUndo.selectAll(scene.models);
-}
-
-void Modeller::Animate()
-{
-
-}
-
-void Modeller::SetCreateTool(const CreateTool tool)
-{
- createTool = tool;
- editMode = ED_CREATE;
- //mgui.startSnapshot();
- SetCursor(crossCursor);
-}
-
-void Modeller::SetEditMode(const EditMode mode)
-{
- createTool = CT_NONE;
- editMode = mode;
- //mgui.startSnapshot();
-}
-
-void Modeller::SetMousePosition(int x, int y)
-{
- currentPos = views[currentView].calcMouseXYZ(x, y);
-}
-
-void Modeller::HandleIMGUI()
-{
- if (mgui.DoIMGUI(this)) {
- prevCursor = handCursor;
- SDL_SetCursor(handCursor);
- }
- else if (prevCursor != currentCursor) {
- SDL_SetCursor(currentCursor);
- prevCursor = currentCursor;
- }
- // SDL_SetCursor(currentCursor);
- //};
-
-}
-
-void Modeller::RenderScene(viewInfo &view)
-{
- view.ticks = window->getTicks();
- scene.renderView(view, &outlines);
-}
-
-Pi3Crecti Modeller::ViewRect(const viewInfo::SceneLayout projection)
-{
- switch (projection) {
- case viewInfo::FULL: return mgui.GetRectFull();
- case viewInfo::BOTTOMRIGHT: return mgui.GetRectBottomRight();
- case viewInfo::BOTTOMLEFT: return mgui.GetRectBottomLeft();
- case viewInfo::TOPLEFT: return mgui.GetRectTopLeft();
- case viewInfo::TOPRIGHT: return mgui.GetRectTopRight();
- }
-}
-
-void Modeller::RenderView(const viewInfo::SceneLayout projection, const Pi3Crecti& rect, int32_t mx, int32_t my)
-{
- //if (refreshed() && (mx(rect.x + rect.width) || my(rect.y + rect.height))) return;
- //window->clearRect(rect);
- views[projection].viewport = rect;
- if (views[projection].viewport.touch(mx, my)) currentView = projection;
- RenderScene(views[projection]);
-}
-
-void Modeller::Render()
-{
- resource->calls = 0;
-
- if (fullscreen) {
- currentView = viewInfo::FULLSCREEN;
- RenderScene(views[currentView]);
- return;
- }
-
- Pi3Crecti screenRect(0, 0, window->getWidth(), window->getHeight());
- int mx = window->mouse.x;
- int my = window->getHeight() - window->mouse.y;
-
- //Render 2D
- scene.setViewport(screenRect);
- scene.setFixedLight(0xffffff, vec3f(0, 1000.f, 1000.f));
- scene.setViewport2D(screenRect, 0.1f, 2000.f);
- //scene.render2D(window->getTicks());
- scene.setup2D();
- HandleIMGUI(); //must be in the rendering loop with 2D setup
-
- currentView = viewInfo::INACTIVE;
-
- if (fullview >= 0) {
- RenderView(viewInfo::FULL, mgui.GetRectFull(), mx, my);
- //views[viewInfo::FULL].viewport = mgui.getRectFull();
- //currentView = viewInfo::FULL;
- //renderScene(views[viewInfo::FULL]);
- }
- else {
- RenderView(viewInfo::BOTTOMRIGHT, mgui.GetRectBottomRight(), mx, my); //render perspective view
- RenderView(viewInfo::BOTTOMLEFT, mgui.GetRectBottomLeft(), mx, my);
- RenderView(viewInfo::TOPLEFT, mgui.GetRectTopLeft(), mx, my);
- RenderView(viewInfo::TOPRIGHT, mgui.GetRectTopRight(), mx, my);
- }
-
- scene.setViewport(screenRect);
- scene.setup2D();
- //scene.render2D(window->getTicks());
- mgui.DragBars(this);
-
- if (currentView != viewInfo::INACTIVE) {
- std::string text = "X:" + Pi3Cutils::ftostrdp(currentPos.x, 2) + ", Y:" + Pi3Cutils::ftostrdp(currentPos.y, 2) + ", Z:" + Pi3Cutils::ftostrdp(currentPos.z, 2)+" "+info;
- Pi3Crecti prect = ViewRect((viewInfo::SceneLayout)currentSelView);
- mgui.PrintText(text, prect.x + 8, window->getHeight() - prect.y - 30, 0xffffffff);
- }
-}
-
-void Modeller::Snapshot() {
- scene.renderOffscreen(views[currentSelView], &outlines);
-}
diff --git a/Examples/3D modeller/Source/Modeller.h b/Examples/3D modeller/Source/Modeller.h
deleted file mode 100644
index 8d11e82..0000000
--- a/Examples/3D modeller/Source/Modeller.h
+++ /dev/null
@@ -1,212 +0,0 @@
-#pragma once
-#include "Pi3Cwin.h"
-#include "Pi3Cresource.h"
-#include "Pi3Cscene.h"
-#include "Pi3Cavatar.h"
-#include "Pi3CloadOptions.h"
-//#include "Pi3CfileScene.h"
-#include "Pi3Cimgui.h"
-#include "Pi3Crect.h"
-#include "ModellerGUI.h"
-#include "Pi3Cgizmos.h"
-#include "Pi3Cediting.h"
-#include "Pi3CfileOBJ.h"
-#include "Pi3CviewInfo.h"
-#include "Pi3Cblocks.h"
-
-class Modeller {
-public:
-
- Modeller(Pi3Cresource *resource, Pi3Cwindow *window);
- ~Modeller();
-
- enum EditMode { ED_SELECT, ED_ROTATE, ED_MOVE, ED_SCALE, ED_CREATE, ED_CONTOUR, ED_ROTATESCENE, ED_DROPMAN };
- enum CreateTool { CT_CUBOID, CT_SPHERE, CT_CYLINDER, CT_CONE, CT_TCONE, CT_TUBE, CT_TORUS, CT_WEDGE, CT_EXTRUDE, CT_LATHE, CT_TEXT, CT_LIBSHAPE, CT_LANDSCAPE, CT_LINE, CT_BLOCKS, CT_NONE };
- enum SceneAction { SA_NONE, SA_PANNING, SA_ZOOMING, SA_ROTATING, SA_DRAGBAR };
-
- void SetupGUI(loadOptions &opts);
- void SetCreateTool(const CreateTool tool);
- void SetEditMode(const EditMode mode);
- void SetMousePosition(int x, int y);
-
- void HandleKeys();
- void HandleEvents(std::vector& eventList);
- void HandleIMGUI();
- void TouchScene();
- //void tweens();
- void Render();
- void RenderScene(viewInfo &view);
- void Animate();
- //void open();
- void Init();
- void SetCursor(SDL_Cursor *newCursor);
- void setDragBarH(bool on) { SetDragBar(on, WECursor); };
- void setDragBarV(bool on) { SetDragBar(on, NSCursor); };
- void DropMan();
- void SetFullScreen();
- void SetFullScene();
-
- void SaveScene(const std::string& path, const std::string& filename, bool selected, Pi3Cscene& scene);
- void ClearScene();
- void ClearGizmos();
- bool isPerspective() { return views[currentView].projection == viewInfo::PERSPECTIVE; }
- bool initialised() { return (resource != nullptr); }
- void CreateModel(const Pi3Cmesh& mesh, const vec3f& pos, int32_t groupId, const uint32_t colour = 0xffffffff, std::string txfile="");
- void CreateLandscape(const vec3f pos, const uint32_t colour);
- void SaveFileOBJ(const std::string& path, const std::string& filename, bool selected = false);
- bool LoadModelAtPosition(const std::string& modelfile, const vec3f pos, const std::function showProgressCB);
- bool currentViewIsActive() { return (currentView != viewInfo::INACTIVE && !mgui.somethingSelected()) || fullscreen; }
-
- void Snapshot();
- void ClearSelections();
- void SelectAll();
- void DeleteSelection();
- void DuplicateSelection();
-
- viewInfo SetupView(const viewInfo::ViewProject view);
- Pi3Crecti ViewRect(const viewInfo::SceneLayout projection);
-
-
- Pi3Cresource *resource = nullptr;
- Pi3Cwindow *window = nullptr;
- Pi3Cscene scene;
-
-
- //void loadModelLibrary(const std::string &path, const std::vector &vals);
- //Pi3Cmodel loadScene(const std::string &file, vec3f &grid);
- //Pi3Cmodel createScene(const uint32_t width, const uint32_t depth, Pi3Cmodel *usemodel, const vec3f &grid);
- //Pi3Cmodel * findModel(const std::string &modelName); //searches all sub-libs to find model
- //Pi3Cmodel * selectLib(const std::string &libName);
-
-
- Pi3Cavatar player;
- std::map modelLibrary;
- std::vector libnames;
-
- //Pi3Cmodel *modelsLib;
-
- vec4f lastCol { 0, 0, 0, 0 };
- EditMode editMode = ED_SELECT;
- CreateTool createTool = CT_CUBOID;
- SceneAction sceneAction = SceneAction::SA_NONE;
-
- int createCount = 0;
- int lastCreateCount = 0;
- int maxSteps = 1;
- Pi3Cmesh currentShape;
- vec3f createFirstPoint;
- vec3f oldPos;
- vec3f oldPos2;
- float oldht;
- std::vector lines; //used for creating lines/extrude and lathe
- std::vector> linePaths;
- std::vector> contours; //used for creating Extrude
-
- std::string libShape; //Create tool library shape file
- int32_t modelGroupId = 1; // used for identifying model materials
-
- //bool modeChange = true;
- //float edTransition = 0;
- //vec3f editpos{ 0, 0.f, -300.f };
- //vec3f editrot{ .7f, .7f, 0 };
- vec3f grid;
- bool gridlock = false;
- Pi3Cmodel *selGroup = nullptr;
- //uint32_t currentSel = 1;
- std::string currentLib;
- std::string currentModel;
- uint32_t currentColour = 0xffffff;
- Pi3Cmaterial outlines;
- bool keypress = false;
- bool fullscreen = false;
-
- bool selectRect = false;
- Pi3Crecti selRect;
- int32_t selRectRef;
-
- Pi3Ctouch touch;
-
- viewInfo views[6];
- int32_t currentView = viewInfo::BOTTOMRIGHT;
- int32_t currentSelView = currentView;
- int32_t fullview = viewInfo::INACTIVE;
-
- //scene model refs ..
- int32_t brushref = -1;
- int32_t sceneModelRef = -1;
- int32_t skybox = -1;
- int32_t gridRef = -1;
- int32_t selboxRef = -1;
- int32_t moveGizmoRef = -1;
- int32_t outlineRef = -1;
- std::string selectedName;
- uint32_t shapeCounts[50] {};
-
- Pi3Cedit editUndo; //used for editing scene with undo/redo support
-
- float sc = 0.5f;
-
- float cx = 0;
- float cy = 0;
- vec3f currentPos;
- int32_t lineCount = 0;
- int32_t lastMovePoint = 0;
- vec3f lastPoint;
- //bool ctrlKey = false;
- //bool shiftKey = false;
-
- SDL_Cursor * handCursor = nullptr;
- SDL_Cursor * arrowCursor = nullptr;
- SDL_Cursor * moveCursor = nullptr;
- SDL_Cursor * crossCursor = nullptr;
- SDL_Cursor * textCursor = nullptr;
- SDL_Cursor * currentCursor = nullptr;
- SDL_Cursor* prevCursor = nullptr;
- SDL_Cursor * WECursor = nullptr;
- SDL_Cursor * NSCursor = nullptr;
-
-private:
- MGui mgui;
- //Pi3Cbbox3d selbbox;
-
- std::string info;
- Blocks blockMap;
-
- void CreateCursors();
- void DeleteCursors();
-
- void TouchView(viewInfo &vi);
- void TouchPerspectiveView(viewInfo &vi);
- void TouchOrthoView(viewInfo &vi);
- void TouchObject(Pi3Cmodel& selmodel);
- void SetDragBar(bool on, SDL_Cursor * newCursor);
- void SetSelectionBox();
- void SetSelectionRect();
- void MoveSelections(const vec3f& vec);
- void SetCurrentSelView(int32_t selview);
- void HandleKeyPresses();
- void CreateShapes();
- void CreatingShape();
- void CreateBlocks(const vec3f pos);
- void ClickLeftMouseButton(viewInfo& view);
- void ClickRightMouseButton(viewInfo& view);
- void MouseButtonUp();
- void DragLeftMouseButton(viewInfo& view, vec3f& mouseXYZ);
- void DragMiddleMouseButton(viewInfo& view, vec3f& mouseXYZ);
- void SetTouchFlags(bool val);
- void ResetZoom();
- void Navikeys(SDL_Scancode key, SDL_Scancode keyA, SDL_Scancode KeyB);
- void AddLinePoint(const vec3f point);
- void DeleteLinePoint();
- void UpdateLineIndexes();
- void FinishLine();
- void TransformLines(std::vector& lines, std::vector& contour, Pi3Cmatrix& matrix, int32_t start = 0);
- float GetShapeHeight(vec3f& pos, vec3f& v1, vec3f& v2);
- void RenderView(const viewInfo::SceneLayout projection, const Pi3Crecti& rect, int32_t mx, int32_t my);
- void ResetLineDrawing();
- void ShowLoadingBar(float perc);
- std::function SetCallback();
-
- Pi3Cmodel* brush() { return &scene.models[brushref]; }
- Pi3Cmodel* selRectangle() { return &scene.models2D[selRectRef]; }
-};
diff --git a/Examples/3D modeller/Source/ModellerGUI.cpp b/Examples/3D modeller/Source/ModellerGUI.cpp
deleted file mode 100644
index d6dba02..0000000
--- a/Examples/3D modeller/Source/ModellerGUI.cpp
+++ /dev/null
@@ -1,532 +0,0 @@
-#include "ModellerGUI.h"
-#include "Modeller.h"
-#include "Pi3Cutils.h"
-
-void MGui::Init(loadOptions &opts, Pi3Cresource * resource, Pi3Cwindow *window, const std::string& defaultStyle)
-{
- gui.init(resource, window);
-
- if (defaultStyle != "") guiStyle.LoadUIstyle(defaultStyle);
-
- // Get GUI fonts
- //resource->addFont(opts.asString("fontsPath").c_str(), opts.asString("font1").c_str(), 80);
- largeFont = gui.addFont(opts.asString("fontsPath").c_str(), opts.asString("font1").c_str(), 28);
- mediumFont = gui.addFont(opts.asString("fontsPath").c_str(), opts.asString("font1").c_str(), 20);
- smallFont = gui.addFont(opts.asString("fontsPath").c_str(), opts.asString("font1").c_str(), 16);
-
- gui.setImagePath("assets/icons");
-
- // Setup GUI button styles ...
- bsMenu.font = smallFont;
- bsMenu.textColour = 0x0;
- bsMenu.buttonAlpha = 1.f;
- bsMenu.buttonColour = guiStyle.iconColour;
- bsMenu.minHeight = 32;
- bsMenu.minWidth = 70;
- bsMenu.vertGap = 0;
- bsMenu.left = 5;
- bsMenu.highlightColour = Pi3Ccolours::LightGray;
-
- bsHeading.font = largeFont;
- bsHeading.textColour = guiStyle.iconColour;
- bsHeading.highlightColour = guiStyle.highlight;
- bsHeading.buttonColour = guiStyle.backColour;
- bsHeading.top = 0;
- bsHeading.bottom = 0;
- bsHeading.left = 0;
- bsHeading.right = 0;
-
- bsIcons.font = largeFont;
- bsIcons.textColour = guiStyle.iconColour;
- bsIcons.buttonColour = guiStyle.backColour;
- bsIcons.highlightColour = guiStyle.highlight;
- bsIcons.minWidth = 32;
- bsIcons.minHeight = 32;
- bsIcons.top = 0;
- bsIcons.bottom = 0;
- bsIcons.left = 0;
- bsIcons.right = 0;
- bsIcons.horizGap = 0;
- bsIcons.sameLine = true;
- bsIcons.selectColour = guiStyle.selectColour;
-
- bsButtons.font = largeFont;
- bsButtons.textColour = guiStyle.iconColour;
- bsButtons.buttonColour = guiStyle.backColour;
- bsButtons.highlightColour = guiStyle.highlight;
- bsButtons.justify = Pi3Cimgui::CENTRE;
- bsButtons.align = Pi3Cimgui::CENTRE;
- bsButtons.minWidth = 40;
- bsButtons.minHeight = 40;
- bsButtons.top = 0;
- bsButtons.bottom = 0;
- bsButtons.left = 0;
- bsButtons.right = 0;
- bsButtons.vertGap = 0;
- bsButtons.selectColour = guiStyle.selectColour;
- //bsButtons.sameLine = true;
-
- bsItems.font = smallFont;
- bsItems.buttonAlpha = 0.8f;
- bsItems.buttonColour = guiStyle.iconColour;
- bsItems.textColour = 0x404040;
- bsItems.minWidth = 140;
- bsItems.minHeight = 40;
- bsItems.justify = Pi3Cimgui::CENTRE;
- bsItems.align = Pi3Cimgui::BOTTOM;
- bsItems.selectColour = guiStyle.selectColour;
-
- bsDialog.font = smallFont;
- bsDialog.buttonAlpha = 0.8f;
- bsDialog.buttonColour = guiStyle.backColour;
- bsDialog.textColour = 0x404040;
- bsDialog.minWidth = 32;
- bsDialog.minHeight = 32;
- bsDialog.justify = Pi3Cimgui::CENTRE;
- bsDialog.align = Pi3Cimgui::CENTRE;
- bsDialog.selectColour = guiStyle.selectColour;
- bsDialog.highlightColour = Pi3Ccolours::Yellow;
-}
-
-void MGui::RenderBorder(uint32_t currentSelView)
-{
- Pi3Crecti rec;
- switch (currentSelView) {
- case viewInfo::TOPLEFT: rec = GetRectTopLeft(); break;
- case viewInfo::TOPRIGHT:rec = GetRectTopRight(); break;
- case viewInfo::BOTTOMLEFT:rec = GetRectBottomLeft(); break;
- case viewInfo::BOTTOMRIGHT:rec = GetRectBottomRight(); break;
- case viewInfo::FULL:rec = GetRectFull(); break;
- }
-
- if (rec.width > 0) {
- gui.renderThickRect(rec, 4, guiStyle.borderColour);
- }
-}
-
-Pi3Crecti MGui::GetRectBottomRight()
-{
- return Pi3Crecti(leftbarWidth + (int)((float)workWidth * dragBarX) + dbh, botbarHeight, (int)((float)workWidth * ibx)-dbh, (int)((float)workHeight * iby));
-}
-
-Pi3Crecti MGui::GetRectBottomLeft()
-{
- return Pi3Crecti(leftbarWidth, botbarHeight, (int)((float)workWidth * dragBarX) - dbh, (int)((float)workHeight * iby));
-}
-
-Pi3Crecti MGui::GetRectTopRight()
-{
- return Pi3Crecti(leftbarWidth + (int)((float)workWidth * dragBarX) + dbh, botbarHeight + (int)((float)workHeight * iby) + dbh, (int)((float)workWidth * ibx)-dbh, (int)((float)workHeight * dragBarY) - dbh * 4);
-}
-
-Pi3Crecti MGui::GetRectTopLeft()
-{
- return Pi3Crecti(leftbarWidth, botbarHeight + (int)((float)workHeight * iby) + dbh, (int)((float)workWidth * dragBarX) - dbh, (int)((float)workHeight * dragBarY) - dbh * 4);
-}
-
-Pi3Crecti MGui::GetRectFull()
-{
- return Pi3Crecti(leftbarWidth, botbarHeight, workWidth, workHeight-dbh * 3);
-}
-
-Pi3Cpointi MGui::GetTopLeft()
-{
- return Pi3Cpointi(leftbarWidth + dbh, topbarHeight + menuHeight + dbh*2);
-}
-
-bool MGui::DraggingBars()
-{
- return draggingBarX || draggingBarY;
-}
-
-float DragLimit(float& dragPos, float pos)
-{
- dragPos = pos;
- if (dragPos < 0.02f) dragPos = 0.02f;
- if (dragPos > 0.98f) dragPos = 0.98f;
- return 1.f - dragPos;
-}
-
-void MGui::UpdateWorkArea(Modeller* md) {
- workWidth = md->window->getWidth() - leftbarWidth - rightbarWidth;
- workHeight = md->window->getHeight() - menuHeight - topbarHeight - botbarHeight;
-}
-
-void MGui::DragViewportBars(Modeller * md, Pi3Cpointi& wpos, int midht)
-{
- bool leftClick = md->window->mouse.LeftButton;
- int mx = md->window->mouse.x;
- int my = md->window->mouse.y;
- bool notDraggingOthers = md->selectRect || draggingBarX || draggingBarY;
-
- UpdateWorkArea(md);
-
- if (md->fullview == viewInfo::INACTIVE) {
- //Drag bar horizontal ...
- gui.setPosition(leftbarWidth + (int)(dragBarX * (float)workWidth - dragBarThickness * 0.5f), wpos.y);
-
- bool touchDragBarH = gui.renderRect((int)dragBarThickness, midht, 0xffffffff);
- if (touchDragBarH || draggingBarX) md->setDragBarH(true);
-
- if (touchDragBarH && leftClick && !notDraggingOthers) {
- draggingBarX = true;
- }
- else if (draggingBarX && leftClick) {
- ibx = DragLimit(dragBarX, (float)(mx - leftbarWidth) / (float)workWidth);
- }
- else {
- draggingBarX = false;
- }
-
- //Drag bar vertical ...
- gui.setPosition(leftbarWidth, topbarHeight + menuHeight + (int)((float)workHeight*dragBarY - dragBarThickness * 0.5f));
-
- bool touchDragBarV = gui.renderRect(workWidth, (int)dragBarThickness, 0xffffffff);
- if (touchDragBarV || draggingBarY) md->setDragBarV(true);
-
- if (touchDragBarV && leftClick && !notDraggingOthers) {
- draggingBarY = true;
- }
- else if (draggingBarY && leftClick) {
- iby = DragLimit(dragBarY, (float)(my - topbarHeight - menuHeight) / (float)workHeight);
- }
- else {
- draggingBarY = false;
- }
-
- if (!(touchDragBarH || touchDragBarV || draggingBarX || draggingBarY)) {
- md->setDragBarH(false);
- }
- }
-}
-
-void MGui::DragBars(Modeller * md)
-{
- Pi3Cpointi wpos = GetTopLeft();
- int midht = md->window->getHeight() - wpos.y - botbarHeight;
- DragViewportBars(md, wpos, midht);
- RenderBorder(md->currentSelView);
-}
-
-void MGui::DoMenus(Modeller * md)
-{
- //Menubar ...
- gui.setButtonStyle(bsMenu);
- if (gui.BeginMenuBar("MenuBar")) {
- if (gui.BeginMenu("File")) {
- if (gui.MenuItem("New", "Ctrl+N")) md->ClearScene();
- if (gui.MenuItem("Open", "Ctrl+O", true)) {} // open();
- if (gui.MenuItem("Save", "Ctrl+S")) SaveAll(md);
- if (gui.MenuItem("Quit", "Esc")) md->window->setquit(true);
- gui.EndMenu();
- }
- if (gui.BeginMenu("Edit")) {
- if (gui.MenuItem("Select All", "Ctrl+A")) md->SelectAll();
- if (gui.MenuItem("Clear selections", "")) md->ClearSelections();
- if (gui.MenuItem("Duplicate", "Ctrl+C")) md->DuplicateSelection();
- if (gui.MenuItem("Delete", "Del")) md->DeleteSelection();
- if (gui.MenuItem("Undo", "Ctrl+X")) {}
- if (gui.MenuItem("Redo", "Ctrl+Y")) {}
- gui.EndMenu();
- }
- if (gui.BeginMenu("Object")) {
- if (gui.MenuItem("Create", "Ctrl+C", true)) {}
- if (gui.MenuItem("Array tool", "Ctrl+V", true)) {}
- gui.EndMenu();
- }
- if (gui.BeginMenu("Help")) {
- if (gui.MenuItem("Version: 0.2.002", "", true)) {}
- }
- gui.EndMenuBar("MenuBar");
- }
-}
-
-
-void MGui::DoEditToolbar(Modeller * md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu)
-{
- int icw = bsIcons.halfWidth(); // (int)((float)bsIcons.minWidth*0.5f);
- int ich = bsIcons.minHeight;
- int idw = bsIcons.thirdWidth(); // (int)((float)bsIcons.minWidth*0.3f);
-
- //gui.renderBackIcon("rendl.png", icw, ich);
- //if (gui.Container("EditToolbar",400,32)) {
- if (gui.BeginGroupHorizontal("rendl.png", icw, ich)) {
-
- if (gui.ButtonImage("butNew.png") && mb && mu) md->ClearScene();
- if (gui.ButtonImage("butOpen.png") && mb && mu) {}
- if (gui.ButtonImage("butSave.png") && mb && mu) SaveAll(md);
- gui.renderBackIcon("butDiv.png", idw, ich);
-
- if (gui.ButtonImage("butArrow.png", md->editMode == Modeller::ED_SELECT) && mb && mu) md->SetEditMode(Modeller::ED_SELECT);
- if (gui.ButtonImage("butMove.png", md->editMode == Modeller::ED_MOVE) && mb && mu) md->SetEditMode(Modeller::ED_MOVE);
- if (gui.ButtonImage("butRotate.png", md->editMode == Modeller::ED_ROTATE) && mb && mu) md->SetEditMode(Modeller::ED_ROTATE);
- if (gui.ButtonImage("butScale.png", md->editMode == Modeller::ED_SCALE) && mb && mu) md->SetEditMode(Modeller::ED_SCALE);
-
- gui.renderBackIcon("butDiv.png", idw, ich);
-
- if (gui.ButtonImage("butSelectAll.png") && mb && mu) md->SelectAll();
- if (gui.ButtonImage("butDelete.png") && mb && mu) md->DeleteSelection();
- if (gui.ButtonImage("butCopy.png") && mb && mu) md->DuplicateSelection(); // snapshot();
-
- gui.renderBackIcon("butDiv.png", idw, ich);
-
- if (gui.ButtonImage("butGroup.png") && mb && mu) {}
- if (gui.ButtonImage("butUngroup.png") && mb && mu) {}
-
- gui.renderBackIcon("butDiv.png", idw, ich);
-
- if (gui.ButtonImage("butUndo.png") && mb && mu) {}
- if (gui.ButtonImage("butRedo.png") && mb && mu) {}
-
- gui.EndGroupHorizontal("rendr.png", icw, ich);
- //}
- //gui.ContainerEnd("EditToolbar");
- }
- //gui.renderBackIcon("rendr.png", icw, ich);
-}
-
-void MGui::DoTransformToolbar(Modeller * md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu)
-{
- if (gui.BeginGroupHorizontal("rendl.png", iconstyle.halfWidth(), iconstyle.minHeight)) {
- if (gui.ButtonImage("butMirror.png") && mb && mu) {}
- if (gui.ButtonImage("butFlip.png") && mb && mu) {}
- if (gui.ButtonImage("butInvertPolys.png") && mb && mu) {}
- if (gui.ButtonImage("butInvertNorms.png") && mb && mu) {}
- gui.EndGroupHorizontal("rendr.png", iconstyle.halfWidth(), iconstyle.minHeight);
- }
-}
-
-void MGui::DoSceneToolbar(Modeller * md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu)
-{
- //gui.setButtonStyle(iconstyle);
-
- if (gui.BeginGroupHorizontal("rendl.png", iconstyle.halfWidth(), iconstyle.minHeight)) {
- if (gui.ButtonImage("butFullscreen.png") && md->fullscreen==false && mb) md->SetFullScreen();
- if (gui.ButtonImage("butDropMan.png", md->editMode == Modeller::ED_DROPMAN) && mb) md->SetEditMode(Modeller::ED_DROPMAN);
- if (gui.ButtonImage("butBigwin.png") && mu) md->SetFullScene();
- if (gui.ButtonImage("butSceneRot.png", md->editMode == Modeller::ED_ROTATESCENE) && mu) md->SetEditMode(Modeller::ED_ROTATESCENE);
- gui.EndGroupHorizontal("rendr.png", iconstyle.halfWidth(), iconstyle.minHeight);
- }
-}
-
-void MGui::DoShapesToolbar(Modeller * md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu)
-{
- int btop = (int)((float)iconstyle.minWidth * .34f);
- bool mouseClick = mb && mu;
- if (gui.BeginGroupVertical("butTop2.png", iconstyle.minWidth, btop)) {
- if (gui.ButtonImage("cuboid.png", md->createTool == Modeller::CT_CUBOID) && mb) md->SetCreateTool(Modeller::CT_CUBOID);
- if (gui.ButtonImage("sphere.png", md->createTool == Modeller::CT_SPHERE) && mb) md->SetCreateTool(Modeller::CT_SPHERE);
- if (gui.ButtonImage("cylinder.png", md->createTool == Modeller::CT_CYLINDER) && mb) md->SetCreateTool(Modeller::CT_CYLINDER);
- if (gui.ButtonImage("cone.png", md->createTool == Modeller::CT_CONE) && mb) md->SetCreateTool(Modeller::CT_CONE);
- if (gui.ButtonImage("tube.png", md->createTool == Modeller::CT_TUBE) && mb) md->SetCreateTool(Modeller::CT_TUBE);
- if (gui.ButtonImage("t-cone.png", md->createTool == Modeller::CT_TCONE) && mb) md->SetCreateTool(Modeller::CT_TCONE);
- if (gui.ButtonImage("wedge.png", md->createTool == Modeller::CT_WEDGE) && mb) md->SetCreateTool(Modeller::CT_WEDGE);
- if (gui.ButtonImage("torus.png", md->createTool == Modeller::CT_TORUS) && mb) md->SetCreateTool(Modeller::CT_TORUS);
- gui.renderBackIcon("butBot2.png", iconstyle.minWidth, btop);
-
- gui.renderBackIcon("butTop2.png", iconstyle.minWidth, btop);
- if (gui.ButtonImage("extrude.png", md->createTool == Modeller::CT_EXTRUDE) && mb) md->SetCreateTool(Modeller::CT_EXTRUDE);
- if (gui.ButtonImage("lathe.png", md->createTool == Modeller::CT_LATHE) && mb) md->SetCreateTool(Modeller::CT_LATHE);
- if (gui.ButtonImage("butLine.png", md->createTool == Modeller::CT_LINE) && mb) md->SetCreateTool(Modeller::CT_LINE);
- //if (gui.ButtonImage("blocks.png", md->createTool == Modeller::CT_BLOCKS) && mb) md->setCreateTool(Modeller::CT_BLOCKS);
- gui.renderBackIcon("butBot2.png", iconstyle.minWidth, btop);
-
- gui.renderBackIcon("butTop2.png", iconstyle.minWidth, btop);
- if (gui.ButtonImage("landscape.png", md->createTool == Modeller::CT_LANDSCAPE) && mb) md->SetCreateTool(Modeller::CT_LANDSCAPE);
- gui.EndGroupVertical("butBot2.png", iconstyle.minWidth, btop);
- }
-}
-
-void MGui::MaterialInfo(Modeller* md, Pi3Cmaterial& material, const Pi3Cpointi& p)
-{
- Pi3Cmodel rect;
- rect.matrix.setz(-10.0f);
- //auto& p = gui.getCurrentPosition();
- int w = 600, h = 250, xc = p.x, yc = p.y + 10, bord = 10;
- if (xc + w > md->window->getWidth()) xc = md->window->getWidth() - w;
- float xf = (float)xc, yf = (float)yc;
- rect.createRect2D(gui.resource, vec2f(xf, yf), vec2f((float)w, (float)h), guiStyle.iconColour);
- rect.renderBasic(gui.resource);
- rect.createRect2D(gui.resource, vec2f(xf + (float)(bord), yf + (float)(bord)), vec2f((float)(h - bord * 2), (float)(h - bord * 2)), 0xffffffff, material.texRef);
- rect.renderBasic(gui.resource);
- gui.setFont(smallFont);
-
- int ht = h-bord/2, hs = 22;
- gui.TextAt("Name: " + ((material.name.length()>20) ? material.name.substr(0,30)+"..." : material.name), xc + h, yc + ht, 0x0); ht -= hs;
- ht -= 5;
- gui.TextAt("Diffuse colour : 0x" + Pi3Cutils::numToHexstr(material.GetColDiffuse()), xc + h, yc + ht, 0x0); ht -= hs;
- gui.TextAt("Ambient colour : 0x" + Pi3Cutils::numToHexstr(material.GetColAmbient()), xc + h, yc + ht, 0x0); ht -= hs;
- gui.TextAt("Emissive colour: 0x" + Pi3Cutils::numToHexstr(material.GetColEmissive()), xc + h, yc + ht, 0x0); ht -= hs;
- gui.TextAt("Specular colour: 0x" + Pi3Cutils::numToHexstr(material.GetColSpecular()), xc + h, yc + ht, 0x0); ht -= hs;
- if (material.texRef > 0) {
- ht -= 5;
- gui.TextAt("Texture width : " + std::to_string(material.texWidth), xc + h, yc + ht, 0x0); ht -= hs;
- gui.TextAt("Texture height: " + std::to_string(material.texHeight), xc + h, yc + ht, 0x0); ht -= hs;
- if (material.animFrames > 0) {
- ht -= 5;
- gui.TextAt("Anim frames: " + std::to_string(material.animFrames), xc + h, yc + ht, 0x0); ht -= hs;
- gui.TextAt("Anim offset: " + Pi3Cutils::ftostrdp(material.animoffset.x, 2) + "," + Pi3Cutils::ftostrdp(material.animoffset.y, 2), xc + h, yc + ht, 0x0); ht -= hs;
- gui.TextAt("Anim size : " + Pi3Cutils::ftostrdp(material.animsize.x, 2) + "," + Pi3Cutils::ftostrdp(material.animsize.y, 2), xc + h, yc + ht, 0x0); ht -= hs;
- }
- }
-}
-
-void MGui::DoMaterialsToolbar(Modeller* md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu)
-{
- int icw = bsIcons.halfWidth();
- int ich = bsIcons.minHeight;
- int touchMaterial = -1;
- int selMat = -1;
- Pi3Cpointi touchMatPos;
-
- gui.setSameLine(true);
- gui.renderBackIcon("rendl.png", icw, ich);
- if (gui.Container("MatToolbar", 400, 32)) {
- //if (gui.BeginGroupHorizontal("rendl.png", iconstyle.halfWidth(), iconstyle.minHeight)) {
-
- std::vector& materials = md->resource->materials;
- //std::vector& textures = md->resource->textures;
-
- for (size_t m = 0; m < materials.size(); m++) {
- auto& material = materials[m];
- if (material.texRef > 0 && material.name!="default") {
- //gui.sameLine();
- if (gui.ButtonImage(material.name, material.texRef, false, 32, 32)) {
- touchMaterial = m;
- touchMatPos = gui.getCurrentPosition();
- }
- }
- }
-
- gui.ContainerEnd("MatToolbar");
- gui.renderBackIcon("rendr.png", icw, ich);
-
- Pi3Cpointi cp = gui.getCurrentPosition();
- if (touchMatPos.x > cp.x) touchMaterial = -1;
- //gui.EndGroupHorizontal("rendr.png", iconstyle.halfWidth(), iconstyle.minHeight);
- }
-
- if (touchMaterial >= 0) {
- auto& material = md->resource->materials[touchMaterial];
- MaterialInfo(md, material, touchMatPos);
- if (mb && mu) selMat = touchMaterial;
- }
-}
-
-bool MGui::DoIMGUI(Modeller * md)
-{
-
- //uint32_t ticks = SDL_GetTicks();
- int winWidth = md->window->getWidth();
- int winHeight = md->window->getHeight();
- int mx = md->window->mouse.x;
- int my = md->window->mouse.y;
- md->SetMousePosition(mx, winHeight - my);
- bool mouseOverToolbars = gui.menuOpen || mx(winWidth - rightbarWidth) || my<(topbarHeight + menuHeight) || my>winHeight - botbarHeight;
-
- //SDL_Log("Menus %s", gui.menuTouch);
-
- gui.Begin();
-
- //If mouse is not over the toolbars, then draw a snapshot of the toolsbar and don't process them ...
- if (!mouseOverToolbars && gui.drawSnapshot()) {
- glClear(GL_DEPTH_BUFFER_BIT);
- return false;
- }
-
- DoMenus(md);
- UpdateWorkArea(md);
-
- bool mb = md->window->mouse.LeftButton && mouseOverToolbars;
- bool mu = md->window->mouse.up && mouseOverToolbars;
- //md->setMousePosition(mx, winHeight - my);
-
- //Draw borders ...
- gui.renderRect(winWidth, topbarHeight);
- gui.nextLine(0);
- Pi3Cpointi wpos = gui.getPosition();
-
- int midht = winHeight - wpos.y - botbarHeight;
- gui.renderRect(leftbarWidth, midht);
- gui.movePosition(winWidth - rightbarWidth, 0);
- gui.renderRect(rightbarWidth, midht);
- gui.setPosition(0, wpos.y + midht);
- gui.renderRect(winWidth, botbarHeight);
-
- //Top menu bar icons ...
- gui.setButtonStyle(bsIcons);
-
- gui.setPosition(wpos.x + leftbarWidth, wpos.y - topbarHeight);
- DoEditToolbar(md, bsIcons, mb, mu);
-
- gui.sameLine();
- DoTransformToolbar(md, bsIcons, mb, mu);
-
- gui.setPosition(winWidth - rightbarWidth - 150, workHeight + topbarHeight + menuHeight + 3);
- DoSceneToolbar(md, bsIcons, mb, mu);
-
- //Left side create shape buttons ...
- gui.setPosition(wpos.x + (leftbarWidth - bsButtons.minWidth) / 2, wpos.y);
- bsButtons.sameLine = false;
- gui.setButtonStyle(bsButtons);
- DoShapesToolbar(md, bsButtons, mb, mu);
-
- gui.setPosition(leftbarWidth, workHeight + topbarHeight + menuHeight + 3);
- //gui.setButtonStyle(bsHeading);
-
- DoMaterialsToolbar(md, bsIcons, mb, mu);
-
- //static double v = 5;
- //gui.SliderH("Scroll", 0, 10, v, 300, 24);
-
- //SDL_Log("Ticks:%d",SDL_GetTicks()-ticks);
-
- gui.End();
- gui.checkForSnapShot();
-
- return true;
-}
-
-void MGui::PrintText(const std::string& text, int x, int y, uint32_t col)
-{
- gui.setButtonStyle(bsMenu);
- gui.setPosition(x, y);
- gui.Text(text, 0,0,Pi3Ccolours::White);
-}
-
-void MGui::SaveAll(Modeller * md)
-{
- //startSnapshot();
- //gui.takeSnapshot();
- std::string folderPath = "../";
- std::string savefile = gui.OpenFileDialog(folderPath, &bsDialog);
- if (savefile!="") md->SaveFileOBJ(folderPath, savefile);
-}
-
-void MGui::ShowProgressCB(Pi3Cwindow* window, const std::string &message, const float pcnt)
-{
- //SDL_Log("Loading '%s' %d%% ...", message.c_str(), (int)pcnt);
- float mWidth = window->getWidth();
- float mHeight = window->getHeight();
-
- window->clear();
- gui.drawSnap();
- gui.setPosition(0, 0);
- gui.renderRect(mWidth, mHeight, Pi3Ccolours::TransparentBlack);
-
- Pi3Cmodel rect;
- rect.matrix.setz(-10.f);
- rect.createRect2D(gui.resource, vec2f(mWidth / 2.f - 110.f, mHeight / 2.f - 20.f), vec2f(220.f, 40.f), 0xffffffff);
- rect.renderBasic(gui.resource);
- rect.createRect2D(gui.resource, vec2f(mWidth / 2.f - 100.f, mHeight / 2.f - 10.f), vec2f(pcnt * 2.f, 20.f), 0xff00aa00);
- rect.renderBasic(gui.resource);
- rect.createRect2D(gui.resource, vec2f(mWidth / 2.f - 100.f + pcnt * 2.f, mHeight / 2.f - 10.f), vec2f((100.f - pcnt) * 2.f, 20.f), 0xff999999);
- rect.renderBasic(gui.resource);
-
- std::string text = message + Pi3Cutils::ftostrdp(pcnt, 0)+"%";
- PrintText(text, mWidth / 2.f - 110.f, mHeight / 2.f - 50.f, 0xffffffff);
-
- std::vector eventList = window->events();
-
- window->SwapBuffers();
-}
diff --git a/Examples/3D modeller/Source/ModellerGUI.h b/Examples/3D modeller/Source/ModellerGUI.h
deleted file mode 100644
index b974829..0000000
--- a/Examples/3D modeller/Source/ModellerGUI.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#pragma once
-#include "Pi3Cimgui.h"
-#include "Pi3CloadOptions.h"
-#include "UIStyles.h"
-
-class Modeller; //forward declare Modeller
-
-class MGui
-{
-public:
-
- //Functions ...
- void Init(loadOptions &opts, Pi3Cresource * resource, Pi3Cwindow *window, const std::string& defaultStyle);
- bool DoIMGUI(Modeller * md);
- bool somethingSelected() { return gui.somethingSelected; }
- void startSnapshot() { gui.startSnapshot(); }
- void takeSnapshot() { gui.takenSnapshot = gui.SH_TAKESHOT; gui.takeSnapshot(); }
- //void stopSnapshot() { gui.stopSnapshot(); }
- void DragBars(Modeller* md);
- void PrintText(const std::string& text, int x, int y, uint32_t col = 0);
- void ShowProgressCB(Pi3Cwindow* window, const std::string& message, const float pcnt);
-
- Pi3Crecti GetRectBottomRight();
- Pi3Crecti GetRectBottomLeft();
- Pi3Crecti GetRectTopRight();
- Pi3Crecti GetRectTopLeft();
- Pi3Crecti GetRectFull();
- Pi3Cpointi GetTopLeft();
-
- void resize() { gui.resize(); }
-
-private:
-
- //Vars ...
- Pi3Cimgui gui;
-
- Pi3Cimgui::rectStyle bsMenu;
- Pi3Cimgui::rectStyle bsHeading;
- Pi3Cimgui::rectStyle bsIcons;
- Pi3Cimgui::rectStyle bsButtons;
- Pi3Cimgui::rectStyle bsItems;
- Pi3Cimgui::rectStyle bsDialog;
-
- UI_Style guiStyle;
-
- //uint32_t backColour = Pi3Ccolours::Raspberry; // 0xcccccc;
- //uint32_t iconColour = Pi3Ccolours::Linen;
- //uint32_t selectColour = Pi3Ccolours::LightCoral; // 0x00ffff;
- //uint32_t highlight = Pi3Ccolours::Salmon;
- //uint32_t borderColour = Pi3Ccolours::Red;
-
- std::string smallFont;
- std::string largeFont;
- std::string mediumFont;
-
- int menuHeight = 20;
- int topbarHeight = 36;
- int botbarHeight = 42;
- int leftbarWidth = 50;
- int rightbarWidth = 40;
-
- float dragBarX = 0.5f;
- float dragBarY = 0.5f;
- float dragBarThickness = 8.f;
- bool draggingBarX = false;
- bool draggingBarY = false;
- int dbh = (int)(dragBarThickness * 0.5f);
-
- bool fastRender = false; // fast draw into 3D views - no GUI rendering
-
- //Temp work vars ...
- int workWidth = 0;
- int workHeight = 0;
- float ibx = 1.f - dragBarX;
- float iby = 1.f - dragBarY;
-
- void UpdateWorkArea(Modeller* md);
-
- void RenderBorder(uint32_t currentSelView);
- void DragViewportBars(Modeller * md, Pi3Cpointi& wposm, int midht);
- void SaveAll(Modeller * md);
- bool DraggingBars();
-
-
- void DoMenus(Modeller * md);
- void DoEditToolbar(Modeller * md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu);
- void DoTransformToolbar(Modeller * md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu);
- void DoSceneToolbar(Modeller * md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu);
- void DoShapesToolbar(Modeller * md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu);
- void DoMaterialsToolbar(Modeller* md, Pi3Cimgui::rectStyle& iconstyle, bool mb, bool mu);
-
- void MaterialInfo(Modeller* md, Pi3Cmaterial& material, const Pi3Cpointi& p);
-};
\ No newline at end of file
diff --git a/Examples/3D modeller/Source/UIStyles.cpp b/Examples/3D modeller/Source/UIStyles.cpp
deleted file mode 100644
index 4f4be2b..0000000
--- a/Examples/3D modeller/Source/UIStyles.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "UIStyles.h"
-#include "Pi3Cjson.h"
-
-void UI_Style::LoadUIstyle(const std::string& file)
-{
- Pi3Cjson json(file.c_str());
-
- if (!json.doc.IsObject()) return;
-
- const Value& gc = json.doc["GUIcolours"];
- backColour = json.readColour(gc,"BackCol", backColour);
- iconColour = json.readColour(gc, "IconCol", iconColour);
- selectColour = json.readColour(gc, "SelectCol", selectColour);
- highlight = json.readColour(gc, "HighlightCol", highlight);
- borderColour = json.readColour(gc, "BorderCol", borderColour);
-}
\ No newline at end of file
diff --git a/Examples/3D modeller/Source/UIStyles.h b/Examples/3D modeller/Source/UIStyles.h
deleted file mode 100644
index 63aa147..0000000
--- a/Examples/3D modeller/Source/UIStyles.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma once
-#include "Pi3Ccolours.h"
-#include
-
-class UI_Style {
-public:
-
- uint32_t backColour = Pi3Ccolours::Raspberry; // 0xcccccc;
- uint32_t iconColour = Pi3Ccolours::Linen;
- uint32_t selectColour = Pi3Ccolours::LightCoral; // 0x00ffff;
- uint32_t highlight = Pi3Ccolours::Salmon;
- uint32_t borderColour = Pi3Ccolours::Red;
-
- UI_Style() {}
-
- void LoadUIstyle(const std::string& file);
-
-};
\ No newline at end of file
diff --git a/Examples/3D modeller/Source/main.cpp b/Examples/3D modeller/Source/main.cpp
deleted file mode 100644
index 1dd0e48..0000000
--- a/Examples/3D modeller/Source/main.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-#include "Pi3Cwin.h"
-#include "Pi3CloadOptions.h"
-#include "Modeller.h"
-
-// ==========================================================================
-// Pi3C Graphics Library Example - Pi3C Modeller (by Tim Skillman)
-// ==========================================================================
-//
-// The MIT License
-//
-// Copyright (c) 2018 Tim Skillman
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-// =======================================================================
-
-Pi3Cwindow::options GetWindowOptions(std::string file)
-{
- loadOptions opts(file.c_str());
-
- // Create and initialize a window
- Pi3Cwindow::options winopts;
- winopts.title = opts.asString("title");
- winopts.fullscreen = opts.asBool("fullscreen");
- winopts.width = opts.asInt("screenWidth");
- winopts.height = opts.asInt("screenHeight");
- winopts.antialiasLevel = opts.asInt("antiAliasLevel");
- winopts.clearColour = 0xffffff;
- return winopts;
-}
-
-int main(int argc, char *argv[])
-{
- static Pi3Cwindow window(GetWindowOptions("options.txt"));
-
- Pi3CGL::showGLinfo();
-
- // Setup Editor and Resources ...
- static Pi3Cresource resource;
- resource.init();
- Modeller modeller(&resource, &window);
- if (!modeller.initialised()) return 1;
-
- modeller.Init();
-
- uint32_t frames = 0;
- uint32_t timer = SDL_GetTicks();
-
- while (!window.hasquit())
- {
- //needs processing for render so that GUI has priority over events (before modeller.handleEvents)
- std::vector eventList = window.events();
-
- window.clear();
- modeller.Render();
-
- modeller.HandleEvents(eventList);
-
- frames++;
- window.SwapBuffers();
- }
-
- uint32_t ticks = SDL_GetTicks() - timer;
- float avtime = (float)frames / ((float)ticks / 1000.f);
- SDL_Log("Average FPS(%d, %d) = %f ", ticks, frames, avtime);
-
- window.destroy();
- return 0;
-}
-
diff --git a/Examples/3D modeller/ToDos.txt b/Examples/3D modeller/ToDos.txt
deleted file mode 100644
index f3fe3b1..0000000
--- a/Examples/3D modeller/ToDos.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-UI work
-- snapshot control and groups when inactive
-- Listbox
- - multi-line
- - multi-select
- - icon and text
- - scroll h & v
- - scissor clipping
- - resize
- - scale fields
-- TextBlock
- - scissor clipping
- - scroll h & v
- - editing
- - select block of text
- - copy/paste
- - caret
- - colours
-- File dialog
- - Save
- - Load
-
-3D Editing work
-- Isolate/select independant mesh (i.e. no adjoining vertices)
-- Edited mesh selections (move/rotate/delete/detach)
-- Point/Line/Facet editing
-- Create from Line / facet - push out from normal
diff --git a/Examples/3D modeller/assets/icons/blocks.png b/Examples/3D modeller/assets/icons/blocks.png
deleted file mode 100644
index 62932b9..0000000
Binary files a/Examples/3D modeller/assets/icons/blocks.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butArrow.png b/Examples/3D modeller/assets/icons/butArrow.png
deleted file mode 100644
index dee00eb..0000000
Binary files a/Examples/3D modeller/assets/icons/butArrow.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butBigwin.png b/Examples/3D modeller/assets/icons/butBigwin.png
deleted file mode 100644
index 836166a..0000000
Binary files a/Examples/3D modeller/assets/icons/butBigwin.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butBot.png b/Examples/3D modeller/assets/icons/butBot.png
deleted file mode 100644
index ab1cb54..0000000
Binary files a/Examples/3D modeller/assets/icons/butBot.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butBot2.png b/Examples/3D modeller/assets/icons/butBot2.png
deleted file mode 100644
index 21103c3..0000000
Binary files a/Examples/3D modeller/assets/icons/butBot2.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butCopy.png b/Examples/3D modeller/assets/icons/butCopy.png
deleted file mode 100644
index 74439ae..0000000
Binary files a/Examples/3D modeller/assets/icons/butCopy.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butCut.png b/Examples/3D modeller/assets/icons/butCut.png
deleted file mode 100644
index 59a4ec2..0000000
Binary files a/Examples/3D modeller/assets/icons/butCut.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butDelete.png b/Examples/3D modeller/assets/icons/butDelete.png
deleted file mode 100644
index 62fba0e..0000000
Binary files a/Examples/3D modeller/assets/icons/butDelete.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butDeleteO.png b/Examples/3D modeller/assets/icons/butDeleteO.png
deleted file mode 100644
index 9ff9803..0000000
Binary files a/Examples/3D modeller/assets/icons/butDeleteO.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butDiv.png b/Examples/3D modeller/assets/icons/butDiv.png
deleted file mode 100644
index 6d26112..0000000
Binary files a/Examples/3D modeller/assets/icons/butDiv.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butDropFace.png b/Examples/3D modeller/assets/icons/butDropFace.png
deleted file mode 100644
index 9132eb1..0000000
Binary files a/Examples/3D modeller/assets/icons/butDropFace.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butDropMan.png b/Examples/3D modeller/assets/icons/butDropMan.png
deleted file mode 100644
index 41ddd7e..0000000
Binary files a/Examples/3D modeller/assets/icons/butDropMan.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butFlip.png b/Examples/3D modeller/assets/icons/butFlip.png
deleted file mode 100644
index ce6699b..0000000
Binary files a/Examples/3D modeller/assets/icons/butFlip.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butFullscreen.png b/Examples/3D modeller/assets/icons/butFullscreen.png
deleted file mode 100644
index 4830bd8..0000000
Binary files a/Examples/3D modeller/assets/icons/butFullscreen.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butGroup.png b/Examples/3D modeller/assets/icons/butGroup.png
deleted file mode 100644
index 40aa99c..0000000
Binary files a/Examples/3D modeller/assets/icons/butGroup.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butInvertNorms.png b/Examples/3D modeller/assets/icons/butInvertNorms.png
deleted file mode 100644
index 8571e9a..0000000
Binary files a/Examples/3D modeller/assets/icons/butInvertNorms.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butInvertPolys.png b/Examples/3D modeller/assets/icons/butInvertPolys.png
deleted file mode 100644
index 5c09f27..0000000
Binary files a/Examples/3D modeller/assets/icons/butInvertPolys.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butLine.png b/Examples/3D modeller/assets/icons/butLine.png
deleted file mode 100644
index b089efc..0000000
Binary files a/Examples/3D modeller/assets/icons/butLine.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butMirror.png b/Examples/3D modeller/assets/icons/butMirror.png
deleted file mode 100644
index 61d1177..0000000
Binary files a/Examples/3D modeller/assets/icons/butMirror.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butMove.png b/Examples/3D modeller/assets/icons/butMove.png
deleted file mode 100644
index dc5eb3d..0000000
Binary files a/Examples/3D modeller/assets/icons/butMove.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butNew.png b/Examples/3D modeller/assets/icons/butNew.png
deleted file mode 100644
index 71ebfb2..0000000
Binary files a/Examples/3D modeller/assets/icons/butNew.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butOpen.png b/Examples/3D modeller/assets/icons/butOpen.png
deleted file mode 100644
index 46a06a9..0000000
Binary files a/Examples/3D modeller/assets/icons/butOpen.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butPaste.png b/Examples/3D modeller/assets/icons/butPaste.png
deleted file mode 100644
index 482b188..0000000
Binary files a/Examples/3D modeller/assets/icons/butPaste.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butRedo.png b/Examples/3D modeller/assets/icons/butRedo.png
deleted file mode 100644
index 8598f5d..0000000
Binary files a/Examples/3D modeller/assets/icons/butRedo.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butRotate.png b/Examples/3D modeller/assets/icons/butRotate.png
deleted file mode 100644
index 1e1a48f..0000000
Binary files a/Examples/3D modeller/assets/icons/butRotate.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butSave.png b/Examples/3D modeller/assets/icons/butSave.png
deleted file mode 100644
index 7ec3f76..0000000
Binary files a/Examples/3D modeller/assets/icons/butSave.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butScale.png b/Examples/3D modeller/assets/icons/butScale.png
deleted file mode 100644
index f56e72e..0000000
Binary files a/Examples/3D modeller/assets/icons/butScale.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butSceneRot.png b/Examples/3D modeller/assets/icons/butSceneRot.png
deleted file mode 100644
index 5d16dbc..0000000
Binary files a/Examples/3D modeller/assets/icons/butSceneRot.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butSelectAll.png b/Examples/3D modeller/assets/icons/butSelectAll.png
deleted file mode 100644
index b9e39ad..0000000
Binary files a/Examples/3D modeller/assets/icons/butSelectAll.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butTop.png b/Examples/3D modeller/assets/icons/butTop.png
deleted file mode 100644
index 5a2f410..0000000
Binary files a/Examples/3D modeller/assets/icons/butTop.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butTop2.png b/Examples/3D modeller/assets/icons/butTop2.png
deleted file mode 100644
index 207d79d..0000000
Binary files a/Examples/3D modeller/assets/icons/butTop2.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butUndo.png b/Examples/3D modeller/assets/icons/butUndo.png
deleted file mode 100644
index 8212995..0000000
Binary files a/Examples/3D modeller/assets/icons/butUndo.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/butUngroup.png b/Examples/3D modeller/assets/icons/butUngroup.png
deleted file mode 100644
index 81a41a2..0000000
Binary files a/Examples/3D modeller/assets/icons/butUngroup.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/checkbox1.png b/Examples/3D modeller/assets/icons/checkbox1.png
deleted file mode 100644
index a9fb1b0..0000000
Binary files a/Examples/3D modeller/assets/icons/checkbox1.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/checkbox2.png b/Examples/3D modeller/assets/icons/checkbox2.png
deleted file mode 100644
index fff6385..0000000
Binary files a/Examples/3D modeller/assets/icons/checkbox2.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/cone.png b/Examples/3D modeller/assets/icons/cone.png
deleted file mode 100644
index 289d7dd..0000000
Binary files a/Examples/3D modeller/assets/icons/cone.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/cuboid.png b/Examples/3D modeller/assets/icons/cuboid.png
deleted file mode 100644
index 9df2ca4..0000000
Binary files a/Examples/3D modeller/assets/icons/cuboid.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/cylinder.png b/Examples/3D modeller/assets/icons/cylinder.png
deleted file mode 100644
index 29932c2..0000000
Binary files a/Examples/3D modeller/assets/icons/cylinder.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/darrow.png b/Examples/3D modeller/assets/icons/darrow.png
deleted file mode 100644
index cdbcf21..0000000
Binary files a/Examples/3D modeller/assets/icons/darrow.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/extrude.png b/Examples/3D modeller/assets/icons/extrude.png
deleted file mode 100644
index 5234aa0..0000000
Binary files a/Examples/3D modeller/assets/icons/extrude.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/handle.png b/Examples/3D modeller/assets/icons/handle.png
deleted file mode 100644
index 5900151..0000000
Binary files a/Examples/3D modeller/assets/icons/handle.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/landscape.png b/Examples/3D modeller/assets/icons/landscape.png
deleted file mode 100644
index 655c86d..0000000
Binary files a/Examples/3D modeller/assets/icons/landscape.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/larrow.png b/Examples/3D modeller/assets/icons/larrow.png
deleted file mode 100644
index f730005..0000000
Binary files a/Examples/3D modeller/assets/icons/larrow.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/lathe.png b/Examples/3D modeller/assets/icons/lathe.png
deleted file mode 100644
index 69cbf4c..0000000
Binary files a/Examples/3D modeller/assets/icons/lathe.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/radiooff.png b/Examples/3D modeller/assets/icons/radiooff.png
deleted file mode 100644
index 17536d1..0000000
Binary files a/Examples/3D modeller/assets/icons/radiooff.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/radioon.png b/Examples/3D modeller/assets/icons/radioon.png
deleted file mode 100644
index 3f10f45..0000000
Binary files a/Examples/3D modeller/assets/icons/radioon.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/rarrow.png b/Examples/3D modeller/assets/icons/rarrow.png
deleted file mode 100644
index cdd0021..0000000
Binary files a/Examples/3D modeller/assets/icons/rarrow.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/rendl.png b/Examples/3D modeller/assets/icons/rendl.png
deleted file mode 100644
index 28db5f9..0000000
Binary files a/Examples/3D modeller/assets/icons/rendl.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/rendr.png b/Examples/3D modeller/assets/icons/rendr.png
deleted file mode 100644
index 78cff50..0000000
Binary files a/Examples/3D modeller/assets/icons/rendr.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/rndEdgeLft.png b/Examples/3D modeller/assets/icons/rndEdgeLft.png
deleted file mode 100644
index 8fe9798..0000000
Binary files a/Examples/3D modeller/assets/icons/rndEdgeLft.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/rndEdgeRgt.png b/Examples/3D modeller/assets/icons/rndEdgeRgt.png
deleted file mode 100644
index d0e904a..0000000
Binary files a/Examples/3D modeller/assets/icons/rndEdgeRgt.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/roundrect.png b/Examples/3D modeller/assets/icons/roundrect.png
deleted file mode 100644
index fa5a16b..0000000
Binary files a/Examples/3D modeller/assets/icons/roundrect.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/scrollLeft.png b/Examples/3D modeller/assets/icons/scrollLeft.png
deleted file mode 100644
index d9f2349..0000000
Binary files a/Examples/3D modeller/assets/icons/scrollLeft.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/scrollRight.png b/Examples/3D modeller/assets/icons/scrollRight.png
deleted file mode 100644
index 01d6f8d..0000000
Binary files a/Examples/3D modeller/assets/icons/scrollRight.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/sphere.png b/Examples/3D modeller/assets/icons/sphere.png
deleted file mode 100644
index 00ed89e..0000000
Binary files a/Examples/3D modeller/assets/icons/sphere.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/t-cone.png b/Examples/3D modeller/assets/icons/t-cone.png
deleted file mode 100644
index 3ef104f..0000000
Binary files a/Examples/3D modeller/assets/icons/t-cone.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/torus.png b/Examples/3D modeller/assets/icons/torus.png
deleted file mode 100644
index e0540e8..0000000
Binary files a/Examples/3D modeller/assets/icons/torus.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/tube.png b/Examples/3D modeller/assets/icons/tube.png
deleted file mode 100644
index 845f44d..0000000
Binary files a/Examples/3D modeller/assets/icons/tube.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/uarrow.png b/Examples/3D modeller/assets/icons/uarrow.png
deleted file mode 100644
index 4c2b1eb..0000000
Binary files a/Examples/3D modeller/assets/icons/uarrow.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/icons/wedge.png b/Examples/3D modeller/assets/icons/wedge.png
deleted file mode 100644
index 3d26636..0000000
Binary files a/Examples/3D modeller/assets/icons/wedge.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/27fa7810c6389e3fbb82d60119439d2a.jpg b/Examples/3D modeller/assets/maps/27fa7810c6389e3fbb82d60119439d2a.jpg
deleted file mode 100644
index 2303e06..0000000
Binary files a/Examples/3D modeller/assets/maps/27fa7810c6389e3fbb82d60119439d2a.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/37_caucasus.jpg b/Examples/3D modeller/assets/maps/37_caucasus.jpg
deleted file mode 100644
index b0a1a50..0000000
Binary files a/Examples/3D modeller/assets/maps/37_caucasus.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/5450840067_ff0c7b8076_b.jpg b/Examples/3D modeller/assets/maps/5450840067_ff0c7b8076_b.jpg
deleted file mode 100644
index 1b027ef..0000000
Binary files a/Examples/3D modeller/assets/maps/5450840067_ff0c7b8076_b.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/5451448916_c9f5b58688_b.jpg b/Examples/3D modeller/assets/maps/5451448916_c9f5b58688_b.jpg
deleted file mode 100644
index a4374fe..0000000
Binary files a/Examples/3D modeller/assets/maps/5451448916_c9f5b58688_b.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/Mountain_Siege.heightmap.jpg b/Examples/3D modeller/assets/maps/Mountain_Siege.heightmap.jpg
deleted file mode 100644
index e84c2d9..0000000
Binary files a/Examples/3D modeller/assets/maps/Mountain_Siege.heightmap.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/MtRainer.png b/Examples/3D modeller/assets/maps/MtRainer.png
deleted file mode 100644
index 82227da..0000000
Binary files a/Examples/3D modeller/assets/maps/MtRainer.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/SluJkrJ.png b/Examples/3D modeller/assets/maps/SluJkrJ.png
deleted file mode 100644
index 3f568f3..0000000
Binary files a/Examples/3D modeller/assets/maps/SluJkrJ.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/SurvivalCraft256x256.png b/Examples/3D modeller/assets/maps/SurvivalCraft256x256.png
deleted file mode 100644
index 5958dd6..0000000
Binary files a/Examples/3D modeller/assets/maps/SurvivalCraft256x256.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/Thompson_River.png b/Examples/3D modeller/assets/maps/Thompson_River.png
deleted file mode 100644
index f1733af..0000000
Binary files a/Examples/3D modeller/assets/maps/Thompson_River.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/bigmounthgt.png b/Examples/3D modeller/assets/maps/bigmounthgt.png
deleted file mode 100644
index 51aeb2a..0000000
Binary files a/Examples/3D modeller/assets/maps/bigmounthgt.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/crater.png b/Examples/3D modeller/assets/maps/crater.png
deleted file mode 100644
index 5973f24..0000000
Binary files a/Examples/3D modeller/assets/maps/crater.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/heightmap.png b/Examples/3D modeller/assets/maps/heightmap.png
deleted file mode 100644
index c0ad6bc..0000000
Binary files a/Examples/3D modeller/assets/maps/heightmap.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/hgtmap.png b/Examples/3D modeller/assets/maps/hgtmap.png
deleted file mode 100644
index 8b3dd4b..0000000
Binary files a/Examples/3D modeller/assets/maps/hgtmap.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/mahe2.png b/Examples/3D modeller/assets/maps/mahe2.png
deleted file mode 100644
index d0b134d..0000000
Binary files a/Examples/3D modeller/assets/maps/mahe2.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/mahesat.jpg b/Examples/3D modeller/assets/maps/mahesat.jpg
deleted file mode 100644
index b061ce5..0000000
Binary files a/Examples/3D modeller/assets/maps/mahesat.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/map1.jpg b/Examples/3D modeller/assets/maps/map1.jpg
deleted file mode 100644
index 00c4bb8..0000000
Binary files a/Examples/3D modeller/assets/maps/map1.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/mars_height.png b/Examples/3D modeller/assets/maps/mars_height.png
deleted file mode 100644
index e70c85b..0000000
Binary files a/Examples/3D modeller/assets/maps/mars_height.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/maze1.jpg b/Examples/3D modeller/assets/maps/maze1.jpg
deleted file mode 100644
index ccb0cb1..0000000
Binary files a/Examples/3D modeller/assets/maps/maze1.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/morgantown-height-map-usgs-ned-10m.png b/Examples/3D modeller/assets/maps/morgantown-height-map-usgs-ned-10m.png
deleted file mode 100644
index fd92587..0000000
Binary files a/Examples/3D modeller/assets/maps/morgantown-height-map-usgs-ned-10m.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/mountains3_512.jpg b/Examples/3D modeller/assets/maps/mountains3_512.jpg
deleted file mode 100644
index 49cc24d..0000000
Binary files a/Examples/3D modeller/assets/maps/mountains3_512.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/mountains512.png b/Examples/3D modeller/assets/maps/mountains512.png
deleted file mode 100644
index 13cb4d1..0000000
Binary files a/Examples/3D modeller/assets/maps/mountains512.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/mountainsHgt2.png b/Examples/3D modeller/assets/maps/mountainsHgt2.png
deleted file mode 100644
index 615f702..0000000
Binary files a/Examples/3D modeller/assets/maps/mountainsHgt2.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/mounts.png b/Examples/3D modeller/assets/maps/mounts.png
deleted file mode 100644
index 0e963ea..0000000
Binary files a/Examples/3D modeller/assets/maps/mounts.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/mt-taranaki.png b/Examples/3D modeller/assets/maps/mt-taranaki.png
deleted file mode 100644
index 7980c06..0000000
Binary files a/Examples/3D modeller/assets/maps/mt-taranaki.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/noise-dimplex.png b/Examples/3D modeller/assets/maps/noise-dimplex.png
deleted file mode 100644
index ef84590..0000000
Binary files a/Examples/3D modeller/assets/maps/noise-dimplex.png and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/teddy.jpg b/Examples/3D modeller/assets/maps/teddy.jpg
deleted file mode 100644
index 16595ce..0000000
Binary files a/Examples/3D modeller/assets/maps/teddy.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/maps/testislands.jpg b/Examples/3D modeller/assets/maps/testislands.jpg
deleted file mode 100644
index b82b7fe..0000000
Binary files a/Examples/3D modeller/assets/maps/testislands.jpg and /dev/null differ
diff --git a/Examples/3D modeller/assets/shaders/fs1.glsl b/Examples/3D modeller/assets/shaders/fs1.glsl
deleted file mode 100644
index da8b0c2..0000000
--- a/Examples/3D modeller/assets/shaders/fs1.glsl
+++ /dev/null
@@ -1,12 +0,0 @@
-//precision highp float; // Set the default precision to medium
-
-uniform sampler2D u_Texture; // texture
-varying vec2 v_UV; // Texture UV coordinate
-varying vec4 v_diffuseColour; // Diffuse colour
-varying vec4 v_fogColour; // Fog colour
-
-void main()
-{
- vec4 col = texture2D(u_Texture, v_UV) * v_diffuseColour + v_fogColour;
- if (col.a > 0.01) gl_FragColor = col; else discard;
-}
diff --git a/Examples/3D modeller/assets/shaders/vs1.glsl b/Examples/3D modeller/assets/shaders/vs1.glsl
deleted file mode 100644
index b57eb00..0000000
--- a/Examples/3D modeller/assets/shaders/vs1.glsl
+++ /dev/null
@@ -1,73 +0,0 @@
-//precision highp float; // Set the default precision to medium. We don't need as high of a
-
-uniform mat4 u_ProjMatrix; // view/projection matrix.
-uniform mat4 u_ModelMatrix; // model matrix.
-uniform vec3 u_LightPos; // The position of the light in eye space.
-uniform vec4 u_lightColour; // The colour of light in eye space.
-uniform int u_illuminationModel; // If ==2 then apply illumation model
-uniform int u_reflective; //
-
-uniform vec2 u_animoffset;
-uniform vec4 u_diffuseColour;
-uniform vec4 u_emissiveColour;
-uniform vec4 u_ambientColour;
-uniform vec4 u_specularColour;
-
-uniform vec3 u_fogColour;
-uniform float u_fogMaxDist;
-uniform float u_fogRange; // effectively 1.0 / (fogMaxDist-fogMinDist)
-uniform float u_col32; // a floating point representing RGB
-
-attribute vec3 a_Position;
-attribute vec3 a_Normal;
-attribute vec2 a_UV;
-attribute float a_Colour;
-
-varying vec2 v_UV;
-varying vec4 v_diffuseColour;
-varying vec4 v_fogColour;
-//varying vec3 v_Normal;
-///varying vec3 v_LightPos;
-
-void main()
-{
- // Transform position into model space
- vec3 Position = vec3(u_ModelMatrix * vec4(a_Position, 1.0));
- vec3 Normal = normalize(vec3(u_ModelMatrix * vec4(a_Normal, 0.0)));
- vec3 lightVector = normalize(u_LightPos - Position);
-
- vec4 col = vec4(fract(a_Colour), fract(a_Colour / 256.0), fract((floor(a_Colour / 256.0)) / 256.0), 1.0);
-
- // Calc UV with animation offset
- v_UV = vec2(a_UV.x, 1.0 - a_UV.y) + u_animoffset;
- if (u_reflective > 0) {
- vec3 pseudoreflect = (lightVector + Normal) *0.5;
- v_UV=v_UV + vec2(pseudoreflect.x, -pseudoreflect.y);
- }
-
- // Calc fog
- vec4 emitColour = max(u_lightColour, u_emissiveColour);
- float fogFactor = (Position.z + u_fogMaxDist) * u_fogRange; // / (fogMaxDist-fogMinDist)
- fogFactor = clamp(fogFactor, 0.0, 1.0);
- //if (u_illuminationModel == 1) fogFactor = 1.0;
- v_fogColour = vec4((u_fogColour * (1.0 - fogFactor)),0.0) * u_lightColour;
-
- // Calc lighting and specular and mix into fogColour
- vec4 ambcol = u_ambientColour; //vec4(0,0,0,0);
- //vec4 diffuseCol = vec4(u_diffuseColour.rgb * max(u_lightColour.rgb, u_emissiveColour.rgb*(1.0-fogFactor)), u_diffuseColour.a);
- vec4 diffuseCol = u_diffuseColour * emitColour * col;
-
- // apply shade and fog ...
- if (u_illuminationModel == 2) {
- float rDotV = max(dot(Normal, lightVector), 0.3); //0.1
- fogFactor = fogFactor * rDotV;
- //rDotV = max(0.0, dot(lightVector, Normal));
- ambcol = u_ambientColour * diffuseCol;
- v_fogColour = v_fogColour + vec4(u_specularColour.rgb * pow(rDotV, 50.0), 0.0);
- }
-
- v_diffuseColour = vec4((diffuseCol + ambcol).rgb * fogFactor, u_diffuseColour.a) ; //preserve alpha
-
- gl_Position = u_ProjMatrix * vec4(Position, 1.0);
-}
-
diff --git a/Examples/3D modeller/dependencies.props b/Examples/3D modeller/dependencies.props
deleted file mode 100644
index 936a45d..0000000
--- a/Examples/3D modeller/dependencies.props
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
- $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))
- $(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\bin\Release\Win32
-
-
- $(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)
- $(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\ThirdParty\SDL2_image\;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\libpng\h;
-
-
-
-
- $(DllDependenciesPath)
-
-
-
\ No newline at end of file
diff --git a/Examples/3D modeller/makefile b/Examples/3D modeller/makefile
deleted file mode 100644
index edcf694..0000000
--- a/Examples/3D modeller/makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-TARGET = Modeller3D
-
-CC = g++
-CFLAGS = -std=c++17 -Wall -Wno-narrowing -Wno-switch
-LDLIBS = -lGL -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf
-LDFLAGS =
-
-INC_DIRS:= ../../SharedCode/core \
- ../../SharedCode/file \
- ../../SharedCode/ui \
- ../../SharedCode/helpers \
- ../../SharedCode/editing \
- ../../SharedCode/glutess \
- ../../ThirdParty/rapidjson \
- ../../ThirdParty/openFBX \
- ../../ThirdParty/gltf/fx \
- ../../ThirdParty/SDL2/include \
- ../../ThirdParty/SDL2_image/include \
- ../../ThirdParty/SDL2_ttf/include \
- ../../ThirdParty/SDL2_mixer/include
-
-BUILDPATH = ../../../_build/Projects/$(TARGET)/
-
-GLES_DIR = /opt/vc/include
-
-SRC_DIR:= $(INC_DIRS) Source
-BUILD_DIR:= $(addprefix $(BUILDPATH),$(SRC_DIR))
-
-SRC:= $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp $(sdir)/*.c))
-OBJ:= $(patsubst %.cpp,$(BUILDPATH)%.o,$(SRC))
-INCS:= $(addprefix -I,$(SRC_DIR))
-
-vpath %.cpp $(SRC_DIR)
-
-define make-target
-$1/%.o: %.cpp
- $(CC) $(INCS) -c $$< -o $$@ $(CFLAGS) $(LDLIBS) $(LDFLAGS)
-endef
-
-.PHONY: all checkdirs clean
-
-all: checkdirs $(TARGET)
-
-$(TARGET): $(OBJ)
- $(CC) $^ -o $@ $(CFLAGS) $(LDLIBS) $(LDFLAGS)
- echo $(OBJ)
-
-checkdirs: $(BUILD_DIR)
-
-$(BUILD_DIR):
- @mkdir -p $@
-
-clean:
- @rm -rf $(BUILD_DIR)
-
-$(foreach bdir,$(BUILD_DIR),$(eval $(call make-target,$(bdir))))
diff --git a/Examples/3D modeller/options.txt b/Examples/3D modeller/options.txt
deleted file mode 100644
index 6fe8598..0000000
--- a/Examples/3D modeller/options.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-title:Pi3C Modeller
-screenWidth:800
-screenHeight:600
-perspective:800
-fullscreen:false
-antiAliasLevel:0
-fly:false
-lightpos:0.0 1.0 0.0
-startpos:10.0 -9.0 0.0
-rotate:0.0 1.57 0.0
-nearzfarz:1 30000.0
-avatarHeight:12.0
-avatarFallSpeed:3
-avatarWalkSpeed:1
-avatarRunSpeed:2
-fogColour:1 1 1
-fogFar:15000.0
-fogNear:100.0
-modelPath:../../Resources/models/
-logo:maps/logo.png
-skyboxPath:../../Resources/models/skyboxes
-skybox:sunnyday.obj
-skyboxScale:15.0
-fontsPath:../../Resources/fonts/
-font1:NotoSans-Regular.ttf
diff --git a/Examples/Blocks/source/BlockMap.h b/Examples/Blocks/source/BlockMap.h
index 02488a5..7e84682 100644
--- a/Examples/Blocks/source/BlockMap.h
+++ b/Examples/Blocks/source/BlockMap.h
@@ -1,14 +1,15 @@
#pragma once
-#include "Pi3Cwin.h"
-#include "Pi3Cresource.h"
-#include "Pi3Cscene.h"
-#include "Pi3Cimgui.h"
-#include "Pi3Cmodel.h"
-#include "Pi3Ccolours.h"
-#include "Pi3Cshapes.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
#include
#include
-#include "Pi3Cblocks.h"
class BlockMap
{
diff --git a/Examples/Blocks/source/Blocks.cpp b/Examples/Blocks/source/Blocks.cpp
index 5f5742f..018f086 100644
--- a/Examples/Blocks/source/Blocks.cpp
+++ b/Examples/Blocks/source/Blocks.cpp
@@ -1,7 +1,8 @@
-#include "Pi3C.h"
-#include "Pi3Cavatar.h"
+#include
+#include
+#include
+
#include "BlockMap.h"
-#include "Pi3CloadOptions.h"
int main(int argc, char *argv[])
{
@@ -153,7 +154,7 @@ int main(int argc, char *argv[])
//pi3c.showFPS();
pi3c.gui.Begin();
- const std::string fps = "FPS:" + std::to_string((int)pi3c.getCurrentFPS());
+ const std::string fps = "FPS:" + std::to_string((int)pi3c.fps);
pi3c.gui.Text(fps, 0xffffffff);
vec3f offset = -ppos;
@@ -195,10 +196,11 @@ int main(int argc, char *argv[])
ocz = cz;
}
+ pi3c.update_time();
pi3c.swap_buffers();
}
- SDL_Log("Average FPS:%f", pi3c.getAverageFPS());
+ SDL_Log("Average FPS:%f", pi3c.average_fps);
SDL_ShowCursor(SDL_SYSTEM_CURSOR_ARROW);
pi3c.window.destroy();
diff --git a/Examples/CastleCreator/Source/CastleCreator.cpp b/Examples/CastleCreator/Source/CastleCreator.cpp
index dc98812..0ed8be1 100644
--- a/Examples/CastleCreator/Source/CastleCreator.cpp
+++ b/Examples/CastleCreator/Source/CastleCreator.cpp
@@ -1,6 +1,6 @@
#include "Editor.h"
-#include "Pi3Cwin.h"
-#include "Pi3CloadOptions.h"
+#include
+#include
// ==========================================================================
// Pi3C Graphics Library Example - Castle Creator (by Tim Skillman)
diff --git a/Examples/CastleCreator/Source/Editor.cpp b/Examples/CastleCreator/Source/Editor.cpp
index aeb7436..b639869 100644
--- a/Examples/CastleCreator/Source/Editor.cpp
+++ b/Examples/CastleCreator/Source/Editor.cpp
@@ -1,7 +1,7 @@
#include "Editor.h"
-#include "Pi3Cshapes.h"
-#include "Pi3Crect.h"
-#include "Pi3Cdirectory.h"
+#include
+#include
+#include
#include
#include
#include
diff --git a/Examples/CastleCreator/Source/Editor.h b/Examples/CastleCreator/Source/Editor.h
index 8c797ee..7c86bb6 100644
--- a/Examples/CastleCreator/Source/Editor.h
+++ b/Examples/CastleCreator/Source/Editor.h
@@ -1,12 +1,12 @@
#pragma once
-#include "Pi3Cjson.h"
-#include "Pi3Cwin.h"
-#include "Pi3Cresource.h"
-#include "Pi3Cscene.h"
-#include "Pi3Cavatar.h"
-#include "Pi3CloadOptions.h"
-#include "Pi3Cimgui.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
class edmodel {
public:
diff --git a/Examples/Extruder/Source/Extruder.cpp b/Examples/Extruder/Source/Extruder.cpp
index b21df71..882cd57 100644
--- a/Examples/Extruder/Source/Extruder.cpp
+++ b/Examples/Extruder/Source/Extruder.cpp
@@ -1,5 +1,5 @@
-#include "Pi3C.h"
-#include "Pi3CmemContour.h"
+#include
+#include
// ==========================================================================
// Pi3C Graphics Library Example - Extruder 2D example (by Tim Skillman)
@@ -59,10 +59,11 @@ int main(int argc, char *argv[])
pi3c.render2D();
pi3c.showFPS();
+ pi3c.update_time();
pi3c.swap_buffers();
}
- SDL_Log("Average FPS = %f ", pi3c.getAverageFPS());
+ SDL_Log("Average FPS = %f ", pi3c.average_fps);
pi3c.window.destroy();
return 0;
diff --git a/Examples/HelloWorld/Source/HelloWorld.cpp b/Examples/HelloWorld/Source/HelloWorld.cpp
index 1d5ca3e..36747ee 100644
--- a/Examples/HelloWorld/Source/HelloWorld.cpp
+++ b/Examples/HelloWorld/Source/HelloWorld.cpp
@@ -1,31 +1,43 @@
-#include "Pi3C.h"
+#include
+
+#define SCREEN_WIDTH 800 // The screen width
+#define SCREEN_HEIGHT 600 // The screen height
int main(int argc, char *argv[])
{
- Pi3C pi3c;
- pi3c.newWindow("Pi3C", 800, 600);
+ Pi3C pi3c("Hello World", SCREEN_WIDTH, SCREEN_HEIGHT); // Set up Pi3C using constructor
+
+ // Setup your scene here...
+ vec3f cubePosition = vec3f(0, 0, 0); // Position of the cube
+ vec3f camPosition = vec3f(0, 0, -2); // Position of the camera
- // Your setup stuff goes here ...
- pi3c.create_cuboid(vec3f(0, 0, 0), vec3f(30, 30, 30), Pi3Ccolours::Green);
- pi3c.scene.setFixedLight(Pi3Ccolours::White, vec3f(150.f, 150.f, 150.f)); //transform sun position into scene
+ int32_t cube_id = pi3c.create_cuboid(cubePosition, vec3f(1.0f, 1.0f, 1.0f), Pi3Ccolours::Red); // Create a red 3D cube
+ Pi3Cmodel* cube = &pi3c.scene.models.at(cube_id); // Get a reference to the cube's model from its ID
- float rotValue = 0;
- vec3f firstPersonOffset = vec3f(0, 0, 0);
- vec3f thirdPersonOffset = vec3f(0, 0, -100);
+ pi3c.scene.setPerspective3D(SCREEN_WIDTH, SCREEN_HEIGHT, 800, 1, 100); // Setup 3D perspective
+ pi3c.scene.setFixedLight(Pi3Ccolours::White, vec3f(15.f, 15.f, 15.f)); // Transform sun position into scene
+ pi3c.scene.setMatrix(camPosition, vec3f(), vec3f()); // Set the camera position without translating or rotating the scene
+ float angle = 0; // Set the rotation angle for the cube to 0
+
while (pi3c.is_running())
{
- pi3c.clear_window(Pi3Ccolours::SkyBlue);
+ pi3c.clear_window(Pi3Ccolours::SkyBlue); // Clear the screen with a sky blue color
- //Set scene matrix and animate
- pi3c.scene.setMatrix(firstPersonOffset, thirdPersonOffset, vec3f(rotValue, rotValue, 0));
- rotValue += 0.03f;
+ // Set cube rotation and animate the angle
+ cube->matrix.setRotate(vec3f(angle, angle, 0)); // Set the new rotation of the cube using the angle
+ angle += 1.0f * pi3c.deltaTime; // Animate the rotation angle for the cube smoothly using deltaTime
- //Render scene
+ // Render the scene
pi3c.render3D();
+ pi3c.render2D();
+
+ pi3c.showFPS(); // Show the FPS
+
+ pi3c.update_time();
- pi3c.swap_buffers();
+ pi3c.swap_buffers(); // Swap back buffer with front buffer to show result
}
return 0;
-}
+}
\ No newline at end of file
diff --git a/Examples/Invaders/Source/Invaders.cpp b/Examples/Invaders/Source/Invaders.cpp
index ea5226d..b4cc70c 100644
--- a/Examples/Invaders/Source/Invaders.cpp
+++ b/Examples/Invaders/Source/Invaders.cpp
@@ -1,11 +1,11 @@
-#include "Pi3C.h"
-#include "Pi3Cshapes.h"
-#include "Pi3CfileOBJ.h"
-#include "Pi3CloadOptions.h"
-#include "Pi3Cavatar.h"
-#include "Pi3Cpopulate.h"
-#include "Pi3CperlinNoise.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#include "bullets.h"
#include "aliens.h"
@@ -271,12 +271,12 @@ int main(int argc, char *argv[])
std::string fps = "Altitude:" + std::to_string((int)ht);
gui.Text(fps, 0xff0000ff);
+ pi3c.update_time();
pi3c.swap_buffers();
-
}
//resource.clearAll();
- SDL_Log("Average FPS = %f ", pi3c.getAverageFPS());
+ SDL_Log("Average FPS = %f ", pi3c.average_fps);
SDL_ShowCursor(SDL_SYSTEM_CURSOR_ARROW);
pi3c.window.destroy();
diff --git a/Examples/Invaders/Source/aliens.h b/Examples/Invaders/Source/aliens.h
index b125432..1d6ba85 100644
--- a/Examples/Invaders/Source/aliens.h
+++ b/Examples/Invaders/Source/aliens.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Pi3Cscene.h"
+#include
#include "bullets.h"
class Aliens {
diff --git a/Examples/Invaders/Source/bullets.cpp b/Examples/Invaders/Source/bullets.cpp
index e4b7f23..23e97d0 100644
--- a/Examples/Invaders/Source/bullets.cpp
+++ b/Examples/Invaders/Source/bullets.cpp
@@ -1,5 +1,5 @@
#include "bullets.h"
-#include "Pi3Cshapes.h"
+#include
void Bullets::init(Pi3Cresource* resource, Pi3Cscene* scene, const uint32_t _maxBullets, const uint32_t _bulletLife)
{
diff --git a/Examples/Invaders/Source/bullets.h b/Examples/Invaders/Source/bullets.h
index d71c8c3..7369573 100644
--- a/Examples/Invaders/Source/bullets.h
+++ b/Examples/Invaders/Source/bullets.h
@@ -1,5 +1,5 @@
#pragma once
-#include "Pi3Cscene.h"
+#include
class Bullets {
public:
diff --git a/Examples/MD viewer/MDviewer.sln b/Examples/MD viewer/MDviewer.sln
deleted file mode 100644
index 29fcd3a..0000000
--- a/Examples/MD viewer/MDviewer.sln
+++ /dev/null
@@ -1,33 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{DA75C201-04BB-4D48-8DCC-C336AE6D4305}") = "MDviewer", "MDviewer.vcxproj", "{86B9CF91-8738-B044-A7BF-A295F9323D12}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|ARM = Debug|ARM
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|ARM = Release|ARM
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|ARM.ActiveCfg = Debug|ARM
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|ARM.Build.0 = Debug|ARM
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|x64.ActiveCfg = Debug|x64
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|x64.Build.0 = Debug|x64
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|x86.ActiveCfg = Debug|Win32
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Debug|x86.Build.0 = Debug|Win32
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|ARM.ActiveCfg = Release|ARM
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|ARM.Build.0 = Release|ARM
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|x64.ActiveCfg = Release|x64
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|x64.Build.0 = Release|x64
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|x86.ActiveCfg = Release|Win32
- {86B9CF91-8738-B044-A7BF-A295F9323D12}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Examples/MD viewer/MDviewer.vcxproj b/Examples/MD viewer/MDviewer.vcxproj
deleted file mode 100644
index d77d279..0000000
--- a/Examples/MD viewer/MDviewer.vcxproj
+++ /dev/null
@@ -1,308 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- ARM
-
-
- Release
- ARM
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- {86B9CF91-8738-B044-A7BF-A295F9323D12}
- MDviewer
- 10.0
-
-
-
- Application
- true
- v143
- MultiByte
-
-
- Application
- true
- v143
- MultiByte
-
-
- Application
- false
- v143
- true
- MultiByte
-
-
- Application
- false
- v143
- true
- MultiByte
-
-
- Application
- true
- v143
- MultiByte
-
-
- Application
- false
- v143
- true
- MultiByte
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\SharedCode\core;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\include;$(ProjectDir)\..\..\ThirdParty\glew\include;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\include;$(ProjectDir)\..\..\SharedCode\ui;$(ProjectDir)\..\..\SharedCode\file;$(ProjectDir)\..\..\SharedCode\helpers;$(ProjectDir)\..\..\SharedCode\glutess;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\SharedCode\helpers;$(ProjectDir)\..\..\SharedCode\core;$(ProjectDir)\..\..\SharedCode\file;$(ProjectDir)\..\..\SharedCode\ui;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2_net\lib\x86;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\include;$(ProjectDir)\..\..\ThirdParty\glew\include;$(ProjectDir)\..\..\SharedCode\ui;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\include;$(ProjectDir)\..\..\SharedCode\file;$(ProjectDir)\..\..\SharedCode\core;$(ProjectDir)\..\..\SharedCode\helpers;$(ProjectDir)\..\..\SharedCode\glutess;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_net\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\lib\Release\Win32;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\Shared\SDLwin\include;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2_net\lib\x86;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\Shared\SDLwin\include;$(ProjectDir)\..\..\SharedCode\core;$(ProjectDir)\..\..\SharedCode\helpers;$(ProjectDir)\..\..\SharedCode\file;$(ProjectDir)\..\..\SharedCode\ui;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\include;$(ProjectDir)\..\..\ThirdParty\glew\include;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\include;$(ProjectDir)\..\..\SharedCode\glutess;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x64;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x64;$(ProjectDir)\..\..\ThirdParty\\SDL2_net\lib\x64;$(ProjectDir)\..\..\ThirdParty\glew\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86;$(LibraryPath)
- $(SourcePath)
-
-
- $(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\SDL2_image\include;$(ProjectDir)\..\..\ThirdParty\SDL2_net\include;$(ProjectDir)\Shared\SDLwin\include;$(IncludePath)
- $(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x64;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x64;$(ProjectDir)\..\..\ThirdParty\\SDL2_net\lib\x64;$(LibraryPath)
- $(SourcePath)
-
-
-
- Level3
- Disabled
- true
- ..\..\Shared\glutess;%(AdditionalIncludeDirectories)
-
-
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;SDL2_mixer.lib;SDL2_ttf.lib;glew32s.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
- Level3
- Disabled
- true
-
-
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
- Level3
- Disabled
- true
-
-
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;SDL2_ttf.lib;glew32s.lib;SDL2_mixer.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
- ..\..\Shared\glutess;%(AdditionalIncludeDirectories)
-
-
- true
- true
- SDL2.lib;SDL2main.lib;SDL2_mixer.lib;OpenGL32.lib;SDL2_image.lib;SDL2_ttf.lib;glew32s.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
-
-
- true
- true
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
-
-
- true
- true
- SDL2.lib;SDL2main.lib;OpenGL32.lib;SDL2_image.lib;%(AdditionalDependencies)
- Windows
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Examples/MD viewer/MDviewer.vcxproj.filters b/Examples/MD viewer/MDviewer.vcxproj.filters
deleted file mode 100644
index 6738405..0000000
--- a/Examples/MD viewer/MDviewer.vcxproj.filters
+++ /dev/null
@@ -1,295 +0,0 @@
-
-
-
-
- {1E142D47-36D3-7740-9C7D-5F7ABC070098}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {6AC69C4B-9960-4D43-A898-F590CE31D5AC}
- h;hh;hpp;hxx;hm;inl;inc;xsd
-
-
- {2A9CF5DA-7433-EF49-AEB2-18C6C9D06AA0}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
- {6678c446-5457-4565-9e43-a2ea2aafd732}
-
-
- {e485b0ed-ffb5-419e-8327-96ab507b5935}
-
-
- {fc74154a-6b0d-4488-9aa3-04b6b3d75e26}
-
-
- {aae40517-da35-437f-98a3-b87096ca01a1}
-
-
- {b988fb8c-7b5d-47ab-8dc2-fa719d29b0e1}
-
-
- {56c8bfdf-a7a9-4bd3-b007-cdd71b5aa6fd}
-
-
- {e2ada6ac-7155-46e3-8acf-8c56d063e30a}
-
-
-
-
- Source Files
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\ui
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\ui
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\helpers
-
-
-
-
- Shared Code\file
-
-
- Shared Code\helpers
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\core
-
-
- Shared Code\ui
-
-
- Shared Code\file
-
-
- Shared Code\core
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\ui
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\helpers
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
- Shared Code\helpers
-
-
-
-
-
-
- Shared Code\glutess
-
-
- Shared Code\glutess
-
-
-
\ No newline at end of file
diff --git a/Examples/MD viewer/MDviewer.vcxproj.user b/Examples/MD viewer/MDviewer.vcxproj.user
deleted file mode 100644
index df47269..0000000
--- a/Examples/MD viewer/MDviewer.vcxproj.user
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- PATH=$(ProjectDir)\..\..\ThirdParty\\SDL_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\bin\Release\Win32;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86
- WindowsLocalDebugger
-
-
-
- PATH=$(ProjectDir)\..\..\ThirdParty\SDL_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\bin\Release\Win32;$(ProjectDir)\..\..\ThirdParty\SDL2_mixer\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2_ttf\lib\x86;
- WindowsLocalDebugger
-
-
-
\ No newline at end of file
diff --git a/Examples/MD viewer/Source/MDviewer.cpp b/Examples/MD viewer/Source/MDviewer.cpp
deleted file mode 100644
index a31b5fa..0000000
--- a/Examples/MD viewer/Source/MDviewer.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-#include "Pi3C.h"
-#include "Pi3Cstring.h"
-
-// ==========================================================================
-// Pi3C Graphics Library Example - MarkDown Viewer (by Tim Skillman)
-// ==========================================================================
-//
-// The MIT License
-//
-// Copyright (c) 2018 Tim Skillman
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-// Dedicated to the One who changes my life in the most amazing ways ...
-// Jesus Christ, King of Kings and Lord of Lords :-)
-// =======================================================================
-
-
-int main(int argc, char *argv[])
-{
- Pi3C pi3c("Markdown Document Viewer");
-
- std::string livetext = loadString("passage.txt");
-
- float mediaWidth = 700;
- float mediaHeight = 900;
-
- Pi3Cmodel textmodel = pi3c.create_model_from_text(livetext, mediaWidth - 40, 0xff202020);
- int textRef = pi3c.add_model_to_scene2D(textmodel);
-
- Pi3Cimgui &gui = pi3c.gui;
- //gui.init(&pi3c.resource, &pi3c.window);
-
- while (pi3c.is_running())
- {
- pi3c.do_events();
- pi3c.clear_window(0xF0F0F0);
-
- //Pi3Crecti screenRect(0, 0, pi3c.window.getWidth(), pi3c.window.getHeight());
- //pi3c.scene.setViewport(screenRect);
- //pi3c.scene.setFixedLight(0xffffff, vec3f(0, 1000.f, 1000.f));
- //pi3c.scene.setViewport2D(screenRect, 0.1f, 2000.f);
- //pi3c.scene.setup2D();
-
- //gui.Begin();
-
- ////Menubar ...
- //gui.setButtonStyle(pi3c.bsMenu);
- //if (gui.BeginMenuBar("MenuBar")) {
- // if (gui.BeginMenu("File")) {
- // if (gui.MenuItem("New", "Ctrl+N")) {};
- // if (gui.MenuItem("Open", "Ctrl+O")) {};
- // if (gui.MenuItem("Save", "Ctrl+S")) {}
- // if (gui.MenuItem("Quit", "")) pi3c.window.setquit(true);
- // gui.EndMenu();
- // }
- // if (gui.BeginMenu("Edit")) {
- // if (gui.MenuItem("Copy", "Ctrl+C")) {}
- // if (gui.MenuItem("Paste", "Ctrl+V")) {}
- // if (gui.MenuItem("Delete", "Del")) {}
- // if (gui.MenuItem("Undo", "Ctrl+X")) {}
- // if (gui.MenuItem("Redo", "Ctrl+Y")) {}
- // gui.EndMenu();
- // }
- // if (gui.BeginMenu("Object")) {
- // if (gui.MenuItem("Copy", "Ctrl+C")) {}
- // if (gui.MenuItem("Paste", "Ctrl+V")) {}
- // if (gui.MenuItem("Delete", "Del")) {}
- // if (gui.MenuItem("Undo", "Ctrl+X")) {}
- // if (gui.MenuItem("Redo", "Ctrl+Y")) {}
- // gui.EndMenu();
- // }
- // gui.EndMenuBar("MenuBar");
- //}
-
- //gui.setPosition((pi3c.window.getWidth()-mediaWidth)/2, 40);
- //gui.End();
-
- bool paperTouch = gui.renderRect(mediaWidth, mediaHeight);
-
- pi3c.scene.models2D[textRef].matrix.move(vec3f((pi3c.window.getWidth() - mediaWidth + 40) / 2, pi3c.window.getHeight()-40, -1.5));
- //pi3c.scene.models2D[textRef].textModel(&pi3c.resource, gui.getFont(pi3c.guifonts[0]).get(), livetext, 700); // +sin(rq)*800.f);
-
- pi3c.render2D();
-
- pi3c.swap_buffers();
- }
-
- SDL_Log("Average FPS = %f ", pi3c.getAverageFPS());
-
- pi3c.window.destroy();
- return 0;
-}
\ No newline at end of file
diff --git a/Examples/MD viewer/assets/shaders/fs1.glsl b/Examples/MD viewer/assets/shaders/fs1.glsl
deleted file mode 100644
index da8b0c2..0000000
--- a/Examples/MD viewer/assets/shaders/fs1.glsl
+++ /dev/null
@@ -1,12 +0,0 @@
-//precision highp float; // Set the default precision to medium
-
-uniform sampler2D u_Texture; // texture
-varying vec2 v_UV; // Texture UV coordinate
-varying vec4 v_diffuseColour; // Diffuse colour
-varying vec4 v_fogColour; // Fog colour
-
-void main()
-{
- vec4 col = texture2D(u_Texture, v_UV) * v_diffuseColour + v_fogColour;
- if (col.a > 0.01) gl_FragColor = col; else discard;
-}
diff --git a/Examples/MD viewer/assets/shaders/vs1.glsl b/Examples/MD viewer/assets/shaders/vs1.glsl
deleted file mode 100644
index 952c49f..0000000
--- a/Examples/MD viewer/assets/shaders/vs1.glsl
+++ /dev/null
@@ -1,73 +0,0 @@
-//precision highp float; // Set the default precision to medium. We don't need as high of a
-
-uniform mat4 u_ProjMatrix; // view/projection matrix.
-uniform mat4 u_ModelMatrix; // model matrix.
-uniform vec3 u_LightPos; // The position of the light in eye space.
-uniform vec4 u_lightColour; // The colour of light in eye space.
-uniform int u_illuminationModel; // If ==2 then apply illumation model
-uniform int u_reflective; //
-
-uniform vec2 u_animoffset;
-uniform vec4 u_diffuseColour;
-uniform vec4 u_emissiveColour;
-uniform vec4 u_ambientColour;
-uniform vec4 u_specularColour;
-
-uniform vec3 u_fogColour;
-uniform float u_fogMaxDist;
-uniform float u_fogRange; // effectively 1.0 / (fogMaxDist-fogMinDist)
-uniform float u_col32; // a floating point representing RGB
-
-attribute vec3 a_Position;
-attribute vec3 a_Normal;
-attribute vec2 a_UV;
-attribute float a_Colour;
-
-varying vec2 v_UV;
-varying vec4 v_diffuseColour;
-varying vec4 v_fogColour;
-//varying vec3 v_Normal;
-///varying vec3 v_LightPos;
-
-void main()
-{
- // Transform position into model space
- vec3 Position = vec3(u_ModelMatrix * vec4(a_Position, 1.0));
- vec3 Normal = normalize(vec3(u_ModelMatrix * vec4(a_Normal, 0.0)));
- vec3 lightVector = normalize(u_LightPos - Position);
-
- vec4 col = vec4(fract(a_Colour), fract(a_Colour / 256.0), fract((floor(a_Colour / 256.0)) / 256.0), 1.0);
-
- // Calc UV with animation offset
- v_UV = vec2(a_UV.x, 1.0 - a_UV.y) + u_animoffset;
- if (u_reflective > 0) {
- vec3 pseudoreflect = (lightVector + Normal) *0.5;
- v_UV=v_UV + vec2(pseudoreflect.x, -pseudoreflect.y);
- }
-
- // Calc fog
- vec4 emitColour = max(u_lightColour, u_emissiveColour);
- float fogFactor = (Position.z + u_fogMaxDist) * u_fogRange; // / (fogMaxDist-fogMinDist)
- fogFactor = clamp(fogFactor, 0.0, 1.0);
- //if (u_illuminationModel == 1) fogFactor = 1.0;
- v_fogColour = vec4((u_fogColour * (1.0 - fogFactor)),0.0) * u_lightColour;
-
- // Calc lighting and specular and mix into fogColour
- vec4 ambcol = vec4(0,0,0,0);
- //vec4 diffuseCol = vec4(u_diffuseColour.rgb * max(u_lightColour.rgb, u_emissiveColour.rgb*(1.0-fogFactor)), u_diffuseColour.a);
- vec4 diffuseCol = u_diffuseColour * emitColour * col;
-
- // apply shade and fog ...
- if (u_illuminationModel == 2) {
- float rDotV = max(dot(Normal, lightVector), 0.1);
- fogFactor = fogFactor * rDotV;
- //rDotV = max(0.0, dot(lightVector, Normal));
- ambcol = u_ambientColour * diffuseCol;
- v_fogColour = v_fogColour + vec4(u_specularColour.rgb * pow(rDotV, 50.0), 0.0);
- }
-
- v_diffuseColour = vec4((diffuseCol + ambcol).rgb * fogFactor, u_diffuseColour.a) ; //preserve alpha
-
- gl_Position = u_ProjMatrix * vec4(Position, 1.0);
-}
-
diff --git a/Examples/MD viewer/dependencies.props b/Examples/MD viewer/dependencies.props
deleted file mode 100644
index 936a45d..0000000
--- a/Examples/MD viewer/dependencies.props
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
- $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))
- $(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(ProjectDir)\..\..\ThirdParty\glew\bin\Release\Win32
-
-
- $(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)
- $(ProjectDir)\..\..\ThirdParty\SDL2_image\lib\x86;$(ProjectDir)\..\..\ThirdParty\SDL2\lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\ThirdParty\SDL2_image\;$(ProjectDir)\..\..\ThirdParty\SDL2\include;$(ProjectDir)\..\..\ThirdParty\libpng\h;
-
-
-
-
- $(DllDependenciesPath)
-
-
-
\ No newline at end of file
diff --git a/Examples/MD viewer/makefile b/Examples/MD viewer/makefile
deleted file mode 100644
index 19b0af2..0000000
--- a/Examples/MD viewer/makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-TARGET = MarkDownViewer
-
-CC = g++
-CFLAGS = -std=c++17 -Wall -Wno-narrowing
-LDLIBS = -lGL -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf
-LDFLAGS =
-
-INC_DIRS:= ../../SharedCode/core \
- ../../SharedCode/file \
- ../../SharedCode/ui \
- ../../SharedCode/helpers \
- ../../SharedCode/editing \
- ../../SharedCode/glutess \
- ../../ThirdParty/rapidjson \
- ../../ThirdParty/openFBX \
- ../../ThirdParty/gltf/fx \
- ../../ThirdParty/SDL2/include \
- ../../ThirdParty/SDL2_image/include \
- ../../ThirdParty/SDL2_ttf/include \
- ../../ThirdParty/SDL2_mixer/include
-
-BUILDPATH = ../../../_build/Projects/$(TARGET)/
-
-GLES_DIR = /opt/vc/include
-
-SRC_DIR:= $(INC_DIRS) Source
-BUILD_DIR:= $(addprefix $(BUILDPATH),$(SRC_DIR))
-
-SRC:= $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp $(sdir)/*.c))
-OBJ:= $(patsubst %.cpp,$(BUILDPATH)%.o,$(SRC))
-INCS:= $(addprefix -I,$(SRC_DIR))
-
-vpath %.cpp $(SRC_DIR)
-
-define make-target
-$1/%.o: %.cpp
- $(CC) $(INCS) -c $$< -o $$@ $(CFLAGS) $(LDLIBS) $(LDFLAGS)
-endef
-
-.PHONY: all checkdirs clean
-
-all: checkdirs $(TARGET)
-
-$(TARGET): $(OBJ)
- $(CC) $^ -o $@ $(CFLAGS) $(LDLIBS) $(LDFLAGS)
- echo $(OBJ)
-
-checkdirs: $(BUILD_DIR)
-
-$(BUILD_DIR):
- @mkdir -p $@
-
-clean:
- @rm -rf $(BUILD_DIR)
-
-$(foreach bdir,$(BUILD_DIR),$(eval $(call make-target,$(bdir))))
diff --git a/Examples/MD viewer/passage.txt b/Examples/MD viewer/passage.txt
deleted file mode 100644
index 36cfe05..0000000
--- a/Examples/MD viewer/passage.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
John 3
-New International Version (NIV)
-
-Jesus Teaches Nicodemus
-
-
3 Now there was a Pharisee, a man named Nicodemus who was a member of the Jewish ruling council. 2 He came to Jesus at night and said, "Rabbi, we know that you are a teacher who has come from God. For no one could perform the signs you are doing if God were not with him."
-3 Jesus replied, "Very truly I tell you, no one can see the kingdom of God unless they are born again.[a] 4 "How can someone be born when they are old?" Nicodemus asked. “Surely they cannot enter a second time into their mother’s womb to be born!"
-
-5 Jesus answered, "Very truly I tell you, no one can enter the kingdom of God unless they are born of water and the Spirit. 6 Flesh gives birth to flesh, but the Spirit[b] gives birth to spirit. 7 You should not be surprised at my saying, ‘You[c] must be born again.’ 8 The wind blows wherever it pleases. You hear its sound, but you cannot tell where it comes from or where it is going. So it is with everyone born of the Spirit."[d] 9 "How can this be?" Nicodemus asked. 10 "You are Israel’s teacher," said Jesus, "and do you not understand these things? 11 Very truly I tell you, we speak of what we know, and we testify to what we have seen, but still you people do not accept our testimony. 12 I have spoken to you of earthly things and you do not believe; how then will you believe if I speak of heavenly things? 13 No one has ever gone into heaven except the one who came from heaven the Son of Man.[e] 14 Just as Moses lifted up the snake in the wilderness, so the Son of Man must be lifted up,[f] 15 that everyone who believes may have eternal life in him."[g] 16 For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life. 17 For God did not send his Son into the world to condemn the world, but to save the world through him. 18 Whoever believes in him is not condemned, but whoever does not believe stands condemned already because they have not believed in the name of God’s one and only Son. 19 This is the verdict: Light has come into the world, but people loved darkness instead of light because their deeds were evil. 20 Everyone who does evil hates the light, and will not come into the light for fear that their deeds will be exposed. 21 But whoever lives by the truth comes into the light, so that it may be seen plainly that what they have done has been done in the sight of God.
-
-John Testifies Again About Jesus
-
-22 After this, Jesus and his disciples went out into the Judean countryside, where he spent some time with them, and baptized. 23 Now John also
-was baptizing at Aenon near Salim, because there was plenty of water, and people were coming and being baptized. 24 (This was before John was put in prison.)
-25 An argument developed between some of John’s disciples and a certain Jew over the matter of ceremonial washing. 26 They came to John and said to
-him, "Rabbi, that man who was with you on the other side of the Jordan—the one you testified about—look, he is baptizing, and everyone is going to him."
-27 To this John replied, "A person can receive only what is given them from heaven. 28 You yourselves can testify that I said, ‘I am not the
-Messiah but am sent ahead of him.’ 29 The bride belongs to the bridegroom. The friend who attends the bridegroom waits and listens for him, and is full
-of joy when he hears the bridegroom’s voice. That joy is mine, and it is now complete. 30 He must become greater; I must become less."[h]
-31 The one who comes from above is above all; the one who is from the earth belongs to the earth, and speaks as one from the earth. The one who
-comes from heaven is above all. 32 He testifies to what he has seen and heard, but no one accepts his testimony. 33 Whoever has accepted
-it has certified that God is truthful. 34 For the one whom God has sent speaks the words of God, for God[i] gives the Spirit without limit. 35
-The Father loves the Son and has placed everything in his hands. 36 Whoever believes in the Son has eternal life, but whoever rejects the Son will not see
-life, for God’s wrath remains on them."
\ No newline at end of file
diff --git a/Examples/NoahsArk/Source/NoahsArk.cpp b/Examples/NoahsArk/Source/NoahsArk.cpp
index 92bef7a..bfea786 100644
--- a/Examples/NoahsArk/Source/NoahsArk.cpp
+++ b/Examples/NoahsArk/Source/NoahsArk.cpp
@@ -1,6 +1,6 @@
-#include "Pi3C.h"
-#include "Pi3CloadOptions.h"
-#include "Pi3Cavatar.h"
+#include
+#include
+#include
#include
#include
diff --git a/Examples/PerlinMap/Source/Perlin.cpp b/Examples/PerlinMap/Source/Perlin.cpp
index 0cbec70..984753b 100644
--- a/Examples/PerlinMap/Source/Perlin.cpp
+++ b/Examples/PerlinMap/Source/Perlin.cpp
@@ -1,6 +1,6 @@
-#include "Pi3C.h"
-#include "Pi3CperlinNoise.h"
-#include "Pi3CloadOptions.h"
+#include
+#include
+#include
//#include "Pi3Cshapes.h"
#include "PerlinGUI.h"
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
pi3c.swap_buffers();
}
- SDL_Log("Average FPS = %f ", pi3c.getAverageFPS());
+ SDL_Log("Average FPS = %f ", pi3c.average_fps);
delete ptex;
diff --git a/Examples/PerlinMap/Source/PerlinGUI.h b/Examples/PerlinMap/Source/PerlinGUI.h
index 95df3ca..8d2d80b 100644
--- a/Examples/PerlinMap/Source/PerlinGUI.h
+++ b/Examples/PerlinMap/Source/PerlinGUI.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Pi3Cimgui.h"
+#include
class perlinGUI {
public:
diff --git a/Examples/ShaderToy/Source/Shadertoy.cpp b/Examples/ShaderToy/Source/Shadertoy.cpp
index f96d975..6051d42 100644
--- a/Examples/ShaderToy/Source/Shadertoy.cpp
+++ b/Examples/ShaderToy/Source/Shadertoy.cpp
@@ -1,6 +1,6 @@
-#include "Pi3Cwin.h"
-#include "Pi3CloadOptions.h"
-#include "Pi3Cresource.h"
+#include
+#include
+#include
// ==========================================================================
// Pi3C Graphics Library Example - ShaderToy implementation
diff --git a/Examples/Snow/Source/Snow.cpp b/Examples/Snow/Source/Snow.cpp
index 86f47fe..77ac0ad 100644
--- a/Examples/Snow/Source/Snow.cpp
+++ b/Examples/Snow/Source/Snow.cpp
@@ -1,7 +1,7 @@
-#include "Pi3C.h"
-#include "Pi3Cstring.h"
-#include "Pi3Cparticles.h"
-#include "Pi3Csprite.h"
+#include
+#include
+#include
+#include
// ==========================================================================
// Pi3C Graphics Library Example - Snow 2D example (by Tim Skillman)
@@ -75,10 +75,12 @@ int main(int argc, char* argv[])
pi3c.render2D();
pi3c.showFPS();
+
+ pi3c.update_time();
pi3c.swap_buffers();
}
- SDL_Log("Average FPS = %f ", pi3c.getAverageFPS());
+ SDL_Log("Average FPS = %f ", pi3c.average_fps);
pi3c.window.destroy();
return 0;
diff --git a/Resources/Template_Project/source/SOLUTION_NAME.cpp b/Resources/Template_Project/source/SOLUTION_NAME.cpp
index ef2e421..9595a8e 100644
--- a/Resources/Template_Project/source/SOLUTION_NAME.cpp
+++ b/Resources/Template_Project/source/SOLUTION_NAME.cpp
@@ -1,8 +1,11 @@
-#include "Pi3C.h"
+#include
+
+#include SCREEN_WIDTH 800
+#include SCREEN_HEIGHT 600
int main(int argc, char *argv[])
{
- Pi3C pi3c("PROJECT_NAME", 800, 600);
+ Pi3C pi3c("PROJECT_NAME", SCREEN_WIDTH, SCREEN_HEIGHT);
//Setup your scene here ...
@@ -12,6 +15,7 @@ int main(int argc, char *argv[])
//Draw your scene here ...
+ pi3c.update_time();
pi3c.swap_buffers();
}
diff --git a/SharedCode/helpers/Pi3C.cpp b/SharedCode/helpers/Pi3C.cpp
index 8edc628..32fc5a4 100644
--- a/SharedCode/helpers/Pi3C.cpp
+++ b/SharedCode/helpers/Pi3C.cpp
@@ -190,29 +190,11 @@ float Pi3C::getFloorHeight(const uint32_t modelRef, const vec3f pos)
return ht;
}
-float Pi3C::getAverageFPS()
-{
- uint32_t ticks = SDL_GetTicks() - start_time;
- return (float)frames / ((float)ticks / 1000.f);
-}
-
-float Pi3C::getCurrentFPS()
-{
- uint32_t ticks = SDL_GetTicks() - last_time;
- if (ticks>1000) {
- float currentFPS = (float)fps / ((float)ticks / 1000.f);
- fps = 0;
- last_time = SDL_GetTicks();
- lastFPS = currentFPS;
- }
- return lastFPS;
-}
-
void Pi3C::showFPS()
{
gui.Begin();
- const std::string fps = "FPS:" + std::to_string((int)getCurrentFPS());
- gui.Text(fps, 0xffffffff);
+ const std::string fpss = "FPS: " + std::to_string((int)fps);
+ gui.Text(fpss, 0xffffffff);
}
void Pi3C::resize_window()
@@ -259,8 +241,22 @@ bool Pi3C::keyPress(char key) {
return (keys[scancode] != 0);
}
+void Pi3C::update_time() {
+ // Calculate deltaTime
+ float ticks = SDL_GetTicks() - last_time;
+ last_time = SDL_GetTicks();
+ deltaTime = ticks / 1000.0f;
+
+ // Calculate fps
+ fps = 1.0f / deltaTime;
+
+ // Calculate average_fps
+ average_fps = (float)frames / SDL_GetTicks() * 1000.0f;
+}
+
void Pi3C::swap_buffers() {
- frames++; fps++;
+ frames++;
+
window.SwapBuffers();
done_events = false;
}
diff --git a/SharedCode/helpers/Pi3C.h b/SharedCode/helpers/Pi3C.h
index 5d7471e..854ad59 100644
--- a/SharedCode/helpers/Pi3C.h
+++ b/SharedCode/helpers/Pi3C.h
@@ -118,9 +118,10 @@ class Pi3C {
inline uint32_t getMilliseconds() { return SDL_GetTicks(); }
std::vector get_dropfiles();
+ //Time functions
+ void update_time();
+
//Report functions
- float getAverageFPS();
- float getCurrentFPS();
void showFPS();
//Window functions
@@ -140,16 +141,18 @@ class Pi3C {
std::vector guifonts;
Pi3Cimgui::rectStyle bsMenu;
+ float deltaTime = 0;
+ float fps = 0;
+ float average_fps = 0;
+
private:
std::vector eventList;
bool done_events = false;
bool has_started = false;
uint32_t frames = 0;
- uint32_t fps = 0;
uint32_t start_time = 0;
uint32_t last_time = 0;
- float lastFPS = 0;
uint32_t winw = 0;
uint32_t winh = 0;
};