diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index deff0af..3e9a9f3 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -1181,8 +1181,10 @@ void Engine::Render(float elapsedTime) { //m_remotePlayer.ApplyTransformation(remotePlayer, false); m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo); m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo); + glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); m_remotePlayer.Render(m_animeAtlas, m_shader01, all, elapsedTime); + if (m_isSkybox) m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas); diff --git a/SQCSim2021/media/shaders/shader01.frag b/SQCSim2021/media/shaders/shader01.frag index 8adf697..99b1d70 100644 --- a/SQCSim2021/media/shaders/shader01.frag +++ b/SQCSim2021/media/shaders/shader01.frag @@ -7,7 +7,7 @@ void main() texel = texture2D(tex,gl_TexCoord[0].st); texel *= light; - texel.a = 255.; + gl_FragColor = texel; } diff --git a/SQCSim2021/remoteplayer.cpp b/SQCSim2021/remoteplayer.cpp index 8a4ed7d..c2247ba 100644 --- a/SQCSim2021/remoteplayer.cpp +++ b/SQCSim2021/remoteplayer.cpp @@ -105,6 +105,10 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr atlas.TextureIndexToCoord(0, u, v, w, h); //glLoadIdentity(); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendEquation(GL_FUNC_ADD); + glLoadMatrixf(tran.GetMatrix().GetInternalValues()); glBegin(GL_QUADS); glTexCoord2f(u, v); glVertex3f(x - width/2., y - height, z); //glVertex3f(v4.x, v4.y, v4.z);//glVertex3f(0, 50, 0); @@ -112,6 +116,12 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr glTexCoord2f(u + w, v + h); glVertex3f(x+width/2., y, z); //glVertex3f(v2.x, v2.y, v2.z); //glVertex3f(50, 0, 0); glTexCoord2f(u, v + h); glVertex3f(x-width/2., y, z); //glVertex3f(v1.x, v1.y, v1.z);// glVertex3f(0, 0, 0); glEnd(); + + + glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR); + glBlendEquation(GL_FUNC_SUBTRACT); + glDisable(GL_BLEND); + shader.Disable(); //tran.ApplyTranslation(-m_position); //glEnable(GL_DEPTH_TEST); diff --git a/SQCSim2021/textureatlas.cpp b/SQCSim2021/textureatlas.cpp index 1adc9f8..3e15259 100644 --- a/SQCSim2021/textureatlas.cpp +++ b/SQCSim2021/textureatlas.cpp @@ -40,6 +40,9 @@ TextureAtlas::TextureIndex TextureAtlas::AddTexture(const std::string& fname) { } bool TextureAtlas::Generate(int textureSize, bool mipmap) { + + + // TODO mipmap pas encore 100% parfait... assert(!mipmap); @@ -66,9 +69,9 @@ bool TextureAtlas::Generate(int textureSize, bool mipmap) { ilOriginFunc(IL_ORIGIN_LOWER_LEFT); ilEnable(IL_ORIGIN_SET); - ilEnable(IL_ALPHA); + - if (!ilLoadImage((const ILstring)it->first.c_str())) + if (!ilLoad(IL_PNG,(const ILstring)it->first.c_str())) return false; if (!ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE)) @@ -171,8 +174,10 @@ bool TextureAtlas::Generate(int textureSize, bool mipmap) { mipmapSize /= 2; } + m_isValid = true; return true; + }