From affc88f3429b79c1cccf08d33b4aa9880d86ca16 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 6 May 2016 17:24:18 +0000 Subject: [PATCH] Three.js: various control improvements. Specifically: * touchscreen devices are now supported; * rotation is now more like what SolveSpace itself does. The code is split in two parts because MSVC can't handle string literals longer than 16Ki. --- src/export.cpp | 692 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 499 insertions(+), 193 deletions(-) diff --git a/src/export.cpp b/src/export.cpp index 9c99a3a..f623edb 100644 --- a/src/export.cpp +++ b/src/export.cpp @@ -843,197 +843,501 @@ void SolveSpaceUI::ExportMeshAsThreeJsTo(FILE *f, const std::string &filename, STriangle *tr; SEdge *e; Vector bndl, bndh; - const char htmlbegin[] = - "\n" - "\n" - " \n" - " \n" - " Three.js Solvespace Mesh\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "\n"; + const char htmlbegin0[] = R"( + + + + + Three.js Solvespace Mesh + + + + + + + + + +)"; // A default three.js viewer with OrthographicTrackballControls is // generated as a comment preceding the data. @@ -1073,8 +1377,10 @@ void SolveSpaceUI::ExportMeshAsThreeJsTo(FILE *f, const std::string &filename, baseFilename[i] = '_'; } - if(extension == "html") - fputs(htmlbegin, f); + if(extension == "html") { + fputs(htmlbegin0, f); + fputs(htmlbegin1, f); + } fprintf(f, "var solvespace_model_%s = {\n" " bounds: {\n"