mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
add lightmaps
This commit is contained in:
parent
bc20b81723
commit
dc8dfeb336
5 changed files with 48 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
package funkin.graphics.framebuffer;
|
||||
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxCamera;
|
||||
import flixel.util.FlxColor;
|
||||
import openfl.Lib;
|
||||
|
@ -118,4 +119,14 @@ class FrameBuffer
|
|||
{
|
||||
spriteCopies.push(spriteCopy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the sprite to the frame buffer. The sprite will only be seen from
|
||||
* the frame buffer.
|
||||
* @param sprite the sprite
|
||||
*/
|
||||
public function moveSprite(sprite:FlxSprite):Void
|
||||
{
|
||||
sprite.cameras = [camera];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,11 +51,21 @@ class FrameBufferManager
|
|||
* @param color if this is not `null`, the sprite will be filled with the color.
|
||||
* if this is `null`, the sprite will keep its original color.
|
||||
*/
|
||||
public function addSpriteCopyTo(name:String, sprite:FlxSprite, color:Null<FlxColor> = null):Void
|
||||
public function copySpriteTo(name:String, sprite:FlxSprite, color:Null<FlxColor> = null):Void
|
||||
{
|
||||
frameBufferMap[name].addSpriteCopy(new SpriteCopy(sprite, color));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the sprite to the frame buffer. The sprite will only be seen from the frame buffer.
|
||||
* @param name the name of the frame buffer
|
||||
* @param sprite the sprite
|
||||
*/
|
||||
public function moveSpriteTo(name:String, sprite:FlxSprite):Void
|
||||
{
|
||||
frameBufferMap[name].moveSprite(sprite);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this before drawing anything.
|
||||
*/
|
||||
|
|
|
@ -10,7 +10,7 @@ import flixel.util.FlxColor;
|
|||
class SpriteCopy
|
||||
{
|
||||
final sprite:FlxSprite;
|
||||
var color:Null<FlxColor>;
|
||||
final color:Null<FlxColor>;
|
||||
|
||||
public function new(sprite:FlxSprite, color:Null<FlxColor>)
|
||||
{
|
||||
|
|
|
@ -86,6 +86,14 @@ class RuntimeRainShader extends RuntimePostEffectShader
|
|||
return mask = value;
|
||||
}
|
||||
|
||||
public var lightMap(default, set):BitmapData;
|
||||
|
||||
function set_lightMap(value:BitmapData):BitmapData
|
||||
{
|
||||
this.setBitmapData('uLightMap', value);
|
||||
return lightMap = value;
|
||||
}
|
||||
|
||||
public var numLights(default, set):Int = 0;
|
||||
|
||||
function set_numLights(value:Int):Int
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.play.stage;
|
||||
|
||||
import openfl.display.BlendMode;
|
||||
import funkin.graphics.framebuffer.FrameBufferManager;
|
||||
import flixel.util.FlxColor;
|
||||
import funkin.graphics.framebuffer.SpriteCopy;
|
||||
|
@ -800,6 +801,22 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME: Polymod hack
|
||||
*/
|
||||
function stringEndsWith(a:String, b:String):Bool
|
||||
{
|
||||
return a.endsWith(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME: Polymod hack
|
||||
*/
|
||||
function setBlendAdd(sprite:FlxSprite, blend:BlendMode):Void
|
||||
{
|
||||
sprite.blend = blend;
|
||||
}
|
||||
|
||||
public function onScriptEvent(event:ScriptEvent) {}
|
||||
|
||||
public function onPause(event:PauseScriptEvent) {}
|
||||
|
|
Loading…
Reference in a new issue