ogre.rb 0.1-i686-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (430) hide show
  1. data/README +79 -0
  2. data/Rakefile +288 -0
  3. data/doc_src/ogre.rb +246 -0
  4. data/doc_src/ois.rb +67 -0
  5. data/lib/application.rb +146 -0
  6. data/lib/application_frame_listener.rb +302 -0
  7. data/lib/application_loading_bar.rb +115 -0
  8. data/lib/constants.rb +51 -0
  9. data/lib/method_fixes.rb +42 -0
  10. data/lib/ogre.so +0 -0
  11. data/lib/ruby_ois.so +0 -0
  12. data/ogre.rb +25 -0
  13. data/platform.rb +23 -0
  14. data/samples/Ogre.log +261 -0
  15. data/samples/bsp.rb +76 -0
  16. data/samples/cg.dll +0 -0
  17. data/samples/grass.rb +325 -0
  18. data/samples/js3250.dll +0 -0
  19. data/samples/lighting.rb +138 -0
  20. data/samples/media/materials/programs/Grass.cg +30 -0
  21. data/samples/media/materials/programs/OffsetMapping.cg +97 -0
  22. data/samples/media/materials/programs/OffsetMapping.hlsl +135 -0
  23. data/samples/media/materials/programs/OffsetMappingFp.glsl +69 -0
  24. data/samples/media/materials/programs/OffsetMappingVp.glsl +54 -0
  25. data/samples/media/materials/programs/OffsetMapping_specular.asm +44 -0
  26. data/samples/media/materials/scripts/CloudySky.material +17 -0
  27. data/samples/media/materials/scripts/CubeMapping.material +34 -0
  28. data/samples/media/materials/scripts/Flare.material +17 -0
  29. data/samples/media/materials/scripts/Grass.material +63 -0
  30. data/samples/media/materials/scripts/Knot.material +14 -0
  31. data/samples/media/materials/scripts/MorningSkyBox.material +17 -0
  32. data/samples/media/materials/scripts/Offset.material +124 -0
  33. data/samples/media/materials/scripts/Ogre.material +119 -0
  34. data/samples/media/materials/scripts/RZR-002.material +15 -0
  35. data/samples/media/materials/scripts/Razor.material +14 -0
  36. data/samples/media/materials/scripts/Ribbon.material +19 -0
  37. data/samples/media/materials/scripts/RustySteel.material +14 -0
  38. data/samples/media/materials/scripts/SpaceSkyBox.material +17 -0
  39. data/samples/media/materials/scripts/SpaceSkyPlane.material +17 -0
  40. data/samples/media/materials/scripts/TextureEffects.material +15 -0
  41. data/samples/media/materials/scripts/dragon.material +42 -0
  42. data/samples/media/materials/scripts/smoke.material +18 -0
  43. data/samples/media/materials/textures/GreenSkin.jpg +0 -0
  44. data/samples/media/materials/textures/MtlPlat2.jpg +0 -0
  45. data/samples/media/materials/textures/RZR-002.png +0 -0
  46. data/samples/media/materials/textures/RustedMetal.jpg +0 -0
  47. data/samples/media/materials/textures/RustySteel.jpg +0 -0
  48. data/samples/media/materials/textures/Water02.jpg +0 -0
  49. data/samples/media/materials/textures/WeirdEye.png +0 -0
  50. data/samples/media/materials/textures/clouds.jpg +0 -0
  51. data/samples/media/materials/textures/cursor.png +0 -0
  52. data/samples/media/materials/textures/dirt01.jpg +0 -0
  53. data/samples/media/materials/textures/flare.png +0 -0
  54. data/samples/media/materials/textures/gras_02.png +0 -0
  55. data/samples/media/materials/textures/grass_1024.jpg +0 -0
  56. data/samples/media/materials/textures/ogreborder.png +0 -0
  57. data/samples/media/materials/textures/ogreborderUp.png +0 -0
  58. data/samples/media/materials/textures/ribbonband.png +0 -0
  59. data/samples/media/materials/textures/rockwall.tga +0 -0
  60. data/samples/media/materials/textures/rockwall_NH.tga +0 -0
  61. data/samples/media/materials/textures/smoke.png +0 -0
  62. data/samples/media/materials/textures/smokecolors.png +0 -0
  63. data/samples/media/materials/textures/spacesky.jpg +0 -0
  64. data/samples/media/materials/textures/spheremap.png +0 -0
  65. data/samples/media/materials/textures/texmap2.jpg +0 -0
  66. data/samples/media/models/RZR-002.mesh +0 -0
  67. data/samples/media/models/geosphere4500.mesh +0 -0
  68. data/samples/media/models/geosphere8000.mesh +0 -0
  69. data/samples/media/models/knot.mesh +0 -0
  70. data/samples/media/models/ogrehead.mesh +0 -0
  71. data/samples/media/models/razor.mesh +0 -0
  72. data/samples/media/models/sphere.mesh +0 -0
  73. data/samples/media/overlays/CubeMapping.overlay +139 -0
  74. data/samples/media/packs/OgreCore.zip +0 -0
  75. data/samples/media/packs/chiropteraDM.pk3 +0 -0
  76. data/samples/media/packs/chiropteraDM.txt +99 -0
  77. data/samples/media/packs/cubemap.zip +0 -0
  78. data/samples/media/packs/cubemapsJS.zip +0 -0
  79. data/samples/media/packs/dragon.zip +0 -0
  80. data/samples/media/packs/skybox.zip +0 -0
  81. data/samples/media/particles/smoke.particle +43 -0
  82. data/samples/media.cfg +22 -0
  83. data/samples/navi/Media/NaviDemo.material +60 -0
  84. data/samples/navi/Media/OgreCore.zip +0 -0
  85. data/samples/navi/Media/cerulean.jpg +0 -0
  86. data/samples/navi/Media/clouds.jpg +0 -0
  87. data/samples/navi/Media/controlsNaviMask.png +0 -0
  88. data/samples/navi/Media/grass.jpg +0 -0
  89. data/samples/navi/Media/knot.mesh +0 -0
  90. data/samples/navi/Media/testNaviMask.png +0 -0
  91. data/samples/navi/NaviLocal/Navi.js +136 -0
  92. data/samples/navi/NaviLocal/buttonBg.jpg +0 -0
  93. data/samples/navi/NaviLocal/controls.html +303 -0
  94. data/samples/navi/NaviLocal/knobBg.jpg +0 -0
  95. data/samples/navi/NaviLocal/moo.dropdownmenu.js +87 -0
  96. data/samples/navi/NaviLocal/mootools.v1.1.js +6964 -0
  97. data/samples/navi/NaviLocal/naviLogo.html +32 -0
  98. data/samples/navi/NaviLocal/naviLogo.png +0 -0
  99. data/samples/navi/NaviLocal/pageBg.jpg +0 -0
  100. data/samples/navi/NaviLocal/sliderBg.jpg +0 -0
  101. data/samples/navi/NaviLocal/test.html +5 -0
  102. data/samples/navi/NaviLocal/welcome.html +36 -0
  103. data/samples/navi/NaviLocal/welcome.png +0 -0
  104. data/samples/navi/chrome/chromelist.txt +597 -0
  105. data/samples/navi/chrome/classic.jar +0 -0
  106. data/samples/navi/chrome/classic.manifest +4 -0
  107. data/samples/navi/chrome/comm.jar +0 -0
  108. data/samples/navi/chrome/comm.manifest +2 -0
  109. data/samples/navi/chrome/en-US.jar +0 -0
  110. data/samples/navi/chrome/en-US.manifest +9 -0
  111. data/samples/navi/chrome/toolkit.jar +0 -0
  112. data/samples/navi/chrome/toolkit.manifest +6 -0
  113. data/samples/navi/components/FeedProcessor.js +1825 -0
  114. data/samples/navi/components/alerts.xpt +0 -0
  115. data/samples/navi/components/appshell.xpt +0 -0
  116. data/samples/navi/components/appstartup.xpt +0 -0
  117. data/samples/navi/components/auth.dll +0 -0
  118. data/samples/navi/components/autocomplete.xpt +0 -0
  119. data/samples/navi/components/autoconfig.dll +0 -0
  120. data/samples/navi/components/autoconfig.xpt +0 -0
  121. data/samples/navi/components/caps.xpt +0 -0
  122. data/samples/navi/components/chardet.xpt +0 -0
  123. data/samples/navi/components/chrome.xpt +0 -0
  124. data/samples/navi/components/commandhandler.xpt +0 -0
  125. data/samples/navi/components/commandlines.xpt +0 -0
  126. data/samples/navi/components/composer.xpt +0 -0
  127. data/samples/navi/components/compreg.dat +1474 -0
  128. data/samples/navi/components/content_base.xpt +0 -0
  129. data/samples/navi/components/content_html.xpt +0 -0
  130. data/samples/navi/components/content_htmldoc.xpt +0 -0
  131. data/samples/navi/components/content_xmldoc.xpt +0 -0
  132. data/samples/navi/components/content_xslt.xpt +0 -0
  133. data/samples/navi/components/content_xtf.xpt +0 -0
  134. data/samples/navi/components/directory.xpt +0 -0
  135. data/samples/navi/components/docshell_base.xpt +0 -0
  136. data/samples/navi/components/dom.xpt +0 -0
  137. data/samples/navi/components/dom_base.xpt +0 -0
  138. data/samples/navi/components/dom_canvas.xpt +0 -0
  139. data/samples/navi/components/dom_core.xpt +0 -0
  140. data/samples/navi/components/dom_css.xpt +0 -0
  141. data/samples/navi/components/dom_events.xpt +0 -0
  142. data/samples/navi/components/dom_html.xpt +0 -0
  143. data/samples/navi/components/dom_loadsave.xpt +0 -0
  144. data/samples/navi/components/dom_range.xpt +0 -0
  145. data/samples/navi/components/dom_sidebar.xpt +0 -0
  146. data/samples/navi/components/dom_storage.xpt +0 -0
  147. data/samples/navi/components/dom_stylesheets.xpt +0 -0
  148. data/samples/navi/components/dom_svg.xpt +0 -0
  149. data/samples/navi/components/dom_traversal.xpt +0 -0
  150. data/samples/navi/components/dom_views.xpt +0 -0
  151. data/samples/navi/components/dom_xbl.xpt +0 -0
  152. data/samples/navi/components/dom_xpath.xpt +0 -0
  153. data/samples/navi/components/dom_xul.xpt +0 -0
  154. data/samples/navi/components/downloads.xpt +0 -0
  155. data/samples/navi/components/editor.xpt +0 -0
  156. data/samples/navi/components/embed_base.xpt +0 -0
  157. data/samples/navi/components/extensions.xpt +0 -0
  158. data/samples/navi/components/exthandler.xpt +0 -0
  159. data/samples/navi/components/fastfind.xpt +0 -0
  160. data/samples/navi/components/feeds.xpt +0 -0
  161. data/samples/navi/components/find.xpt +0 -0
  162. data/samples/navi/components/gfx.xpt +0 -0
  163. data/samples/navi/components/gksvgrenderer.xpt +0 -0
  164. data/samples/navi/components/history.xpt +0 -0
  165. data/samples/navi/components/htmlparser.xpt +0 -0
  166. data/samples/navi/components/imglib2.xpt +0 -0
  167. data/samples/navi/components/inspector.xpt +0 -0
  168. data/samples/navi/components/intl.xpt +0 -0
  169. data/samples/navi/components/intlcmpt.xpt +0 -0
  170. data/samples/navi/components/jar.xpt +0 -0
  171. data/samples/navi/components/jsconsole-clhandler.js +170 -0
  172. data/samples/navi/components/jsconsole.xpt +0 -0
  173. data/samples/navi/components/jsdservice.xpt +0 -0
  174. data/samples/navi/components/layout_base.xpt +0 -0
  175. data/samples/navi/components/layout_printing.xpt +0 -0
  176. data/samples/navi/components/layout_xul.xpt +0 -0
  177. data/samples/navi/components/layout_xul_tree.xpt +0 -0
  178. data/samples/navi/components/locale.xpt +0 -0
  179. data/samples/navi/components/lwbrk.xpt +0 -0
  180. data/samples/navi/components/mimetype.xpt +0 -0
  181. data/samples/navi/components/mozbrwsr.xpt +0 -0
  182. data/samples/navi/components/mozfind.xpt +0 -0
  183. data/samples/navi/components/necko.xpt +0 -0
  184. data/samples/navi/components/necko_about.xpt +0 -0
  185. data/samples/navi/components/necko_cache.xpt +0 -0
  186. data/samples/navi/components/necko_cookie.xpt +0 -0
  187. data/samples/navi/components/necko_data.xpt +0 -0
  188. data/samples/navi/components/necko_dns.xpt +0 -0
  189. data/samples/navi/components/necko_file.xpt +0 -0
  190. data/samples/navi/components/necko_ftp.xpt +0 -0
  191. data/samples/navi/components/necko_http.xpt +0 -0
  192. data/samples/navi/components/necko_res.xpt +0 -0
  193. data/samples/navi/components/necko_socket.xpt +0 -0
  194. data/samples/navi/components/necko_strconv.xpt +0 -0
  195. data/samples/navi/components/necko_viewsource.xpt +0 -0
  196. data/samples/navi/components/nsCloseAllWindows.js +143 -0
  197. data/samples/navi/components/nsDefaultCLH.js +231 -0
  198. data/samples/navi/components/nsDictionary.js +148 -0
  199. data/samples/navi/components/nsExtensionManager.js +8497 -0
  200. data/samples/navi/components/nsHelperAppDlg.js +990 -0
  201. data/samples/navi/components/nsInterfaceInfoToIDL.js +590 -0
  202. data/samples/navi/components/nsKillAll.js +200 -0
  203. data/samples/navi/components/nsPostUpdateWin.js +711 -0
  204. data/samples/navi/components/nsProgressDialog.js +949 -0
  205. data/samples/navi/components/nsProxyAutoConfig.js +396 -0
  206. data/samples/navi/components/nsResetPref.js +175 -0
  207. data/samples/navi/components/nsURLFormatter.js +179 -0
  208. data/samples/navi/components/nsUpdateService.js +3074 -0
  209. data/samples/navi/components/nsXULAppInstall.js +301 -0
  210. data/samples/navi/components/nsXmlRpcClient.js +1038 -0
  211. data/samples/navi/components/oji.xpt +0 -0
  212. data/samples/navi/components/passwordmgr.xpt +0 -0
  213. data/samples/navi/components/pipboot.xpt +0 -0
  214. data/samples/navi/components/pipnss.xpt +0 -0
  215. data/samples/navi/components/plugin.xpt +0 -0
  216. data/samples/navi/components/pref.xpt +0 -0
  217. data/samples/navi/components/prefetch.xpt +0 -0
  218. data/samples/navi/components/profile.xpt +0 -0
  219. data/samples/navi/components/progressDlg.xpt +0 -0
  220. data/samples/navi/components/proxyObject.xpt +0 -0
  221. data/samples/navi/components/rdf.xpt +0 -0
  222. data/samples/navi/components/satchel.xpt +0 -0
  223. data/samples/navi/components/saxparser.xpt +0 -0
  224. data/samples/navi/components/shistory.xpt +0 -0
  225. data/samples/navi/components/storage.xpt +0 -0
  226. data/samples/navi/components/toolkitprofile.xpt +0 -0
  227. data/samples/navi/components/transformiix.dll +0 -0
  228. data/samples/navi/components/txmgr.xpt +0 -0
  229. data/samples/navi/components/txtsvc.xpt +0 -0
  230. data/samples/navi/components/uconv.xpt +0 -0
  231. data/samples/navi/components/unicharutil.xpt +0 -0
  232. data/samples/navi/components/universalchardet.dll +0 -0
  233. data/samples/navi/components/update.xpt +0 -0
  234. data/samples/navi/components/uriloader.xpt +0 -0
  235. data/samples/navi/components/urlformatter.xpt +0 -0
  236. data/samples/navi/components/webBrowser_core.xpt +0 -0
  237. data/samples/navi/components/webbrowserpersist.xpt +0 -0
  238. data/samples/navi/components/webshell_idls.xpt +0 -0
  239. data/samples/navi/components/websrvcs.dll +0 -0
  240. data/samples/navi/components/websrvcs.xpt +0 -0
  241. data/samples/navi/components/widget.xpt +0 -0
  242. data/samples/navi/components/windowds.xpt +0 -0
  243. data/samples/navi/components/windowwatcher.xpt +0 -0
  244. data/samples/navi/components/xml-rpc.xpt +0 -0
  245. data/samples/navi/components/xmlextras.dll +0 -0
  246. data/samples/navi/components/xpcom_base.xpt +0 -0
  247. data/samples/navi/components/xpcom_components.xpt +0 -0
  248. data/samples/navi/components/xpcom_ds.xpt +0 -0
  249. data/samples/navi/components/xpcom_io.xpt +0 -0
  250. data/samples/navi/components/xpcom_obsolete.xpt +0 -0
  251. data/samples/navi/components/xpcom_thread.xpt +0 -0
  252. data/samples/navi/components/xpcom_xpti.xpt +0 -0
  253. data/samples/navi/components/xpconnect.xpt +0 -0
  254. data/samples/navi/components/xpinstall.xpt +0 -0
  255. data/samples/navi/components/xpti.dat +1424 -0
  256. data/samples/navi/components/xulapp.xpt +0 -0
  257. data/samples/navi/components/xulapp_setup.xpt +0 -0
  258. data/samples/navi/components/xuldoc.xpt +0 -0
  259. data/samples/navi/components/xulrunner.xpt +0 -0
  260. data/samples/navi/components/xultmpl.xpt +0 -0
  261. data/samples/navi/components/xulutil.dll +0 -0
  262. data/samples/navi/controlsNaviMask.png +0 -0
  263. data/samples/navi/greprefs/all.js +1344 -0
  264. data/samples/navi/greprefs/security-prefs.js +69 -0
  265. data/samples/navi/greprefs/xpinstall.js +2 -0
  266. data/samples/navi/navi_demo.rb +207 -0
  267. data/samples/navi/plugins/NPSWF32.dll +0 -0
  268. data/samples/navi/plugins/flashplayer.xpt +0 -0
  269. data/samples/navi/plugins/npnul32.dll +0 -0
  270. data/samples/navi/plugins.cfg +10 -0
  271. data/samples/navi/res/EditorOverride.css +359 -0
  272. data/samples/navi/res/Thumbs.db +0 -0
  273. data/samples/navi/res/arrow.gif +0 -0
  274. data/samples/navi/res/arrowd.gif +0 -0
  275. data/samples/navi/res/bloatcycle.html +40 -0
  276. data/samples/navi/res/broken-image.gif +0 -0
  277. data/samples/navi/res/charsetData.properties +199 -0
  278. data/samples/navi/res/charsetalias.properties +517 -0
  279. data/samples/navi/res/cmessage.txt +1 -0
  280. data/samples/navi/res/dtd/xhtml11.dtd +300 -0
  281. data/samples/navi/res/entityTables/html40Latin1.properties +146 -0
  282. data/samples/navi/res/entityTables/html40Special.properties +69 -0
  283. data/samples/navi/res/entityTables/html40Symbols.properties +164 -0
  284. data/samples/navi/res/entityTables/htmlEntityVersions.properties +50 -0
  285. data/samples/navi/res/entityTables/transliterate.properties +2367 -0
  286. data/samples/navi/res/fonts/fontEncoding.properties +127 -0
  287. data/samples/navi/res/fonts/fontNameMap.properties +134 -0
  288. data/samples/navi/res/forms.css +531 -0
  289. data/samples/navi/res/grabber.gif +0 -0
  290. data/samples/navi/res/hiddenWindow.html +1 -0
  291. data/samples/navi/res/html/Thumbs.db +0 -0
  292. data/samples/navi/res/html/gopher-audio.gif +0 -0
  293. data/samples/navi/res/html/gopher-binary.gif +0 -0
  294. data/samples/navi/res/html/gopher-find.gif +0 -0
  295. data/samples/navi/res/html/gopher-image.gif +0 -0
  296. data/samples/navi/res/html/gopher-menu.gif +0 -0
  297. data/samples/navi/res/html/gopher-movie.gif +0 -0
  298. data/samples/navi/res/html/gopher-sound.gif +0 -0
  299. data/samples/navi/res/html/gopher-telnet.gif +0 -0
  300. data/samples/navi/res/html/gopher-text.gif +0 -0
  301. data/samples/navi/res/html/gopher-unknown.gif +0 -0
  302. data/samples/navi/res/html.css +478 -0
  303. data/samples/navi/res/langGroups.properties +236 -0
  304. data/samples/navi/res/language.properties +259 -0
  305. data/samples/navi/res/loading-image.gif +0 -0
  306. data/samples/navi/res/quirk.css +282 -0
  307. data/samples/navi/res/samples/Anieyes.gif +0 -0
  308. data/samples/navi/res/samples/Thumbs.db +0 -0
  309. data/samples/navi/res/samples/aform.css +69 -0
  310. data/samples/navi/res/samples/beeptest.html +18 -0
  311. data/samples/navi/res/samples/bform.css +45 -0
  312. data/samples/navi/res/samples/bg.jpg +0 -0
  313. data/samples/navi/res/samples/cform.css +40 -0
  314. data/samples/navi/res/samples/checkboxTest.xul +47 -0
  315. data/samples/navi/res/samples/demoform.css +97 -0
  316. data/samples/navi/res/samples/find.html +97 -0
  317. data/samples/navi/res/samples/gear1.gif +0 -0
  318. data/samples/navi/res/samples/image_props.html +58 -0
  319. data/samples/navi/res/samples/mozform.css +256 -0
  320. data/samples/navi/res/samples/printsetup.html +175 -0
  321. data/samples/navi/res/samples/raptor.jpg +0 -0
  322. data/samples/navi/res/samples/rock_gra.gif +0 -0
  323. data/samples/navi/res/samples/scrollbarTest1.xul +66 -0
  324. data/samples/navi/res/samples/scrollbarTest2.xul +19 -0
  325. data/samples/navi/res/samples/sliderTest1.xul +14 -0
  326. data/samples/navi/res/samples/soundtest.html +20 -0
  327. data/samples/navi/res/samples/test.wav +0 -0
  328. data/samples/navi/res/samples/test0.html +220 -0
  329. data/samples/navi/res/samples/test1.html +84 -0
  330. data/samples/navi/res/samples/test10.html +16 -0
  331. data/samples/navi/res/samples/test11.html +42 -0
  332. data/samples/navi/res/samples/test12.html +79 -0
  333. data/samples/navi/res/samples/test13.html +126 -0
  334. data/samples/navi/res/samples/test14.html +5 -0
  335. data/samples/navi/res/samples/test15.html +5 -0
  336. data/samples/navi/res/samples/test16.html +124 -0
  337. data/samples/navi/res/samples/test2.html +41 -0
  338. data/samples/navi/res/samples/test3.html +126 -0
  339. data/samples/navi/res/samples/test4.html +335 -0
  340. data/samples/navi/res/samples/test5.html +199 -0
  341. data/samples/navi/res/samples/test6.html +335 -0
  342. data/samples/navi/res/samples/test7.html +11 -0
  343. data/samples/navi/res/samples/test8-1.html +66 -0
  344. data/samples/navi/res/samples/test8.html +662 -0
  345. data/samples/navi/res/samples/test8dom.html +64 -0
  346. data/samples/navi/res/samples/test8sca.html +308 -0
  347. data/samples/navi/res/samples/test8siz.html +224 -0
  348. data/samples/navi/res/samples/test8tab.html +9 -0
  349. data/samples/navi/res/samples/test9.html +12 -0
  350. data/samples/navi/res/samples/test9a.html +39 -0
  351. data/samples/navi/res/samples/test9b.html +16 -0
  352. data/samples/navi/res/samples/test_ed.html +5 -0
  353. data/samples/navi/res/samples/test_form.html +34 -0
  354. data/samples/navi/res/samples/test_gfx.html +75 -0
  355. data/samples/navi/res/samples/test_lbox.html +100 -0
  356. data/samples/navi/res/samples/test_pr.html +87 -0
  357. data/samples/navi/res/samples/test_weight.html +45 -0
  358. data/samples/navi/res/samples/toolbarTest1.xul +51 -0
  359. data/samples/navi/res/samples/treeTest1.css +62 -0
  360. data/samples/navi/res/samples/treeTest1.xul +110 -0
  361. data/samples/navi/res/samples/xulTest.css +130 -0
  362. data/samples/navi/res/svg.css +64 -0
  363. data/samples/navi/res/table-add-column-after-active.gif +0 -0
  364. data/samples/navi/res/table-add-column-after-hover.gif +0 -0
  365. data/samples/navi/res/table-add-column-after.gif +0 -0
  366. data/samples/navi/res/table-add-column-before-active.gif +0 -0
  367. data/samples/navi/res/table-add-column-before-hover.gif +0 -0
  368. data/samples/navi/res/table-add-column-before.gif +0 -0
  369. data/samples/navi/res/table-add-row-after-active.gif +0 -0
  370. data/samples/navi/res/table-add-row-after-hover.gif +0 -0
  371. data/samples/navi/res/table-add-row-after.gif +0 -0
  372. data/samples/navi/res/table-add-row-before-active.gif +0 -0
  373. data/samples/navi/res/table-add-row-before-hover.gif +0 -0
  374. data/samples/navi/res/table-add-row-before.gif +0 -0
  375. data/samples/navi/res/table-remove-column-active.gif +0 -0
  376. data/samples/navi/res/table-remove-column-hover.gif +0 -0
  377. data/samples/navi/res/table-remove-column.gif +0 -0
  378. data/samples/navi/res/table-remove-row-active.gif +0 -0
  379. data/samples/navi/res/table-remove-row-hover.gif +0 -0
  380. data/samples/navi/res/table-remove-row.gif +0 -0
  381. data/samples/navi/res/throbber/Thumbs.db +0 -0
  382. data/samples/navi/res/throbber/anim.gif +0 -0
  383. data/samples/navi/res/throbber/anims00.gif +0 -0
  384. data/samples/navi/res/throbber/anims01.gif +0 -0
  385. data/samples/navi/res/throbber/anims02.gif +0 -0
  386. data/samples/navi/res/throbber/anims03.gif +0 -0
  387. data/samples/navi/res/throbber/anims04.gif +0 -0
  388. data/samples/navi/res/throbber/anims05.gif +0 -0
  389. data/samples/navi/res/throbber/anims06.gif +0 -0
  390. data/samples/navi/res/throbber/anims07.gif +0 -0
  391. data/samples/navi/res/throbber/anims08.gif +0 -0
  392. data/samples/navi/res/throbber/anims09.gif +0 -0
  393. data/samples/navi/res/throbber/anims10.gif +0 -0
  394. data/samples/navi/res/throbber/anims11.gif +0 -0
  395. data/samples/navi/res/throbber/anims12.gif +0 -0
  396. data/samples/navi/res/throbber/anims13.gif +0 -0
  397. data/samples/navi/res/throbber/anims14.gif +0 -0
  398. data/samples/navi/res/throbber/anims15.gif +0 -0
  399. data/samples/navi/res/throbber/anims16.gif +0 -0
  400. data/samples/navi/res/throbber/anims17.gif +0 -0
  401. data/samples/navi/res/throbber/anims18.gif +0 -0
  402. data/samples/navi/res/throbber/anims19.gif +0 -0
  403. data/samples/navi/res/throbber/anims20.gif +0 -0
  404. data/samples/navi/res/throbber/anims21.gif +0 -0
  405. data/samples/navi/res/throbber/anims22.gif +0 -0
  406. data/samples/navi/res/throbber/anims23.gif +0 -0
  407. data/samples/navi/res/throbber/anims24.gif +0 -0
  408. data/samples/navi/res/throbber/anims25.gif +0 -0
  409. data/samples/navi/res/throbber/anims26.gif +0 -0
  410. data/samples/navi/res/throbber/anims27.gif +0 -0
  411. data/samples/navi/res/throbber/anims28.gif +0 -0
  412. data/samples/navi/res/throbber/anims29.gif +0 -0
  413. data/samples/navi/res/ua.css +235 -0
  414. data/samples/navi/res/viewer.properties +1 -0
  415. data/samples/navi/res/viewsource.css +118 -0
  416. data/samples/navi/res/wincharset.properties +55 -0
  417. data/samples/navi/resources.cfg +14 -0
  418. data/samples/navi/testNaviMask.png +0 -0
  419. data/samples/ogre.cfg +8 -0
  420. data/samples/plugins.cfg +11 -0
  421. data/samples/quake3settings.cfg +2 -0
  422. data/samples/render_run_log.5796 +891 -0
  423. data/samples/render_to_texture.rb +161 -0
  424. data/samples/resources.cfg +16 -0
  425. data/samples/sky_box.rb +107 -0
  426. data/samples/sky_dome.rb +86 -0
  427. data/samples/sky_plane.rb +27 -0
  428. data/samples/smoke.rb +23 -0
  429. data/samples/work/cube_mapping.rb +686 -0
  430. metadata +500 -0
@@ -0,0 +1,686 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ require 'application'
4
+ include Ogre
5
+ include OIS
6
+
7
+ # This is a pretty much verbatim copy of the CubeMapping demo.
8
+ # Will this work in Ruby? I really don't know. There's a LOT of
9
+ # pointer arithmetic happening in the original.
10
+
11
+ # Perlin Noise data and algorithms
12
+ class Perlin
13
+ P = [
14
+ 151,160,137,91,90,15,
15
+ 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
16
+ 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
17
+ 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
18
+ 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
19
+ 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
20
+ 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
21
+ 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
22
+ 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
23
+ 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
24
+ 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
25
+ 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
26
+ 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,
27
+
28
+ 151,160,137,91,90,15,
29
+ 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
30
+ 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
31
+ 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
32
+ 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
33
+ 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
34
+ 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
35
+ 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
36
+ 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
37
+ 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
38
+ 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
39
+ 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
40
+ 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
41
+ ]
42
+
43
+ class << self
44
+
45
+ def lerp(t, a, b)
46
+ a + t * (b - a)
47
+ end
48
+
49
+ def fade(t)
50
+ t*t*t*t*(t*(t*6-15)+10)
51
+ end
52
+
53
+ # Convert Low 4 bits of hash code into
54
+ # 12 gradient directions
55
+ def grad(hash, x, y, z)
56
+ hash ||= 0
57
+ h = hash & 15
58
+ u = h < 8 || h == 12 || h == 13 ? x : y
59
+ v = h < 4 || h == 12 || h == 13 ? y : z
60
+
61
+ ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v)
62
+ end
63
+
64
+ # This is copied almost verbatim from CubeMapping demo
65
+ def noise3(x, y, z)
66
+ _x = x.floor & 225
67
+ _y = y.floor & 255
68
+ _z = z.floor & 255
69
+
70
+ x -= x.floor
71
+ y -= y.floor
72
+ z -= z.floor
73
+
74
+ u = fade(x)
75
+ v = fade(y)
76
+ w = fade(z)
77
+
78
+ a = P[_x] + _y
79
+ aa = P[a] + _z
80
+ ab = P[a + 1] + _z
81
+ b = P[_x + 1]
82
+ ba = P[b] + _z
83
+ bb = P[b + 1] + _z
84
+
85
+ # Oh snap!
86
+ return lerp(w,
87
+ lerp(v,
88
+ lerp(u,
89
+ grad(P[aa], x, y, z), # And add
90
+ grad(P[ba], x - 1, y, z)), # Blended
91
+ lerp(u,
92
+ grad(P[ab], a, y - 1, z), # Results
93
+ grad(P[bb], x - 1, y - 1, z))), # From 8
94
+ lerp(v,
95
+ lerp(u,
96
+ grad(P[aa + 1], x, y, z - 1), # Corners
97
+ grad(P[ba + a], x - 1, y, z - 1)), # Of Cube
98
+ lerp(u,
99
+ grad(P[ab + 1], x, y - 1, z - 1),
100
+ grad(P[bb + 1], x - 1, y - 1, z - 1))))
101
+
102
+ end
103
+ end
104
+ end
105
+
106
+ ENTITY_NAME = "CubeMappedEntity"
107
+ MESH_NAME = "CubeMappedMesh"
108
+
109
+ MATERIAL_NAME = "SceneCubeMap2"
110
+ SKYBOX_MATERIAL = "SceneSkyBox2"
111
+
112
+ class CubeMappingListener < ApplicationFrameListener
113
+ def initialize(root, win, cam, scene_manager, object_node)
114
+ super(root, win, cam)
115
+
116
+ @scene_manager = scene_manager
117
+ @object_node = object_node
118
+
119
+ @tm = 0
120
+ @timeout_delay = 0
121
+ @displacement = 0.1
122
+ @density = 50.0
123
+ @time_density = 5.0
124
+ @object_entity = 0
125
+ @cloned_materials = []
126
+ @cloned_mesh = nil
127
+
128
+ @noise_on = false
129
+ @current_cube_map_index = 0
130
+ @current_lbx_index = 0
131
+ @current_mesh_index = 0
132
+
133
+ @material = MaterialManager.instance.get_by_name(MATERIAL_NAME)
134
+
135
+ raise "Cannot find material #{MATERIAL_NAME}" unless @material
136
+
137
+ #puts "\tReading config"
138
+ read_config
139
+
140
+ #puts "\tSetting object"
141
+ set_object
142
+
143
+ #puts "\tSetting material blending"
144
+ set_material_blending
145
+
146
+ #puts "\tSetting cube map"
147
+ set_cube_map
148
+
149
+ #puts "\tSetting noise to On"
150
+ set_noise_on
151
+
152
+ #puts "\tUpdate Info displacement"
153
+ update_info_displacement
154
+
155
+ #puts "\tUpdate info density"
156
+ update_info_density
157
+
158
+ #puts "\tUpdate info time density"
159
+ update_info_time_density
160
+ end
161
+
162
+ def frame_started(event)
163
+ return false unless super(event)
164
+
165
+ @tm += event.time_since_last_frame / @time_density
166
+
167
+ update_noise if @noise_on
168
+
169
+ @object_node.yaw(Degree.new(20 * event.time_since_last_frame))
170
+
171
+ true
172
+ end
173
+
174
+ def adjust_range(value_key, key_plus, key_minus, min_val, max_val, change, func)
175
+ value = instance_variable_get("@#{value_key}")
176
+ if keyboard.key_down?(key_plus)
177
+ value += change
178
+ if value >= max_val
179
+ value = max_val
180
+ end
181
+ instance_variable_set("@#{value_key}", value)
182
+ send(func)
183
+ end
184
+
185
+ if keyboard.key_down?(key_minus)
186
+ value -= change
187
+ if value <= min_val
188
+ value = min_val
189
+ end
190
+ instance_variable_set("@#{value_key}", value)
191
+ send(func)
192
+ end
193
+
194
+ end
195
+
196
+ def switch_value(key, time_delay, code)
197
+ if keyboard.key_down?(key) && @timeout_delay == 0
198
+ @timeout_delay = time_delay
199
+ code.call
200
+ end
201
+ end
202
+
203
+ def process_unbuffered_key_input(event)
204
+
205
+ ret = super(event)
206
+
207
+ change_speed = event.time_since_last_frame
208
+
209
+ if keyboard.key_down?(KC_LSHIFT) || keyboard.key_down?(KC_RSHIFT)
210
+ change_speed += 10.0
211
+ end
212
+
213
+ if keyboard.key_down?(KC_LCONTROL)
214
+ change_speed /= 10.0
215
+ end
216
+
217
+ adjust_range(:displacement, OIS::KC_2, OIS::KC_1, 2, 2, 0.1 * change_speed, :update_info_displacement)
218
+ adjust_range(:density, OIS::KC_4, OIS::KC_3, 0.1, 500, 10.0 * change_speed, :update_info_density)
219
+ adjust_range(:time_density, OIS::KC_6, OIS::KC_5, 1, 10, 1.0 * change_speed, :update_info_time_density)
220
+
221
+ @timeout_delay -= event.time_since_last_frame
222
+ @timeout_delay = 0 if @timeout_delay <= 0
223
+
224
+ switch_value(OIS::KC_O, 0.5, proc { @current_mesh_index += 1; set_object})
225
+ switch_value(OIS::KC_N, 0.5, proc { @noise_on = !@noise_on; set_noise_on})
226
+ switch_value(OIS::KC_M, 0.5, proc { @current_lbx_index += 1; set_material_blending})
227
+ switch_value(OIS::KC_C, 0.5, proc { @current_cube_map_index += 1; set_cube_map})
228
+ switch_value(OIS::KC_SPACE, 0.5, proc { go_random })
229
+
230
+ ret
231
+ end
232
+
233
+ private
234
+
235
+ def read_config
236
+ cfg = ConfigFile.new
237
+ cfg.load("media.cfg")
238
+ @available_meshes = cfg.get_multi_setting("Mesh")
239
+ @available_cube_maps = cfg.get_multi_setting("CubeMap")
240
+ end
241
+
242
+ def random_from(a, b)
243
+ (rand() & 65535) / 65536.0 * (b-a) + a
244
+ end
245
+
246
+ def go_random
247
+ @displacement = random_from(0.0, 1.0)
248
+ update_info_displacement
249
+
250
+ @density = random_from(1.0, 300.0)
251
+ update_info_density
252
+
253
+ @time_density = random_from(1.0, 10.0)
254
+ update_info_time_density
255
+ end
256
+
257
+ def update_info_displacement
258
+ OverlayManager.instance.get_overlay_element("CubeMapping/Displacement").set_caption("[1/2] Displacement: #{@displacement}")
259
+ end
260
+
261
+ def update_info_density
262
+ OverlayManager.instance.get_overlay_element("CubeMapping/Density").set_caption("[3/4] Noise density: #{@density}")
263
+ end
264
+
265
+ def update_info_time_density
266
+ OverlayManager.instance.get_overlay_element("CubeMapping/TimeDensity").set_caption("[5/6] Time density: #{@time_density}")
267
+ end
268
+
269
+ def set_object
270
+ @current_mesh_index %= @available_meshes.size
271
+ mesh_name = @available_meshes[@current_mesh_index]
272
+
273
+ puts "Switching to object #{mesh_name}"
274
+
275
+ prepare_entity(mesh_name)
276
+
277
+ puts "Taking care of overlay"
278
+ OverlayManager.instance.get_overlay_element("CubeMapping/Object").set_caption("[O] Object: #{mesh_name}")
279
+ end
280
+
281
+ def set_noise_on
282
+ OverlayManager.instance.get_overlay_element("CubeMapping/Noise").set_caption("[N] Noise: #{@noise_on ? 'on' : 'off'}")
283
+ end
284
+
285
+ def set_cube_map
286
+ @current_cube_map_index %= @available_cube_maps.size
287
+ cube_map_name = @available_cube_maps[@current_cube_map_index]
288
+
289
+ pass = @material.get_technique(0).get_pass(0)
290
+
291
+ pass.get_texture_unit_state(0).get_num_frames.times do |i|
292
+ old_tex_name = pass.get_texture_unit_state(0).get_frame_texture_name(i)
293
+ old_tex = TextureManager.instance.get_by_name(old_tex_name)
294
+ TextureManager.instance.remove(old_tex_name)
295
+ end
296
+ pass.get_texture_unit_state(0).set_cubic_texture_name(cube_map_name, true)
297
+
298
+ mat2 = MaterialManager.instance.get_by_name(SKYBOX_MATERIAL)
299
+ pass2 = mat2.get_technique(0).get_pass(0)
300
+
301
+ pass2.get_texture_unit_state(0).get_num_frames.times do |i|
302
+ old_tex_name = pass2.get_texture_unit_state(0).get_frame_texture_name(i)
303
+ old_tex = TextureManager.instance.get_by_name(old_tex_name)
304
+ TextureManager.instance.remove(old_tex_name)
305
+ end
306
+ pass2.get_texture_unit_state(0).set_cubic_texture_name(cube_map_name, true)
307
+
308
+ # FIXME UG! Causing Problem
309
+ #@scene_manager.set_sky_box(true, SKYBOX_MATERIAL)
310
+
311
+ prepare_entity(@available_meshes[@current_mesh_index])
312
+ OverlayManager.instance.get_overlay_element("CubeMapping/CubeMap").set_caption("[C] CubeMap: #{cube_map_name}")
313
+ end
314
+
315
+ def set_material_blending
316
+ lbx_name = ""
317
+ @current_lbx_index %= 5
318
+ case @current_lbx_index
319
+ when 0
320
+ @current_lbx = LBX_ADD;
321
+ lbx_name = "ADD"
322
+ when 1
323
+ @current_lbx = LBX_MODULATE;
324
+ lbx_name = "MODULATE"
325
+ when 2
326
+ @current_lbx = LBX_MODULATE_X2;
327
+ lbx_name = "MODULATE X2"
328
+ when 3
329
+ @current_lbx = LBX_MODULATE_X4;
330
+ lbx_name = "MODULATE X4"
331
+ when 4
332
+ @current_lbx = LBX_SOURCE1;
333
+ lbx_name = "SOURCE1"
334
+ when 5
335
+ @current_lbx = LBX_SOURCE2;
336
+ lbx_name = "SOURCE2"
337
+ end
338
+
339
+ # Reset entities, materials, etc
340
+ prepare_entity(@available_meshes[@current_mesh_index])
341
+ OverlayManager.instance.get_overlay_element("CubeMapping/Material").set_caption("[M] Material blend: " + lbx_name)
342
+ end
343
+
344
+ def prepare_entity(mesh_name)
345
+ clear_entity if @object_entity
346
+
347
+ @original_mesh = MeshManager.instance.get_by_name(mesh_name)
348
+
349
+ if !@original_mesh
350
+ @original_mesh = MeshManager.instance.load(mesh_name,
351
+ ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)
352
+ if !@original_mesh
353
+ raise "Can't find the mesh #{mesh_name}"
354
+ end
355
+ end
356
+
357
+ prepare_cloned_mesh
358
+
359
+ @object_entity = @scene_manager.create_entity(ENTITY_NAME, MESH_NAME)
360
+ @object_entity.set_material_name(@material.get_name)
361
+ pass = @material.get_technique(0).get_pass(0)
362
+
363
+ # Go through subentities and set materials
364
+ num = @cloned_mesh.get_num_sub_meshes
365
+ num.times do |m|
366
+ sub_mesh = @cloned_mesh.get_sub_mesh(m)
367
+ sub_entity = @object_entity.get_sub_entity(m)
368
+
369
+ if sub_mesh.is_mat_initialised?
370
+ mat_name = sub_mesh.get_material_name
371
+ sub_mat = MaterialManager.instance.get_by_name(mat_name)
372
+
373
+ unless sub_mat
374
+ sub_mat.load
375
+ cloned = sub_mat.clone("CubeMapTempMaterial##{m}")
376
+ cloned_pass = cloned.get_technique(0).get_pass(0)
377
+
378
+ # the knot, it needs to scroll!
379
+ if mesh_name == "knot.mesh"
380
+ cloned_pass.get_num_texture_unit_states.times do |tl|
381
+ tlayer = cloned_pass.get_texture_unit_state(tl)
382
+ tlayer.set_scroll_animation(1.0, 0)
383
+ end
384
+ end
385
+
386
+ # Layers
387
+ pass.get_num_texture_unit_states.times do |tl|
388
+ org_tl = pass.get_texture_unit_state(tl)
389
+ new_tl = cloned_pass.create_texture_unit_state(org_tl.get_texture_name)
390
+ # Um, *new_tl = *org_tl ?
391
+ new_tl = org_tl
392
+ new_tl.set_colour_operation_ex(@current_lbx)
393
+ end
394
+
395
+ sub_entity.set_material_name(cloned.get_name)
396
+ @cloned_materials << cloned
397
+ end
398
+ end
399
+ end
400
+
401
+ @object_node.attach_object(@object_entity)
402
+
403
+ if @noise_on
404
+ update_noise
405
+ end
406
+ end
407
+
408
+ def prepare_cloned_mesh
409
+ @cloned_mesh = MeshManager.instance.create_manual(MESH_NAME,
410
+ ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)
411
+ @cloned_mesh._set_bounds(@original_mesh.get_bounds)
412
+ @cloned_mesh._set_bounding_sphere_radius(@original_mesh.get_bounding_sphere_radius)
413
+
414
+ @cloned_mesh.shared_vertex_data = prepare_vertex_data(@original_mesh.shared_vertex_data)
415
+
416
+ @original_mesh.get_num_sub_meshes.times do |sm|
417
+ org_sm = @original_mesh.get_sub_mesh(sm)
418
+ new_sm = @cloned_mesh.create_sub_mesh
419
+
420
+ if org_sm.is_mat_initialised?
421
+ new_sm.set_material_name(org_sm.get_material_name)
422
+ end
423
+
424
+ new_sm.use_shared_vertices = org_sm.use_shared_vertices?
425
+ # Vertex data
426
+ new_sm.vertex_data = prepare_vertex_data(org_sm.vertex_data)
427
+ # Reuse index
428
+ new_sm.index_data.index_buffer = org_sm.index_data.index_buffer
429
+ new_sm.index_data.index_start = org_sm.index_data.index_start
430
+ new_sm.index_data.index_count = org_sm.index_data.index_count
431
+ end
432
+ end
433
+
434
+ def prepare_vertex_data(org_vd)
435
+ return nil unless org_vd
436
+
437
+ # Hacky bit: reorganise vertex buffers to a buffer-per-element
438
+ # Since this demo was written a while back to assume that
439
+ # Really this demo should be replaced with a vertex program noise
440
+ # distortion, but left the software for now since it's nice for older
441
+ # card owners
442
+ new_decl = org_vd.vertex_declaration.clone
443
+ elems = new_decl.get_elements
444
+ buff = 0
445
+ elems.each do |elem|
446
+ new_decl.modify_element(buff, buff, 0, elem.get_type, elem.get_semantic, elem.get_index)
447
+ buff += 1
448
+ end
449
+
450
+ org_vd.reorganise_buffers(new_decl)
451
+
452
+ new_vd = VertexData.new
453
+ # Copy that which does not change
454
+ new_vd.vertex_count = org_vd.vertex_count
455
+ new_vd.vertex_start = org_vd.vertex_start
456
+ # Now copy vertex buffers, looking in the declarations
457
+ new_vdecl = new_vd.vertex_declaration
458
+ new_vbind = new_vd.vertex_buffer_binding
459
+
460
+ org_vel = org_vd.vertex_declaration.get_elements
461
+ org_vel.each do |veli|
462
+ ves = veli.get_semantic
463
+ source = veli.get_source
464
+
465
+ org_buf = org_vd.vertex_buffer_binding.get_buffer(source)
466
+
467
+ # Check usage of new buffer
468
+ dynamic = false
469
+ case ves
470
+ when [VES_NORMAL, VES_POSITION]
471
+ dynamic = true
472
+ else
473
+ dynamic = false
474
+ end
475
+
476
+ if dynamic
477
+ new_buf = HardwareBufferManager.instance.create_vertex_buffer(
478
+ org_buff.get_vertex_size, org_buff.get_num_vertices,
479
+ HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE,
480
+ true)
481
+ new_buff.copy_data(org_buff, 0, 0, org_buff.get_size_in_bytes, true)
482
+ new_vbind.set_binding(source, new_buf)
483
+ else
484
+ new_vbind.set_binding(source, org_buf)
485
+ end
486
+
487
+ # Add element for declaration
488
+ new_vdecl.add_element(source, veli.get_offset, veli.get_type,
489
+ ves, veli.get_index)
490
+ end
491
+
492
+ new_vd
493
+ end
494
+
495
+ def clear_entity
496
+ @cloned_materials.each do |cm|
497
+ MaterialManager.instance.remove(cm.get_handle)
498
+ end
499
+
500
+ @cloned_materials.clear
501
+
502
+ @object_node.detach_all_objects
503
+ @scene_manager.destroy_entity(ENTITY_NAME)
504
+
505
+ MeshManager.instance.remove(@cloned_mesh.get_handle) if @cloned_mesh
506
+
507
+ @object_entity = nil
508
+ end
509
+
510
+ def update_noise
511
+ shared_normals = nil
512
+ normals = nil
513
+
514
+ @cloned_mesh.get_num_sub_meshes.times do |m|
515
+ sub_mesh = @cloned_mesh.get_sub_mesh(m)
516
+ org_sub_mesh = @original_mesh.get_sub_mesh(m)
517
+
518
+ if sub_mesh.use_shared_vertices?
519
+ if !shared_normals
520
+ shared_normals = normals_get_cleared(@cloned_mesh.shared_vertex_data)
521
+ end
522
+
523
+ update_vertex_data_noise_and_normals(
524
+ @cloned_mesh.shared_vertex_data,
525
+ @original_mesh.shared_vertex_data,
526
+ sub_mesh.index_data,
527
+ shared_normals)
528
+ else
529
+ normals = normals_get_cleared(sub_mesh.vertex_data)
530
+
531
+ update_vertex_data_noise_and_normals(
532
+ sub_mesh.vertex_data,
533
+ org_sub_mesh.vertex_data,
534
+ sub_mesh.index_data,
535
+ normals)
536
+ normals_save_normalized(sub_mesh.vertex_data, normals)
537
+ end
538
+ end
539
+
540
+ if shared_normals
541
+ normals_save_normalized(@cloned_mesh.shared_vertex_data, shared_normals)
542
+ end
543
+ end
544
+
545
+ def normals_get_cleared(vertex_data)
546
+ norm_ve = vertex_data.vertex_declaration.find_element_by_semantic(VES_NORMAL)
547
+ norm_hvb = vertex_data.vertex_buffer_binding.get_buffer(norm_ve.get_source)
548
+ normals = norm_hvb.lock(vertex_data.vertex_declaration, HardwareBuffer::HBL_DISCARD)
549
+ # FIXME Um, memset?
550
+ normals
551
+ end
552
+
553
+ def normals_save_normalized(vertex_data, normals)
554
+ norm_ve = vertex_data.vertex_declaration.find_element_by_semantic(VES_NORMAL)
555
+ norm_hvb = vertex_data.vertex_buffer_binding.get_buffer(norm_ve.get_source)
556
+ i = 0
557
+ num_verts = norm_hvb.get_num_vertices
558
+ while i < num_verts
559
+ n = Vector3.new(normals[0], normals[1], normals[2])
560
+ n.normalise!
561
+
562
+ normals[0] = n.x
563
+ normals[1] = n.y
564
+ normals[2] = n.z
565
+ i += 3
566
+ end
567
+ norm_hvb.unlock
568
+ end
569
+
570
+ def update_vertex_data_noise_and_normals(dst_data, org_data, index_data, normals)
571
+ # Find destination vertex buffer
572
+ dst_ve_pos = dst_data.vertex_declaration.find_element_by_semantic(VES_POSITION)
573
+ dst_hvb_pos = dst_data.vertex_buffer_binding.get_buffer(dst_ve_pos.get_source)
574
+
575
+ # Find source vertex buffer
576
+ org_ve_pos = org_data.vertex_declaration.find_element_by_semantic(VES_POSITION)
577
+ org_hvb_pos = org_data.vertex_buffer_binding.get_buffer(org_ve_pos.get_source)
578
+
579
+ # Lock buffers
580
+ dst_data_pos = dst_hvb_pos.lock(dst_data.vertex_declaration, HardwareBuffer::HBL_DISCARD)
581
+ org_data_pos = org_hvb_pos.lock(org_data.vertex_declaration, HardwareBuffer::HBL_READ_ONLY)
582
+
583
+ # Noise!
584
+ num_verts = org_hvb_pos.get_num_vertices
585
+ i = 0
586
+ while i < num_verts
587
+ org_data = org_data_pos.get_float(i, VES_POSITION, 3)
588
+ n = 1 + @displacement * Perlin.noise3(
589
+ org_data[0] / @density + @tm,
590
+ org_data[1] / @density + @tm,
591
+ org_data[2] / @density + @tm)
592
+ dst_data_pos.set_float(i, VES_POSITION, org_data[0] * n,
593
+ org_data[1] * n,
594
+ org_data[2] * n)
595
+ i += 3
596
+ end
597
+
598
+ # Unlock original position buffer
599
+ org_hvb_pos.unlock
600
+
601
+ # Calculate normals
602
+ index_hb = index_data.index_buffer
603
+ vertex_indicies = index_hb.lock(HardwareBuffer::HBL_READ_ONLY)
604
+ num_faces = index_data.index_count / 3
605
+ i = 0
606
+ while i < num_faces
607
+ p0 = vertex_indicies[0]
608
+ p1 = vertex_indicies[1]
609
+ p2 = vertex_indicies[2]
610
+
611
+ dst_data = dst_data_pos.get_float(3 * p0, VES_POSITION, 3)
612
+ v0 = Vector3.new(dst_data[0], dst_data[1], dst_data[2])
613
+
614
+ dst_data = dst_data_pos.get_float(3 * p1, VES_POSITION, 3)
615
+ v1 = Vector3.new(dst_data[0], dst_data[1], dst_data[2])
616
+
617
+ dst_data = dst_data_pos.get_float(3 * p2, VES_POSITION, 3)
618
+ v2 = Vector3.new(dst_data[0], dst_data[1], dst_data[2])
619
+
620
+ diff1 = v1 - v2
621
+ diff2 = v1 - v0
622
+ vn = diff1.cross_product(diff2)
623
+
624
+ normals.set_float(3 * p0, VES_POSITION,
625
+ normals.get_float(3 * p0, VES_POSITION, 1)[0] + vn.x,
626
+ normals.get_float(3 * p0 + 1, VES_POSITION, 1)[0] + vn.y,
627
+ normals.get_float(3 * p0 + 2, VES_POSITION, 1)[0] + vn.z
628
+ )
629
+ #normals[3 * p0] += vn.x
630
+ #normals[3 * p0 + 1] += vn.y
631
+ #normals[3 * p0 + 2] += vn.z
632
+
633
+ normals.set_float(3 * p0, VES_POSITION,
634
+ normals.get_float(3 * p1, VES_POSITION, 1)[0] + vn.x,
635
+ normals.get_float(3 * p1 + 1, VES_POSITION, 1)[0] + vn.y,
636
+ normals.get_float(3 * p1 + 2, VES_POSITION, 1)[0] + vn.z
637
+ )
638
+ #normals[3 * p1] += vn.x
639
+ #normals[3 * p1 + 1] += vn.y
640
+ #normals[3 * p1 + 2] += vn.z
641
+
642
+ normals.set_float(3 * p2, VES_POSITION,
643
+ normals.get_float(3 * p2, VES_POSITION, 1)[0] + vn.x,
644
+ normals.get_float(3 * p2 + 1, VES_POSITION, 1)[0] + vn.y,
645
+ normals.get_float(3 * p2 + 2, VES_POSITION, 1)[0] + vn.z
646
+ )
647
+ #normals[3 * p2] += fn.x
648
+ #normals[3 * p2 + 1] += fn.y
649
+ #normals[3 * p2 + 2] += fn.z
650
+
651
+ i += 3
652
+ end
653
+
654
+ index_hb.unlock
655
+
656
+ dst_hvb_pos.unlock
657
+ end
658
+
659
+ end
660
+
661
+ class CubeMappingApplication < Application
662
+ def create_scene
663
+ # Make sure cube mapping is supported
664
+ if !root.get_render_system.get_capabilities.has_capability?(RSC_CUBEMAPPING)
665
+ raise "Your card does not support cube mapping, so we cannot run this demo. Sorry"
666
+ end
667
+
668
+ scene_manager.set_ambient_light(ColourValue.new(0.5, 0.5, 0.5))
669
+ scene_manager.set_sky_box(true, SKYBOX_MATERIAL)
670
+
671
+ l = scene_manager.create_light("MainLight")
672
+ l.set_position(20, 80, 50)
673
+
674
+ @object_node = scene_manager.root_scene_node.create_child_scene_node
675
+
676
+ overlay = OverlayManager.instance.get_by_name("CubeMappingOverlay")
677
+ overlay.show
678
+ end
679
+
680
+ def create_frame_listener
681
+ self.frame_listener = CubeMappingListener.new(root, window, camera, scene_manager, @object_node)
682
+ end
683
+ end
684
+
685
+ app = CubeMappingApplication.new
686
+ app.go