Class: Rays::Shader
- Inherits:
-
Object
- Object
- Rays::Shader
- Defined in:
- lib/rays/shader.rb
Instance Method Summary collapse
-
#initialize(fragment_shader_source, vertex_shader_source = nil, builtin_variable_names = nil, ignore_no_uniform_location_error: false, **uniforms, &block) ⇒ Shader
constructor
A new instance of Shader.
- #uniform(name = nil, *args, **uniforms) ⇒ Object
Constructor Details
#initialize(fragment_shader_source, vertex_shader_source = nil, builtin_variable_names = nil, ignore_no_uniform_location_error: false, **uniforms, &block) ⇒ Shader
Returns a new instance of Shader.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rays/shader.rb', line 10 def initialize( fragment_shader_source, vertex_shader_source = nil, builtin_variable_names = nil, ignore_no_uniform_location_error: false, **uniforms, &block) setup( fragment_shader_source, vertex_shader_source, builtin_variable_names&.values_at( :attribute_position, :attribute_texcoord, :attribute_texcoord_min, :attribute_texcoord_max, :attribute_color, :varying_position, :varying_texcoord, :varying_texcoord_min, :varying_texcoord_max, :varying_color, :uniform_position_matrix, :uniform_texcoord_matrix, :uniform_texcoord_pixel, :uniform_texture), ignore_no_uniform_location_error) uniform(**uniforms) unless uniforms.empty? Xot::BlockUtil.instance_eval_or_block_call self, &block if block end |
Instance Method Details
#uniform(name = nil, *args, **uniforms) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/rays/shader.rb', line 41 def uniform(name = nil, *args, **uniforms) set_uniform name, *args if name uniforms.each do |key, value| set_uniform key, value end end |