From 35465686db3246e06544d90f181575374707ff52 Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Tue, 6 Aug 2013 17:39:56 -0700 Subject: [PATCH] Rave tweaks: Use separate light settings for avatars and particles --- interface/src/avatar/Avatar.cpp | 14 ++++---------- interface/src/avatar/Hand.cpp | 28 ++++++++++++++++++++++++++++ interface/src/avatar/Hand.h | 6 ++++++ 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 322f5adc64..1f1609d401 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -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) { diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index 484ce0de9a..e274e64e1a 100755 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -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(); diff --git a/interface/src/avatar/Hand.h b/interface/src/avatar/Hand.h index 86995e2bdc..54a2b2e8a3 100755 --- a/interface/src/avatar/Hand.h +++ b/interface/src/avatar/Hand.h @@ -20,6 +20,11 @@ #include #include +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);