refactor: update log and leaf materials
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 398 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 398 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 398 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 398 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 398 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 398 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 215 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 215 B |
@@ -1,11 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <Cubed/config.hpp>
|
||||||
|
#include <Cubed/tools/cubed_assert.hpp>
|
||||||
struct BlockTexture {
|
struct BlockTexture {
|
||||||
std::string name;
|
std::string name;
|
||||||
unsigned id;
|
unsigned id;
|
||||||
@@ -38,4 +39,29 @@ struct BlockRenderData {
|
|||||||
struct LookBlock {
|
struct LookBlock {
|
||||||
glm::ivec3 pos;
|
glm::ivec3 pos;
|
||||||
glm::ivec3 normal;
|
glm::ivec3 normal;
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr std::array<std::string_view, MAX_BLOCK_NUM> BLOCK_REISTER{
|
||||||
|
"air",
|
||||||
|
"grass_block",
|
||||||
|
"dirt",
|
||||||
|
"stone",
|
||||||
|
"sand",
|
||||||
|
"log",
|
||||||
|
"leaf"
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::array<bool, MAX_BLOCK_NUM> TRANSPARENT_MAP {
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool is_in_transparent_map(unsigned id) {
|
||||||
|
CUBED_ASSERT_MSG(id < MAX_BLOCK_NUM, "ID is invaild");
|
||||||
|
return TRANSPARENT_MAP[id];
|
||||||
};
|
};
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
static int get_index(int x, int y, int z);
|
static int get_index(int x, int y, int z);
|
||||||
static int get_index(const glm::vec3& pos);
|
static int get_index(const glm::vec3& pos);
|
||||||
void init_chunk();
|
void init_chunk();
|
||||||
void gen_vertex_data();
|
//void gen_vertex_data();
|
||||||
// 0 : (1, 0)
|
// 0 : (1, 0)
|
||||||
// 1 : (-1, 0)
|
// 1 : (-1, 0)
|
||||||
// 2 : (0, 1)
|
// 2 : (0, 1)
|
||||||
|
|||||||