byrybyb
This commit is contained in:
parent
093727be2e
commit
c1f01f69af
|
|
@ -4,36 +4,51 @@ class Particle
|
||||||
@sprite.bitmap = bitmap
|
@sprite.bitmap = bitmap
|
||||||
@sprite.ox = bitmap.width / 2
|
@sprite.ox = bitmap.width / 2
|
||||||
@sprite.oy = bitmap.height / 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.x = rand(Graphics.width)
|
||||||
self.y = rand(Graphics.height)
|
self.y = rand(Graphics.height)
|
||||||
end
|
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
|
# Link various things to the sprite
|
||||||
def x
|
def x
|
||||||
@x
|
@x
|
||||||
end
|
end
|
||||||
def x=(val)
|
def x=(val)
|
||||||
@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
|
if @x < -width
|
||||||
@x = Graphics.width + width
|
@x = Graphics.width + width
|
||||||
elsif @x > Graphics.width + width
|
elsif @x > Graphics.width + width
|
||||||
@x = -width
|
@x = -width
|
||||||
end
|
end
|
||||||
@sprite.x = @x
|
@light.x = @sprite.x = @x
|
||||||
end
|
end
|
||||||
def y
|
def y
|
||||||
@y
|
@y
|
||||||
end
|
end
|
||||||
def y=(val)
|
def y=(val)
|
||||||
@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
|
if @y < -height
|
||||||
@y = Graphics.height + height
|
@y = Graphics.height + height
|
||||||
elsif @y > Graphics.height + height
|
elsif @y > Graphics.height + height
|
||||||
@y = -height
|
@y = -height
|
||||||
end
|
end
|
||||||
@sprite.y = @y
|
@light.y = @sprite.y = @y
|
||||||
end
|
end
|
||||||
def scale
|
def scale
|
||||||
@sprite.zoom_x
|
@sprite.zoom_x
|
||||||
|
|
@ -47,6 +62,7 @@ class Particle
|
||||||
end
|
end
|
||||||
def opacity=(val)
|
def opacity=(val)
|
||||||
@sprite.opacity = val
|
@sprite.opacity = val
|
||||||
|
@light.modulate.set(val * @light_power, val * @light_power, val * @light_power)
|
||||||
end
|
end
|
||||||
def dispose
|
def dispose
|
||||||
@sprite.dispose
|
@sprite.dispose
|
||||||
|
|
@ -63,6 +79,8 @@ class Particle_Firefly < Particle
|
||||||
@wavelength = rand(120..240)
|
@wavelength = rand(120..240)
|
||||||
@vx = rand(0.2..1.5) * (rand(2) * 2 - 1)
|
@vx = rand(0.2..1.5) * (rand(2) * 2 - 1)
|
||||||
@vy = 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)
|
self.scale = rand(0.02..0.08)
|
||||||
@sprite.blend_type = 1
|
@sprite.blend_type = 1
|
||||||
end
|
end
|
||||||
|
|
@ -116,6 +134,7 @@ class Particle_Shrimp < Particle
|
||||||
super(viewport, @@bitmap)
|
super(viewport, @@bitmap)
|
||||||
@angle = rand(0..TAU)
|
@angle = rand(0..TAU)
|
||||||
@speed = rand(0.2..4.0)
|
@speed = rand(0.2..4.0)
|
||||||
|
self.light_scale = 0.2
|
||||||
self.scale = rand(0.04..0.08)
|
self.scale = rand(0.04..0.08)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,16 @@ class Sprite_Picture < Sprite
|
||||||
if @picture.origin == 0
|
if @picture.origin == 0
|
||||||
self.ox = 0
|
self.ox = 0
|
||||||
self.oy = 0
|
self.oy = 0
|
||||||
|
# Set sprite coordinates
|
||||||
|
self.x = @picture.x
|
||||||
|
self.y = @picture.y
|
||||||
else
|
else
|
||||||
self.ox = self.bitmap.width / 2
|
self.ox = self.bitmap.width / 2
|
||||||
self.oy = self.bitmap.height / 2
|
self.oy = self.bitmap.height / 2
|
||||||
end
|
|
||||||
# Set sprite coordinates
|
# Set sprite coordinates
|
||||||
self.x = @picture.x == 0 ? Graphics.width / 2 - self.bitmap.width / 2 * @picture.zoom_x / 100.0 : @picture.x
|
self.x = Graphics.width + @picture.x
|
||||||
self.y = @picture.y == 0 ? Graphics.height / 2 - self.bitmap.height / 2 * @picture.zoom_y / 100.0 : @picture.y
|
self.y = Graphics.height + @picture.y
|
||||||
|
end
|
||||||
self.z = @picture.number
|
self.z = @picture.number
|
||||||
# Set zoom rate, opacity level, and blend method
|
# Set zoom rate, opacity level, and blend method
|
||||||
self.zoom_x = @picture.zoom_x / 100.0
|
self.zoom_x = @picture.zoom_x / 100.0
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ void main(){
|
||||||
float luma = dot(frag.rgb, lumaF);
|
float luma = dot(frag.rgb, lumaF);
|
||||||
frag.rgb = mix(frag.rgb, vec3(luma), tone.w);
|
frag.rgb = mix(frag.rgb, vec3(luma), tone.w);
|
||||||
|
|
||||||
|
/* Apply modulation */
|
||||||
|
frag *= modulate;
|
||||||
|
|
||||||
/* Apply tone */
|
/* Apply tone */
|
||||||
frag.rgb += tone.rgb;
|
frag.rgb += tone.rgb;
|
||||||
|
|
||||||
|
|
@ -30,10 +33,6 @@ void main(){
|
||||||
|
|
||||||
/* Apply color */
|
/* Apply color */
|
||||||
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
||||||
|
|
||||||
/* Apply modulation */
|
|
||||||
frag *= modulate;
|
|
||||||
|
|
||||||
/* Apply bush alpha by mathematical if */
|
/* Apply bush alpha by mathematical if */
|
||||||
lowp float underBush = float(v_texCoord.y < bushDepth);
|
lowp float underBush = float(v_texCoord.y < bushDepth);
|
||||||
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);
|
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);
|
||||||
|
|
|
||||||
|
|
@ -862,8 +862,8 @@ int Graphics::height() const{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::resizeScreen(int width, int height){
|
void Graphics::resizeScreen(int width, int height){
|
||||||
width = clamp(width, 1, p->scRes.x);
|
width = clamp(width, 1, 65000);
|
||||||
height = clamp(height, 1, p->scRes.y);
|
height = clamp(height, 1, 65000);
|
||||||
|
|
||||||
Vec2i size(width, height);
|
Vec2i size(width, height);
|
||||||
|
|
||||||
|
|
@ -876,7 +876,7 @@ void Graphics::resizeScreen(int width, int height){
|
||||||
|
|
||||||
TEXFBO::allocEmpty(p->frozenScene, width, height);
|
TEXFBO::allocEmpty(p->frozenScene, width, height);
|
||||||
|
|
||||||
FloatRect screenRect(0, 0, width, height);
|
FloatRect screenRect(100, 0, width, height);
|
||||||
p->screenQuad.setTexPosRect(screenRect, screenRect);
|
p->screenQuad.setTexPosRect(screenRect, screenRect);
|
||||||
|
|
||||||
shState->eThread().requestWindowResize(width, height);
|
shState->eThread().requestWindowResize(width, height);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue