-
Notifications
You must be signed in to change notification settings - Fork 173
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
Expose MultMatrix #384
Merged
Merged
Expose MultMatrix #384
Conversation
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
I have tested this in my project and it works properly. |
Can you please also add that function to rlgl_purego.go |
rocktavious
commented
May 13, 2024
@gen2brain // MatrixToFloatV - Get float array of matrix data
func MatrixToFloatV(mat Matrix) [16]float32 {
var result [16]float32
result[0] = mat.M0
result[1] = mat.M1
result[2] = mat.M2
result[3] = mat.M3
result[4] = mat.M4
result[5] = mat.M5
result[6] = mat.M6
result[7] = mat.M7
result[8] = mat.M8
result[9] = mat.M9
result[10] = mat.M10
result[11] = mat.M11
result[12] = mat.M12
result[13] = mat.M13
result[14] = mat.M14
result[15] = mat.M15
return result
} // MatrixToFloat - Converts Matrix to float32 slice
func MatrixToFloat(mat Matrix) []float32 {
data := make([]float32, 16)
data[0] = mat.M0
data[1] = mat.M4
data[2] = mat.M8
data[3] = mat.M12
data[4] = mat.M1
data[5] = mat.M5
data[6] = mat.M9
data[7] = mat.M13
data[8] = mat.M2
data[9] = mat.M6
data[10] = mat.M10
data[11] = mat.M14
data[12] = mat.M3
data[13] = mat.M7
data[14] = mat.M11
data[15] = mat.M15
return data
} C-raylib: #ifndef MatrixToFloat
#define MatrixToFloat(mat) (MatrixToFloatV(mat).v)
#endif
RMAPI float16 MatrixToFloatV(Matrix mat)
{
float16 result = { 0 };
result.v[0] = mat.m0;
result.v[1] = mat.m1;
result.v[2] = mat.m2;
result.v[3] = mat.m3;
result.v[4] = mat.m4;
result.v[5] = mat.m5;
result.v[6] = mat.m6;
result.v[7] = mat.m7;
result.v[8] = mat.m8;
result.v[9] = mat.m9;
result.v[10] = mat.m10;
result.v[11] = mat.m11;
result.v[12] = mat.m12;
result.v[13] = mat.m13;
result.v[14] = mat.m14;
result.v[15] = mat.m15;
return result;
} |
@JupiterRider Sorry, I don't remember what happened there. |
I fixed it in #390 as well |
Thanks @JupiterRider and @gen2brain - should be good now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds the MultMatrix with is in raylib core so you can easily setup rendering matrix instead of having to make several calls to
Translatef
andRotatef
andScalef
.