-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloaderApp.js
More file actions
58 lines (50 loc) · 2.52 KB
/
loaderApp.js
File metadata and controls
58 lines (50 loc) · 2.52 KB
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
// JavaScript source code
// Now create an array of positions for the square.
const TryLoadingPrim = (function () {
const mat4 = glMatrix.mat4;
var objects = [];
var Init = function () {
StageData.ticks = 0;
////SkyboxRenderer.useSkybox('skybox');//"penguins (26)");//StageData.skybox = "penguins (26)";
////OutlineRenderer.setup();
////Makarios.setStepsForCelShading(4.0);
Makarios.SetUseAlphaInTextureBuffer(true);
maxCamDist = 200.0;//global scope, plz fix
maxZFar = 300.0;//this global too
var boxloc = 'SampleModels/Box/glTF-Embedded/Box.gltf';
var minloc = 'SampleModels/Minimal.gltf';
var foxloc = 'SampleModels/Fox/glTF-Embedded/Fox.gltf';
var rotboxloc = 'SampleModels/BoxAnimated/glTF-Embedded/BoxAnimated.gltf';
var rottriloc = 'SampleModels/AnimatedTriangle/glTF-Embedded/AnimatedTriangle.gltf';
var twotriloc = 'SampleModels/SimpleMeshes/glTF-Embedded/SimpleMeshes.gltf';
var texloc = 'SampleModels/SimpleTxt.gltf'
var trimorph = 'SampleModels/SimpleMorph/glTF-Embedded/SimpleMorph.gltf'
var skelloc = 'SampleModels/SimpleSkin/glTF-Embedded/SimpleSkin.gltf'
GltfConverter.getPrimitiveFromJsResource(foxloc, function (res) {
console.log('!'); console.log(res);
Primitives.shapes["testbox"] = res.prim;
Primitives.shapes["testbox"].animations = [];
if (res.animations) {
for (var a = 0; a < res.animations.length; a++) {
Primitives.animations.push(res.animations[a]);
Primitives.shapes["testbox"].animations[res.animations[a].name] = Primitives.animations[Primitives.animations.length - 1];
}
}
});
setTimeout(function () {
console.log(Primitives.shapes["testbox"]);
var ob5 = Makarios.instantiate(Primitives.shapes["testbox"], Primitives.shapes["testbox"].textureUrl, null, {});//'plainsky.jpg' Primitives.shapes["testbox"].textureUrl
Makarios.SetAnimation(ob5, "Run");//"0" Survey Run
//ob5.matrix = objects[0].matrix;
console.log(ob5);
}, 2000);
};
var OnFrame = function () {
//FrameLogic.onFrame();
};
//console.log(objects[0].children[0].indices)
//console.log(objects[0].useParentMatrix)
//console.log(objects[0].children[0].useParentMatrix)
//return { 'objects': objects };
return { 'Init': Init, 'OnFrame': OnFrame };
})();