Merge branch 'master' into sqc7_server

This commit is contained in:
MarcEricMartel 2023-09-18 17:37:13 -04:00
commit b7ca0253ca
14 changed files with 316 additions and 174 deletions

View File

@ -14,7 +14,7 @@ Audio::Audio(const char * music) {
m_engine->setRolloffFactor(1);
m_engine->setDefault3DSoundMinDistance(1);
m_engine->setDefault3DSoundMaxDistance(1000);
m_music = m_engine->play2D(music, true, true, true, irrklang::ESM_STREAMING);
m_music = m_engine->play2D(music, false, true, true, irrklang::ESM_STREAMING);
}
Audio::~Audio() {
@ -40,9 +40,9 @@ void Audio::Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& v
sound->setVolume(volume);
}
void Audio::PlaySong(const char* music) {
m_music = m_engine->play2D(music, true, true, true, irrklang::ESM_STREAMING);
}
//void Audio::PlaySong(const char* music) {
// m_music = m_engine->play2D(music, false, false, false, irrklang::ESM_STREAMING);
//}
void Audio::ToggleMusicState() { m_music->setIsPaused(!m_music->getIsPaused()); }

View File

@ -22,7 +22,7 @@ public:
void Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume);
void PlaySong(const char* music);
//void PlaySong(const char* music);
void ToggleMusicState();

View File

@ -33,6 +33,9 @@
#define VIEW_DISTANCE 256
#define TEXTURE_SIZE 128
#define MAX_BULLETS 64
#define BASE_WIDTH 640
#define BASE_HEIGHT 480
#endif
#ifdef NDEBUG

View File

@ -21,24 +21,25 @@ void Engine::Init() {
abort();
}
glDisable(GL_FRAMEBUFFER_SRGB);
glClearColor(0.f, 0.f, 0.f, 1.f);
//glDisable(GL_FRAMEBUFFER_SRGB);
//glEnable(GL_DEPTH_TEST);
//glEnable(GL_STENCIL_TEST);
//glEnable(GL_POINT_SMOOTH);
//glEnable(GL_BLEND);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
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_POINT_SMOOTH);
glEnable(GL_CULL_FACE);
glEnable(GL_BLEND);
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
glBlendEquation(GL_FUNC_SUBTRACT);
//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
//glDisable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glBlendEquation(GL_FUNC_SUBTRACT);
//
// Objet de skybox avec sa propre texture et son propre shader!
m_skybox.Init(0.2f);
@ -60,9 +61,11 @@ void Engine::Init() {
void Engine::DeInit() {}
void Engine::LoadResource() {
LoadTexture(m_skybox.GetTexture(), TEXTURE_PATH "skybox.png");
LoadTexture(m_textureCrosshair, TEXTURE_PATH "cross.bmp");
LoadTexture(m_textureFont, TEXTURE_PATH "font.bmp");
LoadTexture(m_skybox.GetTexture(), TEXTURE_PATH "skybox.png", true);
LoadTexture(m_textureCrosshair, TEXTURE_PATH "cross.bmp", true);
LoadTexture(m_textureFont, TEXTURE_PATH "font.bmp", true);
LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false);
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");
@ -97,46 +100,7 @@ void Engine::LoadResource() {
void Engine::UnloadResource() {}
void Engine::DrawHud(float elapsedTime, BlockType bloc) {
// Setter le blend function , tout ce qui sera noir sera transparent
glDisable(GL_STENCIL_TEST);
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();
glLoadIdentity();
glOrtho(0, Width(), 0, Height(), -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
// Bind de la texture pour le font
m_textureFont.Bind();
std::ostringstream ss;
ss << " Fps : " << GetFps(elapsedTime);
PrintText(10, Height() - 25, ss.str());
ss.str("");
ss << " Rendered Chunks : " << m_renderCount;
PrintText(10, Height() - 35, ss.str());
ss.str("");
ss << " To-Be-Deleted Chunks : " << m_world.GettbDeleted();
PrintText(10, Height() - 45, ss.str());
ss.str("");
ss << " Velocity : " << m_player.GetVelocity(); // IMPORTANT : on utilise l operateur << pour afficher la position
PrintText(10, 10, ss.str());
ss.str("");
ss << " Direction : " << m_player.GetDirection();
PrintText(10, 20, ss.str());
ss.str("");
ss << " Position : " << m_player.GetPosition();
PrintText(10, 30, ss.str());
ss.str("");
ss << " Block : ";
if (bloc == BTYPE_LAST)
ss << "Weapon.";
else ss << (int)bloc;
PrintText(10, 40, ss.str());
void Engine::DisplayCrosshair() {
m_textureCrosshair.Bind();
static const int crossSize = 32;
glLoadIdentity();
@ -151,37 +115,185 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
glTexCoord2f(0, 1);
glVertex2i(0, crossSize);
glEnd();
}
void Engine::DisplayCurrentItem() {
}
void Engine::DisplayHud() {
glBindTexture(GL_TEXTURE_2D, 0);
glLoadIdentity();
glDisable(GL_BLEND);
// Barre HP
float fBarWidth = Width() / 4;
float fBarHeight = Height() / 25;
float fPosX = Width() / 20;
float fPosY = Height() - (Height() - (fBarHeight * 4));
float playerHp = m_player.GetHP();
float facteurOmbrage = m_displayInfo ? 0.5f : 1.0f;
// Arrière-plan (Barre HP)
glColor3f(1.0f * facteurOmbrage, 1.0f * facteurOmbrage, 1.0f * facteurOmbrage);
glBegin(GL_QUADS);
glVertex2f(fPosX, fPosY - fBarHeight); // Bas-Gauche
glVertex2f(fPosX + fBarWidth, fPosY - fBarHeight); // Bas-Droite
glVertex2f(fPosX + fBarWidth, fPosY); // Haut-Droite
glVertex2f(fPosX, fPosY); // Haut-Gauche
glEnd();
//TODO: Associer avec méchanique de vie du joueur
// Barre HP
glColor3f(0.0f * facteurOmbrage, 1.0f * facteurOmbrage, 0.0f * facteurOmbrage);
glBegin(GL_QUADS);
glVertex2f(fPosX, fPosY - fBarHeight); // Bas-Gauche
glVertex2f(fPosX + fBarWidth * playerHp, fPosY - fBarHeight); // Bas-Droite
glVertex2f(fPosX + fBarWidth * playerHp, fPosY); // Haut-Droite
glVertex2f(fPosX, fPosY); // Haut-Gauche
glEnd();
// Barre équip
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor3f(1.0f * facteurOmbrage, 1.0f * facteurOmbrage, 1.0f * facteurOmbrage);
m_textureGun.Bind();
float margin = Width() * 0.05;
float itemWidth = Width() * 0.33;
float itemHeight = itemWidth / 2.208;
float startX = Width() - itemWidth - margin;
float startY = margin;
glTranslated(startX, startY, 0);
glBegin(GL_QUADS);
glTexCoord2f(1, 0); glVertex2i(0, 0);
glTexCoord2f(0, 0); glVertex2i(itemWidth, 0);
glTexCoord2f(0, 1); glVertex2i(itemWidth, itemHeight);
glTexCoord2f(1, 1); glVertex2i(0, itemHeight);
glEnd();
glDisable(GL_BLEND);
// Username
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor3f(1.0f, 1.0f, 1.0f);
float scale = GetScale();
m_textureFont.Bind();
std::ostringstream ss;
ss << m_player.GetUsername();
PrintText(fPosX, fPosY, scale, ss.str());
}
void Engine::DisplayInfo(float elapsedTime, BlockType bloc) {
// Bind de la texture pour le font
m_textureFont.Bind();
std::ostringstream ss;
float scale = GetScale();
unsigned int x = Width() / 25;
ss << " Fps : " << GetFps(elapsedTime);
PrintText(x, Height() - (Height() / 19.2), scale, ss.str());
ss.str("");
ss << " Rendered Chunks : " << m_renderCount;
PrintText(x, Height() - (Height() / 13.7), scale, ss.str());
ss.str("");
ss << " To-Be-Deleted Chunks : " << m_world.GettbDeleted();
PrintText(x, Height() - (Height() / 10.7), scale, ss.str());
ss.str("");
ss << " Velocity : " << m_player.GetVelocity(); // IMPORTANT : on utilise l operateur << pour afficher la position
PrintText(x, Height() / 48, scale, ss.str());
ss.str("");
ss << " Direction : " << m_player.GetDirection();
PrintText(x, Height() / 24, scale, ss.str());
ss.str("");
ss << " Position : " << m_player.GetPosition();
PrintText(x, Height() / 16, scale, ss.str());
ss.str("");
ss << " Block : ";
if (bloc == BTYPE_LAST)
ss << "Weapon.";
else ss << (int)bloc;
PrintText(x, Height() / 12, scale, ss.str());
}
void Engine::DrawHud(float elapsedTime, BlockType bloc) {
// Setter le blend function, tout ce qui sera noir sera transparent
glDisable(GL_STENCIL_TEST);
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glBlendEquation(GL_FUNC_ADD);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, Width(), 0, Height(), -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (m_displayInfo) {
DisplayInfo(elapsedTime, bloc);
}
if (m_displayHud) {
DisplayHud();
}
if (m_displayCrosshair) {
DisplayCrosshair();
}
// Reset du blend function
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
glBlendEquation(GL_FUNC_SUBTRACT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}
void Engine::PrintText(unsigned int x, unsigned int y, const std::string& t) {
void Engine::PrintText(float x, float y, float scale, const std::string& t) {
glLoadIdentity();
glTranslated(x, y, 0);
for (unsigned int i = 0; i < t.length(); ++i) {
float left = (float)((t[i] - 32) % 16) / 16.f;
float top = (float)((t[i] - 32) / 16) / 16.f;
top += .5f;
glBegin(GL_QUADS);
glTexCoord2f(left, 1.f - top - .0625f);
glVertex2f(0, 0);
glTexCoord2f(left + .0625f, 1.f - top - .0625f);
glVertex2f(12, 0);
glTexCoord2f(left + .0625f, 1.f - top);
glVertex2f(12, 12);
glTexCoord2f(left, 1.f - top);
glVertex2f(0, 12);
glTexCoord2f(left, 1.f - top - .0625f); glVertex2f(0, 0);
glTexCoord2f(left + .0625f, 1.f - top - .0625f); glVertex2f(12 * scale, 0);
glTexCoord2f(left + .0625f, 1.f - top); glVertex2f(12 * scale, 12 * scale);
glTexCoord2f(left, 1.f - top); glVertex2f(0, 12 * scale);
glEnd();
glTranslated(8, 0, 0);
glTranslated(8 * scale, 0, 0);
}
}
float Engine::GetScale() const {
float widthRatio = Width() / BASE_WIDTH;
float heightRatio = Height() / BASE_HEIGHT;
return (widthRatio + heightRatio) / 2.0f;
}
int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; }
void Engine::Render(float elapsedTime) {
@ -238,7 +350,7 @@ void Engine::Render(float elapsedTime) {
m_bullets[0] = new Bullet(m_player);
}
bulletTime = .1f;
m_audio.Create3DAudioObj(m_powpow, AUDIO_PATH "pow.wav", m_player.GetPOV(), m_player.GetDirection() * 10, .5f);
m_audio.Create3DAudioObj(m_powpow, AUDIO_PATH "windowsaccount.wav", m_player.GetPOV(), m_player.GetDirection() * 10, .5f);
if (m_flash) { // Coupe le rendering et affiche un frame blanc, pour simuler un flash.
glClearColor(.8f, .8f, .8f, 1.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@ -261,11 +373,7 @@ void Engine::Render(float elapsedTime) {
if (m_isSkybox) m_skybox.Render(skybox);
if (m_wireframe)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
DrawHud(elapsedTime, bloc);
if (m_wireframe)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
static bool fell = false;
if (m_player.GetPosition().y < 1.7f && !fell) {
@ -280,54 +388,54 @@ void Engine::Render(float elapsedTime) {
void Engine::KeyPressEvent(unsigned char key) {
switch (key) {
case 36: // ESC
Stop();
break;
case 94: // F10
SetFullscreen(!IsFullscreen());
break;
case 22: // W
if (!m_keyW) {
// std::cout << "W " << std::endl;
m_keyW = true;
}
break;
case 0: // A
case 0: // A - Gauche
if (!m_keyA) {
//std::cout << "A " << std::endl;
m_keyA = true;
}
break;
case 18: // S
if (!m_keyS) {
//std::cout << "S " << std::endl;
m_keyS = true;
}
break;
case 3: // D
case 3: // D - Droite
if (!m_keyD) {
//std::cout << "D " << std::endl;
m_keyD = true;
}
break;
case 38: // Left Shift
if (!m_keylshift) {
//std::cout << "Dash!" << std::endl;
m_keylshift = true;
case 18: // S - Reculer
if (!m_keyS) {
m_keyS = true;
}
break;
case 57: // Space
case 22: // W - Avancer
if (!m_keyW) {
m_keyW = true;
}
break;
case 36: // ESC - Quitter
Stop();
break;
case 57: // Space - Sauter
if (!m_keySpace) {
//std::cout << "Jump! " << std::endl;
m_keySpace = true;
}
break;
case 94: // F10 - Plein écran
IsFullscreen() ? SetFullscreen(false) : SetFullscreen(true);
//SetFullscreen(!IsFullscreen());
break;
case 2: // C - Ignorer
break;
case 5: // F - Ignorer
case 24: // Y - Ignorer
case 255: // Fn - Ignorer
break;
case 12: // M - Ignorer
break;
case 7: // H - Ignorer
break;
case 8: // I - Ignorer
break;
case 17: // R - Ignorer
break;
case 24: // Y - Ignorer
break;
case 255: // Fn - Ignorer
break;
default:
std::cout << "Unhandled key: " << (int)key << std::endl;
}
@ -335,44 +443,47 @@ void Engine::KeyPressEvent(unsigned char key) {
void Engine::KeyReleaseEvent(unsigned char key) {
switch (key) {
case 5:
case 0: // A - Stop gauche
m_keyA = false;
break;
case 2: // C - Toggle crosshair
m_displayCrosshair = !m_displayCrosshair;
std::cout << "DISPLAY CROSSHAIR " << (m_displayCrosshair ? "enabled" : "disabled") << std::endl;
break;
case 3: // D - Stop droite
m_keyD = false;
break;
case 5: // F - Toggle flash
m_flash = !m_flash;
break;
case 12:
case 7: // H - Toggle HUD
m_displayHud = !m_displayHud;
std::cout << "DISPLAY HUD " << (m_displayHud ? "enabled" : "disabled") << std::endl;
break;
case 8: // I - Toggle render data
m_displayInfo = !m_displayInfo;
std::cout << "DISPLAY INFO " << (m_displayInfo ? "enabled" : "disabled") << std::endl;
break;
case 12: // M - Toggle music
m_audio.ToggleMusicState();
break;
case 17:
case 17: // R - Toggle skybox
m_isSkybox = !m_isSkybox;
break;
case 24: // Y
case 18: // S - Stop reculer
m_keyS = false;
break;
case 22: // W - Stop avancer
m_keyW = false;
break;
case 24: // Y - Wireframe
m_wireframe = !m_wireframe;
if (m_wireframe)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
break;
case 22: // W
//std::cout << "rW " << std::endl;
m_keyW = false;
break;
case 0: // A
//std::cout << "rA " << std::endl;
m_keyA = false;
break;
case 18: // S
//std::cout << "rS " << std::endl;
m_keyS = false;
break;
case 3: // D
//std::cout << "rD " << std::endl;
m_keyD = false;
break;
case 38: // Left Shift
//std::cout << "rLS " << std::endl;
m_keylshift = false;
break;
case 57: // Espace
//std::cout << "rSpace " << std::endl;
case 57: // Espace - Stop sauter
m_keySpace = false;
break;
}
@ -437,10 +548,9 @@ void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {
}
}
bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool stopOnError) {
texture.Load(filename);
if (!texture.IsValid())
{
bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps, bool stopOnError) {
texture.Load(filename, useMipmaps);
if (!texture.IsValid()) {
std::cerr << "Unable to load texture (" << filename << ")" << std::endl;
if (stopOnError)
Stop();

View File

@ -1,5 +1,6 @@
#ifndef ENGINE_H__
#define ENGINE_H__
#include "define.h"
#include "openglcontext.h"
#include "texture.h"
@ -31,15 +32,18 @@ public:
virtual void MouseReleaseEvent(const MOUSE_BUTTON &button, int x, int y);
private:
bool LoadTexture(Texture& texture, const std::string& filename, bool stopOnError = true);
void DrawHud(float elapsedTime, BlockType bloc);
void PrintText(unsigned int x, unsigned int y, const std::string& t);
float GetScale() const;
int GetFps(float elapsedTime) const;
bool m_wireframe = false;
bool m_isSkybox = true;
bool LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps = true, bool stopOnError = true);
int m_renderCount = 0;
void DisplayCrosshair();
void DisplayCurrentItem();
void DisplayHud();
void DisplayInfo(float elapsedTime, BlockType bloc);
void DrawHud(float elapsedTime, BlockType bloc);
void PrintText(float x, float y, float scale, const std::string& t);
Shader m_shader01;
BlockInfo* m_blockinfo[BTYPE_LAST];
@ -50,9 +54,10 @@ private:
Texture m_textureSkybox;
Texture m_textureFont;
Texture m_textureCrosshair;
Texture m_textureGun;
Skybox m_skybox;
Audio m_audio = Audio(AUDIO_PATH "music01.wav");
Audio m_audio = Audio(AUDIO_PATH "start.wav");
irrklang::ISound* m_powpow;
irrklang::ISound* m_scream;
@ -61,21 +66,28 @@ private:
Bullet* m_bullets[MAX_BULLETS];
float m_scale;
int m_renderCount = 0;
bool m_wireframe = false;
bool m_isSkybox = true;
bool m_block = false;
bool m_flash = true;
bool m_displayCrosshair = true;
bool m_displayHud = true;
bool m_displayInfo = false;
bool m_keyW = false;
bool m_keyA = false;
bool m_keyS = false;
bool m_keyD = false;
bool m_keylshift = false;
bool m_keySpace = false;
bool m_mouseL = false;
bool m_mouseR = false;
bool m_mouseC = false;
bool m_mouseWU = false;
bool m_mouseWD = false;
bool m_block = false;
bool m_flash = true;
};
#endif // ENGINE_H__

View File

@ -5,5 +5,5 @@
int main() {
Engine engine;
engine.SetMaxFps(60);
engine.Start("Syndicat Quebecois de la Construction Simulator 2023", 640, 480, false);
engine.Start("Syndicat Quebecois de la Construction Simulator 2023", BASE_WIDTH, BASE_HEIGHT, false);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -4,6 +4,8 @@
Player::Player(const Vector3f& position, float rotX, float rotY) : m_position(position), m_rotX(rotX), m_rotY(rotY) {
m_velocity = Vector3f(0, 0, 0);
m_airborne = true;
m_hp = 0.75f; //TODO: Remettre à 1.0f
m_username = "Zelda Bee-Bop";
}
void Player::TurnLeftRight(float value) {
@ -197,6 +199,10 @@ Vector3f Player::GetPOV() const { return Vector3f(GetPosition().x, m_POV, GetPos
Vector3f Player::GetDirection() const { return m_direction; }
std::string Player::GetUsername() const { return m_username; }
float Player::GetHP() const { return m_hp; }
void Player::Teleport(int& x, int& z) {
m_position.x -= x * CHUNK_SIZE_X;
m_position.z -= z * CHUNK_SIZE_Z;

View File

@ -20,6 +20,8 @@ public:
Vector3f GetDirection() const;
Vector3f GetVelocity() const;
Vector3f GetPOV() const;
std::string GetUsername() const;
float GetHP() const;
void Teleport(int& x, int& z);
private:
@ -27,10 +29,14 @@ private:
Vector3f m_velocity;
Vector3f m_direction;
std::string m_username;
float m_rotX = 0;
float m_rotY = 0;
float m_POV;
float m_hp;
bool m_airborne;
};
#endif //_PLAYER_H__

View File

@ -13,8 +13,7 @@ Texture::~Texture()
glDeleteTextures(1, &m_textureId);
}
bool Texture::Load(const std::string& filename)
bool Texture::Load(const std::string& filename, bool useMipMaps)
{
// Initialize Devil only once:
static bool alreadyInitialized = false;
@ -42,8 +41,14 @@ bool Texture::Load(const std::string& filename)
glGenTextures(1, &m_textureId);
glBindTexture(GL_TEXTURE_2D, m_textureId);
if (useMipMaps) {
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
}
else {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
ilDeleteImages(1, &texid);

View File

@ -11,7 +11,7 @@ public:
Texture(const std::string& filename = "");
~Texture();
bool Load(const std::string& filename);
bool Load(const std::string& filename, bool useMipMaps = true);
bool IsValid() const;
void Bind() const;