MCPcopy Create free account
hub / github.com/CelestiaProject/Celestia / LoadHeightMapFromFile

Function LoadHeightMapFromFile

src/celengine/texture.cpp:1068–1086  ·  view source on GitHub ↗

Load a height map texture from a file and convert it to a normal map.

Source from the content-addressed store, hash-verified

1066
1067// Load a height map texture from a file and convert it to a normal map.
1068Texture* LoadHeightMapFromFile(const string& filename,
1069 float height,
1070 Texture::AddressMode addressMode)
1071{
1072 Image* img = LoadImageFromFile(filename);
1073 if (img == NULL)
1074 return NULL;
1075 Image* normalMap = img->computeNormalMap(height,
1076 addressMode == Texture::Wrap);
1077 delete img;
1078 if (normalMap == NULL)
1079 return NULL;
1080
1081 Texture* tex = CreateTextureFromImage(*normalMap, addressMode,
1082 Texture::DefaultMipMaps);
1083 delete normalMap;
1084
1085 return tex;
1086}

Callers 1

loadMethod · 0.85

Calls 3

LoadImageFromFileFunction · 0.85
CreateTextureFromImageFunction · 0.85
computeNormalMapMethod · 0.80

Tested by

no test coverage detected