高斯函数代码
const float CFFTOceanShader::_getGaussianRandomFloat() const { float u1 = rand() / (float)RAND_MAX; float u2 = rand() / (float)RAND_MAX; if (u1 < 1e-6f) u1 = 1e-6f; return sqrtf(-2.0f * logf(u1)) * cosf(2.0f * D3DX_PI * u2); }
高斯函数代码
const float CFFTOceanShader::_getGaussianRandomFloat() const { float u1 = rand() / (float)RAND_MAX; float u2 = rand() / (float)RAND_MAX; if (u1 < 1e-6f) u1 = 1e-6f; return sqrtf(-2.0f * logf(u1)) * cosf(2.0f * D3DX_PI * u2); }