mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:18:38 +02:00
Fade looking-at-me eye spheres over half a second
This commit is contained in:
parent
9ac4e2f687
commit
bed266dfe9
3 changed files with 24 additions and 13 deletions
|
@ -464,19 +464,24 @@ void Avatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition, boo
|
||||||
// If the avatar is looking at me, indicate that they are
|
// If the avatar is looking at me, indicate that they are
|
||||||
if (getHead()->getIsLookingAtMe() && Menu::getInstance()->isOptionChecked(MenuOption::ShowWhosLookingAtMe)) {
|
if (getHead()->getIsLookingAtMe() && Menu::getInstance()->isOptionChecked(MenuOption::ShowWhosLookingAtMe)) {
|
||||||
const glm::vec3 LOOKING_AT_ME_COLOR = { 1.0f, 1.0f, 1.0f };
|
const glm::vec3 LOOKING_AT_ME_COLOR = { 1.0f, 1.0f, 1.0f };
|
||||||
float alpha = 1.0f;
|
const float LOOKING_AT_ME_DURATION = 0.5f; // seconds
|
||||||
float radius = 0.035f;
|
quint64 now = usecTimestampNow();
|
||||||
Transform transform;
|
float alpha = 1.0f - ((float)(usecTimestampNow() - getHead()->getIsLookingAtMeStarted()))
|
||||||
glm::vec3 position = getHead()->getLeftEyePosition();
|
/ (LOOKING_AT_ME_DURATION * (float)USECS_PER_SECOND);
|
||||||
transform.setTranslation(position);
|
if (alpha > 0.0f) {
|
||||||
batch.setModelTransform(transform);
|
float radius = 0.035f;
|
||||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(batch, radius, 15, 15,
|
Transform transform;
|
||||||
glm::vec4(LOOKING_AT_ME_COLOR, alpha));
|
glm::vec3 position = getHead()->getLeftEyePosition();
|
||||||
position = getHead()->getRightEyePosition();
|
transform.setTranslation(position);
|
||||||
transform.setTranslation(position);
|
batch.setModelTransform(transform);
|
||||||
batch.setModelTransform(transform);
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(batch, radius, 15, 15,
|
||||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(batch, radius, 15, 15,
|
glm::vec4(LOOKING_AT_ME_COLOR, alpha));
|
||||||
glm::vec4(LOOKING_AT_ME_COLOR, alpha));
|
position = getHead()->getRightEyePosition();
|
||||||
|
transform.setTranslation(position);
|
||||||
|
batch.setModelTransform(transform);
|
||||||
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(batch, radius, 15, 15,
|
||||||
|
glm::vec4(LOOKING_AT_ME_COLOR, alpha));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// quick check before falling into the code below:
|
// quick check before falling into the code below:
|
||||||
|
|
|
@ -55,6 +55,7 @@ Head::Head(Avatar* owningAvatar) :
|
||||||
_deltaLeanForward(0.0f),
|
_deltaLeanForward(0.0f),
|
||||||
_isCameraMoving(false),
|
_isCameraMoving(false),
|
||||||
_isLookingAtMe(false),
|
_isLookingAtMe(false),
|
||||||
|
_isLookingAtMeStarted(0),
|
||||||
_faceModel(this),
|
_faceModel(this),
|
||||||
_leftEyeLookAtID(DependencyManager::get<GeometryCache>()->allocateID()),
|
_leftEyeLookAtID(DependencyManager::get<GeometryCache>()->allocateID()),
|
||||||
_rightEyeLookAtID(DependencyManager::get<GeometryCache>()->allocateID())
|
_rightEyeLookAtID(DependencyManager::get<GeometryCache>()->allocateID())
|
||||||
|
@ -323,6 +324,9 @@ glm::vec3 Head::getCorrectedLookAtPosition() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Head::setCorrectedLookAtPosition(glm::vec3 correctedLookAtPosition) {
|
void Head::setCorrectedLookAtPosition(glm::vec3 correctedLookAtPosition) {
|
||||||
|
if (!_isLookingAtMe) {
|
||||||
|
_isLookingAtMeStarted = usecTimestampNow();
|
||||||
|
}
|
||||||
_isLookingAtMe = true;
|
_isLookingAtMe = true;
|
||||||
_correctedLookAtPosition = correctedLookAtPosition;
|
_correctedLookAtPosition = correctedLookAtPosition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
glm::vec3 getCorrectedLookAtPosition();
|
glm::vec3 getCorrectedLookAtPosition();
|
||||||
void clearCorrectedLookAtPosition() { _isLookingAtMe = false; }
|
void clearCorrectedLookAtPosition() { _isLookingAtMe = false; }
|
||||||
bool getIsLookingAtMe() { return _isLookingAtMe; }
|
bool getIsLookingAtMe() { return _isLookingAtMe; }
|
||||||
|
quint64 getIsLookingAtMeStarted() { return _isLookingAtMeStarted; }
|
||||||
|
|
||||||
float getScale() const { return _scale; }
|
float getScale() const { return _scale; }
|
||||||
glm::vec3 getPosition() const { return _position; }
|
glm::vec3 getPosition() const { return _position; }
|
||||||
|
@ -139,6 +140,7 @@ private:
|
||||||
|
|
||||||
bool _isCameraMoving;
|
bool _isCameraMoving;
|
||||||
bool _isLookingAtMe;
|
bool _isLookingAtMe;
|
||||||
|
quint64 _isLookingAtMeStarted;
|
||||||
FaceModel _faceModel;
|
FaceModel _faceModel;
|
||||||
|
|
||||||
glm::vec3 _correctedLookAtPosition;
|
glm::vec3 _correctedLookAtPosition;
|
||||||
|
|
Loading…
Reference in a new issue