test_scene.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  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. "basic_red": {
  182. "type": "MeshBasicMaterial",
  183. "parameters": { color: 0xff0000, wireframe: true }
  184. },
  185. "basic_green": {
  186. "type": "MeshBasicMaterial",
  187. "parameters": { color: 0x007711, wireframe: true }
  188. },
  189. "basic_gray": {
  190. "type": "MeshBasicMaterial",
  191. "parameters": { color: 0x666666, wireframe: true }
  192. },
  193. "basic_black": {
  194. "type": "MeshBasicMaterial",
  195. "parameters": { color: 0x000000, wireframe: true }
  196. },
  197. "basic_white": {
  198. "type": "MeshBasicMaterial",
  199. "parameters": { color: 0xffffff, wireframe: true }
  200. },
  201. "faceted_white": {
  202. "type": "MeshLambertMaterial",
  203. "parameters": { color: 0xffffff, shading: "flat" }
  204. },
  205. "basic_blue": {
  206. "type": "MeshBasicMaterial",
  207. "parameters": { color: 0x0000ff, wireframe: true }
  208. },
  209. "lambert_red": {
  210. "type": "MeshLambertMaterial",
  211. "parameters": { color: 0xff0000 }
  212. },
  213. "lambert_green": {
  214. "type": "MeshLambertMaterial",
  215. "parameters": { color: 0x007711 }
  216. },
  217. "lambert_blue": {
  218. "type": "MeshLambertMaterial",
  219. "parameters": { color: 0x0055aa }
  220. },
  221. "phong_white": {
  222. "type": "MeshPhongMaterial",
  223. "parameters": { color: 0xaaaaaa }
  224. },
  225. "phong_orange": {
  226. "type": "MeshPhongMaterial",
  227. "parameters": { color:0x000000, specular: 0xaa5500 }
  228. },
  229. "basic_refraction": {
  230. "type": "MeshBasicMaterial",
  231. "parameters": { color: 0xffffff, env_map: "cube_refraction", refraction_ratio: 0.95 }
  232. },
  233. "lambert_cube": {
  234. "type": "MeshLambertMaterial",
  235. "parameters": { color: 0xff6600, env_map: "cube_reflection", combine: "MixOperation", reflectivity: 0.3 }
  236. },
  237. "chrome": {
  238. "type": "MeshLambertMaterial",
  239. "parameters": { color: 0xffffff, env_map: "cube_reflection" }
  240. },
  241. "darkerchrome": {
  242. "type": "MeshLambertMaterial",
  243. "parameters": { color: 0x222222, env_map: "cube_reflection" }
  244. },
  245. "glass": {
  246. "type": "MeshLambertMaterial",
  247. "parameters": { color: 0x101046, env_map: "cube_reflection", opacity: 0.25 }
  248. },
  249. "interior": {
  250. "type": "MeshLambertMaterial",
  251. "parameters": { color: 0x050505 }
  252. },
  253. "textured_bg": {
  254. "type": "MeshBasicMaterial",
  255. "parameters": { color: 0xffffff, map: "texture_bg" }
  256. },
  257. "minecraft": {
  258. "type": "MeshBasicMaterial",
  259. "parameters": { color: 0xffffff, map: "texture_minecraft" }
  260. },
  261. "face": {
  262. "type": "MeshFaceMaterial",
  263. "parameters": {}
  264. }
  265. },
  266. "textures":
  267. {
  268. "cube_reflection": {
  269. "url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
  270. "textures/cube/SwedishRoyalCastle/nx.jpg",
  271. "textures/cube/SwedishRoyalCastle/py.jpg",
  272. "textures/cube/SwedishRoyalCastle/ny.jpg",
  273. "textures/cube/SwedishRoyalCastle/pz.jpg",
  274. "textures/cube/SwedishRoyalCastle/nz.jpg"
  275. ]
  276. },
  277. "cube_refraction": {
  278. "url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
  279. "textures/cube/SwedishRoyalCastle/nx.jpg",
  280. "textures/cube/SwedishRoyalCastle/py.jpg",
  281. "textures/cube/SwedishRoyalCastle/ny.jpg",
  282. "textures/cube/SwedishRoyalCastle/nz.jpg",
  283. "textures/cube/SwedishRoyalCastle/pz.jpg"
  284. ],
  285. "mapping": "CubeRefractionMapping"
  286. },
  287. "texture_bg": {
  288. "url": "textures/cube/SwedishRoyalCastle/pz.jpg"
  289. },
  290. "texture_minecraft": {
  291. "url": "textures/minecraft/grass.png",
  292. "mag_filter": "NearestFilter",
  293. "min_filter": "LinearMipMapLinearFilter"
  294. }
  295. },
  296. "cameras":
  297. {
  298. "cam1": {
  299. "type" : "perspective",
  300. "fov" : 50,
  301. "aspect": 1.33333,
  302. "near" : 1,
  303. "far" : 1000,
  304. "position": [0,0,100],
  305. "target" : [0,0,0]
  306. },
  307. "cam2": {
  308. "type" : "ortho",
  309. "left" : 0,
  310. "right" : 1024,
  311. "top" : 0,
  312. "bottom": 1024,
  313. "near" : 1,
  314. "far" : 1000,
  315. "position": [0,0,0],
  316. "target" : [0,0,0]
  317. }
  318. },
  319. "lights":
  320. {
  321. "light1": {
  322. "type" : "directional",
  323. "direction" : [0,1,1],
  324. "color" : [1,1,1],
  325. "intensity" : 0.8
  326. },
  327. "light2": {
  328. "type" : "point",
  329. "position": [0,0,0],
  330. "color" : [1,1,1]
  331. }
  332. },
  333. "fogs":
  334. {
  335. "basic": {
  336. "type" : "linear",
  337. "color": [1,0,0],
  338. "near" : 1,
  339. "far" : 1000
  340. },
  341. "exponential": {
  342. "type" : "exp2",
  343. "color" : [1,1,1],
  344. "density" : 0.005,
  345. },
  346. "black": {
  347. "type" : "exp2",
  348. "color" : [0,0,0],
  349. "density" : 0.005,
  350. }
  351. },
  352. "defaults" :
  353. {
  354. "bgcolor" : [0,0,0],
  355. "bgalpha" : 1,
  356. "camera" : "cam1",
  357. "fog" : "black"
  358. }
  359. };
  360. postMessage( scene );