Class: TextureMappingData
- Inherits:
-
Object
- Object
- TextureMappingData
- Includes:
- Observable
- Defined in:
- lib/ext/projector/projector.rb
Constant Summary
- SCALE_A =
50.0
Instance Attribute Summary (collapse)
-
- (Object) face_list
Returns the value of attribute face_list.
-
- (Object) texture
Returns the value of attribute texture.
-
- (Object) transform
Returns the value of attribute transform.
Instance Method Summary (collapse)
- - (Object) begin_work
- - (Object) commit
-
- (TextureMappingData) initialize
constructor
A new instance of TextureMappingData.
- - (Object) swing_step(dx, dy)
- - (Object) update
Constructor Details
- (TextureMappingData) initialize
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
- (Object) face_list
Returns the value of attribute face_list
122 123 124 |
# File 'lib/ext/projector/projector.rb', line 122 def face_list @face_list end |
- (Object) texture
Returns the value of attribute texture
122 123 124 |
# File 'lib/ext/projector/projector.rb', line 122 def texture @texture end |
- (Object) transform
Returns the value of attribute transform
122 123 124 |
# File 'lib/ext/projector/projector.rb', line 122 def transform @transform end |
Instance Method Details
- (Object) begin_work
143 144 145 146 |
# File 'lib/ext/projector/projector.rb', line 143 def begin_work @transform_begin = @transform self end |
- (Object) commit
155 156 157 158 |
# File 'lib/ext/projector/projector.rb', line 155 def commit @transform_begin = nil self end |
- (Object) swing_step(dx, dy)
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 |
- (Object) update
137 138 139 140 141 |
# File 'lib/ext/projector/projector.rb', line 137 def update changed notify_observers self end |