45 lines
1.7 KiB
C++
45 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <string>
|
|
#include <climits>
|
|
|
|
namespace world::materials {
|
|
//TODO: AoS to SoA compile time
|
|
struct Material {
|
|
std::string name;
|
|
std::string texture;
|
|
float roughness;
|
|
bool solid;
|
|
//uint16_t break_to
|
|
};
|
|
|
|
//MAYBE: index name enum
|
|
constexpr auto AIR = 0;
|
|
constexpr auto DIRT = 1;
|
|
constexpr auto GRASS = 2;
|
|
constexpr auto SAND = 3;
|
|
constexpr auto ROCK = 4;
|
|
constexpr auto WATER = 8;
|
|
|
|
/// Materials count
|
|
static const auto count = 9;
|
|
static_assert(count < (USHRT_MAX >> 4), "for byte packing see Voxel");
|
|
/// Materials names
|
|
static const std::array<std::string, count> names = {{"Air", "Dirt", "Grass", "Sand", "Rock", "Wall", "Path", "Alien metal", "Water"}};
|
|
/// Materials textures
|
|
static const std::array<uint16_t, count> textures_map = {{0, 2, 9, 1, 7, 6, 3, 8, 12}};
|
|
/// Materials roughness.
|
|
/// -1: slope, 0: normal, 1: cube
|
|
static const std::array<float, count> roughness = {{0, 0, 0, 0, 0, 0, -1, .8, 0}};
|
|
/// Materials interactive
|
|
static const std::array<bool, count> invisibility = {{true, false, false, false, false, false, false, false, false}};
|
|
/// Materials see throw
|
|
static const std::array<bool, count> transparency = {{true, false, false, false, false, false, false, false, true}};
|
|
/// Materials is solid
|
|
static const std::array<bool, count> solidity = {{false, true, true, true, true, true, true, true, false}};
|
|
|
|
/// All textures
|
|
static const std::array<std::string, 13> textures = {{"Debug", "Sand", "Dirt", "Stone_path", "Mapl", "Seaside_rock", "Stone_wall", "Rough_rock", "Alien", "Grass", "Plain_grass", "Forest_grass", "Water"}};
|
|
}
|