transfered from codeberg
This commit is contained in:
66
source_code/block_module/block/_internal/private_block.c
Normal file
66
source_code/block_module/block/_internal/private_block.c
Normal file
@@ -0,0 +1,66 @@
|
||||
#include "private_block.h"
|
||||
|
||||
#include "texture_atlas_mapper.h"
|
||||
|
||||
/**
|
||||
* The global registry of block properties and rendering data.
|
||||
* * This array serves as the "Source of Truth" for every block type in the game.
|
||||
* It defines the physical properties (transparency), the vertex colors,
|
||||
* and the specific texture indices for each of the six cube faces.
|
||||
* * The array is indexed using the 'block_id_struct' enum values to ensure
|
||||
* O(1) look-up time for block data during mesh generation and lighting.
|
||||
*/
|
||||
const block_render_data_struct _block_library[] =
|
||||
{
|
||||
[block_air] = {
|
||||
.color = { 0, 0, 0, 0 },
|
||||
.is_transparent = true,
|
||||
.texture = {
|
||||
.top = 0, .bottom = 0,
|
||||
.front = 0, .back = 0,
|
||||
.left = 0, .right = 0
|
||||
}
|
||||
},
|
||||
|
||||
[block_dirt] = {
|
||||
.color = { 255, 255, 255, 255 },
|
||||
.is_transparent = false,
|
||||
.texture = {
|
||||
.top = dirt_texture, .bottom = dirt_texture,
|
||||
.front = dirt_texture, .back = dirt_texture,
|
||||
.left = dirt_texture, .right = dirt_texture
|
||||
}
|
||||
},
|
||||
|
||||
[block_grass] = {
|
||||
.color = { 255, 255, 255, 255 },
|
||||
.is_transparent = false,
|
||||
.texture = {
|
||||
.top = grass_top_texture, .bottom = dirt_texture,
|
||||
.front = grass_side_texture, .back = grass_side_texture,
|
||||
.left = grass_side_texture, .right = grass_side_texture
|
||||
}
|
||||
},
|
||||
|
||||
[block_stone] = {
|
||||
.color = { 255, 255, 255, 255 },
|
||||
.is_transparent = false,
|
||||
.texture = {
|
||||
.top = stone_texture, .bottom = stone_texture,
|
||||
.front = stone_texture, .back = stone_texture,
|
||||
.left = stone_texture, .right = stone_texture
|
||||
}
|
||||
},
|
||||
|
||||
[block_wood] = {
|
||||
.color = { 255, 255, 255, 255 },
|
||||
.is_transparent = false,
|
||||
.texture = {
|
||||
.top = wood_texture, .bottom = wood_texture,
|
||||
.front = wood_texture, .back = wood_texture,
|
||||
.left = wood_texture, .right = wood_texture
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
8
source_code/block_module/block/_internal/private_block.h
Normal file
8
source_code/block_module/block/_internal/private_block.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef private_block_h
|
||||
#define private_block_h
|
||||
|
||||
#include "block.h"
|
||||
|
||||
extern const block_render_data_struct _block_library[];
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user