-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[examples] Added models_decals
#5298
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
[examples] Added models_decals
#5298
Conversation
| switch ( total ) { | ||
| case 0: { | ||
| // the entire face lies inside of the plane, no clipping needed | ||
| AddTriangleToMeshBuilder(outMesh, (Vector3[3]){inMesh->vertices[i], inMesh->vertices[i+1], inMesh->vertices[i+2]}); | ||
| break; | ||
| } | ||
|
|
||
| case 1: { | ||
| // one vertex lies outside of the plane, perform clipping | ||
|
|
||
| if (v1Out) { | ||
| nV1 = inMesh->vertices[ i + 1 ]; | ||
| nV2 = inMesh->vertices[ i + 2 ]; | ||
| nV3 = ClipSegment( inMesh->vertices[ i ], nV1, planes[face], s ); | ||
| nV4 = ClipSegment( inMesh->vertices[ i ], nV2, planes[face], s ); | ||
| } | ||
|
|
||
| if (v2Out) { | ||
| nV1 = inMesh->vertices[ i ]; | ||
| nV2 = inMesh->vertices[ i + 2 ]; | ||
| nV3 = ClipSegment( inMesh->vertices[ i + 1 ], nV1, planes[face], s ); | ||
| nV4 = ClipSegment( inMesh->vertices[ i + 1 ], nV2, planes[face], s ); | ||
|
|
||
| AddTriangleToMeshBuilder(outMesh, (Vector3[3]){nV3, nV2, nV1}); | ||
| AddTriangleToMeshBuilder(outMesh, (Vector3[3]){nV2, nV3, nV4}); | ||
| break; | ||
| } | ||
|
|
||
| if (v3Out) { | ||
| nV1 = inMesh->vertices[ i ]; | ||
| nV2 = inMesh->vertices[ i + 1 ]; | ||
| nV3 = ClipSegment( inMesh->vertices[ i + 2 ], nV1, planes[face], s ); | ||
| nV4 = ClipSegment( inMesh->vertices[ i + 2 ], nV2, planes[face], s ); | ||
| } | ||
|
|
||
| AddTriangleToMeshBuilder(outMesh, (Vector3[3]){nV1, nV2, nV3}); | ||
| AddTriangleToMeshBuilder(outMesh, (Vector3[3]){nV4, nV3, nV2}); | ||
|
|
||
| break; | ||
| } | ||
|
|
||
| case 2: { | ||
| // two vertices lies outside of the plane, perform clipping | ||
| if (!v1Out) { | ||
| nV1 = inMesh->vertices[ i ]; | ||
| nV2 = ClipSegment( nV1, inMesh->vertices[ i + 1 ], planes[face], s ); | ||
| nV3 = ClipSegment( nV1, inMesh->vertices[ i + 2 ], planes[face], s ); | ||
| AddTriangleToMeshBuilder(outMesh, (Vector3[3]){nV1, nV2, nV3}); | ||
| } | ||
| if (!v2Out) { | ||
| nV1 = inMesh->vertices[ i + 1 ]; | ||
| nV2 = ClipSegment( nV1, inMesh->vertices[ i + 2 ], planes[face], s ); | ||
| nV3 = ClipSegment( nV1, inMesh->vertices[ i ], planes[face], s ); | ||
| AddTriangleToMeshBuilder(outMesh, (Vector3[3]){nV1, nV2, nV3}); | ||
| } | ||
| if (!v3Out) { | ||
| nV1 = inMesh->vertices[ i + 2 ]; | ||
| nV2 = ClipSegment( nV1, inMesh->vertices[ i ], planes[face], s ); | ||
| nV3 = ClipSegment( nV1, inMesh->vertices[ i + 1 ], planes[face], s ); | ||
| AddTriangleToMeshBuilder(outMesh, (Vector3[3]){nV1, nV2, nV3}); | ||
| } | ||
| break; | ||
| } | ||
|
|
||
| case 3: { | ||
| // the entire face lies outside of the plane, so let's discard the corresponding vertices | ||
| break; | ||
| } | ||
|
|
||
| } |
Check notice
Code scanning / CodeQL
Long switch case Note
1 (33 lines)
0ad6ca7 to
31b2f3c
Compare
|
@themushroompirates Thanks! Great addition! Please, could you review the issues noted by CodeQL and also the raylib code conventions? Thanks! |
I've changed the code to follow the conventions, and reviewed the CodeQL issues - most of them were fine (and helpful - it was old code I had missed when cleaning), but the "switch case too long one", I think is a mistake. I could compress the code and make it unreadable, or tuck it away into functions or macros and make it harder to follow. It's just the size it needs to be. |
|
@themushroompirates thanks for the review. What is the license or source for model and texture? |
It's CC-0, from kenney.nl |
|
@themushroompirates Thanks! Great addition! Merged! 😄 |
No description provided.