GLES1: Entry points for lighting and materials

- glLight*/glMaterial and their queries
- Use new packed enums in these entry points, except for lightmodel
which stays GLenum to be consistent with other generic glGet's
- State.cpp: New glGet* queries related to light model and
light/normal rescale enablement
- GLES1State.cpp: Functions to get/set lighting/material state
- Validation for lighting/materials

+ Add a few convenience methods to random_utils for sampling
non-negative floats and a sampler for random booleans

BUG=angleproject:2306

Change-Id: If7ba0c0a0dc75f88fbaa986b904f1ea96ee6512e
Reviewed-on: https://chromium-review.googlesource.com/1065502
Commit-Queue: Lingfeng Yang <lfy@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Lingfeng Yang
2018-05-17 22:36:52 -07:00
committed by Commit Bot
parent 2b0cdcc1b4
commit 4a09c1a245
20 changed files with 1284 additions and 135 deletions

View File

@@ -37,6 +37,12 @@ void RNG::reseed(unsigned int newSeed)
mGenerator.seed(newSeed);
}
bool RNG::randomBool(float probTrue)
{
std::bernoulli_distribution dist(probTrue);
return dist(mGenerator);
}
int RNG::randomInt()
{
std::uniform_int_distribution<int> intDistribution;
@@ -67,6 +73,13 @@ float RNG::randomFloatBetween(float min, float max)
return floatDistribution(mGenerator);
}
float RNG::randomFloatNonnegative()
{
std::uniform_real_distribution<float> floatDistribution(0.0f,
std::numeric_limits<float>::max());
return floatDistribution(mGenerator);
}
float RNG::randomNegativeOneToOne()
{
return randomFloatBetween(-1.0f, 1.0f);