Skip to content

Commit

Permalink
refactor: Removed redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
atteneder committed Oct 15, 2021
1 parent d18ac61 commit 1b63225
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Corrected mesh bounds (calculated from accessor's min/max)
- No errors when importing empty scenes
- Removed redundant code

## [4.3.2] - 2021-10-13
### Added
Expand Down
27 changes: 3 additions & 24 deletions Runtime/Scripts/Schema/Accessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ public GLTFAccessorAttributeType typeEnum {
/// </summary>
public AccessorSparse sparse;

public static int GetAccessorComponentTypeLength( GLTFComponentType componentType ) {
switch (componentType)
{
public static int GetComponentTypeSize( GLTFComponentType componentType ) {
switch (componentType) {
case GLTFComponentType.Byte:
case GLTFComponentType.UnsignedByte:
return 1;
Expand All @@ -161,27 +160,7 @@ public static int GetAccessorComponentTypeLength( GLTFComponentType componentTyp
case GLTFComponentType.UnsignedInt:
return 4;
default:
Debug.LogError("Unknown GLTFComponentType");
return 0;
}
}

public static int GetComponentTypeSize(GLTFComponentType type) {
switch (type) {
case GLTFComponentType.Byte:
return 1;
case GLTFComponentType.UnsignedByte:
return 1;
case GLTFComponentType.Short:
return 2;
case GLTFComponentType.UnsignedShort:
return 2;
case GLTFComponentType.UnsignedInt:
return 4;
case GLTFComponentType.Float:
return 4;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
throw new ArgumentOutOfRangeException(nameof(type), componentType, null);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Runtime/Scripts/Schema/Root.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public bool IsAccessorInterleaved( int accessorIndex ) {
var accessor = accessors[accessorIndex];
var bufferView = bufferViews[accessor.bufferView];
if (bufferView.byteStride < 0) return false;
int elementSize = Accessor.GetAccessorAttributeTypeLength(accessor.typeEnum) * Accessor.GetAccessorComponentTypeLength(accessor.componentType);
var elementSize = Accessor.GetAccessorAttributeTypeLength(accessor.typeEnum) * Accessor.GetComponentTypeSize(accessor.componentType);
return bufferView.byteStride > elementSize;
}
}
Expand Down

0 comments on commit 1b63225

Please sign in to comment.