|
|
@ -376,6 +376,8 @@ return 0; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
#pragma endregion |
|
|
|
#pragma endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define OLC_GFX_OPENGL33 |
|
|
|
|
|
|
|
|
|
|
|
#ifndef OLC_PGE_DEF |
|
|
|
#ifndef OLC_PGE_DEF |
|
|
|
#define OLC_PGE_DEF |
|
|
|
#define OLC_PGE_DEF |
|
|
|
|
|
|
|
|
|
|
@ -1230,6 +1232,8 @@ namespace olc |
|
|
|
int32_t TextEntryGetCursor() const; |
|
|
|
int32_t TextEntryGetCursor() const; |
|
|
|
bool IsTextEntryEnabled() const; |
|
|
|
bool IsTextEntryEnabled() const; |
|
|
|
void TextEntrySetCharLimit(const uint8_t charLimit); |
|
|
|
void TextEntrySetCharLimit(const uint8_t charLimit); |
|
|
|
|
|
|
|
const uint8_t GetMosaicEffect()const; |
|
|
|
|
|
|
|
void SetMosaicEffect(uint8_t effectLevel); |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
static std::map<char,Pixel> charToColor; |
|
|
|
static std::map<char,Pixel> charToColor; |
|
|
@ -1340,6 +1344,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=1; |
|
|
|
uint8_t nTextEntryCharLimit=std::numeric_limits<uint8_t>::max(); |
|
|
|
uint8_t nTextEntryCharLimit=std::numeric_limits<uint8_t>::max(); |
|
|
|
|
|
|
|
|
|
|
|
// Command Console Specific
|
|
|
|
// Command Console Specific
|
|
|
@ -1505,6 +1510,7 @@ namespace olc |
|
|
|
typedef GLint CALLSTYLE locGetUniformLocation_t(GLuint program, const GLchar* name); |
|
|
|
typedef GLint CALLSTYLE locGetUniformLocation_t(GLuint program, const GLchar* name); |
|
|
|
typedef void CALLSTYLE locUniform1f_t(GLint location, GLfloat v0); |
|
|
|
typedef void CALLSTYLE locUniform1f_t(GLint location, GLfloat v0); |
|
|
|
typedef void CALLSTYLE locUniform1i_t(GLint location, GLint v0); |
|
|
|
typedef void CALLSTYLE locUniform1i_t(GLint location, GLint v0); |
|
|
|
|
|
|
|
typedef void CALLSTYLE locUniform2f_t(GLint location, GLfloat v0, GLfloat v1); |
|
|
|
typedef void CALLSTYLE locUniform2fv_t(GLint location, GLsizei count, const GLfloat* value); |
|
|
|
typedef void CALLSTYLE locUniform2fv_t(GLint location, GLsizei count, const GLfloat* value); |
|
|
|
typedef void CALLSTYLE locActiveTexture_t(GLenum texture); |
|
|
|
typedef void CALLSTYLE locActiveTexture_t(GLenum texture); |
|
|
|
typedef void CALLSTYLE locGenFrameBuffers_t(GLsizei n, GLuint* ids); |
|
|
|
typedef void CALLSTYLE locGenFrameBuffers_t(GLsizei n, GLuint* ids); |
|
|
@ -4383,6 +4389,12 @@ namespace olc |
|
|
|
void PixelGameEngine::TextEntrySetCharLimit(const uint8_t charLimit){ |
|
|
|
void PixelGameEngine::TextEntrySetCharLimit(const uint8_t charLimit){ |
|
|
|
nTextEntryCharLimit=charLimit; |
|
|
|
nTextEntryCharLimit=charLimit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const uint8_t PixelGameEngine::GetMosaicEffect()const{ |
|
|
|
|
|
|
|
return mosaic; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void PixelGameEngine::SetMosaicEffect(uint8_t effectLevel){ |
|
|
|
|
|
|
|
mosaic=std::max(uint8_t(1),effectLevel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void PixelGameEngine::UpdateTextEntry() |
|
|
|
void PixelGameEngine::UpdateTextEntry() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -5570,6 +5582,9 @@ namespace olc |
|
|
|
locGenVertexArrays_t* locGenVertexArrays = nullptr; |
|
|
|
locGenVertexArrays_t* locGenVertexArrays = nullptr; |
|
|
|
locSwapInterval_t* locSwapInterval = nullptr; |
|
|
|
locSwapInterval_t* locSwapInterval = nullptr; |
|
|
|
locGetShaderInfoLog_t* locGetShaderInfoLog = nullptr; |
|
|
|
locGetShaderInfoLog_t* locGetShaderInfoLog = nullptr; |
|
|
|
|
|
|
|
locGetUniformLocation_t* locGetUniformLocation = nullptr; |
|
|
|
|
|
|
|
locUniform1i_t* locUniform1i = nullptr; |
|
|
|
|
|
|
|
locUniform2f_t* locUniform2f = nullptr; |
|
|
|
|
|
|
|
|
|
|
|
uint32_t m_nFS = 0; |
|
|
|
uint32_t m_nFS = 0; |
|
|
|
uint32_t m_nVS = 0; |
|
|
|
uint32_t m_nVS = 0; |
|
|
@ -5711,6 +5726,9 @@ namespace olc |
|
|
|
locEnableVertexAttribArray = OGL_LOAD(locEnableVertexAttribArray_t, glEnableVertexAttribArray); |
|
|
|
locEnableVertexAttribArray = OGL_LOAD(locEnableVertexAttribArray_t, glEnableVertexAttribArray); |
|
|
|
locUseProgram = OGL_LOAD(locUseProgram_t, glUseProgram); |
|
|
|
locUseProgram = OGL_LOAD(locUseProgram_t, glUseProgram); |
|
|
|
locGetShaderInfoLog = OGL_LOAD(locGetShaderInfoLog_t, glGetShaderInfoLog); |
|
|
|
locGetShaderInfoLog = OGL_LOAD(locGetShaderInfoLog_t, glGetShaderInfoLog); |
|
|
|
|
|
|
|
locGetUniformLocation = OGL_LOAD(locGetUniformLocation_t, glGetUniformLocation); |
|
|
|
|
|
|
|
locUniform1i = OGL_LOAD(locUniform1i_t, glUniform1i); |
|
|
|
|
|
|
|
locUniform2f = OGL_LOAD(locUniform2f_t, glUniform2f); |
|
|
|
#if !defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|
#if !defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|
locBindVertexArray = OGL_LOAD(locBindVertexArray_t, glBindVertexArray); |
|
|
|
locBindVertexArray = OGL_LOAD(locBindVertexArray_t, glBindVertexArray); |
|
|
|
locGenVertexArrays = OGL_LOAD(locGenVertexArrays_t, glGenVertexArrays); |
|
|
|
locGenVertexArrays = OGL_LOAD(locGenVertexArrays_t, glGenVertexArrays); |
|
|
@ -5724,12 +5742,22 @@ namespace olc |
|
|
|
const GLchar* strFS = |
|
|
|
const GLchar* strFS = |
|
|
|
#if defined(__arm__) || defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|
#if defined(__arm__) || defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|
"#version 300 es\n" |
|
|
|
"#version 300 es\n" |
|
|
|
"precision mediump float;" |
|
|
|
"precision highp float;" |
|
|
|
#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" |
|
|
|
|
|
|
|
"if(mosaic<=1){pixel = texture(sprTex,oTex) * oCol;return;}\n" |
|
|
|
|
|
|
|
"vec2 texelSize = 1.0 / textureSize(sprTex,0); \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); |
|
|
|
|
|
|
|
|
|
|
@ -5741,9 +5769,18 @@ namespace olc |
|
|
|
#else |
|
|
|
#else |
|
|
|
"#version 330 core\n" |
|
|
|
"#version 330 core\n" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
"layout(location = 0) in vec3 aPos;\n""layout(location = 1) in vec2 aTex;\n" |
|
|
|
"layout(location = 0) in vec3 aPos;\n" |
|
|
|
"layout(location = 2) in vec4 aCol;\n""out vec2 oTex;\n""out vec4 oCol;\n" |
|
|
|
"layout(location = 1) in vec2 aTex;\n" |
|
|
|
"void main(){ float p = 1.0 / aPos.z; gl_Position = p * vec4(aPos.x, aPos.y, 0.0, 1.0); oTex = p * aTex; oCol = aCol;}"; |
|
|
|
"layout(location = 2) in vec4 aCol;\n" |
|
|
|
|
|
|
|
"out vec2 oTex;\n" |
|
|
|
|
|
|
|
"out vec4 oCol;\n" |
|
|
|
|
|
|
|
"\n" |
|
|
|
|
|
|
|
"void main(){\n" |
|
|
|
|
|
|
|
"float p = 1.0 / aPos.z;\n" |
|
|
|
|
|
|
|
"gl_Position = p * vec4(aPos.x, aPos.y, 0.0, 1.0);\n" |
|
|
|
|
|
|
|
"oTex = p * aTex;\n" |
|
|
|
|
|
|
|
"oCol = aCol;\n" |
|
|
|
|
|
|
|
"}"; |
|
|
|
locShaderSource(m_nVS, 1, &strVS, NULL); |
|
|
|
locShaderSource(m_nVS, 1, &strVS, NULL); |
|
|
|
locCompileShader(m_nVS); |
|
|
|
locCompileShader(m_nVS); |
|
|
|
|
|
|
|
|
|
|
@ -5826,6 +5863,10 @@ namespace olc |
|
|
|
nDecalMode = DecalMode::NORMAL; |
|
|
|
nDecalMode = DecalMode::NORMAL; |
|
|
|
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 mosaicUniformLoc = locGetUniformLocation(m_nQuadShader, "mosaic"); |
|
|
|
|
|
|
|
GLint sizeUniformLoc = locGetUniformLocation(m_nQuadShader, "size"); |
|
|
|
|
|
|
|
locUniform1i(mosaicUniformLoc,ptrPGE->GetMosaicEffect()); |
|
|
|
|
|
|
|
locUniform2f(sizeUniformLoc,ptrPGE->ScreenWidth(),ptrPGE->ScreenHeight()); |
|
|
|
locBindVertexArray(m_vaQuad); |
|
|
|
locBindVertexArray(m_vaQuad); |
|
|
|
|
|
|
|
|
|
|
|
#if defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|
#if defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|