Changed exporters, converters and example models to use more proper JSON.

Single quote property names and hex numbers are not valid in JSON.
This commit is contained in:
alteredq
2011-03-26 06:05:46 +01:00
parent 633276ddd8
commit b31b8eebcd
19 changed files with 373 additions and 202 deletions
+10 -12
View File
@@ -13,10 +13,10 @@
var model = {
'version' : 2,
"version" : 2,
'materials': [ {
"DbgColor" : 0xeeeeee,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Material",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -28,20 +28,18 @@ var model = {
"vertexColors" : false
}],
'vertices': [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
"vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
'morphTargets': [],
"morphTargets": [],
'normals': [],
"normals": [],
'colors': [],
"colors": [],
'uvs': [[]],
"uvs": [[]],
'faces': [3,0,1,2,3,0,3,4,7,6,5,0,3,0,4,5,1,0,3,1,5,6,2,0,3,2,6,7,3,0,3,4,0,3,7,0],
"faces": [3,0,1,2,3,0,3,4,7,6,5,0,3,0,4,5,1,0,3,1,5,6,2,0,3,2,6,7,3,0,3,4,0,3,7,0]
'end': (new Date).getTime()
}
};
postMessage( model );
File diff suppressed because one or more lines are too long
+10 -12
View File
@@ -13,10 +13,10 @@
var model = {
'version' : 2,
"version" : 2,
'materials': [ {
"DbgColor" : 0xeeeeee,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Material.001",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -28,20 +28,18 @@ var model = {
"vertexColors" : false
}],
'vertices': [1.000000,-0.000000,-1.000000,1.000000,0.000000,1.000000,-1.000000,0.000000,1.000000,-1.000000,-0.000000,-1.000000],
"vertices": [1.000000,-0.000000,-1.000000,1.000000,0.000000,1.000000,-1.000000,0.000000,1.000000,-1.000000,-0.000000,-1.000000],
'morphTargets': [],
"morphTargets": [],
'normals': [],
"normals": [],
'colors': [],
"colors": [],
'uvs': [[]],
"uvs": [[]],
'faces': [3,0,3,2,1,0],
"faces": [3,0,3,2,1,0]
'end': (new Date).getTime()
}
};
postMessage( model );
+112 -31
View File
@@ -13,272 +13,353 @@ var scene = {
{
"Cube.006" : {
"geometry" : "geo_Cube",
"groups" : [ ],
"materials" : [ "Material" ],
"position" : [ 10.623673, 3.370784, -0.321692 ],
"rotation" : [ 0.005265, -0.056306, 4.717181 ],
"quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
"scale" : [ 8.310000, 4.930000, 0.120000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.018" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ 1.702659, 0.680278, 5.860421 ],
"rotation" : [ 1.413516, 0.081378, -3.204182 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 0.435837, 0.435837, 0.435837 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.017" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ 0.081295, 0.639505, 5.808783 ],
"rotation" : [ 1.413516, 0.081378, -3.204182 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 0.435837, 0.435837, 0.435837 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.016" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -1.569030, 0.619385, 5.747240 ],
"rotation" : [ 1.413516, 0.081378, -3.204182 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 0.435837, 0.435837, 0.435837 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.015" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -3.129120, 0.552267, 5.709269 ],
"rotation" : [ 1.413516, 0.081378, -3.204182 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 0.435837, 0.435837, 0.435837 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.014" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -6.386331, 0.382167, 3.004400 ],
"rotation" : [ 1.646237, -0.058425, -1.670593 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 0.435837, 0.435837, 0.435837 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.013" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -6.499331, 0.471640, 1.593073 ],
"rotation" : [ 1.646237, -0.058425, -1.670593 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 0.435837, 0.435837, 0.435837 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.012" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -6.629794, 0.533840, 0.234131 ],
"rotation" : [ 1.646237, -0.058425, -1.670593 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 0.435837, 0.435837, 0.435837 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.011" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -6.713673, 0.629835, -1.008146 ],
"rotation" : [ 1.646237, -0.058425, -1.670593 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 0.435837, 0.435837, 0.435837 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.010" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -2.010442, 1.387332, 24.343616 ],
"rotation" : [ 1.520470, 0.191726, -3.004622 ],
"quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
"scale" : [ 9.160007, 9.160007, 9.160008 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.009" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -4.292194, 1.826282, -7.975398 ],
"rotation" : [ 1.594819, 0.080713, -0.213986 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.008" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ 2.151757, 1.891882, -8.065320 ],
"rotation" : [ 1.594819, 0.080713, -0.213986 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.007" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -0.712512, 2.115002, -8.097841 ],
"rotation" : [ 1.594819, 0.080713, -0.213986 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Cube.005" : {
"geometry" : "geo_Cube",
"groups" : [ ],
"materials" : [ "Material" ],
"position" : [ -1.000975, 1.319482, -8.755547 ],
"rotation" : [ 0.000000, 0.000000, -0.000000 ],
"quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
"scale" : [ 6.130000, 1.690000, 0.070000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Cube.004" : {
"geometry" : "geo_Cube",
"groups" : [ ],
"materials" : [ "Material" ],
"position" : [ 2.484517, 2.724846, 7.486932 ],
"rotation" : [ 0.220417, -0.075224, 0.181029 ],
"quaternion": [ 0.988791, 0.112836, 0.027288, -0.093898 ],
"scale" : [ 0.350000, 3.310000, 0.890000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.006" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ 7.724935, 1.694883, -7.123103 ],
"rotation" : [ 1.835590, 0.083161, -2.048913 ],
"quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.005" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -6.334642, 0.566791, -6.636147 ],
"rotation" : [ 1.327136, -0.032561, -4.135900 ],
"quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.004" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -5.384042, 0.444915, 6.194087 ],
"rotation" : [ 0.991213, 0.181430, -5.246078 ],
"quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.003" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ 3.147747, 1.014840, 4.230884 ],
"rotation" : [ 1.719311, -0.307044, -3.355401 ],
"quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.002" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -2.668043, 3.008879, 2.153389 ],
"rotation" : [ 1.881970, 0.457870, 4.066133 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Cube.003" : {
"geometry" : "geo_Cube",
"groups" : [ ],
"materials" : [ "Material" ],
"position" : [ -3.031251, 0.702044, 1.943665 ],
"rotation" : [ -1.300741, -1.330343, 3.282723 ],
"quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
"scale" : [ 1.781142, 0.231142, 0.361142 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey.001" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ 1.245307, 0.620196, -0.137285 ],
"rotation" : [ 2.339869, -0.286025, -1.394760 ],
"quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Monkey" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"materials" : [ "Material.002" ],
"position" : [ -0.282500, 1.813606, -4.272932 ],
"rotation" : [ 0.646062, -0.219349, -0.010569 ],
"quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Cube.002" : {
"geometry" : "geo_Cube",
"groups" : [ ],
"materials" : [ "Material" ],
"position" : [ 0.042212, 5.536832, -0.199037 ],
"rotation" : [ 0.000000, 0.000000, -0.000000 ],
"quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Cube.001" : {
"geometry" : "geo_Cube",
"groups" : [ ],
"materials" : [ "Material" ],
"position" : [ -0.395497, 1.009696, -3.944532 ],
"rotation" : [ 0.000000, 0.000000, -0.000000 ],
"quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Plane" : {
"geometry" : "geo_Plane",
"groups" : [ ],
"materials" : [ "Material.001" ],
"position" : [ 0.000000, 0.000000, 0.118260 ],
"rotation" : [ 0.000000, 0.000000, -0.000000 ],
"quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
"scale" : [ 7.922787, 7.922787, 7.922787 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
},
"Cube" : {
"geometry" : "geo_Cube",
"groups" : [ ],
"materials" : [ "Material" ],
"position" : [ 3.651978, 1.071144, 0.000000 ],
"rotation" : [ 0.220417, -0.075224, 0.181029 ],
"quaternion": [ 0.988791, 0.112836, 0.027288, -0.093898 ],
"scale" : [ 1.000000, 1.000000, 1.000000 ],
"visible" : true
"visible" : true,
"castsShadow" : false,
"meshCollider" : false
}
},
@@ -306,17 +387,17 @@ var scene = {
{
"Material" : {
"type": "MeshPhongMaterial",
"parameters": { color: 0xa31920, opacity: 1.00, ambient: 0x000000, specular: 0x7f7f7f, shininess: 50.0 }
"parameters": { color: 10688800, opacity: 1.00, ambient: 0, specular: 8355711, shininess: 50.0 }
},
"Material.001" : {
"type": "MeshPhongMaterial",
"parameters": { color: 0x24a33e, opacity: 1.00, ambient: 0x000000, specular: 0x7f7f7f, shininess: 50.0 }
"parameters": { color: 2401086, opacity: 1.00, ambient: 0, specular: 8355711, shininess: 50.0 }
},
"Material.002" : {
"type": "MeshPhongMaterial",
"parameters": { color: 0xa37024, opacity: 1.00, ambient: 0x000000, specular: 0x7f7f7f, shininess: 50.0 }
"parameters": { color: 10711076, opacity: 1.00, ambient: 0, specular: 8355711, shininess: 50.0 }
}
},
@@ -340,7 +421,7 @@ var scene = {
"default_light": {
"type" : "directional",
"direction" : [ 0.000000, 1.000000, 1.000000 ],
"color" : 0xffffff,
"color" : 16777215,
"intensity" : 0.80
}
},
Binary file not shown.
+13 -15
View File
@@ -4,7 +4,7 @@
*
* vertices: 8
* faces: 6
* normals: 8
* normals: 0
* uvs: 0
* colors: 22
* materials: 1
@@ -13,35 +13,33 @@
var model = {
'version' : 2,
"version" : 2,
'materials': [ {
"DbgColor" : 0xeeeeee,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Material",
"colorAmbient" : [0.0, 0.0, 0.0],
"colorDiffuse" : [1, 1, 1],
"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorSpecular" : [0.5, 0.5, 0.5],
"shading" : "Basic",
"shading" : "Phong",
"specularCoef" : 50,
"transparency" : 1.0,
"vertexColors" : true
}],
'vertices': [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000000,-1.000000,1.000000,0.999999,-1.000000,1.000000,-1.000000],
"vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000000,-1.000000,1.000000,0.999999,-1.000000,1.000000,-1.000000],
'morphTargets': [],
"morphTargets": [],
'normals': [0.577349,-0.577349,-0.577349,0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,-0.577349,0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,0.577349,0.577349,0.577349,0.577349],
"normals": [],
'colors': [0xffffff,0xffe18d,0xffe190,0x80fff7,0xe7df1b,0x6f62ff,0xfd17db,0xff0007,0x101d0e,0x5c00a3,0xd1ffb4,0x8a0079,0x797eed,0x6758ff,0xfff5de,0x3f3cff,0xb6b4ff,0x1dffef,0x101e1d,0x8a9190,0xd0ffaf,0x4c5555],
"colors": [16777215,16769421,16769424,8454135,15195931,7299839,16586715,16711687,1056014,6029475,13762484,9044089,7962349,6772991,16774622,4144383,11973887,1966063,1056285,9081232,13696943,5002581],
'uvs': [[]],
"uvs": [[]],
'faces': [163,0,1,2,3,0,0,1,2,3,0,1,2,3,163,4,7,6,5,0,4,5,6,7,4,5,6,7,163,0,4,5,1,0,0,4,7,1,0,8,9,10,163,1,5,6,2,0,1,7,6,2,0,11,12,13,163,2,6,7,3,0,2,6,5,3,14,15,16,17,163,4,0,3,7,0,4,0,3,5,18,19,20,21],
"faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21]
'end': (new Date).getTime()
}
};
postMessage( model );
File diff suppressed because one or more lines are too long
+9 -11
View File
@@ -9,10 +9,10 @@
var model = {
'version' : 1,
"version" : 1,
'materials': [ {
"DbgColor" : 0xeeeeee,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "_03_-_Default1noCulli__03_-_Default1noCulli",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -26,7 +26,7 @@ var model = {
},
{
"DbgColor" : 0xee0000,
"DbgColor" : 15597568,
"DbgIndex" : 1,
"DbgName" : "_02_-_Default1noCulli__02_-_Default1noCulli",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -40,7 +40,7 @@ var model = {
},
{
"DbgColor" : 0x00ee00,
"DbgColor" : 60928,
"DbgIndex" : 2,
"DbgName" : "FrontColorNoCullingID__02_-_Default1noCulli",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -54,7 +54,7 @@ var model = {
},
{
"DbgColor" : 0x0000ee,
"DbgColor" : 238,
"DbgIndex" : 3,
"DbgName" : "FrontColorNoCullingID__03_-_Default1noCulli",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -68,7 +68,7 @@ var model = {
},
{
"DbgColor" : 0xeeee00,
"DbgColor" : 15658496,
"DbgIndex" : 4,
"DbgName" : "_01_-_Default1noCulli__01_-_Default1noCulli",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -82,7 +82,7 @@ var model = {
},
{
"DbgColor" : 0x00eeee,
"DbgColor" : 61166,
"DbgIndex" : 5,
"DbgName" : "FrontColorNoCullingID__01_-_Default1noCulli",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -95,10 +95,8 @@ var model = {
"transparency" : 1.0
}],
'buffers': 'Female02_bin.bin',
"buffers": "Female02_bin.bin"
'end': (new Date).getTime()
};
postMessage( model );
File diff suppressed because one or more lines are too long
+4 -6
View File
@@ -9,18 +9,16 @@
var model = {
'version' : 1,
"version" : 1,
'materials': [ {
"DbgColor" : 0xeeeeee,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "default"
}],
'buffers': 'Lucy100k_bin.bin',
"buffers": "Lucy100k_bin.bin"
'end': (new Date).getTime()
};
postMessage( model );
File diff suppressed because one or more lines are too long
+8 -10
View File
@@ -9,10 +9,10 @@
var model = {
'version' : 1,
"version" : 1,
'materials': [ {
"DbgColor" : 0xeeeeee,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "male-02-1noCullingID_male-02-1noCulling.JP",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -26,7 +26,7 @@ var model = {
},
{
"DbgColor" : 0xee0000,
"DbgColor" : 15597568,
"DbgIndex" : 1,
"DbgName" : "orig_02_-_Defaul1noCu_orig_02_-_Defaul1noCu",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -40,7 +40,7 @@ var model = {
},
{
"DbgColor" : 0x00ee00,
"DbgColor" : 60928,
"DbgIndex" : 2,
"DbgName" : "FrontColorNoCullingID_orig_02_-_Defaul1noCu",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -54,7 +54,7 @@ var model = {
},
{
"DbgColor" : 0x0000ee,
"DbgColor" : 238,
"DbgIndex" : 3,
"DbgName" : "_01_-_Default1noCulli__01_-_Default1noCulli",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -68,7 +68,7 @@ var model = {
},
{
"DbgColor" : 0xeeee00,
"DbgColor" : 15658496,
"DbgIndex" : 4,
"DbgName" : "FrontColorNoCullingID_male-02-1noCulling.JP",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -81,10 +81,8 @@ var model = {
"transparency" : 1.0
}],
'buffers': 'Male02_bin.bin',
"buffers": "Male02_bin.bin"
'end': (new Date).getTime()
};
postMessage( model );
File diff suppressed because one or more lines are too long
+4 -6
View File
@@ -9,18 +9,16 @@
var model = {
'version' : 1,
"version" : 1,
'materials': [ {
"DbgColor" : 0xeeeeee,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "default"
}],
'buffers': 'NinjaLo_bin.bin',
"buffers": "NinjaLo_bin.bin"
'end': (new Date).getTime()
};
postMessage( model );
+4 -6
View File
@@ -9,18 +9,16 @@
var model = {
'version' : 1,
"version" : 1,
'materials': [ {
"DbgColor" : 0xeeeeee,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "(null)"
}],
'buffers': 'Torus_bin.bin',
"buffers": "Torus_bin.bin"
'end': (new Date).getTime()
};
postMessage( model );
File diff suppressed because one or more lines are too long
+4 -6
View File
@@ -9,10 +9,10 @@
var model = {
'version' : 1,
"version" : 1,
'materials': [ {
"DbgColor" : 0xeeeeee,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "lambert2SG.001",
"colorAmbient" : [0.0, 0.0, 0.0],
@@ -24,10 +24,8 @@ var model = {
"transparency" : 1.0
}],
'buffers': 'WaltHead_bin.bin',
"buffers": "WaltHead_bin.bin"
'end': (new Date).getTime()
};
postMessage( model );
File diff suppressed because one or more lines are too long
@@ -0,0 +1,120 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# Based on import_obj.py
# Contributors: alteredq
"""
Blender importer for Three.js (ASCII JSON format).
"""
import os
import time
import json
import bpy
import mathutils
from mathutils.geometry import tesselate_polygon
from io_utils import load_image, unpack_list, unpack_face_list
# #####################################################
# Utils
# #####################################################
def splitArray(data, chunkSize):
result = []
chunk = []
for i in range(len(data)):
if i > 0 and i % chunkSize == 0:
result.append(chunk)
chunk = []
chunk.append(data[i])
result.append(chunk)
return result
def extract_json_string(text):
marker_begin = "var model ="
marker_end = "postMessage"
start = text.find(marker_begin) + len(marker_begin)
end = text.find(marker_end)
end = text.rfind("}", start, end)
return text[start:end+1].strip()
# #####################################################
# Parser
# #####################################################
def load(operator, context, filepath):
print('\nimporting %r' % filepath)
time_main = time.time()
verts_loc = []
verts_tex = []
faces = []
materials = []
print("\tparsing JSON file...")
time_sub = time.time()
file = open(filepath, 'rU')
rawcontent = file.read()
file.close()
json_string = extract_json_string(rawcontent)
data = json.loads( json_string )
time_new = time.time()
print('parsing %.4f sec' % (time_new - time_sub))
time_sub = time_new
verts_loc = splitArray(data["vertices"], 3)
verts_loc[:] = [(v[0], v[2], -v[1]) for v in verts_loc]
# deselect all
bpy.ops.object.select_all(action='DESELECT')
scene = context.scene
new_objects = []
print('\tbuilding geometry...\n\tverts:%i faces:%i materials: %i ...' % ( len(verts_loc), len(faces), len(materials) ))
# Create new obj
for obj in new_objects:
base = scene.objects.link(obj)
base.select = True
scene.update()
time_new = time.time()
print('finished importing: %r in %.4f sec.' % (filepath, (time_new - time_main)))
return {'FINISHED'}
if __name__ == "__main__":
register()