get rid of lightmapMap

This commit is contained in:
SamGondelman 2019-06-07 14:51:24 -07:00
parent 96aa7e38d9
commit 129d96a997
14 changed files with 62 additions and 62 deletions

View file

@ -257,7 +257,7 @@ ShapeKey MaterialEntityRenderer::getShapeKey() {
bool isTranslucent = drawMaterialKey.isTranslucent(); bool isTranslucent = drawMaterialKey.isTranslucent();
bool hasTangents = drawMaterialKey.isNormalMap(); bool hasTangents = drawMaterialKey.isNormalMap();
bool hasLightmap = drawMaterialKey.isLightmapMap(); bool hasLightmap = drawMaterialKey.isLightMap();
bool isUnlit = drawMaterialKey.isUnlit(); bool isUnlit = drawMaterialKey.isUnlit();
ShapeKey::Builder builder; ShapeKey::Builder builder;
@ -270,7 +270,7 @@ ShapeKey MaterialEntityRenderer::getShapeKey() {
builder.withTangents(); builder.withTangents();
} }
if (hasLightmap) { if (hasLightmap) {
builder.withLightmap(); builder.withLightMap();
} }
if (isUnlit) { if (isUnlit) {
builder.withUnlit(); builder.withUnlit();

View file

@ -197,7 +197,7 @@ ShapeKey ShapeEntityRenderer::getShapeKey() {
bool isTranslucent = drawMaterialKey.isTranslucent(); bool isTranslucent = drawMaterialKey.isTranslucent();
bool hasTangents = drawMaterialKey.isNormalMap(); bool hasTangents = drawMaterialKey.isNormalMap();
bool hasLightmap = drawMaterialKey.isLightmapMap(); bool hasLightmap = drawMaterialKey.isLightMap();
bool isUnlit = drawMaterialKey.isUnlit(); bool isUnlit = drawMaterialKey.isUnlit();
ShapeKey::Builder builder; ShapeKey::Builder builder;
@ -210,7 +210,7 @@ ShapeKey ShapeEntityRenderer::getShapeKey() {
builder.withTangents(); builder.withTangents();
} }
if (hasLightmap) { if (hasLightmap) {
builder.withLightmap(); builder.withLightMap();
} }
if (isUnlit) { if (isUnlit) {
builder.withUnlit(); builder.withUnlit();

View file

@ -88,7 +88,7 @@ private:
// emissive, albedo // emissive, albedo
// urls to textures: // urls to textures:
// emissiveMap, albedoMap (set opacityMap = albedoMap for transparency), metallicMap or specularMap, roughnessMap or glossMap, // emissiveMap, albedoMap (set opacityMap = albedoMap for transparency), metallicMap or specularMap, roughnessMap or glossMap,
// normalMap or bumpMap, occlusionMap, lightmapMap (broken, FIXME), scatteringMap (only works if normal mapped) // normalMap or bumpMap, occlusionMap, lightMap (broken, FIXME), scatteringMap (only works if normal mapped)
QString _materialURL; QString _materialURL;
// Type of material. "uv" or "projected". // Type of material. "uv" or "projected".
MaterialMappingMode _materialMappingMode { UV }; MaterialMappingMode _materialMappingMode { UV };

View file

@ -57,7 +57,7 @@ namespace scriptable {
* @property {string} normalMap * @property {string} normalMap
* @property {string} bumpMap * @property {string} bumpMap
* @property {string} occlusionMap * @property {string} occlusionMap
* @property {string} lightmapMap * @property {string} lightMap
* @property {string} scatteringMap * @property {string} scatteringMap
* @property {Mat4|string} texCoordTransform0 * @property {Mat4|string} texCoordTransform0
* @property {Mat4|string} texCoordTransform1 * @property {Mat4|string} texCoordTransform1
@ -91,7 +91,7 @@ namespace scriptable {
QString normalMap; QString normalMap;
QString bumpMap; QString bumpMap;
QString occlusionMap; QString occlusionMap;
QString lightmapMap; QString lightMap;
QString scatteringMap; QString scatteringMap;
std::array<glm::mat4, graphics::Material::NUM_TEXCOORD_TRANSFORMS> texCoordTransforms; std::array<glm::mat4, graphics::Material::NUM_TEXCOORD_TRANSFORMS> texCoordTransforms;

View file

@ -430,10 +430,10 @@ namespace scriptable {
obj.setProperty("occlusionMap", material.occlusionMap); obj.setProperty("occlusionMap", material.occlusionMap);
} }
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::LIGHTMAP_MAP_BIT)) { if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::LIGHT_MAP_BIT)) {
obj.setProperty("lightmapMap", FALLTHROUGH); obj.setProperty("lightMap", FALLTHROUGH);
} else if (!material.lightmapMap.isEmpty()) { } else if (!material.lightMap.isEmpty()) {
obj.setProperty("lightmapMap", material.lightmapMap); obj.setProperty("lightMap", material.lightMap);
} }
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::SCATTERING_MAP_BIT)) { if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::SCATTERING_MAP_BIT)) {

View file

@ -39,7 +39,7 @@ scriptable::ScriptableMaterial& scriptable::ScriptableMaterial::operator=(const
normalMap = material.normalMap; normalMap = material.normalMap;
bumpMap = material.bumpMap; bumpMap = material.bumpMap;
occlusionMap = material.occlusionMap; occlusionMap = material.occlusionMap;
lightmapMap = material.lightmapMap; lightMap = material.lightMap;
scatteringMap = material.scatteringMap; scatteringMap = material.scatteringMap;
defaultFallthrough = material.defaultFallthrough; defaultFallthrough = material.defaultFallthrough;
@ -110,9 +110,9 @@ scriptable::ScriptableMaterial::ScriptableMaterial(const graphics::MaterialPoint
occlusionMap = map->getTextureSource()->getUrl().toString(); occlusionMap = map->getTextureSource()->getUrl().toString();
} }
map = material->getTextureMap(graphics::Material::MapChannel::LIGHTMAP_MAP); map = material->getTextureMap(graphics::Material::MapChannel::LIGHT_MAP);
if (map && map->getTextureSource()) { if (map && map->getTextureSource()) {
lightmapMap = map->getTextureSource()->getUrl().toString(); lightMap = map->getTextureSource()->getUrl().toString();
} }
map = material->getTextureMap(graphics::Material::MapChannel::SCATTERING_MAP); map = material->getTextureMap(graphics::Material::MapChannel::SCATTERING_MAP);

View file

@ -129,7 +129,7 @@ void Material::setTextureMap(MapChannel channel, const TextureMapPointer& textur
_texcoordTransforms[1] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4()); _texcoordTransforms[1] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4());
} }
if (channel == MaterialKey::LIGHTMAP_MAP) { if (channel == MaterialKey::LIGHT_MAP) {
// update the texcoord1 with lightmap // update the texcoord1 with lightmap
_texcoordTransforms[1] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4()); _texcoordTransforms[1] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4());
_lightmapParams = (textureMap ? glm::vec2(textureMap->getLightmapOffsetScale()) : glm::vec2(0.0, 1.0)); _lightmapParams = (textureMap ? glm::vec2(textureMap->getLightmapOffsetScale()) : glm::vec2(0.0, 1.0));

View file

@ -53,7 +53,7 @@ public:
ROUGHNESS_MAP_BIT, ROUGHNESS_MAP_BIT,
NORMAL_MAP_BIT, NORMAL_MAP_BIT,
OCCLUSION_MAP_BIT, OCCLUSION_MAP_BIT,
LIGHTMAP_MAP_BIT, LIGHT_MAP_BIT,
SCATTERING_MAP_BIT, SCATTERING_MAP_BIT,
NUM_FLAGS, NUM_FLAGS,
@ -67,7 +67,7 @@ public:
ROUGHNESS_MAP, ROUGHNESS_MAP,
NORMAL_MAP, NORMAL_MAP,
OCCLUSION_MAP, OCCLUSION_MAP,
LIGHTMAP_MAP, LIGHT_MAP,
SCATTERING_MAP, SCATTERING_MAP,
NUM_MAP_CHANNELS, NUM_MAP_CHANNELS,
@ -107,7 +107,7 @@ public:
Builder& withNormalMap() { _flags.set(NORMAL_MAP_BIT); return (*this); } Builder& withNormalMap() { _flags.set(NORMAL_MAP_BIT); return (*this); }
Builder& withOcclusionMap() { _flags.set(OCCLUSION_MAP_BIT); return (*this); } Builder& withOcclusionMap() { _flags.set(OCCLUSION_MAP_BIT); return (*this); }
Builder& withLightmapMap() { _flags.set(LIGHTMAP_MAP_BIT); return (*this); } Builder& withLightMap() { _flags.set(LIGHT_MAP_BIT); return (*this); }
Builder& withScatteringMap() { _flags.set(SCATTERING_MAP_BIT); return (*this); } Builder& withScatteringMap() { _flags.set(SCATTERING_MAP_BIT); return (*this); }
// Convenient standard keys that we will keep on using all over the place // Convenient standard keys that we will keep on using all over the place
@ -157,8 +157,8 @@ public:
void setOcclusionMap(bool value) { _flags.set(OCCLUSION_MAP_BIT, value); } void setOcclusionMap(bool value) { _flags.set(OCCLUSION_MAP_BIT, value); }
bool isOcclusionMap() const { return _flags[OCCLUSION_MAP_BIT]; } bool isOcclusionMap() const { return _flags[OCCLUSION_MAP_BIT]; }
void setLightmapMap(bool value) { _flags.set(LIGHTMAP_MAP_BIT, value); } void setLightMap(bool value) { _flags.set(LIGHT_MAP_BIT, value); }
bool isLightmapMap() const { return _flags[LIGHTMAP_MAP_BIT]; } bool isLightMap() const { return _flags[LIGHT_MAP_BIT]; }
void setScattering(bool value) { _flags.set(SCATTERING_VAL_BIT, value); } void setScattering(bool value) { _flags.set(SCATTERING_VAL_BIT, value); }
bool isScattering() const { return _flags[SCATTERING_VAL_BIT]; } bool isScattering() const { return _flags[SCATTERING_VAL_BIT]; }
@ -235,8 +235,8 @@ public:
Builder& withoutOcclusionMap() { _value.reset(MaterialKey::OCCLUSION_MAP_BIT); _mask.set(MaterialKey::OCCLUSION_MAP_BIT); return (*this); } Builder& withoutOcclusionMap() { _value.reset(MaterialKey::OCCLUSION_MAP_BIT); _mask.set(MaterialKey::OCCLUSION_MAP_BIT); return (*this); }
Builder& withOcclusionMap() { _value.set(MaterialKey::OCCLUSION_MAP_BIT); _mask.set(MaterialKey::OCCLUSION_MAP_BIT); return (*this); } Builder& withOcclusionMap() { _value.set(MaterialKey::OCCLUSION_MAP_BIT); _mask.set(MaterialKey::OCCLUSION_MAP_BIT); return (*this); }
Builder& withoutLightmapMap() { _value.reset(MaterialKey::LIGHTMAP_MAP_BIT); _mask.set(MaterialKey::LIGHTMAP_MAP_BIT); return (*this); } Builder& withoutLightMap() { _value.reset(MaterialKey::LIGHT_MAP_BIT); _mask.set(MaterialKey::LIGHT_MAP_BIT); return (*this); }
Builder& withLightmapMap() { _value.set(MaterialKey::LIGHTMAP_MAP_BIT); _mask.set(MaterialKey::LIGHTMAP_MAP_BIT); return (*this); } Builder& withLightMap() { _value.set(MaterialKey::LIGHT_MAP_BIT); _mask.set(MaterialKey::LIGHT_MAP_BIT); return (*this); }
Builder& withoutScattering() { _value.reset(MaterialKey::SCATTERING_VAL_BIT); _mask.set(MaterialKey::SCATTERING_VAL_BIT); return (*this); } Builder& withoutScattering() { _value.reset(MaterialKey::SCATTERING_VAL_BIT); _mask.set(MaterialKey::SCATTERING_VAL_BIT); return (*this); }
Builder& withScattering() { _value.set(MaterialKey::SCATTERING_VAL_BIT); _mask.set(MaterialKey::SCATTERING_VAL_BIT); return (*this); } Builder& withScattering() { _value.set(MaterialKey::SCATTERING_VAL_BIT); _mask.set(MaterialKey::SCATTERING_VAL_BIT); return (*this); }

View file

@ -178,7 +178,7 @@ float fetchScatteringMap(vec2 uv) {
float <$occlusion$> = mix(1.0, fetchOcclusionMap(<$texcoord1$>), float((<$matKey$> & OCCLUSION_MAP_BIT) != 0)); float <$occlusion$> = mix(1.0, fetchOcclusionMap(<$texcoord1$>), float((<$matKey$> & OCCLUSION_MAP_BIT) != 0));
<@endif@> <@endif@>
<@if lightmap@> <@if lightmap@>
vec3 <$lightmap$> = fetchLightmapMap(<$texcoord1$>); vec3 <$lightmap$> = fetchLightMap(<$texcoord1$>);
<@endif@> <@endif@>
<@endfunc@> <@endfunc@>
@ -189,7 +189,7 @@ float fetchScatteringMap(vec2 uv) {
<$declareMaterialTexMapArrayBuffer()$> <$declareMaterialTexMapArrayBuffer()$>
LAYOUT(binding=GRAPHICS_TEXTURE_MATERIAL_EMISSIVE_LIGHTMAP) uniform sampler2D emissiveMap; LAYOUT(binding=GRAPHICS_TEXTURE_MATERIAL_EMISSIVE_LIGHTMAP) uniform sampler2D emissiveMap;
vec3 fetchLightmapMap(vec2 uv) { vec3 fetchLightMap(vec2 uv) {
vec2 lightmapParams = getTexMapArray()._lightmapParams; vec2 lightmapParams = getTexMapArray()._lightmapParams;
return (vec3(lightmapParams.x) + lightmapParams.y * texture(emissiveMap, uv).rgb); return (vec3(lightmapParams.x) + lightmapParams.y * texture(emissiveMap, uv).rgb);
} }

View file

@ -362,9 +362,9 @@ std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource
if (value.isString()) { if (value.isString()) {
auto valueString = value.toString(); auto valueString = value.toString();
if (valueString == FALLTHROUGH) { if (valueString == FALLTHROUGH) {
material->setPropertyDoesFallthrough(graphics::MaterialKey::FlagBit::LIGHTMAP_MAP_BIT); material->setPropertyDoesFallthrough(graphics::MaterialKey::FlagBit::LIGHT_MAP_BIT);
} else { } else {
material->setLightmapMap(baseUrl.resolved(valueString)); material->setLightMap(baseUrl.resolved(valueString));
} }
} }
} else if (key == "texCoordTransform0") { } else if (key == "texCoordTransform0") {
@ -567,12 +567,12 @@ void NetworkMaterial::setScatteringMap(const QUrl& url) {
} }
} }
void NetworkMaterial::setLightmapMap(const QUrl& url) { void NetworkMaterial::setLightMap(const QUrl& url) {
auto map = fetchTextureMap(url, image::TextureUsage::LIGHTMAP_TEXTURE, MapChannel::LIGHTMAP_MAP); auto map = fetchTextureMap(url, image::TextureUsage::LIGHTMAP_TEXTURE, MapChannel::LIGHT_MAP);
if (map) { if (map) {
//map->setTextureTransform(_lightmapTransform); //map->setTextureTransform(_lightmapTransform);
//map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); //map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y);
setTextureMap(MapChannel::LIGHTMAP_MAP, map); setTextureMap(MapChannel::LIGHT_MAP, map);
} }
} }
@ -640,14 +640,14 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur
} }
if (!material.lightmapTexture.filename.isEmpty()) { if (!material.lightmapTexture.filename.isEmpty()) {
auto map = fetchTextureMap(textureBaseUrl, material.lightmapTexture, image::TextureUsage::LIGHTMAP_TEXTURE, MapChannel::LIGHTMAP_MAP); auto map = fetchTextureMap(textureBaseUrl, material.lightmapTexture, image::TextureUsage::LIGHTMAP_TEXTURE, MapChannel::LIGHT_MAP);
if (map) { if (map) {
_lightmapTransform = material.lightmapTexture.transform; _lightmapTransform = material.lightmapTexture.transform;
_lightmapParams = material.lightmapParams; _lightmapParams = material.lightmapParams;
map->setTextureTransform(_lightmapTransform); map->setTextureTransform(_lightmapTransform);
map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y);
} }
setTextureMap(MapChannel::LIGHTMAP_MAP, map); setTextureMap(MapChannel::LIGHT_MAP, map);
} }
} }
@ -660,7 +660,7 @@ void NetworkMaterial::setTextures(const QVariantMap& textureMap) {
const auto& metallicName = getTextureName(MapChannel::METALLIC_MAP); const auto& metallicName = getTextureName(MapChannel::METALLIC_MAP);
const auto& occlusionName = getTextureName(MapChannel::OCCLUSION_MAP); const auto& occlusionName = getTextureName(MapChannel::OCCLUSION_MAP);
const auto& emissiveName = getTextureName(MapChannel::EMISSIVE_MAP); const auto& emissiveName = getTextureName(MapChannel::EMISSIVE_MAP);
const auto& lightmapName = getTextureName(MapChannel::LIGHTMAP_MAP); const auto& lightmapName = getTextureName(MapChannel::LIGHT_MAP);
const auto& scatteringName = getTextureName(MapChannel::SCATTERING_MAP); const auto& scatteringName = getTextureName(MapChannel::SCATTERING_MAP);
if (!albedoName.isEmpty()) { if (!albedoName.isEmpty()) {
@ -715,12 +715,12 @@ void NetworkMaterial::setTextures(const QVariantMap& textureMap) {
if (!lightmapName.isEmpty()) { if (!lightmapName.isEmpty()) {
auto url = textureMap.contains(lightmapName) ? textureMap[lightmapName].toUrl() : QUrl(); auto url = textureMap.contains(lightmapName) ? textureMap[lightmapName].toUrl() : QUrl();
auto map = fetchTextureMap(url, image::TextureUsage::LIGHTMAP_TEXTURE, MapChannel::LIGHTMAP_MAP); auto map = fetchTextureMap(url, image::TextureUsage::LIGHTMAP_TEXTURE, MapChannel::LIGHT_MAP);
if (map) { if (map) {
map->setTextureTransform(_lightmapTransform); map->setTextureTransform(_lightmapTransform);
map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y);
} }
setTextureMap(MapChannel::LIGHTMAP_MAP, map); setTextureMap(MapChannel::LIGHT_MAP, map);
} }
} }

View file

@ -31,7 +31,7 @@ public:
void setOcclusionMap(const QUrl& url); void setOcclusionMap(const QUrl& url);
void setEmissiveMap(const QUrl& url); void setEmissiveMap(const QUrl& url);
void setScatteringMap(const QUrl& url); void setScatteringMap(const QUrl& url);
void setLightmapMap(const QUrl& url); void setLightMap(const QUrl& url);
bool isMissingTexture(); bool isMissingTexture();
void checkResetOpacityMap(); void checkResetOpacityMap();

View file

@ -115,8 +115,8 @@ ShapeKey MeshPartPayload::getShapeKey() const {
if (drawMaterialKey.isNormalMap()) { if (drawMaterialKey.isNormalMap()) {
builder.withTangents(); builder.withTangents();
} }
if (drawMaterialKey.isLightmapMap()) { if (drawMaterialKey.isLightMap()) {
builder.withLightmap(); builder.withLightMap();
} }
return builder.build(); return builder.build();
} }
@ -354,7 +354,7 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, PrimitiveMode pr
bool isTranslucent = drawMaterialKey.isTranslucent(); bool isTranslucent = drawMaterialKey.isTranslucent();
bool hasTangents = drawMaterialKey.isNormalMap() && _hasTangents; bool hasTangents = drawMaterialKey.isNormalMap() && _hasTangents;
bool hasLightmap = drawMaterialKey.isLightmapMap(); bool hasLightmap = drawMaterialKey.isLightMap();
bool isUnlit = drawMaterialKey.isUnlit(); bool isUnlit = drawMaterialKey.isUnlit();
bool isDeformed = _isBlendShaped || _isSkinned; bool isDeformed = _isBlendShaped || _isSkinned;
@ -374,7 +374,7 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, PrimitiveMode pr
builder.withTangents(); builder.withTangents();
} }
if (hasLightmap) { if (hasLightmap) {
builder.withLightmap(); builder.withLightMap();
} }
if (isUnlit) { if (isUnlit) {
builder.withUnlit(); builder.withUnlit();

View file

@ -107,7 +107,7 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip
model_translucent_normal_map, nullptr, nullptr); model_translucent_normal_map, nullptr, nullptr);
addPipeline( addPipeline(
// FIXME: Ignore lightmap for translucents meshpart // FIXME: Ignore lightmap for translucents meshpart
Key::Builder().withMaterial().withTranslucent().withLightmap(), Key::Builder().withMaterial().withTranslucent().withLightMap(),
model_translucent, nullptr, nullptr); model_translucent, nullptr, nullptr);
// Same thing but with Fade on // Same thing but with Fade on
addPipeline( addPipeline(
@ -127,21 +127,21 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip
model_translucent_normal_map_fade, batchSetter, itemSetter); model_translucent_normal_map_fade, batchSetter, itemSetter);
addPipeline( addPipeline(
// FIXME: Ignore lightmap for translucents meshpart // FIXME: Ignore lightmap for translucents meshpart
Key::Builder().withMaterial().withTranslucent().withLightmap().withFade(), Key::Builder().withMaterial().withTranslucent().withLightMap().withFade(),
model_translucent_fade, batchSetter, itemSetter); model_translucent_fade, batchSetter, itemSetter);
// Lightmapped // Lightmapped
addPipeline( addPipeline(
Key::Builder().withMaterial().withLightmap(), Key::Builder().withMaterial().withLightMap(),
model_lightmap, nullptr, nullptr); model_lightmap, nullptr, nullptr);
addPipeline( addPipeline(
Key::Builder().withMaterial().withLightmap().withTangents(), Key::Builder().withMaterial().withLightMap().withTangents(),
model_lightmap_normal_map, nullptr, nullptr); model_lightmap_normal_map, nullptr, nullptr);
// Same thing but with Fade on // Same thing but with Fade on
addPipeline( addPipeline(
Key::Builder().withMaterial().withLightmap().withFade(), Key::Builder().withMaterial().withLightMap().withFade(),
model_lightmap_fade, batchSetter, itemSetter); model_lightmap_fade, batchSetter, itemSetter);
addPipeline( addPipeline(
Key::Builder().withMaterial().withLightmap().withTangents().withFade(), Key::Builder().withMaterial().withLightMap().withTangents().withFade(),
model_lightmap_normal_map_fade, batchSetter, itemSetter); model_lightmap_normal_map_fade, batchSetter, itemSetter);
// matrix palette skinned // matrix palette skinned
@ -228,10 +228,10 @@ void initForwardPipelines(ShapePlumber& plumber) {
// Opaques // Opaques
addPipeline(Key::Builder().withMaterial(), program::forward_model); addPipeline(Key::Builder().withMaterial(), program::forward_model);
addPipeline(Key::Builder().withMaterial().withLightmap(), program::forward_model_lightmap); addPipeline(Key::Builder().withMaterial().withLightMap(), program::forward_model_lightmap);
addPipeline(Key::Builder().withMaterial().withUnlit(), program::forward_model_unlit); addPipeline(Key::Builder().withMaterial().withUnlit(), program::forward_model_unlit);
addPipeline(Key::Builder().withMaterial().withTangents(), program::forward_model_normal_map); addPipeline(Key::Builder().withMaterial().withTangents(), program::forward_model_normal_map);
addPipeline(Key::Builder().withMaterial().withTangents().withLightmap(), program::forward_model_normal_map_lightmap); addPipeline(Key::Builder().withMaterial().withTangents().withLightMap(), program::forward_model_normal_map_lightmap);
// Deformed Opaques // Deformed Opaques
addPipeline(Key::Builder().withMaterial().withDeformed(), program::forward_deformed_model); addPipeline(Key::Builder().withMaterial().withDeformed(), program::forward_deformed_model);
@ -581,7 +581,7 @@ void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial
break; break;
case graphics::MaterialKey::EMISSIVE_MAP_BIT: case graphics::MaterialKey::EMISSIVE_MAP_BIT:
// Lightmap takes precendence over emissive map for legacy reasons // Lightmap takes precendence over emissive map for legacy reasons
if (materialKey.isEmissiveMap() && !materialKey.isLightmapMap()) { if (materialKey.isEmissiveMap() && !materialKey.isLightMap()) {
auto itr = textureMaps.find(graphics::MaterialKey::EMISSIVE_MAP); auto itr = textureMaps.find(graphics::MaterialKey::EMISSIVE_MAP);
if (itr != textureMaps.end()) { if (itr != textureMaps.end()) {
if (itr->second->isDefined()) { if (itr->second->isDefined()) {
@ -595,14 +595,14 @@ void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial
forceDefault = true; forceDefault = true;
} }
schemaKey.setEmissiveMap(true); schemaKey.setEmissiveMap(true);
} else if (materialKey.isLightmapMap()) { } else if (materialKey.isLightMap()) {
// We'll set this later when we check the lightmap // We'll set this later when we check the lightmap
wasSet = true; wasSet = true;
} }
break; break;
case graphics::MaterialKey::LIGHTMAP_MAP_BIT: case graphics::MaterialKey::LIGHT_MAP_BIT:
if (materialKey.isLightmapMap()) { if (materialKey.isLightMap()) {
auto itr = textureMaps.find(graphics::MaterialKey::LIGHTMAP_MAP); auto itr = textureMaps.find(graphics::MaterialKey::LIGHT_MAP);
if (itr != textureMaps.end()) { if (itr != textureMaps.end()) {
if (itr->second->isDefined()) { if (itr->second->isDefined()) {
drawMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, itr->second->getTextureView()); drawMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, itr->second->getTextureView());
@ -614,7 +614,7 @@ void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial
} else { } else {
forceDefault = true; forceDefault = true;
} }
schemaKey.setLightmapMap(true); schemaKey.setLightMap(true);
} }
break; break;
case graphics::Material::TEXCOORDTRANSFORM0: case graphics::Material::TEXCOORDTRANSFORM0:
@ -712,12 +712,12 @@ void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial
} }
break; break;
case graphics::MaterialKey::EMISSIVE_MAP_BIT: case graphics::MaterialKey::EMISSIVE_MAP_BIT:
if (schemaKey.isEmissiveMap() && !schemaKey.isLightmapMap()) { if (schemaKey.isEmissiveMap() && !schemaKey.isLightMap()) {
drawMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, textureCache->getGrayTexture()); drawMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, textureCache->getGrayTexture());
} }
break; break;
case graphics::MaterialKey::LIGHTMAP_MAP_BIT: case graphics::MaterialKey::LIGHT_MAP_BIT:
if (schemaKey.isLightmapMap()) { if (schemaKey.isLightMap()) {
drawMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, textureCache->getBlackTexture()); drawMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, textureCache->getBlackTexture());
} }
break; break;
@ -765,7 +765,7 @@ bool RenderPipelines::bindMaterials(graphics::MultiMaterial& multiMaterial, gpu:
batch.setResourceTextureTable(multiMaterial.getTextureTable()); batch.setResourceTextureTable(multiMaterial.getTextureTable());
} else { } else {
if (renderMode != render::Args::RenderMode::SHADOW_RENDER_MODE) { if (renderMode != render::Args::RenderMode::SHADOW_RENDER_MODE) {
if (key.isLightmapMap()) { if (key.isLightMap()) {
defaultMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, textureCache->getBlackTexture()); defaultMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, textureCache->getBlackTexture());
} else if (key.isEmissiveMap()) { } else if (key.isEmissiveMap()) {
defaultMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, textureCache->getGrayTexture()); defaultMaterialTextures->setTexture(gr::Texture::MaterialEmissiveLightmap, textureCache->getGrayTexture());

View file

@ -74,7 +74,7 @@ public:
Builder& withMaterial() { _flags.set(MATERIAL); return (*this); } Builder& withMaterial() { _flags.set(MATERIAL); return (*this); }
Builder& withTranslucent() { _flags.set(TRANSLUCENT); return (*this); } Builder& withTranslucent() { _flags.set(TRANSLUCENT); return (*this); }
Builder& withLightmap() { _flags.set(LIGHTMAP); return (*this); } Builder& withLightMap() { _flags.set(LIGHTMAP); return (*this); }
Builder& withTangents() { _flags.set(TANGENTS); return (*this); } Builder& withTangents() { _flags.set(TANGENTS); return (*this); }
Builder& withUnlit() { _flags.set(UNLIT); return (*this); } Builder& withUnlit() { _flags.set(UNLIT); return (*this); }
Builder& withDeformed() { _flags.set(DEFORMED); return (*this); } Builder& withDeformed() { _flags.set(DEFORMED); return (*this); }
@ -116,8 +116,8 @@ public:
Builder& withTranslucent() { _flags.set(TRANSLUCENT); _mask.set(TRANSLUCENT); return (*this); } Builder& withTranslucent() { _flags.set(TRANSLUCENT); _mask.set(TRANSLUCENT); return (*this); }
Builder& withOpaque() { _flags.reset(TRANSLUCENT); _mask.set(TRANSLUCENT); return (*this); } Builder& withOpaque() { _flags.reset(TRANSLUCENT); _mask.set(TRANSLUCENT); return (*this); }
Builder& withLightmap() { _flags.set(LIGHTMAP); _mask.set(LIGHTMAP); return (*this); } Builder& withLightMap() { _flags.set(LIGHTMAP); _mask.set(LIGHTMAP); return (*this); }
Builder& withoutLightmap() { _flags.reset(LIGHTMAP); _mask.set(LIGHTMAP); return (*this); } Builder& withoutLightMap() { _flags.reset(LIGHTMAP); _mask.set(LIGHTMAP); return (*this); }
Builder& withTangents() { _flags.set(TANGENTS); _mask.set(TANGENTS); return (*this); } Builder& withTangents() { _flags.set(TANGENTS); _mask.set(TANGENTS); return (*this); }
Builder& withoutTangents() { _flags.reset(TANGENTS); _mask.set(TANGENTS); return (*this); } Builder& withoutTangents() { _flags.reset(TANGENTS); _mask.set(TANGENTS); return (*this); }
@ -160,7 +160,7 @@ public:
}; };
bool useMaterial() const { return _flags[MATERIAL]; } bool useMaterial() const { return _flags[MATERIAL]; }
bool hasLightmap() const { return _flags[LIGHTMAP]; } bool hasLightMap() const { return _flags[LIGHTMAP]; }
bool hasTangents() const { return _flags[TANGENTS]; } bool hasTangents() const { return _flags[TANGENTS]; }
bool isUnlit() const { return _flags[UNLIT]; } bool isUnlit() const { return _flags[UNLIT]; }
bool isTranslucent() const { return _flags[TRANSLUCENT]; } bool isTranslucent() const { return _flags[TRANSLUCENT]; }
@ -199,7 +199,7 @@ inline QDebug operator<<(QDebug debug, const ShapeKey& key) {
} else { } else {
debug << "[ShapeKey:" debug << "[ShapeKey:"
<< "useMaterial:" << key.useMaterial() << "useMaterial:" << key.useMaterial()
<< "hasLightmap:" << key.hasLightmap() << "hasLightmap:" << key.hasLightMap()
<< "hasTangents:" << key.hasTangents() << "hasTangents:" << key.hasTangents()
<< "isUnlit:" << key.isUnlit() << "isUnlit:" << key.isUnlit()
<< "isTranslucent:" << key.isTranslucent() << "isTranslucent:" << key.isTranslucent()