|
|
@ -1248,7 +1248,7 @@ namespace olc |
|
|
|
std::vector<std::string> vDroppedFilesCache; |
|
|
|
std::vector<std::string> vDroppedFilesCache; |
|
|
|
olc::vi2d vDroppedFilesPoint; |
|
|
|
olc::vi2d vDroppedFilesPoint; |
|
|
|
olc::vi2d vDroppedFilesPointCache; |
|
|
|
olc::vi2d vDroppedFilesPointCache; |
|
|
|
uint8_t mosaic=0; |
|
|
|
uint8_t mosaic=1; |
|
|
|
|
|
|
|
|
|
|
|
// Command Console Specific
|
|
|
|
// Command Console Specific
|
|
|
|
bool bConsoleShow = false; |
|
|
|
bool bConsoleShow = false; |
|
|
@ -3596,7 +3596,7 @@ namespace olc |
|
|
|
return mosaic; |
|
|
|
return mosaic; |
|
|
|
} |
|
|
|
} |
|
|
|
void PixelGameEngine::SetMosaicEffect(uint8_t effectLevel){ |
|
|
|
void PixelGameEngine::SetMosaicEffect(uint8_t effectLevel){ |
|
|
|
mosaic=effectLevel; |
|
|
|
mosaic=std::max(uint8_t(1),effectLevel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -4865,8 +4865,17 @@ namespace olc |
|
|
|
#else |
|
|
|
#else |
|
|
|
"#version 330 core\n" |
|
|
|
"#version 330 core\n" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
"out vec4 pixel;\n""in vec2 oTex;\n" |
|
|
|
"out vec4 pixel;\n" |
|
|
|
"in vec4 oCol;\n""uniform sampler2D sprTex;\n""void main(){pixel = texture(sprTex, oTex) * oCol;}"; |
|
|
|
"in vec2 oTex;\n" |
|
|
|
|
|
|
|
"in vec4 oCol;\n" |
|
|
|
|
|
|
|
"uniform int mosaic;\n" |
|
|
|
|
|
|
|
"uniform vec2 size;\n" |
|
|
|
|
|
|
|
"uniform sampler2D sprTex;\n" |
|
|
|
|
|
|
|
"void main(){\n" |
|
|
|
|
|
|
|
"vec2 texelSize = 1.0 / size; \n" |
|
|
|
|
|
|
|
"vec2 pos = oTex / texelSize; \n""vec2 outputPos = vec2(floor(pos.x/float(mosaic))*float(mosaic),floor(pos.y/float(mosaic))*float(mosaic));\n" |
|
|
|
|
|
|
|
"pixel = texture(sprTex, outputPos*texelSize) * oCol;\n" |
|
|
|
|
|
|
|
"}"; |
|
|
|
locShaderSource(m_nFS, 1, &strFS, NULL); |
|
|
|
locShaderSource(m_nFS, 1, &strFS, NULL); |
|
|
|
locCompileShader(m_nFS); |
|
|
|
locCompileShader(m_nFS); |
|
|
|
|
|
|
|
|
|
|
@ -4883,13 +4892,12 @@ namespace olc |
|
|
|
"layout(location = 2) in vec4 aCol;\n" |
|
|
|
"layout(location = 2) in vec4 aCol;\n" |
|
|
|
"out vec2 oTex;\n" |
|
|
|
"out vec2 oTex;\n" |
|
|
|
"out vec4 oCol;\n" |
|
|
|
"out vec4 oCol;\n" |
|
|
|
"uniform int mosaic;\n" |
|
|
|
|
|
|
|
"\n" |
|
|
|
"\n" |
|
|
|
"void main(){\n" |
|
|
|
"void main(){\n" |
|
|
|
"float p = 1.0 / aPos.z;\n" |
|
|
|
"float p = 1.0 / aPos.z;\n" |
|
|
|
"gl_Position = p * vec4(aPos.x, aPos.y, 0.0, 1.0);\n" |
|
|
|
"gl_Position = p * vec4(aPos.x, aPos.y, 0.0, 1.0);\n" |
|
|
|
"oTex = p * aTex;\n" |
|
|
|
"oTex = p * aTex;\n" |
|
|
|
"oCol = vec4(aCol.r,float(mosaic)/255.0,0,aCol.a);\n" |
|
|
|
"oCol = aCol;\n" |
|
|
|
"}"; |
|
|
|
"}"; |
|
|
|
locShaderSource(m_nVS, 1, &strVS, NULL); |
|
|
|
locShaderSource(m_nVS, 1, &strVS, NULL); |
|
|
|
locCompileShader(m_nVS); |
|
|
|
locCompileShader(m_nVS); |
|
|
@ -4974,7 +4982,9 @@ namespace olc |
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
|
|
|
locUseProgram(m_nQuadShader); |
|
|
|
locUseProgram(m_nQuadShader); |
|
|
|
GLint myUniformLocation = glGetUniformLocation(m_nQuadShader, "mosaic"); |
|
|
|
GLint myUniformLocation = glGetUniformLocation(m_nQuadShader, "mosaic"); |
|
|
|
|
|
|
|
GLint myUniformLocation2 = glGetUniformLocation(m_nQuadShader, "size"); |
|
|
|
glUniform1i(myUniformLocation,ptrPGE->GetMosaicEffect()); |
|
|
|
glUniform1i(myUniformLocation,ptrPGE->GetMosaicEffect()); |
|
|
|
|
|
|
|
glUniform2f(myUniformLocation2,ptrPGE->ScreenWidth(),ptrPGE->ScreenHeight()); |
|
|
|
locBindVertexArray(m_vaQuad); |
|
|
|
locBindVertexArray(m_vaQuad); |
|
|
|
|
|
|
|
|
|
|
|
#if defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|
#if defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|