test_scene.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. var scene = {
  2. "type" : "scene",
  3. "urlBaseType" : "relativeToHTML",
  4. "objects":
  5. {
  6. "cube1" : {
  7. "geometry" : "cube",
  8. "materials": [ "lambert_red" ],
  9. "position" : [ 0, 0, 0 ],
  10. "rotation" : [ 0, -0.3, 0 ],
  11. "scale" : [ 1, 1, 1 ],
  12. "visible" : true
  13. },
  14. "cube2" : {
  15. "geometry" : "cube",
  16. "materials": [ "basic_white" ],
  17. "position" : [ 0, 0, 0 ],
  18. "rotation" : [ 0, -0.3, 0 ],
  19. "scale" : [ 2, 2, 2 ],
  20. "visible" : true
  21. },
  22. "cube3" : {
  23. "geometry" : "cube",
  24. "materials": [ "minecraft" ],
  25. "position" : [ -30, -5, 25 ],
  26. "rotation" : [ 0, 0.8, 0 ],
  27. "scale" : [ 1, 1, 1 ],
  28. "visible" : true
  29. },
  30. "sphere_lambert" : {
  31. "geometry" : "sphere",
  32. "materials": [ "lambert_green" ],
  33. "position" : [ -20, -5, 15 ],
  34. "rotation" : [ 0, 0, 0 ],
  35. "scale" : [ 1, 1, 1 ],
  36. "visible" : true
  37. },
  38. "sphere_refraction" : {
  39. "geometry" : "sphere",
  40. "materials": [ "basic_refraction" ],
  41. "position" : [ 50, 45, -50 ],
  42. "rotation" : [ 0, 0, 0 ],
  43. "scale" : [ 1, 1, 1 ],
  44. "visible" : true
  45. },
  46. "icosahedron" : {
  47. "geometry" : "icosahedron",
  48. "materials": [ "faceted_white" ],
  49. "position" : [ 20, 10, -60 ],
  50. "rotation" : [ 0, 0, 0 ],
  51. "scale" : [ 20, 20, 20 ],
  52. "visible" : true
  53. },
  54. "torus" : {
  55. "geometry" : "torus",
  56. "materials": [ "phong_orange" ],
  57. "position" : [ -20, 5, -50 ],
  58. "rotation" : [ 0, 0, 0 ],
  59. "scale" : [ 2, 2, 2 ],
  60. "visible" : true
  61. },
  62. "cone" : {
  63. "geometry" : "cone",
  64. "materials": [ "lambert_blue" ],
  65. "position" : [ -50, 15, -50 ],
  66. "rotation" : [ 1.57, 0, 0 ],
  67. "scale" : [ 1, 1, 1 ],
  68. "visible" : true
  69. },
  70. "cylinder" : {
  71. "geometry" : "cylinder",
  72. "materials": [ "lambert_blue" ],
  73. "position" : [ 50, 15, -50 ],
  74. "rotation" : [ 1.57, 0, 0 ],
  75. "scale" : [ 1, 1, 1 ],
  76. "visible" : true
  77. },
  78. "colorcube" : {
  79. "geometry" : "colorcube",
  80. "materials": [ ],
  81. "position" : [ -10, -5, 30 ],
  82. "rotation" : [ 1.57, 0, 0 ],
  83. "scale" : [ 5, 5, 5 ],
  84. "visible" : true
  85. },
  86. "veyron" : {
  87. "geometry" : "veyron",
  88. "materials": [ "face" ],
  89. "position" : [ 40, -1, 0 ],
  90. "rotation" : [ 0, 0.3, 0 ],
  91. "scale" : [ 0.25, 0.25, 0.25 ],
  92. "visible" : true
  93. },
  94. "walt" : {
  95. "geometry" : "WaltHead",
  96. "materials": [ "lambert_cube" ],
  97. "position" : [ -45, 10, 0 ],
  98. "rotation" : [ 0, 0, 0 ],
  99. "scale" : [ 0.5, 0.5, 0.5 ],
  100. "visible" : true
  101. },
  102. "quad_bg" : {
  103. "geometry" : "quad",
  104. "materials": [ "textured_bg" ],
  105. "position" : [ 0, 15, -90 ],
  106. "rotation" : [ 0, 0, 0 ],
  107. "scale" : [ 20, 20, 20 ],
  108. "visible" : true
  109. },
  110. "ground" : {
  111. "geometry" : "plane",
  112. "materials": [ "basic_gray" ],
  113. "position" : [ 0, -10, 0 ],
  114. "rotation" : [ 1.57, 0, 0 ],
  115. "scale" : [ 100, 100, 100 ],
  116. "visible" : true
  117. }
  118. },
  119. "geometries":
  120. {
  121. "cube": {
  122. "type" : "cube",
  123. "width" : 10,
  124. "height": 10,
  125. "depth" : 10,
  126. "segmentsWidth" : 1,
  127. "segmentsHeight" : 1,
  128. "segmentsDepth" : 1,
  129. "flipped" : false,
  130. "sides" : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
  131. },
  132. "plane": {
  133. "type" : "plane",
  134. "width" : 10,
  135. "height" : 10,
  136. "segmentsWidth" : 50,
  137. "segmentsHeight" : 50
  138. },
  139. "quad": {
  140. "type" : "plane",
  141. "width" : 10,
  142. "height" : 10,
  143. "segmentsWidth" : 1,
  144. "segmentsHeight" : 1
  145. },
  146. "sphere": {
  147. "type" : "sphere",
  148. "radius" : 5,
  149. "segmentsWidth" : 32,
  150. "segmentsHeight" : 16
  151. },
  152. "icosahedron": {
  153. "type" : "icosahedron",
  154. "subdivisions" : 2
  155. },
  156. "torus": {
  157. "type" : "torus",
  158. "radius" : 5,
  159. "tube" : 2,
  160. "segmentsR" : 16,
  161. "segmentsT" : 32
  162. },
  163. "cylinder": {
  164. "type" : "cylinder",
  165. "numSegs" : 32,
  166. "topRad" : 5,
  167. "botRad" : 5,
  168. "height" : 50,
  169. "topOffset": 0,
  170. "botOffset": 0
  171. },
  172. "cone": {
  173. "type" : "cylinder",
  174. "numSegs" : 32,
  175. "topRad" : 0,
  176. "botRad" : 5,
  177. "height" : 50,
  178. "topOffset": 0,
  179. "botOffset": 0
  180. },
  181. "WaltHead": {
  182. "type": "bin_mesh",
  183. "url" : "obj/walt/WaltHead_bin.js"
  184. },
  185. "veyron": {
  186. "type": "bin_mesh",
  187. "url" : "obj/veyron/VeyronNoUv_bin.js"
  188. },
  189. "colorcube": {
  190. "type": "embedded_mesh",
  191. "id" : "cube_fvc"
  192. }
  193. },
  194. "embeds": {
  195. "cube_fvc": {
  196. "version" : 2,
  197. "scale" : 1.000000,
  198. "materials": [ {
  199. "DbgColor" : 15658734,
  200. "DbgIndex" : 0,
  201. "DbgName" : "Material",
  202. "colorAmbient" : [0.0, 0.0, 0.0],
  203. "colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
  204. "colorSpecular" : [0.5, 0.5, 0.5],
  205. "specularCoef" : 50,
  206. "transparency" : 1.0,
  207. "vertexColors" : true
  208. }],
  209. "vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
  210. "morphTargets": [],
  211. "normals": [],
  212. "colors": [16777215,16769421,16769424,8454135,15195931,7299839,16586715,16711687,1056014,6029475,13762484,9044089,7962349,6772991,16774622,4144383,11973887,1966063,1056285,9081232,13696943,5002581],
  213. "uvs": [[]],
  214. "faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21],
  215. "edges" : []
  216. }
  217. },
  218. "materials":
  219. {
  220. /*
  221. "basic_red": {
  222. "type": "MeshBasicMaterial",
  223. "parameters": { color: 0xff0000, wireframe: true }
  224. },
  225. "basic_green": {
  226. "type": "MeshBasicMaterial",
  227. "parameters": { color: 0x007711, wireframe: true }
  228. },
  229. "basic_blue": {
  230. "type": "MeshBasicMaterial",
  231. "parameters": { color: 0x0000ff, wireframe: true }
  232. },
  233. "basic_black": {
  234. "type": "MeshBasicMaterial",
  235. "parameters": { color: 0x000000, wireframe: true }
  236. },
  237. "phong_white": {
  238. "type": "MeshPhongMaterial",
  239. "parameters": { color: 0xaaaaaa }
  240. },
  241. */
  242. "basic_gray": {
  243. "type": "MeshBasicMaterial",
  244. "parameters": { color: 0x666666, wireframe: true }
  245. },
  246. "basic_white": {
  247. "type": "MeshBasicMaterial",
  248. "parameters": { color: 0xffffff, wireframe: true }
  249. },
  250. "faceted_white": {
  251. "type": "MeshLambertMaterial",
  252. "parameters": { color: 0xffffff, shading: "flat" }
  253. },
  254. "lambert_red": {
  255. "type": "MeshLambertMaterial",
  256. "parameters": { color: 0xff0000 }
  257. },
  258. "lambert_green": {
  259. "type": "MeshLambertMaterial",
  260. "parameters": { color: 0x007711, blending: "AdditiveBlending", transparent: true }
  261. },
  262. "lambert_blue": {
  263. "type": "MeshLambertMaterial",
  264. "parameters": { color: 0x0055aa }
  265. },
  266. "phong_orange": {
  267. "type": "MeshPhongMaterial",
  268. "parameters": { color:0x000000, specular: 0xaa5500 }
  269. },
  270. "basic_refraction": {
  271. "type": "MeshBasicMaterial",
  272. "parameters": { color: 0xffffff, envMap: "cube_refraction", refractionRatio: 0.95 }
  273. },
  274. "lambert_cube": {
  275. "type": "MeshLambertMaterial",
  276. "parameters": { color: 0xff6600, envMap: "cube_reflection", combine: "MixOperation", reflectivity: 0.3 }
  277. },
  278. "chrome": {
  279. "type": "MeshLambertMaterial",
  280. "parameters": { color: 0xffffff, envMap: "cube_reflection" }
  281. },
  282. "darkerchrome": {
  283. "type": "MeshLambertMaterial",
  284. "parameters": { color: 0x222222, envMap: "cube_reflection" }
  285. },
  286. "glass": {
  287. "type": "MeshLambertMaterial",
  288. "parameters": { color: 0x101046, envMap: "cube_reflection", opacity: 0.25, transparent: true }
  289. },
  290. "interior": {
  291. "type": "MeshLambertMaterial",
  292. "parameters": { color: 0x050505 }
  293. },
  294. "backlights": {
  295. "type": "MeshLambertMaterial",
  296. "parameters": { color: 0xff0000, opacity: 0.5 }
  297. },
  298. "backsignals": {
  299. "type": "MeshLambertMaterial",
  300. "parameters": { color: 0xffbb00, opacity: 0.5 }
  301. },
  302. "textured_bg": {
  303. "type": "MeshBasicMaterial",
  304. "parameters": { color: 0xffffff, map: "texture_bg" }
  305. },
  306. "minecraft": {
  307. "type": "MeshBasicMaterial",
  308. "parameters": { color: 0xffffff, map: "texture_minecraft" }
  309. },
  310. "face": {
  311. "type": "MeshFaceMaterial",
  312. "parameters": {}
  313. }
  314. },
  315. "textures":
  316. {
  317. "cube_reflection": {
  318. "url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
  319. "textures/cube/SwedishRoyalCastle/nx.jpg",
  320. "textures/cube/SwedishRoyalCastle/py.jpg",
  321. "textures/cube/SwedishRoyalCastle/ny.jpg",
  322. "textures/cube/SwedishRoyalCastle/pz.jpg",
  323. "textures/cube/SwedishRoyalCastle/nz.jpg"
  324. ]
  325. },
  326. "cube_refraction": {
  327. "url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
  328. "textures/cube/SwedishRoyalCastle/nx.jpg",
  329. "textures/cube/SwedishRoyalCastle/py.jpg",
  330. "textures/cube/SwedishRoyalCastle/ny.jpg",
  331. "textures/cube/SwedishRoyalCastle/nz.jpg",
  332. "textures/cube/SwedishRoyalCastle/pz.jpg"
  333. ],
  334. "mapping": "CubeRefractionMapping"
  335. },
  336. "texture_bg": {
  337. "url": "textures/cube/SwedishRoyalCastle/pz.jpg"
  338. },
  339. "texture_minecraft": {
  340. "url": "textures/minecraft/grass.png",
  341. "magFilter": "NearestFilter",
  342. "minFilter": "LinearMipMapLinearFilter"
  343. }
  344. },
  345. "cameras":
  346. {
  347. "cam1": {
  348. "type" : "perspective",
  349. "fov" : 50,
  350. "aspect": 1.33333,
  351. "near" : 1,
  352. "far" : 1000,
  353. "position": [0,0,100],
  354. "target" : [0,0,0]
  355. },
  356. "cam2": {
  357. "type" : "ortho",
  358. "left" : 0,
  359. "right" : 1024,
  360. "top" : 0,
  361. "bottom": 1024,
  362. "near" : 1,
  363. "far" : 1000,
  364. "position": [0,0,0],
  365. "target" : [0,0,0]
  366. }
  367. },
  368. "lights":
  369. {
  370. "light1": {
  371. "type" : "directional",
  372. "direction" : [0,1,1],
  373. "color" : 0xffffff,
  374. "intensity" : 0.8
  375. },
  376. "light2": {
  377. "type" : "point",
  378. "position": [0,0,0],
  379. "color" : 0xffffff
  380. }
  381. },
  382. "fogs":
  383. {
  384. "basic": {
  385. "type" : "linear",
  386. "color": [1,0,0],
  387. "near" : 1,
  388. "far" : 1000
  389. },
  390. "exponential": {
  391. "type" : "exp2",
  392. "color" : [1,1,1],
  393. "density" : 0.005,
  394. },
  395. "black": {
  396. "type" : "exp2",
  397. "color" : [0,0,0],
  398. "density" : 0.005,
  399. }
  400. },
  401. "defaults" :
  402. {
  403. "bgcolor" : [0,0,0],
  404. "bgalpha" : 1,
  405. "camera" : "cam1",
  406. "fog" : "black"
  407. }
  408. };
  409. postMessage( scene );
  410. close();