Class: RLSL::CodeGenerator::ShaderFunctionGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/rlsl/code_generator/shader_function_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ ShaderFunctionGenerator

Returns a new instance of ShaderFunctionGenerator.



6
7
8
# File 'lib/rlsl/code_generator/shader_function_generator.rb', line 6

def initialize(context)
  @context = context
end

Instance Method Details

#generateObject



10
11
12
13
14
15
16
# File 'lib/rlsl/code_generator/shader_function_generator.rb', line 10

def generate
  <<~C
    static vec3 shader_#{@context.name}(vec2 frag_coord, vec2 resolution, Uniforms u) {
      #{@context.fragment_code}
    }
  C
end