mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 01:13:32 +02:00
Rave tweaks: Use separate light settings for avatars and particles
This commit is contained in:
parent
7583e1cd14
commit
35465686db
3 changed files with 38 additions and 10 deletions
|
@ -1159,6 +1159,10 @@ void Avatar::render(bool lookingInMirror, bool renderAvatarBalls) {
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
if (Application::getInstance()->getAvatar()->getHand().isRaveGloveActive()) {
|
||||
_hand.setRaveLights(RAVE_LIGHTS_AVATAR);
|
||||
}
|
||||
|
||||
// render a simple round on the ground projected down from the avatar's position
|
||||
renderDiskShadow(_position, glm::vec3(0.0f, 1.0f, 0.0f), _scale * 0.1f, 0.2f);
|
||||
|
||||
|
@ -1225,16 +1229,6 @@ void Avatar::renderScreenTint(ScreenTintLayer layer, Camera& whichCamera) {
|
|||
if (layer == SCREEN_TINT_BEFORE_AVATARS) {
|
||||
if (_hand.isRaveGloveActive()) {
|
||||
_hand.renderRaveGloveStage();
|
||||
|
||||
// Set some mood lighting
|
||||
GLfloat ambient_color[] = { 0.0, 0.0, 0.0 };
|
||||
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color);
|
||||
GLfloat diffuse_color[] = { 0.4, 0.0, 0.0 };
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color);
|
||||
GLfloat specular_color[] = { 0.0, 0.0, 0.0, 0.0};
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, specular_color);
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, specular_color);
|
||||
glMateriali(GL_FRONT, GL_SHININESS, 0);
|
||||
}
|
||||
}
|
||||
else if (layer == SCREEN_TINT_BEFORE_AVATARS) {
|
||||
|
|
|
@ -145,6 +145,9 @@ void Hand::render(bool lookingInMirror) {
|
|||
|
||||
if (_raveGloveInitialized) {
|
||||
updateRaveGloveEmitters(); // do this after calculateGeometry
|
||||
|
||||
// Use normal lighting for the particles
|
||||
setRaveLights(RAVE_LIGHTS_PARTICLES);
|
||||
_raveGloveParticleSystem.render();
|
||||
}
|
||||
}
|
||||
|
@ -161,6 +164,31 @@ void Hand::render(bool lookingInMirror) {
|
|||
}
|
||||
}
|
||||
|
||||
void Hand::setRaveLights(RaveLightsSetting setting) {
|
||||
if (setting == RAVE_LIGHTS_AVATAR) {
|
||||
// Set some mood lighting
|
||||
GLfloat ambient_color[] = { 0.0, 0.0, 0.0 };
|
||||
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color);
|
||||
GLfloat diffuse_color[] = { 0.4, 0.0, 0.0 };
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color);
|
||||
GLfloat specular_color[] = { 0.0, 0.0, 0.0, 0.0};
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, specular_color);
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, specular_color);
|
||||
glMateriali(GL_FRONT, GL_SHININESS, 0);
|
||||
}
|
||||
else if (setting == RAVE_LIGHTS_PARTICLES) {
|
||||
// particles use a brighter light setting
|
||||
GLfloat ambient_color[] = { 0.7, 0.7, 0.8 };
|
||||
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color);
|
||||
GLfloat diffuse_color[] = { 0.8, 0.7, 0.7 };
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color);
|
||||
GLfloat specular_color[] = { 1.0, 1.0, 1.0, 1.0};
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, specular_color);
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, specular_color);
|
||||
glMateriali(GL_FRONT, GL_SHININESS, 96);
|
||||
}
|
||||
}
|
||||
|
||||
void Hand::renderRaveGloveStage() {
|
||||
if (_owningAvatar && _owningAvatar->isMyAvatar()) {
|
||||
Head& head = _owningAvatar->getHead();
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
#include <SharedUtil.h>
|
||||
#include <vector>
|
||||
|
||||
enum RaveLightsSetting {
|
||||
RAVE_LIGHTS_AVATAR = 0,
|
||||
RAVE_LIGHTS_PARTICLES
|
||||
};
|
||||
|
||||
class Avatar;
|
||||
class ProgramObject;
|
||||
|
||||
|
@ -42,6 +47,7 @@ public:
|
|||
void simulate(float deltaTime, bool isMine);
|
||||
void render(bool lookingInMirror);
|
||||
void renderRaveGloveStage();
|
||||
void setRaveLights(RaveLightsSetting setting);
|
||||
|
||||
void setBallColor (glm::vec3 ballColor ) { _ballColor = ballColor; }
|
||||
void updateRaveGloveParticles(float deltaTime);
|
||||
|
|
Loading…
Reference in a new issue