Browse Source

Adjusted texture index access modifiers

vpenades 2 years ago
parent
commit
db8f6cc57b

+ 2 - 2
src/SharpGLTF.Core/Schema2/gltf.MaterialChannel.cs

@@ -158,7 +158,7 @@ namespace SharpGLTF.Schema2
             var texInfo = _TextureInfo?.Invoke(false);
             if (texInfo == null) return null;
 
-            return _Material.LogicalParent.LogicalTextures[texInfo._LogicalTextureIndex];
+            return _Material.LogicalParent.LogicalTextures[texInfo.LogicalTextureIndex];
         }
 
         public Texture SetTexture(
@@ -194,7 +194,7 @@ namespace SharpGLTF.Schema2
             var texInfo = _TextureInfo(true);
 
             texInfo.TextureCoordinate = texSet;
-            texInfo._LogicalTextureIndex = tex.LogicalIndex;
+            texInfo.LogicalTextureIndex = tex.LogicalIndex;
         }
 
         public void SetTransform(Vector2 offset, Vector2 scale, float rotation = 0, int? texCoordOverride = null)

+ 14 - 1
src/SharpGLTF.Core/Schema2/gltf.TextureInfo.cs

@@ -39,10 +39,23 @@ namespace SharpGLTF.Schema2
 
         #region properties
 
+        /// <summary>
+        /// Index into <see cref="ModelRoot.LogicalTextures"/>
+        /// </summary>
+        public int LogicalTextureIndex
+        {
+            get => _index;
+            internal protected set => _index = value;
+        }
+
+        /// <summary>
+        /// Index into <see cref="ModelRoot.LogicalTextures"/>
+        /// </summary>
+        [Obsolete("Use LogicalTextureIndex instead", true)]
         public int _LogicalTextureIndex
         {
             get => _index;
-            set => _index = value;
+            internal protected set => _index = value;
         }
 
         /// <summary>