Class: TextureMappingData
- Includes:
- Observable
- Defined in:
- lib/ext/projector/projector.rb
Constant Summary collapse
- SCALE_A =
50.0
Instance Attribute Summary collapse
-
#face_list ⇒ Object
Returns the value of attribute face_list.
-
#texture ⇒ Object
Returns the value of attribute texture.
-
#transform ⇒ Object
Returns the value of attribute transform.
Instance Method Summary collapse
- #begin_work ⇒ Object
- #commit ⇒ Object
-
#initialize ⇒ TextureMappingData
constructor
A new instance of TextureMappingData.
- #swing_step(dx, dy) ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize ⇒ TextureMappingData
Returns a new instance of TextureMappingData.
127 128 129 130 131 132 133 134 135 |
# File 'lib/ext/projector/projector.rb', line 127 def initialize @texture = nil @transform = Matrix3d::identity @transform *= Matrix3d::rotate(+20.0, Vector[1.0, 0.0, 0.0, 1.0]) @transform *= Matrix3d::rotate(+30.0, Vector[0.0, 1.0, 0.0, 1.0]) @transform *= Matrix3d::rotate(+90.0, Vector[0.0, 0.0, 1.0, 1.0]) @face_list = [] @transform_begin = nil end |
Instance Attribute Details
#face_list ⇒ Object
Returns the value of attribute face_list.
122 123 124 |
# File 'lib/ext/projector/projector.rb', line 122 def face_list @face_list end |
#texture ⇒ Object
Returns the value of attribute texture.
122 123 124 |
# File 'lib/ext/projector/projector.rb', line 122 def texture @texture end |
#transform ⇒ Object
Returns the value of attribute transform.
122 123 124 |
# File 'lib/ext/projector/projector.rb', line 122 def transform @transform end |
Instance Method Details
#begin_work ⇒ Object
143 144 145 146 |
# File 'lib/ext/projector/projector.rb', line 143 def begin_work @transform_begin = @transform self end |
#commit ⇒ Object
155 156 157 158 |
# File 'lib/ext/projector/projector.rb', line 155 def commit @transform_begin = nil self end |
#swing_step(dx, dy) ⇒ Object
148 149 150 151 152 153 |
# File 'lib/ext/projector/projector.rb', line 148 def swing_step(dx, dy) a = Math::sqrt(dx * dx + dy * dy) * SCALE_A a > a * Float::EPSILON or return self self.transform = Matrix3d::rotate(a, Vector[dy, dx, 0.0, 1.0]) * @transform_begin self end |
#update ⇒ Object
137 138 139 140 141 |
# File 'lib/ext/projector/projector.rb', line 137 def update changed notify_observers self end |