test_scene.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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. "sphere" : {
  21. "geometry" : "sphere",
  22. "materials": [ "lambert_green" ],
  23. "position" : [ -20, -5, 15 ],
  24. "rotation" : [ 0, 0, 0 ],
  25. "scale" : [ 1, 1, 1 ],
  26. "visible" : true
  27. },
  28. "torus" : {
  29. "geometry" : "torus",
  30. "materials": [ "phong_orange" ],
  31. "position" : [ 0, 5, -50 ],
  32. "rotation" : [ 0, 0, 0 ],
  33. "scale" : [ 2, 2, 2 ],
  34. "visible" : true
  35. },
  36. "cone" : {
  37. "geometry" : "cone",
  38. "materials": [ "lambert_blue" ],
  39. "position" : [ -50, 40, -50 ],
  40. "rotation" : [ 1.57, 0, 0 ],
  41. "scale" : [ 1, 1, 1 ],
  42. "visible" : true
  43. },
  44. "cylinder" : {
  45. "geometry" : "cylinder",
  46. "materials": [ "lambert_blue" ],
  47. "position" : [ 50, 40, -50 ],
  48. "rotation" : [ 1.57, 0, 0 ],
  49. "scale" : [ 1, 1, 1 ],
  50. "visible" : true
  51. },
  52. "veyron" : {
  53. "geometry" : "veyron",
  54. "materials": [ "face" ],
  55. "position" : [ 40, -1, 0 ],
  56. "rotation" : [ 0, 0.3, 0 ],
  57. "scale" : [ 0.25, 0.25, 0.25 ],
  58. "visible" : true
  59. },
  60. "walt" : {
  61. "geometry" : "WaltHead",
  62. "materials": [ "phong_white" ],
  63. "position" : [ -45, 10, 0 ],
  64. "rotation" : [ 0, 0, 0 ],
  65. "scale" : [ 0.5, 0.5, 0.5 ],
  66. "visible" : true
  67. },
  68. "ground" : {
  69. "geometry" : "plane",
  70. "materials": [ "basic_gray" ],
  71. "position" : [ 0, -10, 0 ],
  72. "rotation" : [ 1.57, 0, 0 ],
  73. "scale" : [ 100, 100, 100 ],
  74. "visible" : true
  75. }
  76. },
  77. "geometries":
  78. {
  79. "cube": {
  80. "type" : "cube",
  81. "width" : 10,
  82. "height": 10,
  83. "depth" : 10,
  84. "segments_width" : 1,
  85. "segments_height" : 1,
  86. "flipped" : false,
  87. "sides" : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
  88. },
  89. "plane": {
  90. "type" : "plane",
  91. "width" : 10,
  92. "height" : 10,
  93. "segments_width" : 50,
  94. "segments_height" : 50
  95. },
  96. "sphere": {
  97. "type" : "sphere",
  98. "radius" : 5,
  99. "segments_width" : 32,
  100. "segments_height" : 16
  101. },
  102. "torus": {
  103. "type" : "torus",
  104. "radius" : 5,
  105. "tube" : 2,
  106. "segmentsR" : 16,
  107. "segmentsT" : 32
  108. },
  109. "cylinder": {
  110. "type" : "cylinder",
  111. "numSegs" : 32,
  112. "topRad" : 5,
  113. "botRad" : 5,
  114. "height" : 50,
  115. "topOffset": 0,
  116. "botOffset": 0
  117. },
  118. "cone": {
  119. "type" : "cylinder",
  120. "numSegs" : 32,
  121. "topRad" : 0,
  122. "botRad" : 5,
  123. "height" : 50,
  124. "topOffset": 0,
  125. "botOffset": 0
  126. },
  127. "WaltHead": {
  128. "type": "bin_mesh",
  129. "url" : "obj/walt/WaltHead_bin.js"
  130. },
  131. "veyron": {
  132. "type": "bin_mesh",
  133. "url" : "obj/veyron/VeyronNoUv_bin.js"
  134. }
  135. },
  136. "materials":
  137. {
  138. "basic_red": {
  139. "type": "MeshBasicMaterial",
  140. "parameters": { color: 0xff0000, wireframe: true }
  141. },
  142. "basic_green": {
  143. "type": "MeshBasicMaterial",
  144. "parameters": { color: 0x007711, wireframe: true }
  145. },
  146. "basic_gray": {
  147. "type": "MeshBasicMaterial",
  148. "parameters": { color: 0x666666, wireframe: true }
  149. },
  150. "basic_black": {
  151. "type": "MeshBasicMaterial",
  152. "parameters": { color: 0x000000, wireframe: true }
  153. },
  154. "basic_white": {
  155. "type": "MeshBasicMaterial",
  156. "parameters": { color: 0xffffff, wireframe: true }
  157. },
  158. "basic_blue": {
  159. "type": "MeshBasicMaterial",
  160. "parameters": { color: 0x0000ff, wireframe: true }
  161. },
  162. "lambert_red": {
  163. "type": "MeshLambertMaterial",
  164. "parameters": { color: 0xff0000 }
  165. },
  166. "lambert_green": {
  167. "type": "MeshLambertMaterial",
  168. "parameters": { color: 0x007711 }
  169. },
  170. "lambert_blue": {
  171. "type": "MeshLambertMaterial",
  172. "parameters": { color: 0x0055aa }
  173. },
  174. "phong_white": {
  175. "type": "MeshPhongMaterial",
  176. "parameters": { color: 0xaaaaaa }
  177. },
  178. "phong_orange": {
  179. "type": "MeshPhongMaterial",
  180. "parameters": { color:0x000000, specular: 0xaa5500 }
  181. },
  182. "chrome": {
  183. "type": "MeshLambertMaterial",
  184. "parameters": { color: 0xffffff, env_map: "textureCube" }
  185. },
  186. "darkerchrome": {
  187. "type": "MeshLambertMaterial",
  188. "parameters": { color: 0x222222, env_map: "textureCube" }
  189. },
  190. "glass": {
  191. "type": "MeshLambertMaterial",
  192. "parameters": { color: 0x101046, env_map: "textureCube", opacity: 0.25 }
  193. },
  194. "interior": {
  195. "type": "MeshLambertMaterial",
  196. "parameters": { color: 0x050505 }
  197. },
  198. "face": {
  199. "type": "MeshFaceMaterial",
  200. "parameters": {}
  201. }
  202. },
  203. "textures":
  204. {
  205. "textureCube": {
  206. "url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
  207. "textures/cube/SwedishRoyalCastle/nx.jpg",
  208. "textures/cube/SwedishRoyalCastle/py.jpg",
  209. "textures/cube/SwedishRoyalCastle/ny.jpg",
  210. "textures/cube/SwedishRoyalCastle/pz.jpg",
  211. "textures/cube/SwedishRoyalCastle/nz.jpg"
  212. ]
  213. }
  214. },
  215. "cameras":
  216. {
  217. "cam1": {
  218. "type" : "perspective",
  219. "fov" : 50,
  220. "aspect": 1.33333,
  221. "near" : 1,
  222. "far" : 1000,
  223. "position": [0,0,100],
  224. "target" : [0,0,0]
  225. },
  226. "cam2": {
  227. "type" : "ortho",
  228. "left" : 0,
  229. "right" : 1024,
  230. "top" : 0,
  231. "bottom": 1024,
  232. "near" : 1,
  233. "far" : 1000,
  234. "position": [0,0,0],
  235. "target" : [0,0,0]
  236. }
  237. },
  238. "lights":
  239. {
  240. "light1": {
  241. "type" : "directional",
  242. "direction" : [0,1,1],
  243. "color" : [1,1,1]
  244. },
  245. "light2": {
  246. "type" : "point",
  247. "position": [0,0,0],
  248. "color" : [1,1,1]
  249. }
  250. },
  251. "fogs":
  252. {
  253. "basic": {
  254. "type" : "linear",
  255. "color": [1,0,0],
  256. "near" : 1,
  257. "far" : 1000
  258. },
  259. "exponential": {
  260. "type" : "exp2",
  261. "color" : [1,1,1],
  262. "density" : 0.005,
  263. },
  264. "black": {
  265. "type" : "exp2",
  266. "color" : [0,0,0],
  267. "density" : 0.005,
  268. }
  269. },
  270. "defaults" :
  271. {
  272. "bgcolor" : [0,0,0],
  273. "bgalpha" : 1,
  274. "camera" : "cam1",
  275. "fog" : "black"
  276. }
  277. };
  278. postMessage( scene );