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// Main process\nvoid main()\n{\n  // Coordinate on the screen in pixel\n  vec2 screenCoord = gl_TexCoord[0].xy * 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

new, #set_position

Methods inherited from LiteRGSS::Disposable

#dispose, #disposed?

Constructor Details

#initialize(viewport) ⇒ Plane

Create a new plane

Parameters:



1393
1394
# File 'docs/0_Dependencies.rb', line 1393

def initialize(viewport)
end

Instance Attribute Details

#blend_typeInteger

Return the blend type

Returns:

  • (Integer)


1390
1391
1392
# File 'docs/0_Dependencies.rb', line 1390

def blend_type
  @blend_type
end

#colorColor

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

Returns:



1384
1385
1386
# File 'docs/0_Dependencies.rb', line 1384

def color
  @color
end

#textureTexture

Get the real texture

Returns:



1378
1379
1380
# File 'docs/0_Dependencies.rb', line 1378

def texture
  @texture
end

#toneTone

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

Returns:



1387
1388
1389
# File 'docs/0_Dependencies.rb', line 1387

def tone
  @tone
end

#visibleBoolean

Return the visibility of the plane

Returns:

  • (Boolean)


1381
1382
1383
# File 'docs/0_Dependencies.rb', line 1381

def visible
  @visible
end

Class Method Details

.textureTexture

Get the generic plane texture

Returns:



1463
1464
# File 'docs/0_Dependencies.rb', line 1463

def texture
end

Instance Method Details

#bitmapTexture Also known as: working_texture

Get the real texture

Returns:



1402
1403
1404
# File 'docs/0_Dependencies.rb', line 1402

def texture
  @texture
end

#oxFloat

Get the ox of the Plane

Returns:

  • (Float)


1438
1439
# File 'docs/0_Dependencies.rb', line 1438

def ox
end

#ox=(origin)

Set the ox of the Plane

Parameters:

  • origin (Float)


1434
1435
# File 'docs/0_Dependencies.rb', line 1434

def ox=(origin)
end

#oyFloat

Get the oy of the Plane

Returns:

  • (Float)


1446
1447
# File 'docs/0_Dependencies.rb', line 1446

def oy
end

#oy=(origin)

Set the oy of the Plane

Parameters:

  • origin (Float)


1442
1443
# File 'docs/0_Dependencies.rb', line 1442

def oy=(origin)
end

#set_origin(ox, oy)

Set the origin of the Plane

Parameters:

  • ox (Float)
  • oy (Float)


1430
1431
# File 'docs/0_Dependencies.rb', line 1430

def set_origin(ox, oy)
end

#zoom=(zoom)

Set the zoom of the Plane

Parameters:

  • zoom (Float)


1409
1410
# File 'docs/0_Dependencies.rb', line 1409

def zoom=(zoom)
end

#zoom_xFloat

Get the zoom_x of the Plane

Returns:

  • (Float)


1417
1418
# File 'docs/0_Dependencies.rb', line 1417

def zoom_x
end

#zoom_x=(zoom)

Set the zoom_x of the Plane

Parameters:

  • zoom (Float)


1413
1414
# File 'docs/0_Dependencies.rb', line 1413

def zoom_x=(zoom)
end

#zoom_yFloat

Get the zoom_y of the Plane

Returns:

  • (Float)


1425
1426
# File 'docs/0_Dependencies.rb', line 1425

def zoom_y
end

#zoom_y=(zoom)

Set the zoom_y of the Plane

Parameters:

  • zoom (Float)


1421
1422
# File 'docs/0_Dependencies.rb', line 1421

def zoom_y=(zoom)
end