Merge branch 'master' of ssh://code.nikooneshot.ru:222/Sunshine/mkxp-sunshine
This commit is contained in:
commit
358119d45a
|
|
@ -78,7 +78,7 @@ class Window_Settings
|
||||||
@content.add_parameter(screen_title, BoolParameter.new(@content, screen_index, parameter_index,
|
@content.add_parameter(screen_title, BoolParameter.new(@content, screen_index, parameter_index,
|
||||||
parameter_info[:name], parameter_info[:parameter], parameter_info[:default]))
|
parameter_info[:name], parameter_info[:parameter], parameter_info[:default]))
|
||||||
when :switch
|
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]))
|
parameter_info[:name], parameter_info[:parameter], parameter_info[:default], parameter_info[:switch], parameter_info[:invert]))
|
||||||
when :int
|
when :int
|
||||||
@content.add_parameter(screen_title, IntParameter.new(@content, screen_index, parameter_index,
|
@content.add_parameter(screen_title, IntParameter.new(@content, screen_index, parameter_index,
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,8 @@ void DynamicLightShader::setWallMapResolution(int x, int y){
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicLightShader::setCameraPosition(int x, int y){
|
void DynamicLightShader::setCameraPosition(int x, int y){
|
||||||
|
cameraPositionCache.x = x;
|
||||||
|
cameraPositionCache.y = y;
|
||||||
gl.Uniform2f(u_cameraPosition, x, 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){
|
void DynamicLightShader::setLightSources(std::vector<LightSource> sources){
|
||||||
int count = 0;
|
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 (count < 64) {
|
||||||
if (!sources[i].hasEffect())
|
LightSource source = sources[i];
|
||||||
|
if (!source.hasEffect())
|
||||||
continue;
|
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,
|
gl.Uniform4f(u_lightSources + count,
|
||||||
sources[i].x,
|
source.x,
|
||||||
sources[i].y,
|
source.y,
|
||||||
sources[i].power,
|
source.power,
|
||||||
sources[i].radius
|
source.radius
|
||||||
);
|
);
|
||||||
gl.Uniform4f(u_lightSourcesColors + count,
|
gl.Uniform4f(u_lightSourcesColors + count,
|
||||||
sources[i].color.red / 255.0,
|
source.color.red / 255.0,
|
||||||
sources[i].color.green / 255.0,
|
source.color.green / 255.0,
|
||||||
sources[i].color.blue / 255.0,
|
source.color.blue / 255.0,
|
||||||
sources[i].color.alpha / 255.0
|
source.color.alpha / 255.0
|
||||||
);
|
);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLint u_wallMapTexture, u_wallMapResolution, u_cameraPosition, u_tileMapOffset, u_lightSources, u_lightSourcesCount, u_lightSourcesColors, u_ambientLight;
|
GLint u_wallMapTexture, u_wallMapResolution, u_cameraPosition, u_tileMapOffset, u_lightSources, u_lightSourcesCount, u_lightSourcesColors, u_ambientLight;
|
||||||
|
Vec2i cameraPositionCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SimpleColorShader : public ShaderBase{
|
class SimpleColorShader : public ShaderBase{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue