test_scene.js 8.1 KB

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