Class: RBGL::Engine::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/rbgl/engine/pipeline.rb

Constant Summary collapse

VALID_CULL_MODES =
%i[none front back].freeze
VALID_BLEND_MODES =
%i[none alpha].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePipeline

Returns a new instance of Pipeline.



12
13
14
15
16
17
18
19
# File 'lib/rbgl/engine/pipeline.rb', line 12

def initialize
  @vertex_shader = nil
  @fragment_shader = nil
  self.depth_test = true
  self.depth_write = true
  self.cull_mode = :back
  self.blend_mode = :none
end

Instance Attribute Details

#blend_modeObject

Returns the value of attribute blend_mode.



10
11
12
# File 'lib/rbgl/engine/pipeline.rb', line 10

def blend_mode
  @blend_mode
end

#cull_modeObject

Returns the value of attribute cull_mode.



10
11
12
# File 'lib/rbgl/engine/pipeline.rb', line 10

def cull_mode
  @cull_mode
end

#depth_testObject

Returns the value of attribute depth_test.



10
11
12
# File 'lib/rbgl/engine/pipeline.rb', line 10

def depth_test
  @depth_test
end

#depth_writeObject

Returns the value of attribute depth_write.



10
11
12
# File 'lib/rbgl/engine/pipeline.rb', line 10

def depth_write
  @depth_write
end

#fragment_shaderObject

Returns the value of attribute fragment_shader.



9
10
11
# File 'lib/rbgl/engine/pipeline.rb', line 9

def fragment_shader
  @fragment_shader
end

#vertex_shaderObject

Returns the value of attribute vertex_shader.



9
10
11
# File 'lib/rbgl/engine/pipeline.rb', line 9

def vertex_shader
  @vertex_shader
end

Class Method Details

.create(&block) ⇒ Object



21
22
23
24
25
# File 'lib/rbgl/engine/pipeline.rb', line 21

def self.create(&block)
  pipeline = new
  pipeline.instance_eval(&block) if block_given?
  pipeline
end

Instance Method Details

#fragment(&block) ⇒ Object



31
32
33
# File 'lib/rbgl/engine/pipeline.rb', line 31

def fragment(&block)
  @fragment_shader = FragmentShader.new(&block)
end

#vertex(&block) ⇒ Object



27
28
29
# File 'lib/rbgl/engine/pipeline.rb', line 27

def vertex(&block)
  @vertex_shader = VertexShader.new(&block)
end