Sha256: 46ed494d7bf66da189a84839a5669419d4ba37270e139ce06c21c84047353a83

Contents?: true

Size: 531 Bytes

Versions: 7

Compression:

Stored size: 531 Bytes

Contents

# -*- coding: utf-8 -*-


require 'xot/block_util'
require 'rays/ext'


module Rays


  class Shader

    def initialize(source = nil, **uniforms, &block)
      if source
        setup source
        uniform(**uniforms) unless uniforms.empty?
      end

      Xot::BlockUtil.instance_eval_or_block_call self, &block if block
    end

    def uniform(name = nil, *args, **uniforms)
      set_uniform name, *args if name
      uniforms.each do |key, value|
        set_uniform key, value
      end
    end

  end# Shader


end# Rays

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rays-0.1.28 lib/rays/shader.rb
rays-0.1.27 lib/rays/shader.rb
rays-0.1.26 lib/rays/shader.rb
rays-0.1.25 lib/rays/shader.rb
rays-0.1.24 lib/rays/shader.rb
rays-0.1.23 lib/rays/shader.rb
rays-0.1.22 lib/rays/shader.rb