소스 검색

Update rmodels.c - 'fix' for GenMeshSphere artifact

When creating a new sphere mesh with high number of slices/rings the top and bottom parts of the generated sphere are removed. This happens because the triangles in those parts, due to high resolution, end up being very small and are removed as part of the 'par_shapes' library's optimization. Adding par_shapes_set_epsilon_degenerate_sphere(0.0); before generating the sphere mesh sets the threshold for removal of small triangles is removed and the sphere is returned to raylib correctly.
pull/4460/head
MikiZX1 2 달 전
committed by GitHub
부모
커밋
1ffc687ef5
No known key found for this signature in database GPG 키 ID: B5690EEEBB952194
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. +1
    -0
      src/rmodels.c

+ 1
- 0
src/rmodels.c 파일 보기

@ -2820,6 +2820,7 @@ Mesh GenMeshSphere(float radius, int rings, int slices)
if ((rings >= 3) && (slices >= 3))
{
par_shapes_set_epsilon_degenerate_sphere(0.0);
par_shapes_mesh *sphere = par_shapes_create_parametric_sphere(slices, rings);
par_shapes_scale(sphere, radius, radius, radius);
// NOTE: Soft normals are computed internally

불러오는 중...
취소
저장