mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:19:24 +02:00
Merged from master. Get rid of redundant GL fog states. Moved local light parameters to shader uniform arrays.
This commit is contained in:
parent
56eadcb0dc
commit
ef4b95c6e0
12 changed files with 16 additions and 15 deletions
|
@ -23,19 +23,19 @@ function keyPressEvent(event) {
|
|||
|
||||
if (event.text == "1") {
|
||||
currentSelection = 0;
|
||||
print("selection = " + currentSelection);
|
||||
print("light election = " + currentSelection);
|
||||
}
|
||||
else if (event.text == "2" ) {
|
||||
currentSelection = 1;
|
||||
print("selection = " + currentSelection);
|
||||
print("light selection = " + currentSelection);
|
||||
}
|
||||
else if (event.text == "3" ) {
|
||||
currentSelection = 2;
|
||||
print("selection = " + currentSelection);
|
||||
print("light selection = " + currentSelection);
|
||||
}
|
||||
else if (event.text == "4" ) {
|
||||
currentSelection = 3;
|
||||
print("selection = " + currentSelection);
|
||||
print("light selection = " + currentSelection);
|
||||
}
|
||||
else if (event.text == "5" ) {
|
||||
localLightColors[currentSelection].x += 0.01;
|
||||
|
|
|
@ -39,3 +39,4 @@ void main(void) {
|
|||
// use standard pipeline transform
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
//
|
||||
const int MAX_LOCAL_LIGHTS = 2;
|
||||
|
||||
uniform int numLocalLights;
|
||||
uniform vec3 localLightDirections[MAX_LOCAL_LIGHTS];
|
||||
uniform vec3 localLightColors[MAX_LOCAL_LIGHTS];
|
||||
|
||||
|
@ -35,7 +36,7 @@ void main(void) {
|
|||
|
||||
// the local light that is always present
|
||||
vec4 totalLocalLight = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
for (int i = 0; i < MAX_LOCAL_LIGHTS; i++) {
|
||||
for (int i = 0; i < numLocalLights; i++) {
|
||||
float localDiffuse = dot(normalizedNormal, vec4(localLightDirections[i], 1.0));
|
||||
float localLight = step(0.0, localDiffuse);
|
||||
float localLightVal = localDiffuse * localLight;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
const int MAX_CLUSTERS = 128;
|
||||
const int INDICES_PER_VERTEX = 4;
|
||||
const int MAX_LOCAL_LIGHTS = 4;
|
||||
|
||||
uniform mat4 clusterMatrices[MAX_CLUSTERS];
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ void Avatar::init() {
|
|||
|
||||
for (int i = 0; i < MAX_LOCAL_LIGHTS; i++) {
|
||||
_localLightColors[i] = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
_localLightDirections[i] = glm::vec3(0.0f, 0.0f, 1.0f);
|
||||
_localLightDirections[i] = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
glm::vec3 darkGrayColor(0.3f, 0.3f, 0.3f);
|
||||
|
|
|
@ -1489,7 +1489,7 @@ void Model::renderMeshes(float alpha, RenderMode mode, bool translucent, bool re
|
|||
program->setUniform(skinLocations->shadowDistances, Application::getInstance()->getShadowDistances());
|
||||
}
|
||||
|
||||
// local light
|
||||
// local light uniforms
|
||||
skinProgram->setUniformValue("numLocalLights", _numLocalLights);
|
||||
skinProgram->setUniformArray("localLightDirections", _localLightDirections, MAX_LOCAL_LIGHTS);
|
||||
skinProgram->setUniformArray("localLightColors", _localLightColors, MAX_LOCAL_LIGHTS);
|
||||
|
|
Loading…
Reference in a new issue