Update to THREE.js revision 111 as found in Debian Testing

Required some small JavaScript changes to replace deprecated usage.
pull/908/head
Ryan Pavlik 2021-01-21 15:25:09 -06:00 committed by phkahler
parent 6d9bbb69d6
commit d16e33ac48
5 changed files with 11 additions and 8 deletions

View File

@ -284,7 +284,7 @@ add_resources(
shaders/edge.frag shaders/edge.frag
shaders/edge.vert shaders/edge.vert
shaders/outline.vert shaders/outline.vert
threejs/three-r76.js.gz threejs/three-r111.min.js.gz
threejs/hammer-2.0.8.js.gz threejs/hammer-2.0.8.js.gz
threejs/SolveSpaceControls.js) threejs/SolveSpaceControls.js)

View File

@ -470,9 +470,9 @@ solvespace = function(obj, params) {
changeBasis.makeBasis(camera.right, camera.up, n); changeBasis.makeBasis(camera.right, camera.up, n);
for (var i = 0; i < 2; i++) { for (var i = 0; i < 2; i++) {
var newLightPos = changeBasis.applyToVector3Array( var newLightPos = new THREE.Vector3(obj.lights.d[i].direction[0],
[obj.lights.d[i].direction[0], obj.lights.d[i].direction[1], obj.lights.d[i].direction[1],
obj.lights.d[i].direction[2]]); obj.lights.d[i].direction[2]).applyMatrix4(changeBasis);
directionalLightArray[i].position.set(newLightPos[0], directionalLightArray[i].position.set(newLightPos[0],
newLightPos[1], newLightPos[2]); newLightPos[1], newLightPos[2]);
} }
@ -515,7 +515,7 @@ solvespace = function(obj, params) {
} }
geometry.computeBoundingSphere(); geometry.computeBoundingSphere();
return new THREE.Mesh(geometry, new THREE.MultiMaterial(materialList)); return new THREE.Mesh(geometry, materialList);
} }
function createEdges(meshObj) { function createEdges(meshObj) {

Binary file not shown.

Binary file not shown.

View File

@ -956,13 +956,16 @@ void SolveSpaceUI::ExportMeshAsThreeJsTo(FILE *f, const Platform::Path &filename
SPointList spl = {}; SPointList spl = {};
STriangle *tr; STriangle *tr;
Vector bndl, bndh; Vector bndl, bndh;
const std::string THREE_FN("three-r111.min.js");
const char htmlbegin[] = R"( const char htmlbegin[] = R"(
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"></meta> <meta charset="utf-8"></meta>
<title>Three.js Solvespace Mesh</title> <title>Three.js Solvespace Mesh</title>
<script id="three-r76.js">%s</script> <script id="%s">%s</script>
<script id="hammer-2.0.8.js">%s</script> <script id="hammer-2.0.8.js">%s</script>
<script id="SolveSpaceControls.js">%s</script> <script id="SolveSpaceControls.js">%s</script>
<style type="text/css"> <style type="text/css">
@ -1014,8 +1017,8 @@ void SolveSpaceUI::ExportMeshAsThreeJsTo(FILE *f, const Platform::Path &filename
if(filename.HasExtension("html")) { if(filename.HasExtension("html")) {
fprintf(f, htmlbegin, fprintf(f, htmlbegin,
LoadStringFromGzip("threejs/three-r76.js.gz").c_str(), THREE_FN.c_str(),
LoadStringFromGzip("threejs/hammer-2.0.8.js.gz").c_str(), LoadStringFromGzip("threejs/" + THREE_FN + ".gz").c_str(),
LoadString("threejs/SolveSpaceControls.js").c_str()); LoadString("threejs/SolveSpaceControls.js").c_str());
} }