Class: Mittsu::RenderTarget

Inherits:
Texture
  • Object
show all
Includes:
EventDispatcher
Defined in:
lib/mittsu/textures/render_target.rb

Direct Known Subclasses

RenderTargetCube

Constant Summary

Constants inherited from Texture

Texture::DEFAULT_IMAGE, Texture::DEFAULT_MAPPING

Instance Attribute Summary collapse

Attributes inherited from Texture

#filp_y, #id, #image, #mapping, #mipmaps, #name, #on_update, #premultiply_alpha, #source_file, #unpack_alignment, #uuid

Instance Method Summary collapse

Methods included from EventDispatcher

#add_event_listener, #dispatch_event, #has_event_listener, #remove_event_listener

Methods inherited from Texture

#needs_update=, #update

Constructor Details

#initialize(width, height, options = {}) ⇒ RenderTarget

Returns a new instance of RenderTarget.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/mittsu/textures/render_target.rb', line 25

def initialize(width, height, options = {})
  super(self, nil)

  @width = width
  @height = height

  @wrap_s = options.fetch(:wrap_s, ClampToEdgeWrapping)
  @wrap_t = options.fetch(:wrap_t, ClampToEdgeWrapping)

  @mag_filter = options.fetch(:mag_filter, LinearFilter)
  @min_filter = options.fetch(:min_filter, LinearMipMapLinearFilter)

  @anisotropy = options.fetch(:anisotropy, 1.0);

  @offset = Vector2.new(0.0, 0.0)
  @repeat = Vector2.new(1.0, 1.0)

  @format = options.fetch(:format, RGBAFormat)
  @type = options.fetch(:type, UnsignedByteType)

  @depth_buffer = options.fetch(:depth_buffer, true)
  @stencil_buffer = options.fetch(:stencil_buffer, true)

  @generate_mipmaps = true

  @share_depth_from = options.fetch(:share_depth_from, nil)
end

Instance Attribute Details

#anisotropyObject

Returns the value of attribute anisotropy.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def anisotropy
  @anisotropy
end

#depth_bufferObject

Returns the value of attribute depth_buffer.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def depth_buffer
  @depth_buffer
end

#formatObject

Returns the value of attribute format.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def format
  @format
end

#framebufferObject (readonly)

Returns the value of attribute framebuffer.



21
22
23
# File 'lib/mittsu/textures/render_target.rb', line 21

def framebuffer
  @framebuffer
end

#generate_mipmapsObject

Returns the value of attribute generate_mipmaps.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def generate_mipmaps
  @generate_mipmaps
end

#heightObject

Returns the value of attribute height.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def height
  @height
end

#mag_filterObject

Returns the value of attribute mag_filter.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def mag_filter
  @mag_filter
end

#min_filterObject

Returns the value of attribute min_filter.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def min_filter
  @min_filter
end

#offsetObject

Returns the value of attribute offset.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def offset
  @offset
end

#renderer=(value) ⇒ Object (writeonly)

Sets the attribute renderer

Parameters:

  • value

    the value to set the attribute renderer to.



23
24
25
# File 'lib/mittsu/textures/render_target.rb', line 23

def renderer=(value)
  @renderer = value
end

#repeatObject

Returns the value of attribute repeat.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def repeat
  @repeat
end

#share_depth_fromObject

Returns the value of attribute share_depth_from.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def share_depth_from
  @share_depth_from
end

#stencil_bufferObject

Returns the value of attribute stencil_buffer.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def stencil_buffer
  @stencil_buffer
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def type
  @type
end

#widthObject

Returns the value of attribute width.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def width
  @width
end

#wrap_sObject

Returns the value of attribute wrap_s.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def wrap_s
  @wrap_s
end

#wrap_tObject

Returns the value of attribute wrap_t.



5
6
7
# File 'lib/mittsu/textures/render_target.rb', line 5

def wrap_t
  @wrap_t
end

Instance Method Details

#cloneObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/mittsu/textures/render_target.rb', line 62

def clone
  RenderTarget.new(@width, @height).tap do |tmp|
    tmp.renderer = @renderer

		tmp.wrap_s = @wrap_s
		tmp.wrap_t = @wrap_t

		tmp.mag_filter = @mag_filter
		tmp.min_filter = @min_filter

		tmp.anisotropy = @anisotropy

		tmp.offset.copy(@offset)
		tmp.repeat.copy(@repeat)

		tmp.format = @format
		tmp.type = @type

		tmp.depth_buffer = @depth_buffer
		tmp.stencil_buffer = @stencil_buffer

		tmp.generate_mipmaps = @generate_mipmaps

		tmp.share_depth_from = @share_depth_from
  end
end

#disposeObject



89
90
91
# File 'lib/mittsu/textures/render_target.rb', line 89

def dispose
  dispatch_event(type: :dispose)
end

#needs_update?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/mittsu/textures/render_target.rb', line 58

def needs_update?
  false
end

#set_size(width, height) ⇒ Object



53
54
55
56
# File 'lib/mittsu/textures/render_target.rb', line 53

def set_size(width, height)
  @width = width
  @height = height
end