Push de couleur qui marche pas 💢
This commit is contained in:
parent
85b8f4b94b
commit
02fafea45c
@ -1181,8 +1181,10 @@ void Engine::Render(float elapsedTime) {
|
|||||||
//m_remotePlayer.ApplyTransformation(remotePlayer, false);
|
//m_remotePlayer.ApplyTransformation(remotePlayer, false);
|
||||||
m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo);
|
m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo);
|
||||||
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
|
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
|
||||||
|
|
||||||
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
m_remotePlayer.Render(m_animeAtlas, m_shader01, all, elapsedTime);
|
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);
|
if (m_isSkybox) m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ void main()
|
|||||||
texel = texture2D(tex,gl_TexCoord[0].st);
|
texel = texture2D(tex,gl_TexCoord[0].st);
|
||||||
|
|
||||||
texel *= light;
|
texel *= light;
|
||||||
texel.a = 255.;
|
|
||||||
gl_FragColor = texel;
|
gl_FragColor = texel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,10 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
|
|||||||
atlas.TextureIndexToCoord(0, u, v, w, h);
|
atlas.TextureIndexToCoord(0, u, v, w, h);
|
||||||
//glLoadIdentity();
|
//glLoadIdentity();
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
|
|
||||||
glLoadMatrixf(tran.GetMatrix().GetInternalValues());
|
glLoadMatrixf(tran.GetMatrix().GetInternalValues());
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(u, v); glVertex3f(x - width/2., y - height, z); //glVertex3f(v4.x, v4.y, v4.z);//glVertex3f(0, 50, 0);
|
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 + 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);
|
glTexCoord2f(u, v + h); glVertex3f(x-width/2., y, z); //glVertex3f(v1.x, v1.y, v1.z);// glVertex3f(0, 0, 0);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
|
||||||
|
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||||
|
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
shader.Disable();
|
shader.Disable();
|
||||||
//tran.ApplyTranslation(-m_position);
|
//tran.ApplyTranslation(-m_position);
|
||||||
//glEnable(GL_DEPTH_TEST);
|
//glEnable(GL_DEPTH_TEST);
|
||||||
|
@ -40,6 +40,9 @@ TextureAtlas::TextureIndex TextureAtlas::AddTexture(const std::string& fname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TextureAtlas::Generate(int textureSize, bool mipmap) {
|
bool TextureAtlas::Generate(int textureSize, bool mipmap) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO mipmap pas encore 100% parfait...
|
// TODO mipmap pas encore 100% parfait...
|
||||||
assert(!mipmap);
|
assert(!mipmap);
|
||||||
|
|
||||||
@ -66,9 +69,9 @@ bool TextureAtlas::Generate(int textureSize, bool mipmap) {
|
|||||||
|
|
||||||
ilOriginFunc(IL_ORIGIN_LOWER_LEFT);
|
ilOriginFunc(IL_ORIGIN_LOWER_LEFT);
|
||||||
ilEnable(IL_ORIGIN_SET);
|
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;
|
return false;
|
||||||
|
|
||||||
if (!ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE))
|
if (!ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE))
|
||||||
@ -171,8 +174,10 @@ bool TextureAtlas::Generate(int textureSize, bool mipmap) {
|
|||||||
mipmapSize /= 2;
|
mipmapSize /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_isValid = true;
|
m_isValid = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user