MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / Load

Method Load

Source/Graphics/terrain.cpp:606–633  ·  view source on GitHub ↗

Load terrain

Source from the content-addressed store, hash-verified

604
605// Load terrain
606void Terrain::Load(const char *name, const std::string &model_override) {
607 minimal = false;
608 heightmap_.LoadData(name, HeightmapImage::DOWNSAMPLED);
609
610 LOGI << "Loading terrain \"" << name << "\"" << std::endl;
611 AddLoadingText("Checking for terrain cache file...");
612
613 if (!LoadCachedSimplifiedTerrain()) {
614 LOGI << "Failed to load cached terrain, calculating a simplified terrain" << std::endl;
615 CalculateSimplifiedTerrain();
616 }
617
618 if (!model_override.empty()) {
619 Model &terrain_simplified_model = Models::Instance()->GetModel(model_id);
620 terrain_simplified_model.LoadObj(model_override, 0);
621 for (float &i : terrain_simplified_model.tex_coords2) {
622 i *= 2048.0f;
623 }
624 }
625
626 LOGI << "*****************" << std::endl;
627
628 CalculatePatches();
629
630 heightmap_.LoadData(heightmap_.path(), HeightmapImage::ORIGINAL_RES);
631
632 terrain_texture_size = heightmap_.width() / Graphics::Instance()->config_.texture_reduction_factor();
633}
634
635void Terrain::LoadMinimal(const char *name, const std::string &model_override) {
636 minimal = true;

Callers 6

ConvertImageFunction · 0.45
GetAverageColorFunction · 0.45
ReloadInternalMethod · 0.45
loadTextureMethod · 0.45
loadArraySliceMethod · 0.45
CalcDetailTexturesMethod · 0.45

Calls 8

AddLoadingTextFunction · 0.85
LoadDataMethod · 0.80
LoadObjMethod · 0.80
emptyMethod · 0.45
GetModelMethod · 0.45
pathMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected