Merge pull request #5 from CegepSTH/sqc7_server

Sqc7 server
This commit is contained in:
Frederic Leger
2023-09-25 16:15:40 -04:00
committed by GitHub
31 changed files with 5099 additions and 60 deletions

View File

@@ -112,8 +112,8 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>external\irrKlang-1.6.0\include;external\glew170\include;external\devil178\include;external\sfml23\include;$(IncludePath)</IncludePath>
<LibraryPath>external\glew170\lib;external\devil178\lib;external\sfml23\lib;$(LibraryPath);external\irrKlang-1.6.0\lib\Win32-visualStudio</LibraryPath>
<IncludePath>external\irrKlang-1.6.0\include;external\glew210\include;external\devil178\include;external\sfml251\include;$(IncludePath)</IncludePath>
<LibraryPath>external\glew210\lib;external\sfml251\lib;external\devil178\lib;external\irrKlang-1.6.0\lib\Win32-visualStudio;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
@@ -122,8 +122,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>external\irrKlang-1.6.0\include;external\sfml23\include;external\devil178\include;external\glew170\include;$(IncludePath)</IncludePath>
<LibraryPath>external\sfml23\lib;external\devil178\lib;external\glew170\lib;$(LibraryPath);external\irrKlang-1.6.0\lib\Win32-visualStudio</LibraryPath>
<IncludePath>external\devil180\include;external\irrKlang-1.6.0\include;external\sfml251\include;external\glew210\include;$(IncludePath)</IncludePath>
<LibraryPath>external\sfml251\lib;external\devil180\lib\x86\Release;external\glew210\lib\Release\Win32;$(LibraryPath);external\irrKlang-1.6.0\lib\Win32-visualStudio</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>

View File

@@ -13,59 +13,33 @@
#include <gl/GLU.h>
#endif
#define CHUNK_SIZE_X 16
#define CHUNK_SIZE_Y 128
#define CHUNK_SIZE_Z 16
#define CHUNK_SIZE_X 4
#define CHUNK_SIZE_Y 64
#define CHUNK_SIZE_Z 4
#define MAX_SELECTION_DISTANCE 5
#define SEED 12345
#ifdef _DEBUG
#define WORLD_SIZE_X 64
#define WORLD_SIZE_Y 64
#define FRAMES_RENDER_CHUNKS 4
#define FRAMES_UPDATE_CHUNKS 4
#define FRAMES_DELETE_CHUNKS 4
#define THREADS_GENERATE_CHUNKS 1
#define THREADS_UPDATE_CHUNKS 1
#define THREADS_DELETE_CHUNKS 1
#define VIEW_DISTANCE 256
#define TEXTURE_SIZE 128
#define MAX_BULLETS 64
#define COUNTDOWN 300
#define BASE_WIDTH 640
#define BASE_HEIGHT 480
#endif
#define SEED 12345
#ifdef NDEBUG
#define WORLD_SIZE_X 16
#define WORLD_SIZE_Y 16
#define WORLD_SIZE_X 64
#define WORLD_SIZE_Y 64
#define FRAMES_RENDER_CHUNKS 1
#define FRAMES_UPDATE_CHUNKS 1
#define FRAMES_DELETE_CHUNKS 1
#define THREADS_GENERATE_CHUNKS 12
#define THREADS_UPDATE_CHUNKS 5
#define THREADS_DELETE_CHUNKS 2
#define THREADS_GENERATE_CHUNKS 8
#define THREADS_UPDATE_CHUNKS 3
#define THREADS_DELETE_CHUNKS 3
#define VIEW_DISTANCE 1024
#define VIEW_DISTANCE 512
#define TEXTURE_SIZE 512
#define MAX_BULLETS 512
#endif
typedef uint8_t BlockType;
enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_LAST };
//#define TEXTURE_PATH "../SQCSim2021/media/textures/"
//#define SHADER_PATH "../SQCSim2021/media/shaders/"
//#define AUDIO_PATH "../SQCSim2021/media/audio/"
//#define CHUNK_PATH "../SQCSim2021/media/chunks/"
#define TEXTURE_PATH "./media/textures/"
#define SHADER_PATH "./media/shaders/"
#define AUDIO_PATH "./media/audio/"

View File

@@ -223,7 +223,7 @@ void World::RenderWorld(int& rendercount, Player& player, Transformation& world,
direct.Normalize();
pos.y = 1;
static Vector3<unsigned int> renderManifest[VIEW_DISTANCE * 4]; // Nombre de Chunks maximal <20> <20>tre rendus.
static Vector3<unsigned int> renderManifest[VIEW_DISTANCE * 8]; // Nombre de Chunks maximal <20> <20>tre rendus.
//for (int dist = VIEW_DISTANCE; dist >= 0; dist -= CHUNK_SIZE_X) {
for (int dist = 0; dist <= VIEW_DISTANCE; dist += CHUNK_SIZE_X) {
@@ -231,26 +231,26 @@ void World::RenderWorld(int& rendercount, Player& player, Transformation& world,
float sinus, cosinus;
int echantillons;
if (dist > VIEW_DISTANCE * .5f) {
if (dist > VIEW_DISTANCE * .1f) {
sinus = .00872653549f; // sin(1/2 degr<67>)
cosinus = .99996192306; // cos(1/2 degr<67>)
echantillons = 180;
}
else if (dist > VIEW_DISTANCE * .4f) {
sinus = .01151891831f; // sin(2/3 degr<67>)
cosinus = .99993365506; // cos(2/3 degr<67>)
echantillons = 120;
}
else if (dist > VIEW_DISTANCE * .3f) {
sinus = .01745240643; // sin(1 degr<67>)
cosinus = .99984769515; // cos(1 degr<67>)
echantillons = 90;
}
else if (dist > VIEW_DISTANCE * .2f) {
sinus = .0261769483;
cosinus = .99965732497;
echantillons = 60;
}
//else if (dist > VIEW_DISTANCE * .3f) {
// sinus = .01151891831f; // sin(2/3 degr<67>)
// cosinus = .99993365506; // cos(2/3 degr<67>)
// echantillons = 120;
//}
//else if (dist > VIEW_DISTANCE * .2f) {
// sinus = .01745240643; // sin(1 degr<67>)
// cosinus = .99984769515; // cos(1 degr<67>)
// echantillons = 90;
//}
//else if (dist > VIEW_DISTANCE * .1f) {
// sinus = .0261769483;
// cosinus = .99965732497;
// echantillons = 60;
//}
else {
sinus = .0348994967;
cosinus = .99939082701;
@@ -293,7 +293,7 @@ void World::RenderWorld(int& rendercount, Player& player, Transformation& world,
world.ApplyTranslation(chx, 0, chy);
world.Use();
float blcolor = renderManifest[index].y / (VIEW_DISTANCE * 1000.f);
float blcolor = renderManifest[index].y / (VIEW_DISTANCE / 50.f);
glBlendColor(blcolor, blcolor, blcolor, 1.f);
ChunkAt(chx, 1, chy)->Render();
world.ApplyTranslation(-chx, 0, -chy);