test_scene.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  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" : [ 0, 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" : [ 0, 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. "topRad" : 5,
  166. "botRad" : 5,
  167. "height" : 50,
  168. "radSegs" : 32,
  169. "heightSegs": 1
  170. },
  171. "cone": {
  172. "type" : "cylinder",
  173. "topRad" : 0,
  174. "botRad" : 5,
  175. "height" : 50,
  176. "radSegs" : 32,
  177. "heightSegs" : 1
  178. },
  179. "WaltHead": {
  180. "type": "bin_mesh",
  181. "url" : "obj/walt/WaltHead_bin.js"
  182. },
  183. "veyron": {
  184. "type": "bin_mesh",
  185. "url" : "obj/veyron/VeyronNoUv_bin.js"
  186. },
  187. "colorcube": {
  188. "type": "embedded_mesh",
  189. "id" : "cube_fvc"
  190. }
  191. },
  192. "embeds": {
  193. "cube_fvc": {
  194. "version" : 2,
  195. "scale" : 1.000000,
  196. "materials": [ {
  197. "DbgColor" : 15658734,
  198. "DbgIndex" : 0,
  199. "DbgName" : "Material",
  200. "colorAmbient" : [0.0, 0.0, 0.0],
  201. "colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
  202. "colorSpecular" : [0.5, 0.5, 0.5],
  203. "specularCoef" : 50,
  204. "transparency" : 1.0,
  205. "vertexColors" : true
  206. }],
  207. "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],
  208. "morphTargets": [],
  209. "normals": [],
  210. "colors": [16777215,16769421,16769424,8454135,15195931,7299839,16586715,16711687,1056014,6029475,13762484,9044089,7962349,6772991,16774622,4144383,11973887,1966063,1056285,9081232,13696943,5002581],
  211. "uvs": [[]],
  212. "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],
  213. "edges" : []
  214. }
  215. },
  216. "materials":
  217. {
  218. /*
  219. "basic_red": {
  220. "type": "MeshBasicMaterial",
  221. "parameters": { color: 0xff0000, wireframe: true }
  222. },
  223. "basic_green": {
  224. "type": "MeshBasicMaterial",
  225. "parameters": { color: 0x007711, wireframe: true }
  226. },
  227. "basic_blue": {
  228. "type": "MeshBasicMaterial",
  229. "parameters": { color: 0x0000ff, wireframe: true }
  230. },
  231. "basic_black": {
  232. "type": "MeshBasicMaterial",
  233. "parameters": { color: 0x000000, wireframe: true }
  234. },
  235. "phong_white": {
  236. "type": "MeshPhongMaterial",
  237. "parameters": { color: 0xaaaaaa }
  238. },
  239. */
  240. "basic_gray": {
  241. "type": "MeshBasicMaterial",
  242. "parameters": { color: 0x666666, wireframe: true }
  243. },
  244. "basic_white": {
  245. "type": "MeshBasicMaterial",
  246. "parameters": { color: 0xffffff, wireframe: true }
  247. },
  248. "faceted_white": {
  249. "type": "MeshLambertMaterial",
  250. "parameters": { color: 0xffffff, shading: "flat" }
  251. },
  252. "lambert_red": {
  253. "type": "MeshLambertMaterial",
  254. "parameters": { color: 0xff0000 }
  255. },
  256. "lambert_green": {
  257. "type": "MeshLambertMaterial",
  258. "parameters": { color: 0x007711, blending: "AdditiveBlending", transparent: true }
  259. },
  260. "lambert_blue": {
  261. "type": "MeshLambertMaterial",
  262. "parameters": { color: 0x0055aa }
  263. },
  264. "phong_orange": {
  265. "type": "MeshPhongMaterial",
  266. "parameters": { color:0x000000, specular: 0xaa5500 }
  267. },
  268. "basic_refraction": {
  269. "type": "MeshBasicMaterial",
  270. "parameters": { color: 0xffffff, envMap: "cube_refraction", refractionRatio: 0.95 }
  271. },
  272. "lambert_cube": {
  273. "type": "MeshLambertMaterial",
  274. "parameters": { color: 0xff6600, envMap: "cube_reflection", combine: "MixOperation", reflectivity: 0.3 }
  275. },
  276. "chrome": {
  277. "type": "MeshLambertMaterial",
  278. "parameters": { color: 0xffffff, envMap: "cube_reflection" }
  279. },
  280. "darkerchrome": {
  281. "type": "MeshLambertMaterial",
  282. "parameters": { color: 0x222222, envMap: "cube_reflection" }
  283. },
  284. "glass": {
  285. "type": "MeshLambertMaterial",
  286. "parameters": { color: 0x101046, envMap: "cube_reflection", opacity: 0.25, transparent: true }
  287. },
  288. "interior": {
  289. "type": "MeshLambertMaterial",
  290. "parameters": { color: 0x050505 }
  291. },
  292. "backlights": {
  293. "type": "MeshLambertMaterial",
  294. "parameters": { color: 0xff0000, opacity: 0.5 }
  295. },
  296. "backsignals": {
  297. "type": "MeshLambertMaterial",
  298. "parameters": { color: 0xffbb00, opacity: 0.5 }
  299. },
  300. "textured_bg": {
  301. "type": "MeshBasicMaterial",
  302. "parameters": { color: 0xffffff, map: "texture_bg" }
  303. },
  304. "minecraft": {
  305. "type": "MeshBasicMaterial",
  306. "parameters": { color: 0xffffff, map: "texture_minecraft" }
  307. },
  308. "face": {
  309. "type": "MeshFaceMaterial",
  310. "parameters": {}
  311. }
  312. },
  313. "textures":
  314. {
  315. "cube_reflection": {
  316. "url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
  317. "textures/cube/SwedishRoyalCastle/nx.jpg",
  318. "textures/cube/SwedishRoyalCastle/py.jpg",
  319. "textures/cube/SwedishRoyalCastle/ny.jpg",
  320. "textures/cube/SwedishRoyalCastle/pz.jpg",
  321. "textures/cube/SwedishRoyalCastle/nz.jpg"
  322. ]
  323. },
  324. "cube_refraction": {
  325. "url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
  326. "textures/cube/SwedishRoyalCastle/nx.jpg",
  327. "textures/cube/SwedishRoyalCastle/py.jpg",
  328. "textures/cube/SwedishRoyalCastle/ny.jpg",
  329. "textures/cube/SwedishRoyalCastle/nz.jpg",
  330. "textures/cube/SwedishRoyalCastle/pz.jpg"
  331. ],
  332. "mapping": "CubeRefractionMapping"
  333. },
  334. "texture_bg": {
  335. "url": "textures/cube/SwedishRoyalCastle/pz.jpg"
  336. },
  337. "texture_minecraft": {
  338. "url": "textures/minecraft/grass.png",
  339. "magFilter": "NearestFilter",
  340. "minFilter": "LinearMipMapLinearFilter"
  341. }
  342. },
  343. "cameras":
  344. {
  345. "cam1": {
  346. "type" : "perspective",
  347. "fov" : 50,
  348. "aspect": 1.33333,
  349. "near" : 1,
  350. "far" : 1000,
  351. "position": [0,0,100],
  352. "target" : [0,0,0]
  353. },
  354. "cam2": {
  355. "type" : "ortho",
  356. "left" : 0,
  357. "right" : 1024,
  358. "top" : 0,
  359. "bottom": 1024,
  360. "near" : 1,
  361. "far" : 1000,
  362. "position": [0,0,0],
  363. "target" : [0,0,0]
  364. }
  365. },
  366. "lights":
  367. {
  368. "light1": {
  369. "type" : "directional",
  370. "direction" : [0,1,1],
  371. "color" : 0xffffff,
  372. "intensity" : 0.8
  373. },
  374. "light2": {
  375. "type" : "point",
  376. "position": [0,0,0],
  377. "color" : 0xffffff
  378. }
  379. },
  380. "fogs":
  381. {
  382. "basic": {
  383. "type" : "linear",
  384. "color": [1,0,0],
  385. "near" : 1,
  386. "far" : 1000
  387. },
  388. "exponential": {
  389. "type" : "exp2",
  390. "color" : [1,1,1],
  391. "density" : 0.005,
  392. },
  393. "black": {
  394. "type" : "exp2",
  395. "color" : [0,0,0],
  396. "density" : 0.005,
  397. }
  398. },
  399. "defaults" :
  400. {
  401. "bgcolor" : [0,0,0],
  402. "bgalpha" : 1,
  403. "camera" : "cam1",
  404. "fog" : "black"
  405. }
  406. };
  407. postMessage( scene );
  408. close();