test_scene.js 6.9 KB

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