Class: Teien::BoxObjectInfo
- Inherits:
-
ObjectInfo
- Object
- ObjectInfo
- Teien::BoxObjectInfo
- Defined in:
- lib/teien/ui/std_objects/box_object_info.rb,
lib/teien/base_object/std_objects/box_object_info.rb
Instance Attribute Summary collapse
-
#material_name ⇒ Object
Returns the value of attribute material_name.
-
#num_seg_x ⇒ Object
Returns the value of attribute num_seg_x.
-
#num_seg_y ⇒ Object
Returns the value of attribute num_seg_y.
-
#num_seg_z ⇒ Object
Returns the value of attribute num_seg_z.
-
#size ⇒ Object
Returns the value of attribute size.
-
#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(size, num_seg_x = 1, num_seg_y = 1, num_seg_z = 1, u_tile = 1.0, v_tile = 1.0) ⇒ BoxObjectInfo
constructor
A new instance of BoxObjectInfo.
Constructor Details
#initialize(size, num_seg_x = 1, num_seg_y = 1, num_seg_z = 1, u_tile = 1.0, v_tile = 1.0) ⇒ BoxObjectInfo
Returns a new instance of BoxObjectInfo.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/teien/base_object/std_objects/box_object_info.rb', line 14 def initialize(size, num_seg_x = 1, num_seg_y = 1, num_seg_z = 1, u_tile = 1.0, v_tile = 1.0) super() @size = size @num_seg_x = num_seg_x @num_seg_y = num_seg_y @num_seg_z = num_seg_z @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.
12 13 14 |
# File 'lib/teien/base_object/std_objects/box_object_info.rb', line 12 def material_name @material_name end |
#num_seg_x ⇒ Object
Returns the value of attribute num_seg_x.
7 8 9 |
# File 'lib/teien/base_object/std_objects/box_object_info.rb', line 7 def num_seg_x @num_seg_x end |
#num_seg_y ⇒ Object
Returns the value of attribute num_seg_y.
8 9 10 |
# File 'lib/teien/base_object/std_objects/box_object_info.rb', line 8 def num_seg_y @num_seg_y end |
#num_seg_z ⇒ Object
Returns the value of attribute num_seg_z.
9 10 11 |
# File 'lib/teien/base_object/std_objects/box_object_info.rb', line 9 def num_seg_z @num_seg_z end |
#size ⇒ Object
Returns the value of attribute size.
6 7 8 |
# File 'lib/teien/base_object/std_objects/box_object_info.rb', line 6 def size @size end |
#u_tile ⇒ Object
Returns the value of attribute u_tile.
10 11 12 |
# File 'lib/teien/base_object/std_objects/box_object_info.rb', line 10 def u_tile @u_tile end |
#v_tile ⇒ Object
Returns the value of attribute v_tile.
11 12 13 |
# File 'lib/teien/base_object/std_objects/box_object_info.rb', line 11 def v_tile @v_tile end |
Class Method Details
.create_physics_object(obj, physics) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/teien/base_object/std_objects/box_object_info.rb', line 25 def self.create_physics_object(obj, physics) physics_object = PhysicsObject.new(physics) cShape = Bullet::BtBoxShape.new(Vector3D.new(obj.object_info.size.x, obj.object_info.size.y, obj.object_info.size.z)) 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 22 23 24 |
# File 'lib/teien/ui/std_objects/box_object_info.rb', line 7 def self.create_view_object(obj, view) gen = Procedural::BoxGenerator.new() gen.set_size_x(obj.object_info.size.x * 2.0) gen.set_size_y(obj.object_info.size.y * 2.0) gen.set_size_z(obj.object_info.size.z * 2.0) gen.set_num_seg_x(obj.object_info.num_seg_x) gen.set_num_seg_y(obj.object_info.num_seg_y) gen.set_num_seg_z(obj.object_info.num_seg_z) gen.set_utile(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 |