Class: Teien::SphereObjectInfo
- Inherits:
-
ObjectInfo
- Object
- ObjectInfo
- Teien::SphereObjectInfo
- Defined in:
- lib/teien/ui/std_objects/sphere_object_info.rb,
lib/teien/base_object/std_objects/sphere_object_info.rb
Instance Attribute Summary collapse
-
#material_name ⇒ Object
Returns the value of attribute material_name.
-
#num_rings ⇒ Object
Returns the value of attribute num_rings.
-
#num_segments ⇒ Object
Returns the value of attribute num_segments.
-
#radius ⇒ Object
Returns the value of attribute radius.
-
#u_tile ⇒ Object
Returns the value of attribute u_tile.
-
#v_tile ⇒ Object
Returns the value of attribute v_tile.
Attributes inherited from ObjectInfo
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(radius, num_rings = 16, num_segments = 16, u_tile = 1.0, v_tile = 1.0) ⇒ SphereObjectInfo
constructor
A new instance of SphereObjectInfo.
Constructor Details
#initialize(radius, num_rings = 16, num_segments = 16, u_tile = 1.0, v_tile = 1.0) ⇒ SphereObjectInfo
Returns a new instance of SphereObjectInfo.
13 14 15 16 17 18 19 20 21 |
# File 'lib/teien/base_object/std_objects/sphere_object_info.rb', line 13 def initialize(radius, num_rings = 16, num_segments = 16, u_tile = 1.0, v_tile = 1.0) super() @radius = radius @num_rings = num_rings @num_segments = num_segments @u_tile = u_tile @v_tile = v_tile @material_name = nil end |
Instance Attribute Details
#material_name ⇒ Object
Returns the value of attribute material_name.
11 12 13 |
# File 'lib/teien/base_object/std_objects/sphere_object_info.rb', line 11 def material_name @material_name end |
#num_rings ⇒ Object
Returns the value of attribute num_rings.
7 8 9 |
# File 'lib/teien/base_object/std_objects/sphere_object_info.rb', line 7 def num_rings @num_rings end |
#num_segments ⇒ Object
Returns the value of attribute num_segments.
8 9 10 |
# File 'lib/teien/base_object/std_objects/sphere_object_info.rb', line 8 def num_segments @num_segments end |
#radius ⇒ Object
Returns the value of attribute radius.
6 7 8 |
# File 'lib/teien/base_object/std_objects/sphere_object_info.rb', line 6 def radius @radius end |
#u_tile ⇒ Object
Returns the value of attribute u_tile.
9 10 11 |
# File 'lib/teien/base_object/std_objects/sphere_object_info.rb', line 9 def u_tile @u_tile end |
#v_tile ⇒ Object
Returns the value of attribute v_tile.
10 11 12 |
# File 'lib/teien/base_object/std_objects/sphere_object_info.rb', line 10 def v_tile @v_tile end |
Class Method Details
.create_physics_object(obj, physics) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/teien/base_object/std_objects/sphere_object_info.rb', line 23 def self.create_physics_object(obj, physics) physics_object = PhysicsObject.new(physics) cShape = Bullet::BtSphereShape.new(obj.object_info.radius) inertia = Bullet::BtVector3.new() cShape.calculate_local_inertia(obj.physics_info.mass, inertia) physics_object.set_rigid_body(obj, cShape, inertia) obj.object_info.use_physics = true return physics_object end |
.create_view_object(obj, view) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/teien/ui/std_objects/sphere_object_info.rb', line 7 def self.create_view_object(obj, view) gen = Procedural::SphereGenerator.new() gen.set_radius(obj.object_info.radius) gen.set_num_rings(obj.object_info.num_rings) gen.set_num_segments(obj.object_info.num_segments) gen.set_vtile(obj.object_info.u_tile).set_vtile(obj.object_info.v_tile).realize_mesh(obj.name) entity = view.scene_mgr.create_entity(obj.name) entity.set_cast_shadows(true) entity.set_material_name(obj.object_info.material_name) view_object = ViewObject.new(view) view_object.set_scene_node(entity) return view_object end |