code split
parent
79282f8572
commit
770d8160d2
|
@ -38,13 +38,12 @@
|
|||
<body>
|
||||
<div id="react"></div>
|
||||
<canvas id="c"></canvas>
|
||||
<div id="stats"></div>
|
||||
<script src="redux.bundle.js"></script>
|
||||
<script src="renderer.bundle.js"></script>
|
||||
<script src="index.bundle.js"></script>
|
||||
<script src="solver.js"></script>
|
||||
<script src="lz-string.min.js"></script>
|
||||
<!-- <script src="lz-string.js"></script> -->
|
||||
<div id="stats"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
// import { createStore, applyMiddleware } from 'redux'
|
||||
// import logger from 'redux-logger'
|
||||
|
||||
|
||||
|
||||
function reducer(state = {}, action) {
|
||||
switch (action.type) {
|
||||
case 'toggle':
|
||||
return { ...state, toggle: action.payload }
|
||||
case 'rx-new-sketch':
|
||||
return { ...state, sketches: [...state.sketches, action.idx] }
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
var bbb = 'bbbx'
|
||||
var store = Redux.createStore(reducer, {sketches:[]}, Redux.applyMiddleware(reduxLogger.logger))
|
|
@ -13,9 +13,9 @@ import { add3DPoint } from './datums'
|
|||
|
||||
export function Renderer(store) {
|
||||
this.store = store
|
||||
// this.stats = new Stats();
|
||||
// this.stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
|
||||
// document.getElementById('stats').appendChild(this.stats.dom);
|
||||
this.stats = new Stats();
|
||||
this.stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
|
||||
document.getElementById('stats').appendChild(this.stats.dom);
|
||||
|
||||
this.canvas = document.querySelector('#c');
|
||||
this.renderer = new THREE.WebGLRenderer({ canvas: this.canvas });
|
||||
|
@ -123,7 +123,7 @@ export function Renderer(store) {
|
|||
}
|
||||
|
||||
function render() {
|
||||
// this.stats.begin();
|
||||
this.stats.begin();
|
||||
if (this.resizeCanvas(this.renderer)) {
|
||||
const canvas = this.renderer.domElement;
|
||||
this.camera.left = -canvas.clientWidth / canvas.clientHeight;
|
||||
|
@ -131,7 +131,7 @@ function render() {
|
|||
this.camera.updateProjectionMatrix();
|
||||
}
|
||||
this.renderer.render(scene, this.camera);
|
||||
// this.stats.end();
|
||||
this.stats.end();
|
||||
}
|
||||
|
||||
function resizeCanvas(renderer) {
|
||||
|
|
|
@ -166,7 +166,7 @@ class Sketcher extends THREE.Group {
|
|||
var string = JSON.stringify(this.toJSON());
|
||||
window.string = string;
|
||||
alert("Size of sample is: " + string.length);
|
||||
var compressed = LZString.compress(string);
|
||||
window.compressed = LZString.compress(string);
|
||||
alert("Size of compressed sample is: " + compressed.length);
|
||||
string = LZString.decompress(compressed);
|
||||
alert("Sample is: " + string);
|
||||
|
|
Loading…
Reference in New Issue