code split
parent
79282f8572
commit
770d8160d2
|
@ -38,13 +38,12 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="react"></div>
|
<div id="react"></div>
|
||||||
<canvas id="c"></canvas>
|
<canvas id="c"></canvas>
|
||||||
|
<div id="stats"></div>
|
||||||
<script src="redux.bundle.js"></script>
|
<script src="redux.bundle.js"></script>
|
||||||
<script src="renderer.bundle.js"></script>
|
<script src="renderer.bundle.js"></script>
|
||||||
<script src="index.bundle.js"></script>
|
<script src="index.bundle.js"></script>
|
||||||
<script src="solver.js"></script>
|
<script src="solver.js"></script>
|
||||||
<script src="lz-string.min.js"></script>
|
<script src="lz-string.min.js"></script>
|
||||||
<!-- <script src="lz-string.js"></script> -->
|
|
||||||
<div id="stats"></div>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</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) {
|
export function Renderer(store) {
|
||||||
this.store = store
|
this.store = store
|
||||||
// this.stats = new Stats();
|
this.stats = new Stats();
|
||||||
// this.stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
|
this.stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
|
||||||
// document.getElementById('stats').appendChild(this.stats.dom);
|
document.getElementById('stats').appendChild(this.stats.dom);
|
||||||
|
|
||||||
this.canvas = document.querySelector('#c');
|
this.canvas = document.querySelector('#c');
|
||||||
this.renderer = new THREE.WebGLRenderer({ canvas: this.canvas });
|
this.renderer = new THREE.WebGLRenderer({ canvas: this.canvas });
|
||||||
|
@ -123,7 +123,7 @@ export function Renderer(store) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
// this.stats.begin();
|
this.stats.begin();
|
||||||
if (this.resizeCanvas(this.renderer)) {
|
if (this.resizeCanvas(this.renderer)) {
|
||||||
const canvas = this.renderer.domElement;
|
const canvas = this.renderer.domElement;
|
||||||
this.camera.left = -canvas.clientWidth / canvas.clientHeight;
|
this.camera.left = -canvas.clientWidth / canvas.clientHeight;
|
||||||
|
@ -131,7 +131,7 @@ function render() {
|
||||||
this.camera.updateProjectionMatrix();
|
this.camera.updateProjectionMatrix();
|
||||||
}
|
}
|
||||||
this.renderer.render(scene, this.camera);
|
this.renderer.render(scene, this.camera);
|
||||||
// this.stats.end();
|
this.stats.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
function resizeCanvas(renderer) {
|
function resizeCanvas(renderer) {
|
||||||
|
|
|
@ -166,7 +166,7 @@ class Sketcher extends THREE.Group {
|
||||||
var string = JSON.stringify(this.toJSON());
|
var string = JSON.stringify(this.toJSON());
|
||||||
window.string = string;
|
window.string = string;
|
||||||
alert("Size of sample is: " + string.length);
|
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);
|
alert("Size of compressed sample is: " + compressed.length);
|
||||||
string = LZString.decompress(compressed);
|
string = LZString.decompress(compressed);
|
||||||
alert("Sample is: " + string);
|
alert("Sample is: " + string);
|
||||||
|
|
Loading…
Reference in New Issue