SL-18134 Rename Albedo to Base Color to be more consistent with GLTF spec
parent
01d6671091
commit
8f1d226865
|
|
@ -43,12 +43,12 @@ public:
|
|||
ALPHA_MODE_MASK
|
||||
};
|
||||
|
||||
LLUUID mAlbedoId;
|
||||
LLUUID mBaseColorId;
|
||||
LLUUID mNormalId;
|
||||
LLUUID mMetallicRoughnessId;
|
||||
LLUUID mEmissiveId;
|
||||
|
||||
LLColor4 mAlbedoColor = LLColor4(1,1,1,1);
|
||||
LLColor4 mBaseColor = LLColor4(1,1,1,1);
|
||||
LLColor3 mEmissiveColor = LLColor3(0,0,0);
|
||||
|
||||
F32 mMetallicFactor = 0.f;
|
||||
|
|
|
|||
|
|
@ -1336,7 +1336,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
|
||||
if (tep->getGLTFMaterial())
|
||||
{
|
||||
color = tep->getGLTFMaterial()->mAlbedoColor;
|
||||
color = tep->getGLTFMaterial()->mBaseColor;
|
||||
}
|
||||
|
||||
if (rebuild_color)
|
||||
|
|
|
|||
|
|
@ -259,8 +259,8 @@ bool LLLocalGLTFMaterial::loadMaterial(LLPointer<LLGLTFMaterial> mat)
|
|||
std::string folder = gDirUtilp->getDirName(filename_lc);
|
||||
tinygltf::Material material_in = model_in.materials[0];
|
||||
|
||||
// get albedo texture
|
||||
LLPointer<LLImageRaw> albedo_img = LLTinyGLTFHelper::getTexture(folder, model_in, material_in.pbrMetallicRoughness.baseColorTexture.index);
|
||||
// get base color texture
|
||||
LLPointer<LLImageRaw> base_img = LLTinyGLTFHelper::getTexture(folder, model_in, material_in.pbrMetallicRoughness.baseColorTexture.index);
|
||||
// get normal map
|
||||
LLPointer<LLImageRaw> normal_img = LLTinyGLTFHelper::getTexture(folder, model_in, material_in.normalTexture.index);
|
||||
// get metallic-roughness texture
|
||||
|
|
@ -276,12 +276,12 @@ bool LLLocalGLTFMaterial::loadMaterial(LLPointer<LLGLTFMaterial> mat)
|
|||
|
||||
// todo: pass it into local bitmaps?
|
||||
LLTinyGLTFHelper::initFetchedTextures(material_in,
|
||||
albedo_img, normal_img, mr_img, emissive_img, occlusion_img,
|
||||
mAlbedoFetched, mNormalFetched, mMRFetched, mEmissiveFetched);
|
||||
base_img, normal_img, mr_img, emissive_img, occlusion_img,
|
||||
mBaseColorFetched, mNormalFetched, mMRFetched, mEmissiveFetched);
|
||||
|
||||
if (mAlbedoFetched)
|
||||
if (mBaseColorFetched)
|
||||
{
|
||||
mat->mAlbedoId = mAlbedoFetched->getID();
|
||||
mat->mBaseColorId= mBaseColorFetched->getID();
|
||||
}
|
||||
if (mNormalFetched)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ private: /* members */
|
|||
S32 mUpdateRetries;
|
||||
|
||||
// material needs to maintain textures
|
||||
LLPointer<LLViewerFetchedTexture> mAlbedoFetched;
|
||||
LLPointer<LLViewerFetchedTexture> mBaseColorFetched;
|
||||
LLPointer<LLViewerFetchedTexture> mNormalFetched;
|
||||
LLPointer<LLViewerFetchedTexture> mMRFetched;
|
||||
LLPointer<LLViewerFetchedTexture> mEmissiveFetched;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
#include <strstream>
|
||||
|
||||
|
||||
const std::string MATERIAL_ALBEDO_DEFAULT_NAME = "Albedo";
|
||||
const std::string MATERIAL_BASE_COLOR_DEFAULT_NAME = "Base Color";
|
||||
const std::string MATERIAL_NORMAL_DEFAULT_NAME = "Normal";
|
||||
const std::string MATERIAL_METALLIC_DEFAULT_NAME = "Metallic Roughness";
|
||||
const std::string MATERIAL_EMISSIVE_DEFAULT_NAME = "Emissive";
|
||||
|
|
@ -101,12 +101,12 @@ LLMaterialEditor::LLMaterialEditor(const LLSD& key)
|
|||
|
||||
BOOL LLMaterialEditor::postBuild()
|
||||
{
|
||||
mAlbedoTextureCtrl = getChild<LLTextureCtrl>("albedo_texture");
|
||||
mBaseColorTextureCtrl = getChild<LLTextureCtrl>("base_color_texture");
|
||||
mMetallicTextureCtrl = getChild<LLTextureCtrl>("metallic_roughness_texture");
|
||||
mEmissiveTextureCtrl = getChild<LLTextureCtrl>("emissive_texture");
|
||||
mNormalTextureCtrl = getChild<LLTextureCtrl>("normal_texture");
|
||||
|
||||
mAlbedoTextureCtrl->setCommitCallback(boost::bind(&LLMaterialEditor::onCommitAlbedoTexture, this, _1, _2));
|
||||
mBaseColorTextureCtrl->setCommitCallback(boost::bind(&LLMaterialEditor::onCommitBaseColorTexture, this, _1, _2));
|
||||
mMetallicTextureCtrl->setCommitCallback(boost::bind(&LLMaterialEditor::onCommitMetallicTexture, this, _1, _2));
|
||||
mEmissiveTextureCtrl->setCommitCallback(boost::bind(&LLMaterialEditor::onCommitEmissiveTexture, this, _1, _2));
|
||||
mNormalTextureCtrl->setCommitCallback(boost::bind(&LLMaterialEditor::onCommitNormalTexture, this, _1, _2));
|
||||
|
|
@ -116,7 +116,7 @@ BOOL LLMaterialEditor::postBuild()
|
|||
childSetAction("cancel", boost::bind(&LLMaterialEditor::onClickCancel, this));
|
||||
|
||||
S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
|
||||
getChild<LLUICtrl>("albedo_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
|
||||
getChild<LLUICtrl>("base_color_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
|
||||
getChild<LLUICtrl>("metallic_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
|
||||
getChild<LLUICtrl>("emissive_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
|
||||
getChild<LLUICtrl>("normal_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
|
||||
|
|
@ -130,8 +130,8 @@ BOOL LLMaterialEditor::postBuild()
|
|||
|
||||
childSetCommitCallback("double sided", changes_callback, NULL);
|
||||
|
||||
// Albedo
|
||||
childSetCommitCallback("albedo color", changes_callback, NULL);
|
||||
// BaseColor
|
||||
childSetCommitCallback("base color", changes_callback, NULL);
|
||||
childSetCommitCallback("transparency", changes_callback, NULL);
|
||||
childSetCommitCallback("alpha mode", changes_callback, NULL);
|
||||
childSetCommitCallback("alpha cutoff", changes_callback, NULL);
|
||||
|
|
@ -177,18 +177,18 @@ void LLMaterialEditor::onClose(bool app_quitting)
|
|||
LLPreview::onClose(app_quitting);
|
||||
}
|
||||
|
||||
LLUUID LLMaterialEditor::getAlbedoId()
|
||||
LLUUID LLMaterialEditor::getBaseColorId()
|
||||
{
|
||||
return mAlbedoTextureCtrl->getValue().asUUID();
|
||||
return mBaseColorTextureCtrl->getValue().asUUID();
|
||||
}
|
||||
|
||||
void LLMaterialEditor::setAlbedoId(const LLUUID& id)
|
||||
void LLMaterialEditor::setBaseColorId(const LLUUID& id)
|
||||
{
|
||||
mAlbedoTextureCtrl->setValue(id);
|
||||
mAlbedoTextureCtrl->setDefaultImageAssetID(id);
|
||||
mBaseColorTextureCtrl->setValue(id);
|
||||
mBaseColorTextureCtrl->setDefaultImageAssetID(id);
|
||||
}
|
||||
|
||||
void LLMaterialEditor::setAlbedoUploadId(const LLUUID& id)
|
||||
void LLMaterialEditor::setBaseColorUploadId(const LLUUID& id)
|
||||
{
|
||||
// Might be better to use local textures and
|
||||
// assign a fee in case of a local texture
|
||||
|
|
@ -196,23 +196,23 @@ void LLMaterialEditor::setAlbedoUploadId(const LLUUID& id)
|
|||
{
|
||||
// todo: this does not account for posibility of texture
|
||||
// being from inventory, need to check that
|
||||
childSetValue("albedo_upload_fee", getString("upload_fee_string"));
|
||||
childSetValue("base_color_upload_fee", getString("upload_fee_string"));
|
||||
// Only set if we will need to upload this texture
|
||||
mAlbedoTextureUploadId = id;
|
||||
mBaseColorTextureUploadId = id;
|
||||
}
|
||||
setHasUnsavedChanges(true);
|
||||
}
|
||||
|
||||
LLColor4 LLMaterialEditor::getAlbedoColor()
|
||||
LLColor4 LLMaterialEditor::getBaseColor()
|
||||
{
|
||||
LLColor4 ret = linearColor4(LLColor4(childGetValue("albedo color")));
|
||||
LLColor4 ret = linearColor4(LLColor4(childGetValue("base color")));
|
||||
ret.mV[3] = getTransparency();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void LLMaterialEditor::setAlbedoColor(const LLColor4& color)
|
||||
void LLMaterialEditor::setBaseColor(const LLColor4& color)
|
||||
{
|
||||
childSetValue("albedo color", srgbColor4(color).getValue());
|
||||
childSetValue("base color", srgbColor4(color).getValue());
|
||||
setTransparency(color.mV[3]);
|
||||
}
|
||||
|
||||
|
|
@ -370,7 +370,7 @@ void LLMaterialEditor::setHasUnsavedChanges(bool value)
|
|||
}
|
||||
|
||||
S32 upload_texture_count = 0;
|
||||
if (mAlbedoTextureUploadId.notNull() && mAlbedoTextureUploadId == getAlbedoId())
|
||||
if (mBaseColorTextureUploadId.notNull() && mBaseColorTextureUploadId == getBaseColorId())
|
||||
{
|
||||
upload_texture_count++;
|
||||
}
|
||||
|
|
@ -401,23 +401,23 @@ void LLMaterialEditor::setCanSave(BOOL value)
|
|||
childSetEnabled("save", value);
|
||||
}
|
||||
|
||||
void LLMaterialEditor::onCommitAlbedoTexture(LLUICtrl * ctrl, const LLSD & data)
|
||||
void LLMaterialEditor::onCommitBaseColorTexture(LLUICtrl * ctrl, const LLSD & data)
|
||||
{
|
||||
// might be better to use arrays, to have a single callback
|
||||
// and not to repeat the same thing for each tecture control
|
||||
LLUUID new_val = mAlbedoTextureCtrl->getValue().asUUID();
|
||||
if (new_val == mAlbedoTextureUploadId && mAlbedoTextureUploadId.notNull())
|
||||
LLUUID new_val = mBaseColorTextureCtrl->getValue().asUUID();
|
||||
if (new_val == mBaseColorTextureUploadId && mBaseColorTextureUploadId.notNull())
|
||||
{
|
||||
childSetValue("albedo_upload_fee", getString("upload_fee_string"));
|
||||
childSetValue("base_color_upload_fee", getString("upload_fee_string"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Texture picker has 'apply now' with 'cancel' support.
|
||||
// Keep mAlbedoJ2C and mAlbedoFetched, it's our storage in
|
||||
// Keep mBaseColorJ2C and mBaseColorFetched, it's our storage in
|
||||
// case user decides to cancel changes.
|
||||
// Without mAlbedoFetched, viewer will eventually cleanup
|
||||
// Without mBaseColorFetched, viewer will eventually cleanup
|
||||
// the texture that is not in use
|
||||
childSetValue("albedo_upload_fee", getString("no_upload_fee_string"));
|
||||
childSetValue("base_color_upload_fee", getString("no_upload_fee_string"));
|
||||
}
|
||||
setHasUnsavedChanges(true);
|
||||
applyToSelection();
|
||||
|
|
@ -547,19 +547,19 @@ void LLMaterialEditor::getGLTFModel(tinygltf::Model& model)
|
|||
model.materials.resize(1);
|
||||
tinygltf::PbrMetallicRoughness& pbrMaterial = model.materials[0].pbrMetallicRoughness;
|
||||
|
||||
// write albedo
|
||||
LLColor4 albedo_color = getAlbedoColor();
|
||||
albedo_color.mV[3] = getTransparency();
|
||||
write_color(albedo_color, pbrMaterial.baseColorFactor);
|
||||
// write base color
|
||||
LLColor4 base_color = getBaseColor();
|
||||
base_color.mV[3] = getTransparency();
|
||||
write_color(base_color, pbrMaterial.baseColorFactor);
|
||||
|
||||
model.materials[0].alphaCutoff = getAlphaCutoff();
|
||||
model.materials[0].alphaMode = getAlphaMode();
|
||||
|
||||
LLUUID albedo_id = getAlbedoId();
|
||||
LLUUID base_color_id = getBaseColorId();
|
||||
|
||||
if (albedo_id.notNull())
|
||||
if (base_color_id.notNull())
|
||||
{
|
||||
U32 texture_idx = write_texture(albedo_id, model);
|
||||
U32 texture_idx = write_texture(base_color_id, model);
|
||||
|
||||
pbrMaterial.baseColorTexture.index = texture_idx;
|
||||
}
|
||||
|
|
@ -677,9 +677,9 @@ const std::string LLMaterialEditor::buildMaterialDescription()
|
|||
// control UUI for NULL is a valid metric for if it was loaded
|
||||
// or not but I suspect this code will change a lot so may need
|
||||
// to revisit
|
||||
if (!mAlbedoTextureCtrl->getValue().asUUID().isNull())
|
||||
if (!mBaseColorTextureCtrl->getValue().asUUID().isNull())
|
||||
{
|
||||
desc << mAlbedoName;
|
||||
desc << mBaseColorName;
|
||||
desc << ", ";
|
||||
}
|
||||
if (!mMetallicTextureCtrl->getValue().asUUID().isNull())
|
||||
|
|
@ -1050,22 +1050,22 @@ void LLMaterialFilePicker::notify(const std::vector<std::string>& filenames)
|
|||
}
|
||||
|
||||
static void pack_textures(
|
||||
LLPointer<LLImageRaw>& albedo_img,
|
||||
LLPointer<LLImageRaw>& base_color_img,
|
||||
LLPointer<LLImageRaw>& normal_img,
|
||||
LLPointer<LLImageRaw>& mr_img,
|
||||
LLPointer<LLImageRaw>& emissive_img,
|
||||
LLPointer<LLImageRaw>& occlusion_img,
|
||||
LLPointer<LLImageJ2C>& albedo_j2c,
|
||||
LLPointer<LLImageJ2C>& base_color_j2c,
|
||||
LLPointer<LLImageJ2C>& normal_j2c,
|
||||
LLPointer<LLImageJ2C>& mr_j2c,
|
||||
LLPointer<LLImageJ2C>& emissive_j2c)
|
||||
{
|
||||
// NOTE : remove log spam and lossless vs lossy comparisons when the logs are no longer useful
|
||||
|
||||
if (albedo_img)
|
||||
if (base_color_img)
|
||||
{
|
||||
albedo_j2c = LLViewerTextureList::convertToUploadFile(albedo_img);
|
||||
LL_INFOS() << "Albedo: " << albedo_j2c->getDataSize() << LL_ENDL;
|
||||
base_color_j2c = LLViewerTextureList::convertToUploadFile(base_color_img);
|
||||
LL_INFOS() << "BaseColor: " << base_color_j2c->getDataSize() << LL_ENDL;
|
||||
}
|
||||
|
||||
if (normal_img)
|
||||
|
|
@ -1146,8 +1146,8 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename)
|
|||
model_out.asset.version = "2.0";
|
||||
model_out.materials.resize(1);
|
||||
|
||||
// get albedo texture
|
||||
LLPointer<LLImageRaw> albedo_img = LLTinyGLTFHelper::getTexture(folder, model_in, material_in.pbrMetallicRoughness.baseColorTexture.index, mAlbedoName);
|
||||
// get base color texture
|
||||
LLPointer<LLImageRaw> base_color_img = LLTinyGLTFHelper::getTexture(folder, model_in, material_in.pbrMetallicRoughness.baseColorTexture.index, mBaseColorName);
|
||||
// get normal map
|
||||
LLPointer<LLImageRaw> normal_img = LLTinyGLTFHelper::getTexture(folder, model_in, material_in.normalTexture.index, mNormalName);
|
||||
// get metallic-roughness texture
|
||||
|
|
@ -1162,20 +1162,20 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename)
|
|||
occlusion_img = LLTinyGLTFHelper::getTexture(folder, model_in, material_in.occlusionTexture.index, tmp);
|
||||
}
|
||||
|
||||
LLTinyGLTFHelper::initFetchedTextures(material_in, albedo_img, normal_img, mr_img, emissive_img, occlusion_img,
|
||||
mAlbedoFetched, mNormalFetched, mMetallicRoughnessFetched, mEmissiveFetched);
|
||||
pack_textures(albedo_img, normal_img, mr_img, emissive_img, occlusion_img,
|
||||
mAlbedoJ2C, mNormalJ2C, mMetallicRoughnessJ2C, mEmissiveJ2C);
|
||||
LLTinyGLTFHelper::initFetchedTextures(material_in, base_color_img, normal_img, mr_img, emissive_img, occlusion_img,
|
||||
mBaseColorFetched, mNormalFetched, mMetallicRoughnessFetched, mEmissiveFetched);
|
||||
pack_textures(base_color_img, normal_img, mr_img, emissive_img, occlusion_img,
|
||||
mBaseColorJ2C, mNormalJ2C, mMetallicRoughnessJ2C, mEmissiveJ2C);
|
||||
|
||||
LLUUID albedo_id;
|
||||
if (mAlbedoFetched.notNull())
|
||||
LLUUID base_color_id;
|
||||
if (mBaseColorFetched.notNull())
|
||||
{
|
||||
mAlbedoFetched->forceToSaveRawImage(0, F32_MAX);
|
||||
albedo_id = mAlbedoFetched->getID();
|
||||
mBaseColorFetched->forceToSaveRawImage(0, F32_MAX);
|
||||
base_color_id = mBaseColorFetched->getID();
|
||||
|
||||
if (mAlbedoName.empty())
|
||||
if (mBaseColorName.empty())
|
||||
{
|
||||
mAlbedoName = MATERIAL_ALBEDO_DEFAULT_NAME;
|
||||
mBaseColorName = MATERIAL_BASE_COLOR_DEFAULT_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1215,8 +1215,8 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename)
|
|||
}
|
||||
}
|
||||
|
||||
setAlbedoId(albedo_id);
|
||||
setAlbedoUploadId(albedo_id);
|
||||
setBaseColorId(base_color_id);
|
||||
setBaseColorUploadId(base_color_id);
|
||||
setMetallicRoughnessId(mr_id);
|
||||
setMetallicRoughnessUploadId(mr_id);
|
||||
setEmissiveId(emissive_id);
|
||||
|
|
@ -1245,16 +1245,16 @@ bool LLMaterialEditor::setFromGltfModel(tinygltf::Model& model, bool set_texture
|
|||
S32 index;
|
||||
LLUUID id;
|
||||
|
||||
// get albedo texture
|
||||
// get base color texture
|
||||
index = material_in.pbrMetallicRoughness.baseColorTexture.index;
|
||||
if (index >= 0)
|
||||
{
|
||||
id.set(model.images[index].uri);
|
||||
setAlbedoId(id);
|
||||
setBaseColorId(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
setAlbedoId(LLUUID::null);
|
||||
setBaseColorId(LLUUID::null);
|
||||
}
|
||||
|
||||
// get normal map
|
||||
|
|
@ -1297,7 +1297,7 @@ bool LLMaterialEditor::setFromGltfModel(tinygltf::Model& model, bool set_texture
|
|||
setAlphaMode(material_in.alphaMode);
|
||||
setAlphaCutoff(material_in.alphaCutoff);
|
||||
|
||||
setAlbedoColor(LLTinyGLTFHelper::getColor(material_in.pbrMetallicRoughness.baseColorFactor));
|
||||
setBaseColor(LLTinyGLTFHelper::getColor(material_in.pbrMetallicRoughness.baseColorFactor));
|
||||
setEmissiveColor(LLTinyGLTFHelper::getColor(material_in.emissiveFactor));
|
||||
|
||||
setMetalnessFactor(material_in.pbrMetallicRoughness.metallicFactor);
|
||||
|
|
@ -1331,7 +1331,7 @@ const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, c
|
|||
stripped_uri = stripped_uri.substr(0, max_texture_name_length - 1);
|
||||
}
|
||||
|
||||
// We intend to append the type of texture (albedo, emissive etc.) to the
|
||||
// We intend to append the type of texture (base color, emissive etc.) to the
|
||||
// name of the texture but sometimes the creator already did that. To try
|
||||
// to avoid repeats (not perfect), we look for the texture type in the name
|
||||
// and if we find it, do not append the type, later on. One way this fails
|
||||
|
|
@ -1357,7 +1357,7 @@ const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, c
|
|||
// so we can include everything
|
||||
if (stripped_uri.length() > 0)
|
||||
{
|
||||
// example "DamagedHelmet: base layer (Albedo)"
|
||||
// example "DamagedHelmet: base layer"
|
||||
return STRINGIZE(
|
||||
mMaterialNameShort <<
|
||||
": " <<
|
||||
|
|
@ -1476,17 +1476,17 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, tinygltf
|
|||
{
|
||||
const tinygltf::Material& first_material = model.materials[0];
|
||||
|
||||
mAlbedoName = MATERIAL_ALBEDO_DEFAULT_NAME;
|
||||
// note: unlike the other textures, albedo doesn't have its own entry
|
||||
mBaseColorName = MATERIAL_BASE_COLOR_DEFAULT_NAME;
|
||||
// note: unlike the other textures, base color doesn't have its own entry
|
||||
// in the tinyGLTF Material struct. Rather, it is taken from a
|
||||
// sub-texture in the pbrMetallicRoughness member
|
||||
int index = first_material.pbrMetallicRoughness.baseColorTexture.index;
|
||||
if (index > -1 && index < model.images.size())
|
||||
{
|
||||
// sanitize the name we decide to use for each texture
|
||||
std::string texture_name = getImageNameFromUri(model.images[index].uri, MATERIAL_ALBEDO_DEFAULT_NAME);
|
||||
std::string texture_name = getImageNameFromUri(model.images[index].uri, MATERIAL_BASE_COLOR_DEFAULT_NAME);
|
||||
LLInventoryObject::correctInventoryName(texture_name);
|
||||
mAlbedoName = texture_name;
|
||||
mBaseColorName = texture_name;
|
||||
}
|
||||
|
||||
mEmissiveName = MATERIAL_EMISSIVE_DEFAULT_NAME;
|
||||
|
|
@ -1559,9 +1559,9 @@ void LLMaterialEditor::applyToSelection()
|
|||
|
||||
void LLMaterialEditor::getGLTFMaterial(LLGLTFMaterial* mat)
|
||||
{
|
||||
mat->mAlbedoColor = getAlbedoColor();
|
||||
mat->mAlbedoColor.mV[3] = getTransparency();
|
||||
mat->mAlbedoId = getAlbedoId();
|
||||
mat->mBaseColor = getBaseColor();
|
||||
mat->mBaseColor.mV[3] = getTransparency();
|
||||
mat->mBaseColorId = getBaseColorId();
|
||||
|
||||
mat->mNormalId = getNormalId();
|
||||
|
||||
|
|
@ -1579,8 +1579,8 @@ void LLMaterialEditor::getGLTFMaterial(LLGLTFMaterial* mat)
|
|||
|
||||
void LLMaterialEditor::setFromGLTFMaterial(LLGLTFMaterial* mat)
|
||||
{
|
||||
setAlbedoColor(mat->mAlbedoColor);
|
||||
setAlbedoId(mat->mAlbedoId);
|
||||
setBaseColor(mat->mBaseColor);
|
||||
setBaseColorId(mat->mBaseColorId);
|
||||
setNormalId(mat->mNormalId);
|
||||
|
||||
setMetallicRoughnessId(mat->mMetallicRoughnessId);
|
||||
|
|
@ -1801,23 +1801,23 @@ S32 LLMaterialEditor::saveTextures()
|
|||
{
|
||||
S32 work_count = 0;
|
||||
LLSD key = getKey(); // must be locally declared for lambda's capture to work
|
||||
if (mAlbedoTextureUploadId == getAlbedoId() && mAlbedoTextureUploadId.notNull())
|
||||
if (mBaseColorTextureUploadId == getBaseColorId() && mBaseColorTextureUploadId.notNull())
|
||||
{
|
||||
mUploadingTexturesCount++;
|
||||
work_count++;
|
||||
saveTexture(mAlbedoJ2C, mAlbedoName, mAlbedoTextureUploadId, [key](LLUUID newAssetId, LLSD response)
|
||||
saveTexture(mBaseColorJ2C, mBaseColorName, mBaseColorTextureUploadId, [key](LLUUID newAssetId, LLSD response)
|
||||
{
|
||||
LLMaterialEditor* me = LLFloaterReg::findTypedInstance<LLMaterialEditor>("material_editor", key);
|
||||
if (me)
|
||||
{
|
||||
if (response["success"].asBoolean())
|
||||
{
|
||||
me->setAlbedoId(newAssetId);
|
||||
me->setBaseColorId(newAssetId);
|
||||
}
|
||||
else
|
||||
{
|
||||
// To make sure that we won't retry (some failures can cb immediately)
|
||||
me->setAlbedoId(LLUUID::null);
|
||||
me->setBaseColorId(LLUUID::null);
|
||||
}
|
||||
me->mUploadingTexturesCount--;
|
||||
|
||||
|
|
@ -1902,17 +1902,17 @@ S32 LLMaterialEditor::saveTextures()
|
|||
}
|
||||
|
||||
// discard upload buffers once textures have been saved
|
||||
mAlbedoJ2C = nullptr;
|
||||
mBaseColorJ2C = nullptr;
|
||||
mNormalJ2C = nullptr;
|
||||
mEmissiveJ2C = nullptr;
|
||||
mMetallicRoughnessJ2C = nullptr;
|
||||
|
||||
mAlbedoFetched = nullptr;
|
||||
mBaseColorFetched = nullptr;
|
||||
mNormalFetched = nullptr;
|
||||
mMetallicRoughnessFetched = nullptr;
|
||||
mEmissiveFetched = nullptr;
|
||||
|
||||
mAlbedoTextureUploadId.setNull();
|
||||
mBaseColorTextureUploadId.setNull();
|
||||
mNormalTextureUploadId.setNull();
|
||||
mMetallicTextureUploadId.setNull();
|
||||
mEmissiveTextureUploadId.setNull();
|
||||
|
|
|
|||
|
|
@ -108,14 +108,14 @@ public:
|
|||
|
||||
void onClose(bool app_quitting) override;
|
||||
|
||||
LLUUID getAlbedoId();
|
||||
void setAlbedoId(const LLUUID& id);
|
||||
void setAlbedoUploadId(const LLUUID& id);
|
||||
LLUUID getBaseColorId();
|
||||
void setBaseColorId(const LLUUID& id);
|
||||
void setBaseColorUploadId(const LLUUID& id);
|
||||
|
||||
LLColor4 getAlbedoColor();
|
||||
LLColor4 getBaseColor();
|
||||
|
||||
// sets both albedo color and transparency
|
||||
void setAlbedoColor(const LLColor4& color);
|
||||
// sets both base color and transparency
|
||||
void setBaseColor(const LLColor4& color);
|
||||
|
||||
F32 getTransparency();
|
||||
void setTransparency(F32 transparency);
|
||||
|
|
@ -156,7 +156,7 @@ public:
|
|||
void setCanSaveAs(BOOL value);
|
||||
void setCanSave(BOOL value);
|
||||
|
||||
void onCommitAlbedoTexture(LLUICtrl* ctrl, const LLSD& data);
|
||||
void onCommitBaseColorTexture(LLUICtrl* ctrl, const LLSD& data);
|
||||
void onCommitMetallicTexture(LLUICtrl* ctrl, const LLSD& data);
|
||||
void onCommitEmissiveTexture(LLUICtrl* ctrl, const LLSD& data);
|
||||
void onCommitNormalTexture(LLUICtrl* ctrl, const LLSD& data);
|
||||
|
|
@ -169,32 +169,32 @@ private:
|
|||
LLUUID mAssetID;
|
||||
LLUUID mObjectID;
|
||||
|
||||
LLTextureCtrl* mAlbedoTextureCtrl;
|
||||
LLTextureCtrl* mBaseColorTextureCtrl;
|
||||
LLTextureCtrl* mMetallicTextureCtrl;
|
||||
LLTextureCtrl* mEmissiveTextureCtrl;
|
||||
LLTextureCtrl* mNormalTextureCtrl;
|
||||
|
||||
// 'Default' texture, unless it's null or from inventory is the one with the fee
|
||||
LLUUID mAlbedoTextureUploadId;
|
||||
LLUUID mBaseColorTextureUploadId;
|
||||
LLUUID mMetallicTextureUploadId;
|
||||
LLUUID mEmissiveTextureUploadId;
|
||||
LLUUID mNormalTextureUploadId;
|
||||
|
||||
// last known name of each texture
|
||||
std::string mAlbedoName;
|
||||
std::string mBaseColorName;
|
||||
std::string mNormalName;
|
||||
std::string mMetallicRoughnessName;
|
||||
std::string mEmissiveName;
|
||||
|
||||
// keep pointers to fetched textures or viewer will remove them
|
||||
// if user temporary selects something else with 'apply now'
|
||||
LLPointer<LLViewerFetchedTexture> mAlbedoFetched;
|
||||
LLPointer<LLViewerFetchedTexture> mBaseColorFetched;
|
||||
LLPointer<LLViewerFetchedTexture> mNormalFetched;
|
||||
LLPointer<LLViewerFetchedTexture> mMetallicRoughnessFetched;
|
||||
LLPointer<LLViewerFetchedTexture> mEmissiveFetched;
|
||||
|
||||
// J2C versions of packed buffers for uploading
|
||||
LLPointer<LLImageJ2C> mAlbedoJ2C;
|
||||
LLPointer<LLImageJ2C> mBaseColorJ2C;
|
||||
LLPointer<LLImageJ2C> mNormalJ2C;
|
||||
LLPointer<LLImageJ2C> mMetallicRoughnessJ2C;
|
||||
LLPointer<LLImageJ2C> mEmissiveJ2C;
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ const S32 MATTYPE_SPECULAR = 2; // Specular map
|
|||
const S32 ALPHAMODE_MASK = 2; // Alpha masking mode
|
||||
const S32 BUMPY_TEXTURE = 18; // use supplied normal map
|
||||
const S32 SHINY_TEXTURE = 4; // use supplied specular map
|
||||
const S32 PBRTYPE_ALBEDO = 0; // PBR Albedo
|
||||
const S32 PBRTYPE_BASE_COLOR = 0; // PBR Base Color
|
||||
const S32 PBRTYPE_NORMAL = 1; // PBR Normal
|
||||
const S32 PBRTYPE_METALLIC = 2; // PBR Metallic
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ BOOL LLPanelFace::postBuild()
|
|||
if (radio_pbr_type)
|
||||
{
|
||||
radio_pbr_type->setCommitCallback(LLPanelFace::onCommitPbrType, this);
|
||||
radio_pbr_type->selectNthItem(PBRTYPE_ALBEDO);
|
||||
radio_pbr_type->selectNthItem(PBRTYPE_BASE_COLOR);
|
||||
}
|
||||
|
||||
mCtrlGlow = getChild<LLSpinCtrl>("glow");
|
||||
|
|
@ -897,9 +897,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
|
|||
radio_mat_type->setEnabled(editable);
|
||||
|
||||
LLRadioGroup* radio_pbr_type = getChild<LLRadioGroup>("radio_pbr_type");
|
||||
if (radio_pbr_type->getSelectedIndex() < PBRTYPE_ALBEDO)
|
||||
if (radio_pbr_type->getSelectedIndex() < PBRTYPE_BASE_COLOR)
|
||||
{
|
||||
radio_pbr_type->selectNthItem(PBRTYPE_ALBEDO);
|
||||
radio_pbr_type->selectNthItem(PBRTYPE_BASE_COLOR);
|
||||
}
|
||||
radio_pbr_type->setEnabled(editable);
|
||||
|
||||
|
|
@ -2570,7 +2570,7 @@ void LLPanelFace::updateVisibility()
|
|||
bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled()));
|
||||
bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled();
|
||||
bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled();
|
||||
bool show_pbr_albedo = show_pbr && (pbr_type == PBRTYPE_ALBEDO) && mComboMatMedia->getEnabled();
|
||||
bool show_pbr_base_color = show_pbr && (pbr_type == PBRTYPE_BASE_COLOR) && mComboMatMedia->getEnabled();
|
||||
bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL) && mComboMatMedia->getEnabled();
|
||||
bool show_pbr_metallic = show_pbr && (pbr_type == PBRTYPE_METALLIC) && mComboMatMedia->getEnabled();
|
||||
|
||||
|
|
@ -2594,11 +2594,11 @@ void LLPanelFace::updateVisibility()
|
|||
updateAlphaControls();
|
||||
}
|
||||
// texture scale and position controls are shared between bpr and non-pbr textures
|
||||
getChildView("TexScaleU")->setVisible(show_texture || show_pbr_albedo);
|
||||
getChildView("TexScaleV")->setVisible(show_texture || show_pbr_albedo);
|
||||
getChildView("TexRot")->setVisible(show_texture || show_pbr_albedo);
|
||||
getChildView("TexOffsetU")->setVisible(show_texture || show_pbr_albedo);
|
||||
getChildView("TexOffsetV")->setVisible(show_texture || show_pbr_albedo);
|
||||
getChildView("TexScaleU")->setVisible(show_texture || show_pbr_base_color);
|
||||
getChildView("TexScaleV")->setVisible(show_texture || show_pbr_base_color);
|
||||
getChildView("TexRot")->setVisible(show_texture || show_pbr_base_color);
|
||||
getChildView("TexOffsetU")->setVisible(show_texture || show_pbr_base_color);
|
||||
getChildView("TexOffsetV")->setVisible(show_texture || show_pbr_base_color);
|
||||
|
||||
// Specular map controls
|
||||
getChildView("shinytexture control")->setVisible(show_shininess);
|
||||
|
|
|
|||
|
|
@ -62,19 +62,19 @@ void copy_red_channel(LLPointer<LLImageRaw>& src_img, LLPointer<LLImageRaw>& dst
|
|||
}
|
||||
|
||||
void LLTinyGLTFHelper::initFetchedTextures(tinygltf::Material& material,
|
||||
LLPointer<LLImageRaw>& albedo_img,
|
||||
LLPointer<LLImageRaw>& base_color_img,
|
||||
LLPointer<LLImageRaw>& normal_img,
|
||||
LLPointer<LLImageRaw>& mr_img,
|
||||
LLPointer<LLImageRaw>& emissive_img,
|
||||
LLPointer<LLImageRaw>& occlusion_img,
|
||||
LLPointer<LLViewerFetchedTexture>& albedo_tex,
|
||||
LLPointer<LLViewerFetchedTexture>& base_color_tex,
|
||||
LLPointer<LLViewerFetchedTexture>& normal_tex,
|
||||
LLPointer<LLViewerFetchedTexture>& mr_tex,
|
||||
LLPointer<LLViewerFetchedTexture>& emissive_tex)
|
||||
{
|
||||
if (albedo_img)
|
||||
if (base_color_img)
|
||||
{
|
||||
albedo_tex = LLViewerTextureManager::getFetchedTexture(albedo_img, FTType::FTT_LOCAL_FILE, true);
|
||||
base_color_tex = LLViewerTextureManager::getFetchedTexture(base_color_img, FTType::FTT_LOCAL_FILE, true);
|
||||
}
|
||||
|
||||
if (normal_img)
|
||||
|
|
@ -128,15 +128,15 @@ void LLTinyGLTFHelper::setFromModel(LLGLTFMaterial* mat, tinygltf::Model& model)
|
|||
|
||||
auto& material_in = model.materials[0];
|
||||
|
||||
// get albedo texture
|
||||
// get base color texture
|
||||
index = material_in.pbrMetallicRoughness.baseColorTexture.index;
|
||||
if (index >= 0)
|
||||
{
|
||||
mat->mAlbedoId.set(model.images[index].uri);
|
||||
mat->mBaseColorId.set(model.images[index].uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
mat->mAlbedoId.setNull();
|
||||
mat->mBaseColorId.setNull();
|
||||
}
|
||||
|
||||
// get normal map
|
||||
|
|
@ -175,7 +175,7 @@ void LLTinyGLTFHelper::setFromModel(LLGLTFMaterial* mat, tinygltf::Model& model)
|
|||
mat->setAlphaMode(material_in.alphaMode);
|
||||
mat->mAlphaCutoff = llclamp((F32)material_in.alphaCutoff, 0.f, 1.f);
|
||||
|
||||
mat->mAlbedoColor = getColor(material_in.pbrMetallicRoughness.baseColorFactor);
|
||||
mat->mBaseColor= getColor(material_in.pbrMetallicRoughness.baseColorFactor);
|
||||
mat->mEmissiveColor = getColor(material_in.emissiveFactor);
|
||||
|
||||
mat->mMetallicFactor = llclamp((F32)material_in.pbrMetallicRoughness.metallicFactor, 0.f, 1.f);
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ namespace LLTinyGLTFHelper
|
|||
LLImageRaw* getTexture(const std::string& folder, const tinygltf::Model& model, S32 texture_index);
|
||||
|
||||
void initFetchedTextures(tinygltf::Material& material,
|
||||
LLPointer<LLImageRaw>& albedo_img,
|
||||
LLPointer<LLImageRaw>& base_color_img,
|
||||
LLPointer<LLImageRaw>& normal_img,
|
||||
LLPointer<LLImageRaw>& mr_img,
|
||||
LLPointer<LLImageRaw>& emissive_img,
|
||||
LLPointer<LLImageRaw>& occlusion_img,
|
||||
LLPointer<LLViewerFetchedTexture>& albedo_tex,
|
||||
LLPointer<LLViewerFetchedTexture>& base_color_tex,
|
||||
LLPointer<LLViewerFetchedTexture>& normal_tex,
|
||||
LLPointer<LLViewerFetchedTexture>& mr_tex,
|
||||
LLPointer<LLViewerFetchedTexture>& emissive_tex);
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ void LLViewerObject::deleteTEImages()
|
|||
mTESpecularMaps = NULL;
|
||||
}
|
||||
|
||||
mGLTFAlbedoMaps.clear();
|
||||
mGLTFBaseColorMaps.clear();
|
||||
mGLTFNormalMaps.clear();
|
||||
mGLTFMetallicRoughnessMaps.clear();
|
||||
mGLTFEmissiveMaps.clear();
|
||||
|
|
@ -4753,7 +4753,7 @@ void LLViewerObject::setNumTEs(const U8 num_tes)
|
|||
mTENormalMaps = new_normmaps;
|
||||
mTESpecularMaps = new_specmaps;
|
||||
|
||||
mGLTFAlbedoMaps.resize(num_tes);
|
||||
mGLTFBaseColorMaps.resize(num_tes);
|
||||
mGLTFNormalMaps.resize(num_tes);
|
||||
mGLTFMetallicRoughnessMaps.resize(num_tes);
|
||||
mGLTFEmissiveMaps.resize(num_tes);
|
||||
|
|
@ -4943,14 +4943,14 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)
|
|||
|
||||
if (mat != nullptr)
|
||||
{
|
||||
mGLTFAlbedoMaps[te] = fetch_texture(mat->mAlbedoId);
|
||||
mGLTFBaseColorMaps[te] = fetch_texture(mat->mBaseColorId);
|
||||
mGLTFNormalMaps[te] = fetch_texture(mat->mNormalId);
|
||||
mGLTFMetallicRoughnessMaps[te] = fetch_texture(mat->mMetallicRoughnessId);
|
||||
mGLTFEmissiveMaps[te] = fetch_texture(mat->mEmissiveId);
|
||||
}
|
||||
else
|
||||
{
|
||||
mGLTFAlbedoMaps[te] = nullptr;
|
||||
mGLTFBaseColorMaps[te] = nullptr;
|
||||
mGLTFNormalMaps[te] = nullptr;
|
||||
mGLTFMetallicRoughnessMaps[te] = nullptr;
|
||||
mGLTFEmissiveMaps[te] = nullptr;
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ public:
|
|||
LLViewerTexture *getTENormalMap(const U8 te) const;
|
||||
LLViewerTexture *getTESpecularMap(const U8 te) const;
|
||||
|
||||
LLViewerTexture* getGLTFAlbedoMap(U8 te) const { return mGLTFAlbedoMaps[te]; }
|
||||
LLViewerTexture* getGLTFBaseColorMap(U8 te) const { return mGLTFBaseColorMaps[te]; }
|
||||
LLViewerTexture* getGLTFNormalMap(U8 te) const { return mGLTFNormalMaps[te]; }
|
||||
LLViewerTexture* getGLTFEmissiveMap(U8 te) const { return mGLTFEmissiveMaps[te]; }
|
||||
LLViewerTexture* getGLTFMetallicRoughnessMap(U8 te) const { return mGLTFMetallicRoughnessMaps[te]; }
|
||||
|
|
@ -693,7 +693,7 @@ public:
|
|||
LLPointer<LLViewerTexture> *mTENormalMaps;
|
||||
LLPointer<LLViewerTexture> *mTESpecularMaps;
|
||||
|
||||
std::vector<LLPointer<LLViewerTexture> > mGLTFAlbedoMaps;
|
||||
std::vector<LLPointer<LLViewerTexture> > mGLTFBaseColorMaps;
|
||||
std::vector<LLPointer<LLViewerTexture> > mGLTFNormalMaps;
|
||||
std::vector<LLPointer<LLViewerTexture> > mGLTFMetallicRoughnessMaps;
|
||||
std::vector<LLPointer<LLViewerTexture> > mGLTFEmissiveMaps;
|
||||
|
|
|
|||
|
|
@ -5520,13 +5520,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
LLViewerObject* vobj = facep->getViewerObject();
|
||||
U8 te = facep->getTEOffset();
|
||||
|
||||
draw_info->mTexture = vobj->getGLTFAlbedoMap(te);
|
||||
draw_info->mTexture = vobj->getGLTFBaseColorMap(te);
|
||||
draw_info->mNormalMap = vobj->getGLTFNormalMap(te);
|
||||
draw_info->mSpecularMap = vobj->getGLTFMetallicRoughnessMap(te);
|
||||
draw_info->mEmissiveMap = vobj->getGLTFEmissiveMap(te);
|
||||
if (draw_info->mGLTFMaterial->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_MASK)
|
||||
{
|
||||
draw_info->mAlphaMaskCutoff = gltf_mat->mAlphaCutoff * gltf_mat->mAlbedoColor.mV[3];
|
||||
draw_info->mAlphaMaskCutoff = gltf_mat->mAlphaCutoff * gltf_mat->mBaseColor.mV[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
layout="topleft"
|
||||
left="1"
|
||||
mouse_opaque="false"
|
||||
name="albedo_texture_pnl"
|
||||
name="base_color_texture_pnl"
|
||||
top_pad="5"
|
||||
>
|
||||
<text
|
||||
|
|
@ -62,8 +62,8 @@
|
|||
layout="topleft"
|
||||
left="10"
|
||||
top="5"
|
||||
width="64">
|
||||
Albedo:
|
||||
width="128">
|
||||
Base Color:
|
||||
</text>
|
||||
<texture_picker
|
||||
can_apply_immediately="true"
|
||||
|
|
@ -75,8 +75,8 @@
|
|||
height="151"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="albedo_texture"
|
||||
tool_tip="Albedo map. Alpha channel is optional and used for transparency."
|
||||
name="base_color_texture"
|
||||
tool_tip="Base Color map. Alpha channel is optional and used for transparency."
|
||||
width="128" />
|
||||
<text
|
||||
type="string"
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
layout="topleft"
|
||||
left="10"
|
||||
top_pad="-17"
|
||||
name="albedo_upload_fee"
|
||||
name="base_color_upload_fee"
|
||||
>
|
||||
No upload fee
|
||||
</text>
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
layout="topleft"
|
||||
left_delta="0"
|
||||
top_pad="5"
|
||||
name="albedo color"
|
||||
name="base color"
|
||||
width="40" />
|
||||
<text
|
||||
type="string"
|
||||
|
|
|
|||
|
|
@ -191,8 +191,8 @@
|
|||
visible = "false"
|
||||
name="radio_pbr_type">
|
||||
<radio_item
|
||||
label="Albedo/emissive"
|
||||
name="Albedo/emissive"
|
||||
label="Color/emissive"
|
||||
name="Color/emissive"
|
||||
top="0"
|
||||
layout="topleft"
|
||||
height="16"
|
||||
|
|
|
|||
Loading…
Reference in New Issue