Class: MD2
Defined Under Namespace
Modules: Errors Classes: Command, Frame, Header, Normals, Triangle, Vertex
Instance Attribute Summary collapse
-
#base_path ⇒ Object
readonly
Returns the value of attribute base_path.
-
#frames ⇒ Object
readonly
Returns the value of attribute frames.
-
#gl_commands ⇒ Object
readonly
Returns the value of attribute gl_commands.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#skins ⇒ Object
readonly
Returns the value of attribute skins.
-
#texcoords ⇒ Object
readonly
Returns the value of attribute texcoords.
-
#triangles ⇒ Object
readonly
Returns the value of attribute triangles.
Instance Method Summary collapse
-
#initialize(path) ⇒ MD2
constructor
A new instance of MD2.
- #to_json ⇒ Object
Constructor Details
#initialize(path) ⇒ MD2
Returns a new instance of MD2.
25 26 27 |
# File 'lib/md2.rb', line 25 def initialize(path) load(path) end |
Instance Attribute Details
#base_path ⇒ Object (readonly)
Returns the value of attribute base_path.
18 19 20 |
# File 'lib/md2.rb', line 18 def base_path @base_path end |
#frames ⇒ Object (readonly)
Returns the value of attribute frames.
18 19 20 |
# File 'lib/md2.rb', line 18 def frames @frames end |
#gl_commands ⇒ Object (readonly)
Returns the value of attribute gl_commands.
18 19 20 |
# File 'lib/md2.rb', line 18 def gl_commands @gl_commands end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
17 18 19 |
# File 'lib/md2.rb', line 17 def header @header end |
#skins ⇒ Object (readonly)
Returns the value of attribute skins.
18 19 20 |
# File 'lib/md2.rb', line 18 def skins @skins end |
#texcoords ⇒ Object (readonly)
Returns the value of attribute texcoords.
18 19 20 |
# File 'lib/md2.rb', line 18 def texcoords @texcoords end |
#triangles ⇒ Object (readonly)
Returns the value of attribute triangles.
18 19 20 |
# File 'lib/md2.rb', line 18 def triangles @triangles end |
Instance Method Details
#to_json ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/md2.rb', line 29 def to_json raise "Can't convert to json unless you've already activated the 'json' gem!" if !defined?(JSON) { :header => @header, :frames => @frames.collect { |f| f.reduce }, :triangles => @triangles, :texcoords => @texcoords, :skins => @skins, :gl_commands => @gl_commands, :base_path => @base_path }.to_json end |