소스 검색

REVIEWED: `GenImagePerlinNoise()`, clamp values #3071

pull/3074/head
Ray 2 년 전
부모
커밋
3a841ac130
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. +4
    -0
      src/rtextures.c

+ 4
- 0
src/rtextures.c 파일 보기

@ -846,6 +846,10 @@ Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float
// octaves = 6 -- number of "octaves" of noise3() to sum
float p = stb_perlin_fbm_noise3(nx, ny, 1.0f, 2.0f, 0.5f, 6);
// Clamp between -1.0f and 1.0f
if (p < -1.0f) p = -1.0f;
if (p > 1.0f) p = 1.0f;
// We need to normalize the data from [-1..1] to [0..1]
float np = (p + 1.0f)/2.0f;

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