ogre.rb 0.1-i386-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/README +79 -0
  2. data/Rakefile +291 -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.dll +0 -0
  11. data/lib/ruby_ois.dll +0 -0
  12. data/ogre.rb +25 -0
  13. data/platform.rb +23 -0
  14. data/samples/Ogre.log +279 -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/Thumbs.db +0 -0
  49. data/samples/media/materials/textures/Water02.jpg +0 -0
  50. data/samples/media/materials/textures/WeirdEye.png +0 -0
  51. data/samples/media/materials/textures/clouds.jpg +0 -0
  52. data/samples/media/materials/textures/cursor.png +0 -0
  53. data/samples/media/materials/textures/dirt01.jpg +0 -0
  54. data/samples/media/materials/textures/flare.png +0 -0
  55. data/samples/media/materials/textures/gras_02.png +0 -0
  56. data/samples/media/materials/textures/grass_1024.jpg +0 -0
  57. data/samples/media/materials/textures/ogreborder.png +0 -0
  58. data/samples/media/materials/textures/ogreborderUp.png +0 -0
  59. data/samples/media/materials/textures/ribbonband.png +0 -0
  60. data/samples/media/materials/textures/rockwall.tga +0 -0
  61. data/samples/media/materials/textures/rockwall_NH.tga +0 -0
  62. data/samples/media/materials/textures/smoke.png +0 -0
  63. data/samples/media/materials/textures/smokecolors.png +0 -0
  64. data/samples/media/materials/textures/spacesky.jpg +0 -0
  65. data/samples/media/materials/textures/spheremap.png +0 -0
  66. data/samples/media/materials/textures/texmap2.jpg +0 -0
  67. data/samples/media/models/RZR-002.mesh +0 -0
  68. data/samples/media/models/geosphere4500.mesh +0 -0
  69. data/samples/media/models/geosphere8000.mesh +0 -0
  70. data/samples/media/models/knot.mesh +0 -0
  71. data/samples/media/models/ogrehead.mesh +0 -0
  72. data/samples/media/models/razor.mesh +0 -0
  73. data/samples/media/models/sphere.mesh +0 -0
  74. data/samples/media/overlays/CubeMapping.overlay +139 -0
  75. data/samples/media/packs/OgreCore.zip +0 -0
  76. data/samples/media/packs/chiropteraDM.pk3 +0 -0
  77. data/samples/media/packs/chiropteraDM.txt +99 -0
  78. data/samples/media/packs/cubemap.zip +0 -0
  79. data/samples/media/packs/cubemapsJS.zip +0 -0
  80. data/samples/media/packs/dragon.zip +0 -0
  81. data/samples/media/packs/skybox.zip +0 -0
  82. data/samples/media/particles/smoke.particle +43 -0
  83. data/samples/media.cfg +22 -0
  84. data/samples/ogre.cfg +19 -0
  85. data/samples/plugins.cfg +12 -0
  86. data/samples/quake3settings.cfg +2 -0
  87. data/samples/render_to_texture.rb +161 -0
  88. data/samples/resources.cfg +16 -0
  89. data/samples/sky_box.rb +107 -0
  90. data/samples/sky_dome.rb +86 -0
  91. data/samples/sky_plane.rb +27 -0
  92. data/samples/smoke.rb +23 -0
  93. data/samples/work/cube_mapping.rb +686 -0
  94. metadata +149 -0
@@ -0,0 +1,139 @@
1
+ CubeMappingOverlay
2
+ {
3
+ zorder 500
4
+ // Stats block
5
+ container BorderPanel(Core/CubeMappingPanel)
6
+ {
7
+ metrics_mode pixels
8
+ vert_align top
9
+ left 5
10
+ top 5
11
+ width 250
12
+ height 130
13
+ material Core/StatsBlockCenter
14
+ border_size 1 1 1 1
15
+ border_material Core/StatsBlockBorder
16
+ border_topleft_uv 0.0000 1.0000 0.0039 0.9961
17
+ border_top_uv 0.0039 1.0000 0.9961 0.9961
18
+ border_topright_uv 0.9961 1.0000 1.0000 0.9961
19
+ border_left_uv 0.0000 0.9961 0.0039 0.0039
20
+ border_right_uv 0.9961 0.9961 1.0000 0.0039
21
+ border_bottomleft_uv 0.0000 0.0039 0.0039 0.0000
22
+ border_bottom_uv 0.0039 0.0039 0.9961 0.0000
23
+ border_bottomright_uv 0.9961 0.0039 1.0000 0.0000
24
+
25
+ element TextArea(CubeMapping/Displacement)
26
+ {
27
+ metrics_mode pixels
28
+ left 5
29
+ top 5
30
+ width 90
31
+ height 30
32
+ font_name BlueHighway
33
+ char_height 16
34
+ caption [1/2] Displacement:
35
+ colour_top 0.5 0.7 0.5
36
+ colour_bottom 0.3 0.5 0.3
37
+ }
38
+
39
+ element TextArea(CubeMapping/Density)
40
+ {
41
+ metrics_mode pixels
42
+ left 5
43
+ top 20
44
+ width 90
45
+ height 30
46
+ font_name BlueHighway
47
+ char_height 16
48
+ caption [3/4] Noise density:
49
+ colour_top 0.5 0.7 0.5
50
+ colour_bottom 0.3 0.5 0.3
51
+ }
52
+
53
+ element TextArea(CubeMapping/TimeDensity)
54
+ {
55
+ metrics_mode pixels
56
+ left 5
57
+ top 35
58
+ width 90
59
+ height 30
60
+ font_name BlueHighway
61
+ char_height 16
62
+ caption [5/6] Time density:
63
+ colour_top 0.5 0.7 0.5
64
+ colour_bottom 0.3 0.5 0.3
65
+ }
66
+
67
+
68
+ element TextArea(CubeMapping/Noise)
69
+ {
70
+ metrics_mode pixels
71
+ left 5
72
+ top 50
73
+ width 90
74
+ height 30
75
+ font_name BlueHighway
76
+ char_height 16
77
+ caption [N] Noise: _not_set_
78
+ colour_top 0.5 0.7 0.5
79
+ colour_bottom 0.3 0.5 0.3
80
+ }
81
+
82
+ element TextArea(CubeMapping/Material)
83
+ {
84
+ metrics_mode pixels
85
+ left 5
86
+ top 65
87
+ width 90
88
+ height 30
89
+ font_name BlueHighway
90
+ char_height 16
91
+ caption [M] Material: *UNIMPLEMENTED*
92
+ colour_top 0.5 0.7 0.5
93
+ colour_bottom 0.3 0.5 0.3
94
+ }
95
+
96
+ element TextArea(CubeMapping/Object)
97
+ {
98
+ metrics_mode pixels
99
+ left 5
100
+ top 80
101
+ width 90
102
+ height 30
103
+ font_name BlueHighway
104
+ char_height 16
105
+ caption [O] Object:
106
+ colour_top 0.5 0.7 0.5
107
+ colour_bottom 0.3 0.5 0.3
108
+ }
109
+
110
+ element TextArea(CubeMapping/CubeMap)
111
+ {
112
+ metrics_mode pixels
113
+ left 5
114
+ top 95
115
+ width 90
116
+ height 30
117
+ font_name BlueHighway
118
+ char_height 16
119
+ caption [C] CubeMap:
120
+ colour_top 0.5 0.7 0.5
121
+ colour_bottom 0.3 0.5 0.3
122
+ }
123
+
124
+ element TextArea(CubeMapping/Random)
125
+ {
126
+ metrics_mode pixels
127
+ left 5
128
+ top 110
129
+ width 90
130
+ height 30
131
+ font_name BlueHighway
132
+ char_height 16
133
+ caption [SPACE] Go random!
134
+ colour_top 0.5 0.7 0.5
135
+ colour_bottom 0.3 0.5 0.3
136
+ }
137
+
138
+ }
139
+ }
Binary file
@@ -0,0 +1,99 @@
1
+ date: September 17th 2001.
2
+ Quake3Arena DM level.
3
+
4
+ ====================================================
5
+ title: ChiropteraDM
6
+ file: ChiropteraDM.pk3
7
+
8
+ authors: Alcatraz / Nunuk / Sock
9
+
10
+ Alcatraz alcatraz@planetquake.com
11
+ http://www.planetquake.com/bighouse
12
+ Nunuk: nunuk@planetquake.com
13
+ http://www.planetquake.com/nunuk
14
+ Sock: sock@planetquake.com
15
+ http://www.planetquake.com/simland
16
+ ====================================================
17
+ Components
18
+
19
+ Architecture: Nunuk
20
+ Gameplay: Alcatraz
21
+ Textures: Sock / Arnaud "pikouze" barros / Nunuk
22
+
23
+ ====================================================
24
+ Play information
25
+
26
+ tourney: yes
27
+ deathmatch: 2-6
28
+ Bot File (aas): yes (Optimized)
29
+
30
+ how to play place chiropteraDM.pk3 in your
31
+ /Quake III Arena/baseq3/ folder
32
+ start quake3 Arena
33
+ hit ~
34
+ type /map chiropteraDM
35
+ type /addbot <botname> <skill>
36
+ hit ~ (to clear the console)
37
+
38
+ Note: If the map does not start automatically after loading then make
39
+ sure you have the SV_PURE variable set to 0. I also included an arena
40
+ file in the pk3 file so that it can be loaded from the menus.
41
+
42
+ ====================================================
43
+ Construction
44
+
45
+ editor: Q3Radiant 197 by Id Software
46
+ build time: Original Map : 3 months, New version : 1 month
47
+ build version: 6(F)
48
+
49
+ ====================================================
50
+ New Beta testers: Nunuk, Ttimo, NakedApe, Shallow[BAP]
51
+
52
+ Thanks from Sock:
53
+
54
+ Ttimo : for advice and testing.
55
+ NakedApe : for advice on TA items and testing.
56
+ alcatraz : for taking time on the level, and for his item placement.
57
+ Zed the best gf ever :P
58
+
59
+ Additional thanks from Nunuk:
60
+
61
+ my wife lorene. for her patience.
62
+ my son arthur.(stop slapping dad's keyboard!)
63
+ for advice and testing : nanospawn, bal, sock, shod, ttimo, spog.
64
+ auhsan - for inspiration :o)
65
+ th - too bad for the title, it will be for the next map.
66
+ just for being there : lunaran, grindspire, friction, and all at TF.
67
+ cool_ber - for being cool :>
68
+ ptit benj - always there for cool advices
69
+ bengal - for his awesome artwork
70
+ pappy-r, will, ash, and staff, @ planetquake
71
+ all the guys at qmap and terrafusion
72
+ ohz, shod and fff - for pimping and for always reminding me that i'll
73
+ become a real mapper when i'll stop doing these crappy space maps .... :oD
74
+ www.quakexpert.com
75
+ darkworks
76
+ yan "la crampe" - the only "dm17sucks" dude that passes at
77
+ least one hour a day playing in it.
78
+ arnaud "pikouse" - for allowing me to modify his own texes.
79
+ roland "poz_kak"
80
+
81
+
82
+ Thanx to all the other people that i could have forgot. ;)
83
+
84
+ ====================================================
85
+ Distribution / Copyright / Permissions
86
+
87
+ Copyright (c) 2001 sock, sock@planetquake.com
88
+ All rights reserved.
89
+
90
+ Quake III Arena is a registered trademark of
91
+ id Software, Inc.
92
+
93
+ This level may be electronically distributed only at
94
+ NO CHARGE to the recipient in its current state, MUST
95
+ include this .txt file, and may NOT be modified IN
96
+ ANY WAY. UNDER NO CIRCUMSTANCES IS THIS LEVEL TO BE
97
+ DISTRIBUTED ON CD-ROM WITHOUT PRIOR WRITTEN PERMISSION.
98
+
99
+ ====================================================
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,43 @@
1
+ // Example particle systems
2
+
3
+ // smoke
4
+ Smoke
5
+ {
6
+ material Smoke
7
+ particle_width 55
8
+ particle_height 55
9
+ cull_each true
10
+ quota 500
11
+ billboard_type point
12
+ sorted true
13
+
14
+ // Area emitter
15
+ emitter Point
16
+ {
17
+ angle 11
18
+ emission_rate 15
19
+ time_to_live 4
20
+ direction 0 1 0
21
+ velocity_min 150
22
+ velocity_max 240
23
+ }
24
+
25
+ affector ColourImage
26
+ {
27
+ image smokecolors.png
28
+ }
29
+
30
+ affector Rotator
31
+ {
32
+ rotation_range_start 0
33
+ rotation_range_end 360
34
+ rotation_speed_range_start -60
35
+ rotation_speed_range_end 200
36
+ }
37
+
38
+ affector Scaler
39
+ {
40
+ rate 100
41
+ }
42
+
43
+ }
data/samples/media.cfg ADDED
@@ -0,0 +1,22 @@
1
+ Mesh=ogrehead.mesh
2
+ # missing material
3
+ #Mesh=geosphere4500.mesh
4
+ # works but crashes (seg fault)
5
+ Mesh=razor.mesh
6
+ # works but crashes (seg fault)
7
+ Mesh=knot.mesh
8
+ # works but crashes (seg fault)
9
+ Mesh=RZR-002.mesh
10
+ # missing material
11
+ #Mesh=geosphere8000.mesh
12
+
13
+ Mesh=sphere.mesh
14
+
15
+ CubeMap=cubescene.jpg
16
+ CubeMap=early_morning.jpg
17
+ CubeMap=cubemap.jpg
18
+ CubeMap=morning.jpg
19
+ CubeMap=cloudy_noon.jpg
20
+ CubeMap=evening.jpg
21
+ CubeMap=stormy.jpg
22
+ CubeMap=stevecube.jpg
data/samples/ogre.cfg ADDED
@@ -0,0 +1,19 @@
1
+ Render System=Direct3D9 Rendering Subsystem
2
+
3
+ [OpenGL Rendering Subsystem]
4
+ Colour Depth=32
5
+ Display Frequency=N/A
6
+ FSAA=0
7
+ Full Screen=No
8
+ RTT Preferred Mode=FBO
9
+ VSync=No
10
+ Video Mode=1024 x 768
11
+
12
+ [Direct3D9 Rendering Subsystem]
13
+ Allow NVPerfHUD=No
14
+ Anti aliasing=NonMaskable 4
15
+ Floating-point mode=Fastest
16
+ Full Screen=No
17
+ Rendering Device=NVIDIA GeForce 6800 Series GPU
18
+ VSync=No
19
+ Video Mode=1024 x 768 @ 32-bit colour
@@ -0,0 +1,12 @@
1
+ # Defines plugins to load
2
+
3
+ # Define plugin folder
4
+ PluginFolder=D:\Programming\engines\Ogre1.4.1SDK\bin\release
5
+ #PluginFolder=/usr/local/lib/OGRE/
6
+
7
+ Plugin=RenderSystem_GL
8
+ Plugin=RenderSystem_Direct3D9
9
+ Plugin=Plugin_OctreeSceneManager
10
+ Plugin=Plugin_ParticleFX
11
+ Plugin=Plugin_BSPSceneManager
12
+ Plugin=Plugin_CgProgramManager
@@ -0,0 +1,2 @@
1
+ Pak0Location: ./media/packs/chiropteraDM.pk3
2
+ Map: maps/chiropteradm.bsp
@@ -0,0 +1,161 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + "/.."
4
+ require 'ogre'
5
+ require 'application'
6
+ include Ogre
7
+
8
+ class RenderToTextureListener < ApplicationFrameListener
9
+ def initialize(root, window, cam, reflect_cam, plane)
10
+ super(root, window, cam)
11
+ @reflect_cam = reflect_cam
12
+ @plane = plane
13
+
14
+ end
15
+
16
+ def frame_started(event)
17
+ return false unless super(event)
18
+
19
+ #GC.start
20
+
21
+ # Update reflection camera
22
+ @reflect_cam.set_orientation(camera.get_orientation)
23
+ @reflect_cam.set_position(camera.get_position)
24
+
25
+ # Rotate the plane
26
+ @plane.yaw(Degree.new(30 * event.time_since_last_frame), Node::TS_PARENT)
27
+
28
+ true
29
+ end
30
+ end
31
+
32
+ # Is this class really needed? Not using and the demo looks fine
33
+ class RTTRenderTargetListener < RenderTargetListener
34
+ def initialize(plane_entity)
35
+ super()
36
+ @plane = plane_entity
37
+ end
38
+
39
+ def pre_render_target_update(event)
40
+ @plane.set_visible(false)
41
+ end
42
+
43
+ def post_render_target_update(event)
44
+ @plane.set_visible(true)
45
+ end
46
+ end
47
+
48
+ class RenderToTextureApplication < Application
49
+
50
+ def create_scene
51
+ scene_manager.set_ambient_light(Ogre::ColourValue.new(0.2, 0.2, 0.2))
52
+ scene_manager.set_sky_box(true, "MorningSkyBox")
53
+
54
+ light = scene_manager.create_light("MainLight")
55
+ light.set_type(Light::LT_DIRECTIONAL)
56
+
57
+ dir = Vector3.new(0.5, -1, 0)
58
+ dir.normalise!
59
+
60
+ light.set_direction(dir)
61
+ light.set_diffuse_colour(1.0, 1.0, 0.8)
62
+ light.set_specular_colour(1.0, 1.0, 1.0)
63
+
64
+ @plane = MovablePlane.new("ReflectPlane")
65
+ @plane.d = 0
66
+ @plane.normal = Vector3.UNIT_Y
67
+
68
+ MeshManager.instance.create_plane("ReflectionPlane",
69
+ ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
70
+ @plane, 2000, 2000,
71
+ 1, 1, true, 1, 1, 1, Vector3.UNIT_Z)
72
+
73
+ @plane_entity = scene_manager.create_entity("Plane", "ReflectionPlane")
74
+
75
+ knot_entity = scene_manager.create_entity("Knot", "knot.mesh")
76
+ knot_entity.set_material_name("TextureEffect2")
77
+
78
+ ogre_head = scene_manager.create_entity("Head", "ogrehead.mesh")
79
+
80
+ root = scene_manager.root_scene_node
81
+
82
+ # Setting up the plane in the scene
83
+ @plane_node = root.create_child_scene_node
84
+ @plane_node.attach_object(@plane_entity)
85
+ @plane_node.attach_object(@plane)
86
+ @plane_node.translate(0, -10, 0)
87
+
88
+ # Tilt cause it's cool
89
+ @plane_node.roll(Degree.new(5))
90
+
91
+ root.create_child_scene_node("Head").attach_object(ogre_head)
92
+
93
+ texture = TextureManager.instance.create_manual("RttTex",
94
+ ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D,
95
+ 512, 512, 1, -1, PF_R8G8B8, TU_RENDERTARGET)
96
+
97
+ target = texture.get_buffer.get_render_target
98
+
99
+ @reflect_cam = scene_manager.create_camera("ReflectCam")
100
+ @reflect_cam.set_near_clip_distance(camera.get_near_clip_distance)
101
+ @reflect_cam.set_far_clip_distance(camera.get_far_clip_distance)
102
+
103
+ # Make sure these are floats, otherwise we get a much smaller aspect ratio than expected
104
+ @reflect_cam.set_aspect_ratio(
105
+ window.get_viewport(0).get_actual_width * 1.0 / window.get_viewport(0).get_actual_height * 1.0)
106
+
107
+ viewport = target.add_viewport(@reflect_cam)
108
+ viewport.set_clear_every_frame(true)
109
+ viewport.set_background_colour(ColourValue.Black)
110
+
111
+ mat = MaterialManager.instance.create("RttMat",
112
+ ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)
113
+
114
+
115
+ mat.get_technique(0).get_pass(0).create_texture_unit_state("RustedMetal.jpg")
116
+ tex_unit_state = mat.get_technique(0).get_pass(0).create_texture_unit_state("RttTex")
117
+ tex_unit_state.set_colour_operation_ex(LBX_BLEND_MANUAL, LBS_TEXTURE, LBS_CURRENT,
118
+ ColourValue.White, ColourValue.White, 0.25)
119
+
120
+ tex_unit_state.set_texture_addressing_mode(TextureUnitState::TAM_CLAMP)
121
+ tex_unit_state.set_projective_texturing(true, @reflect_cam)
122
+
123
+ #puts "", "Registering our listener"
124
+ #@rt_listener = RTTRenderTargetListener.new(@plane_entity)
125
+ #target.add_listener(@rt_listener)
126
+
127
+ @reflect_cam.enable_reflection(@plane)
128
+ @reflect_cam.enable_custom_near_clip_plane(@plane)
129
+
130
+ @plane_entity.set_material_name("RttMat")
131
+
132
+ # Create some knots
133
+ clone_ent = nil
134
+ 10.times do |i|
135
+ node = scene_manager.create_scene_node
136
+ pos = Vector3.new
137
+ pos.x = Ogre::Math.symmetric_random * 750.0
138
+ pos.y = Ogre::Math.symmetric_random * 100.0 + 25
139
+ pos.z = Ogre::Math.symmetric_random * 750.0
140
+
141
+ node.set_position(pos)
142
+ root.add_child(node)
143
+
144
+ # Clone it
145
+ clone_name = "Knot#{i}"
146
+ clone_ent = knot_entity.clone(clone_name)
147
+ node.attach_object(clone_ent)
148
+ end
149
+
150
+ camera.set_position(-50, 100, 500)
151
+ camera.look_at(0, 0, 0)
152
+ end
153
+
154
+ def create_frame_listener
155
+ self.frame_listener = RenderToTextureListener.new(root, window, camera,
156
+ @reflect_cam, @plane_node)
157
+ end
158
+ end
159
+
160
+ app = RenderToTextureApplication.new
161
+ app.go
@@ -0,0 +1,16 @@
1
+ [Bootstrap]
2
+ Zip=./media/packs/OgreCore.zip
3
+
4
+ [General]
5
+ FileSystem=./media/
6
+ FileSystem=./media/materials
7
+ FileSystem=./media/materials/textures
8
+ FileSystem=./media/materials/scripts
9
+ FileSystem=./media/materials/programs
10
+ FileSystem=./media/models
11
+ FileSystem=./media/particles
12
+ FileSystem=./media/overlays
13
+ Zip=./media/packs/skybox.zip
14
+ Zip=./media/packs/dragon.zip
15
+ Zip=./media/packs/cubemap.zip
16
+ Zip=./media/packs/cubemapsJS.zip
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + "/.."
4
+ require 'ogre'
5
+ require 'application'
6
+ include Ogre
7
+
8
+ $thrusters = nil
9
+
10
+ class SkyBoxListener < ApplicationFrameListener
11
+ attr_accessor :default_dimensions, :default_velocity
12
+ def initialize(*args)
13
+ super
14
+ @default_dimensions = 25.0
15
+ @default_velocity = 50.0
16
+ end
17
+
18
+ def frame_started(evt)
19
+ return false unless super(evt)
20
+
21
+ if keyboard.key_down?( OIS::KC_N )
22
+ $thrusters.set_default_dimensions( @default_dimensions + 0.25, @default_dimensions + 0.25 )
23
+ @default_dimensions += 0.25
24
+ end
25
+
26
+ if keyboard.key_down?( OIS::KC_M )
27
+ $thrusters.set_default_dimensions( @default_dimensions - 0.25, @default_dimensions - 0.25 )
28
+ @default_dimensions -= 0.25
29
+ end
30
+
31
+ if keyboard.key_down?( OIS::KC_H )
32
+ $thrusters.get_emitter( 0 ).set_particle_velocity( @default_velocity + 1 )
33
+ $thrusters.get_emitter( 1 ).set_particle_velocity( @default_velocity + 1 )
34
+ @default_velocity += 1
35
+ end
36
+
37
+ if keyboard.key_down?( OIS::KC_J ) && !( @default_velocity < 0.0 )
38
+ $thrusters.get_emitter( 0 ).set_particle_velocity( @default_velocity - 1 )
39
+ $thrusters.get_emitter( 1 ).set_particle_velocity( @default_velocity - 1 )
40
+ @default_velocity -= 1
41
+ end
42
+
43
+ true
44
+ end
45
+ end
46
+
47
+ class SkyBoxApplication < Application
48
+
49
+ def create_scene
50
+ scene_manager.set_ambient_light ColourValue.new(0.5, 0.5, 0.5)
51
+
52
+ # Create a skybox
53
+ scene_manager.set_sky_box(true, "SpaceSkyBox", 50 )
54
+
55
+ # Create a light
56
+ l = scene_manager.create_light("MainLight")
57
+ l.set_position(20,80,50)
58
+
59
+ # Also add a nice starship in
60
+ ent = scene_manager.create_entity( "razor", "razor.mesh" )
61
+
62
+ scene_manager.root_scene_node.attach_object( ent )
63
+
64
+ $thrusters = scene_manager.create_particle_system( "ParticleSys1", 200 )
65
+
66
+ $thrusters.set_material_name("Flare")
67
+ $thrusters.set_default_dimensions( 25, 25 )
68
+
69
+ emitter1 = $thrusters.add_emitter( "Point" )
70
+ emitter2 = $thrusters.add_emitter( "Point" )
71
+
72
+ # Thruster 1
73
+ emitter1.set_angle( Radian.new(0.05) )
74
+ emitter1.set_time_to_live( 0.2 )
75
+ emitter1.set_emission_rate( 70 )
76
+
77
+ emitter1.set_particle_velocity( 50 )
78
+
79
+ emitter1.set_direction(- Vector3.UNIT_Z)
80
+ emitter1.set_colour( ColourValue.White, ColourValue.Red)
81
+
82
+ # Thruster 2
83
+ emitter2.set_angle( Radian.new(0.05) )
84
+ emitter2.set_time_to_live( 0.2 )
85
+ emitter2.set_emission_rate( 70 )
86
+
87
+ emitter2.set_particle_velocity( 50 )
88
+
89
+ emitter2.set_direction( -Vector3.UNIT_Z )
90
+ emitter2.set_colour( ColourValue.White, ColourValue.Red )
91
+
92
+ # Set the position of the $thrusters
93
+ emitter1.set_position( Vector3.new( 5.7, 0.0, 0.0 ) )
94
+ emitter2.set_position( Vector3.new( -18.0, 0.0, 0.0 ) )
95
+
96
+ node = scene_manager.root_scene_node.create_child_scene_node( Vector3.new( 0.0, 6.5, -67.0 ) )
97
+ node.attach_object($thrusters)
98
+ end
99
+
100
+ def create_frame_listener
101
+ self.frame_listener = SkyBoxListener.new(root, window, camera)
102
+ #root.addFrameListener(self.frame_listener)
103
+ end
104
+ end
105
+
106
+ app = SkyBoxApplication.new
107
+ app.go