Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const float PhongRandsConsts[32] =
- {
- 0,
- 188,
- 137,
- 225,
- 99,
- 207,
- 165,
- 241,
- 71,
- 198,
- 151,
- 233,
- 120,
- 216,
- 177,
- 248,
- 50,
- 193,
- 145,
- 229,
- 110,
- 212,
- 171,
- 244,
- 86,
- 203,
- 158,
- 237,
- 129,
- 220,
- 182,
- 252
- };
- inline float tosRGBFloat(float rgba)
- {
- float srgb = (rgba*rgba)*(rgba*0.2848f + 0.7152f);
- return srgb;
- }
- Math::Vector4* GetPhongRands()
- {
- static Math::Vector4 rands[32];
- float r1 = 0.032f;
- for (int it = 0, end = 32; it != end; ++it)
- {
- float r2 = tosRGBFloat(PhongRandsConsts[it] / 255.f);
- //float r2 = Platform::Random::RandFloat(0.f, 1.0f);
- rands[it].x = r1;
- rands[it].y = r2;
- rands[it].z = Math::Cos(2.f * Math::PI<float>() * r2);
- rands[it].w = Math::Sin(2.f * Math::PI<float>() * r2);
- r1 += 0.032f;
- }
- return rands;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement