test_scene.js 6.0 KB

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