-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimized the GLTF mesh building by only including the attributes tha…
…t are needed in each mesh.
- Loading branch information
1 parent
e71ce8c
commit b7d49e2
Showing
93 changed files
with
513 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
FinModelUtility/Fin/Fin/src/model/accessor/ConsistentVertexAccessor_Normal_NormalAccessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lUtility/Fin/Fin/src/model/accessor/ConsistentVertexAccessor_Normal_NullNormalAccessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tility/Fin/Fin/src/model/accessor/ConsistentVertexAccessor_Tangent_NullTangentAccessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...delUtility/Fin/Fin/src/model/accessor/ConsistentVertexAccessor_Tangent_TangentAccessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
FinModelUtility/Fin/Fin/src/model/accessor/ConsistentVertexAccessor_Uv_MultiUvAccessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
FinModelUtility/Fin/Fin/src/model/accessor/ConsistentVertexAccessor_Uv_NullUvAccessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
FinModelUtility/Fin/Fin/src/model/accessor/ConsistentVertexAccessor_Uv_SingleUvAccessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
FinModelUtility/Fin/Fin/src/model/accessor/MaximalVertexAccessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
using fin.color; | ||
|
||
namespace fin.model.accessor { | ||
public class MaximalVertexAccessor : IVertexAccessor { | ||
private IReadOnlyVertex currentVertex_; | ||
|
||
public static IVertexAccessor GetAccessorForModel(IModel model) | ||
=> new MaximalVertexAccessor(); | ||
|
||
private MaximalVertexAccessor() { } | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public void Target(IReadOnlyVertex vertex) { | ||
this.currentVertex_ = vertex; | ||
} | ||
|
||
public int Index => this.currentVertex_.Index; | ||
|
||
public IBoneWeights? BoneWeights => this.currentVertex_.BoneWeights; | ||
public Position LocalPosition => this.currentVertex_.LocalPosition; | ||
|
||
public Normal? LocalNormal | ||
=> (this.currentVertex_ as IReadOnlyNormalVertex)?.LocalNormal; | ||
|
||
public Tangent? LocalTangent | ||
=> (this.currentVertex_ as IReadOnlyTangentVertex)?.LocalTangent; | ||
|
||
public int ColorCount | ||
=> (this.currentVertex_ as IReadOnlyMultiColorVertex)?.ColorCount ?? | ||
(this.currentVertex_ is IReadOnlySingleColorVertex ? 1 : 0); | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public IColor? GetColor() | ||
=> (this.currentVertex_ as IReadOnlyMultiColorVertex)?.GetColor(0) ?? | ||
(this.currentVertex_ as IReadOnlySingleColorVertex)?.GetColor(); | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public IColor? GetColor(int colorIndex) | ||
=> (this.currentVertex_ as IReadOnlyMultiColorVertex)?.GetColor( | ||
colorIndex) ?? | ||
(this.currentVertex_ as IReadOnlySingleColorVertex)?.GetColor(); | ||
|
||
public int UvCount | ||
=> (this.currentVertex_ as IReadOnlyMultiUvVertex)?.UvCount ?? | ||
(this.currentVertex_ is IReadOnlySingleUvVertex ? 1 : 0); | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public TexCoord? GetUv() | ||
=> (this.currentVertex_ as IReadOnlyMultiUvVertex)?.GetUv(0) ?? | ||
(this.currentVertex_ as IReadOnlySingleUvVertex)?.GetUv(); | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public TexCoord? GetUv(int uvIndex) | ||
=> (this.currentVertex_ as IReadOnlyMultiUvVertex)?.GetUv(uvIndex) ?? | ||
(this.currentVertex_ as IReadOnlySingleUvVertex)?.GetUv(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
FinModelUtility/Fin/Fin/src/model/accessor/VertexAccessorInterfaces.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace fin.model.accessor { | ||
public interface IVertexTargeter { | ||
void Target(IReadOnlyVertex vertex); | ||
} | ||
|
||
public interface IVertexAccessor | ||
: IVertexNormalAccessor, | ||
IVertexTangentAccessor, | ||
IVertexColorAccessor, | ||
IVertexUvAccessor { | ||
static abstract IVertexAccessor GetAccessorForModel(IModel model); | ||
} | ||
|
||
public interface IVertexNormalAccessor : IVertexTargeter, | ||
IReadOnlyNormalVertex { } | ||
|
||
public interface IVertexTangentAccessor : IVertexTargeter, | ||
IReadOnlyTangentVertex { } | ||
|
||
public interface IVertexColorAccessor : IVertexTargeter, | ||
IReadOnlySingleColorVertex, | ||
IReadOnlyMultiColorVertex { } | ||
|
||
public interface IVertexUvAccessor : IVertexTargeter, | ||
IReadOnlySingleUvVertex, | ||
IReadOnlyMultiUvVertex { } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.