mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
101.9k stars 35.32k forks source link

shadow for skeletal animation #969

Closed weitmLzu closed 12 years ago

weitmLzu commented 12 years ago

I use Skeletal animation in my scene and I want to add shadow to the animated mesh, but I fail. When I examine the code, it seems that only "_depthMaterialMorph" is provided(in WebGLRenderer.js line:130), can you provide shadow for Skeletal animation?

alteredq commented 12 years ago

Did you actually create some pipeline for generating skeletal animations?

We don't have a proper asset pipeline yet for skinning, so not much effort went into skeletal animation rendering.

weitmLzu commented 12 years ago

I have write a converter(using c++) which can translate the Meshes and Skeletons of OGRE into Json, it is very pool and it has very much bugs so i haven't shown it up.

weitmLzu commented 12 years ago

/* 将OGRE的mesh、skeleton格式转成json的model格式,使用自己开发的小工具 ,created by weitm*/

var model = {

"version" : 2,

"scale" : 0.4,

"materials": [ { "DbgColor" : 15658734, "DbgIndex" : 0, "DbgName" : "Examples/Robot", //"colorAmbient" : [0.0, 0.0, 0.0], //"colorDiffuse" : [0.5332959254577148, 0.00743219341981699, 0.00743219341981699], //"colorSpecular" : [0.5, 0.5, 0.5], "shading" : "Lambert", "mapDiffuse" : "r2skin.jpg", //"specularCoef" : 50, //"transparency" : 1.0, //"vertexColors" : false skinning: true }],

"vertices": [14.8357,42.0759,21.8862,17.0135,43.2254,14.0466,18.0914,44.6956,16.6812,11.9976,38.2315,15.1363,14.406,40.3656,12.7177,12.2942,39.2978,20.6468,11.3457,37.9718,18.0936,17.3378,44.3512,19.7785,17.0135,43.2254,14.0466,3.80786,55.6896,12.5024,4.88578,57.1597,15.1371,18.0914,44.6956,16.6812,11.9976,38.2315,15.1363,-1.20805,50.6956,13.5921,1.2004,52.8298,11.1735,14.406,40.3656,12.7177,14.8357,42.0759,21.8862,1.6301,54.5401,20.342,-0.911454,51.762,19.1026,12.2942,39.2978,20.6468,-1.85999,50.436,16.5495,11.3457,37.9718,18.0936,3.80786,55.6896,12.5024,17.0135,43.2254,14.0466,4.13221,56.8153,18.2343,17.3378,44.3512,19.7785,2.0307,62.3005,10.6728,4.34732,66.8746,13.5109,3.0029,63.4569,15.3651,-0.498331,69.4109,15.6442,-1.86,65.9947,16.6507,-3.23167,69.7181,13.2925,-4.57609,66.3003,15.1468,-4.97438,65.5376,10.6563,-0.84319,59.0603,12.3926,-0.63118,59.7802,16.0353,-3.85389,56.7786,18.2345,-5.48546,54.4456,13.4525,2.0307,62.3005,10.6728,-0.84319,59.0603,12.3926,-5.5049,54.9159,17.0084,2.78917,58.082,12.0632,3.12559,59.2372,17.9181,-0.186709,56.1652,20.2717,-3.80299,51.5258,13.5472,-0.608647,54.4332,10.8908,2.78917,58.082,12.0632,-3.49958,52.6157,19.1772,4.88578,57.1597,15.1371,4.13221,56.8153,18.2343,1.6301,54.5401,20.342,-1.20805,50.6956,13.5921,1.2004,52.8298,11.1735,-0.911454,51.762,19.1026,-1.85999,50.436,16.5495,3.80786,55.6896,12.5024,3.80786,55.6896,12.5024,-2.86061,97.3814,0.116986,-3.59818,72.7662,0.0838234,-3.22902,72.7108,1.13247,-2.45101,74.2176,0.063361,10.5221,-0.291216,5.38113,10.5912,2.165,5.53413,10.7761,2.16506,13.463,10.7792,-0.290295,13.7662,1.93663,-0.0818529,4.40616,4.06331,5.07529,4.55913,4.24824,5.08014,12.488,2.19373,-0.0763126,14.9037,2.19373,-0.0763126,14.9037,-8.67494,0.0298744,14.0276,1.93663,-0.0818529,4.40616,-8.66393,0.0297176,5.38257,1.19402,23.3676,9.62502,1.11969,47.2402,6.1743,-1.7109,48.6459,4.32465,7.02796,25.087,9.40758,7.02796,25.087,9.40758,4.16527,42.261,0.79029,3.9574,44.9761,3.48228,6.91512,25.0826,4.7121,1.19402,23.3676,9.62502,-1.7109,48.6459,4.32465,-3.5207,43.7374,2.56869,-2.19283,41.1163,0.81273,1.19889,23.3633,5.21067,1.19889,23.3633,5.21067,-2.19283,41.1163,0.81273,4.16527,42.261,0.79029,6.91512,25.0826,4.7121,6.39906,21.5114,10.0723,6.90836,23.0191,7.39221,6.2862,21.5104,4.71207,6.39906,21.5114,10.0723,6.2862,21.5104,4.71207,2.19373,-0.0763126,14.9037,4.24824,5.08014,12.488,2.19373,-0.0763126,14.9037,-8.67494,0.0298744,14.0276,4.06331,5.07529,4.55913,-8.67494,0.0298744,14.0276,-8.66393,0.0297176,5.38257,-8.66393,0.0297176,5.38257,4.06331,5.07529,4.55913,1.93663,-0.0818529,4.40616,5.78779,77.4734,1.78729,2.43373,72.1676,3.96252,5.15296,68.4403,-0.11256,6.32887,76.7688,-0.120155,1.99085,80.9392,-0.0137138,2.39304,80.6153,1.93137,-2.45101,74.2176,0.063361,-2.79196,72.9306,4.20041,-2.79196,72.9306,4.20041,2.43373,72.1676,3.96252,-0.498331,69.4109,15.6442,2.43373,72.1676,3.96252,-2.79196,72.9306,4.20041,4.34732,66.8746,13.5109,6.29736,51.9622,-0.01581,4.16527,42.261,0.79029,3.92966,41.901,-0.01581,4.54635,51.864,5.41527,3.36801,57.0851,7.17027,6.93863,57.6293,-0.01581,7.01393,58.4114,5.22027,7.86798,58.7238,1.32027,7.24214,66.2263,0.992165,5.59586,67.3195,10.789,5.15296,68.4403,-0.11256,2.0307,62.3005,10.6728,3.9574,44.9761,3.48228,1.11969,47.2402,6.1743,-2.71425,52.0185,2.73633,4.54635,51.864,5.41527,3.36801,57.0851,7.17027,-1.11333,56.2907,4.6515,2.0307,62.3005,10.6728,-4.97438,65.5376,10.6563,-2.79196,72.9306,4.20041,-3.23167,69.7181,13.2925,-0.498331,69.4109,15.6442,1.11969,47.2402,6.1743,-1.7109,48.6459,4.32465,-3.5207,43.7374,2.56869,-2.65782,51.8402,-0.01581,-2.42347,42.3851,-0.01581,3.92966,41.901,-0.01581,4.16527,42.261,0.79029,-2.19283,41.1163,0.81273,-2.04438,56.5571,-0.01581,-6.53533,63.0166,-0.01581,-3.22902,72.7108,1.13247,-3.69578,70.6392,0.0816457,-3.59818,72.7662,0.0838234,-2.45101,74.2176,0.063361,1.11969,47.2402,6.1743,18.861,45.8477,-18.2451,18.0772,44.3099,-15.5459,15.3881,43.0408,-23.2063,15.7575,41.2931,-14.0422,13.3085,39.0186,-16.2858,12.4522,38.7239,-19.1872,13.1223,40.1096,-21.7963,17.8982,45.4624,-21.2789,5.0715,57.4735,-15.6342,4.28765,55.9358,-12.935,18.0772,44.3099,-15.5459,18.861,45.8477,-18.2451,1.96796,52.919,-11.4313,-0.48106,50.6445,-13.6749,13.3085,39.0186,-16.2858,15.7575,41.2931,-14.0422,-0.667288,51.7356,-19.1854,1.59856,54.6667,-20.5954,15.3881,43.0408,-23.2063,13.1223,40.1096,-21.7963,-1.33735,50.3498,-16.5764,12.4522,38.7239,-19.1872,4.28765,55.9358,-12.935,18.0772,44.3099,-15.5459,4.1087,57.0882,-18.668,17.8982,45.4624,-21.2789,2.65018,63.6382,-15.4945,3.8568,67.1272,-13.6786,1.59524,62.3424,-10.7658,-1.21806,69.3664,-15.6011,-2.40748,65.8757,-16.5693,-3.86714,69.4987,-13.1392,-5.07376,66.0096,-14.9552,-5.40313,65.5788,-10.4523,-0.539444,59.0139,-12.4547,-0.647587,59.7511,-16.0984,-3.83734,56.5603,-18.0673,1.59524,62.3424,-10.7658,-4.95725,54.124,-13.1905,-0.539444,59.0139,-12.4547,-5.27391,54.5977,-16.7319,3.16048,58.2604,-12.4057,2.98245,59.4431,-18.262,-0.303823,56.1768,-20.3785,-3.11115,51.3134,-13.4296,3.16048,58.2604,-12.4057,0.0906706,54.4077,-11.0034,-3.30105,52.4286,-19.0596,5.0715,57.4735,-15.6342,4.1087,57.0882,-18.668,1.59856,54.6667,-20.5954,-0.48106,50.6445,-13.6749,1.96796,52.919,-11.4313,-0.667288,51.7356,-19.1854,-1.33735,50.3498,-16.5764,4.28765,55.9358,-12.935,4.28765,55.9358,-12.935,-3.27191,72.715,-0.979184,10.207,2.32556,-13.4947,10.022,2.32733,-5.56578,9.92877,-0.128092,-5.41278,10.1858,-0.129706,-13.7978,1.8333,5.41735,-4.59075,1.34574,0.165919,-4.43781,2.01742,5.39933,-12.5197,1.60289,0.168924,-14.9353,1.34574,0.165919,-4.43781,-9.2642,0.382277,-14.0593,1.60289,0.168924,-14.9353,-9.2532,0.382012,-5.41419,-1.68598,47.9161,-4.3563,2.18891,47.4802,-6.20595,1.24511,23.9239,-9.65667,7.24674,24.9097,-9.4392,4.38983,44.5932,-3.51393,3.9303,41.9093,-0.82194,7.24674,24.9097,-9.4392,7.13422,24.9193,-4.74375,-3.16478,45.2129,-2.60034,-1.68598,47.9161,-4.3563,1.24511,23.9239,-9.65667,1.24942,23.9191,-5.24232,-2.51517,42.3474,-0.84438,3.9303,41.9093,-0.82194,-2.51517,42.3474,-0.84438,1.24942,23.9191,-5.24232,7.13422,24.9193,-4.74375,6.18106,21.4391,-10.104,6.87267,22.8724,-7.42386,6.18106,21.4391,-10.104,6.06895,21.4521,-4.74372,6.06895,21.4521,-4.74372,2.01742,5.39933,-12.5197,1.60289,0.168924,-14.9353,-9.2642,0.382277,-14.0593,1.60289,0.168924,-14.9353,1.8333,5.41735,-4.59075,-9.2642,0.382277,-14.0593,-9.2532,0.382012,-5.41419,-9.2532,0.382012,-5.41419,1.8333,5.41735,-4.59075,1.34574,0.165919,-4.43781,2.27121,72.1832,-4.03895,5.71125,77.4807,-1.98098,2.3137,80.6229,-1.97481,-2.95977,72.9468,-4.06146,-2.95977,72.9468,-4.06146,2.27121,72.1832,-4.03895,-2.95977,72.9468,-4.06146,2.27121,72.1832,-4.03895,-1.21806,69.3664,-15.6011,3.8568,67.1272,-13.6786,3.9303,41.9093,-0.82194,4.54635,51.864,-5.44692,3.36801,57.0851,-7.20192,7.01393,58.4114,-5.25192,7.86798,58.7238,-1.35192,5.15314,67.3621,-11.0071,7.19579,66.2308,-1.28955,1.59524,62.3424,-10.7658,2.18891,47.4802,-6.20595,4.38983,44.5932,-3.51393,3.36801,57.0851,-7.20192,4.54635,51.864,-5.44692,-2.71425,52.0185,-2.76798,-1.11333,56.2907,-4.68315,1.59524,62.3424,-10.7658,-5.40313,65.5788,-10.4523,-1.21806,69.3664,-15.6011,-3.86714,69.4987,-13.1392,-2.95977,72.9468,-4.06146,2.18891,47.4802,-6.20595,-1.68598,47.9161,-4.3563,-3.16478,45.2129,-2.60034,3.9303,41.9093,-0.82194,-2.51517,42.3474,-0.84438,-3.27191,72.715,-0.979184,2.18891,47.4802,-6.20595],

"morphTargets": [],

"normals":[0.712716,-0.694832,0.0961511,0.71281,-0.694736,0.0961433,0.71276,-0.694789,0.0961335,0.712609,-0.694938,0.0961762,0.712701,-0.694839,0.0962119,0.712682,-0.694872,0.0961156,0.712686,-0.694868,0.0961079,0.712775,-0.694771,0.096152,0.601303,0.567371,-0.562606,0.601303,0.567371,-0.562605,0.669782,0.66995,-0.320248,0.687975,0.725079,-0.0308413,-0.490588,-0.598266,-0.633562,-0.593689,-0.681934,-0.427199,-0.167692,-0.294239,-0.940905,0.0731483,-0.045928,-0.996263,-0.0848216,0.0335073,0.995833,0.128702,0.255086,0.958315,-0.407973,-0.326616,0.852573,-0.52765,-0.4715,0.706593,-0.672375,-0.674638,0.304589,-0.688339,-0.724247,0.0406866,0.281357,0.181349,-0.942311,0.281355,0.181348,-0.942312,0.575978,0.668526,0.470449,0.455479,0.567549,0.685877,0.840443,-0.54035,-0.0409673,0.880953,-0.0950342,0.463562,0.742879,-0.30517,0.59582,0.0998127,0.31749,0.942994,-0.050213,0.256753,0.965172,-0.676197,0.497531,0.543342,-0.775556,0.324001,0.54179,-0.956215,0.0860612,-0.279726,0.971722,-0.229253,-0.0565611,0.518754,0.566117,0.640629,-0.30461,0.346831,0.887086,-0.606923,-0.577238,-0.546297,0.330794,-0.579974,-0.74445,-0.0678094,-0.11341,-0.991232,-0.876857,-0.0315089,0.479717,0.523374,0.799851,-0.293799,0.354367,0.825457,0.439369,-0.139327,0.271016,0.952438,-0.630631,-0.584578,-0.510464,-0.228468,-0.114031,-0.96685,0.227775,0.144273,-0.962966,-0.590999,-0.499901,0.633103,0.84148,0.51882,-0.15079,0.575114,0.391558,0.71828,0.0306414,-0.0258718,0.999196,-0.286417,-0.724193,-0.627304,0.123935,-0.148682,-0.981088,-0.179703,-0.612012,0.770161,-0.435481,-0.879159,0.193481,0.436043,0.0205102,-0.899692,0.831793,0.264603,-0.48796,-0.967061,0.253742,0.0201956,-0.999345,0.0299169,0.0203611,-0.150871,0.0429052,0.987622,0.999638,0.0177235,-0.0202627,0.707195,-0.309738,-0.635561,0.684162,0.638157,-0.353098,0.745452,0.407237,0.527693,0.45703,-0.793042,0.402751,0.0281035,-0.897011,-0.441114,0.29997,0.412268,-0.860264,0.337936,0.874072,0.348994,0.0790396,-0.239584,0.967653,-0.00983149,-0.999951,0.000768539,-0.0101777,-0.999948,0.00038664,-0.0101777,-0.999948,0.00038664,-0.0105239,-0.999945,4.74128e-006,-0.123516,0.181028,0.975691,-0.261136,0.1373,0.955488,-0.499592,0.122404,0.857569,-0.0117152,0.16448,0.986311,0.989756,0.0810621,0.117524,0.988719,0.143834,-0.0417969,0.935855,0.225222,0.271017,0.998043,-0.0180638,-0.0598673,-0.99385,-0.0137631,0.10988,-0.760171,0.0484976,0.647911,-0.962913,-0.143784,0.228307,-0.960972,-0.246107,-0.126349,-0.978821,0.204716,-0.00120519,-0.0396908,-0.104228,-0.993761,0.0385805,-0.233331,-0.971632,0.0106727,-0.229338,-0.973288,-0.0549144,-0.105354,-0.992917,-0.0118725,0.202667,0.979176,0.983538,-0.179746,-0.0185723,0.973756,-0.220304,-0.0571455,0.97646,-0.162886,0.1414,-0.083555,0.0215248,-0.996271,0.768611,-0.00656471,0.639682,0.94108,-0.0746944,0.329831,-0.0409955,0.217814,0.975129,-0.0763523,0.215922,0.973421,0.990813,-0.133448,-0.0219326,-0.921113,0.389294,-0.00128704,-0.921098,0.389329,-0.00117993,-0.0832769,0.0384565,-0.995784,-0.0814665,0.042989,-0.995749,-0.0908169,0.0669231,-0.993616,0.821948,0.339949,0.456985,0.72768,-0.189772,0.659142,0.981444,-0.190515,-0.021709,0.940061,0.340464,-0.0192066,-0.0882032,0.996095,0.00384116,0.0866345,0.636919,0.766047,-0.834062,0.551377,0.0180199,-0.829357,0.549236,0.102503,-0.421205,0.506371,0.752446,0.164966,0.231323,0.958789,0.357234,0.885027,0.298515,0.571144,0.798811,0.188933,0.151118,0.952941,0.262807,0.793856,0.447196,0.412078,0.993856,-0.108072,-0.0238745,0.975349,-0.187837,0.115811,0.96939,-0.228125,-0.090785,0.894489,-0.128036,0.428365,0.802558,-0.366385,0.470811,0.904853,-0.425714,-0.00285976,0.715661,-0.53752,0.445984,0.986576,-0.159293,-0.0359618,0.890043,0.339978,-0.303707,0.922432,0.1161,0.368293,0.867517,0.496996,-0.0202416,0.639742,-0.458092,0.617156,0.807966,-0.22223,0.545714,0.540615,-0.269839,0.79682,-0.719513,0.101659,0.686998,-0.346064,0.0048041,0.938198,-0.369947,-0.396033,0.840415,-0.794839,-0.343124,0.500496,-0.298552,-0.593029,0.747786,-0.847145,-0.310564,0.431157,-0.855971,0.498896,0.135707,-0.774235,0.610324,0.167527,-0.171361,0.9315,0.320846,-0.369917,0.328476,0.86906,-0.618822,0.176395,0.76547,-0.999106,0.0317206,0.0279335,-0.994667,0.102539,0.0110939,-0.514232,-0.857618,-0.00751156,-0.0742556,-0.974469,0.211886,0.0160994,-0.960058,-0.279337,-0.799241,-0.293465,-0.524492,-0.970996,-0.239094,5.59149e-007,-0.999827,-0.00983132,0.0158024,-0.95222,0.240833,0.187823,-0.98201,0.187736,0.0202864,-0.998742,0.0458078,0.02038,-0.862332,0.506004,0.0185048,0.770018,0.288426,0.569108,0.744659,-0.649482,-0.153808,0.744705,-0.649426,-0.153821,0.744617,-0.649527,-0.153821,0.744597,-0.649534,-0.153882,0.744514,-0.64964,-0.15384,0.744594,-0.649563,-0.153774,0.744592,-0.649565,-0.153778,0.744671,-0.649463,-0.153827,0.649779,0.709386,0.273055,0.606205,0.602414,0.519242,0.606205,0.602415,0.519242,0.642656,0.765976,-0.0165544,-0.0778302,-0.305446,0.949023,-0.51687,-0.71782,0.466455,-0.403795,-0.628286,0.664985,0.15085,-0.0428748,0.987626,-0.450426,-0.349778,-0.821445,0.0401072,0.263993,-0.96369,-0.161671,0.0297607,-0.986396,-0.549644,-0.501974,-0.667767,-0.650891,-0.714251,-0.257269,-0.643812,-0.765153,0.00677343,0.340083,0.196862,0.919559,0.340079,0.196858,0.919562,0.496797,0.703414,-0.508332,0.366781,0.595546,-0.7147,0.754151,-0.243876,-0.609738,0.877411,-0.0554154,-0.476529,0.882595,-0.464969,0.0694895,0.0417025,0.325529,-0.944612,-0.110412,0.257478,-0.959955,-0.714401,0.460225,-0.527091,-0.807911,0.274461,-0.52149,-0.953359,0.025178,0.300787,0.992021,-0.119177,0.0411202,0.442775,0.603279,-0.663329,-0.384625,0.325591,-0.863744,0.317328,-0.492157,0.810608,-0.532202,-0.577395,0.619174,-0.0145604,-0.0966263,0.995214,-0.899059,-0.0950672,-0.427382,0.494114,0.830077,0.258505,0.268975,0.846368,-0.459688,-0.227183,0.2634,-0.937554,-0.553308,-0.623048,0.552867,0.290582,0.15653,0.94396,-0.147398,-0.129357,0.980582,-0.605404,-0.534332,-0.589894,0.817119,0.569365,0.090223,0.494179,0.4273,-0.757101,-0.0433741,-0.0223985,-0.998808,-0.193358,-0.741405,0.642598,0.206533,-0.142285,0.968039,-0.199542,-0.620722,-0.758214,-0.394207,-0.903983,-0.165577,0.500667,0.0459091,0.864422,0.848502,0.314514,0.425588,-0.190844,0.0467557,-0.980506,0.737739,0.414412,-0.53292,0.650748,0.667379,0.362121,0.70085,-0.307825,0.64347,0.449187,-0.79751,-0.402751,0.262288,0.437085,0.860327,0.0200959,-0.894035,0.447546,0.29346,0.890337,-0.348111,0.0756232,-0.237116,-0.968534,-0.0200373,-0.999799,-0.000386641,-0.0200373,-0.999799,-0.000386641,-0.0196912,-0.999806,-0.000768538,-0.0203835,-0.999792,-4.74323e-006,-0.412399,0.148197,-0.898868,-0.205024,0.149899,-0.96721,-0.0910856,0.185077,-0.978494,0.0085348,0.165596,-0.986157,0.979118,0.173839,-0.105399,0.983471,0.125902,0.130127,0.998502,0.0154457,-0.052481,0.993977,-0.0915045,0.0603126,-0.944886,-0.0915365,-0.314344,-0.792233,0.0377657,-0.609048,-0.987367,0.00961025,-0.15816,-0.976846,0.213943,0.00113185,-0.978751,-0.204784,0.0104904,-0.0311218,-0.234121,0.971709,-0.0194103,-0.235839,0.971598,-0.0600873,-0.103293,0.992834,-0.0665017,-0.103419,0.992412,0.0129169,0.201948,-0.979311,0.953809,-0.299839,0.0185721,0.944691,-0.315076,0.0910331,0.939093,-0.338878,0.0571455,-0.0882707,0.0306133,0.995626,0.924656,-0.279049,0.25912,0.828753,-0.287443,0.48015,-0.0742719,0.215257,-0.973729,-0.0267211,0.216461,-0.975926,0.966747,-0.254794,0.0219325,-0.913224,0.407455,0.00125686,-0.913213,0.407481,0.00117504,-0.0889069,0.0339696,0.995461,-0.0899163,0.0352044,0.995327,-0.0909112,0.0374229,0.995156,0.699201,-0.185855,-0.690345,0.802054,0.34206,-0.489596,0.0555069,0.639917,-0.766437,-0.832791,0.549567,-0.066592,-0.451373,0.509276,-0.732735,0.125915,0.235083,-0.963785,0.140069,0.951455,-0.274069,0.565594,0.799487,-0.202296,0.318267,0.894499,-0.31397,0.779147,0.452479,-0.433812,0.990257,-0.134927,-0.0344256,0.94735,-0.0720646,-0.311984,0.803063,-0.358816,-0.475754,0.716023,-0.527162,-0.457615,0.989533,-0.141619,0.0277357,0.913638,0.119879,-0.388451,0.894998,0.350349,0.276107,0.622104,-0.445733,-0.643668,0.633155,-0.211573,-0.744548,0.94201,-0.105015,-0.318729,-0.367303,-0.403311,-0.838111,-0.34648,-0.021417,-0.937813,-0.718382,0.0775163,-0.691316,-0.797622,-0.348521,-0.492273,-0.308989,-0.60187,-0.736395,-0.859886,-0.31583,-0.401057,-0.25305,0.912532,-0.321327,-0.792894,0.594021,-0.135861,-0.866131,0.489649,-0.100301,-0.358741,0.285623,-0.888664,-0.615281,0.145726,-0.774722,-0.993992,0.0233291,-0.10694,-0.071971,-0.99718,0.0212719,-0.868201,-0.456303,0.194975,-0.959042,0.24149,-0.148056,0.864559,0.255711,-0.432609],

"colors": [],

"uvs": [[0.050098,0.570065,0.170913,0.672776,0.1713,0.612859,0.054521,0.730337,0.127602,0.73369,0.010778,0.635819,0.015247,0.69114,0.125753,0.574221,0.287285,0.752788,0.001604,0.752788,0.001628,0.780496,0.287308,0.780496,0.287283,0.927881,0.001602,0.92788,0.001604,0.960393,0.287285,0.960393,0.287349,0.842726,0.001669,0.842726,0.001652,0.877909,0.287332,0.877909,0.001627,0.903283,0.287308,0.903283,0.001604,0.994909,0.287285,0.994909,0.001652,0.807936,0.287332,0.807936,0.258955,0.00461298,0.267383,0.045482,0.30668,0.049369,0.267393,0.084796,0.309579,0.0835,0.267382,0.104315,0.307642,0.104315,0.267618,0.148836,0.342436,0.00951701,0.342468,0.044474,0.342479,0.079044,0.339546,0.136687,0.270508,0.197234,0.342436,0.190477,0.34343,0.105,0.372851,0.000918984,0.373846,0.045153,0.372894,0.071357,0.372849,0.131866,0.37285,0.159245,0.372851,0.188358,0.372883,0.100917,0.398529,0.024237,0.397582,0.045867,0.398556,0.07088,0.398512,0.13551,0.398513,0.159577,0.398545,0.097737,0.398528,0.117024,0.398513,0.184856,0.39755,0.00130397,0.963292,0.306494,0.932858,0.772911,0.956543,0.773286,1.00048,0.743385,0.485772,0.088112,0.48667,0.108065,0.492188,0.00554699,0.491704,0.00286198,0.698639,0.088999,0.699537,0.109599,0.695899,0.021933,0.695414,0.000535011,0.875767,0.084525,0.997464,0.084502,0.875516,-0.000314951,0.997341,-6.19888e-005,0.930039,0.387235,0.870209,0.682424,0.912072,0.681535,0.867292,0.405064,0.794213,0.370222,0.846278,0.571575,0.81926,0.60894,0.853543,0.370173,0.793576,0.353505,0.792152,0.645448,0.81892,0.607683,0.845688,0.569919,0.851505,0.351103,0.930527,0.386011,0.912695,0.680591,0.870296,0.681233,0.868724,0.406272,0.874202,0.367504,0.827582,0.353852,0.857248,0.335058,0.797917,0.335064,0.874421,0.36835,0.73329,0.059492,0.769327,0.130142,0.877378,0.097644,0.998682,0.097756,0.857089,0.13009,0.709543,0.068739,0.845603,0.068739,0.999653,0.096996,0.876693,0.165087,0.877114,0.096777,0.922854,0.827257,0.768288,0.974034,0.978589,0.999505,0.992914,0.831395,0.734764,0.701092,0.754795,0.801368,0.489129,0.694126,0.48904,0.973902,0.48904,0.972522,0.768288,0.972654,0.000535,0.197156,0.244403,0.195475,0.243663,-0.00323403,0.00056,0.307624,0.382041,0.604717,0.359879,0.776737,0.38204,0.776899,0.20705,0.602465,0.122687,0.50802,0.382041,0.486738,0.239973,0.471515,0.345534,0.463904,0.350812,0.320372,0.104731,0.362644,0.382041,0.281226,0.00156,0.419632,0.272271,0.724208,0.184662,0.67168,0.464952,0.587873,0.662396,0.587748,0.668727,0.491638,0.501897,0.49964,0.77816,0.390099,0.663509,0.346577,0.505692,0.138899,0.668127,0.222456,0.670016,0.129611,0.608005,0.658305,0.495592,0.657526,0.461717,0.715515,0.411615,0.591554,0.411615,0.772583,0.411615,0.772567,0.42741,0.772394,0.427843,0.773504,0.411615,0.494139,0.411615,0.3792,0.437275,0.173395,0.411615,0.216934,0.411615,0.172987,0.411615,0.140859,0.792241,0.646305,0.1713,0.612859,0.170913,0.672776,0.050098,0.570065,0.127602,0.73369,0.054521,0.730337,0.015247,0.69114,0.010778,0.635819,0.125753,0.574221,0.001628,0.780496,0.001604,0.752788,0.287285,0.752788,0.287308,0.780496,0.001604,0.960393,0.001602,0.92788,0.287283,0.927881,0.287285,0.960393,0.001652,0.877909,0.001669,0.842726,0.287349,0.842726,0.287332,0.877909,0.001627,0.903283,0.287308,0.903283,0.001604,0.994909,0.287285,0.994909,0.001652,0.807936,0.287332,0.807936,0.30668,0.049369,0.267383,0.045482,0.258955,0.00461298,0.267393,0.084796,0.309579,0.0835,0.267382,0.104315,0.307642,0.104315,0.267618,0.148836,0.342436,0.00951701,0.342468,0.044474,0.342479,0.079044,0.270508,0.197234,0.339546,0.136687,0.342436,0.190477,0.34343,0.105,0.372851,0.000918984,0.373846,0.045153,0.372894,0.071357,0.372849,0.131866,0.372851,0.188358,0.37285,0.159245,0.372883,0.100917,0.398529,0.024237,0.397582,0.045867,0.398556,0.07088,0.398512,0.13551,0.398513,0.159577,0.398545,0.097737,0.398528,0.117024,0.398513,0.184856,0.39755,0.00130397,0.956543,0.773286,0.492188,0.00554699,0.48667,0.108065,0.485772,0.088112,0.491704,0.00286198,0.699537,0.109599,0.698639,0.088999,0.695899,0.021933,0.695414,0.000535011,0.875516,-0.000314951,0.997464,0.084502,0.875767,0.084525,0.997341,-6.19888e-005,0.912072,0.681535,0.870209,0.682424,0.930039,0.387235,0.867292,0.405064,0.81926,0.60894,0.846278,0.571575,0.794213,0.370222,0.853543,0.370173,0.81892,0.607683,0.792152,0.645448,0.793576,0.353505,0.851505,0.351103,0.845688,0.569919,0.870296,0.681233,0.912695,0.680591,0.930527,0.386011,0.868724,0.406272,0.874202,0.367504,0.827582,0.353852,0.797917,0.335064,0.857248,0.335058,0.874421,0.36835,0.769327,0.130142,0.73329,0.059492,0.998682,0.097756,0.877378,0.097644,0.857089,0.13009,0.709543,0.068739,0.845603,0.068739,0.999653,0.096996,0.876693,0.165087,0.877114,0.096777,0.768288,0.974034,0.922854,0.827257,0.754795,0.801368,0.48904,0.973902,0.48904,0.972522,0.768288,0.972654,0.243663,-0.00323403,0.244403,0.195475,0.000535,0.197156,0.00056,0.307624,0.359879,0.776737,0.20705,0.602465,0.122687,0.50802,0.239973,0.471515,0.345534,0.463904,0.104731,0.362644,0.350812,0.320372,0.00156,0.419632,0.184662,0.67168,0.272271,0.724208,0.668727,0.491638,0.662396,0.587748,0.464952,0.587873,0.501897,0.49964,0.77816,0.390099,0.663509,0.346577,0.670016,0.129611,0.668127,0.222456,0.505692,0.138899,0.608005,0.658305,0.495592,0.657526,0.461717,0.715515,0.42741,0.772394,0.427843,0.773504,0.437275,0.173395,0.792241,0.646305]],

"faces": [42,0,1,2,0,0,1,2,0,1,2,42,3,4,0,0,3,4,0,3,4,0,42,0,5,6,0,0,5,6,0,5,6,42,4,1,0,0,4,1,0,4,1,0,42,2,7,0,0,2,7,0,2,7,0,42,6,3,0,0,6,3,0,6,3,0,42,8,9,10,0,8,9,10,8,9,10,42,8,10,11,0,8,10,11,8,10,11,42,12,13,14,0,12,13,14,12,13,14,42,12,14,15,0,12,14,15,12,14,15,42,16,17,18,0,16,17,18,16,17,18,42,16,18,19,0,16,18,19,16,18,19,42,19,18,20,0,19,18,20,19,18,20,42,19,20,21,0,19,20,21,19,20,21,42,15,14,22,0,15,14,22,15,14,22,42,15,22,23,0,15,22,23,15,22,23,42,11,10,24,0,11,10,24,11,10,24,42,11,24,25,0,11,24,25,11,24,25,42,25,24,17,0,25,24,17,25,24,17,42,25,17,16,0,25,17,16,25,17,16,42,21,20,13,0,21,20,13,21,20,13,42,21,13,12,0,21,13,12,21,13,12,42,26,27,28,0,26,27,28,26,27,28,42,28,27,29,0,28,27,29,28,27,29,42,28,29,30,0,28,29,30,28,29,30,42,30,29,31,0,30,29,31,30,29,31,42,30,31,32,0,30,31,32,30,31,32,42,32,31,33,0,32,31,33,32,31,33,42,34,26,28,0,34,26,28,34,26,28,42,34,28,35,0,34,28,35,34,28,35,42,35,28,30,0,35,28,30,35,28,30,42,35,30,36,0,35,30,36,35,30,36,42,37,33,38,0,37,33,38,37,33,38,42,37,38,39,0,37,38,39,37,38,39,42,36,30,32,0,36,30,32,36,30,32,42,36,32,40,0,36,32,40,36,32,40,42,40,32,33,0,40,32,33,40,32,33,42,40,33,37,0,40,33,37,40,33,37,42,41,34,35,0,41,34,35,41,34,35,42,41,35,42,0,41,35,42,41,35,42,42,42,35,36,0,42,35,36,42,35,36,42,42,36,43,0,42,36,43,42,36,43,42,44,37,39,0,44,37,39,44,37,39,42,45,39,46,0,45,39,46,45,39,46,42,43,36,40,0,43,36,40,43,36,40,42,43,40,47,0,43,40,47,43,40,47,42,47,40,37,0,47,40,37,47,40,37,42,47,37,44,0,47,37,44,47,37,44,42,45,44,39,0,45,44,39,45,44,39,42,48,41,42,0,48,41,42,48,41,42,42,48,42,49,0,48,42,49,48,42,49,42,49,42,43,0,49,42,43,49,42,43,42,49,43,50,0,49,43,50,49,43,50,42,51,44,45,0,51,44,45,51,44,45,42,51,45,52,0,51,45,52,51,45,52,42,50,43,47,0,50,43,47,50,43,47,42,50,47,53,0,50,47,53,50,47,53,42,54,47,44,0,54,47,44,54,47,44,42,54,44,51,0,54,44,51,54,44,51,42,52,45,46,0,52,45,46,52,45,46,42,52,46,55,0,52,46,55,52,46,55,42,48,56,41,0,48,56,41,48,56,41,42,54,53,47,0,54,53,47,54,53,47,42,57,58,59,0,57,58,59,57,58,59,42,57,59,60,0,57,59,60,57,59,60,42,61,62,63,0,61,62,63,61,62,63,42,63,64,61,0,63,64,61,63,64,61,42,61,65,66,0,61,65,66,61,65,66,42,61,66,62,0,61,66,62,61,66,62,42,62,66,67,0,62,66,67,62,66,67,42,62,67,63,0,62,67,63,62,67,63,42,63,67,68,0,63,67,68,63,67,68,42,63,68,64,0,63,68,64,63,68,64,42,64,68,65,0,64,68,65,64,68,65,42,64,65,61,0,64,65,61,64,65,61,42,69,70,71,0,69,70,71,69,70,71,42,71,70,72,0,71,70,72,71,70,72,42,73,74,75,0,73,74,75,73,74,75,42,76,74,73,0,76,74,73,76,74,73,42,77,78,79,0,77,78,79,77,78,79,42,80,78,77,0,80,78,77,80,78,77,42,81,82,83,0,81,82,83,81,82,83,42,81,84,85,0,81,84,85,81,84,85,42,86,87,88,0,86,87,88,86,87,88,42,86,88,89,0,86,88,89,86,88,89,42,90,76,73,0,90,76,73,90,76,73,42,91,80,77,0,91,80,77,91,80,77,42,92,91,93,0,92,91,93,92,91,93,42,86,89,94,0,86,89,94,86,89,94,42,95,96,93,0,95,96,93,95,96,93,42,97,73,98,0,97,73,98,97,73,98,42,96,99,93,0,96,99,93,96,99,93,42,100,81,85,0,100,81,85,100,81,85,42,100,85,101,0,100,85,101,100,85,101,42,102,86,94,0,102,86,94,102,86,94,42,102,94,103,0,102,94,103,102,94,103,42,91,92,80,0,91,92,80,91,92,80,42,91,77,93,0,91,77,93,91,77,93,42,99,92,93,0,99,92,93,99,92,93,42,103,104,102,0,103,104,102,103,104,102,42,97,90,73,0,97,90,73,97,90,73,42,105,106,107,0,105,106,107,105,106,107,42,105,108,109,0,105,108,109,105,108,109,42,109,110,105,0,109,110,105,109,110,105,42,105,107,108,0,105,107,108,105,107,108,42,109,111,112,0,109,111,112,109,111,112,42,109,113,110,0,109,113,110,109,113,110,42,110,113,114,0,110,113,114,110,113,114,42,110,114,105,0,110,114,105,110,114,105,42,115,116,117,0,115,116,117,115,116,117,42,115,118,116,0,115,118,116,115,118,116,42,119,120,121,0,119,120,121,119,120,121,42,119,122,120,0,119,122,120,119,122,120,42,119,123,122,0,119,123,122,119,123,122,42,119,124,123,0,119,124,123,119,124,123,42,124,125,123,0,124,125,123,124,125,123,42,124,126,125,0,124,126,125,124,126,125,42,126,127,128,0,126,127,128,126,127,128,42,129,127,124,0,129,127,124,129,127,124,42,125,130,123,0,125,130,123,125,130,123,42,128,130,125,0,128,130,125,128,130,125,42,128,118,130,0,128,118,130,128,118,130,42,128,127,116,0,128,127,116,128,127,116,42,128,116,118,0,128,116,118,128,116,118,42,126,128,125,0,126,128,125,126,128,125,42,126,124,127,0,126,124,127,126,124,127,42,127,129,116,0,127,129,116,127,129,116,42,131,122,132,0,131,122,132,131,122,132,42,133,134,135,0,133,134,135,133,134,135,42,133,135,136,0,133,135,136,133,135,136,42,136,135,137,0,136,135,137,136,135,137,42,136,137,138,0,136,137,138,136,137,138,42,139,140,141,0,139,140,141,139,140,141,42,142,134,133,0,142,134,133,142,134,133,42,142,133,143,0,142,133,143,142,133,143,42,144,133,145,0,144,133,145,144,133,145,42,146,147,148,0,146,147,148,146,147,148,42,149,146,148,0,149,146,148,149,146,148,42,146,149,145,0,146,149,145,146,149,145,42,145,149,144,0,145,149,144,145,149,144,42,136,150,145,0,136,150,145,136,150,145,42,145,133,136,0,145,133,136,145,133,136,42,151,150,136,0,151,150,136,151,150,136,42,136,138,151,0,136,138,151,136,138,151,42,138,140,151,0,138,140,151,138,140,151,42,140,139,151,0,140,139,151,140,139,151,42,139,152,153,0,139,152,153,139,152,153,42,153,151,139,0,153,151,139,153,151,139,42,152,154,153,0,152,154,153,152,154,153,42,152,139,155,0,152,139,155,152,139,155,42,79,156,77,0,79,156,77,79,156,77,42,131,120,122,0,131,120,122,131,120,122,42,83,84,81,0,83,84,81,83,84,81,42,144,143,133,0,144,143,133,144,143,133,42,157,158,159,0,157,158,159,157,158,159,42,159,160,161,0,159,160,161,159,160,161,42,162,163,159,0,162,163,159,162,163,159,42,159,158,160,0,159,158,160,159,158,160,42,159,164,157,0,159,164,157,159,164,157,42,159,161,162,0,159,161,162,159,161,162,42,165,166,167,0,165,166,167,165,166,167,42,168,165,167,0,168,165,167,168,165,167,42,169,170,171,0,169,170,171,169,170,171,42,172,169,171,0,172,169,171,172,169,171,42,173,174,175,0,173,174,175,173,174,175,42,176,173,175,0,176,173,175,176,173,175,42,177,173,176,0,177,173,176,177,173,176,42,178,177,176,0,178,177,176,178,177,176,42,179,169,172,0,179,169,172,179,169,172,42,180,179,172,0,180,179,172,180,179,172,42,181,165,168,0,181,165,168,181,165,168,42,182,181,168,0,182,181,168,182,181,168,42,174,181,182,0,174,181,182,174,181,182,42,175,174,182,0,175,174,182,175,174,182,42,170,177,178,0,170,177,178,170,177,178,42,171,170,178,0,171,170,178,171,170,178,42,183,184,185,0,183,184,185,183,184,185,42,186,184,183,0,186,184,183,186,184,183,42,187,186,183,0,187,186,183,187,186,183,42,188,186,187,0,188,186,187,188,186,187,42,189,188,187,0,189,188,187,189,188,187,42,190,188,189,0,190,188,189,190,188,189,42,183,185,191,0,183,185,191,183,185,191,42,192,183,191,0,192,183,191,192,183,191,42,187,183,192,0,187,183,192,187,183,192,42,193,187,192,0,193,187,192,193,187,192,42,194,190,195,0,194,190,195,194,190,195,42,196,194,195,0,196,194,195,196,194,195,42,189,187,193,0,189,187,193,189,187,193,42,197,189,193,0,197,189,193,197,189,193,42,190,189,197,0,190,189,197,190,189,197,42,195,190,197,0,195,190,197,195,190,197,42,192,191,198,0,192,191,198,192,191,198,42,199,192,198,0,199,192,198,199,192,198,42,193,192,199,0,193,192,199,193,192,199,42,200,193,199,0,200,193,199,200,193,199,42,196,195,201,0,196,195,201,196,195,201,42,202,196,203,0,202,196,203,202,196,203,42,197,193,200,0,197,193,200,197,193,200,42,204,197,200,0,204,197,200,204,197,200,42,195,197,204,0,195,197,204,195,197,204,42,201,195,204,0,201,195,204,201,195,204,42,196,201,203,0,196,201,203,196,201,203,42,199,198,205,0,199,198,205,199,198,205,42,206,199,205,0,206,199,205,206,199,205,42,200,199,206,0,200,199,206,200,199,206,42,207,200,206,0,207,200,206,207,200,206,42,203,201,208,0,203,201,208,203,201,208,42,209,203,208,0,209,203,208,209,203,208,42,204,200,207,0,204,200,207,204,200,207,42,210,204,207,0,210,204,207,210,204,207,42,201,204,211,0,201,204,211,201,204,211,42,208,201,211,0,208,201,211,208,201,211,42,202,203,209,0,202,203,209,202,203,209,42,212,202,209,0,212,202,209,212,202,209,42,198,213,205,0,198,213,205,198,213,205,42,204,210,211,0,204,210,211,204,210,211,42,214,58,57,0,214,58,57,214,58,57,42,60,214,57,0,60,214,57,60,214,57,42,215,216,217,0,215,216,217,215,216,217,42,217,218,215,0,217,218,215,217,218,215,42,219,220,217,0,219,220,217,219,220,217,42,216,219,217,0,216,219,217,216,219,217,42,221,219,216,0,221,219,216,221,219,216,42,215,221,216,0,215,221,216,215,221,216,42,222,221,215,0,222,221,215,222,221,215,42,218,222,215,0,218,222,215,218,222,215,42,220,222,218,0,220,222,218,220,222,218,42,217,220,218,0,217,220,218,217,220,218,42,223,224,225,0,223,224,225,223,224,225,42,226,224,223,0,226,224,223,226,224,223,42,227,228,229,0,227,228,229,227,228,229,42,229,228,230,0,229,228,230,229,228,230,42,231,232,233,0,231,232,233,231,232,233,42,233,232,234,0,233,232,234,233,232,234,42,235,236,237,0,235,236,237,235,236,237,42,238,239,237,0,238,239,237,238,239,237,42,240,241,242,0,240,241,242,240,241,242,42,243,240,242,0,243,240,242,243,240,242,42,229,230,244,0,229,230,244,229,230,244,42,233,234,245,0,233,234,245,233,234,245,42,246,245,247,0,246,245,247,246,245,247,42,248,243,242,0,248,243,242,248,243,242,42,246,249,250,0,246,249,250,246,249,250,42,251,229,252,0,251,229,252,251,229,252,42,246,253,249,0,246,253,249,246,253,249,42,238,237,254,0,238,237,254,238,237,254,42,255,238,254,0,255,238,254,255,238,254,42,248,242,256,0,248,242,256,248,242,256,42,257,248,256,0,257,248,256,257,248,256,42,234,247,245,0,234,247,245,234,247,245,42,246,233,245,0,246,233,245,246,233,245,42,246,247,253,0,246,247,253,246,247,253,42,256,258,257,0,256,258,257,256,258,257,42,229,244,252,0,229,244,252,229,244,252,42,107,259,260,0,107,259,260,107,259,260,42,109,108,260,0,109,108,260,109,108,260,42,260,261,109,0,260,261,109,260,261,109,42,108,107,260,0,108,107,260,108,107,260,42,262,111,109,0,262,111,109,262,111,109,42,261,263,109,0,261,263,109,261,263,109,42,264,263,261,0,264,263,261,264,263,261,42,260,264,261,0,260,264,261,260,264,261,42,265,266,267,0,265,266,267,265,266,267,42,266,268,267,0,266,268,267,266,268,267,42,121,269,119,0,121,269,119,121,269,119,42,269,270,119,0,269,270,119,269,270,119,42,270,271,119,0,270,271,119,270,271,119,42,271,124,119,0,271,124,119,271,124,119,42,271,272,124,0,271,272,124,271,272,124,42,272,273,124,0,272,273,124,272,273,124,42,274,275,273,0,274,275,273,274,275,273,42,124,275,129,0,124,275,129,124,275,129,42,271,276,272,0,271,276,272,271,276,272,42,272,276,274,0,272,276,274,272,276,274,42,276,268,274,0,276,268,274,276,268,274,42,266,275,274,0,266,275,274,266,275,274,42,268,266,274,0,268,266,274,268,266,274,42,272,274,273,0,272,274,273,272,274,273,42,275,124,273,0,275,124,273,275,124,273,42,266,129,275,0,266,129,275,266,129,275,42,277,270,278,0,277,270,278,277,270,278,42,279,280,281,0,279,280,281,279,280,281,42,282,279,281,0,282,279,281,282,279,281,42,283,279,282,0,283,279,282,283,279,282,42,284,283,282,0,284,283,282,284,283,282,42,285,286,287,0,285,286,287,285,286,287,42,281,280,288,0,281,280,288,281,280,288,42,289,281,288,0,289,281,288,289,281,288,42,145,281,290,0,145,281,290,145,281,290,42,291,147,146,0,291,147,146,291,147,146,42,291,146,292,0,291,146,292,291,146,292,42,145,292,146,0,145,292,146,145,292,146,42,290,292,145,0,290,292,145,290,292,145,42,145,150,282,0,145,150,282,145,150,282,42,282,281,145,0,282,281,145,282,281,145,42,282,150,151,0,282,150,151,282,150,151,42,151,284,282,0,151,284,282,151,284,282,42,151,286,284,0,151,286,284,151,286,284,42,151,287,286,0,151,287,286,151,287,286,42,153,293,287,0,153,293,287,153,293,287,42,287,151,153,0,287,151,153,287,151,153,42,153,154,293,0,153,154,293,153,154,293,42,155,287,293,0,155,287,293,155,287,293,42,233,294,231,0,233,294,231,233,294,231,42,270,269,278,0,270,269,278,270,269,278,42,237,239,235,0,237,239,235,237,239,235,42,281,289,290,0,281,289,290,281,289,290],

"skinWeights":[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],

"skinIndices":[17,-1,-1,-1,17,-1,-1,-1,17,-1,-1,-1,17,-1,-1,-1,17,-1,-1,-1,17,-1,-1,-1,17,-1,-1,-1,17,-1,-1,-1,17,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,17,-1,-1,-1,17,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,17,-1,-1,-1,17,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,17,-1,-1,-1,16,-1,-1,-1,17,-1,-1,-1,16,-1,-1,-1,17,-1,-1,-1,16,-1,-1,-1,17,-1,-1,-1,10,-1,-1,-1,15,-1,-1,-1,15,-1,-1,-1,15,-1,-1,-1,15,-1,-1,-1,15,-1,-1,-1,15,-1,-1,-1,10,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,10,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,16,-1,-1,-1,11,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,8,-1,-1,-1,8,-1,-1,-1,8,-1,-1,-1,8,-1,-1,-1,7,-1,-1,-1,6,-1,-1,-1,6,-1,-1,-1,7,-1,-1,-1,7,-1,-1,-1,7,-1,-1,-1,7,-1,-1,-1,7,-1,-1,-1,6,-1,-1,-1,5,-1,-1,-1,0,-1,-1,-1,6,-1,-1,-1,6,-1,-1,-1,5,-1,-1,-1,5,-1,-1,-1,6,-1,-1,-1,6,-1,-1,-1,0,-1,-1,-1,5,-1,-1,-1,5,-1,-1,-1,6,-1,-1,-1,6,-1,-1,-1,5,-1,-1,-1,5,-1,-1,-1,6,-1,-1,-1,6,-1,-1,-1,6,-1,-1,-1,6,-1,-1,-1,6,-1,-1,-1,6,-1,-1,-1,7,-1,-1,-1,6,-1,-1,-1,7,-1,-1,-1,7,-1,-1,-1,6,-1,-1,-1,7,-1,-1,-1,7,-1,-1,-1,7,-1,-1,-1,6,-1,-1,-1,7,-1,-1,-1,11,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,11,-1,-1,-1,11,-1,-1,-1,11,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,15,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,15,-1,-1,-1,0,-1,-1,-1,5,-1,-1,-1,1,-1,-1,-1,0,-1,-1,-1,9,-1,-1,-1,9,-1,-1,-1,9,-1,-1,-1,9,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,5,-1,-1,-1,5,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,9,-1,-1,-1,0,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,15,-1,-1,-1,15,-1,-1,-1,5,-1,-1,-1,0,-1,-1,-1,5,-1,-1,-1,0,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,5,-1,-1,-1,5,-1,-1,-1,0,-1,-1,-1,9,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,5,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,14,-1,-1,-1,14,-1,-1,-1,13,-1,-1,-1,14,-1,-1,-1,13,-1,-1,-1,14,-1,-1,-1,13,-1,-1,-1,14,-1,-1,-1,12,-1,-1,-1,12,-1,-1,-1,10,-1,-1,-1,12,-1,-1,-1,12,-1,-1,-1,12,-1,-1,-1,12,-1,-1,-1,10,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,10,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,13,-1,-1,-1,10,-1,-1,-1,4,-1,-1,-1,4,-1,-1,-1,4,-1,-1,-1,4,-1,-1,-1,2,-1,-1,-1,3,-1,-1,-1,2,-1,-1,-1,3,-1,-1,-1,3,-1,-1,-1,3,-1,-1,-1,3,-1,-1,-1,3,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,2,-1,-1,-1,3,-1,-1,-1,3,-1,-1,-1,3,-1,-1,-1,2,-1,-1,-1,3,-1,-1,-1,3,-1,-1,-1,3,-1,-1,-1,2,-1,-1,-1,3,-1,-1,-1,10,-1,-1,-1,11,-1,-1,-1,11,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,12,-1,-1,-1,12,-1,-1,-1,1,-1,-1,-1,0,-1,-1,-1,9,-1,-1,-1,9,-1,-1,-1,9,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,9,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,10,-1,-1,-1,10,-1,-1,-1,12,-1,-1,-1,12,-1,-1,-1,10,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,10,-1,-1,-1,1,-1,-1,-1],

"bones":[

    {// id: 0,
        parent: -1,
        name: "Joint1",
        pos: [0,51.5913,-0.0159202],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 1,
        parent: 0,
        name: "Joint2",
        pos: [1.25659,-6.37357,-3.36696],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 2,
        parent: 1,
        name: "Joint3",
        pos: [-1.37845,-21.1802,-4.04035],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 3,
        parent: 2,
        name: "Joint4",
        pos: [-0.132187,-22.3265,-2.02017],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 4,
        parent: 3,
        name: "Joint5",
        pos: [8.93628,-0.380359,0],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 5,
        parent: 0,
        name: "Joint6",
        pos: [1.25659,-6.59769,3.81589],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 6,
        parent: 5,
        name: "Joint7",
        pos: [-1.37845,-20.5078,3.59142],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 7,
        parent: 6,
        name: "Joint8",
        pos: [-0.143204,-22.8124,2.24464],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 8,
        parent: 7,
        name: "Joint9",
        pos: [8.93972,-0.168111,0.224463],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 9,
        parent: 0,
        name: "Joint10",
        pos: [2.59993,7.38522,0.224464],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 10,
        parent: 9,
        name: "Joint11",
        pos: [-2.60406,10.1826,0.224464],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 11,
        parent: 10,
        name: "Joint12",
        pos: [0,10.5338,0],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 12,
        parent: 10,
        name: "Joint13",
        pos: [0,-1.12062,-14.8146],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 13,
        parent: 12,
        name: "Joint14",
        pos: [-3.68851,-12.335,-0.897854],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 14,
        parent: 13,
        name: "Joint15",
        pos: [15.6188,-13.2904,-6.50945],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 15,
        parent: 10,
        name: "Joint16",
        pos: [0,-0.896494,13.2434],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 16,
        parent: 15,
        name: "Joint17",
        pos: [-3.68851,-12.7833,2.24464],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    },

    {// id: 17,
        parent: 16,
        name: "Joint18",
        pos: [15.6188,-13.5145,6.73391],
        scl: [1,1,1],
        rotq: [1,0,0,0],
    }

],  "animations":{

    "Die":{
         name: "Die",
         fps: 30,
         length: 0.541667,
         JIT: undefined,

         hierarchy: [
            {
                parent: -1, // Id: 0
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.0833333,
                         pos:[ -10.3369,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.166667,
                         pos:[ -45.4042,-11.4903,0 ],
                         rot:[ 0,0,1,0.858638 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.25,
                         pos:[ -71.4441,-45.7615,0 ],
                         rot:[ 0,0,1,1.51744 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.291667,
                         pos:[ -71.4121,-45.1504,0 ],
                         rot:[ 0,0,1,1.51744 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ -73.377,-46.4263,0 ],
                         rot:[ 0,0,1,1.51744 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.5,
                         pos:[ -82.8014,-45.1663,0 ],
                         rot:[ 0,0,1,1.51744 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.541667,
                         pos:[ -82.8014,-45.1663,0 ],
                         rot:[ 0,0,1,1.51744 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 0, // Id: 1
                keys: [
                     {
                         time:0,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.0761765 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.0833333,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,1,0.19435 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.25,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.102357 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.291667,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.102357 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 1, // Id: 2
                keys: [
                     {
                         time:0,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,-1,0.0436304 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.25,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,1,0.375247 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.291667,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,1,0.375247 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.5,
                         pos:[ 10.7524,0.283351,0 ],
                         rot:[ 0,0,1,0.0162092 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.541667,
                         pos:[ 10.7524,0.283351,0 ],
                         rot:[ 0,0,1,0.0162092 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 2, // Id: 3
                keys: [
                     {
                         time:0,
                         pos:[ 0.0512495,0.716218,0 ],
                         rot:[ 0,0,1,0.101159 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.0833333,
                         pos:[ 0.0512495,0.716218,0 ],
                         rot:[ 0,0,-1,0.265361 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 3, // Id: 4
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 0, // Id: 5
                keys: [
                     {
                         time:0,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.169814 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.0833333,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.44034 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.25,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.143634 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.291667,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.143634 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 5, // Id: 6
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.165806 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.25,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.253074 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.291667,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.253074 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.5,
                         pos:[ 5.88073,-0.625497,0 ],
                         rot:[ 0,0,-1,0.105966 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.541667,
                         pos:[ 5.88073,-0.625497,0 ],
                         rot:[ 0,0,-1,0.105966 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 6, // Id: 7
                keys: [
                     {
                         time:0,
                         pos:[ -2.08179,0.980345,0 ],
                         rot:[ 0,0,-1,0.0128075 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.0833333,
                         pos:[ -2.08179,0.980345,0 ],
                         rot:[ 0,0,-1,0.379318 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 7, // Id: 8
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 0, // Id: 9
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.0959959 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.0833333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.471242 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 9, // Id: 10
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,1,0,0.020403 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 10, // Id: 11
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 10, // Id: 12
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.12795 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.0833333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.354842 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 12, // Id: 13
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,-1,0,0.200714 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.166667,
                         pos:[ 0,0,0 ],
                         rot:[ -0.0725245,-0.689929,0.720235,0.289853 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.25,
                         pos:[ 0,0,0 ],
                         rot:[ 0.0956146,-0.2987,-0.949545,0.650294 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.291667,
                         pos:[ 0,0,0 ],
                         rot:[ 0.0956146,-0.2987,-0.949545,0.650294 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 13, // Id: 14
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 10, // Id: 15
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.0664918 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.0833333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.293385 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 15, // Id: 16
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,1,0,0.235619 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.166667,
                         pos:[ 0,0,0 ],
                         rot:[ 0.078354,0.745389,0.662009,0.314944 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.25,
                         pos:[ 0,0,0 ],
                         rot:[ -0.110335,0.344685,-0.932212,0.66153 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.291667,
                         pos:[ 0,0,0 ],
                         rot:[ -0.110335,0.344685,-0.932212,0.66153 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 16, // Id: 17
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
         ],
    },      "Idle":{
         name: "Idle",
         fps: 30,
         length: 2.83333,
         JIT: undefined,

         hierarchy: [
            {
                parent: -1, // Id: 0
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 0, // Id: 1
                keys: [
                     {
                         time:0,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.0761765 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.0761765 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.0761765 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.0761765 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.0761765 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.0761765 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ -0.244575,-0.945701,0 ],
                         rot:[ 0,0,-1,0.0761765 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 1, // Id: 2
                keys: [
                     {
                         time:0,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,-1,0.0436304 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,-1,0.0436358 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,-1,0.0436358 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,-1,0.0436358 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,-1,0.0436358 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,-1,0.0436358 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 4.83928,0.187507,0 ],
                         rot:[ 0,0,-1,0.0436304 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 2, // Id: 3
                keys: [
                     {
                         time:0,
                         pos:[ 0.0512495,0.716218,0 ],
                         rot:[ 0,0,1,0.101159 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0.0512495,0.716218,0 ],
                         rot:[ 0,0,1,0.101159 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0.0512495,0.716218,0 ],
                         rot:[ 0,0,1,0.101159 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0.0512495,0.716218,0 ],
                         rot:[ 0,0,1,0.101159 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0.0512495,0.716218,0 ],
                         rot:[ 0,0,1,0.101159 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0.0512495,0.716218,0 ],
                         rot:[ 0,0,1,0.101159 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0.0512495,0.716218,0 ],
                         rot:[ 0,0,1,0.101159 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 3, // Id: 4
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 0, // Id: 5
                keys: [
                     {
                         time:0,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.169814 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.169814 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.169814 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.169814 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.169814 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.169814 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ -0.459241,-1.37253,0 ],
                         rot:[ 0,0,1,0.169814 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 5, // Id: 6
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.165806 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.165806 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.165806 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.165806 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.165806 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.165806 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.165806 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 6, // Id: 7
                keys: [
                     {
                         time:0,
                         pos:[ -2.08179,0.980345,0 ],
                         rot:[ 0,0,-1,0.0128075 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ -2.08179,0.980345,0 ],
                         rot:[ 0,0,-1,0.0128075 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ -2.08179,0.980345,0 ],
                         rot:[ 0,0,-1,0.0128075 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ -2.08179,0.980345,0 ],
                         rot:[ 0,0,-1,0.0128075 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ -2.08179,0.980345,0 ],
                         rot:[ 0,0,-1,0.0128075 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ -2.08179,0.980345,0 ],
                         rot:[ 0,0,-1,0.0128075 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ -2.08179,0.980345,0 ],
                         rot:[ 0,0,-1,0.0128075 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 7, // Id: 8
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 0, // Id: 9
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.0959959 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.0959959 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.0959959 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.165809 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ -0.061061,-0.854469,-0.515902,0.27528 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ 0.0551701,0.903031,-0.426019,0.30544 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,-1,0.0959959 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 9, // Id: 10
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,1,0,0.020403 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ -0.0428709,0.981906,-0.184453,0.464855 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ -0.195341,-0.968925,0.15174,0.352233 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ -0.485483,-0.783267,0.388327,0.123183 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ -0.0628036,-0.995099,0.0763726,0.434543 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ -0.121135,-0.983821,0.131997,0.172733 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,1,0,0.020403 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 10, // Id: 11
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ 0,-1,0,0.18326 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 10, // Id: 12
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.12795 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.12795 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.12795 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.12795 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.12795 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.12795 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.12795 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 12, // Id: 13
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,-1,0,0.200714 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,-1,0,0.200714 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ -0.0797277,-0.605592,0.791772,0.329536 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ -0.0284455,-0.958848,0.282491,0.209266 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ -0.0069916,-0.997562,0.0694328,0.201201 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ -0.00367714,-0.999326,0.0365171,0.200847 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,-1,0,0.200714 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 13, // Id: 14
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 1,0,0,0 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 10, // Id: 15
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.0664918 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.0664918 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.0664918 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.0664918 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.0664918 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.20833,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.0664918 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:2.83333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,0,1,0.0664918 ],
                         scl:[ 1,1,1 ],
                     },
                ]
            },
            {
                parent: 15, // Id: 16
                keys: [
                     {
                         time:0,
                         pos:[ 0,0,0 ],
                         rot:[ 0,1,0,0.235619 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.333333,
                         pos:[ 0,0,0 ],
                         rot:[ 0,1,0,0.235619 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:0.75,
                         pos:[ 0,0,0 ],
                         rot:[ -0.0542564,0.887084,-0.458409,0.26528 ],
                         scl:[ 1,1,1 ],
                     },
                     {
                         time:1.375,
                         pos:[ 0,0,0 ],
weitmLzu commented 12 years ago

the json is created by my converter

alteredq commented 12 years ago

Very interesting.

Do models converted by you work ok? Buffalo, our only skinned model so far has some occasional weird glitches, not sure if they come from the model or there are bugs in the playback code.

If you would put your converter code somewhere, maybe somebody else can help ;). I think more people would be interested in having better skinning pipeline.

weitmLzu commented 12 years ago

I want to build a demo with WebGL and test the performance, but I have no resources, so I do the job. My converter is based on OGRE's SDK. There is a XMLConverter in the SDK, I add some features to it. The following is the contents that I added or modified.

weitmLzu commented 12 years ago

main.cpp

#include "Ogre.h"
#include "OgreXMLMeshSerializer.h"
#include "OgreMeshSerializer.h"
#include "OgreXMLSkeletonSerializer.h"
#include "OgreSkeletonSerializer.h"
#include "OgreXMLPrerequisites.h"
#include "OgreDefaultHardwareBufferManager.h"
#include <iostream>
#include <sys/stat.h>
#include "OgreMaterial.h"
#include <stdio.h>
#include <vector>
// #include <windows.h>
#include <io.h>
#include "MeshToJson.h"

using namespace std;
using namespace Ogre;

struct XmlOptions
{
    String source;
    String dest;
    String sourceExt;
    String destExt;
    String logFile;
    bool interactiveMode; // 互动模式
    unsigned short numLods;// LOD level of detail 层次细节度 的数量(可以减少渲染的面数,进而提高效率)
    Real lodValue;
    String lodStrategy;
    Real lodPercent;
    size_t lodFixed;
    size_t nuextremityPoints;//Generate extremes per submesh
    bool usePercent;
    bool generateEdgeLists;// 生成边
    bool generateTangents; // 生成切线
    VertexElementSemantic tangentSemantic;
    bool tangentUseParity;    // 奇偶校验
    bool tangentSplitMirrored;// 切线分割镜像
    bool tangentSplitRotated; // 
    bool reorganiseBuffers;   // 重组缓冲
    bool optimiseAnimations;  // 优化动画
    bool quietMode;
    bool d3d;
    bool gl;
    bool isDir;
    Serializer::Endian endian;// 对齐方式
};

// 提示用法
void help(void)
{
    cout << endl << "Usage:  JSConverter.exe sourcefile(*.xml) [destfile] " << endl;
    cout << endl << "Also:   JSConverter.exe -direc sourceDir(in which all the files will be converted into js format) " << endl;
    cout << endl;
}

XmlOptions parseArgs(int numArgs, char **args)
{
    XmlOptions opts;

    opts.interactiveMode = false;
    opts.lodValue = 250000;
    opts.lodFixed = 0;
    opts.lodPercent = 20;
    opts.numLods = 0;
    opts.nuextremityPoints = 0;
    opts.usePercent = true;
    opts.generateEdgeLists = true;
    opts.generateTangents = false;
    opts.tangentSemantic = VES_TANGENT;
    opts.tangentUseParity = false;
    opts.tangentSplitMirrored = false;
    opts.tangentSplitRotated = false;
    opts.reorganiseBuffers = true;
    opts.optimiseAnimations = true;
    opts.quietMode = true;
    opts.endian = Serializer::ENDIAN_NATIVE;

    opts.isDir  = false; // 默认是针对单个文件进行解析

    // 程序名字由命令行解析出来
    char* source = 0;
    char* dest = 0;

    UnaryOptionList unOpt;  // 单个的输入配置项
    BinaryOptionList binOpt;// 成对的输入配置项

    unOpt["-i"] = false;
    unOpt["-e"] = false;
    unOpt["-r"] = false;
    unOpt["-t"] = false;
    unOpt["-tm"] = false;
    unOpt["-tr"] = false;
    unOpt["-o"] = false;
    unOpt["-q"] = false;
    unOpt["-d3d"] = false;
    unOpt["-gl"] = false;
    unOpt["-direc"] = false;

    binOpt["-l"] = "";
    binOpt["-v"] = "";
    binOpt["-s"] = "Distance";
    binOpt["-p"] = "";
    binOpt["-f"] = "";
    binOpt["-E"] = "";
    binOpt["-x"] = "";
    binOpt["-log"] = "OgreXMLConverter.log";
    binOpt["-td"] = "";
    binOpt["-ts"] = "";

    int startIndex = findCommandLineOpts(numArgs, args, unOpt, binOpt);
    UnaryOptionList::iterator ui;
    BinaryOptionList::iterator bi;

    ui = unOpt.find("-q");
    if (ui->second)
    {
        opts.quietMode = true;
    }

    ui = unOpt.find("-i");
    if (ui->second)
    {
        opts.interactiveMode = true;
    }
    else
    {
        ui = unOpt.find("-e");
        if (ui->second)
        {
            opts.generateEdgeLists = false;
        }

        ui = unOpt.find("-r");
        if (ui->second)
        {
            opts.reorganiseBuffers = false;
        }

        ui = unOpt.find("-t");
        if (ui->second)
        {
            opts.generateTangents = true;
        }
        ui = unOpt.find("-tm");
        if (ui->second)
        {
            opts.tangentSplitMirrored = true;
        }
        ui = unOpt.find("-tr");
        if (ui->second)
        {
            opts.tangentSplitRotated = true;
        }

        bi = binOpt.find("-td");
        if (!bi->second.empty())
        {
            if (bi->second == "uvw")
                opts.tangentSemantic = VES_TEXTURE_COORDINATES;
            else
                opts.tangentSemantic = VES_TANGENT;
        }
        bi = binOpt.find("-ts");
        if (!bi->second.empty())
        {
            if (bi->second == "4")
                opts.tangentUseParity = true;
        }

        ui = unOpt.find("-o");
        if (ui->second)
        {
            opts.optimiseAnimations = false;
        }

        bi = binOpt.find("-l");
        if (!bi->second.empty())
        {
            opts.numLods = StringConverter::parseInt(bi->second);// 设置LOD的数量
        }

        bi = binOpt.find("-v");
        if (!bi->second.empty())
        {
            opts.lodValue = StringConverter::parseReal(bi->second);
        }

        bi = binOpt.find("-s");
        if (!bi->second.empty())
        {
            opts.lodStrategy = bi->second;
        }

        bi = binOpt.find("-p");
        if (!bi->second.empty())
        {
            opts.lodPercent = StringConverter::parseReal(bi->second);
            opts.usePercent = true;
        }

        bi = binOpt.find("-f");
        if (!bi->second.empty())
        {
            opts.lodFixed = StringConverter::parseInt(bi->second);// 使用固定的数量还是使用百分比
            opts.usePercent = false;
        }

        bi = binOpt.find("-x");
        if (!bi->second.empty())
        {
            opts.nuextremityPoints = StringConverter::parseInt(bi->second);
        }

        bi = binOpt.find("-log");
        if (!bi->second.empty())
        {
            opts.logFile = bi->second;
        }

        bi = binOpt.find("-E");
        if (!bi->second.empty())
        {
            if (bi->second == "big")
                opts.endian = Serializer::ENDIAN_BIG;
            else if (bi->second == "little")
                opts.endian = Serializer::ENDIAN_LITTLE;
            else 
                opts.endian = Serializer::ENDIAN_NATIVE;
        }

        ui = unOpt.find("-d3d");
        if (ui->second)
        {
            opts.d3d = true;
        }

        // 检查是否是输入的目录
        ui = unOpt.find("-direc");
        if (ui->second)
        {
            opts.isDir = true;
        }

        ui = unOpt.find("-gl");
        if (ui->second)
        {
            opts.gl = true;
            opts.d3d = false;
        }

    }

    if (numArgs > startIndex)
        source = args[startIndex];// 源文件名和目标文件名放在最后边
    if (numArgs > startIndex+1)
        dest = args[startIndex+1];
    if (numArgs > startIndex+2) {
        cout << "参数太多 " << endl;
        help();
        exit(1);
    }

    if (!source)
    {
        cout << "没有输入 源文件名字. " << endl;
        help();
        exit(1);
    }

    opts.source = source;
    Ogre::vector<String>::type srcparts = StringUtil::split(opts.source, ".");
    String& ext = srcparts.back(); // 最末尾的肯定是扩展名
    StringUtil::toLowerCase(ext);  // 统一成小写的
    opts.sourceExt = ext;

    if (!dest)
    {
        if (opts.sourceExt == "xml")
        {
            // source 去掉 .xml
            opts.dest = opts.source.substr(0, opts.source.size() - 4);
        }
        else
        {
            // source + .xml
            opts.dest = opts.source;
            opts.dest.append(".xml");
        }

    }
    else
    {
        opts.dest = dest;
    }
    Ogre::vector<String>::type dstparts = StringUtil::split(opts.dest, ".");
    ext = dstparts.back();
    StringUtil::toLowerCase(ext);
    opts.destExt = ext;

    if (!opts.quietMode) 
    {
        cout << endl;
        cout << "-- OPTIONS --" << endl;
        cout << "source file      = " << opts.source << endl;
        cout << "destination file = " << opts.dest << endl;
            cout << "log file         = " << opts.logFile << endl;
        cout << "interactive mode = " << StringConverter::toString(opts.interactiveMode) << endl;
        if (opts.numLods == 0)
        {
            cout << "lod levels       = none (or use existing)" << endl;
        }
        else
        {
            cout << "lod levels       = " << opts.numLods << endl;
            cout << "lod value     = " << opts.lodValue << endl;
            cout << "lod strategy     = " << opts.lodStrategy << endl;
            if (opts.usePercent)
            {
                cout << "lod reduction    = " << opts.lodPercent << "%" << endl;
            }
            else
            {
                cout << "lod reduction    = " << opts.lodFixed << " verts" << endl;
            }
        }
        if (opts.nuextremityPoints)
            cout << "Generate extremes per submesh = " << opts.nuextremityPoints << endl;
        cout << "Generate edge lists  = " << opts.generateEdgeLists << endl;
        cout << "Generate tangents = " << opts.generateTangents << endl;
        cout << " semantic = " << (opts.tangentSemantic == VES_TANGENT? "TANGENT" : "TEXCOORD") << endl;
        cout << " parity = " << opts.tangentUseParity << endl;
        cout << " split mirror = " << opts.tangentSplitMirrored << endl;
        cout << " split rotated = " << opts.tangentSplitRotated << endl;
        cout << "Reorganise vertex buffers = " << opts.reorganiseBuffers << endl;
        cout << "Optimise animations = " << opts.optimiseAnimations << endl;

        cout << "-- END OPTIONS --" << endl;
        cout << endl;
    }

    return opts;
}

// 为了使用OGRE的库 不得已创建这些全局变量,这些变量构成了一个工作环境
LogManager* logMgr = 0;
Math* mth = 0;
LodStrategyManager *lodMgr = 0;
MaterialManager* matMgr    = 0;
SkeletonManager* skelMgr   = 0;
MeshSerializer* meshSerializer = 0;
XMLMeshSerializer* xmlMeshSerializer   = 0;
SkeletonSerializer* skeletonSerializer = 0;
XMLSkeletonSerializer* xmlSkeletonSerializer = 0;
DefaultHardwareBufferManager *bufferManager  = 0;
MeshManager* meshMgr      = 0;
ResourceGroupManager* rgm = 0;

// mesh转为 人可读的xml格式
void meshToXML(XmlOptions opts)
{
    std::ifstream ifs;
    ifs.open(opts.source.c_str(), std::ios_base::in | std::ios_base::binary);

    if (ifs.bad())
    {
        // 流操作时出现错误
        cout << "无法打开文件 " << opts.source << endl;
        exit(1);
    }

    // false表示 FileStreamDataStream不用管 ifstream(这里是在栈上创建的变量)
    DataStreamPtr stream(new FileStreamDataStream(opts.source, &ifs, false));

    // 创建一个空的mesh
    MeshPtr mesh = MeshManager::getSingleton().create("conversion", 
        ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

    // stream中的数据写到mesh的数据结构中   硬盘-----》内存中的 mesh结构
    meshSerializer->importMesh(stream, mesh.getPointer());

    // 生成xml         内存中的mesh----》硬盘上的xml文件
    xmlMeshSerializer->exportMesh(mesh.getPointer(), opts.dest);
}

// xml文件转成 OGRE的模型文件
void XMLToBinary(XmlOptions opts)
{
    String response;
    TiXmlDocument* doc = new TiXmlDocument(opts.source.c_str());

    // 此函数之后内存中已经解析好了xml格式的数据
    if (!doc->LoadFile())
    {
        cout << "无法打开XML文件 " << opts.source << " - error." << endl;
        delete doc;
        exit (1);
    }

    // 首先读入root节点 mesh
    TiXmlElement* root = doc->RootElement();

    if (!stricmp(root->Value(), "mesh"))
    {
        delete doc; // 释放文档缓冲区

        // 创建mesh数据结构
        MeshPtr newMesh = MeshManager::getSingleton().createManual("conversion", 
            ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

        // 确定颜色数据结构
        VertexElementType colourElementType;
        if (opts.d3d)
            colourElementType = VET_COLOUR_ARGB;
        else
            colourElementType = VET_COLOUR_ABGR;

        // 这里是导入mesh数据的总入口
        xmlMeshSerializer->importMesh(opts.source, colourElementType, newMesh.getPointer());

        if (opts.reorganiseBuffers)
        {
            logMgr->logMessage("Reorganising vertex buffers to automatic layout..");
            // Shared geometry 字段
            if (newMesh->sharedVertexData)
            {
                // 使用自动的vertexDeclaration
                VertexDeclaration* newDcl = 
                    newMesh->sharedVertexData->vertexDeclaration->getAutoOrganisedDeclaration(
                        newMesh->hasSkeleton(), newMesh->hasVertexAnimation());
                if (*newDcl != *(newMesh->sharedVertexData->vertexDeclaration))
                {
                    // 占上位置
                    BufferUsageList bufferUsages;
                    for (size_t u = 0; u <= newDcl->getMaxSource(); ++u)
                        bufferUsages.push_back(HardwareBuffer::HBU_STATIC_WRITE_ONLY);
                    newMesh->sharedVertexData->reorganiseBuffers(newDcl, bufferUsages);
                }
            }
            // 构建每个submesh
            Mesh::SubMeshIterator smIt = newMesh->getSubMeshIterator();
            while (smIt.hasMoreElements())
            {
                SubMesh* sm = smIt.getNext();
                if (!sm->useSharedVertices)
                {
                    VertexDeclaration* newDcl = 
                        sm->vertexData->vertexDeclaration->getAutoOrganisedDeclaration(
                            newMesh->hasSkeleton(), newMesh->hasVertexAnimation());
                    if (*newDcl != *(sm->vertexData->vertexDeclaration))
                    {
                        BufferUsageList bufferUsages;
                        for (size_t u = 0; u <= newDcl->getMaxSource(); ++u)
                            bufferUsages.push_back(HardwareBuffer::HBU_STATIC_WRITE_ONLY);
                        sm->vertexData->reorganiseBuffers(newDcl, bufferUsages);
                    }
                }
            }

        }

        // LOD信息
        bool genLod = false;
        bool askLodDtls = false;
        if (!opts.interactiveMode) 
        {
            askLodDtls = false;
            if (opts.numLods == 0)
            {
                genLod = false;
            }
            else
            {
                genLod = true;
            }
        }
        else if(opts.numLods == 0) 
        {
            if (newMesh->getNumLodLevels() > 1)
            {
                std::cout << "\nXML already contains level-of detail information.\n"
                    "Do you want to: (u)se it, (r)eplace it, or (d)rop it?";
                while (response == "")
                {
                    cin >> response;
                    StringUtil::toLowerCase(response);
                    if (response == "u")
                    {
                        // Do nothing
                    }
                    else if (response == "d")
                    {
                        newMesh->removeLodLevels();
                    }
                    else if (response == "r")
                    {
                        genLod = true;
                        askLodDtls = true;

                    }
                    else
                    {
                        std::cout << "Did not understand \"" << response << "\" please try again:" << std::endl;
                        response = "";
                    }
                }// while response == ""
            }
            else // no existing LOD
            {
                std::cout << "\nWould you like to generate LOD information? (y/n)";
                while (response == "")
                {
                    cin >> response;
                    StringUtil::toLowerCase(response);
                    if (response == "n")
                    {
                        // Do nothing
                    }
                    else if (response == "y")
                    {
                        genLod = true;
                        askLodDtls = true;
                    }
                    else
                    {
                        std::cout << "Did not understand \"" << response << "\" please try again:" << std::endl;
                        response = "";
                    }
                }
            }
        }

        if (genLod)
        {
            unsigned short numLod;
            ProgressiveMesh::VertexReductionQuota quota;
            Real reduction;
            Mesh::LodValueList valueList;

            if (askLodDtls)
            {
                cout << "\nHow many extra LOD levels would you like to generate?";
                cin >> numLod;

                cout << "\nWhat lod strategy should be used?";
                cin >> opts.lodStrategy;

                cout << "\nWhat unit of reduction would you like to use:" <<
                    "\n(f)ixed or (p)roportional?";
                response = "";
                while (response == "") {
                    cin >> response;
                    StringUtil::toLowerCase(response);
                    if (response == "f")
                    {
                        quota = ProgressiveMesh::VRQ_CONSTANT;
                        cout << "\nHow many vertices should be removed at each LOD?";
                    }
                    else if (response == "p")
                    {
                        quota = ProgressiveMesh::VRQ_PROPORTIONAL;
                        cout << "\nWhat percentage of remaining vertices should be removed "
                            "\at each LOD (e.g. 50)?";
                    }
                    else {
                            std::cout << "Did not understand \"" << response << "\" please try again:" << std::endl;
                            response = "";
                    }
                }
                cin >> reduction;
                if (quota == ProgressiveMesh::VRQ_PROPORTIONAL)
                {
                    // Percentage -> parametric
                    reduction = reduction * 0.01f;
                }

                cout << "\nEnter the distance for each LOD to come into effect.";

                Real distance;
                for (unsigned short iLod = 0; iLod < numLod; ++iLod)
                {
                    cout << "\nLOD Level " << (iLod+1) << ":";
                    cin >> distance;
                    valueList.push_back(distance);
                }
            }
            else
            {
                numLod = opts.numLods;
                quota = opts.usePercent? 
                    ProgressiveMesh::VRQ_PROPORTIONAL : ProgressiveMesh::VRQ_CONSTANT;
                if (opts.usePercent)
                {
                    reduction = opts.lodPercent * 0.01f;
                }
                else
                {
                    reduction = (float)opts.lodFixed;
                }
                Real currDist = 0;
                for (unsigned short iLod = 0; iLod < numLod; ++iLod)
                {
                    currDist += opts.lodValue;
                    Real currDistSq = Ogre::Math::Sqr(currDist);
                    valueList.push_back(currDistSq);
                }

            }

            newMesh->setLodStrategy(LodStrategyManager::getSingleton().getStrategy(opts.lodStrategy));
            newMesh->generateLodLevels(valueList, quota, reduction);
        }

        if (opts.interactiveMode)
        {
            std::cout << "\nWould you like to include edge lists to enable stencil shadows with this mesh? (y/n)";
            while (response == "")
            {
                cin >> response;
                StringUtil::toLowerCase(response);
                if (response == "y")
                {
                    // Do nothing
                }
                else if (response == "n")
                {
                    opts.generateEdgeLists = false;
                }
                else
                {
                    std::cout << "Did not understand \"" << response << "\" please try again:" << std::endl;
                    response = "";
                }
            }

            std::cout << "\nWould you like to generate tangents to enable normal mapping with this mesh? (y/n)";
            while (response == "")
            {
                cin >> response;
                StringUtil::toLowerCase(response);
                if (response == "y")
                {
                    opts.generateTangents = true;
                }
                else if (response == "n")
                {
                    // Do nothing
                }
                else
                {
                    std::cout << "Did not understand \"" << response << "\" please try again:" << std::endl;
                    response = "";
                }
            }
        }

        if (opts.generateEdgeLists)
        {
            if (!opts.quietMode) 
            {
                std::cout << "Generating edge lists...." << std::endl;
            }
            newMesh->buildEdgeList();
        }

        if (opts.generateTangents)
        {
            unsigned short srcTex, destTex;
            if (!opts.quietMode) 
            {
                std::cout << "Checking if we already have tangent vectors...." << std::endl;
            }
            bool existing;
            try {
                existing = newMesh->suggestTangentVectorBuildParams(opts.tangentSemantic, srcTex, destTex);
            } catch (Exception &e) {
                std::cerr << "WARNING: While checking for existing tangents: " << e.getFullDescription() << std::endl;
                std::cerr << "NOTE: Tangents were NOT generated for this mesh!" << std::endl;
                existing = false;
                opts.generateTangents = false;
            }
            if (existing)
            {
                std::cout << "\nThis mesh appears to already have a set of 3D texture coordinates, " <<
                    "which would suggest tangent vectors have already been calculated. Do you really " <<
                    "want to generate new tangent vectors (may duplicate)? (y/n): ";
                while (response == "")
                {
                    cin >> response;
                    StringUtil::toLowerCase(response);
                    if (response == "y")
                    {
                        // Do nothing
                    }
                    else if (response == "n")
                    {
                        opts.generateTangents = false;
                    }
                    else
                    {
                        std::cout << "Did not understand \"" << response << "\" please try again:" << std::endl;
                        response = "";
                    }
                }

            }
            if (opts.generateTangents)
            {
                if (!opts.quietMode) 
                {
                    std::cout << "Generating tangent vectors...." << std::endl;
                }
                newMesh->buildTangentVectors(opts.tangentSemantic, srcTex, destTex, 
                    opts.tangentSplitMirrored, opts.tangentSplitRotated, opts.tangentUseParity);
            }
        }

        if (opts.nuextremityPoints)
        {
            Mesh::SubMeshIterator smIt = newMesh->getSubMeshIterator();
            while (smIt.hasMoreElements())
            {
                SubMesh* sm = smIt.getNext();
                sm->generateExtremes (opts.nuextremityPoints);
            }
        }

        meshSerializer->exportMesh(newMesh.getPointer(), opts.dest, opts.endian);
    }// 处理if root = =mesh 结束
    else if (!stricmp(root->Value(), "skeleton"))
    {
        delete doc;
        SkeletonPtr newSkel = SkeletonManager::getSingleton().create("conversion", 
            ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
        xmlSkeletonSerializer->importSkeleton(opts.source, newSkel.getPointer());
        if (opts.optimiseAnimations)
        {
            newSkel->optimiseAllAnimations();
        }
        skeletonSerializer->exportSkeleton(newSkel.getPointer(), opts.dest, opts.endian);
    }
    else
    {
        delete doc;
    }

}

void skeletonToXML(XmlOptions opts)
{

    std::ifstream ifs;
    ifs.open(opts.source.c_str(), std::ios_base::in | std::ios_base::binary);
    if (ifs.bad())
    {
        cout << "文件打不开 " << opts.source << endl;
        exit(1);
    }

    SkeletonPtr skel = SkeletonManager::getSingleton().create("conversion", 
        ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

    // pass false for freeOnClose to FileStreamDataStream since ifs is created locally on stack
    DataStreamPtr stream(new FileStreamDataStream(opts.source, &ifs, false));
    skeletonSerializer->importSkeleton(stream, skel.getPointer());

    xmlSkeletonSerializer->exportSkeleton(skel.getPointer(), opts.dest);

}

void testString()
{
    String s;
    s += "1,2";
    s += "\",3,4\"";

    s.replace(0,1,String());
    cout<< s<<endl;

    ofstream f;
    f.open("test1.txt");
    //f.write(s,1);
    f<<s;
    f.close();

    std::ostringstream oneFace;
    oneFace << 1<<","<<2.345<< s;

    cout <<oneFace.str();

}

void getDir()
{
    //
         const int nBufSize = 512;

        TCHAR* p = new TCHAR[nBufSize];

         //TCHAR chBuf[nBufSize];  
         ZeroMemory(p,nBufSize);

         //获取当前执行文件的路径, 参数依次是进程句柄、路径缓冲区、以及缓冲区大小
        if (GetModuleFileName(NULL,p,nBufSize))
         {
               //输出带文件名称路径。
               OutputDebugString(p);

//               cout<<String(chBuf);

            //TCHAR* p = chBuf;
                cout<<p;

 /*
            while(strchr(p,'\\'))
            {
                     p = strchr(p,'\\'); // 找到最后一个\
                     p++;                // 移动到下一个位置 
            }

            *p = '\0';

            OutputDebugString(chBuf);
/*
              // OutputDebugString(_T("/r/n"));

               //获取文件路径。
               TCHAR* lpStrPath = chBuf;

               PathRemoveFileSpec(lpStrPath);
               OutputDebugString(lpStrPath);
              // OutputDebugString(_T("/r/n"));
              */
         }
}

void   visit(String path,int layer)     
{     

    struct _finddata_t   filefind;     
    String  curr = path + "\\*.*";     
    //String  curr = path;     
    long   done = 0L,handle;     

    if((handle = _findfirst(curr.c_str(),&filefind))== -1L)
    {
        cout << "文件没有找到" << endl;
        return;       
    }

    while(! (done = _findnext(handle, &filefind)))     
    {         

        printf("\n%s",filefind.name);   // 这个文件名仅仅是文件本身的名字 不包含路径
        if(filefind.attrib == _A_NORMAL) cout<<"  普通文件 ";
        else if(filefind.attrib == _A_RDONLY) cout<<" 只读文件 ";
        else if(filefind.attrib == _A_HIDDEN ) cout<<" 隐藏文件 ";
        else if(filefind.attrib == _A_SYSTEM ) cout<<" 系统文件 ";
        else if(filefind.attrib == _A_SUBDIR) cout<<" 子目录 ";
        else cout<<" 存档文件 ";

        //cout<<endl;

        /*
        if(!strcmp(filefind.name,".."))
        {  
            continue;  
        }

        for(i = 0; i < layer; i++)
            cout << "    ";

        if((_A_SUBDIR==filefind.attrib)) //是目录  
        {             
            printf("----------%s\n",filefind.name);      
            cout << filefind.name<<"(dir)" << endl;     
            curr = path+"\\" + filefind.name;     
        }     
        else
        {   
            // 不是目录,是文件        
            cout << path + "\\" + filefind.name << endl;    
        } 
        */
    }             
    _findclose(handle);   

}     

// 将整个目录转成json格式,参数依次是 当前目录、源文件夹
void XMLToJson4Dir(String currentDir, String srcDir)
{
    String fileName, outputName;

    int     done    = 0, handle; 
    struct _finddata_t   filefind;     

    String  curr = currentDir + srcDir + "\\*.*";     

    if((handle = _findfirst(curr.c_str(),&filefind))== -1)
    {
        // 输入不是一个有效的目录

        // 析构掉句柄
        _findclose(handle);       

        cout << "warning ! 输入的文件夹中没有可以进行转换的文件"<<endl;
        return ;

    }

    // 对整个目录进行转换,目前只支持一层深度
    while(! (done = _findnext(handle, &filefind)))     
    {   
        // 把主功能模块建立起来
        G_bits::MeshToJson *m2j = new G_bits::MeshToJson();
        cout << filefind.name << endl; // 测试用   

        // 处理文件夹内的每一个文件
        if(filefind.attrib == _A_SUBDIR) 
        {
            cout << filefind.name << "  是一个子目录,目前还不对子目录进行递归的处理"<< endl;
            continue;
        }else 
        {
            fileName = String(filefind.name);

            Ogre::vector<String>::type nameparts = StringUtil::split(fileName, ".");
            String& ext = nameparts.back(); // 最末尾的肯定是扩展名
            StringUtil::toLowerCase(ext);  // 统一成小写的

            if (ext != "xml")
                // 只针对xml格式的文件进行处理
                continue;

            // 对于目录的处理 输出文件名统一为 源文件名 去掉.xml 加上.js
            outputName  = fileName.substr(0, fileName.size() - 4);
            outputName += ".js";

            m2j->exportMesh( String(currentDir) + srcDir + "\\" + fileName, String(currentDir) + srcDir + "\\" + outputName);
        }

        delete m2j;
    }   

    // 析构掉句柄
    _findclose(handle);       
}

int main(int numargs, char** args)
{
    char* currentDir = args[0]; 
    char* tmp = currentDir; // 借助命令行传进来的参数

    // 得到当前的目录
    while(strchr(tmp,'\\'))
    {
        tmp = strchr(tmp,'\\'); // 找到最后一个
        tmp++;                  // 移动到下一个位置 
    }

    *tmp = '\0'; // 注意 这样的话后面就取不到完整的文件名了,如果有别的需求,要将字符串的数据复制一份出去

/*
    testString();
    getchar();
    return 0;
*/

    if (numargs < 2)
    {
        help();
        getchar();
        return -1;
    }

    // 默认正常退出 
    int retCode = 0;

    try 
    {
        logMgr = new LogManager();

        // 
        logMgr->createLog("Temporary log", false, true, true); 

        // 解析参数 使用拷贝构造函数
        XmlOptions opts = parseArgs(numargs, args);

        // 日志
        logMgr->setDefaultLog(logMgr->createLog(opts.logFile, false, !opts.quietMode)); 
        // 
        logMgr->destroyLog("Temporary log");

        rgm = new ResourceGroupManager();
        mth = new Math();
        lodMgr = new LodStrategyManager();// level of detail 管理器
        meshMgr = new MeshManager();      // 注册mesh类型
        matMgr = new MaterialManager();
        matMgr->initialise();                // 管理材质
        skelMgr = new SkeletonManager();
        meshSerializer = new MeshSerializer(); // 内存中的mesh数据《-------》硬盘上的mesh文件
        xmlMeshSerializer = new XMLMeshSerializer();
        skeletonSerializer = new SkeletonSerializer(); // skeleton 到文件的转换
        xmlSkeletonSerializer = new XMLSkeletonSerializer();
        bufferManager = new DefaultHardwareBufferManager(); // 缺少渲染系统,所以需要创建出来 

        G_bits::MeshToJson m2j1;

        String outputName;
        bool inputIsDir = false;

        struct _finddata_t   filefind;     

        if (! opts.isDir)
        {
            // 是普通的文件 不是文件夹
            // 设置一下输出文件名
            if (opts.dest != String())
            {
                outputName = opts.dest;

                if (opts.destExt != "js")
                    outputName += ".js";

            }
            else
            {
                if (opts.sourceExt == "xml")
                {
                    // 去掉 .xml 加上.js
                    outputName = opts.source.substr(0, opts.source.size() - 4);
                    outputName += ".js";
                }
                else
                {
                    cout<< "输入文件格式不对,无法解析"<<endl;
                    return 1;

                    // cout<< "无法设置输出文件名,默认是error.js"<<endl;
                    // outputName = "error.js";
                }
            }

        //    visit(String(currentDir)+"models", 1);

            cout<< "input:"<<opts.source<< "  output:"<<outputName<<endl;
            m2j1.exportMesh( String(currentDir)+opts.source, String(currentDir) + outputName);
        }else
        {
            XMLToJson4Dir(currentDir,opts.source);
        }

        cout<< "press any key to exit"<<endl;
        getchar();
        //return 0;

        /*

        if (opts.sourceExt == "mesh")
        {
            meshToXML(opts);
        }
        else if (opts.sourceExt == "skeleton")
        {
            skeletonToXML(opts);
        }
        else if (opts.sourceExt == "xml")
        {
            XMLToBinary(opts);
        }
        else
        {
            cout << "Unknown input type.\n";
            retCode = 1;
        }
        */

    }
    catch(Exception& e)
    {
        cerr << "FATAL ERROR: " << e.getDescription() << std::endl;
        cerr << "ABORTING!" << std::endl;
        retCode = 1;
    }

    delete xmlSkeletonSerializer;
    delete skeletonSerializer;
    delete xmlMeshSerializer;
    delete meshSerializer;
    delete skelMgr;
    delete matMgr;
    delete meshMgr;
    delete bufferManager;
    delete lodMgr;
    delete mth;
    delete rgm;
    delete logMgr;

    return retCode;
}
weitmLzu commented 12 years ago

MeshToJson.h

#ifndef MESH_TO_JSON_H
#define MESH_TO_JSON_H

#include "OgrePrerequisites.h"
// 使用开源的xml处理库
#include "tinyxml.h"

// 使用OGRE提供的String StringUtil等类,也是为了方便,所以这里使用这种方式
using namespace Ogre;

namespace G_bits
{
    struct Bone
    {
        // 这里是图个省事直接就设成public的了
    public:
        String name;
        int id;
        float position[3];
        float rotate[4];
        float scale[4];
    };

    struct keyFrame
    {
    public:
        float time;
        float translate[3];
        float rotate[4];
        float scale[4];

        keyFrame():time(0){}
        ~keyFrame(){}
    };

    struct Track
    {
    public:
        String name;
        std::vector<keyFrame> keys;
    };

    struct Animation
    {
    public:
        String name;
        std::vector<Track> tracks;
        float length;
    };

    struct VertexBoneAssignment
    {
    public:
        int   vertexIndex;
        std::vector<int>   boneIndexes; // 每个顶点最多受4个骨头的影响,默认是-1
        std::vector<float> weights;     // 分别对应4个骨头的权重值,默认是0
    };

    class MeshToJson
    {
    public:

        MeshToJson();
        virtual ~MeshToJson();

        // 为了便于实现,现在是将xml格式的mesh文件导出成为json格式,由mesh格式转化为xml格式可以借助于 OGRE本身的工具
        /** 将xml格式的mesh数据 导出为json文本格式. 
            参数含义:第一个参数是xml文档在内存中的数据结构,第二个参数是输出的json格式的文件名
        */

        void exportMesh(const String& inputFilename, const String& filename);

    protected:

        // 此为xml文件在内存中的数据结构
        TiXmlDocument* mXMLDoc;
    private:
        void readGeometry( const TiXmlElement* e);
        void readSubmeshes( const TiXmlElement* e);
        void readSkeletonInfo(const TiXmlElement* mSubmeshesNode, const String& inputFileName);    

        void readBones(const TiXmlElement* bones);    
        void readBoneHierarchy(const TiXmlElement* boneHierarchy);    
        void readAnimations(const TiXmlElement* animations);
        //void readOneKeyFrame(const TiXmlElement* keyFrame);
        void readBoneAssignments(const TiXmlElement* boneAssignments);
        String generateString();
        String calculateFaces();
        String calculateUVs();
        String calculateSkinWeights();
        String calculateSkinIndices();
        String calculateBones();
        String calculateAnimation();
        String calculateOneHierarchy(String indent, std::vector<Track>::iterator it, int myID);

        // 对应json格式的model结构, 都使用Ogre的String封装
        String mMaterials;

        // 顶点的位置信息 
        String mVertices;
        // 法线
        String mNormals;

        // 面的信息,由于OGRE的face字段中仅有index信息,所以这里用此数据结构来缓存处理的结果 
        // 每个face的3个或4个顶点的索引 分别是一个vector,所有面的vector构成一个大的vector
        std::vector< std::vector<int> > mFaces; // 用空格分开后2个> 避免与>>发生语义冲突

        std::vector< std::vector< std::vector<Real> > > mTextures; //材质信息,每一层分别对应 顶点、材质索引、材质坐标 

        int mTextureCount;
        int mTexCoordCount; // 坐标的个数

        // 以下信息用于计算three.js的faces字段中的type信息,并且会影响一个face所对应的信息的数据结构
        bool isQuad;             // (这里统统设为false 好像OGRE的面都是三角形面片)
        bool hasMaterial;        // 是否有材质,对应属性 <submesh material = ...>
        bool hasFaceUv;
        bool hasFaceVertexUv     ;    // uv坐标,               vertexbuffer 中的texture_coords 属性(指定有几个纹理的坐标)
        bool hasFaceNormal;
        bool hasFaceVertexNormal ;    // 法线信息,这个一般都有用于设置光照的效果, vertexbuffer 中的normals 属性针对此字段(只有顶点法线,没有面法线),所有属性中 

position和normal是不可少的
        bool hasFaceColor;
        bool hasFaceVertexColor  ;   // 颜色信息 这个一般都是没有

        bool hasBoneAssignInfo;
        bool hasBoneHierarchy;
        bool hasAnimation;
        std::vector<Bone> mBones;
        std::map<std::string, std::string> mHierarchy;
        //std::map<std::string, std::map<std::string, std::vector<keyFrame> > > mAnimations;

        std::vector<float> mAnimationLengths;
        // std::vector<std::string> mAnimationNames;

        std::vector<Animation> mAnimations;

        std::vector<VertexBoneAssignment> mAssignments; // 骨骼的分配信息

        std::map<int,int> mId_map;// 里面存的是每个bone所对应的父亲的id
    };

}

#endif
weitmLzu commented 12 years ago

MeshToJson.cpp

#include "MeshToJson.h"

#include "OgreSubMesh.h"
#include "OgreLogManager.h"
#include "OgreSkeleton.h"
#include "OgreStringConverter.h"
#include "OgreHardwareBufferManager.h"
#include "OgreException.h"
#include "OgreAnimation.h"
#include "OgreAnimationTrack.h"
#include "OgreKeyFrame.h"
#include "OgreLodStrategyManager.h"

#include <iostream>

// 尽量都使用Ogre中的数据类型,这样方便使用Ogre中的其他类
using namespace Ogre;
namespace G_bits
{

    MeshToJson::MeshToJson(): isQuad(false), hasMaterial(false),hasFaceUv(false),hasFaceVertexUv(true), hasFaceNormal(false),hasFaceVertexNormal(true),hasFaceColor

(false),hasFaceVertexColor(false),mTextureCount(0),mTexCoordCount(0)
    {
        hasBoneAssignInfo = false;
        hasBoneHierarchy  = false;
        hasAnimation      = false;
    }

    MeshToJson::~MeshToJson()
    {
    }
    void MeshToJson::exportMesh( const String& inputFilename, const String& outputFilename)
    {
        // 注意这个名字要是全名才可以
        TiXmlDocument* mXMLDoc = new TiXmlDocument(inputFilename.c_str());

        if (!mXMLDoc)
        {
            std::cout<<"error ! xml document is null,or the document name is error!"<<std::endl;
            exit(1);
        }
        // 读入并解析出xml文档,文件名在传入指针之前创建
        mXMLDoc->LoadFile();

        const TiXmlElement* elem;

        const TiXmlElement* rootElem = mXMLDoc->RootElement();

        // shared geometry 字段
        elem = rootElem->FirstChildElement("sharedgeometry");
        if (elem)
        {
            // 处理共享顶点信息的情况
            const char *claimedVertexCount_ = elem->Attribute("vertexcount");
            if(!claimedVertexCount_ || StringConverter::parseInt(claimedVertexCount_) > 0)
            {
                // 有共享的顶点时要读进来这些顶点的信息
                readGeometry(elem);
            }
        }

        // submeshes 字段
        elem = rootElem->FirstChildElement("submeshes");
        if (elem)
            // 处理submeshes中的数据
            readSubmeshes(elem);

        // 骨骼 信息
        elem = rootElem->FirstChildElement("skeletonlink");
        if (elem)
            // 处理skeletonlink中的数据
            readSkeletonInfo(elem, inputFilename);

        // 其他的数据字段(如)以后再详细解析

        // 构造字符串
        String s = generateString();

        std::ofstream f;
        f.open(outputFilename.c_str());

        f << s;
        f.flush();
        f.close();

        // 防止内存溢出
        delete mXMLDoc;
        std::cout<<std::endl<<std::endl<<"finish write to outputFilename  " + outputFilename<<std::endl;
    }

    void MeshToJson::readSkeletonInfo(const TiXmlElement* skeleton, const String& inputFileName)    
    {
        std::cout<<"start parse skeleton info" <<std::endl;

        // 取出名字属性
        const char *name = skeleton->Attribute("name");

        String tmp(inputFileName);
        String dir;

        if(name)
        {

            Ogre::vector<String>::type srcparts = StringUtil::split(tmp, "\\");
            String& meshName = srcparts.back(); // 最末尾的
            dir = tmp.substr(0, tmp.size() - meshName.size());// 得到目录名

            dir.append(Ogre::String(name)); // skeleton文件名
            dir += ".xml";                  // xml格式的skeleton

            TiXmlDocument* mXMLDoc = new TiXmlDocument(dir.c_str());

            if (!mXMLDoc)
            {
                std::cout << "error! xml document is null,or the document name is error!" << std::endl;
                std::cout << "error! can't parse skeleton info from the given xml document:"<< dir << std::endl;
                exit(1);
            }

            // 读入并解析出xml文档,文件名在传入指针之前创建
            mXMLDoc->LoadFile();

            const TiXmlElement* elem;

            const TiXmlElement* rootSkeletonEle = mXMLDoc->RootElement();

            // 骨骼定义 字段
            elem = rootSkeletonEle->FirstChildElement("bones");

            if (elem)
            {
                readBones(elem);
            }

            // 骨骼层次结构
            elem = rootSkeletonEle->FirstChildElement("bonehierarchy");

            if (elem)
            {
                readBoneHierarchy(elem);
                hasBoneHierarchy = true;
            }

            // 动画信息
            elem = rootSkeletonEle->FirstChildElement("animations");
            {
                readAnimations(elem);
                hasAnimation      = true;
            }

            delete mXMLDoc;
        }
    }

    void MeshToJson::readBones(const TiXmlElement* bones)    
    {
        Bone tmp;

        for (const TiXmlElement* boneElem = bones->FirstChildElement();
            boneElem != 0; boneElem = boneElem->NextSiblingElement())
        {
            String name = boneElem->Attribute("name");
            int id = StringConverter::parseInt(boneElem->Attribute("id"));
            tmp.name = name;
            tmp.id   = id;

            // 处理bonElem的position
            const TiXmlElement* elemen;

            //const TiXmlElement* rootSkeletonEle = mXMLDoc->RootElement();

            elemen = boneElem->FirstChildElement("position");

            if (elemen)
            {
                tmp.position[0] = StringConverter::parseReal(elemen->Attribute("x"));
                tmp.position[1] = StringConverter::parseReal(elemen->Attribute("y"));
                tmp.position[2] = StringConverter::parseReal(elemen->Attribute("z"));
            }

            elemen = boneElem->FirstChildElement("rotation");

            if (elemen)
            {
                const TiXmlElement* axis;

                axis = elemen->FirstChildElement("axis");

                if (axis)
                {
                    tmp.rotate[0] = StringConverter::parseReal(axis->Attribute("x"));
                    tmp.rotate[1] = StringConverter::parseReal(axis->Attribute("y"));
                    tmp.rotate[2] = StringConverter::parseReal(axis->Attribute("z"));
                }

                // 最后一个是角度 
                tmp.rotate[3] = StringConverter::parseReal(elemen->Attribute("angle"));    
            }

            elemen = boneElem->FirstChildElement("scale");

            if (elemen)
            {
                const char* attr; 

                attr = elemen->Attribute("factor");

                if (attr)
                    tmp.scale[0] = StringConverter::parseReal(attr);
                else
                    // 默认是1
                    tmp.scale[0] = 1.0;

                attr = elemen->Attribute("x");

                if (attr)
                    tmp.scale[1] = StringConverter::parseReal(attr);
                else
                    // 默认是1
                    tmp.scale[1] = 1.0;

                attr = elemen->Attribute("y");

                if (attr)
                    tmp.scale[2] = StringConverter::parseReal(attr);
                else
                    // 默认是1
                    tmp.scale[2] = 1.0;

                attr = elemen->Attribute("z");

                if (attr)
                    tmp.scale[3] = StringConverter::parseReal(attr);
                else
                    // 默认是1
                    tmp.scale[3] = 1.0;
            }
            else
            {
                tmp.scale[0] = 1.0;
                tmp.scale[1] = 1.0;
                tmp.scale[2] = 1.0;
                tmp.scale[3] = 1.0;
            }

            mBones.push_back(tmp);
        } // end of for

        std::cout << "end of parse bones" << std::endl;        
    }

    void MeshToJson::readBoneHierarchy(const TiXmlElement* bonehierarchy)    
    {
        String bone, parent;

        for (const TiXmlElement* boneParent = bonehierarchy->FirstChildElement();
            boneParent != 0; boneParent = boneParent->NextSiblingElement())
        {
            // 依次取出 bone 和 parent
            bone   = boneParent->Attribute("bone");
            parent = boneParent->Attribute("parent");

            mHierarchy.insert(std::pair<std::string, std::string>(bone, parent));
        }

        std::cout << "end of parse hierarchy" << std::endl;        
    }

    void MeshToJson::readAnimations(const TiXmlElement* animations)    
    {

        for (const TiXmlElement* animation = animations->FirstChildElement();
            animation != 0; animation = animation->NextSiblingElement())
        {
            // 依次处理每个animation
            String aniName = animation->Attribute("name");
            float length   = StringConverter::parseReal(animation->Attribute("length"));

            // 先存一下动画的长度
            mAnimationLengths.push_back(length);

            Animation oneAnimation;
            oneAnimation.length = length;
            // 跳过tracks
            const TiXmlElement* tracks = animation->FirstChildElement();
            std::vector<Track> Tracks;

            for (const TiXmlElement* track = tracks->FirstChildElement();
                track != 0; track = track->NextSiblingElement())
            {
                // 处理每一个track
                Track OneTrack;

                String boneName  = track->Attribute("bone");

                std::vector<keyFrame> keys;

                const TiXmlElement* keyframes = track->FirstChildElement();

                for (const TiXmlElement* keyframe = keyframes->FirstChildElement();
                    keyframe != 0; keyframe = keyframe->NextSiblingElement())
                {
                    // 处理每一个keyframe
                    keyFrame kf;
                    const char  *ss = keyframe->Attribute("time");

                    if (ss)
                    {
                        // 这里还是有一些问题
                        float tt = StringConverter::parseReal(ss); 
                        kf.time = tt;
                    }
                    const TiXmlElement* elemen;

                    elemen = keyframe->FirstChildElement("translate");

                    // 取出关键帧中的translate属性
                    if (elemen)
                    {
                        kf.translate[0] =  StringConverter::parseReal(elemen->Attribute("x"));
                        kf.translate[1] =  StringConverter::parseReal(elemen->Attribute("y"));
                        kf.translate[2] =  StringConverter::parseReal(elemen->Attribute("z"));                        
                    }

                    elemen = keyframe->FirstChildElement("rotate");

                    // rotate属性
                    if (elemen)
                    {
                        const TiXmlElement* axis;

                        axis = elemen->FirstChildElement("axis");

                        if (axis)
                        {
                            kf.rotate[0]  = StringConverter::parseReal(axis->Attribute("x"));
                            kf.rotate[1]  = StringConverter::parseReal(axis->Attribute("y"));
                            kf.rotate[2]  = StringConverter::parseReal(axis->Attribute("z"));
                        }

                        kf.rotate[3] = StringConverter::parseReal(elemen->Attribute("angle"));
                    }

                    elemen = keyframe->FirstChildElement("scale");

                    if (elemen)
                    {
                        const char* attr; 

                        attr = elemen->Attribute("factor");

                        if (attr)
                            kf.scale[0]  = StringConverter::parseReal(attr);
                        else
                            // 默认是1
                            kf.scale[0] = 1.0;

                        attr = elemen->Attribute("x");

                        if (attr)
                            kf.scale[1] = StringConverter::parseReal(attr);
                        else
                            // 默认是1
                            kf.scale[1] = 1.0;

                        attr = elemen->Attribute("y");

                        if (attr)
                            kf.scale[2] = StringConverter::parseReal(attr);
                        else
                            // 默认是1
                            kf.scale[2] = 1.0;

                        attr = elemen->Attribute("z");

                        if (attr)
                            kf.scale[3] = StringConverter::parseReal(attr);
                        else
                            // 默认是1
                            kf.scale[3] = 1.0;
                    }
                    else
                    {
                        kf.scale[0] = 1.0;
                        kf.scale[1] = 1.0;
                        kf.scale[2] = 1.0;
                        kf.scale[3] = 1.0;
                    }

                    keys.push_back(kf);
                }

                OneTrack.name = boneName;
                OneTrack.keys = keys;
                Tracks.push_back(OneTrack);

            } 

            oneAnimation.name = aniName;
            oneAnimation.tracks = Tracks;

            mAnimations.push_back(oneAnimation);
            //mAnimations.insert(std::pair<String, Animation>(aniName, oneAnimation));

        }// 整个animation结束

        std::cout << std::endl;
        std::cout<< "*************************************************************" << std::endl;
        //std::cout << mAnimations <<std::endl;

    }
/*
    void MeshToJson::readOneKeyFrame(const TiXmlElement* keyFrame)    
    {
        // 处理每一个keyframe
                    keyFrame kf;
                    const char  *ss = keyframe->Attribute("time");

                    if (ss)
                    {
                        // 这里还是有一些问题
                        float tt = StringConverter::parseReal(ss); 
                        kf.time = tt;
                    }
                    const TiXmlElement* elemen;

                    elemen = keyframe->FirstChildElement("translate");

                    // 取出关键帧中的translate属性
                    if (elemen)
                    {
                        kf.translate[0] =  StringConverter::parseReal(elemen->Attribute("x"));
                        kf.translate[1] =  StringConverter::parseReal(elemen->Attribute("y"));
                        kf.translate[2] =  StringConverter::parseReal(elemen->Attribute("z"));                        
                    }

                    elemen = keyframe->FirstChildElement("rotate");

                    // rotate属性
                    if (elemen)
                    {
                        const TiXmlElement* axis;

                        axis = elemen->FirstChildElement("axis");

                        if (axis)
                        {
                            kf.rotate[0]  = StringConverter::parseReal(axis->Attribute("x"));
                            kf.rotate[1]  = StringConverter::parseReal(axis->Attribute("y"));
                            kf.rotate[2]  = StringConverter::parseReal(axis->Attribute("z"));
                        }

                        kf.rotate[3] = StringConverter::parseReal(elemen->Attribute("angle"));
                    }

                    elemen = keyframe->FirstChildElement("scale");

                    if (elemen)
                    {
                        const char* attr; 

                        attr = elemen->Attribute("factor");

                        if (attr)
                            kf.scale[0]  = StringConverter::parseReal(attr);
                        else
                            // 默认是1
                            kf.scale[0] = 1.0;

                        attr = elemen->Attribute("x");

                        if (attr)
                            kf.scale[1] = StringConverter::parseReal(attr);
                        else
                            // 默认是1
                            kf.scale[1] = 1.0;

                        attr = elemen->Attribute("y");

                        if (attr)
                            kf.scale[2] = StringConverter::parseReal(attr);
                        else
                            // 默认是1
                            kf.scale[2] = 1.0;

                        attr = elemen->Attribute("z");

                        if (attr)
                            kf.scale[3] = StringConverter::parseReal(attr);
                        else
                            // 默认是1
                            kf.scale[3] = 1.0;
                    }
                    else
                    {
                        kf.scale[0] = 1.0;
                        kf.scale[1] = 1.0;
                        kf.scale[2] = 1.0;
                        kf.scale[3] = 1.0;
                    }

                    keys.push_back(kf);
    }
    */
    void MeshToJson::readSubmeshes(const TiXmlElement* mSubmeshesNode)    
    {
        std::cout<<"start parse submeshes"<<std::endl;

        // 处理每一个submesh节点 
        for (const TiXmlElement* smElem = mSubmeshesNode->FirstChildElement();
            smElem != 0; smElem = smElem->NextSiblingElement())
        {
            const char* mat = smElem->Attribute("material");

            if (mat)
            {
                // 设置材质名
                mMaterials  = String(mat);
                hasMaterial = true;
            }

            // Read operation type
            bool readFaces = true;

            bool useInfoFromShared = false;
            const char* tmp = smElem->Attribute("usesharedvertices");
            if (StringConverter::parseBool( String(tmp)))
                // 使用共享的顶点信息
                useInfoFromShared = true;

            // 取出faces信息
            const TiXmlElement* faces = smElem->FirstChildElement("faces");

            int actualCount = 0;

            for (const TiXmlElement *faceElem = faces->FirstChildElement(); faceElem != 0; faceElem = faceElem->NextSiblingElement())
            {
                    actualCount++;
            }
            const char *claimedCount_ = faces->Attribute("count");

            // 检查面的个数是否正确
            if (claimedCount_ && StringConverter::parseInt(claimedCount_)!=actualCount)
            {
                LogManager::getSingleton().stream()
                    << "WARNING: face count (" << actualCount << ") " <<
                    "is not as claimed (" << claimedCount_ << ")";
            }

            const char* optype = smElem->Attribute("operationtype");
            RenderOperation::OperationType ot;

            // 查出是何种渲染操作
            if (optype)
            {
                if (!strcmp(optype, "triangle_list"))
                {
                    ot = RenderOperation::OT_TRIANGLE_LIST;
                }
                else if (!strcmp(optype, "triangle_fan"))
                {
                    ot = RenderOperation::OT_TRIANGLE_FAN;
                }
                else if (!strcmp(optype, "triangle_strip"))
                {
                    ot = RenderOperation::OT_TRIANGLE_STRIP;
                }
                else if (!strcmp(optype, "line_strip"))
                {
                    ot = RenderOperation::OT_LINE_STRIP;
                    readFaces = false;
                }
                else if (!strcmp(optype, "line_list"))
                {
                    ot = RenderOperation::OT_LINE_LIST;

                }
                else if (!strcmp(optype, "point_list"))
                {
                    ot = RenderOperation::OT_POINT_LIST;
                    readFaces = false;
                }

            }

            size_t indexCount;

            if (actualCount > 0)
            {
                // 根据渲染操作的类型, 计算索引数
                switch(ot)
                {
                case RenderOperation::OT_TRIANGLE_LIST:
                    // 3角形列表直接乘3
                    indexCount = actualCount * 3;

                    break;
                case RenderOperation::OT_LINE_LIST:
                    // 直线数组
                    indexCount = actualCount * 2;

                    break;
                case RenderOperation::OT_TRIANGLE_FAN:
                case RenderOperation::OT_TRIANGLE_STRIP:
                    // triangle fan or triangle strip 都是利用另外2个索引来形成3角形
                    indexCount = actualCount + 2;

                    break;
                default:
                    OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "operationType not implemented", 
                        __FUNCTION__);
                }

                unsigned int *pInt = 0;
                unsigned short *pShort = 0;

                // 3个索引值
                int v1,v2,v3;

                const TiXmlElement* faceElem;
                bool firstTri = true;

                // 处理每个face的每个顶点                            
                for (faceElem = faces->FirstChildElement();
                    faceElem != 0; faceElem = faceElem->NextSiblingElement())
                {
                    std::vector<int> indexes;

                    v1 = StringConverter::parseInt(String(faceElem->Attribute("v1")), 0);
                    indexes.push_back(v1);

                    if(ot == RenderOperation::OT_LINE_LIST)
                    {
                        v2 = StringConverter::parseInt(String(faceElem->Attribute("v2")), 0);
                        indexes.push_back(v2);

                        /*
                        v2 = String(faceElem->Attribute("v2"));
                        mIndexes +=     ",";
                        mIndexes +=     v2;
                        */
                    }
                    // only need all 3 vertices if it's a trilist or first tri
                    else if (ot == RenderOperation::OT_TRIANGLE_LIST || firstTri)
                    {
                        v2 = StringConverter::parseInt(String(faceElem->Attribute("v2")), 0);
                        v3 = StringConverter::parseInt(String(faceElem->Attribute("v3")), 0);

                        indexes.push_back(v2);
                        indexes.push_back(v3);
                        /*
                        v2 = String(faceElem->Attribute("v2"));
                        v3 = String(faceElem->Attribute("v3"));
                        mIndexes +=     ",";
                        mIndexes +=     v2;
                        mIndexes +=     ",";
                        mIndexes +=     v3;
                        */
                    }
                    mFaces.push_back(indexes); // 是否可以用这种引用的方式来传递数据呢?如果不行可能会引起崩溃
                    indexes.clear();
                }// end of for

            }// end of if

            // submesh 第一部分处理的是面的索引,下一步是处理顶点的属性信息
            if (! useInfoFromShared)
            {
                const TiXmlElement* geomNode = smElem->FirstChildElement("geometry");
                if (geomNode)
                {

                    // 处理几何信息(渲染的数据相关部分,material可以认为是渲染的显示相关部分)
                    readGeometry(geomNode);
                }
            }

            // 处理骨骼信息
            const TiXmlElement* boneAssignments = smElem->FirstChildElement("boneassignments");

            if (boneAssignments)
            {
                readBoneAssignments(boneAssignments);
                hasBoneAssignInfo = true;
            }

        } // 一个submesh处理结束

        std::cout<<"finished parse  submeshes"<<std::endl;
    }

    // 骨骼信息
    void MeshToJson::readBoneAssignments(const TiXmlElement* boneAssignments)
    {
        int index = 0;
        int boneIndex;
        int tmp;

        float weight;

        std::vector<int>   boneIndexes;
        std::vector<float> weights;

        const TiXmlElement* vertexBoneAssignment = boneAssignments->FirstChildElement();
        index = StringConverter::parseInt(vertexBoneAssignment->Attribute("vertexindex"));

        for ( ; vertexBoneAssignment != 0; vertexBoneAssignment = vertexBoneAssignment->NextSiblingElement())
        {
            // 依次处理每一个vertexBoneAssignment

            tmp       = StringConverter::parseInt(vertexBoneAssignment->Attribute("vertexindex"));
            boneIndex = StringConverter::parseInt(vertexBoneAssignment->Attribute("boneindex"));
            weight    = StringConverter::parseReal(vertexBoneAssignment->Attribute("weight"));

            if (tmp == index)
            {
                // 索引相同直接加进来就好
                boneIndexes.push_back(boneIndex);    
                weights.push_back(weight);
            }
            else
            {
                // 换顶点了,将原来顶点的数据整理出来
                std::vector<int>   bI;
                std::vector<float> ws;

                std::vector<int>::iterator iter;

                // 把数据复制出来
                for(iter = boneIndexes.begin();iter != boneIndexes.end(); iter++)
                {
                    bI.push_back(*iter);
                }

                std::vector<float>::iterator it;

                // 把数据复制出来
                for(it = weights.begin();it != weights.end(); it++)
                {
                    ws.push_back(*it);
                }

                VertexBoneAssignment vba;
                vba.boneIndexes = bI;
                vba.weights     = ws;
                vba.vertexIndex = index;

                // 放进来
                mAssignments.push_back(vba);

                // 清空
                boneIndexes.clear();
                weights.clear();

                // 把此次的数据放进来
                boneIndexes.push_back(boneIndex);    
                weights.push_back(weight);

            }

            // 更新索引
            index = tmp;

        }

        // 最后一个顶点的分配信息
        VertexBoneAssignment vba;
        vba.boneIndexes = boneIndexes;
        vba.weights     = weights;
        vba.vertexIndex = index;
        mAssignments.push_back(vba);
    }

    // 读出顶点的信息
    void MeshToJson::readGeometry(const TiXmlElement* mGeometryNode)
    {
        String tmp;
        bool hasTextureInfo = false;

        std::vector< std::vector<Real> > vertexTexture; // 针对一个vertex

        // 处理每一个vertexBuffer,每一个vertexbuffer实际上代表vertex的一个类别,比如代表位置、法线信息的vertex; 或者是代表纹理信息的vertex
        // texture_coords 属性 代表有几个纹理的坐标,如 
        // texture_coord_dimensions_0 属性 代表各个texture坐标的格式,如 <vertexbuffer texture_coord_dimensions_0="2" texture_coords="1">
        for (const TiXmlElement* vbNode = mGeometryNode->FirstChildElement();
                vbNode != 0; vbNode = vbNode->NextSiblingElement())
        {
            hasTextureInfo = false;
            if (vbNode->Attribute("texture_coords"))
            {
                mTextureCount = StringConverter::parseInt( String(vbNode->Attribute("texture_coords")) );
                hasTextureInfo = true;
            }

            // 处理每一个vertex
            for (const TiXmlElement* vertexNode = vbNode->FirstChildElement();
                vertexNode != 0; vertexNode = vertexNode->NextSiblingElement())
            {
                // 处理每一个dataNode
                for (const TiXmlElement* dataNode = vertexNode->FirstChildElement();
                    dataNode != 0; dataNode = dataNode->NextSiblingElement())
                {
                    const char* elementName = dataNode->Value();
                    String tmp(elementName);

                    if (tmp == String("position"))
                    {
                        // 此节点是位置信息,记录下来3个坐标的信息
                        mVertices += ",";
                        mVertices +=  dataNode->Attribute("x"); // 注意最后输出时要去掉开头的逗号,

                        mVertices += ",";
                        mVertices +=  dataNode->Attribute("y");

                        mVertices += ",";
                        mVertices +=  dataNode->Attribute("z");

                    }else if (tmp == String("normal"))
                    {
                        // 法线信息
                        mNormals += ",";
                        mNormals +=  dataNode->Attribute("x"); // 注意最后输出时要去掉开头的逗号,

                        mNormals += ",";
                        mNormals +=  dataNode->Attribute("y");

                        mNormals += ",";
                        mNormals +=  dataNode->Attribute("z");

                    }else if (tmp ==  String("colour_diffuse"))
                    {
                        // 漫反射颜色值

                    }else if (tmp == String("colour_specular"))
                    {
                        // 高光颜色值
                    }else if (tmp == String("texcoord"))
                    {
                        // 纹理坐标值 最少是含有一个值的一位坐标
                        if (!dataNode->Attribute("u") || !dataNode->Attribute("v"))
                            // Three.js 中使用的材质坐标都是uv格式的二维坐标
                            std::cout<<"UV texture coordinate is error"<< std::endl;

                        std::vector<Real> uvs; 
                        Real uv;

                        uv =StringConverter::parseReal(String(dataNode->Attribute("u")), 0);
                        uvs.push_back(uv);
                        uv =StringConverter::parseReal(String(dataNode->Attribute("v")), 0);
                        uvs.push_back(uv);

                        // 记录下来一层纹理坐标的值
                        vertexTexture.push_back(uvs);

                        uvs.clear();
                    }
                } // end of dataNode

                // 一个顶点的所有的材质坐标处理结束,加入到mTextures中
                if(hasTextureInfo)
                {
                    mTextures.push_back(vertexTexture);// 
                    vertexTexture.clear();
                }
            }// end of vertexNode
        }// end of vertexBuffer

    }

    String MeshToJson::generateString()
    {
        String ret, tmp;
        //String vertexes, morphTargets, normals, colors, uvs, edges, faces;

        // three.js 所使用的model文件的组成如下
        // vertexes morphTargets normals       colors        uvs           edges         faces

        // 去掉开头的逗号
        mVertices.replace(0,1,String()); 
        mNormals.replace(0,1,String()); 

        ret += "/* 将OGRE的mesh、skeleton格式转成json的model格式,使用自己开发的小工具 ,created by weitm*/\n\n";
        ret += "var model = { \n\n";   
        ret += " \"version\" : 2,\n\n";       // 版本信息统一设置成2
        ret += " \"scale\"   : 0.1000000,\n\n"; // 伸缩比默认是0.1,否则模型显得太小了

        // material相关的现在是设成默认的
        ret += " \"materials\": [ { \n";
        ret += "\"DbgColor\" : 15658734,\n";
        ret += "\"DbgIndex\" : 0,\n";
        if (mMaterials != String())
        {
            ret += "\"DbgName\" : ";
            ret += "\"";
            ret += mMaterials;
            ret += "\",\n";
            // ret += ("\"DbgName\" : " +"\""+ mMaterials + "\",\n");
        }
        else
            ret += "\"DbgName\" : \"Material.001\",\n"; // 默认的材质名
        ret += "\"colorAmbient\" : [0.0, 0.0, 0.0],\n";    
        ret += "\"colorDiffuse\" : [0.5332959254577148, 0.00743219341981699, 0.00743219341981699],\n";    
        ret += "\"colorSpecular\" : [0.5, 0.5, 0.5],\n";
        ret += "\"shading\" : \"Lambert\",\n";
        ret += "\"specularCoef\" : 50,\n";
        ret += "\"transparency\" : 1.0,\n";
        ret += "\"vertexColors\" : false\n";
        ret += "}],\n\n";

        // 顶点的坐标信息
        ret += "\"vertices\": [";
        ret += mVertices;
        ret += "],\n\n";

        // 变形信息目前为空,因为OGRE的mesh文件中不包含此类信息
        ret += "\"morphTargets\": [],\n\n";

        // 法线坐标
        ret += "\"normals\":[";
        ret += mNormals;
        ret += "],\n\n";

        // 颜色信息目前也不设置
        ret += "\"colors\": [],\n\n";

        // 纹理坐标
        ret += "\"uvs\": ";
        tmp = calculateUVs();
        ret += tmp;
        ret += ",\n\n";
        // 面信息
        ret += "\"faces\": [";
        tmp = calculateFaces();
        ret += tmp;
        //std::cout<< "面信息"<<std::endl;
        //std::cout<< tmp<<std::endl;

        ret += "],\n\n";

        // skinWeights
        tmp = calculateSkinWeights();
        ret += tmp;

        // skinIndices
        tmp = calculateSkinIndices();
        ret += tmp;

        // bones
        tmp = calculateBones();
        ret += tmp;

        ret += "\n";

        // animation
        tmp = calculateAnimation();
        ret += tmp;

        // 边
        ret += "\"edges\" : []\n\n";    

        // model数据结束
        ret += "};\n\n";

        ret += "postMessage( model );\n";
        ret += "close();\n";

        // material 信息先设成默认的
        //std::cout<< "*******************************************************************************************************************************"<<std::endl;
        // std::cout<< ret<<std::endl;
        //std::cout<< "结束"<<std::endl;
        return ret;
    }

    // 皮肤权重,统一成4个元素,没有时设置成0
    String MeshToJson::calculateSkinWeights() 
    {
        int count = 0;
        String ret, tmp;

        std::ostringstream weights;
        std::vector<float> ws;

        if (! hasBoneAssignInfo)
            return ret;

        ret += "\"skinWeights\":[";    

        std::vector<VertexBoneAssignment>::iterator iter;

        for(iter = mAssignments.begin(); iter != mAssignments.end(); iter++)
        {
            count = 0;
            ws = iter->weights;

            std::vector<float>::iterator it;

            // 把每个数据传进来
            for(it = ws.begin(); it != ws.end(); it++)
            {
                weights << "," << *it ;
                count++;
            }

            while(count < 4)
            {
                weights << ",0";// 确保有4个
                count++;
            }
        }

        tmp = String(weights.str());

        // 去掉开头的逗号
        tmp.replace(0,1,String()); 

        ret += tmp;

        ret += "],\n\n";

        return ret;
    }

    // 每个顶点最多受4个骨头的影响,不够4个时默认是-1
    String MeshToJson::calculateSkinIndices() 
    {
        String ret, tmp;

        int count = 0;

        std::ostringstream indices;
        std::vector<int> is;

        if (! hasBoneAssignInfo)
            return ret;

        ret += "\"skinIndices\":[";

        std::vector<VertexBoneAssignment>::iterator iter;

        for(iter = mAssignments.begin(); iter != mAssignments.end(); iter++)
        {
            count = 0;
            is = iter->boneIndexes;

            std::vector<int>::iterator it;

            // 把每个数据传进来
            for(it = is.begin(); it != is.end(); it++)
            {
                indices << "," << *it ;
                count++;
            }

            while(count < 4)
            {
                indices << ",-1";// 确保有4个,不足4个的时候用-1补足
                count++;
            }
        }

        tmp = String(indices.str());

        // 去掉开头的逗号
        tmp.replace(0,1,String()); 

        ret += tmp;

        ret += "],\n\n";

        return ret;
    }

    // 骨骼信息
    String MeshToJson::calculateBones() 
    {
        String ret, tmp, myName, parentName;

        int count = 0, index = 0;
        int myID = -1, parentID = -1;

        std::ostringstream bone_str;
        std::vector<int> is;

        if (! hasBoneHierarchy)
            return ret;
        /*
        myName = String("hello");
        if (myName == String("hello"))
            std::cout<<"that is OK!"<<std::endl;
*/
        ret += "\t\"bones\":[\n\n";

        std::map<std::string, std::string>::iterator iter;

        for(iter = mHierarchy.begin(); iter != mHierarchy.end();iter++)
        {
            myName     = iter->first;
            parentName = iter->second;
            std::vector<Bone> ::iterator it;

            index = 0;// 初始化下标索引

            for(it = mBones.begin(); it!= mBones.end(); it++)
            {
                // 找出自己的id
                if (it->name == myName)
                {
                    myID = index;

                }

                // 找出parent的id
                if (it->name == parentName)
                {
                    parentID = index;

                }

                index++;
            }

            // 存入id_map
            mId_map.insert(std::pair<int, int>(myID, parentID));
            //mHierarchy.insert(std::pair<std::string, std::string>(bone, parent));

        }

        std::vector<Bone> ::iterator it;

        for(it = mBones.begin(); it!= mBones.end(); it++)
        {
            int tmp1 = it->id;
            int tmp2 = -1;

            std::map<int, int>::iterator iterI;
            for(iterI = mId_map.begin(); iterI != mId_map.end();iterI++)
            {
                // 找到父亲在bones中的id
                if (tmp1 == iterI->first)
                {
                    tmp2 = iterI->second;
                    break; // 找到了就可以退出了
                }

            }

            bone_str << "\t\t{// id: " << tmp1 <<","   <<"\n\t\t\t";
            bone_str << "parent: " << tmp2  <<"," <<"\n\t\t\t";
            bone_str << "name: \""  << it->name << "\","<<"\n\t\t\t";
            bone_str << "pos: ["  << it->position[0] << "," << it->position[1] <<"," <<it->position[2]<< "],"<<"\n\t\t\t";
            bone_str << "scl: ["  << it->scale[1] << "," << it->scale[2] <<"," <<it->scale[3]<< "],"<<"\n\t\t\t";

            // 这里先不计算rot
            // rotq的内容依次是 xyz angle
            bone_str << "rotq: ["  << it->rotate[0] << "," << it->rotate[1] <<"," <<it->rotate[2] <<"," <<it->rotate[3] << "],"<<"\n\t\t";
            bone_str << "},"  <<"\n\n";
        }

        tmp = String(bone_str.str());

        // 去掉最后的逗号和2个回车
        tmp.replace(tmp.size() - 3,3,String());     

        ret += tmp;
        ret += "\n\n\t],";

        return ret;
    }

    String MeshToJson::calculateAnimation() 
    {
        String ret, tmp, aniName, parentName, indent,tmp1, tmp2;
        int index = 0;

        if (! hasAnimation)
            return ret;

        ret += "\t\"animations\":{\n\n";

        std::vector<Animation> ::iterator iter;

        for(iter = mAnimations.begin(); iter != mAnimations.end();iter++)
        {
            // 依次处理每一个animation
            index = 0;
            std::ostringstream oneAnimation;

            aniName = iter->name;
            oneAnimation << "\t\t\"" << aniName <<"\":{\n";
            indent = "\t\t\t";

            oneAnimation << indent << " name: \"" << aniName <<"\",\n";
            oneAnimation << indent << " fps: " << "30" <<",\n";    // 这里fps设为恒定的,因为OGRE的数据里面没有这个
            oneAnimation << indent << " length: " << iter->length <<",\n";
            oneAnimation << indent << " JIT: " << "undefined"<<",\n\n";

            oneAnimation << indent << " hierarchy: [" <<"\n";

            tmp  = String(oneAnimation.str());
            ret += tmp;

            // 处理每一个track的keys
            std::vector<Track>::iterator it;
            for(it = iter->tracks.begin(); it != iter->tracks.end();it++)
            {
                indent = "\t\t\t\t";
                ret += indent;
                ret += "{\n";

                // oneAnimation << indent << "{" <<"\n";

                tmp1 = calculateOneHierarchy(indent, it, mBones.at(index).id);
                ret += tmp1;

                ret += indent;
                ret += "},\n";
                //oneAnimation << indent << "}," <<"\n";
                index++;
            }
/*
            oneAnimation << "\t\t\t" <<" ]," <<"\n";
            oneAnimation << "\t\t},"; // 与一个animation的数据相对应

            // 字符串太大时会有问题,所以把每个animation单独导出来
            tmp  = String(oneAnimation.str());
            ret += tmp;
            oneAnimation.flush();
            */
            ret += "\t\t\t ], \n";
            ret += "\t\t},";
        }

        ret += "\n\t},"; // 整个animations结束
        return ret;

    }

    String MeshToJson::calculateOneHierarchy(String indent, std::vector<Track>::iterator it, int myID)
    {
        String ret;

        std::ostringstream hierarchy;

        int tmp1,tmp2;

        tmp1 = myID;
        tmp2 = -1;  // 默认是无父亲的
        std::map<int, int>::iterator iterI;
        for(iterI = mId_map.begin(); iterI != mId_map.end();iterI++)
        {
            // 找到父亲在bones中的id
            if (tmp1 == iterI->first)
            {
                tmp2 = iterI->second;
                break; // 找到了就可以退出了
            }
        }

        hierarchy<< indent << "\t" << "parent: " << tmp2 << ", // Id: " << tmp1 << "\n";

        hierarchy<< indent << "\t" << "keys: [" << "\n";

        std::vector<keyFrame> ::iterator iter;
        for(iter = it->keys.begin() ; iter != it->keys.end();iter++)
        {
            hierarchy<< indent << "\t\t {\n";
            hierarchy<< indent << "\t\t\t time:" << iter->time << ",\n";

            hierarchy<< indent << "\t\t\t pos:[ " << iter->translate[0] << ","<<iter->translate[1] << "," << iter->translate[2] << " ],\n";
            hierarchy<< indent << "\t\t\t rot:[ " << iter->rotate[0] << ","<<iter->rotate[1] << "," << iter->rotate[2] << "," << iter->rotate[3] << " ],\n";
            hierarchy<< indent << "\t\t\t scl:[ " <<iter->scale[1] << "," << iter->scale[2] << "," << iter->scale[3]<< " ],\n"; // 后3部分是各个方向上的伸缩比例
            hierarchy<< indent << "\t\t },\n";
        }

        hierarchy << indent << "\t" << "]" << "\n";

        ret = String(hierarchy.str());

        return ret;

    }

    // 根据前面解析出的信息构造成面的信息
    String MeshToJson::calculateFaces()
    {
        String ret, tmp;
        // Json模型的face的格式 第一个数是type 决定一个face的数据的构成,其有8个开关来构成 
        // 各个开关依次是 isQuad(对应2的0次方)、hasMaterial、hasFaceUvs、hasFaceVertexUvs、hasFaceNormals、hasFaceVertexNormals、hasFaceColors、hasFaceVertexColors

        // 解析出type的数值 
        int type = 0;
        if (isQuad)
            type += 1;
        if (hasMaterial)
            type += 2;
        if (hasFaceUv)
            type += 4;
        if (hasFaceVertexUv)
            type += 8;
        if (hasFaceNormal)
            type += 16;
        if (hasFaceVertexNormal)
            type += 32;
        if (hasFaceColor)
            type += 64;
        if (hasFaceVertexColor)
            type += 128;

        std::ostringstream faces;

        int vertexNum;

        if(isQuad)
        {
            vertexNum = 4;
        }
        else
        {
            vertexNum = 3;
        }

        // 处理每一个face的数据
        for(int i = 0; i != mFaces.size(); i++)
        {    
            // type信息
            faces << ",";
            faces << type;

            // 输出每个顶点索引的值
            for(int j = 0; j < vertexNum;j++)
            {
                faces << ",";
                faces << mFaces[i][j];
            }

            // 材质索引
            if (hasMaterial)
            {
                faces << ",";

                // 暂时还不做具体解析
                faces << 0;
            }

            // 面UV
            if (hasFaceUv)
            {
                faces << ",";

                // OGRE中好像不用
                faces << 0;
            }

            // 顶点UV,这个需要详细的去设置
            if (hasFaceVertexUv)
            {
                // 处理每一层UV
                for(int uvIndex = 0; uvIndex != mTextureCount; uvIndex++)
                {
                    // 每个顶点
                    for(int vertexIndex = 0; vertexIndex < vertexNum;vertexIndex++)
                    {
                        faces << ",";

                        // 顶点的索引和纹理的索引恰好是一致的,所以这里用顶点的索引值作为纹理的坐标索引值
                        faces << mFaces[i][vertexIndex];
                    }                
                }
            }

            // 面法线
            if (hasFaceNormal)
            {
                faces << ",";

                // OGRE中好像不用
                faces << 0;
            }

            // 顶点法线
            if (hasFaceVertexNormal)
            {

                // OGRE中的顶点索引和normal索引是一样的,所以这里仅仅是复制一下就好
                for(int j = 0; j < vertexNum;j++)
                {
                    faces << ",";
                    faces << mFaces[i][j];
                }
            }

            // 面颜色
            if (hasFaceColor)
            {
                faces << ",";

                // OGRE中好像不用
                faces << 0;
            }

            // 顶点颜色
            if (hasFaceVertexColor)
            {
                faces << ",";

                // OGRE中好像不用
                faces << 0;
            }
        }

        ret = String(faces.str());

        // 去掉开头的逗号
        ret.replace(0,1,String()); 
        return ret;
    }

    // 构建纹理坐标的数据
    String MeshToJson::calculateUVs()
    {
        String ret, tmp;
        bool firstUV = false;
        // 借助string流 
        std::ostringstream uvs, uv;    

        uvs << "[";

        // 处理每一层UV
        for(int uvIndex = 0; uvIndex != mTextureCount; uvIndex++)
        {
            firstUV = false;

            if (uvIndex == 0)
                firstUV = true;

            if (firstUV)
                uvs << "[";
            else
                uvs << ",[";

            // 每一个顶点
            for(int vertexIndex = 0; vertexIndex != mTextures.size(); vertexIndex++)
            {
                for(int coordinateIndex = 0; coordinateIndex!= mTextures[vertexIndex][uvIndex].size(); coordinateIndex++)
                {
                    uv << ",";
                    uv << mTextures[vertexIndex][uvIndex][coordinateIndex];
                }

            }

            tmp = uv.str();
            tmp.replace(0,1,String()); 

            // 加进来一层的数据
            uvs << tmp;
            uvs << "]";
        }

        uvs << "]";

        ret = uvs.str();
        return ret;
    }

}
weitmLzu commented 12 years ago

That's all. I try to convert OGRE's material script to Json that Three.js can recognize too, but I fail. Maybe OGRE's material script is too complex.

alteredq commented 12 years ago

Does it work? Do you have a running example with animated skinned mesh from OGRE in three.js?

Are coordinate systems the same between OGRE and three.js? Also seems like OGRE uses axis+angle for bone rotations while three.js uses quaternions.

If we would know OGRE skinning is compatible with ours, it may make sense to create some easier pipeline, for example OGRELoader that could load directly OGRE XMLs, or have Python script for converting OGRE XML into our JSONs.

weitmLzu commented 12 years ago

No, the Converter works,but the skinning mesh converted by it does't work. axis+angle is similar to quaternions and I think OGRE skinning is compatible with Three.js because the resources are all built wih 3dMax、maya、blender...

mrdoob commented 12 years ago

So seems like @alteredq managed to get this working already :D http://alteredqualia.com/three/examples/webgl_animation_skinning_tf2.html

K1ll3rF0x commented 12 years ago

@alteredq Good to see that skeletal animation has been improved again :) It would be also great to have it working properly with animated collada models loaded with ColladaLoader.