-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOpenGLExample.js
More file actions
54 lines (41 loc) · 1.03 KB
/
Copy pathOpenGLExample.js
File metadata and controls
54 lines (41 loc) · 1.03 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
var model;
var finished = false;
var settings = false;
var lastPersent = 0;
function modTick() {
if(!finished && settings) {
if(model.getLoaded()) {
clientMessage("Finished loading cube.obj");
finished = true;
} else {
var persent = model.getLoadedPersent();
if(lastPersent != persent && persent % 10 == 0) {
lastPersent = persent;
clientMessage(persent + "%");
}
}
}
if(finished) {
//model.setX(model.getX() + 0.1);
}
}
function selectLevelHook() {
timer(function() {
model = new ModPEOpenGLLib.Model();
model.setX(Player.getX());
model.setY(Player.getY());
model.setZ(Player.getZ());
model.setFile("sdcard/cube.obj");
try {
model.init();
ModPEOpenGLLib.addModel(model);
} catch (e) {
clientMessage(e);
}
settings = true;
clientMessage("Started loading cube.obj!");
}, 10000);
}
function timer(func, time) {
new android.os.Handler(android.os.Looper.getMainLooper()).postDelayed(new java.lang.Runnable({run:func}), time);
}