Compare commits
5 Commits
sqc-20_aud
...
SQC_17_HUD
Author | SHA1 | Date | |
---|---|---|---|
|
fc4a22e844 | ||
|
c7271f6217 | ||
|
8ebe7b95fc | ||
|
df5b7960b2 | ||
|
db0a39f64a |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -373,8 +373,3 @@ FodyWeavers.xsd
|
||||
/x64/Release/SQCSim2023.exe
|
||||
/x64/Debug/SQCSim2023.exe
|
||||
/x64/Debug/SQCSim2021.pdb
|
||||
/SQCSim-srv/cmake/*
|
||||
!/SQCSim-srv/cmake/CMakeLists.txt
|
||||
/SQCSim2021/cmake/*
|
||||
!/SQCSim2021/cmake/CMakeLists.txt
|
||||
/SQCSim2021/SQCSim-client
|
||||
|
@@ -7,9 +7,8 @@ Bullet::Bullet(Vector3f pos, Vector3f dir, uint64_t tid): m_startpos(pos), m_cur
|
||||
|
||||
Bullet::~Bullet() {}
|
||||
|
||||
bool Bullet::Update(World* world, float elapsedtime, int perframe) {
|
||||
int max = 100 / perframe;
|
||||
for (int x = 0; x < max; ++x) {
|
||||
bool Bullet::Update(World* world, float elapsedtime) {
|
||||
for (int x = 0; x < 1000; ++x) {
|
||||
m_currentpos += m_velocity * elapsedtime;
|
||||
|
||||
if (!world->ChunkAt(m_currentpos))
|
||||
@@ -31,14 +30,10 @@ void Bullet::Transpose(int& x, int& z) {
|
||||
m_startpos.z -= z * CHUNK_SIZE_Z;
|
||||
}
|
||||
|
||||
Vector3f Bullet::getPos() const {
|
||||
Vector3f Bullet::getPos() {
|
||||
return m_currentpos;
|
||||
}
|
||||
|
||||
Vector3f Bullet::getVel() const {
|
||||
return m_velocity;
|
||||
}
|
||||
|
||||
uint64_t Bullet::getTeamID(){
|
||||
return m_tid;
|
||||
}
|
||||
|
@@ -12,10 +12,9 @@ public:
|
||||
Bullet(Vector3f pos, Vector3f dir, uint64_t tid);
|
||||
~Bullet();
|
||||
|
||||
bool Update(World* world, float elapsedtime, int perframe);
|
||||
bool Update(World* world, float elapsedtime);
|
||||
void Transpose(int& x, int& z);
|
||||
Vector3f getPos() const;
|
||||
Vector3f getVel() const;
|
||||
Vector3f getPos();
|
||||
uint64_t getTeamID();
|
||||
|
||||
private:
|
||||
|
@@ -53,7 +53,6 @@ typedef uint64_t Timestamp;
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <cstring>
|
||||
|
||||
#define SOCKET int
|
||||
#define INVALID_SOCKET -1
|
||||
|
@@ -130,7 +130,7 @@ void World::GetScope(unsigned int& x, unsigned int& y) {
|
||||
y = m_center[1];
|
||||
}
|
||||
|
||||
void World::Update(Bullet* bullets[MAX_BULLETS], const Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]) {
|
||||
void World::Update(Bullet* bullets[MAX_BULLETS], Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]) {
|
||||
UpdateWorld(player_pos, blockinfo);
|
||||
//TransposeWorld(player_pos, bullets);
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ public:
|
||||
BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const;
|
||||
BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const;
|
||||
|
||||
void Update(Bullet* bullets[MAX_BULLETS], const Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]);
|
||||
void Update(Bullet* bullets[MAX_BULLETS], Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]);
|
||||
|
||||
void GetScope(unsigned int& x, unsigned int& y);
|
||||
|
||||
|
@@ -1,30 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.18.4)
|
||||
|
||||
project(SQCSim-Server VERSION 0.1)
|
||||
|
||||
add_compile_options("-Wno-narrowing")
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_STANDARD_REQUIRED True)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../out")
|
||||
|
||||
set(SQCSIM_COMMON_DIR "../../SQCSim-common/")
|
||||
|
||||
add_library(SQCSim-common
|
||||
"${SQCSIM_COMMON_DIR}blockinfo.cpp"
|
||||
"${SQCSIM_COMMON_DIR}bullet.cpp"
|
||||
"${SQCSIM_COMMON_DIR}chunk.cpp"
|
||||
"${SQCSIM_COMMON_DIR}netprotocol.cpp"
|
||||
"${SQCSIM_COMMON_DIR}opensimplex.cpp"
|
||||
"${SQCSIM_COMMON_DIR}player.cpp"
|
||||
"${SQCSIM_COMMON_DIR}transformation.cpp"
|
||||
"${SQCSIM_COMMON_DIR}world.cpp"
|
||||
)
|
||||
|
||||
add_executable(SQCSim-server
|
||||
"../connection.cpp"
|
||||
"../server.cpp"
|
||||
"../main.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(SQCSim-server PUBLIC SQCSim-common)
|
@@ -85,7 +85,7 @@ int Server::Ready() {
|
||||
|
||||
while (!readystart) {
|
||||
sockaddr_in sockad;
|
||||
unsigned int addrlen = sizeof(sockad);
|
||||
int addrlen = sizeof(sockad);
|
||||
SOCKET sock = accept(m_sock_tcp, (sockaddr*)&sockad, &addrlen);
|
||||
|
||||
if (sock < 0)
|
||||
@@ -140,7 +140,7 @@ void Server::Run() {
|
||||
Log("Partie en cours...", false, false);
|
||||
}
|
||||
|
||||
inline std::string Server::LogTimestamp() {
|
||||
inline std::string Server::Timestamp() {
|
||||
time_t rawtime;
|
||||
struct tm timeinfo;
|
||||
char buffer[80];
|
||||
@@ -162,11 +162,11 @@ inline std::string Server::LogTimestamp() {
|
||||
void Server::Log(std::string str, bool is_error = false, bool is_fatal = false) {
|
||||
switch (m_log) {
|
||||
case LOG_DEST::LOGFILE:
|
||||
m_logfile << LogTimestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl;
|
||||
m_logfile << Timestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl;
|
||||
break;
|
||||
case LOG_DEST::CONSOLE:
|
||||
default:
|
||||
std::cout << LogTimestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl;
|
||||
std::cout << Timestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@ private:
|
||||
|
||||
World* m_world = nullptr;
|
||||
|
||||
std::string LogTimestamp();
|
||||
std::string Timestamp();
|
||||
void Log(std::string str, bool is_error, bool is_fatal);
|
||||
void buildIdList(size_t size);
|
||||
|
||||
|
@@ -2,17 +2,17 @@
|
||||
|
||||
Audio::Audio() {
|
||||
m_engine = irrklang::createIrrKlangDevice();
|
||||
m_engine->setDopplerEffectParameters(10);
|
||||
m_engine->setRolloffFactor(2);
|
||||
m_engine->setDefault3DSoundMinDistance(.1);
|
||||
m_engine->setDopplerEffectParameters(1);
|
||||
m_engine->setRolloffFactor(1);
|
||||
m_engine->setDefault3DSoundMinDistance(1);
|
||||
m_engine->setDefault3DSoundMaxDistance(1000);
|
||||
}
|
||||
|
||||
Audio::Audio(const char * music) {
|
||||
m_engine = irrklang::createIrrKlangDevice();
|
||||
m_engine->setDopplerEffectParameters(1);
|
||||
m_engine->setRolloffFactor(2);
|
||||
m_engine->setDefault3DSoundMinDistance(.1);
|
||||
m_engine->setRolloffFactor(1);
|
||||
m_engine->setDefault3DSoundMinDistance(1);
|
||||
m_engine->setDefault3DSoundMaxDistance(1000);
|
||||
m_music = m_engine->play2D(music, false, true, true, irrklang::ESM_STREAMING);
|
||||
}
|
||||
@@ -28,11 +28,10 @@ void Audio::Update3DAudio(Vector3f pos, Vector3f dir, Vector3f vel) {
|
||||
irrklang::vec3df(vel.x, vel.y, vel.z));
|
||||
}
|
||||
|
||||
irrklang::ISound* Audio::Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, bool is_looped = false, float volume = 1) {
|
||||
sound = m_engine->play3D(name, irrklang::vec3df(pos.x, pos.y, pos.z), is_looped, false, true, is_looped? irrklang::ESM_STREAMING: irrklang::ESM_NO_STREAMING, true);
|
||||
void Audio::Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, float volume = 1) {
|
||||
sound = m_engine->play3D(name, irrklang::vec3df(pos.x, pos.y, pos.z), false, false, true, irrklang::ESM_NO_STREAMING, true);
|
||||
sound->setVelocity(irrklang::vec3df(vel.x, vel.y, vel.z));
|
||||
sound->setVolume(volume);
|
||||
return sound;
|
||||
}
|
||||
|
||||
void Audio::Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume = 1) {
|
||||
|
@@ -1,30 +1,24 @@
|
||||
#ifndef AUDIO_H__
|
||||
#define AUDIO_H__
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <irrKlang.h>
|
||||
#include <ik_ISoundSource.h>
|
||||
#else
|
||||
#include "./external/irrKlang-64bit-1.6.0/include/irrKlang.h"
|
||||
#include "./external/irrKlang-64bit-1.6.0/include/ik_ISoundSource.h"
|
||||
#endif
|
||||
|
||||
#include "../SQCSim-common/vector3.h"
|
||||
#include "define.h"
|
||||
|
||||
class Audio {
|
||||
private:
|
||||
irrklang::ISoundEngine* m_engine;
|
||||
irrklang::ISound* m_music;
|
||||
|
||||
public:
|
||||
Audio();
|
||||
Audio(const char* music);
|
||||
~Audio();
|
||||
irrklang::ISoundEngine* m_engine;
|
||||
|
||||
void Update3DAudio(Vector3f pos, Vector3f dir, Vector3f speed);
|
||||
|
||||
irrklang::ISound* Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, bool is_looped, float volume);
|
||||
void Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, float volume);
|
||||
|
||||
void Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume);
|
||||
|
||||
|
@@ -1,68 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.18.4)
|
||||
|
||||
project(SQCSim-Client VERSION 0.8)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_STANDARD_REQUIRED True)
|
||||
|
||||
set(CMAKE_BUILD_DIRECTORY "./build")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../")
|
||||
|
||||
set(SQCSIM_COMMON_DIR "../../SQCSim-common/")
|
||||
set(SQCSIM_EXTERN_DIR "../external/")
|
||||
|
||||
find_package(SFML COMPONENTS system window graphics REQUIRED)
|
||||
find_package(DevIL REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
|
||||
find_library(IRRKLANG_LIBRARY
|
||||
NAMES libIrrKlang.so
|
||||
PATHS "${SQCSIM_EXTERN_DIR}/irrKlang-64bit-1.6.0/lib/linux-gcc-64/")
|
||||
|
||||
include_directories(
|
||||
${SQCSIM_EXTERN_DIR}/irrKlang-64bit-1.6.0/include/
|
||||
${SFML_INCLUDE_DIRS}
|
||||
${IL_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
|
||||
add_library(SQCSim-common
|
||||
"${SQCSIM_COMMON_DIR}blockinfo.cpp"
|
||||
"${SQCSIM_COMMON_DIR}bullet.cpp"
|
||||
"${SQCSIM_COMMON_DIR}chunk.cpp"
|
||||
"${SQCSIM_COMMON_DIR}netprotocol.cpp"
|
||||
"${SQCSIM_COMMON_DIR}opensimplex.cpp"
|
||||
"${SQCSIM_COMMON_DIR}player.cpp"
|
||||
"${SQCSIM_COMMON_DIR}transformation.cpp"
|
||||
"${SQCSIM_COMMON_DIR}world.cpp"
|
||||
)
|
||||
|
||||
add_executable(SQCSim-client
|
||||
"../audio.cpp"
|
||||
"../connector.cpp"
|
||||
"../engine.cpp"
|
||||
"../mesh.cpp"
|
||||
"../openglcontext.cpp"
|
||||
"../shader.cpp"
|
||||
"../skybox.cpp"
|
||||
"../texture.cpp"
|
||||
"../textureatlas.cpp"
|
||||
"../tool.cpp"
|
||||
"../vertexbuffer.cpp"
|
||||
"../worldrenderer.cpp"
|
||||
"../main.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(SQCSim-client PUBLIC SQCSim-common
|
||||
${IRRKLANG_LIBRARY}
|
||||
sfml-system
|
||||
sfml-window
|
||||
sfml-graphics
|
||||
GL
|
||||
GLU
|
||||
GLEW
|
||||
${IL_LIBRARIES}
|
||||
${ILU_LIBRARIES}
|
||||
)
|
||||
|
@@ -6,34 +6,26 @@
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <GL/glew.h>
|
||||
#include <SFML/Window.hpp>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include "../SQCSim-common/define.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <GL/glew.h>
|
||||
#include <gl/GL.h>
|
||||
#include <gl/GLU.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <climits>
|
||||
#endif
|
||||
|
||||
#define NETWORK_TEST false
|
||||
#define SRV_ADDR "127.0.0.1"
|
||||
#define COUNTDOWN 300
|
||||
|
||||
#define BULLET_UPDATES_PER_FRAME 20
|
||||
|
||||
#define BASE_WIDTH 640
|
||||
#define BASE_HEIGHT 480
|
||||
|
||||
#define BASE_WIDTH 1600
|
||||
#define BASE_HEIGHT 900
|
||||
|
||||
#define TEXTURE_PATH "./media/textures/"
|
||||
#define SHADER_PATH "./media/shaders/"
|
||||
#define AUDIO_PATH "./media/audio/"
|
||||
#define CHUNK_PATH "./media/chunks/"
|
||||
#define MENU_ITEM_PATH "./media/menu_items/"
|
||||
|
||||
#endif // DEFINE_H__
|
||||
|
@@ -1 +0,0 @@
|
||||
|
@@ -5,8 +5,6 @@
|
||||
#include <thread>
|
||||
#include <queue>
|
||||
|
||||
|
||||
|
||||
// Define a structure to represent notifications
|
||||
struct Notification {
|
||||
std::string message;
|
||||
@@ -28,200 +26,6 @@ Engine::~Engine() {
|
||||
m_world.GetChunks().Get(x, y)->~Chunk();
|
||||
}
|
||||
|
||||
void Engine::DrawMenu()
|
||||
{
|
||||
static const int sTitle = 400;
|
||||
static const int sButton = 225;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(0, Width(), 0, Height(), -1, 1);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
||||
MenuBGTexture.Bind();
|
||||
glLoadIdentity();
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 0);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(800, 0);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(800, 600);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 600);
|
||||
glEnd();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
if (m_gamestate != GameState::OPTIONS)
|
||||
{
|
||||
MenuTitleTexture.Bind();
|
||||
glTranslated(200, 300, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 200);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sTitle, 200);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sTitle, 300);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 300);
|
||||
glEnd();
|
||||
|
||||
MenuStartTexture.Bind();
|
||||
glTranslated(80, -225, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 100);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sButton, 100);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sButton, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();
|
||||
|
||||
/*MenuResumeTexture.Bind();
|
||||
glTranslated(0, -100, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 125);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sButton, 125);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sButton, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();*/
|
||||
|
||||
/*MenuOptionsTexture.Bind();
|
||||
glTranslated(0, -100, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 125);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sButton, 125);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sButton, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();*/
|
||||
|
||||
MenuQuitTexture.Bind();
|
||||
glTranslated(0, -100, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 100);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sButton, 100);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sButton, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*MenuOptionsTexture.Bind();
|
||||
glTranslated(200, 0, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 0);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sTitle, 0);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sTitle, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();
|
||||
|
||||
WireFrameTexture.Bind();
|
||||
glTranslated(0, 300, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 125);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sButton, 125);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sButton, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();
|
||||
|
||||
OnOffBtnTexture.Bind();
|
||||
glTranslated(200, 0, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 125);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sButton, 125);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sButton, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();
|
||||
glTranslated(-400, -300, 0);
|
||||
|
||||
MusicTexture.Bind();
|
||||
glTranslated(200, 200, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 125);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sButton, 125);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sButton, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();
|
||||
|
||||
OnOffBtnTexture.Bind();
|
||||
glTranslated(200, 0, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 125);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sButton, 125);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sButton, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();
|
||||
|
||||
BackBtnTexture.Bind();
|
||||
glTranslated(-375, 175, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 140);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(sButton, 140);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(sButton, 200);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, 200);
|
||||
glEnd();*/
|
||||
}
|
||||
|
||||
//glEnable(GL_LIGHTING);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
ShowCursor();
|
||||
}
|
||||
|
||||
void Engine::Init() {
|
||||
GLenum glewErr = glewInit();
|
||||
if (glewErr != GLEW_OK) {
|
||||
@@ -247,7 +51,6 @@ void Engine::Init() {
|
||||
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);
|
||||
@@ -256,24 +59,22 @@ void Engine::Init() {
|
||||
//m_audio.ToggleMusicState();
|
||||
|
||||
// Array pour les balles.
|
||||
for (int x = 0; x < MAX_BULLETS; ++x) {
|
||||
for (int x = 0; x < MAX_BULLETS; ++x)
|
||||
m_bullets[x] = nullptr;
|
||||
m_whoosh[x] = nullptr; // = m_audio.m_engine.m_audio.m_engine->addSoundSourceFromFile(AUDIO_PATH "noise.ogg", irrklang::ESM_AUTO_DETECT, false);
|
||||
}
|
||||
|
||||
uint64_t seed = SEED;
|
||||
std::string playname = "La Chienne <20> Jacques";
|
||||
if (NETWORK_TEST) { // Test connexion r<>seau.
|
||||
std::string playname = "La Chienne <20> Jacques";
|
||||
if (NETWORK_TEST) { // Test connexion r<>seau.
|
||||
if (!m_conn.Init()) {
|
||||
if (!m_conn.Connect(SRV_ADDR, playname)) {
|
||||
// setup jeu en r<>seau.
|
||||
std::cout << "ID re<72>u du serveur: " << std::to_string(m_conn.getId()) << "!" << std::endl;
|
||||
std::cout << "Seed re<72>u du serveur: " << std::to_string(m_conn.getSeed()) << "!" << std::endl;
|
||||
// setup jeu en r<>seau.
|
||||
std::cout << "ID re<72>u du serveur: " << std::to_string(m_conn.getId()) << "!" << std::endl;
|
||||
std::cout << "Seed re<72>u du serveur: " << std::to_string(m_conn.getSeed()) << "!" << std::endl;
|
||||
seed = m_conn.getSeed();
|
||||
}
|
||||
else std::cout << "Erreur de connexion." << std::endl;
|
||||
}
|
||||
else std::cout << "Erreur de cr<63>ation de socket." << std::endl;
|
||||
else std::cout << "Erreur de cr<63>ation de socket." << std::endl;
|
||||
}
|
||||
|
||||
m_world.SetSeed(seed);
|
||||
@@ -281,8 +82,6 @@ void Engine::Init() {
|
||||
// Init Chunks
|
||||
m_world.GetChunks().Reset(nullptr);
|
||||
|
||||
|
||||
|
||||
// Gestion de souris.
|
||||
CenterMouse();
|
||||
HideCursor();
|
||||
@@ -294,13 +93,11 @@ void Engine::LoadResource() {
|
||||
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", true);
|
||||
LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false);
|
||||
LoadTexture(m_texturePovGun, TEXTURE_PATH "GUN.png", false);
|
||||
LoadTexture(m_textureSoloMultiMenu, TEXTURE_PATH "single_multi.png", false);
|
||||
LoadTexture(m_textureTitle, TEXTURE_PATH "title.png", false);
|
||||
|
||||
LoadTexture(MenuTitleTexture, MENU_ITEM_PATH "test.png");
|
||||
LoadTexture(MenuBGTexture, MENU_ITEM_PATH "test.png");
|
||||
LoadTexture(MenuQuitTexture, MENU_ITEM_PATH "BasicQuit.png");
|
||||
LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png");
|
||||
LoadTexture(MenuStartTexture, MENU_ITEM_PATH "BasicPlay.png");
|
||||
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");
|
||||
@@ -350,7 +147,6 @@ void Engine::KillNotification(Player killer, Player killed) {
|
||||
DisplayNotification(message);
|
||||
}
|
||||
|
||||
|
||||
void Engine::DisplayNotification(std::string message) {
|
||||
|
||||
if (message.length() > 45) {
|
||||
@@ -366,17 +162,22 @@ void Engine::DisplayNotification(std::string message) {
|
||||
|
||||
// Add a method to process the notification queue
|
||||
void Engine::ProcessNotificationQueue() {
|
||||
m_textureFont.Bind();
|
||||
float scale = GetScale();
|
||||
unsigned int xOffset = Width() - Width() * 0.26;
|
||||
unsigned int yOffset = Height() - (Height() / 2.2);
|
||||
//PrintText(fPosX, fUsernamePosY, ss.str(), 1.5f);
|
||||
//float fPosX = (Width() / 100.0f) * scaleX;
|
||||
//float fPosY = Height() - (Height() * 0.05) * scaleY;
|
||||
|
||||
m_textureFont.Bind();
|
||||
|
||||
auto [scaleX, scaleY] = GetScale();
|
||||
|
||||
float xOffset = (Width() / 1.5f) * scaleX;
|
||||
float yOffset = (Height() / 1.2f) * scaleY;
|
||||
|
||||
// Iterate through the notifications and display them
|
||||
for (auto it = notifications.begin(); it != notifications.end(); ) {
|
||||
float timeSinceDisplay = m_time - it->displayStartTime;
|
||||
|
||||
// Display the notification message with vertical offset
|
||||
unsigned int y = yOffset - (static_cast<unsigned int>(scale * 20) * (it - notifications.begin()));
|
||||
float y = yOffset - (20.0f * scaleX * (it - notifications.begin()));
|
||||
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
@@ -392,7 +193,7 @@ void Engine::ProcessNotificationQueue() {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
||||
PrintText(xOffset, y, scale, it->message);
|
||||
PrintText(xOffset, y, it->message);
|
||||
|
||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||
@@ -402,22 +203,18 @@ void Engine::ProcessNotificationQueue() {
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
// Check if it's time to remove the notification (display for 2 seconds)
|
||||
|
||||
if (timeSinceDisplay >= 4.0f) {
|
||||
it = notifications.erase(it); // Remove the notification
|
||||
it = notifications.erase(it);
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Engine::DisplayCrosshair() {
|
||||
m_textureCrosshair.Bind();
|
||||
static const int crossSize = 32;
|
||||
@@ -435,117 +232,288 @@ void Engine::DisplayCrosshair() {
|
||||
glEnd();
|
||||
}
|
||||
|
||||
void Engine::DisplayCurrentItem() {
|
||||
void Engine::DisplayPovGun() {
|
||||
// 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_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
|
||||
glLoadIdentity();
|
||||
glOrtho(0, Width(), 0, Height(), -1, 1);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
||||
float scaleX = (Width()) / BASE_WIDTH;
|
||||
float scaleY = (Height()) / BASE_HEIGHT;
|
||||
float baseXOffset = 0.4958 * BASE_WIDTH;
|
||||
float baseWidth = 0.4688 * BASE_WIDTH;
|
||||
float baseHeight = 0.5787 * BASE_HEIGHT;
|
||||
float xTranslation = baseXOffset * scaleX;
|
||||
float quadWidth = baseWidth * scaleX;
|
||||
float quadHeight = baseHeight * scaleY;
|
||||
|
||||
m_texturePovGun.Bind();
|
||||
glLoadIdentity();
|
||||
glTranslated(xTranslation, 0, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(0, 0);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(quadWidth, 0);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(quadWidth, quadHeight);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(0, quadHeight);
|
||||
glEnd();
|
||||
|
||||
// Reset du blend function
|
||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void Engine::DisplayCurrentItem() {
|
||||
}
|
||||
|
||||
void Engine::DisplayHud(int timer) {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glLoadIdentity();
|
||||
glDisable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
auto [scaleX, scaleY] = GetScale();
|
||||
|
||||
float fBackPosX = (Width() / 25.0f) * scaleX;
|
||||
float fBackPosY = (Height() - (Height() * 0.815) * scaleY);
|
||||
float fBackWidth = (Width() / 4.0f) * scaleX;
|
||||
float fBackHeight = (Height() / 5.5f) * scaleY;
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 0.2f);
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f(fBackPosX, fBackPosY);
|
||||
glVertex2f(fBackPosX + fBackWidth, fBackPosY);
|
||||
glVertex2f(fBackPosX + fBackWidth, fBackPosY + fBackHeight);
|
||||
glVertex2f(fBackPosX, fBackPosY + fBackHeight);
|
||||
glEnd();
|
||||
|
||||
// HP Bar
|
||||
float fBarWidth = (Width() / 4.0f) * scaleX;
|
||||
float fBarHeight = (Height() / 25.0f) * scaleY;
|
||||
float fPosX = (Width() / 25.0f) * scaleX;
|
||||
float fBarPosY = (Height() - (Height() * 0.775) * scaleY);
|
||||
|
||||
// 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<EFBFBD>re-plan (Barre HP)
|
||||
// HP Bar Background
|
||||
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
|
||||
glVertex2f(fPosX, fBarPosY - fBarHeight);
|
||||
glVertex2f(fPosX + fBarWidth, fBarPosY - fBarHeight);
|
||||
glVertex2f(fPosX + fBarWidth, fBarPosY);
|
||||
glVertex2f(fPosX, fBarPosY);
|
||||
glEnd();
|
||||
|
||||
//TODO: Associer avec m<>chanique de vie du joueur
|
||||
|
||||
// Barre HP
|
||||
// Current 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
|
||||
glVertex2f(fPosX, fBarPosY - fBarHeight);
|
||||
glVertex2f(fPosX + fBarWidth * playerHp, fBarPosY - fBarHeight);
|
||||
glVertex2f(fPosX + fBarWidth * playerHp, fBarPosY);
|
||||
glVertex2f(fPosX, fBarPosY);
|
||||
glEnd();
|
||||
|
||||
// Barre <20>quip
|
||||
// Equip Bar
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor3f(1.0f * facteurOmbrage, 1.0f * facteurOmbrage, 1.0f * facteurOmbrage);
|
||||
|
||||
float fEquipWidth = (Width() * 0.175f) * scaleX;
|
||||
float fEquipHeight = (fEquipWidth / 2.5) * scaleY;
|
||||
float fEquipPosY = (Height() - (Height() * 0.765) * scaleY);
|
||||
|
||||
glTranslatef(fPosX, fEquipPosY, 0);
|
||||
|
||||
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);
|
||||
glTexCoord2f(0, 0); glVertex2i(0, 0);
|
||||
glTexCoord2f(1, 0); glVertex2i(fEquipWidth, 0);
|
||||
glTexCoord2f(1, 1); glVertex2i(fEquipWidth, fEquipHeight);
|
||||
glTexCoord2f(0, 1); glVertex2i(0, fEquipHeight);
|
||||
glEnd();
|
||||
|
||||
//glDisable(GL_BLEND);
|
||||
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;
|
||||
float fUsernamePosY = fBarPosY - (fBarHeight * 2) * scaleY;
|
||||
|
||||
ss.str("");
|
||||
ss << m_player.GetUsername();
|
||||
PrintText(fPosX, fPosY, scale, ss.str());
|
||||
PrintText(fPosX, fUsernamePosY, ss.str(), 1.5f);
|
||||
|
||||
ss.str("");
|
||||
ss << m_player.GetHP() * 100 << "%";
|
||||
PrintText(fPosX * 6.25, fUsernamePosY, ss.str(), 1.5f);
|
||||
|
||||
// Countdown
|
||||
ss.str("");
|
||||
ss << "Time: " << (int)(timer / 60) << ":" << std::setw(2) << std::setfill('0') << timer % 60;
|
||||
PrintText(Width() - Width() * 0.15, Height() - (Height() / 19.2), scale, ss.str());
|
||||
|
||||
PrintText(Width() - (Width() * 0.2f) * scaleX, Height() - (Height() * 0.1) * scaleY, ss.str(), 2.0f);
|
||||
}
|
||||
|
||||
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;
|
||||
auto [scaleX, scaleY] = GetScale();
|
||||
|
||||
float fPosX = (Width() / 100.0f) * scaleX;
|
||||
float fPosY = Height() - (Height() * 0.05) * scaleY;
|
||||
float charSize = 20 + (24 - 20) * (Width() - 1600) / (1920 - 1600);
|
||||
|
||||
ss << " Fps : " << GetFps(elapsedTime);
|
||||
PrintText(x, Height() - (Height() / 19.2), scale, ss.str());
|
||||
PrintText(fPosX, fPosY, ss.str());
|
||||
ss.str("");
|
||||
fPosY -= charSize;
|
||||
|
||||
ss << " Rendered Chunks : " << m_renderCount;
|
||||
PrintText(x, Height() - (Height() / 13.7), scale, ss.str());
|
||||
PrintText(fPosX, fPosY, ss.str());
|
||||
ss.str("");
|
||||
fPosY -= charSize;
|
||||
|
||||
ss << " To-Be-Deleted Chunks : " << m_world.GettbDeleted();
|
||||
PrintText(x, Height() - (Height() / 10.7), scale, ss.str());
|
||||
PrintText(fPosX, fPosY, ss.str());
|
||||
ss.str("");
|
||||
ss << " Velocity : " << m_player.GetVelocity(); // IMPORTANT : on utilise l <20> operateur << pour afficher la position
|
||||
PrintText(x, Height() / 48, scale, ss.str());
|
||||
fPosY -= charSize;
|
||||
|
||||
float fPosYJump = ((Height() - (Height() * 0.9f)) * scaleY);
|
||||
fPosY = fPosYJump;
|
||||
fPosY -= charSize;
|
||||
|
||||
ss << " Velocity : " << m_player.GetVelocity();
|
||||
PrintText(fPosX, fPosY, ss.str());
|
||||
ss.str("");
|
||||
fPosY -= charSize;
|
||||
|
||||
ss << " Direction : " << m_player.GetDirection();
|
||||
PrintText(x, Height() / 24, scale, ss.str());
|
||||
PrintText(fPosX, fPosY, ss.str());
|
||||
ss.str("");
|
||||
fPosY -= charSize;
|
||||
|
||||
ss << " Position : " << m_player.GetPosition();
|
||||
PrintText(x, Height() / 16, scale, ss.str());
|
||||
PrintText(fPosX, fPosY, ss.str());
|
||||
ss.str("");
|
||||
fPosY -= charSize;
|
||||
|
||||
ss << " Block : ";
|
||||
|
||||
if (bloc == BTYPE_LAST)
|
||||
ss << "Weapon.";
|
||||
else ss << (int)bloc;
|
||||
ss << "Weapon";
|
||||
else
|
||||
ss << (int)bloc;
|
||||
PrintText(fPosX, fPosYJump, ss.str());
|
||||
}
|
||||
|
||||
PrintText(x, Height() / 12, scale, ss.str());
|
||||
void Engine::DisplaySingleOrMultiplayerMenu() {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
|
||||
glLoadIdentity();
|
||||
glOrtho(0, Width(), 0, Height(), -1, 1);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
||||
auto [scaleX, scaleY] = GetScale();
|
||||
float fBackPosX = 0.0f;
|
||||
float fBackPosY = 0.0f;
|
||||
float fBackWidth = Width();
|
||||
float fBackHeight = Height();
|
||||
|
||||
m_textureSoloMultiMenu.Bind();
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex2f(fBackPosX, fBackPosY);
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex2f(fBackWidth, fBackPosY);
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex2f(fBackWidth, fBackHeight);
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(fBackPosX, fBackHeight);
|
||||
glEnd();
|
||||
|
||||
float centerX = (Width() / 2.0f);
|
||||
float centerY = (Height() / 2.0f);
|
||||
float titleWidth = (centerX * 1.85f) * scaleX;
|
||||
float titleHeight = (centerY * 1.85f) * scaleY;
|
||||
|
||||
// Solo game indicator
|
||||
m_textureTitle.Bind();
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX, centerY);
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex2f(titleWidth, centerY);
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex2f(titleWidth, titleHeight);
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(centerX, titleHeight);
|
||||
glEnd();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
// Solo game indicator
|
||||
float fPosX = (centerX * 1.1f) * scaleX;
|
||||
float fPosXWidth = (centerX * 1.75f) * scaleX;
|
||||
float soloPosY = (centerY * 0.75f) * scaleY;
|
||||
float soloHeight = (centerY * 0.9f) * scaleY;
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex2f(fPosX, soloPosY);
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex2f(fPosXWidth, soloPosY);
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex2f(fPosXWidth, soloHeight);
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosX, soloHeight);
|
||||
glEnd();
|
||||
|
||||
// Multiplayer game indicator
|
||||
float multiPosY = (centerY * 0.5f) * scaleY;
|
||||
float multiHeight = (centerY * 0.65f) * scaleY;
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex2f(fPosX, multiPosY);
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex2f(fPosXWidth, multiPosY);
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex2f(fPosXWidth, multiHeight);
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosX, multiHeight);
|
||||
glEnd();
|
||||
|
||||
// TODO: Add SOLO / MULTIPLAYER text with font
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
||||
@@ -555,7 +523,6 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
@@ -568,7 +535,6 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
||||
|
||||
int timer = GetCountdown(elapsedTime);
|
||||
|
||||
// Appel de la fonction pour l'affichage de notifications
|
||||
if (m_keyK) {
|
||||
SystemNotification(m_messageNotification);
|
||||
m_keyK = false;
|
||||
@@ -591,7 +557,6 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
||||
DisplayCrosshair();
|
||||
}
|
||||
|
||||
// Reset du blend function
|
||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||
|
||||
@@ -605,31 +570,36 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void Engine::PrintText(float x, float y, float scale, const std::string& t) {
|
||||
void Engine::PrintText(float x, float y, const std::string& t, float charSizeMultiplier) {
|
||||
auto [scaleX, scaleY] = GetScale();
|
||||
float scale = std::min(scaleX, scaleY);
|
||||
|
||||
float baseCharSize = 20 + (24 - 20) * (Width() - 1600) / (1920 - 1600);
|
||||
float charSize = baseCharSize * charSizeMultiplier;
|
||||
|
||||
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;
|
||||
top += 0.5f;
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
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);
|
||||
glTexCoord2f(left + .0625f, 1.f - top - .0625f); glVertex2f(charSize * scale, 0);
|
||||
glTexCoord2f(left + .0625f, 1.f - top); glVertex2f(charSize * scale, charSize * scale);
|
||||
glTexCoord2f(left, 1.f - top); glVertex2f(0, charSize * scale);
|
||||
glEnd();
|
||||
|
||||
glTranslated(8 * scale, 0, 0);
|
||||
glTranslated(0.5555f * charSize * scale, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
float Engine::GetScale() const {
|
||||
float widthRatio = Width() / BASE_WIDTH;
|
||||
float heightRatio = Height() / BASE_HEIGHT;
|
||||
|
||||
return (widthRatio + heightRatio) / 2.0f;
|
||||
std::pair<float, float> Engine::GetScale() const {
|
||||
float widthRatio = static_cast<float>(Width()) / BASE_WIDTH;
|
||||
float heightRatio = static_cast<float>(Height()) / BASE_HEIGHT;
|
||||
return { widthRatio, heightRatio };
|
||||
}
|
||||
|
||||
int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; }
|
||||
@@ -647,13 +617,6 @@ int Engine::GetCountdown(float elapsedTime) {
|
||||
}
|
||||
|
||||
void Engine::Render(float elapsedTime) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
if (m_gamestate == GameState::PLAY)
|
||||
{
|
||||
HideCursor();
|
||||
CenterMouse(); //D<>placement de centermouse dans l'action de jouer
|
||||
|
||||
//static float gameTime = elapsedTime;
|
||||
static irrklang::ISound* step; // Pour les sons de pas.
|
||||
static float pollTime = 0;
|
||||
@@ -668,6 +631,7 @@ void Engine::Render(float elapsedTime) {
|
||||
Transformation all;
|
||||
Transformation skybox;
|
||||
Vector3f vstep;
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
// Transformations initiales
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
@@ -692,8 +656,8 @@ void Engine::Render(float elapsedTime) {
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
m_audio.Update3DAudio(m_player.GetPOV(), m_player.GetDirection(), m_player.GetVelocity()); // Ajustement du positionnement 3D avec les coordonn<6E>es du joueur et
|
||||
// son vecteur de v<>locit<69> (pour l'effet Doppler)
|
||||
m_audio.Update3DAudio(m_player.GetPOV(), m_player.GetDirection(), m_player.GetVelocity()); // Ajustement du positionnement 3D avec les coordonn<6E>es du joueur et
|
||||
// son vecteur de v<>locit<69> (pour l'effet Doppler)
|
||||
pollTime = 0;
|
||||
}
|
||||
|
||||
@@ -705,7 +669,7 @@ void Engine::Render(float elapsedTime) {
|
||||
if (m_mouseWU) bloc++;
|
||||
else if (m_mouseWD) bloc--;
|
||||
if (bloc == BTYPE_LAST + 1) bloc = BTYPE_AIR + 1;
|
||||
else if (bloc == BTYPE_AIR) bloc = BTYPE_LAST; // La selection de BTYPE_LAST <20>quipe l'arme.
|
||||
else if (bloc == BTYPE_AIR) bloc = BTYPE_LAST; // La selection de BTYPE_LAST <20>quipe l'arme.
|
||||
m_mouseWU = m_mouseWD = false;
|
||||
|
||||
if (m_mouseL) {
|
||||
@@ -717,31 +681,28 @@ void Engine::Render(float elapsedTime) {
|
||||
m_bullets[x] = new Bullet(m_player.GetPOV() + m_player.GetDirection(), m_player.GetDirection());
|
||||
break;
|
||||
}
|
||||
else if (x == MAX_BULLETS - 1) { // S'il y a pas d'espace dans l'array, prendre la place de la premi<6D>re balle de l'array.
|
||||
else if (x == MAX_BULLETS - 1) { // S'il y a pas d'espace dans l'array, prendre la place de la premi<6D>re balle de l'array.
|
||||
m_bullets[0]->~Bullet();
|
||||
m_bullets[0] = new Bullet(m_player.GetPOV() + m_player.GetDirection(), m_player.GetDirection());
|
||||
}
|
||||
bulletTime = .1f;
|
||||
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);
|
||||
glClearColor(0.f, 0.f, 0.f, 1.f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_mouseR)
|
||||
m_world.ChangeBlockAtCursor(BTYPE_AIR, m_player.GetPosition(), m_player.GetDirection(), m_block);
|
||||
|
||||
for (int x = 0; x < MAX_BULLETS; ++x) { // Array de bullets en jeu.
|
||||
if (m_bullets[x]) {
|
||||
for (int b = 0; b < BULLET_UPDATES_PER_FRAME; ++b)
|
||||
if (m_bullets[x]->Update(&m_world, elapsedTime, BULLET_UPDATES_PER_FRAME)) {
|
||||
for (int x = 0; x < MAX_BULLETS; ++x) // Array de bullets en jeu.
|
||||
if (m_bullets[x])
|
||||
if (m_bullets[x]->Update(&m_world, elapsedTime)) {
|
||||
m_bullets[x]->~Bullet();
|
||||
if (m_whoosh[x])
|
||||
m_whoosh[x]->drop();
|
||||
m_bullets[x] = nullptr;
|
||||
m_whoosh[x] = nullptr;
|
||||
break;
|
||||
}
|
||||
else if (!m_whoosh[x]) {
|
||||
m_whoosh[x] = m_audio.Create3DAudioObj(m_whoosh[x], AUDIO_PATH "noise.wav", m_bullets[x]->getPos(), m_bullets[x]->getVel(), true, (m_bullets[x]->getPos() - m_player.GetPosition()).Length());
|
||||
}
|
||||
else m_audio.Render3DAudioObj(m_whoosh[x], m_bullets[x]->getPos(), m_bullets[x]->getVel(), 5 - (m_bullets[x]->getPos() - m_player.GetPosition()).Length());
|
||||
}
|
||||
}
|
||||
|
||||
m_wrenderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
|
||||
@@ -750,8 +711,14 @@ void Engine::Render(float elapsedTime) {
|
||||
|
||||
if (m_isSkybox) m_skybox.Render(skybox);
|
||||
|
||||
ProcessNotificationQueue();
|
||||
|
||||
DrawHud(elapsedTime, bloc);
|
||||
DisplayPovGun();
|
||||
ProcessNotificationQueue();
|
||||
|
||||
/*if (m_soloMultiChoiceMade) {
|
||||
DisplaySingleOrMultiplayerMenu();
|
||||
}*/
|
||||
|
||||
static bool fell = false;
|
||||
if (m_player.GetPosition().y < 1.7f && !fell) {
|
||||
@@ -762,14 +729,6 @@ void Engine::Render(float elapsedTime) {
|
||||
m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f)); // Respawn si le bonho- joueur tombe en bas du monde.
|
||||
fell = false;
|
||||
}
|
||||
|
||||
}
|
||||
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
||||
{
|
||||
DrawMenu();
|
||||
}
|
||||
else if (m_gamestate == GameState::QUIT)
|
||||
Stop();
|
||||
}
|
||||
|
||||
void Engine::KeyPressEvent(unsigned char key) {
|
||||
@@ -795,15 +754,14 @@ void Engine::KeyPressEvent(unsigned char key) {
|
||||
}
|
||||
break;
|
||||
case 36: // ESC - Quitter
|
||||
m_gamestate = GameState::MAIN_MENU;
|
||||
//Stop();
|
||||
Stop();
|
||||
break;
|
||||
case 57: // Space - Sauter
|
||||
if (!m_keySpace) {
|
||||
m_keySpace = true;
|
||||
}
|
||||
break;
|
||||
case 94: // F10 - Plein <20>cran
|
||||
case 94: // F10 - Plein <20>cran
|
||||
IsFullscreen() ? SetFullscreen(false) : SetFullscreen(true);
|
||||
//SetFullscreen(!IsFullscreen());
|
||||
break;
|
||||
@@ -813,7 +771,7 @@ void Engine::KeyPressEvent(unsigned char key) {
|
||||
break;
|
||||
case 10: // K - Debugging DisplayNotification()
|
||||
m_keyK = true;
|
||||
m_messageNotification = "notifications systeme peuvent <20>tre affich<63>";
|
||||
m_messageNotification = "notifications systeme peuvent <20>tre affich<63>";
|
||||
break;
|
||||
case 11: // L - Debugging DisplayNotification()
|
||||
m_keyL = true;
|
||||
@@ -826,8 +784,6 @@ void Engine::KeyPressEvent(unsigned char key) {
|
||||
break;
|
||||
case 8: // I - Ignorer
|
||||
break;
|
||||
case 15: // P - Ignorer
|
||||
break;
|
||||
case 17: // R - Ignorer
|
||||
break;
|
||||
case 19: // T - Ignorer
|
||||
@@ -877,17 +833,6 @@ void Engine::KeyReleaseEvent(unsigned char key) {
|
||||
case 12: // M - Toggle music
|
||||
m_audio.ToggleMusicState();
|
||||
break;
|
||||
case 15:
|
||||
for (int x = 0; x < MAX_BULLETS; ++x) // Ajouter une balle dans l'array (aussi connu sous le nom de "faire pow pow").
|
||||
if (!m_bullets[x]) {
|
||||
m_bullets[x] = new Bullet(m_player.GetPOV() - Vector3f(1.f, 0.f, 1.f), Vector3f(1.f,0.f,1.f));
|
||||
break;
|
||||
}
|
||||
else if (x == MAX_BULLETS - 1) { // S'il y a pas d'espace dans l'array, prendre la place de la premi<6D>re balle de l'array.
|
||||
m_bullets[0]->~Bullet();
|
||||
m_bullets[0] = new Bullet(m_player.GetPOV() - Vector3f(1.f, 0.f, 1.f), Vector3f(1.f, 0.f, 1.f));
|
||||
}
|
||||
break;
|
||||
case 17: // R - Toggle skybox
|
||||
m_isSkybox = !m_isSkybox;
|
||||
break;
|
||||
@@ -918,22 +863,18 @@ void Engine::MouseMoveEvent(int x, int y) {
|
||||
m_player.TurnLeftRight(x - (Width() / 2));
|
||||
m_player.TurnTopBottom(y - (Height() / 2));
|
||||
|
||||
// Centrer la souris seulement si elle n'est pas d<>j<EFBFBD> centr<74>e
|
||||
// Il est n<>cessaire de faire la v<>rification pour <20>viter de tomber
|
||||
// dans une boucle infinie o<> l'appel <20> CenterMouse g<>n<EFBFBD>re un
|
||||
// Centrer la souris seulement si elle n'est pas d<>j<EFBFBD> centr<74>e
|
||||
// Il est n<>cessaire de faire la v<>rification pour <20>viter de tomber
|
||||
// dans une boucle infinie o<> l'appel <20> CenterMouse g<>n<EFBFBD>re un
|
||||
// MouseMoveEvent, qui rapelle CenterMouse qui rapelle un autre
|
||||
// MouseMoveEvent, etc
|
||||
if (x == (Width() / 2) && y == (Height() / 2))
|
||||
return;
|
||||
|
||||
CenterMouse();
|
||||
}
|
||||
|
||||
void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
m_mousemx = x;
|
||||
m_mousemy = y;
|
||||
|
||||
if (m_gamestate == GameState::PLAY)
|
||||
{
|
||||
switch (button) {
|
||||
case MOUSE_BUTTON_LEFT:
|
||||
m_mouseL = true;
|
||||
@@ -953,14 +894,6 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
case MOUSE_BUTTON_NONE: break;
|
||||
}
|
||||
}
|
||||
else if (m_gamestate == GameState::MAIN_MENU)
|
||||
{
|
||||
if ((m_mousemx >= 285 && m_mousemx <= 490) && (m_mousemy >= 150 && m_mousemy <= 250))
|
||||
m_gamestate = GameState::PLAY;
|
||||
if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400))
|
||||
m_gamestate = GameState::QUIT;
|
||||
}
|
||||
}
|
||||
|
||||
void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
switch (button) {
|
||||
|
@@ -24,7 +24,6 @@ class Engine : public OpenglContext {
|
||||
public:
|
||||
Engine();
|
||||
virtual ~Engine();
|
||||
virtual void DrawMenu();
|
||||
virtual void Init();
|
||||
virtual void DeInit();
|
||||
virtual void LoadResource();
|
||||
@@ -37,7 +36,7 @@ public:
|
||||
virtual void MouseReleaseEvent(const MOUSE_BUTTON &button, int x, int y);
|
||||
|
||||
private:
|
||||
float GetScale() const;
|
||||
std::pair<float, float> GetScale() const;
|
||||
|
||||
int GetFps(float elapsedTime) const;
|
||||
int GetCountdown(float elapsedTime);
|
||||
@@ -49,11 +48,13 @@ private:
|
||||
void DisplayNotification(std::string message);
|
||||
void ProcessNotificationQueue();
|
||||
void DisplayCrosshair();
|
||||
void DisplayPovGun();
|
||||
void DisplayCurrentItem();
|
||||
void DisplayHud(int timer);
|
||||
void DisplayInfo(float elapsedTime, BlockType bloc);
|
||||
void DisplaySingleOrMultiplayerMenu();
|
||||
void DrawHud(float elapsedTime, BlockType bloc);
|
||||
void PrintText(float x, float y, float scale, const std::string& t);
|
||||
void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f);
|
||||
|
||||
Connector m_conn;
|
||||
Shader m_shader01;
|
||||
@@ -63,31 +64,24 @@ private:
|
||||
World m_world = World();
|
||||
WorldRenderer m_wrenderer = WorldRenderer();
|
||||
|
||||
Texture m_textureSkybox;
|
||||
Texture m_textureFont;
|
||||
Texture m_textureCrosshair;
|
||||
Texture m_textureFont;
|
||||
Texture m_textureGun;
|
||||
Texture m_texturePovGun;
|
||||
Texture m_textureSkybox;
|
||||
Texture m_textureSoloMultiMenu;
|
||||
Texture m_textureTitle;
|
||||
|
||||
Skybox m_skybox;
|
||||
Audio m_audio = Audio(AUDIO_PATH "start.wav");
|
||||
|
||||
irrklang::ISound* m_powpow,
|
||||
* m_scream;
|
||||
irrklang::ISound *m_whoosh[MAX_BULLETS];
|
||||
irrklang::ISound* m_powpow;
|
||||
irrklang::ISound* m_scream;
|
||||
|
||||
Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f));
|
||||
|
||||
Bullet* m_bullets[MAX_BULLETS];
|
||||
|
||||
//Menu
|
||||
enum class GameState { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY };
|
||||
GameState m_gamestate = GameState::MAIN_MENU;
|
||||
Texture MenuTitleTexture;
|
||||
Texture MenuBGTexture;
|
||||
Texture MenuStartTexture;
|
||||
Texture MenuQuitTexture;
|
||||
Texture MenuOptionsTexture;
|
||||
|
||||
float m_scale;
|
||||
float m_time = 0;
|
||||
|
||||
@@ -102,6 +96,7 @@ private:
|
||||
bool m_displayHud = true;
|
||||
bool m_displayInfo = false;
|
||||
bool m_resetcountdown = false;
|
||||
bool m_soloMultiChoiceMade = true;
|
||||
bool m_stopcountdown = false;
|
||||
|
||||
bool m_keyK = false;
|
||||
@@ -116,9 +111,6 @@ private:
|
||||
bool m_mouseC = false;
|
||||
bool m_mouseWU = false;
|
||||
bool m_mouseWD = false;
|
||||
//Pour trouver ou est la souris
|
||||
float m_mousemx = 0;
|
||||
float m_mousemy = 0;
|
||||
|
||||
std::string m_messageNotification = "";
|
||||
};
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 289 KiB |
@@ -7,7 +7,7 @@ void main()
|
||||
texel = texture2D(tex,gl_TexCoord[0].st);
|
||||
|
||||
texel *= light;
|
||||
texel.a = 255.;
|
||||
texel.a = 255;
|
||||
gl_FragColor = texel;
|
||||
|
||||
}
|
||||
|
BIN
SQCSim2021/media/textures/single_multi.png
Normal file
BIN
SQCSim2021/media/textures/single_multi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
BIN
SQCSim2021/media/textures/skybox2.png
Normal file
BIN
SQCSim2021/media/textures/skybox2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 MiB |
BIN
SQCSim2021/media/textures/title.png
Normal file
BIN
SQCSim2021/media/textures/title.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
@@ -8,30 +8,30 @@ void Skybox::Init(float size){
|
||||
int count = 0;
|
||||
VertexBuffer::VertexData* vd = new VertexBuffer::VertexData[24];
|
||||
|
||||
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 0.f, .5f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 0.f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 0.f, .5f);
|
||||
|
||||
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);
|
||||
|
||||
vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);
|
||||
|
||||
vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 1.f, .5f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 1.f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);
|
||||
|
||||
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .25f, 1.f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, .5f, 1.f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .5f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .25f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, .25f, 1.f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .5f, 1.f);
|
||||
|
||||
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .5f, .25f);
|
||||
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, .75f, .25f);
|
||||
|
@@ -211,4 +211,3 @@ void WorldRenderer::UpdateWorld(World* origin, const Vector3f& player, BlockInfo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user