Compare commits
4 Commits
5916f293c3
...
7e54de7c9d
Author | SHA1 | Date | |
---|---|---|---|
|
7e54de7c9d | ||
|
cebf698aa5 | ||
|
2952ff378f | ||
|
27c7917338 |
@ -1,3 +1,26 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef POLYGUN_CORE_HPP
|
||||
#define POLYGUN_CORE_HPP
|
||||
|
||||
|
@ -23,7 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "greedy_meshing.hpp"
|
||||
#include "game/world/chunk.hpp"
|
||||
|
||||
|
@ -1,3 +1,29 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
Copyright (c) 2023 Looki2000 https://looki2000.cubesoftware.xyz
|
||||
Copyright (c) 2023 mrkubax10 <mrkubax10@onet.pl>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "game/engine/player_camera.hpp"
|
||||
|
||||
#include "game/engine/engine.hpp"
|
||||
|
@ -1,3 +1,29 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
Copyright (c) 2023 Looki2000 https://looki2000.cubesoftware.xyz
|
||||
Copyright (c) 2023 mrkubax10 <mrkubax10@onet.pl>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef POLYGUN_ENGINE_CAMERA_H
|
||||
#define POLYGUN_ENGINE_CAMERA_H
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
@ -1,3 +1,27 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef POLYGUN_RENDERER_VERTEX_HPP
|
||||
#define POLYGUN_RENDERER_VERTEX_HPP
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
@ -1,3 +1,27 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef POLYGUN_RENDERER_VERTEX_ARRAY_HPP
|
||||
#define POLYGUN_RENDERER_VERTEX_ARRAY_HPP
|
||||
|
||||
|
@ -39,7 +39,7 @@ SOFTWARE.
|
||||
|
||||
// greedy meshing debug test
|
||||
//#include <iostream>
|
||||
//#include "../engine/greedy_meshing.hpp"
|
||||
#include "../engine/greedy_meshing.hpp"
|
||||
|
||||
using namespace polygun::screens;
|
||||
|
||||
@ -181,6 +181,11 @@ void GameSessionScreen::begin() {
|
||||
m_node_mesh = m_engine->get_master_renderer().create_mesh();
|
||||
for(size_t i = 0; i<vertices.size(); i+=3)
|
||||
indices.push_back((int)i/3);
|
||||
/*
|
||||
engine::greedy_meshing greedy;
|
||||
engine::vertices_indices mesh = greedy.generate_mesh(greedy.merge(m_chnk), m_chnk);
|
||||
m_node_mesh->load_from_memory(mesh.vertices, mesh.indices);
|
||||
*/
|
||||
m_node_mesh->load_from_memory(vertices, indices, uvs);
|
||||
|
||||
for(int i = 0; i< sizeof(world::nodes) / sizeof(world::nodes[0]); i++) {
|
||||
|
@ -93,4 +93,4 @@ void MainMenuScreen::render() {
|
||||
|
||||
void MainMenuScreen::update(double delta) {}
|
||||
|
||||
void MainMenuScreen::finish() {}
|
||||
void MainMenuScreen::finish() {}
|
@ -2,6 +2,8 @@
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 mrkubax10 <mrkubax10@onet.pl>
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,3 +1,26 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#include "chunk.hpp"
|
||||
|
||||
#include "../engine/greedy_meshing.hpp"
|
||||
@ -7,18 +30,7 @@ namespace polygun::world {
|
||||
for (int z = 0; z < CHUNK_SIZE; z++) {
|
||||
for (int y = 0; y < CHUNK_SIZE; y++) {
|
||||
for (int x = 0; x < CHUNK_SIZE; x++) {
|
||||
if (x < 5 && y < 5 && z < 5)
|
||||
chunk_data[z][y][x] = 1;
|
||||
else
|
||||
chunk_data[z][y][x] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int z = 2; z < 10; z++) {
|
||||
for (int y = 2; y < 8; y++) {
|
||||
for (int x = 2; x < 6; x++) {
|
||||
chunk_data[z][y][x] = 2;
|
||||
chunk_data[z][y][x] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,8 +89,4 @@ namespace polygun::world {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
engine::verticies_indices Chunk::generate_mesh() {
|
||||
return m_greedy_meshing.generate_mesh(m_greedy_meshing.merge(*this), *this);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,30 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef POLYGUN_WORLD_CHUNK_HPP
|
||||
#define POLYGUN_WORLD_CHUNK_HPP
|
||||
|
||||
#include "nodes.hpp"
|
||||
#include "../engine/greedy_meshing.hpp"
|
||||
#include "../engine/engine.hpp"
|
||||
|
||||
namespace polygun::world {
|
||||
class Chunk {
|
||||
@ -16,14 +37,11 @@ namespace polygun::world {
|
||||
int get_node(glm::vec3 pos);
|
||||
bool is_neighbour_air(glm::vec3 pos);
|
||||
|
||||
engine::verticies_indices generate_mesh();
|
||||
|
||||
static const int CHUNK_SIZE = 32;
|
||||
|
||||
glm::vec3 chunk_pos;
|
||||
|
||||
private:
|
||||
engine::greedy_meshing m_greedy_meshing;
|
||||
int chunk_data[CHUNK_SIZE][CHUNK_SIZE][CHUNK_SIZE];
|
||||
};
|
||||
}
|
||||
|
23
src/game/world/world.hpp
Normal file
23
src/game/world/world.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
PolyGun
|
||||
|
||||
Copyright (c) 2023 kacperks https://kacperks.cubesoftware.xyz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
@ -12,6 +12,8 @@
|
||||
#include "common/logger.hpp"
|
||||
#include "common/locale/translation_manager.hpp"
|
||||
|
||||
#include "game/ecs/base_component.hpp"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
polygun::utils::Logger::create(false, true);
|
||||
polygun::locale::TranslationManager::create("locale");
|
||||
|
Loading…
x
Reference in New Issue
Block a user