Merge branch 'master' of ssh://code.nikooneshot.ru:222/Sunshine/mkxp-sunshine

This commit is contained in:
niko(depressedTWM) 2026-07-18 13:46:31 -04:00
commit 358119d45a
3 changed files with 24 additions and 11 deletions

View file

@ -78,7 +78,7 @@ class Window_Settings
@content.add_parameter(screen_title, BoolParameter.new(@content, screen_index, parameter_index,
parameter_info[:name], parameter_info[:parameter], parameter_info[:default]))
when :switch
@content.add_parameter(screen_title, BoolParameter.new(@content, screen_index, parameter_index,
@content.add_parameter(screen_title, SwitchPatameter.new(@content, screen_index, parameter_index,
parameter_info[:name], parameter_info[:parameter], parameter_info[:default], parameter_info[:switch], parameter_info[:invert]))
when :int
@content.add_parameter(screen_title, IntParameter.new(@content, screen_index, parameter_index,

View file

@ -301,6 +301,8 @@ void DynamicLightShader::setWallMapResolution(int x, int y){
}
void DynamicLightShader::setCameraPosition(int x, int y){
cameraPositionCache.x = x;
cameraPositionCache.y = y;
gl.Uniform2f(u_cameraPosition, x, y);
}
@ -310,21 +312,31 @@ void DynamicLightShader::setTileMapOffset(int x, int y){
void DynamicLightShader::setLightSources(std::vector<LightSource> sources){
int count = 0;
for(int i = 0; i < sources.size(); i++) {
int screenWidth = shState->graphics().width();
int screenHeight = shState->graphics().height();
for(int i = 0; i < sources.size(); ++i) {
if (count < 64) {
if (!sources[i].hasEffect())
LightSource source = sources[i];
if (!source.hasEffect())
continue;
if (source.x * 32 < cameraPositionCache.x - source.radius * 32
|| source.y * 32 < cameraPositionCache.y - source.radius * 32
|| source.x * 32 > cameraPositionCache.x + source.radius * 32 + screenWidth
|| source.y * 32 > cameraPositionCache.y + source.radius * 32 + screenHeight
) continue;
gl.Uniform4f(u_lightSources + count,
sources[i].x,
sources[i].y,
sources[i].power,
sources[i].radius
source.x,
source.y,
source.power,
source.radius
);
gl.Uniform4f(u_lightSourcesColors + count,
sources[i].color.red / 255.0,
sources[i].color.green / 255.0,
sources[i].color.blue / 255.0,
sources[i].color.alpha / 255.0
source.color.red / 255.0,
source.color.green / 255.0,
source.color.blue / 255.0,
source.color.alpha / 255.0
);
count++;
}

View file

@ -117,6 +117,7 @@ public:
private:
GLint u_wallMapTexture, u_wallMapResolution, u_cameraPosition, u_tileMapOffset, u_lightSources, u_lightSourcesCount, u_lightSourcesColors, u_ambientLight;
Vec2i cameraPositionCache;
};
class SimpleColorShader : public ShaderBase{