Log Realism: Added authentic multi-texture Oak Logs - v2.1.7
This commit is contained in:
parent
2114e50a9f
commit
b2a36a249b
|
|
@ -13,11 +13,11 @@ MorriCraft is a high-performance voxel engine built with C++ and Raylib. It feat
|
||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
### v2.1.6 - Inventory Insight (Latest)
|
### v2.1.7 - Log Realism (Latest)
|
||||||
* **Item Tooltips**: Added mouse-over names for all inventory and hotbar items.
|
* **Authentic Oak Logs**: Replaced plank-fallback textures with dedicated bark (side) and ring (top) textures.
|
||||||
* **UI Polish**: Dynamic tooltip positioning to ensure labels stay on-screen.
|
* **Multi-Texture Rendering**: Implemented specialized draw calls for logs to support independent side/top textures.
|
||||||
|
|
||||||
### v2.1.5 - Windows Portability
|
### v2.1.6 - Inventory Insight
|
||||||
|
|
||||||
### v2.1.0 - Personalization & Stability
|
### v2.1.0 - Personalization & Stability
|
||||||
* **Integrated Skin Editor**: Personalize your shirt and pants colors directly from the Options menu.
|
* **Integrated Skin Editor**: Personalize your shirt and pants colors directly from the Options menu.
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 450 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 752 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 450 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 752 KiB |
|
|
@ -1 +1 @@
|
||||||
v2.1.6
|
v2.1.7
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 450 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 752 KiB |
|
|
@ -1 +1 @@
|
||||||
v2.1.6
|
v2.1.7
|
||||||
|
|
|
||||||
27
src/main.cpp
27
src/main.cpp
|
|
@ -722,6 +722,24 @@ void DrawCraftingTable(Vector3 position, unsigned int sideTexId, unsigned int to
|
||||||
rlEnd();
|
rlEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawLog(Vector3 position, unsigned int sideTexId, unsigned int topTexId, Color tint) {
|
||||||
|
float x = position.x; float y = position.y; float z = position.z;
|
||||||
|
rlSetTexture(sideTexId);
|
||||||
|
rlBegin(RL_QUADS);
|
||||||
|
rlColor4ub(tint.r, tint.g, tint.b, 255);
|
||||||
|
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x - 0.5f, y - 0.5f, z + 0.5f); rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x + 0.5f, y - 0.5f, z + 0.5f); rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x + 0.5f, y + 0.5f, z + 0.5f); rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x - 0.5f, y + 0.5f, z + 0.5f);
|
||||||
|
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x - 0.5f, y - 0.5f, z - 0.5f); rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x - 0.5f, y + 0.5f, z - 0.5f); rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x + 0.5f, y + 0.5f, z - 0.5f); rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x + 0.5f, y - 0.5f, z - 0.5f);
|
||||||
|
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x + 0.5f, y - 0.5f, z - 0.5f); rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x + 0.5f, y + 0.5f, z - 0.5f); rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x + 0.5f, y + 0.5f, z + 0.5f); rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x + 0.5f, y - 0.5f, z + 0.5f);
|
||||||
|
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x - 0.5f, y - 0.5f, z - 0.5f); rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x - 0.5f, y - 0.5f, z + 0.5f); rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x - 0.5f, y + 0.5f, z + 0.5f); rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x - 0.5f, y + 0.5f, z - 0.5f);
|
||||||
|
rlEnd();
|
||||||
|
rlSetTexture(topTexId);
|
||||||
|
rlBegin(RL_QUADS);
|
||||||
|
rlColor4ub(tint.r, tint.g, tint.b, 255);
|
||||||
|
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x - 0.5f, y + 0.5f, z - 0.5f); rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x - 0.5f, y + 0.5f, z + 0.5f); rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x + 0.5f, y + 0.5f, z + 0.5f); rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x + 0.5f, y + 0.5f, z - 0.5f);
|
||||||
|
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x - 0.5f, y - 0.5f, z - 0.5f); rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x + 0.5f, y - 0.5f, z - 0.5f); rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x + 0.5f, y - 0.5f, z + 0.5f); rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x - 0.5f, y - 0.5f, z + 0.5f);
|
||||||
|
rlEnd();
|
||||||
|
}
|
||||||
|
|
||||||
// Optimized check to see if a block has any exposed faces.
|
// Optimized check to see if a block has any exposed faces.
|
||||||
bool IsExposedOptimized(int lx, int ly, int lz, Chunk* chunk, Chunk* nxM, Chunk* nxP, Chunk* nzM, Chunk* nzP) {
|
bool IsExposedOptimized(int lx, int ly, int lz, Chunk* chunk, Chunk* nxM, Chunk* nxP, Chunk* nzM, Chunk* nzP) {
|
||||||
if (ly > 0) { if (chunk->blocks[lx][ly-1][lz] == AIR) return true; } else return true;
|
if (ly > 0) { if (chunk->blocks[lx][ly-1][lz] == AIR) return true; } else return true;
|
||||||
|
|
@ -940,10 +958,16 @@ int main(void)
|
||||||
Texture2D grassTopTexture = LoadTexture("assets/grass_top.png");
|
Texture2D grassTopTexture = LoadTexture("assets/grass_top.png");
|
||||||
Texture2D craftingSideTexture = LoadTexture("assets/crafting_table_side.png");
|
Texture2D craftingSideTexture = LoadTexture("assets/crafting_table_side.png");
|
||||||
Texture2D craftingTopTexture = LoadTexture("assets/crafting_table_top.png");
|
Texture2D craftingTopTexture = LoadTexture("assets/crafting_table_top.png");
|
||||||
|
Texture2D logSideTexture = LoadTexture("assets/oak_log_side.png");
|
||||||
|
Texture2D logTopTexture = LoadTexture("assets/oak_log_top.png");
|
||||||
|
|
||||||
// Safety Fallback: Use Planks if custom textures failed to load (prevents crash)
|
// Safety Fallback: Use Planks if custom textures failed to load (prevents crash)
|
||||||
if (craftingSideTexture.id == 0) craftingSideTexture = blockTextures[PLANK];
|
if (craftingSideTexture.id == 0) craftingSideTexture = blockTextures[PLANK];
|
||||||
if (craftingTopTexture.id == 0) craftingTopTexture = blockTextures[PLANK];
|
if (craftingTopTexture.id == 0) craftingTopTexture = blockTextures[PLANK];
|
||||||
|
if (logSideTexture.id == 0) logSideTexture = blockTextures[PLANK];
|
||||||
|
if (logTopTexture.id == 0) logTopTexture = blockTextures[PLANK];
|
||||||
|
|
||||||
|
blockTextures[LOG] = logSideTexture; // For inventory preview
|
||||||
blockTextures[CRAFTING_TABLE] = craftingSideTexture; // Preview for inventory
|
blockTextures[CRAFTING_TABLE] = craftingSideTexture; // Preview for inventory
|
||||||
|
|
||||||
blockTextures[STICK] = LoadTexture("assets/stick.png");
|
blockTextures[STICK] = LoadTexture("assets/stick.png");
|
||||||
|
|
@ -2590,6 +2614,9 @@ int main(void)
|
||||||
for (auto& pos : chunk->renderLists[CRAFTING_TABLE]) {
|
for (auto& pos : chunk->renderLists[CRAFTING_TABLE]) {
|
||||||
DrawCraftingTable(pos, craftingSideTexture.id, craftingTopTexture.id, blockTextures[DIRT].id, blockTint);
|
DrawCraftingTable(pos, craftingSideTexture.id, craftingTopTexture.id, blockTextures[DIRT].id, blockTint);
|
||||||
}
|
}
|
||||||
|
for (auto& pos : chunk->renderLists[LOG]) {
|
||||||
|
DrawLog(pos, logSideTexture.id, logTopTexture.id, blockTint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rlSetTexture(blockTextures[renderType].id);
|
rlSetTexture(blockTextures[renderType].id);
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
v2.1.6
|
v2.1.7
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue