Class: Glslkit::WebGL::Geometry
- Inherits:
-
Object
- Object
- Glslkit::WebGL::Geometry
- Defined in:
- lib/glslkit/webgl/geometry.rb
Instance Attribute Summary collapse
-
#attribute_locations ⇒ Object
readonly
Returns the value of attribute attribute_locations.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#index_type ⇒ Object
readonly
Returns the value of attribute index_type.
-
#indexed ⇒ Object
readonly
Returns the value of attribute indexed.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#vao ⇒ Object
readonly
Returns the value of attribute vao.
Instance Method Summary collapse
-
#initialize(gl, program, attributes:, indices: nil, mode: nil) ⇒ Geometry
constructor
A new instance of Geometry.
Constructor Details
#initialize(gl, program, attributes:, indices: nil, mode: nil) ⇒ Geometry
Returns a new instance of Geometry.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/glslkit/webgl/geometry.rb', line 8 def initialize(gl, program, attributes:, indices: nil, mode: nil) @gl = gl @vao = gl.call(:createVertexArray) @mode = mode || gl[:TRIANGLES] # M11d: 構築時に実際に使ったattributeのlocationを保持する # (SPEC-livereload.md §4.2)。reload時、Contextがこれと新Programの # locationを突き合わせ、このGeometryのVAOがそのまま使えるかを判断する。 @attribute_locations = {} gl.call(:bindVertexArray, @vao) build_attributes(program, attributes) build_indices(indices) gl.call(:bindVertexArray, JS::Null) end |
Instance Attribute Details
#attribute_locations ⇒ Object (readonly)
Returns the value of attribute attribute_locations.
6 7 8 |
# File 'lib/glslkit/webgl/geometry.rb', line 6 def attribute_locations @attribute_locations end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
6 7 8 |
# File 'lib/glslkit/webgl/geometry.rb', line 6 def count @count end |
#index_type ⇒ Object (readonly)
Returns the value of attribute index_type.
6 7 8 |
# File 'lib/glslkit/webgl/geometry.rb', line 6 def index_type @index_type end |
#indexed ⇒ Object (readonly)
Returns the value of attribute indexed.
6 7 8 |
# File 'lib/glslkit/webgl/geometry.rb', line 6 def indexed @indexed end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
6 7 8 |
# File 'lib/glslkit/webgl/geometry.rb', line 6 def mode @mode end |
#vao ⇒ Object (readonly)
Returns the value of attribute vao.
6 7 8 |
# File 'lib/glslkit/webgl/geometry.rb', line 6 def vao @vao end |