diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index f683569..7eac763 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -211,7 +211,7 @@ void Engine::Render(float elapsedTime) { // (donc l'objet ne bouge pas relativement au joueur, ce qui est pratique pour une skybox!). glDisable(GL_LIGHT0); - //m_skybox.Render(skybox); + if (m_isSkybox) m_skybox.Render(skybox); glEnable(GL_LIGHT0); if (m_mouseL) @@ -317,7 +317,7 @@ void Engine::Render(float elapsedTime) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); if (m_player.GetPosition().y < -20.f) - m_player = Player(Vector3f(CHUNK_SIZE_X * WORLD_SIZE_X / 2, CHUNK_SIZE_Y + 1.8f, CHUNK_SIZE_Z * WORLD_SIZE_X / 2)); // Respawn si le bonho- joueur tombe en bas du monde. + m_player = Player(Vector3f(0, CHUNK_SIZE_Y + 1.8f, 0)); // Respawn si le bonho- joueur tombe en bas du monde. } void Engine::KeyPressEvent(unsigned char key) @@ -387,7 +387,7 @@ void Engine::KeyReleaseEvent(unsigned char key) m_audio.ToggleMusicState(); break; case 17: - m_renderer = !m_renderer; + m_isSkybox = !m_isSkybox; break; case 24: // Y m_wireframe = !m_wireframe; diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index 8b90aa0..6c75b8b 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -41,7 +41,7 @@ private: void ChangeBlockAtCursor(BlockType blocktype); bool m_wireframe = false; - bool m_renderer = false; + bool m_isSkybox = true; int m_renderCount = 0; int m_badHitCount = 0; @@ -62,7 +62,7 @@ private: Shader m_shader01; Audio m_audio = Audio(AUDIO_PATH "music01.wav"); - Player m_player = Player(Vector3f(CHUNK_SIZE_X * WORLD_SIZE_X / 2, CHUNK_SIZE_Y + 1.8f, CHUNK_SIZE_Z * WORLD_SIZE_X / 2)); + Player m_player = Player(Vector3f(0, CHUNK_SIZE_Y + 1.8f, 0)); bool m_keyW = false; bool m_keyA = false; @@ -79,10 +79,5 @@ private: bool m_block = false; }; -template -static bool EqualWithEpsilon(const T& v1, const T& v2, T epsilon = T(0.0001)) { return (fabs(v2 - v1) < epsilon); } - -template -static bool InRangeWithEpsilon(const T& v, const T& vinf, const T& vsup, T epsilon = T(0.0001)) { return (v >= vinf - epsilon && v <= vsup + epsilon); } #endif // ENGINE_H__ diff --git a/SQCSim2021/media/chunks/0_0.chunk b/SQCSim2021/media/chunks/0_0.chunk new file mode 100644 index 0000000..081655e Binary files /dev/null and b/SQCSim2021/media/chunks/0_0.chunk differ diff --git a/SQCSim2021/media/chunks/108_45.chunk b/SQCSim2021/media/chunks/108_45.chunk new file mode 100644 index 0000000..9334430 Binary files /dev/null and b/SQCSim2021/media/chunks/108_45.chunk differ diff --git a/SQCSim2021/media/chunks/113_20.chunk b/SQCSim2021/media/chunks/113_20.chunk new file mode 100644 index 0000000..e9bc2e0 Binary files /dev/null and b/SQCSim2021/media/chunks/113_20.chunk differ diff --git a/SQCSim2021/media/chunks/118_2.chunk b/SQCSim2021/media/chunks/118_2.chunk new file mode 100644 index 0000000..4fceb94 Binary files /dev/null and b/SQCSim2021/media/chunks/118_2.chunk differ diff --git a/SQCSim2021/media/chunks/118_3.chunk b/SQCSim2021/media/chunks/118_3.chunk new file mode 100644 index 0000000..dd9a7e3 Binary files /dev/null and b/SQCSim2021/media/chunks/118_3.chunk differ diff --git a/SQCSim2021/media/chunks/118_4.chunk b/SQCSim2021/media/chunks/118_4.chunk new file mode 100644 index 0000000..04cf4ac Binary files /dev/null and b/SQCSim2021/media/chunks/118_4.chunk differ diff --git a/SQCSim2021/media/chunks/118_5.chunk b/SQCSim2021/media/chunks/118_5.chunk new file mode 100644 index 0000000..441a5f1 Binary files /dev/null and b/SQCSim2021/media/chunks/118_5.chunk differ diff --git a/SQCSim2021/media/chunks/118_7.chunk b/SQCSim2021/media/chunks/118_7.chunk new file mode 100644 index 0000000..cbad6b7 --- /dev/null +++ b/SQCSim2021/media/chunks/118_7.chunk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/SQCSim2021/media/chunks/11_100.chunk b/SQCSim2021/media/chunks/11_100.chunk new file mode 100644 index 0000000..74d3ccd Binary files /dev/null and b/SQCSim2021/media/chunks/11_100.chunk differ diff --git a/SQCSim2021/media/chunks/11_101.chunk b/SQCSim2021/media/chunks/11_101.chunk new file mode 100644 index 0000000..85f9636 Binary files /dev/null and b/SQCSim2021/media/chunks/11_101.chunk differ diff --git a/SQCSim2021/media/chunks/11_102.chunk b/SQCSim2021/media/chunks/11_102.chunk new file mode 100644 index 0000000..14290f4 Binary files /dev/null and b/SQCSim2021/media/chunks/11_102.chunk differ diff --git a/SQCSim2021/media/chunks/11_103.chunk b/SQCSim2021/media/chunks/11_103.chunk new file mode 100644 index 0000000..ae4eaf3 Binary files /dev/null and b/SQCSim2021/media/chunks/11_103.chunk differ diff --git a/SQCSim2021/media/chunks/11_105.chunk b/SQCSim2021/media/chunks/11_105.chunk new file mode 100644 index 0000000..3b894ee Binary files /dev/null and b/SQCSim2021/media/chunks/11_105.chunk differ diff --git a/SQCSim2021/media/chunks/11_99.chunk b/SQCSim2021/media/chunks/11_99.chunk new file mode 100644 index 0000000..18b2b85 Binary files /dev/null and b/SQCSim2021/media/chunks/11_99.chunk differ diff --git a/SQCSim2021/media/chunks/12_103.chunk b/SQCSim2021/media/chunks/12_103.chunk new file mode 100644 index 0000000..f395a2d Binary files /dev/null and b/SQCSim2021/media/chunks/12_103.chunk differ diff --git a/SQCSim2021/media/chunks/16_5.chunk b/SQCSim2021/media/chunks/16_5.chunk new file mode 100644 index 0000000..36f1afc Binary files /dev/null and b/SQCSim2021/media/chunks/16_5.chunk differ diff --git a/SQCSim2021/media/chunks/17_5.chunk b/SQCSim2021/media/chunks/17_5.chunk new file mode 100644 index 0000000..d6b3875 Binary files /dev/null and b/SQCSim2021/media/chunks/17_5.chunk differ diff --git a/SQCSim2021/media/chunks/1_6.chunk b/SQCSim2021/media/chunks/1_6.chunk new file mode 100644 index 0000000..40168cf Binary files /dev/null and b/SQCSim2021/media/chunks/1_6.chunk differ diff --git a/SQCSim2021/media/chunks/1_7.chunk b/SQCSim2021/media/chunks/1_7.chunk new file mode 100644 index 0000000..11541ac Binary files /dev/null and b/SQCSim2021/media/chunks/1_7.chunk differ diff --git a/SQCSim2021/media/chunks/20_111.chunk b/SQCSim2021/media/chunks/20_111.chunk new file mode 100644 index 0000000..bda5e00 Binary files /dev/null and b/SQCSim2021/media/chunks/20_111.chunk differ diff --git a/SQCSim2021/media/chunks/23_97.chunk b/SQCSim2021/media/chunks/23_97.chunk new file mode 100644 index 0000000..d8d921c Binary files /dev/null and b/SQCSim2021/media/chunks/23_97.chunk differ diff --git a/SQCSim2021/media/chunks/23_98.chunk b/SQCSim2021/media/chunks/23_98.chunk new file mode 100644 index 0000000..28a94cb Binary files /dev/null and b/SQCSim2021/media/chunks/23_98.chunk differ diff --git a/SQCSim2021/media/chunks/24_97.chunk b/SQCSim2021/media/chunks/24_97.chunk new file mode 100644 index 0000000..16d005a Binary files /dev/null and b/SQCSim2021/media/chunks/24_97.chunk differ diff --git a/SQCSim2021/media/chunks/28_94.chunk b/SQCSim2021/media/chunks/28_94.chunk new file mode 100644 index 0000000..9d9974e Binary files /dev/null and b/SQCSim2021/media/chunks/28_94.chunk differ diff --git a/SQCSim2021/media/chunks/28_96.chunk b/SQCSim2021/media/chunks/28_96.chunk new file mode 100644 index 0000000..5924301 Binary files /dev/null and b/SQCSim2021/media/chunks/28_96.chunk differ diff --git a/SQCSim2021/media/chunks/39_64.chunk b/SQCSim2021/media/chunks/39_64.chunk new file mode 100644 index 0000000..57562f0 Binary files /dev/null and b/SQCSim2021/media/chunks/39_64.chunk differ diff --git a/SQCSim2021/media/chunks/41_75.chunk b/SQCSim2021/media/chunks/41_75.chunk new file mode 100644 index 0000000..cb7d9e3 Binary files /dev/null and b/SQCSim2021/media/chunks/41_75.chunk differ diff --git a/SQCSim2021/media/chunks/42_75.chunk b/SQCSim2021/media/chunks/42_75.chunk new file mode 100644 index 0000000..b70364a Binary files /dev/null and b/SQCSim2021/media/chunks/42_75.chunk differ diff --git a/SQCSim2021/media/chunks/42_76.chunk b/SQCSim2021/media/chunks/42_76.chunk new file mode 100644 index 0000000..6d942e5 Binary files /dev/null and b/SQCSim2021/media/chunks/42_76.chunk differ diff --git a/SQCSim2021/media/chunks/43_76.chunk b/SQCSim2021/media/chunks/43_76.chunk new file mode 100644 index 0000000..25ed3fc Binary files /dev/null and b/SQCSim2021/media/chunks/43_76.chunk differ diff --git a/SQCSim2021/media/chunks/45_37.chunk b/SQCSim2021/media/chunks/45_37.chunk new file mode 100644 index 0000000..73e85f6 Binary files /dev/null and b/SQCSim2021/media/chunks/45_37.chunk differ diff --git a/SQCSim2021/media/chunks/45_38.chunk b/SQCSim2021/media/chunks/45_38.chunk new file mode 100644 index 0000000..77f3aa3 Binary files /dev/null and b/SQCSim2021/media/chunks/45_38.chunk differ diff --git a/SQCSim2021/media/chunks/45_75.chunk b/SQCSim2021/media/chunks/45_75.chunk new file mode 100644 index 0000000..aa848f1 Binary files /dev/null and b/SQCSim2021/media/chunks/45_75.chunk differ diff --git a/SQCSim2021/media/chunks/46_39.chunk b/SQCSim2021/media/chunks/46_39.chunk new file mode 100644 index 0000000..6d41e01 Binary files /dev/null and b/SQCSim2021/media/chunks/46_39.chunk differ diff --git a/SQCSim2021/media/chunks/46_75.chunk b/SQCSim2021/media/chunks/46_75.chunk new file mode 100644 index 0000000..fa9a9f7 Binary files /dev/null and b/SQCSim2021/media/chunks/46_75.chunk differ diff --git a/SQCSim2021/media/chunks/47_74.chunk b/SQCSim2021/media/chunks/47_74.chunk new file mode 100644 index 0000000..bd6b8ee Binary files /dev/null and b/SQCSim2021/media/chunks/47_74.chunk differ diff --git a/SQCSim2021/media/chunks/47_75.chunk b/SQCSim2021/media/chunks/47_75.chunk new file mode 100644 index 0000000..cf380ef Binary files /dev/null and b/SQCSim2021/media/chunks/47_75.chunk differ diff --git a/SQCSim2021/media/chunks/49_52.chunk b/SQCSim2021/media/chunks/49_52.chunk new file mode 100644 index 0000000..3009871 Binary files /dev/null and b/SQCSim2021/media/chunks/49_52.chunk differ diff --git a/SQCSim2021/media/chunks/53_65.chunk b/SQCSim2021/media/chunks/53_65.chunk new file mode 100644 index 0000000..cd57d9d Binary files /dev/null and b/SQCSim2021/media/chunks/53_65.chunk differ diff --git a/SQCSim2021/media/chunks/53_66.chunk b/SQCSim2021/media/chunks/53_66.chunk new file mode 100644 index 0000000..d5c8509 Binary files /dev/null and b/SQCSim2021/media/chunks/53_66.chunk differ diff --git a/SQCSim2021/media/chunks/54_61.chunk b/SQCSim2021/media/chunks/54_61.chunk new file mode 100644 index 0000000..dc44570 Binary files /dev/null and b/SQCSim2021/media/chunks/54_61.chunk differ diff --git a/SQCSim2021/media/chunks/54_62.chunk b/SQCSim2021/media/chunks/54_62.chunk new file mode 100644 index 0000000..b777eef Binary files /dev/null and b/SQCSim2021/media/chunks/54_62.chunk differ diff --git a/SQCSim2021/media/chunks/54_64.chunk b/SQCSim2021/media/chunks/54_64.chunk new file mode 100644 index 0000000..37c630a Binary files /dev/null and b/SQCSim2021/media/chunks/54_64.chunk differ diff --git a/SQCSim2021/media/chunks/54_68.chunk b/SQCSim2021/media/chunks/54_68.chunk new file mode 100644 index 0000000..9ed7245 Binary files /dev/null and b/SQCSim2021/media/chunks/54_68.chunk differ diff --git a/SQCSim2021/media/chunks/54_69.chunk b/SQCSim2021/media/chunks/54_69.chunk new file mode 100644 index 0000000..2aa72f1 Binary files /dev/null and b/SQCSim2021/media/chunks/54_69.chunk differ diff --git a/SQCSim2021/media/chunks/55_57.chunk b/SQCSim2021/media/chunks/55_57.chunk new file mode 100644 index 0000000..e0f8448 Binary files /dev/null and b/SQCSim2021/media/chunks/55_57.chunk differ diff --git a/SQCSim2021/media/chunks/55_58.chunk b/SQCSim2021/media/chunks/55_58.chunk new file mode 100644 index 0000000..7604009 Binary files /dev/null and b/SQCSim2021/media/chunks/55_58.chunk differ diff --git a/SQCSim2021/media/chunks/55_68.chunk b/SQCSim2021/media/chunks/55_68.chunk new file mode 100644 index 0000000..42a97a6 Binary files /dev/null and b/SQCSim2021/media/chunks/55_68.chunk differ diff --git a/SQCSim2021/media/chunks/55_70.chunk b/SQCSim2021/media/chunks/55_70.chunk new file mode 100644 index 0000000..106d3f0 Binary files /dev/null and b/SQCSim2021/media/chunks/55_70.chunk differ diff --git a/SQCSim2021/media/chunks/56_67.chunk b/SQCSim2021/media/chunks/56_67.chunk new file mode 100644 index 0000000..fb23c74 Binary files /dev/null and b/SQCSim2021/media/chunks/56_67.chunk differ diff --git a/SQCSim2021/media/chunks/57_64.chunk b/SQCSim2021/media/chunks/57_64.chunk new file mode 100644 index 0000000..676c69a Binary files /dev/null and b/SQCSim2021/media/chunks/57_64.chunk differ diff --git a/SQCSim2021/media/chunks/57_74.chunk b/SQCSim2021/media/chunks/57_74.chunk new file mode 100644 index 0000000..4e1ec8c Binary files /dev/null and b/SQCSim2021/media/chunks/57_74.chunk differ diff --git a/SQCSim2021/media/chunks/58_64.chunk b/SQCSim2021/media/chunks/58_64.chunk new file mode 100644 index 0000000..9835150 Binary files /dev/null and b/SQCSim2021/media/chunks/58_64.chunk differ diff --git a/SQCSim2021/media/chunks/59_63.chunk b/SQCSim2021/media/chunks/59_63.chunk new file mode 100644 index 0000000..af4bb49 Binary files /dev/null and b/SQCSim2021/media/chunks/59_63.chunk differ diff --git a/SQCSim2021/media/chunks/59_64.chunk b/SQCSim2021/media/chunks/59_64.chunk new file mode 100644 index 0000000..7fe012b Binary files /dev/null and b/SQCSim2021/media/chunks/59_64.chunk differ diff --git a/SQCSim2021/media/chunks/59_75.chunk b/SQCSim2021/media/chunks/59_75.chunk new file mode 100644 index 0000000..92fe300 Binary files /dev/null and b/SQCSim2021/media/chunks/59_75.chunk differ diff --git a/SQCSim2021/media/chunks/5_25.chunk b/SQCSim2021/media/chunks/5_25.chunk new file mode 100644 index 0000000..276f7f8 Binary files /dev/null and b/SQCSim2021/media/chunks/5_25.chunk differ diff --git a/SQCSim2021/media/chunks/5_43.chunk b/SQCSim2021/media/chunks/5_43.chunk new file mode 100644 index 0000000..d7b967d Binary files /dev/null and b/SQCSim2021/media/chunks/5_43.chunk differ diff --git a/SQCSim2021/media/chunks/5_44.chunk b/SQCSim2021/media/chunks/5_44.chunk new file mode 100644 index 0000000..2858407 Binary files /dev/null and b/SQCSim2021/media/chunks/5_44.chunk differ diff --git a/SQCSim2021/media/chunks/5_46.chunk b/SQCSim2021/media/chunks/5_46.chunk new file mode 100644 index 0000000..5ea4e1a Binary files /dev/null and b/SQCSim2021/media/chunks/5_46.chunk differ diff --git a/SQCSim2021/media/chunks/5_50.chunk b/SQCSim2021/media/chunks/5_50.chunk new file mode 100644 index 0000000..35cfb7d Binary files /dev/null and b/SQCSim2021/media/chunks/5_50.chunk differ diff --git a/SQCSim2021/media/chunks/5_51.chunk b/SQCSim2021/media/chunks/5_51.chunk new file mode 100644 index 0000000..082cab2 Binary files /dev/null and b/SQCSim2021/media/chunks/5_51.chunk differ diff --git a/SQCSim2021/media/chunks/5_52.chunk b/SQCSim2021/media/chunks/5_52.chunk new file mode 100644 index 0000000..17f5379 Binary files /dev/null and b/SQCSim2021/media/chunks/5_52.chunk differ diff --git a/SQCSim2021/media/chunks/60_121.chunk b/SQCSim2021/media/chunks/60_121.chunk new file mode 100644 index 0000000..504dc42 Binary files /dev/null and b/SQCSim2021/media/chunks/60_121.chunk differ diff --git a/SQCSim2021/media/chunks/60_122.chunk b/SQCSim2021/media/chunks/60_122.chunk new file mode 100644 index 0000000..6861f93 Binary files /dev/null and b/SQCSim2021/media/chunks/60_122.chunk differ diff --git a/SQCSim2021/media/chunks/60_123.chunk b/SQCSim2021/media/chunks/60_123.chunk new file mode 100644 index 0000000..b27b52d Binary files /dev/null and b/SQCSim2021/media/chunks/60_123.chunk differ diff --git a/SQCSim2021/media/chunks/60_124.chunk b/SQCSim2021/media/chunks/60_124.chunk new file mode 100644 index 0000000..772a00c Binary files /dev/null and b/SQCSim2021/media/chunks/60_124.chunk differ diff --git a/SQCSim2021/media/chunks/60_125.chunk b/SQCSim2021/media/chunks/60_125.chunk new file mode 100644 index 0000000..222c32c Binary files /dev/null and b/SQCSim2021/media/chunks/60_125.chunk differ diff --git a/SQCSim2021/media/chunks/60_127.chunk b/SQCSim2021/media/chunks/60_127.chunk new file mode 100644 index 0000000..3afdf37 Binary files /dev/null and b/SQCSim2021/media/chunks/60_127.chunk differ diff --git a/SQCSim2021/media/chunks/60_62.chunk b/SQCSim2021/media/chunks/60_62.chunk new file mode 100644 index 0000000..9c50136 Binary files /dev/null and b/SQCSim2021/media/chunks/60_62.chunk differ diff --git a/SQCSim2021/media/chunks/60_63.chunk b/SQCSim2021/media/chunks/60_63.chunk new file mode 100644 index 0000000..783ccbd Binary files /dev/null and b/SQCSim2021/media/chunks/60_63.chunk differ diff --git a/SQCSim2021/media/chunks/62_107.chunk b/SQCSim2021/media/chunks/62_107.chunk new file mode 100644 index 0000000..476686f Binary files /dev/null and b/SQCSim2021/media/chunks/62_107.chunk differ diff --git a/SQCSim2021/media/chunks/62_109.chunk b/SQCSim2021/media/chunks/62_109.chunk new file mode 100644 index 0000000..d47913a Binary files /dev/null and b/SQCSim2021/media/chunks/62_109.chunk differ diff --git a/SQCSim2021/media/chunks/62_76.chunk b/SQCSim2021/media/chunks/62_76.chunk new file mode 100644 index 0000000..1df5d22 Binary files /dev/null and b/SQCSim2021/media/chunks/62_76.chunk differ diff --git a/SQCSim2021/media/chunks/63_105.chunk b/SQCSim2021/media/chunks/63_105.chunk new file mode 100644 index 0000000..7d5ffe9 Binary files /dev/null and b/SQCSim2021/media/chunks/63_105.chunk differ diff --git a/SQCSim2021/media/chunks/63_106.chunk b/SQCSim2021/media/chunks/63_106.chunk new file mode 100644 index 0000000..565d8f8 Binary files /dev/null and b/SQCSim2021/media/chunks/63_106.chunk differ diff --git a/SQCSim2021/media/chunks/63_107.chunk b/SQCSim2021/media/chunks/63_107.chunk new file mode 100644 index 0000000..a8e35ff Binary files /dev/null and b/SQCSim2021/media/chunks/63_107.chunk differ diff --git a/SQCSim2021/media/chunks/63_64.chunk b/SQCSim2021/media/chunks/63_64.chunk new file mode 100644 index 0000000..26cf557 Binary files /dev/null and b/SQCSim2021/media/chunks/63_64.chunk differ diff --git a/SQCSim2021/media/chunks/63_76.chunk b/SQCSim2021/media/chunks/63_76.chunk new file mode 100644 index 0000000..dd3eca8 Binary files /dev/null and b/SQCSim2021/media/chunks/63_76.chunk differ diff --git a/SQCSim2021/media/chunks/64_104.chunk b/SQCSim2021/media/chunks/64_104.chunk new file mode 100644 index 0000000..c948e6f Binary files /dev/null and b/SQCSim2021/media/chunks/64_104.chunk differ diff --git a/SQCSim2021/media/chunks/64_105.chunk b/SQCSim2021/media/chunks/64_105.chunk new file mode 100644 index 0000000..d8b32a6 Binary files /dev/null and b/SQCSim2021/media/chunks/64_105.chunk differ diff --git a/SQCSim2021/media/chunks/64_69.chunk b/SQCSim2021/media/chunks/64_69.chunk new file mode 100644 index 0000000..045ed64 Binary files /dev/null and b/SQCSim2021/media/chunks/64_69.chunk differ diff --git a/SQCSim2021/media/chunks/64_72.chunk b/SQCSim2021/media/chunks/64_72.chunk index f7c3a22..d94c490 100644 Binary files a/SQCSim2021/media/chunks/64_72.chunk and b/SQCSim2021/media/chunks/64_72.chunk differ diff --git a/SQCSim2021/media/chunks/65_102.chunk b/SQCSim2021/media/chunks/65_102.chunk new file mode 100644 index 0000000..0fce0e0 Binary files /dev/null and b/SQCSim2021/media/chunks/65_102.chunk differ diff --git a/SQCSim2021/media/chunks/65_103.chunk b/SQCSim2021/media/chunks/65_103.chunk new file mode 100644 index 0000000..df2f35a Binary files /dev/null and b/SQCSim2021/media/chunks/65_103.chunk differ diff --git a/SQCSim2021/media/chunks/65_62.chunk b/SQCSim2021/media/chunks/65_62.chunk new file mode 100644 index 0000000..d269483 --- /dev/null +++ b/SQCSim2021/media/chunks/65_62.chunk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/SQCSim2021/media/chunks/66_41.chunk b/SQCSim2021/media/chunks/66_41.chunk new file mode 100644 index 0000000..01e0894 Binary files /dev/null and b/SQCSim2021/media/chunks/66_41.chunk differ diff --git a/SQCSim2021/media/chunks/66_76.chunk b/SQCSim2021/media/chunks/66_76.chunk new file mode 100644 index 0000000..7807b38 Binary files /dev/null and b/SQCSim2021/media/chunks/66_76.chunk differ diff --git a/SQCSim2021/media/chunks/67_100.chunk b/SQCSim2021/media/chunks/67_100.chunk new file mode 100644 index 0000000..8e95cf8 Binary files /dev/null and b/SQCSim2021/media/chunks/67_100.chunk differ diff --git a/SQCSim2021/media/chunks/67_81.chunk b/SQCSim2021/media/chunks/67_81.chunk new file mode 100644 index 0000000..2a19980 Binary files /dev/null and b/SQCSim2021/media/chunks/67_81.chunk differ diff --git a/SQCSim2021/media/chunks/67_99.chunk b/SQCSim2021/media/chunks/67_99.chunk new file mode 100644 index 0000000..b76aeef Binary files /dev/null and b/SQCSim2021/media/chunks/67_99.chunk differ diff --git a/SQCSim2021/media/chunks/68_125.chunk b/SQCSim2021/media/chunks/68_125.chunk new file mode 100644 index 0000000..3aecb01 Binary files /dev/null and b/SQCSim2021/media/chunks/68_125.chunk differ diff --git a/SQCSim2021/media/chunks/68_126.chunk b/SQCSim2021/media/chunks/68_126.chunk new file mode 100644 index 0000000..4f5d8b1 Binary files /dev/null and b/SQCSim2021/media/chunks/68_126.chunk differ diff --git a/SQCSim2021/media/chunks/68_63.chunk b/SQCSim2021/media/chunks/68_63.chunk new file mode 100644 index 0000000..ae8c1b3 --- /dev/null +++ b/SQCSim2021/media/chunks/68_63.chunk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/SQCSim2021/media/chunks/69_121.chunk b/SQCSim2021/media/chunks/69_121.chunk new file mode 100644 index 0000000..cd13a05 Binary files /dev/null and b/SQCSim2021/media/chunks/69_121.chunk differ diff --git a/SQCSim2021/media/chunks/69_122.chunk b/SQCSim2021/media/chunks/69_122.chunk new file mode 100644 index 0000000..2de4a30 Binary files /dev/null and b/SQCSim2021/media/chunks/69_122.chunk differ diff --git a/SQCSim2021/media/chunks/69_123.chunk b/SQCSim2021/media/chunks/69_123.chunk new file mode 100644 index 0000000..db22057 Binary files /dev/null and b/SQCSim2021/media/chunks/69_123.chunk differ diff --git a/SQCSim2021/media/chunks/69_124.chunk b/SQCSim2021/media/chunks/69_124.chunk new file mode 100644 index 0000000..6d1957a Binary files /dev/null and b/SQCSim2021/media/chunks/69_124.chunk differ diff --git a/SQCSim2021/media/chunks/69_125.chunk b/SQCSim2021/media/chunks/69_125.chunk new file mode 100644 index 0000000..44455fc Binary files /dev/null and b/SQCSim2021/media/chunks/69_125.chunk differ diff --git a/SQCSim2021/media/chunks/6_116.chunk b/SQCSim2021/media/chunks/6_116.chunk new file mode 100644 index 0000000..6f82d42 Binary files /dev/null and b/SQCSim2021/media/chunks/6_116.chunk differ diff --git a/SQCSim2021/media/chunks/6_52.chunk b/SQCSim2021/media/chunks/6_52.chunk new file mode 100644 index 0000000..612841f Binary files /dev/null and b/SQCSim2021/media/chunks/6_52.chunk differ diff --git a/SQCSim2021/media/chunks/6_53.chunk b/SQCSim2021/media/chunks/6_53.chunk new file mode 100644 index 0000000..e1a2dcb Binary files /dev/null and b/SQCSim2021/media/chunks/6_53.chunk differ diff --git a/SQCSim2021/media/chunks/6_54.chunk b/SQCSim2021/media/chunks/6_54.chunk new file mode 100644 index 0000000..2be1096 Binary files /dev/null and b/SQCSim2021/media/chunks/6_54.chunk differ diff --git a/SQCSim2021/media/chunks/6_55.chunk b/SQCSim2021/media/chunks/6_55.chunk new file mode 100644 index 0000000..b64c752 Binary files /dev/null and b/SQCSim2021/media/chunks/6_55.chunk differ diff --git a/SQCSim2021/media/chunks/6_56.chunk b/SQCSim2021/media/chunks/6_56.chunk new file mode 100644 index 0000000..3ffe2d6 Binary files /dev/null and b/SQCSim2021/media/chunks/6_56.chunk differ diff --git a/SQCSim2021/media/chunks/6_57.chunk b/SQCSim2021/media/chunks/6_57.chunk new file mode 100644 index 0000000..cc2d632 Binary files /dev/null and b/SQCSim2021/media/chunks/6_57.chunk differ diff --git a/SQCSim2021/media/chunks/6_58.chunk b/SQCSim2021/media/chunks/6_58.chunk new file mode 100644 index 0000000..b31a046 Binary files /dev/null and b/SQCSim2021/media/chunks/6_58.chunk differ diff --git a/SQCSim2021/media/chunks/6_59.chunk b/SQCSim2021/media/chunks/6_59.chunk new file mode 100644 index 0000000..4f87f4d Binary files /dev/null and b/SQCSim2021/media/chunks/6_59.chunk differ diff --git a/SQCSim2021/media/chunks/6_60.chunk b/SQCSim2021/media/chunks/6_60.chunk new file mode 100644 index 0000000..833237c Binary files /dev/null and b/SQCSim2021/media/chunks/6_60.chunk differ diff --git a/SQCSim2021/media/chunks/6_61.chunk b/SQCSim2021/media/chunks/6_61.chunk new file mode 100644 index 0000000..04c04e7 Binary files /dev/null and b/SQCSim2021/media/chunks/6_61.chunk differ diff --git a/SQCSim2021/media/chunks/6_62.chunk b/SQCSim2021/media/chunks/6_62.chunk new file mode 100644 index 0000000..59eacdf Binary files /dev/null and b/SQCSim2021/media/chunks/6_62.chunk differ diff --git a/SQCSim2021/media/chunks/6_63.chunk b/SQCSim2021/media/chunks/6_63.chunk new file mode 100644 index 0000000..c39fb29 Binary files /dev/null and b/SQCSim2021/media/chunks/6_63.chunk differ diff --git a/SQCSim2021/media/chunks/70_63.chunk b/SQCSim2021/media/chunks/70_63.chunk new file mode 100644 index 0000000..0e05b90 Binary files /dev/null and b/SQCSim2021/media/chunks/70_63.chunk differ diff --git a/SQCSim2021/media/chunks/70_75.chunk b/SQCSim2021/media/chunks/70_75.chunk new file mode 100644 index 0000000..6f2e034 Binary files /dev/null and b/SQCSim2021/media/chunks/70_75.chunk differ diff --git a/SQCSim2021/media/chunks/70_76.chunk b/SQCSim2021/media/chunks/70_76.chunk new file mode 100644 index 0000000..9d6304c Binary files /dev/null and b/SQCSim2021/media/chunks/70_76.chunk differ diff --git a/SQCSim2021/media/chunks/73_61.chunk b/SQCSim2021/media/chunks/73_61.chunk new file mode 100644 index 0000000..4e69b57 Binary files /dev/null and b/SQCSim2021/media/chunks/73_61.chunk differ diff --git a/SQCSim2021/media/chunks/75_59.chunk b/SQCSim2021/media/chunks/75_59.chunk new file mode 100644 index 0000000..e352477 Binary files /dev/null and b/SQCSim2021/media/chunks/75_59.chunk differ diff --git a/SQCSim2021/media/chunks/78_75.chunk b/SQCSim2021/media/chunks/78_75.chunk new file mode 100644 index 0000000..2d8835e --- /dev/null +++ b/SQCSim2021/media/chunks/78_75.chunk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/SQCSim2021/media/chunks/7_67.chunk b/SQCSim2021/media/chunks/7_67.chunk new file mode 100644 index 0000000..b593b88 Binary files /dev/null and b/SQCSim2021/media/chunks/7_67.chunk differ diff --git a/SQCSim2021/media/chunks/81_75.chunk b/SQCSim2021/media/chunks/81_75.chunk new file mode 100644 index 0000000..efe9d1f --- /dev/null +++ b/SQCSim2021/media/chunks/81_75.chunk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/SQCSim2021/media/chunks/84_73.chunk b/SQCSim2021/media/chunks/84_73.chunk new file mode 100644 index 0000000..1b3ec65 Binary files /dev/null and b/SQCSim2021/media/chunks/84_73.chunk differ diff --git a/SQCSim2021/media/chunks/84_74.chunk b/SQCSim2021/media/chunks/84_74.chunk new file mode 100644 index 0000000..6e29afe Binary files /dev/null and b/SQCSim2021/media/chunks/84_74.chunk differ diff --git a/SQCSim2021/media/chunks/85_71.chunk b/SQCSim2021/media/chunks/85_71.chunk new file mode 100644 index 0000000..b70ae27 Binary files /dev/null and b/SQCSim2021/media/chunks/85_71.chunk differ diff --git a/SQCSim2021/media/chunks/85_72.chunk b/SQCSim2021/media/chunks/85_72.chunk new file mode 100644 index 0000000..a06ceb8 Binary files /dev/null and b/SQCSim2021/media/chunks/85_72.chunk differ diff --git a/SQCSim2021/media/chunks/88_68.chunk b/SQCSim2021/media/chunks/88_68.chunk new file mode 100644 index 0000000..29de148 Binary files /dev/null and b/SQCSim2021/media/chunks/88_68.chunk differ diff --git a/SQCSim2021/media/chunks/89_66.chunk b/SQCSim2021/media/chunks/89_66.chunk new file mode 100644 index 0000000..e84c36f Binary files /dev/null and b/SQCSim2021/media/chunks/89_66.chunk differ diff --git a/SQCSim2021/media/chunks/90_65.chunk b/SQCSim2021/media/chunks/90_65.chunk new file mode 100644 index 0000000..ba39ac5 Binary files /dev/null and b/SQCSim2021/media/chunks/90_65.chunk differ diff --git a/SQCSim2021/media/chunks/90_66.chunk b/SQCSim2021/media/chunks/90_66.chunk new file mode 100644 index 0000000..36705b1 Binary files /dev/null and b/SQCSim2021/media/chunks/90_66.chunk differ diff --git a/SQCSim2021/media/chunks/91_62.chunk b/SQCSim2021/media/chunks/91_62.chunk new file mode 100644 index 0000000..d00b07e Binary files /dev/null and b/SQCSim2021/media/chunks/91_62.chunk differ diff --git a/SQCSim2021/media/chunks/9_84.chunk b/SQCSim2021/media/chunks/9_84.chunk new file mode 100644 index 0000000..75877d9 Binary files /dev/null and b/SQCSim2021/media/chunks/9_84.chunk differ diff --git a/SQCSim2021/player.cpp b/SQCSim2021/player.cpp index 9e8c846..5c91375 100644 --- a/SQCSim2021/player.cpp +++ b/SQCSim2021/player.cpp @@ -1,4 +1,5 @@ #include "player.h" +#include "world.h" Player::Player(const Vector3f& position, float rotX, float rotY) : m_position(position), m_rotX(rotX), m_rotY(rotY) { m_velocity = Vector3f(0, 0, 0); @@ -66,19 +67,19 @@ void Player::ApplyPhysics(Vector3f input, World world, float elapsedTime) { /* Gestion de collisions */ BlockType bt1, bt2, bt3; - bt1 = world.BlockAt(m_position.x, m_position.y + input.y, m_position.z); - bt2 = world.BlockAt(m_position.x, m_position.y + input.y - 0.9f, m_position.z); - bt3 = world.BlockAt(m_position.x, m_position.y + input.y - 1.7f, m_position.z); + bt1 = world.BlockAt(GetPosition().x, GetPosition().y + input.y, GetPosition().z); + bt2 = world.BlockAt(GetPosition().x, GetPosition().y + input.y - 0.9f, GetPosition().z); + bt3 = world.BlockAt(GetPosition().x, GetPosition().y + input.y - 1.7f, GetPosition().z); if ((bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) && m_position.y < 129.7f) { - bt1 = world.BlockAt(m_position.x, m_position.y + .3f, m_position.z); + bt1 = world.BlockAt(GetPosition().x, GetPosition().y + .3f, GetPosition().z); if (bt1 == BTYPE_AIR) m_position.y = (int)m_position.y + .7f; m_velocity.y = input.y = 0; m_airborne = false; } else { if (abs(m_velocity.y) < 1.1f) m_velocity.y += input.y - 1.1f * elapsedTime; - bt3 = world.BlockAt(m_position.x, m_position.y + m_velocity.y - 1.7f, m_position.z); - bt1 = world.BlockAt(m_position.x, m_position.y + .3f, m_position.z); + bt3 = world.BlockAt(GetPosition().x, GetPosition().y + m_velocity.y - 1.7f, GetPosition().z); + bt1 = world.BlockAt(GetPosition().x, GetPosition().y + .3f, GetPosition().z); if (bt3 != BTYPE_AIR) { m_velocity.y = 0; m_airborne = false; @@ -89,17 +90,17 @@ void Player::ApplyPhysics(Vector3f input, World world, float elapsedTime) { else m_airborne = true; } - bt1 = world.BlockAt(m_position.x + input.x, m_position.y, m_position.z); - bt2 = world.BlockAt(m_position.x + input.x, m_position.y - 0.9f, m_position.z); - bt3 = world.BlockAt(m_position.x + input.x, m_position.y - 1.7f, m_position.z); + bt1 = world.BlockAt(GetPosition().x + input.x, GetPosition().y, GetPosition().z); + bt2 = world.BlockAt(GetPosition().x + input.x, GetPosition().y - 0.9f, GetPosition().z); + bt3 = world.BlockAt(GetPosition().x + input.x, GetPosition().y - 1.7f, GetPosition().z); if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { input.x = m_velocity.x = 0; m_velocity.z *= .5f; } - bt1 = world.BlockAt(m_position.x, m_position.y, m_position.z + input.z); - bt2 = world.BlockAt(m_position.x, m_position.y - 0.9f, m_position.z + input.z); - bt3 = world.BlockAt(m_position.x, m_position.y - 1.7f, m_position.z + input.z); + bt1 = world.BlockAt(GetPosition().x, GetPosition().y, GetPosition().z + input.z); + bt2 = world.BlockAt(GetPosition().x, GetPosition().y - 0.9f, GetPosition().z + input.z); + bt3 = world.BlockAt(GetPosition().x, GetPosition().y - 1.7f, GetPosition().z + input.z); if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { input.z = m_velocity.z = 0; m_velocity.x *= .5f; @@ -145,13 +146,20 @@ void Player::ApplyPhysics(Vector3f input, World world, float elapsedTime) { void Player::ApplyTransformation(Transformation& transformation, bool rel) const { transformation.ApplyRotation(-m_rotX, 1, 0, 0); transformation.ApplyRotation(-m_rotY, 0, 1, 0); - if (rel) transformation.ApplyTranslation(-m_position.x,-m_POV,-m_position.z); + if (rel) transformation.ApplyTranslation(-GetPOV()); } -Vector3f Player::GetPosition() const { return m_position; } +Vector3f Player::GetPosition() const { return Vector3f(m_position.x + CHUNK_SIZE_X * WORLD_SIZE_X / 2, m_position.y, m_position.z + CHUNK_SIZE_Z * WORLD_SIZE_Y / 2); +} Vector3f Player::GetVelocity() const { return m_velocity; } -Vector3f Player::GetPOV() const { return Vector3f(m_position.x, m_POV, m_position.z); } +Vector3f Player::GetPOV() const { return Vector3f(GetPosition().x, m_POV, GetPosition().z); } Vector3f Player::GetDirection() const { return m_direction; } + +void Player::Transpose(int& x, int& z) { + m_position.x -= x * CHUNK_SIZE_X; + m_position.z -= z * CHUNK_SIZE_Z; +} + diff --git a/SQCSim2021/player.h b/SQCSim2021/player.h index 3e90c95..7789ada 100644 --- a/SQCSim2021/player.h +++ b/SQCSim2021/player.h @@ -2,9 +2,10 @@ #define _PLAYER_H__ #include "vector3.h" #include "transformation.h" -#include "world.h" #include +class World; + class Player { public: Player(const Vector3f& position, float rotX = 0, float rotY = 0); @@ -18,6 +19,7 @@ public: Vector3f GetDirection() const; Vector3f GetVelocity() const; Vector3f GetPOV() const; + void Transpose(int& x, int& z); private: Vector3f m_position; diff --git a/SQCSim2021/world.cpp b/SQCSim2021/world.cpp index 1ee6783..bc22409 100644 --- a/SQCSim2021/world.cpp +++ b/SQCSim2021/world.cpp @@ -11,7 +11,9 @@ Chunk* World::ChunkAt(float x, float y, float z) const { int cz = (int)z / CHUNK_SIZE_Z; if (x < 0 || y < 0 || z < 0 || - x >= WORLD_SIZE_X * CHUNK_SIZE_X || z >= CHUNK_SIZE_Z * WORLD_SIZE_Y || y > CHUNK_SIZE_Y) + x >= WORLD_SIZE_X * CHUNK_SIZE_X || + z >= CHUNK_SIZE_Z * WORLD_SIZE_Y || + y > CHUNK_SIZE_Y) return 0; return m_chunks.Get(cx, cz); @@ -36,3 +38,44 @@ BlockType World::BlockAt(const Vector3f& pos, BlockType defaultBlockType) const return BlockAt(pos.x, pos.y, pos.z, defaultBlockType); } +void World::TransposeWorld(Player& player) { + int x = 0; + int y = 0; + + if (player.GetPosition().x > (WORLD_SIZE_X * CHUNK_SIZE_X) * .66f) ++x; + else if (player.GetPosition().x < (WORLD_SIZE_X * CHUNK_SIZE_X) * .33f) --x; + if (player.GetPosition().z > (WORLD_SIZE_Y * CHUNK_SIZE_Z) * .66f) ++y; + else if (player.GetPosition().z < (WORLD_SIZE_Y * CHUNK_SIZE_Z) * .33f) --y; + + if (!x && !y) return; + + if (x != 0) + for (int ay = 0; ay < WORLD_SIZE_Y; ++ay) + for (int ax = 0; ax < abs(x); ++ay) + if (ChunkAt(x < 0 ? (WORLD_SIZE_X - 1 - ax) * WORLD_SIZE_X : ax, 1, ay * WORLD_SIZE_Y)) + m_tbDeleted.push_back(std::move(m_chunks.Get(x < 0? WORLD_SIZE_X - 1 - ax: ax, ay))); + if (y != 0) + for (int ax = 0; ax < WORLD_SIZE_X; ++ax) + for (int ay = 0; ay < abs(y); ++ay) + if (ChunkAt(ax * WORLD_SIZE_X , 1, y < 0 ? (WORLD_SIZE_Y - 1 - ay) * WORLD_SIZE_Y : ay)) + m_tbDeleted.push_back(std::move(m_chunks.Get(ax, y < 0 ? WORLD_SIZE_Y - 1 - ay: ay))); + + for (int ax = 0; ax < WORLD_SIZE_X; ++ax) + for (int ay = 0; ay < WORLD_SIZE_Y; ++ay) + if (ax + x < WORLD_SIZE_X && ax + x > 0 && + ay + y < WORLD_SIZE_Y && ay + y > 0) + m_chunks.Set(x > 0? ax: ax + x, y > 0? ay: ay + y, + m_chunks.Get(x < 0 ? ax : ax + x, y < 0 ? ay : ay + y)); + if (x != 0) + for (int ay = 0; ay < WORLD_SIZE_Y; ++ay) + for (int ax = 0; ax < abs(x); ++ay) + m_chunks.Set(x > 0 ? WORLD_SIZE_X - 1 - ax : ax, ay, nullptr); + if (y != 0) + for (int ax = 0; ax < WORLD_SIZE_X; ++ax) + for (int ay = 0; ay < abs(y); ++ay) + m_chunks.Set(ax, y > 0 ? WORLD_SIZE_Y - 1 - ay : ay, nullptr); + + m_center[0] += x; m_center[1] += y; + player.Transpose(x, y); +} + diff --git a/SQCSim2021/world.h b/SQCSim2021/world.h index 8efc5be..6d9c3c5 100644 --- a/SQCSim2021/world.h +++ b/SQCSim2021/world.h @@ -4,11 +4,14 @@ #include "chunk.h" #include "array2d.h" #include "vector3.h" +#include "player.h" #include "transformation.h" #include #include +#include class Chunk; +class Player; class World { public: @@ -23,10 +26,12 @@ class World { BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const; BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const; + void TransposeWorld(Player& player); private: Array2d m_chunks = Array2d(WORLD_SIZE_X, WORLD_SIZE_Y); + std::vector m_tbDeleted; - unsigned int m_center[2] = {UINT16_MAX / 2, UINT16_MAX / 2}; + int m_center[2] = {INT16_MAX / 2, INT16_MAX / 2}; }; #endif // WORLD_H__