test_scene.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  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, 15, -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, 15, -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. "segmentsWidth" : 1,
  117. "segmentsHeight" : 1,
  118. "segmentsDepth" : 1,
  119. "flipped" : false,
  120. "sides" : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
  121. },
  122. "plane": {
  123. "type" : "plane",
  124. "width" : 10,
  125. "height" : 10,
  126. "segmentsWidth" : 50,
  127. "segmentsHeight" : 50
  128. },
  129. "quad": {
  130. "type" : "plane",
  131. "width" : 10,
  132. "height" : 10,
  133. "segmentsWidth" : 1,
  134. "segmentsHeight" : 1
  135. },
  136. "sphere": {
  137. "type" : "sphere",
  138. "radius" : 5,
  139. "segmentsWidth" : 32,
  140. "segmentsHeight" : 16
  141. },
  142. "icosahedron": {
  143. "type" : "icosahedron",
  144. "subdivisions" : 2
  145. },
  146. "torus": {
  147. "type" : "torus",
  148. "radius" : 5,
  149. "tube" : 2,
  150. "segmentsR" : 16,
  151. "segmentsT" : 32
  152. },
  153. "cylinder": {
  154. "type" : "cylinder",
  155. "numSegs" : 32,
  156. "topRad" : 5,
  157. "botRad" : 5,
  158. "height" : 50,
  159. "topOffset": 0,
  160. "botOffset": 0
  161. },
  162. "cone": {
  163. "type" : "cylinder",
  164. "numSegs" : 32,
  165. "topRad" : 0,
  166. "botRad" : 5,
  167. "height" : 50,
  168. "topOffset": 0,
  169. "botOffset": 0
  170. },
  171. "WaltHead": {
  172. "type": "bin_mesh",
  173. "url" : "obj/walt/WaltHead_bin.js"
  174. },
  175. "veyron": {
  176. "type": "bin_mesh",
  177. "url" : "obj/veyron/VeyronNoUv_bin.js"
  178. }
  179. },
  180. "materials":
  181. {
  182. /*
  183. "basic_red": {
  184. "type": "MeshBasicMaterial",
  185. "parameters": { color: 0xff0000, wireframe: true }
  186. },
  187. "basic_green": {
  188. "type": "MeshBasicMaterial",
  189. "parameters": { color: 0x007711, wireframe: true }
  190. },
  191. "basic_blue": {
  192. "type": "MeshBasicMaterial",
  193. "parameters": { color: 0x0000ff, wireframe: true }
  194. },
  195. "basic_black": {
  196. "type": "MeshBasicMaterial",
  197. "parameters": { color: 0x000000, wireframe: true }
  198. },
  199. "phong_white": {
  200. "type": "MeshPhongMaterial",
  201. "parameters": { color: 0xaaaaaa }
  202. },
  203. */
  204. "basic_gray": {
  205. "type": "MeshBasicMaterial",
  206. "parameters": { color: 0x666666, wireframe: true }
  207. },
  208. "basic_white": {
  209. "type": "MeshBasicMaterial",
  210. "parameters": { color: 0xffffff, wireframe: true }
  211. },
  212. "faceted_white": {
  213. "type": "MeshLambertMaterial",
  214. "parameters": { color: 0xffffff, shading: "flat" }
  215. },
  216. "lambert_red": {
  217. "type": "MeshLambertMaterial",
  218. "parameters": { color: 0xff0000 }
  219. },
  220. "lambert_green": {
  221. "type": "MeshLambertMaterial",
  222. "parameters": { color: 0x007711, blending: "AdditiveBlending" }
  223. },
  224. "lambert_blue": {
  225. "type": "MeshLambertMaterial",
  226. "parameters": { color: 0x0055aa }
  227. },
  228. "phong_orange": {
  229. "type": "MeshPhongMaterial",
  230. "parameters": { color:0x000000, specular: 0xaa5500 }
  231. },
  232. "basic_refraction": {
  233. "type": "MeshBasicMaterial",
  234. "parameters": { color: 0xffffff, envMap: "cube_refraction", refractionRatio: 0.95 }
  235. },
  236. "lambert_cube": {
  237. "type": "MeshLambertMaterial",
  238. "parameters": { color: 0xff6600, envMap: "cube_reflection", combine: "MixOperation", reflectivity: 0.3 }
  239. },
  240. "chrome": {
  241. "type": "MeshLambertMaterial",
  242. "parameters": { color: 0xffffff, envMap: "cube_reflection" }
  243. },
  244. "darkerchrome": {
  245. "type": "MeshLambertMaterial",
  246. "parameters": { color: 0x222222, envMap: "cube_reflection" }
  247. },
  248. "glass": {
  249. "type": "MeshLambertMaterial",
  250. "parameters": { color: 0x101046, envMap: "cube_reflection", opacity: 0.25 }
  251. },
  252. "interior": {
  253. "type": "MeshLambertMaterial",
  254. "parameters": { color: 0x050505 }
  255. },
  256. "backlights": {
  257. "type": "MeshLambertMaterial",
  258. "parameters": { color: 0xff0000, opacity: 0.5 }
  259. },
  260. "backsignals": {
  261. "type": "MeshLambertMaterial",
  262. "parameters": { color: 0xffbb00, opacity: 0.5 }
  263. },
  264. "textured_bg": {
  265. "type": "MeshBasicMaterial",
  266. "parameters": { color: 0xffffff, map: "texture_bg" }
  267. },
  268. "minecraft": {
  269. "type": "MeshBasicMaterial",
  270. "parameters": { color: 0xffffff, map: "texture_minecraft" }
  271. },
  272. "face": {
  273. "type": "MeshFaceMaterial",
  274. "parameters": {}
  275. }
  276. },
  277. "textures":
  278. {
  279. "cube_reflection": {
  280. "url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
  281. "textures/cube/SwedishRoyalCastle/nx.jpg",
  282. "textures/cube/SwedishRoyalCastle/py.jpg",
  283. "textures/cube/SwedishRoyalCastle/ny.jpg",
  284. "textures/cube/SwedishRoyalCastle/pz.jpg",
  285. "textures/cube/SwedishRoyalCastle/nz.jpg"
  286. ]
  287. },
  288. "cube_refraction": {
  289. "url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
  290. "textures/cube/SwedishRoyalCastle/nx.jpg",
  291. "textures/cube/SwedishRoyalCastle/py.jpg",
  292. "textures/cube/SwedishRoyalCastle/ny.jpg",
  293. "textures/cube/SwedishRoyalCastle/nz.jpg",
  294. "textures/cube/SwedishRoyalCastle/pz.jpg"
  295. ],
  296. "mapping": "CubeRefractionMapping"
  297. },
  298. "texture_bg": {
  299. "url": "textures/cube/SwedishRoyalCastle/pz.jpg"
  300. },
  301. "texture_minecraft": {
  302. "url": "textures/minecraft/grass.png",
  303. "magFilter": "NearestFilter",
  304. "minFilter": "LinearMipMapLinearFilter"
  305. }
  306. },
  307. "cameras":
  308. {
  309. "cam1": {
  310. "type" : "perspective",
  311. "fov" : 50,
  312. "aspect": 1.33333,
  313. "near" : 1,
  314. "far" : 1000,
  315. "position": [0,0,100],
  316. "target" : [0,0,0]
  317. },
  318. "cam2": {
  319. "type" : "ortho",
  320. "left" : 0,
  321. "right" : 1024,
  322. "top" : 0,
  323. "bottom": 1024,
  324. "near" : 1,
  325. "far" : 1000,
  326. "position": [0,0,0],
  327. "target" : [0,0,0]
  328. }
  329. },
  330. "lights":
  331. {
  332. "light1": {
  333. "type" : "directional",
  334. "direction" : [0,1,1],
  335. "color" : [1,1,1],
  336. "intensity" : 0.8
  337. },
  338. "light2": {
  339. "type" : "point",
  340. "position": [0,0,0],
  341. "color" : [1,1,1]
  342. }
  343. },
  344. "fogs":
  345. {
  346. "basic": {
  347. "type" : "linear",
  348. "color": [1,0,0],
  349. "near" : 1,
  350. "far" : 1000
  351. },
  352. "exponential": {
  353. "type" : "exp2",
  354. "color" : [1,1,1],
  355. "density" : 0.005,
  356. },
  357. "black": {
  358. "type" : "exp2",
  359. "color" : [0,0,0],
  360. "density" : 0.005,
  361. }
  362. },
  363. "defaults" :
  364. {
  365. "bgcolor" : [0,0,0],
  366. "bgalpha" : 1,
  367. "camera" : "cam1",
  368. "fog" : "black"
  369. }
  370. };
  371. postMessage( scene );