summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llgltfmaterial.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive/llgltfmaterial.cpp')
-rw-r--r--indra/llprimitive/llgltfmaterial.cpp43
1 files changed, 35 insertions, 8 deletions
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp
index b9ef2de61a..8f08a8b2cf 100644
--- a/indra/llprimitive/llgltfmaterial.cpp
+++ b/indra/llprimitive/llgltfmaterial.cpp
@@ -37,7 +37,7 @@ LLGLTFMaterial::LLGLTFMaterial(const LLGLTFMaterial& rhs)
LLGLTFMaterial& LLGLTFMaterial::operator=(const LLGLTFMaterial& rhs)
{
- //have to do a manual operator= because of LLRefCount
+ //have to do a manual operator= because of LLRefCount
mBaseColorId = rhs.mBaseColorId;
mNormalId = rhs.mNormalId;
mMetallicRoughnessId = rhs.mMetallicRoughnessId;
@@ -53,10 +53,7 @@ LLGLTFMaterial& LLGLTFMaterial::operator=(const LLGLTFMaterial& rhs)
mDoubleSided = rhs.mDoubleSided;
mAlphaMode = rhs.mAlphaMode;
- for (S32 i = 0; i < 3; ++i)
- {
- mTextureTransform[i] = rhs.mTextureTransform[i];
- }
+ mTextureTransform = rhs.mTextureTransform;
return *this;
}
@@ -285,16 +282,31 @@ void LLGLTFMaterial::setRoughnessFactor(F32 roughness)
void LLGLTFMaterial::setAlphaMode(S32 mode)
{
- mAlphaMode = (AlphaMode)llclamp(mode, (S32)ALPHA_MODE_OPAQUE, (S32)ALPHA_MODE_MASK);
+ mAlphaMode = (AlphaMode) llclamp(mode, (S32) ALPHA_MODE_OPAQUE, (S32) ALPHA_MODE_MASK);
}
void LLGLTFMaterial::setDoubleSided(bool double_sided)
{
- // sure, no clamping will ever be needed for a bool, but include the
+ // sure, no clamping will ever be needed for a bool, but include the
// setter for consistency with the clamping API
mDoubleSided = double_sided;
}
+void LLGLTFMaterial::setTextureOffset(TextureInfo texture_info, const LLVector2& offset)
+{
+ mTextureTransform[texture_info].mOffset = offset;
+}
+
+void LLGLTFMaterial::setTextureScale(TextureInfo texture_info, const LLVector2& scale)
+{
+ mTextureTransform[texture_info].mScale = scale;
+}
+
+void LLGLTFMaterial::setTextureRotation(TextureInfo texture_info, float rotation)
+{
+ mTextureTransform[texture_info].mRotation = rotation;
+}
+
// Default value accessors
LLUUID LLGLTFMaterial::getDefaultBaseColorId()
@@ -324,7 +336,7 @@ F32 LLGLTFMaterial::getDefaultAlphaCutoff()
S32 LLGLTFMaterial::getDefaultAlphaMode()
{
- return (S32)ALPHA_MODE_OPAQUE;
+ return (S32) ALPHA_MODE_OPAQUE;
}
F32 LLGLTFMaterial::getDefaultMetallicFactor()
@@ -352,6 +364,21 @@ bool LLGLTFMaterial::getDefaultDoubleSided()
return false;
}
+LLVector2 LLGLTFMaterial::getDefaultTextureOffset()
+{
+ return LLVector2(0.f, 0.f);
+}
+
+LLVector2 LLGLTFMaterial::getDefaultTextureScale()
+{
+ return LLVector2(1.f, 1.f);
+}
+
+F32 LLGLTFMaterial::getDefaultTextureRotation()
+{
+ return 0.f;
+}
+
void LLGLTFMaterial::writeOverridesToModel(tinygltf::Model& model, S32 mat_index, LLGLTFMaterial const* base_material) const
{
if (model.materials.size() < mat_index + 1)