Class: RLSL::CodeGenerator
- Inherits:
-
Object
- Object
- RLSL::CodeGenerator
- Defined in:
- lib/rlsl/code_generator.rb,
lib/rlsl/code_generator/math_prelude.rb,
lib/rlsl/code_generator/template_context.rb,
lib/rlsl/code_generator/ruby_wrapper_generator.rb,
lib/rlsl/code_generator/uniform_struct_generator.rb,
lib/rlsl/code_generator/shader_function_generator.rb
Defined Under Namespace
Modules: MathPrelude Classes: RubyWrapperGenerator, ShaderFunctionGenerator, TemplateContext, UniformStructGenerator
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(name, uniforms, helpers_block, fragment_block) ⇒ CodeGenerator
constructor
A new instance of CodeGenerator.
Constructor Details
#initialize(name, uniforms, helpers_block, fragment_block) ⇒ CodeGenerator
Returns a new instance of CodeGenerator.
11 12 13 14 15 16 17 18 |
# File 'lib/rlsl/code_generator.rb', line 11 def initialize(name, uniforms, helpers_block, fragment_block) @context = TemplateContext.new( name: name, uniforms: uniforms, helpers_block: helpers_block, fragment_block: fragment_block ) end |
Instance Method Details
#generate ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rlsl/code_generator.rb', line 20 def generate <<~C #include <ruby.h> #include <math.h> #include <stdint.h> #ifdef __APPLE__ #include <dispatch/dispatch.h> #endif #{RLSL::C_TYPES} #{MathPrelude.code} #{UniformStructGenerator.new(@context).generate} #{custom_helpers} #{ShaderFunctionGenerator.new(@context).generate} #{RubyWrapperGenerator.new(@context).generate} #{init_function} C end |