GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — old/ModelLoader.js at master · vfasteng/old

Expand file tree

/

ModelLoader.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
81 lines (69 loc) · 1.92 KB
/

ModelLoader.js

Copy path

File metadata and controls

81 lines (69 loc) · 1.92 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// @ts-nocheck
import * as THREE from 'three'
export function loadModel (jsoncontent) {
var loader = new THREE.AssimpJSONLoader();
if (object != null) { scene1.remove(object) }
if (mesh != null) { scene1.remove(mesh) }
object = loader.parse(jsoncontent);
object.scale.multiplyScalar(SCALE);
scene1.add(object);
objects.push(object);
render();
animate();
}
//STL
function loadSTL(stlpath) {
var loader = new THREE.STLLoader();
loader.load('./STLFile/File.stl', function (geometry) {
if (mesh != null) { scene1.remove(mesh) }
if (object != null) { scene1.remove(object) }
var material = new THREE.MeshNormalMaterial();
mesh = new THREE.Mesh(geometry, material);
mesh.scale.set(0.1, 0.1, 0.1);
scene1.add(mesh);
render();
animate();
});
}
//DAE
function loadDAE() {
var loader = new THREE.ColladaLoader();
loader.load("./DAEFile/File.dae", function loadCollada(collada) {
var model = collada.scene;
model.updateMatrix();
scene1.add(model);
render();
animate();
});
}
//PLY
function loadPLY() {
var loader = new THREE.PLYLoader();
loader.load('./PLYFile/File.ply', function (geometry) {
geometry.computeVertexNormals();
var material = new THREE.MeshStandardMaterial({ color: 0x0055ff, flatShading: true });
var mesh = new THREE.Mesh(geometry, material);
mesh.position.y = 0;
mesh.scale = 2;
mesh.position.z = 0;
mesh.rotation.x = 0;
mesh.scale.multiplyScalar(7);
mesh.castShadow = true;
mesh.receiveShadow = true;
scene1.add(mesh);
});
}
//// instantiate a loader
//var loader = new THREE.ColladaLoader();
//loader.load(
// // resource URL
// './DAEFile/File.dae',
// // Function when resource is loaded
// function (collada) {
// scene.add(collada.scene);
// },
// // Function called when download progresses
// function (xhr) {
// console.log((xhr.loaded / xhr.total * 100) + '% loaded');
// }
//);
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.