MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Block_SetDrawType

Function Block_SetDrawType

src/Block.c:158–168  ·  view source on GitHub ↗

Sets draw type and updates related state (e.g. FullOpaque) for the given block */

Source from the content-addressed store, hash-verified

156
157/* Sets draw type and updates related state (e.g. FullOpaque) for the given block */
158static void Block_SetDrawType(BlockID block, cc_uint8 draw) {
159 if (draw == DRAW_OPAQUE && Blocks.Collide[block] != COLLIDE_SOLID) draw = DRAW_TRANSPARENT;
160 Blocks.Draw[block] = draw;
161 Block_RecalcIsLiquid(block);
162
163 /* Whether a block is opaque and exactly occupies a cell in the world */
164 /* The mesh builder module needs this information for optimisation purposes */
165 Blocks.FullOpaque[block] = draw == DRAW_OPAQUE
166 && Blocks.MinBB[block].x == 0 && Blocks.MinBB[block].y == 0 && Blocks.MinBB[block].z == 0
167 && Blocks.MaxBB[block].x == 1 && Blocks.MaxBB[block].y == 1 && Blocks.MaxBB[block].z == 1;
168}
169
170void Block_SetSide(TextureLoc texLoc, BlockID blockId) {
171 int index = blockId * FACE_COUNT;

Callers 2

Block_DefineCustomFunction · 0.85
Block_ResetPropsFunction · 0.85

Calls 1

Block_RecalcIsLiquidFunction · 0.85

Tested by

no test coverage detected