Class: RBGL::Engine::BaseShader
- Inherits:
-
Object
- Object
- RBGL::Engine::BaseShader
- Includes:
- ShaderBuiltins
- Defined in:
- lib/rbgl/engine/shader/base_shader.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#uniforms ⇒ Object
readonly
Returns the value of attribute uniforms.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ BaseShader
constructor
A new instance of BaseShader.
- #process(input, uniforms) ⇒ Object
Methods included from ShaderBuiltins
#abs, #acos, #asin, #atan, #ceil, #clamp, #color_from_vec3, #color_from_vec4, #cos, #cross, #dot, #floor, #fract, #length, #max, #min, #mix, #mod, #normalize, #pow, #reflect, #refract, #rgb, #rgba, #saturate, #sign, #sin, #smoothstep, #sqrt, #step, #tan, #texture, #texture_lod, #vec2, #vec3, #vec4
Constructor Details
#initialize(&block) ⇒ BaseShader
Returns a new instance of BaseShader.
8 9 10 |
# File 'lib/rbgl/engine/shader/base_shader.rb', line 8 def initialize(&block) @process_block = block end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
22 23 24 |
# File 'lib/rbgl/engine/shader/base_shader.rb', line 22 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
22 23 24 |
# File 'lib/rbgl/engine/shader/base_shader.rb', line 22 def output @output end |
#uniforms ⇒ Object (readonly)
Returns the value of attribute uniforms.
22 23 24 |
# File 'lib/rbgl/engine/shader/base_shader.rb', line 22 def uniforms @uniforms end |
Class Method Details
.create(&block) ⇒ Object
24 25 26 |
# File 'lib/rbgl/engine/shader/base_shader.rb', line 24 def self.create(&block) new(&block) end |
Instance Method Details
#process(input, uniforms) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/rbgl/engine/shader/base_shader.rb', line 12 def process(input, uniforms) output = ShaderIO.new @input = input @uniforms = uniforms @output = output instance_exec(input, uniforms, output, &@process_block) finalize_output(output) end |