| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 44223ea commit afafa5e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -327,7 +327,7 @@ SolvespaceControls.prototype.constructor = SolvespaceControls; | |||
| 327 | 327 | solvespace = function(obj, params) { | |
| 328 | 328 | var scene, edgeScene, camera, edgeCamera, renderer; | |
| 329 | 329 | var geometry, controls, material, mesh, edges; | |
| 330 | - var width, height; | ||
| 330 | + var width, height, scale, offset, projRight, projUp; | ||
| 331 | 331 | var directionalLightArray = []; | |
| 332 | 332 | ||
| 333 | 333 | if (typeof params === "undefined" || !("width" in params)) { | |
@@ -342,7 +342,32 @@ solvespace = function(obj, params) { | |||
| 342 | 342 | height = params.height; | |
| 343 | 343 | } | |
| 344 | 344 | ||
| 345 | + if (typeof params === "undefined" || !("scale" in params)) { | ||
| 346 | + scale = 5; | ||
| 347 | + } else { | ||
| 348 | + scale = params.scale; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + if (typeof params === "undefined" || !("offset" in params)) { | ||
| 352 | + offset = new THREE.Vector3(0, 0, 0); | ||
| 353 | + } else { | ||
| 354 | + offset = params.offset; | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + if (typeof params === "undefined" || !("projUp" in params)) { | ||
| 358 | + projUp = new THREE.Vector3(0, 1, -1); | ||
| 359 | + } else { | ||
| 360 | + projUp = params.projUp; | ||
| 361 | + } | ||
| 362 | + | ||
| 363 | + if (typeof params === "undefined" || !("projRight" in params)) { | ||
| 364 | + projRight = new THREE.Vector3(1, 0, -1); | ||
| 365 | + } else { | ||
| 366 | + projRight = params.projRight; | ||
| 367 | + } | ||
| 368 | + | ||
| 345 | 369 | domElement = init(); | |
| 370 | + lightUpdate(); | ||
| 346 | 371 | render(); | |
| 347 | 372 | return domElement; | |
| 348 | 373 | ||
@@ -351,9 +376,8 @@ solvespace = function(obj, params) { | |||
| 351 | 376 | scene = new THREE.Scene(); | |
| 352 | 377 | edgeScene = new THREE.Scene(); | |
| 353 | 378 | ||
| 354 | - camera = new SolvespaceCamera(width, | ||
| 355 | - height, 5, new THREE.Vector3(0, 1, 0), | ||
| 356 | - new THREE.Vector3(1, 0, 0), new THREE.Vector3(0, 0, 0)); | ||
| 379 | + camera = new SolvespaceCamera(width, height, scale, projUp, projRight, offset); | ||
| 380 | + camera.NormalizeProjectionVectors(); | ||
| 357 | 381 | ||
| 358 | 382 | mesh = createMesh(obj); | |
| 359 | 383 | scene.add(mesh); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -860,7 +860,12 @@ void SolveSpaceUI::ExportMeshAsThreeJsTo(FILE *f, const std::string &filename, | |||
| 860 | 860 | <script> | |
| 861 | 861 | )"; | |
| 862 | 862 | const char htmlend[] = R"( | |
| 863 | - document.body.appendChild(solvespace(solvespace_model_%s)); | ||
| 863 | + document.body.appendChild(solvespace(solvespace_model_%s, { | ||
| 864 | + scale: %g, | ||
| 865 | + offset: new THREE.Vector3(%g, %g, %g), | ||
| 866 | + projUp: new THREE.Vector3(%g, %g, %g), | ||
| 867 | + projRight: new THREE.Vector3(%g, %g, %g) | ||
| 868 | + })); | ||
| 864 | 869 | </script> | |
| 865 | 870 | </body> | |
| 866 | 871 | </html> | |
@@ -1001,7 +1006,12 @@ void SolveSpaceUI::ExportMeshAsThreeJsTo(FILE *f, const std::string &filename, | |||
| 1001 | 1006 | fputs(" ]\n};\n", f); | |
| 1002 | 1007 | ||
| 1003 | 1008 | if(extension == "html") | |
| 1004 | - fprintf(f, htmlend, baseFilename.c_str()); | ||
| 1009 | + fprintf(f, htmlend, | ||
| 1010 | + baseFilename.c_str(), | ||
| 1011 | + SS.GW.scale, | ||
| 1012 | + CO(SS.GW.offset), | ||
| 1013 | + CO(SS.GW.projUp), | ||
| 1014 | + CO(SS.GW.projRight)); | ||
| 1005 | 1015 | ||
| 1006 | 1016 | spl.Clear(); | |
| 1007 | 1017 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments