Class: Plane

Overview

Class simulating repeating texture

Constant Summary collapse

SHADER =

Shader of the Plane sprite

"// Viewport tone (required)\nuniform vec4 tone;\n// Viewport color (required)\nuniform vec4 color;\n// Zoom configuration\nuniform vec2 zoom;\n// Origin configuration\nuniform vec2 origin;\n// Texture size configuration\nuniform vec2 textureSize;\n// Texture source\nuniform sampler2D texture;\n// Plane Texture (what's zoomed origined etc...)\nuniform sampler2D planeTexture;\n// Screen size\nuniform vec2 screenSize;\n// Gray scale transformation vector\nconst vec3 lumaF = vec3(.299, .587, .114);\n\#ifdef GL_ES\nvarying vec2 v_factor_npot;\n\#else\nconst vec2 v_factor_npot = vec2(1.0, 1.0);\n\#endif\n// Main process\nvoid main()\n{\n  // Coordinate on the screen in pixel\n  vec2 screenCoord = gl_TexCoord[0].xy * v_factor_npot * screenSize;\n  // Coordinaet in the texture in pixel (including zoom)\n  vec2 bmpCoord = mod(origin + screenCoord / zoom, textureSize) / textureSize;\n  vec4 frag = texture2D(planeTexture, bmpCoord);\n  // Tone&Color process\n  frag.rgb = mix(frag.rgb, color.rgb, color.a);\n  float luma = dot(frag.rgb, lumaF);\n  frag.rgb += tone.rgb;\n  frag.rgb = mix(frag.rgb, vec3(luma), tone.w);\n  frag.a *= gl_Color.a;\n  // Result\n  gl_FragColor = frag * texture2D(texture, gl_TexCoord[0].xy);\n}\n"

Instance Attribute Summary collapse

Attributes inherited from LiteRGSS::ShaderedSprite

#blendmode, #shader

Attributes inherited from LiteRGSS::Sprite

#__index__, #angle, #height, #mirror, #opacity, #src_rect, #viewport, #width, #x, #y, #z, #zoom

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Sprite

#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords, #update

Methods inherited from LiteRGSS::Sprite

#set_position

Methods inherited from LiteRGSS::Disposable

#dispose, #disposed?

Constructor Details

#initialize(viewport) ⇒ Plane

Create a new plane

Parameters:



1540
1541
# File 'docs/0_Dependencies.rb', line 1540

def initialize(viewport)
end

Instance Attribute Details

#blend_type ⇒ Integer

Return the blend type

Returns:

  • (Integer)


1537
1538
1539
# File 'docs/0_Dependencies.rb', line 1537

def blend_type
  @blend_type
end

#color ⇒ Color

Return the color of the plane /!\ this is unlinked set() won't change the color

Returns:



1531
1532
1533
# File 'docs/0_Dependencies.rb', line 1531

def color
  @color
end

#texture ⇒ Texture

Get the real texture

Returns:



1525
1526
1527
# File 'docs/0_Dependencies.rb', line 1525

def texture
  @texture
end

#tone ⇒ Tone

Return the tone of the plane /!\ this is unlinked set() won't change the color

Returns:



1534
1535
1536
# File 'docs/0_Dependencies.rb', line 1534

def tone
  @tone
end

#visible ⇒ Boolean

Return the visibility of the plane

Returns:

  • (Boolean)


1528
1529
1530
# File 'docs/0_Dependencies.rb', line 1528

def visible
  @visible
end

Class Method Details

.texture ⇒ Texture

Get the generic plane texture

Returns:



1610
1611
# File 'docs/0_Dependencies.rb', line 1610

def texture
end

Instance Method Details

#bitmap ⇒ Texture Also known as: working_texture

Get the real texture

Returns:



1549
1550
1551
# File 'docs/0_Dependencies.rb', line 1549

def texture
  @texture
end

#ox ⇒ Float

Get the ox of the Plane

Returns:

  • (Float)


1585
1586
# File 'docs/0_Dependencies.rb', line 1585

def ox
end

#ox=(origin)

Set the ox of the Plane

Parameters:

  • origin (Float)


1581
1582
# File 'docs/0_Dependencies.rb', line 1581

def ox=(origin)
end

#oy ⇒ Float

Get the oy of the Plane

Returns:

  • (Float)


1593
1594
# File 'docs/0_Dependencies.rb', line 1593

def oy
end

#oy=(origin)

Set the oy of the Plane

Parameters:

  • origin (Float)


1589
1590
# File 'docs/0_Dependencies.rb', line 1589

def oy=(origin)
end

#set_origin(ox, oy)

Set the origin of the Plane

Parameters:

  • ox (Float)
  • oy (Float)


1577
1578
# File 'docs/0_Dependencies.rb', line 1577

def set_origin(ox, oy)
end

#zoom=(zoom)

Set the zoom of the Plane

Parameters:

  • zoom (Float)


1556
1557
# File 'docs/0_Dependencies.rb', line 1556

def zoom=(zoom)
end

#zoom_x ⇒ Float

Get the zoom_x of the Plane

Returns:

  • (Float)


1564
1565
# File 'docs/0_Dependencies.rb', line 1564

def zoom_x
end

#zoom_x=(zoom)

Set the zoom_x of the Plane

Parameters:

  • zoom (Float)


1560
1561
# File 'docs/0_Dependencies.rb', line 1560

def zoom_x=(zoom)
end

#zoom_y ⇒ Float

Get the zoom_y of the Plane

Returns:

  • (Float)


1572
1573
# File 'docs/0_Dependencies.rb', line 1572

def zoom_y
end

#zoom_y=(zoom)

Set the zoom_y of the Plane

Parameters:

  • zoom (Float)


1568
1569
# File 'docs/0_Dependencies.rb', line 1568

def zoom_y=(zoom)
end