Sha256: c2e7e6a7306fea66f7f17be76c0207db1995ab086598ab2d623b8b80be37018b

Contents?: true

Size: 1.94 KB

Versions: 7

Compression:

Stored size: 1.94 KB

Contents

#!/usr/bin/ruby -w

$: << File.dirname(__FILE__) + "/.."
require 'ogre'
require 'application'
require 'application_loading_bar'
include Ogre

class BSPApplication < Application
	def initialize
		super

		#@loading_bar = ApplicationLoadingBar.new
		@quake_level = ""
		@quake_pk3 = ""
		@loading_bar = ApplicationLoadingBar.new
	end

	def load_resources
		@loading_bar.start(window, 1, 1, 0.75)

		# Turn off rendering of all but overlays
		scene_manager.clear_special_case_render_queues
		scene_manager.add_special_case_render_queue(RENDER_QUEUE_OVERLAY)
		scene_manager.set_special_case_render_queue_mode(SceneManager::SCRQM_INCLUDE)

		rgm = ResourceGroupManager.instance

		# World geometry link
		rgm.link_world_geometry_to_resource_group(
			rgm.get_world_resource_group_name,
			@quake_level, scene_manager)

		# Initialize the rest of the groups, parse
		rgm.initialise_all_resource_groups
		rgm.load_resource_group rgm.get_world_resource_group_name, false, true

		# Full rendering
		scene_manager.clear_special_case_render_queues
		scene_manager.set_special_case_render_queue_mode(SceneManager::SCRQM_EXCLUDE)

		@loading_bar.finish
	end

	def setup_resources
		file = ConfigFile.new
		file.load("quake3settings.cfg")
		@quake_level = file.get_setting("Map")
		@quake_pk3 = file.get_setting("Pak0Location")

		super

		ResourceGroupManager.instance.add_resource_location(@quake_pk3,
			"Zip", ResourceGroupManager.instance.get_world_resource_group_name, true)
	end

	def choose_scene_manager
		self.scene_manager = root.create_scene_manager("BspSceneManager")
	end

  def create_scene
		camera.set_near_clip_distance 4
		camera.set_far_clip_distance 4000
		
		vp = scene_manager.get_suggested_viewpoint(true)

		camera.set_position(vp.position)
		camera.pitch(Degree.new(90))
		camera.rotate(vp.orientation)

		camera.set_fixed_yaw_axis(true, Vector3.UNIT_Z)
  end
end

app = BSPApplication.new
app.go

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ogre.rb-0.2-i686-linux samples/bsp.rb
ogre.rb-0.2-i386-mswin32 samples/bsp.rb
ogre.rb-0.1-i686-linux samples/bsp.rb
ogre.rb-0.1-i386-mswin32 samples/bsp.rb
ogre.rb-0.2-x86_64-linux samples/bsp.rb
shattered_ogrerb-0.5.0.2 vendor/ogrerb/samples/bsp.rb
shattered_ogrerb-0.5.1 vendor/ogrerb/samples/bsp.rb