MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / EvaluateBlock

Function EvaluateBlock

Descent3/TerrainSearch.cpp:852–876  ·  view source on GitHub ↗

Returns 1 if the given block (specified by the upper left corder x,z) lod can be simplified Returns -1 if the block is invisible Returns 0 if not

Source from the content-addressed store, hash-verified

850// Returns -1 if the block is invisible
851// Returns 0 if not
852int EvaluateBlock(int x, int z, int lod) {
853 float delta;
854 int simplemul = 1 << ((MAX_TERRAIN_LOD - 1) - lod);
855
856#if (defined(EDITOR) || defined(NEWEDITOR))
857 if (View_mode == EDITOR_MODE && Editor_LOD_engine_off)
858 return 0;
859#endif
860
861 if (View_mode != EDITOR_MODE && Terrain_LOD_engine_off)
862 return 0;
863
864 delta = TerrainDeltaBlocks[lod][((z / simplemul) * (TERRAIN_WIDTH / simplemul)) + (x / simplemul)];
865
866 if (delta == SHUTOFF_LOD_INVISIBLE)
867 return -1; // This block is completely invisible
868
869 // if (SimplifyVertexSlow (x+(simplemul/2),z+(simplemul/2),delta))
870 // return 1;
871
872 if (SimplifyVertex(x + (simplemul / 2), z + (simplemul / 2), delta))
873 return 1;
874
875 return 0;
876}
877
878// Shuts off LOD for a given cell
879void TurnOffLODForCell(int cellnum) {

Callers 1

SearchQuadTreeFunction · 0.85

Calls 1

SimplifyVertexFunction · 0.85

Tested by

no test coverage detected