don't use super-three
faster loading through geometry re-use
This commit is contained in:
parent
2a5fad3c87
commit
7bb0e46e56
@ -29,8 +29,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/super-three@0.116.0/build/three.min.js"></script>
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/three@0.116.0/build/three.min.js"></script>
|
||||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/super-three@0.116.0/examples/js/controls/OrbitControls.js"></script>
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/three@0.116.0/examples/js/controls/OrbitControls.js"></script>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='lddviewer/base64-binary.js') }}"></script>
|
<script type="text/javascript" src="{{ url_for('static', filename='lddviewer/base64-binary.js') }}"></script>
|
||||||
@ -59,8 +59,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script type='module'>
|
<script type='module'>
|
||||||
import {MTLLoader} from 'https://cdn.jsdelivr.net/npm/super-three@0.116.0/examples/jsm/loaders/MTLLoader.js'
|
import {MTLLoader} from 'https://cdn.jsdelivr.net/npm/three@0.116.0/examples/jsm/loaders/MTLLoader.js'
|
||||||
import {OBJLoader} from 'https://cdn.jsdelivr.net/npm/super-three@0.116.0/examples/jsm/loaders/OBJLoader.js'
|
import {OBJLoader} from 'https://cdn.jsdelivr.net/npm/three@0.116.0/examples/jsm/loaders/OBJLoader.js'
|
||||||
//Three.js stuff
|
//Three.js stuff
|
||||||
const scene = new THREE.Scene();
|
const scene = new THREE.Scene();
|
||||||
let cammatr = new THREE.Matrix4();
|
let cammatr = new THREE.Matrix4();
|
||||||
@ -589,13 +589,15 @@
|
|||||||
for (const bri of this.scene.Bricks){
|
for (const bri of this.scene.Bricks){
|
||||||
current += 1
|
current += 1
|
||||||
for (const pa of bri.Parts){
|
for (const pa of bri.Parts){
|
||||||
let geo = new Geometry(pa.designID, this.database)
|
let geo = 0
|
||||||
if (!(pa.designID in geometriecache)) {
|
if (geometriecache.hasOwnProperty(pa.designID)) {
|
||||||
let geo = new Geometry(pa.designID, this.database)
|
// console.log(`Re-use brick ${pa.designID}`)
|
||||||
geometriecache[pa.designID] = geo
|
geo = geometriecache[pa.designID]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
geo = geometriecache[pa.designID]
|
// console.log(`New brick ${pa.designID}`)
|
||||||
|
geo = new Geometry(pa.designID, this.database)
|
||||||
|
geometriecache[pa.designID] = geo
|
||||||
}
|
}
|
||||||
|
|
||||||
let ind = 0
|
let ind = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user