lib/mittsu/renderers/shaders/shader_chunk.rb in mittsu-0.1.1 vs lib/mittsu/renderers/shaders/shader_chunk.rb in mittsu-0.1.2
- old
+ new
@@ -1,12 +1,9 @@
module Mittsu
- ShaderChunk = {}.tap do |chunks|
- Dir.new(File.join(__dir__, 'shader_chunk')).each do |file_name|
- next unless file_name.end_with? '.glsl'
- file_path = File.join(__dir__, 'shader_chunk', file_name)
- chunk_name = File.basename(file_name, '.glsl')
- chunk = File.read(file_path)
- # chunk = "// #{chunk_name}\n#{chunk}"
- chunks[chunk_name.to_sym] = chunk
- end
+ ShaderChunk = Hash.new do |chunks, key|
+ file_name = "#{key.to_s}.glsl"
+ file_path = File.join(__dir__, 'shader_chunk', file_name)
+ chunk = File.read(file_path)
+ # chunk = "// #{chunk_name}\n#{chunk}"
+ chunks[key] = chunk
end
end