Nerfage pour version Debug/MSVC
This commit is contained in:
@@ -15,24 +15,26 @@ void Engine::Init() {
|
||||
abort();
|
||||
}
|
||||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
glClearColor(0.f, 0.f, 0.f, 1.f);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(45.0f, (float)Width() / (float)Height(), 0.0001f, 1000.0f);
|
||||
gluPerspective(45.0f, (float)Width() / (float)Height(), 0.1f, VIEW_DISTANCE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
|
||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR); // , GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_SUBTRACT);// , GL_FUNC_ADD);
|
||||
|
||||
// Objet de skybox avec sa propre texture et son propre shader!
|
||||
m_skybox.Init(0.00013f);
|
||||
m_skybox.Init(0.2f);
|
||||
|
||||
// Objet de musique!
|
||||
//m_audio.ToggleMusicState();
|
||||
@@ -54,7 +56,7 @@ void Engine::LoadResource() {
|
||||
TextureAtlas::TextureIndex texDirtIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal3.png");
|
||||
TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
|
||||
TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.png");
|
||||
TextureAtlas::TextureIndex texMetalIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal1.png");
|
||||
TextureAtlas::TextureIndex texMetalIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "dirt.png");
|
||||
|
||||
if (!m_textureAtlas.Generate(512, false)) {
|
||||
std::cout << " Unable to generate texture atlas ..." << std::endl;
|
||||
@@ -89,6 +91,7 @@ void Engine::DrawHud(float elapsedTime) {
|
||||
// Setter le blend function , tout ce qui sera noir sera transparent
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
@@ -135,7 +138,8 @@ void Engine::DrawHud(float elapsedTime) {
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, crossSize);
|
||||
glEnd();
|
||||
glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
|
||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR); // , GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_SUBTRACT);// , GL_FUNC_ADD);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
@@ -174,7 +178,7 @@ void Engine::Render(float elapsedTime) {
|
||||
|
||||
Transformation all;
|
||||
Transformation skybox;
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
// Transformations initiales
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
@@ -188,19 +192,23 @@ void Engine::Render(float elapsedTime) {
|
||||
m_player.ApplyTransformation(skybox, false); // Version d'ApplyTransformation qui ne tient compte que de la rotation
|
||||
// (donc l'objet ne bouge pas relativement au joueur, ce qui est pratique pour une skybox!).
|
||||
|
||||
if (m_isSkybox) m_skybox.Render(skybox);
|
||||
|
||||
if (m_mouseL)
|
||||
m_world.ChangeBlockAtCursor(BTYPE_DIRT, m_player, m_block);
|
||||
else if (m_mouseR)
|
||||
m_world.ChangeBlockAtCursor(BTYPE_AIR, m_player, m_block);
|
||||
|
||||
|
||||
glStencilFunc(GL_EQUAL, 1, 0x00);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
m_world.Update(m_renderCount, m_badHitCount, m_player, all, m_shader01, m_textureAtlas, m_perlin, m_blockinfo);
|
||||
|
||||
glStencilFunc(GL_GREATER, 1, 0xFF);
|
||||
if (m_isSkybox) m_skybox.Render(skybox);
|
||||
|
||||
if (m_wireframe)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
DrawHud(elapsedTime);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
if (m_wireframe)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
||||
|
Reference in New Issue
Block a user