-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpenguin.js
More file actions
60 lines (49 loc) · 1.41 KB
/
Copy pathpenguin.js
File metadata and controls
60 lines (49 loc) · 1.41 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
59
//this is a file that is not included in the config.json, the purpose is to test the parsejol
var CTMParser = {
name: "ctmparser",
type: "mesh",
format: "text",
dataType:'text',
mimeType: "text/plain; charset=x-user-defined",
init: function()
{
/*
LiteGUI.requireScript([], inner );
function retrieve(url, callback){
var request = new XMLHttpRequest();
request.open("GET", url, true);
request.overrideMimeType("text/plain; charset=x-user-defined");
request.send();
request.onload = callback;
return request;
};
function inner()
{
//var request = retrieve("url to ctm file to test", loaded );
}
*/
},
deinit: function()
{
},
showDialog: function()
{
var dialog = new LiteGUI.Dialog("dialog_daylight", {title:"Day light editor", close: true, width: 300, height: 120, scroll: false, draggable: true});
dialog.show('fade');
},
parse: function(data)
{
var stream = new CTM.Stream(data);
var file = new CTM.File(stream);
if(!file)
return;
console.log( file );
var mesh = GL.Mesh.load({ vertices: file.body.vertices, triangles: file.body.indices, normals: file.body.normals, coords: file.body.uvMaps[0].uv });
LS.RM.registerResource( "test.ctm", mesh );
console.log("Mesh registered");
return mesh;
}
}
LS.Network.requestScript("js/plugins/extra/lzma.js");
LS.Network.requestScript("js/plugins/extra/ctm.js");
LS.Formats.addSupportedFormat( "ctm", CTMParser );