Skip to content

Commit

Permalink
Renderer|Environment: Fall back to "texture.reflect.default"
Browse files Browse the repository at this point in the history
If no map-specific reflections are found, use "texture.reflect.default"
if that is found instead.
  • Loading branch information
skyjake committed Feb 17, 2016
1 parent 158e754 commit e62fd0a
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions doomsday/apps/client/src/render/environ.cpp
Expand Up @@ -28,6 +28,7 @@

using namespace de;

static String const ID_DEFAULT ("default");
static String const DEF_PATH ("path");
static String const DEF_INTERIOR_PATH("interior.path");
static String const DEF_EXTERIOR_PATH("exterior.path");
Expand Down Expand Up @@ -165,16 +166,27 @@ DENG2_PIMPL(Environment)
auto found = maps.constFind(mapId);
if(found != maps.constEnd())
{
EnvMaps const &env = found.value();
DENG2_ASSERT(!(env.interior.isEmpty() && env.exterior.isEmpty()));

if(!env.exterior.isEmpty())
loadEnvMaps(found.value());
}
else
{
// Maybe the default maps, then?
found = maps.constFind(ID_DEFAULT);
if(found != maps.constEnd())
{
loadCubeMap(reflectionTextures[Exterior], env.exterior);
loadEnvMaps(found.value());
}
}
}

loadCubeMap(reflectionTextures[Interior], env.interior);
void loadEnvMaps(EnvMaps const &env)
{
DENG2_ASSERT(!(env.interior.isEmpty() && env.exterior.isEmpty()));
if(!env.exterior.isEmpty())
{
loadCubeMap(reflectionTextures[Exterior], env.exterior);
}
loadCubeMap(reflectionTextures[Interior], env.interior);
}
};

Expand Down

0 comments on commit e62fd0a

Please sign in to comment.