Class: Glslkit::Program
- Inherits:
-
Object
- Object
- Glslkit::Program
- Defined in:
- lib/glslkit/program.rb
Overview
ValidatorとManifest.buildが共有する薄い値オブジェクト(§8.3)。 sourcesはマージ前の Glslkit::Source をそのまま保持する — E006(同一ステージ内の 重複宣言)はマージ後のデータからは検出できないため、生のReflectionへの アクセスが必要になる。
Constant Summary collapse
- STAGES =
%i[vertex fragment].freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Instance Method Summary collapse
- #fragment ⇒ Object
-
#initialize(name:, sources:) ⇒ Program
constructor
A new instance of Program.
- #vertex ⇒ Object
Constructor Details
#initialize(name:, sources:) ⇒ Program
Returns a new instance of Program.
13 14 15 16 17 18 19 20 |
# File 'lib/glslkit/program.rb', line 13 def initialize(name:, sources:) unless sources.is_a?(Hash) && !sources.empty? && (sources.keys - STAGES).empty? raise ArgumentError, "sources must be a non-empty Hash with only :vertex and/or :fragment keys" end @name = name @sources = sources end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/glslkit/program.rb', line 11 def name @name end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
11 12 13 |
# File 'lib/glslkit/program.rb', line 11 def sources @sources end |
Instance Method Details
#fragment ⇒ Object
26 27 28 |
# File 'lib/glslkit/program.rb', line 26 def fragment sources[:fragment] end |
#vertex ⇒ Object
22 23 24 |
# File 'lib/glslkit/program.rb', line 22 def vertex sources[:vertex] end |