diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/WallTile_SPU.h | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/WallTile_SPU.h')
| -rw-r--r-- | Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/WallTile_SPU.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/WallTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/WallTile_SPU.h new file mode 100644 index 00000000..98e215d2 --- /dev/null +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/WallTile_SPU.h @@ -0,0 +1,105 @@ +#pragma once + +#include "Tile_SPU.h" + +class WallTile_SPU : public Tile_SPU +{ +public: + static const float WALL_WIDTH = 3.0f / 16.0f; + static const float WALL_HEIGHT = 13.0f / 16.0f; + static const float POST_WIDTH = 4.0f / 16.0f; + static const float POST_HEIGHT = 16.0f / 16.0f; + + + static const int TYPE_NORMAL = 0; + static const int TYPE_MOSSY = 1; + + static const unsigned int COBBLE_NAMES[2]; + + WallTile_SPU(int id) : Tile_SPU(id) {} + + Icon_SPU *getTexture(int face, int data) + { + if (data == TYPE_MOSSY) + { + return TileRef_SPU(mossStone_Id)->getTexture(face); + } + return TileRef_SPU(stoneBrick_Id)->getTexture(face); + + } + int getRenderShape() { return SHAPE_WALL; } + bool isCubeShaped() { return false; } + bool isSolidRender(bool isServerLevel = false) { return false; } + void updateShape(ChunkRebuildData *level, int x, int y, int z) + { + bool n = connectsTo(level, x, y, z - 1); + bool s = connectsTo(level, x, y, z + 1); + bool w = connectsTo(level, x - 1, y, z); + bool e = connectsTo(level, x + 1, y, z); + + float west = .5f - POST_WIDTH; + float east = .5f + POST_WIDTH; + float north = .5f - POST_WIDTH; + float south = .5f + POST_WIDTH; + float up = POST_HEIGHT; + + if (n) + { + north = 0; + } + if (s) + { + south = 1; + } + if (w) + { + west = 0; + } + if (e) + { + east = 1; + } + + if (n && s && !w && !e) + { + up = WALL_HEIGHT; + west = .5f - WALL_WIDTH; + east = .5f + WALL_WIDTH; + } + else if (!n && !s && w && e) + { + up = WALL_HEIGHT; + north = .5f - WALL_WIDTH; + south = .5f + WALL_WIDTH; + } + + setShape(west, 0, north, east, up, south); + } + bool connectsTo(ChunkRebuildData *level, int x, int y, int z) + { + int tile = level->getTile(x, y, z); + if (tile == id || tile == Tile_SPU::fenceGate_Id) + { + return true; + } + TileRef_SPU tileInstance(tile); + if (tileInstance.getPtr() != NULL) + { + if (tileInstance->getMaterial()->isSolidBlocking() && tileInstance->isCubeShaped()) + { + return tileInstance->getMaterial()->getID() != Material_SPU::vegetable_Id; + } + } + return false; + + } + bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face) + { + if (face == Facing::DOWN) + { + return Tile_SPU::shouldRenderFace(level, x, y, z, face); + } + return true; + + } +};
\ No newline at end of file |
