mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
byrybyb
This commit is contained in:
parent
093727be2e
commit
c1f01f69af
4 changed files with 35 additions and 14 deletions
|
|
@ -4,36 +4,51 @@ class Particle
|
|||
@sprite.bitmap = bitmap
|
||||
@sprite.ox = bitmap.width / 2
|
||||
@sprite.oy = bitmap.height / 2
|
||||
@light = Sprite.new(viewport)
|
||||
@light.bitmap = RPG::Cache.light("light")
|
||||
@light.ox = @light.bitmap.width / 2
|
||||
@light.oy = @light.bitmap.height / 2
|
||||
@light.z -= 1
|
||||
@light.blend_type = 3
|
||||
@light.tone = Tone.new(512, 512, 512)
|
||||
@light_power = 1.0
|
||||
self.x = rand(Graphics.width)
|
||||
self.y = rand(Graphics.height)
|
||||
end
|
||||
|
||||
def light_scale
|
||||
@light.zoom_x
|
||||
end
|
||||
def light_scale=(val)
|
||||
@light.zoom_x = @light.zoom_y = val
|
||||
end
|
||||
|
||||
# Link various things to the sprite
|
||||
def x
|
||||
@x
|
||||
end
|
||||
def x=(val)
|
||||
@x = val
|
||||
width = @sprite.bitmap.width * @sprite.zoom_x
|
||||
width = [@sprite.bitmap.width * @sprite.zoom_x, @light.bitmap.width * @light.zoom_x].max
|
||||
if @x < -width
|
||||
@x = Graphics.width + width
|
||||
elsif @x > Graphics.width + width
|
||||
@x = -width
|
||||
end
|
||||
@sprite.x = @x
|
||||
@light.x = @sprite.x = @x
|
||||
end
|
||||
def y
|
||||
@y
|
||||
end
|
||||
def y=(val)
|
||||
@y = val
|
||||
height = @sprite.bitmap.height * @sprite.zoom_y
|
||||
height = [@sprite.bitmap.height * @sprite.zoom_y, @light.bitmap.height * @light.zoom_y].max
|
||||
if @y < -height
|
||||
@y = Graphics.height + height
|
||||
elsif @y > Graphics.height + height
|
||||
@y = -height
|
||||
end
|
||||
@sprite.y = @y
|
||||
@light.y = @sprite.y = @y
|
||||
end
|
||||
def scale
|
||||
@sprite.zoom_x
|
||||
|
|
@ -47,6 +62,7 @@ class Particle
|
|||
end
|
||||
def opacity=(val)
|
||||
@sprite.opacity = val
|
||||
@light.modulate.set(val * @light_power, val * @light_power, val * @light_power)
|
||||
end
|
||||
def dispose
|
||||
@sprite.dispose
|
||||
|
|
@ -63,6 +79,8 @@ class Particle_Firefly < Particle
|
|||
@wavelength = rand(120..240)
|
||||
@vx = rand(0.2..1.5) * (rand(2) * 2 - 1)
|
||||
@vy = rand(0.2..1.5) * (rand(2) * 2 - 1)
|
||||
@light_power = 0.5
|
||||
self.light_scale = 0.2
|
||||
self.scale = rand(0.02..0.08)
|
||||
@sprite.blend_type = 1
|
||||
end
|
||||
|
|
@ -116,6 +134,7 @@ class Particle_Shrimp < Particle
|
|||
super(viewport, @@bitmap)
|
||||
@angle = rand(0..TAU)
|
||||
@speed = rand(0.2..4.0)
|
||||
self.light_scale = 0.2
|
||||
self.scale = rand(0.04..0.08)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -61,13 +61,16 @@ class Sprite_Picture < Sprite
|
|||
if @picture.origin == 0
|
||||
self.ox = 0
|
||||
self.oy = 0
|
||||
# Set sprite coordinates
|
||||
self.x = @picture.x
|
||||
self.y = @picture.y
|
||||
else
|
||||
self.ox = self.bitmap.width / 2
|
||||
self.oy = self.bitmap.height / 2
|
||||
# Set sprite coordinates
|
||||
self.x = Graphics.width + @picture.x
|
||||
self.y = Graphics.height + @picture.y
|
||||
end
|
||||
# Set sprite coordinates
|
||||
self.x = @picture.x == 0 ? Graphics.width / 2 - self.bitmap.width / 2 * @picture.zoom_x / 100.0 : @picture.x
|
||||
self.y = @picture.y == 0 ? Graphics.height / 2 - self.bitmap.height / 2 * @picture.zoom_y / 100.0 : @picture.y
|
||||
self.z = @picture.number
|
||||
# Set zoom rate, opacity level, and blend method
|
||||
self.zoom_x = @picture.zoom_x / 100.0
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ void main(){
|
|||
/* Apply gray */
|
||||
float luma = dot(frag.rgb, lumaF);
|
||||
frag.rgb = mix(frag.rgb, vec3(luma), tone.w);
|
||||
|
||||
/* Apply modulation */
|
||||
frag *= modulate;
|
||||
|
||||
/* Apply tone */
|
||||
frag.rgb += tone.rgb;
|
||||
|
|
@ -30,10 +33,6 @@ void main(){
|
|||
|
||||
/* Apply color */
|
||||
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
||||
|
||||
/* Apply modulation */
|
||||
frag *= modulate;
|
||||
|
||||
/* Apply bush alpha by mathematical if */
|
||||
lowp float underBush = float(v_texCoord.y < bushDepth);
|
||||
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);
|
||||
|
|
|
|||
|
|
@ -862,8 +862,8 @@ int Graphics::height() const{
|
|||
}
|
||||
|
||||
void Graphics::resizeScreen(int width, int height){
|
||||
width = clamp(width, 1, p->scRes.x);
|
||||
height = clamp(height, 1, p->scRes.y);
|
||||
width = clamp(width, 1, 65000);
|
||||
height = clamp(height, 1, 65000);
|
||||
|
||||
Vec2i size(width, height);
|
||||
|
||||
|
|
@ -876,7 +876,7 @@ void Graphics::resizeScreen(int width, int height){
|
|||
|
||||
TEXFBO::allocEmpty(p->frozenScene, width, height);
|
||||
|
||||
FloatRect screenRect(0, 0, width, height);
|
||||
FloatRect screenRect(100, 0, width, height);
|
||||
p->screenQuad.setTexPosRect(screenRect, screenRect);
|
||||
|
||||
shState->eThread().requestWindowResize(width, height);
|
||||
|
|
|
|||
Loading…
Reference in a new issue