-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: Mesh API for index and vertex buffer reading #2858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
52289f5
feat: BufferHelper API
Eideren 3f0c619
fix: Wrong offset used in IndexExtensions
Eideren be0e611
chore: Use *BufferHelper API to handle more mesh format in physics logic
Eideren fe3a818
fix: Wrong count used, performance regression
Eideren 4461d47
chore: Improve docs
Eideren 154d5be
Added Write() to manipulate the buffer directly and Copy(Span<Vertex>…
Eideren 3c7528a
ComputeBounds using vertexbuffer helper to support non float3 positions
Eideren 47aaecb
TransformBuffer using vertexbuffer helper to support non float3/float…
Eideren da176b3
Workaround for IConversion<T, T> unification issue
Eideren 7a50fd6
Unconstrain the generic type from the semantic were applicable
Eideren df9fc42
Add comments to the writing example
Eideren 59ad3e2
Semantic -> Semantics
Eideren e1d1e77
Rename IConversion to IConverter
Eideren 04ca948
Fix InterleavedParameters
Eideren 05a2678
introduce UNormByte4 and move Byte4, UShort4 to new Interop namespace
Eideren b7da585
Fix mapping for Color
Eideren cf64226
Change IndexBufferHelper to readonly struct for consistency
Eideren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,73 @@ | ||
| // Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) | ||
| // Distributed under the MIT license. See the LICENSE.md file in the project root for more information. | ||
|
|
||
| using Stride.Graphics.Semantic; | ||
|
|
||
| namespace Stride.Graphics; | ||
|
|
||
| public struct PositionSemantic : IFloat3Semantic | ||
| { | ||
| public static string Name => VertexElementUsage.Position; | ||
| } | ||
|
|
||
| public struct NormalSemantic : IFloat3Semantic | ||
| { | ||
| public static string Name => VertexElementUsage.Normal; | ||
| } | ||
|
|
||
| public struct ColorSemantic : IFloat4Semantic | ||
| { | ||
| public static string Name => VertexElementUsage.Color; | ||
| } | ||
|
|
||
| public struct TangentSemantic : IFloat4Semantic | ||
| { | ||
| public static string Name => VertexElementUsage.Tangent; | ||
| } | ||
|
|
||
| public struct BiTangentSemantic : IFloat4Semantic | ||
| { | ||
| public static string Name => VertexElementUsage.BiTangent; | ||
| } | ||
|
|
||
| public struct TextureCoordinateSemantic : IFloat2Semantic | ||
| { | ||
| public static string Name => VertexElementUsage.TextureCoordinate; | ||
| } | ||
|
|
||
| public struct BlendIndicesSemantic : IUShort4Semantic | ||
| { | ||
| public static string Name => VertexElementUsage.BlendIndices; | ||
| } | ||
|
|
||
| public struct BlendWeightSemantic : IFloat4Semantic | ||
| { | ||
| public static string Name => VertexElementUsage.BlendWeight; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// A semantic extension to allow users to provide non default destination datatypes | ||
| /// </summary> | ||
| /// <example> | ||
| /// Reading positions of a mesh into a Half3 array | ||
| /// <code> | ||
| /// <![CDATA[ | ||
| /// var positions = new Half3[count]; | ||
| /// helper.Read<Relaxed<PositionSemantic>, Half3>(positions); | ||
| /// ]]> | ||
| /// </code> | ||
| /// </example> | ||
| /// <typeparam name="T">The actual semantic used, for example <see cref="PositionSemantic"/></typeparam> | ||
| public struct Relaxed<T> : | ||
| IFloat4Semantic, | ||
| IFloat3Semantic, | ||
| IFloat2Semantic, | ||
| IHalf4Semantic, | ||
| IHalf3Semantic, | ||
| IHalf2Semantic, | ||
| IUShort4Semantic, | ||
| IByte4Semantic | ||
| where T : ISemantic | ||
| { | ||
| public static string Name => T.Name; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.