File confec.cpp changed (mode: 100644) (index ea83568..be6012f) |
... |
... |
GLfloat |
531 |
531 |
bloomThreshold = 0.56f, |
bloomThreshold = 0.56f, |
532 |
532 |
bloomAmount = 0.25f; |
bloomAmount = 0.25f; |
533 |
533 |
|
|
534 |
|
fgl::Pipeline bloomPipeline, sunlitInstancePipeline; |
|
|
534 |
|
fgl::Pipeline bloomPipeline, rimlitSpritePipeline, sunlitInstancePipeline; |
535 |
535 |
|
|
536 |
536 |
std::string fadeTo = ""; |
std::string fadeTo = ""; |
537 |
537 |
|
|
|
... |
... |
void Tick(); |
812 |
812 |
|
|
813 |
813 |
void TurboSleep(); |
void TurboSleep(); |
814 |
814 |
|
|
|
815 |
|
void UpdateRimSun(); |
|
816 |
|
|
815 |
817 |
void UpdateRichPresence(); |
void UpdateRichPresence(); |
816 |
818 |
|
|
817 |
819 |
void UpdateSpecialItems(); |
void UpdateSpecialItems(); |
|
... |
... |
int main( int argc, char* argv[] ){ |
1103 |
1105 |
data_path + "/glsl/postfx.frag", |
data_path + "/glsl/postfx.frag", |
1104 |
1106 |
{ "u_texture" } |
{ "u_texture" } |
1105 |
1107 |
); |
); |
|
1108 |
|
rimlitSpritePipeline = LoadShaders( |
|
1109 |
|
data_path + "/glsl/rimlit_sprite.vert", |
|
1110 |
|
data_path + "/glsl/rimlit_sprite.frag", |
|
1111 |
|
{ "u_texture" } |
|
1112 |
|
); |
1106 |
1113 |
sunlitInstancePipeline = LoadShaders( |
sunlitInstancePipeline = LoadShaders( |
1107 |
1114 |
data_path + "/glsl/sunlit_instance.vert", |
data_path + "/glsl/sunlit_instance.vert", |
1108 |
1115 |
data_path + "/glsl/sunlit_instance.frag", |
data_path + "/glsl/sunlit_instance.frag", |
|
... |
... |
void vnDraw( double sw, double sh ){ |
2067 |
2074 |
hudOffX = vnOffX; |
hudOffX = vnOffX; |
2068 |
2075 |
} |
} |
2069 |
2076 |
|
|
2070 |
|
// Configure the pipeline for 2D drawing. |
|
|
2077 |
|
// Configure the pipeline for UI drawing. |
2071 |
2078 |
//fgl::setPipeline( fgl::unlitPipeline ); |
//fgl::setPipeline( fgl::unlitPipeline ); |
2072 |
2079 |
fgl::setPipeline( fgl::colorModPipeline ); |
fgl::setPipeline( fgl::colorModPipeline ); |
2073 |
2080 |
glDisable( GL_DEPTH_TEST ); |
glDisable( GL_DEPTH_TEST ); |
|
... |
... |
void TurboSleep(){ |
4080 |
4087 |
} |
} |
4081 |
4088 |
} |
} |
4082 |
4089 |
|
|
|
4090 |
|
// Update the sun position for sprite rim lighting. |
|
4091 |
|
void UpdateRimSun(){ |
|
4092 |
|
float angle = player_time * 6.283; |
|
4093 |
|
auto sun = linalg::normalize( linalg::vec<float,2>( |
|
4094 |
|
std::sin( angle ), |
|
4095 |
|
std::cos( angle ) |
|
4096 |
|
) ) * 2.0f; |
|
4097 |
|
if( sun.y > 0.0f ) sun *= 1.0f - std::min( sun.y / 0.2f, 1.0f ); |
|
4098 |
|
glUniform2f( |
|
4099 |
|
glGetUniformLocation( rimlitSpritePipeline.programObject, "u_sun" ), |
|
4100 |
|
sun.x, |
|
4101 |
|
sun.y |
|
4102 |
|
); |
|
4103 |
|
} |
|
4104 |
|
|
4083 |
4105 |
void UpdateRichPresence(){ |
void UpdateRichPresence(){ |
4084 |
4106 |
#ifdef __STEAM__ |
#ifdef __STEAM__ |
4085 |
4107 |
if( use_steam && !is_steam_china ){ |
if( use_steam && !is_steam_china ){ |
|
... |
... |
void Render(){ |
4682 |
4704 |
circleY = DBL_INF; |
circleY = DBL_INF; |
4683 |
4705 |
// Reset blend mode. |
// Reset blend mode. |
4684 |
4706 |
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); |
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); |
|
4707 |
|
// Draw the bottom layers with only ambient lighting. |
|
4708 |
|
fgl::setPipeline( fgl::colorModPipeline ); |
4685 |
4709 |
// Day/night tinting. |
// Day/night tinting. |
4686 |
4710 |
fgl::setFog( ambient_light ); |
fgl::setFog( ambient_light ); |
4687 |
4711 |
// Draw the world (fade in/fade out edition) |
// Draw the world (fade in/fade out edition) |
|
... |
... |
void Render(){ |
4689 |
4713 |
world.drawMap(); |
world.drawMap(); |
4690 |
4714 |
SimulateParticles( d ); |
SimulateParticles( d ); |
4691 |
4715 |
DrawFloorParticles(); |
DrawFloorParticles(); |
|
4716 |
|
// Draw the entities with rim lighting. |
|
4717 |
|
fgl::setPipeline( rimlitSpritePipeline ); |
|
4718 |
|
UpdateRimSun(); |
4692 |
4719 |
if( multiplayer ) |
if( multiplayer ) |
4693 |
4720 |
world.drawEntities( ws_entities ); |
world.drawEntities( ws_entities ); |
4694 |
4721 |
else |
else |
|
... |
... |
void Render(){ |
4706 |
4733 |
bloomAmount / bloomFactor |
bloomAmount / bloomFactor |
4707 |
4734 |
} ); |
} ); |
4708 |
4735 |
fgl::drawFramebuffer( framebuffer ); |
fgl::drawFramebuffer( framebuffer ); |
|
4736 |
|
// Switch back to the color mod pipeline for UI drawing. |
4709 |
4737 |
fgl::setPipeline( fgl::colorModPipeline ); |
fgl::setPipeline( fgl::colorModPipeline ); |
4710 |
4738 |
fgl::setFog( { 1.0f, 1.0f, 1.0f, 1.0f } ); |
fgl::setFog( { 1.0f, 1.0f, 1.0f, 1.0f } ); |
4711 |
4739 |
}else if( true |
}else if( true |
|
... |
... |
void GameLoop( double d ){ |
5860 |
5888 |
world.cursorX = fgl::mouseX; |
world.cursorX = fgl::mouseX; |
5861 |
5889 |
world.cursorY = fgl::mouseY; |
world.cursorY = fgl::mouseY; |
5862 |
5890 |
|
|
|
5891 |
|
// Draw the bottom layers with only ambient lighting. |
|
5892 |
|
fgl::setPipeline( fgl::colorModPipeline ); |
|
5893 |
|
|
5863 |
5894 |
// Day/night tinting. |
// Day/night tinting. |
5864 |
5895 |
fgl::setFog( ambient_light ); |
fgl::setFog( ambient_light ); |
5865 |
5896 |
|
|
|
... |
... |
void GameLoop( double d ){ |
5930 |
5961 |
e.last_y += vel_y * d; |
e.last_y += vel_y * d; |
5931 |
5962 |
} |
} |
5932 |
5963 |
} |
} |
|
5964 |
|
// Draw the entities with rim lighting. |
|
5965 |
|
fgl::setPipeline( rimlitSpritePipeline ); |
|
5966 |
|
UpdateRimSun(); |
5933 |
5967 |
if( multiplayer ) |
if( multiplayer ) |
5934 |
5968 |
world.drawEntities( ws_entities ); |
world.drawEntities( ws_entities ); |
5935 |
5969 |
else |
else |
|
... |
... |
void GameLoop( double d ){ |
6143 |
6177 |
} |
} |
6144 |
6178 |
|
|
6145 |
6179 |
// This is where circles would be drawn if they were on top. |
// This is where circles would be drawn if they were on top. |
|
6180 |
|
// Be sure to switch to the correct pipeline. |
6146 |
6181 |
} |
} |
6147 |
6182 |
|
|
6148 |
6183 |
// It is once again safe to use pathfinding. |
// It is once again safe to use pathfinding. |
|
... |
... |
void GameLoop( double d ){ |
6163 |
6198 |
? ( 0.0f ) : ( bloomAmount ) |
? ( 0.0f ) : ( bloomAmount ) |
6164 |
6199 |
} ); |
} ); |
6165 |
6200 |
fgl::drawFramebuffer( framebuffer ); |
fgl::drawFramebuffer( framebuffer ); |
6166 |
|
|
|
|
6201 |
|
// Switch back to the color mod pipeline for UI drawing. |
6167 |
6202 |
fgl::setPipeline( fgl::colorModPipeline ); |
fgl::setPipeline( fgl::colorModPipeline ); |
6168 |
6203 |
|
|
6169 |
6204 |
fgl::setFog( { 1.0f, 1.0f, 1.0f, 1.0f } ); |
fgl::setFog( { 1.0f, 1.0f, 1.0f, 1.0f } ); |