mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:01:06 +02:00
Merge pull request #1346 from PhilipRosedale/remove_avatar_balls
Fix to render other avatar's again
This commit is contained in:
commit
2cf4c3f814
3 changed files with 40 additions and 25 deletions
|
@ -1412,9 +1412,16 @@ void Application::processAvatarURLsMessage(unsigned char* packetData, size_t dat
|
||||||
if (!avatar) {
|
if (!avatar) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QDataStream in(QByteArray((char*)packetData, dataBytes));
|
// PER Note: message is no longer processed but used to trigger
|
||||||
QUrl voxelURL;
|
// Dataserver lookup - redesign this to instantly ask the
|
||||||
in >> voxelURL;
|
// dataserver on first receipt of other avatar UUID, and also
|
||||||
|
// don't ask over and over again. Instead use this message to
|
||||||
|
// Tell the other avatars that your dataserver data has
|
||||||
|
// changed.
|
||||||
|
|
||||||
|
//QDataStream in(QByteArray((char*)packetData, dataBytes));
|
||||||
|
//QUrl voxelURL;
|
||||||
|
//in >> voxelURL;
|
||||||
|
|
||||||
// use this timing to as the data-server for an updated mesh for this avatar (if we have UUID)
|
// use this timing to as the data-server for an updated mesh for this avatar (if we have UUID)
|
||||||
DataServerClient::getValuesForKeysAndUUID(QStringList() << DataServerKey::FaceMeshURL << DataServerKey::SkeletonURL,
|
DataServerClient::getValuesForKeysAndUUID(QStringList() << DataServerKey::FaceMeshURL << DataServerKey::SkeletonURL,
|
||||||
|
@ -2553,6 +2560,11 @@ void Application::updateAvatar(float deltaTime) {
|
||||||
controlledBroadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString,
|
controlledBroadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString,
|
||||||
nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
|
nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
|
||||||
|
|
||||||
|
const float AVATAR_URLS_SEND_INTERVAL = 1.0f;
|
||||||
|
if (shouldDo(AVATAR_URLS_SEND_INTERVAL, deltaTime)) {
|
||||||
|
QUrl empty;
|
||||||
|
Avatar::sendAvatarURLsMessage(empty);
|
||||||
|
}
|
||||||
// Update _viewFrustum with latest camera and view frustum data...
|
// Update _viewFrustum with latest camera and view frustum data...
|
||||||
// NOTE: we get this from the view frustum, to make it simpler, since the
|
// NOTE: we get this from the view frustum, to make it simpler, since the
|
||||||
// loadViewFrumstum() method will get the correct details from the camera
|
// loadViewFrumstum() method will get the correct details from the camera
|
||||||
|
|
|
@ -168,18 +168,18 @@ void Avatar::follow(Avatar* leadingAvatar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
|
void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
|
||||||
|
|
||||||
if (_leadingAvatar && !_leadingAvatar->getOwningNode()->isAlive()) {
|
if (_leadingAvatar && !_leadingAvatar->getOwningNode()->isAlive()) {
|
||||||
follow(NULL);
|
follow(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_scale != _newScale) {
|
if (_scale != _newScale) {
|
||||||
setScale(_newScale);
|
setScale(_newScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy velocity so we can use it later for acceleration
|
// copy velocity so we can use it later for acceleration
|
||||||
glm::vec3 oldVelocity = getVelocity();
|
glm::vec3 oldVelocity = getVelocity();
|
||||||
|
|
||||||
// update balls
|
// update balls
|
||||||
if (_balls) {
|
if (_balls) {
|
||||||
_balls->moveOrigin(_position);
|
_balls->moveOrigin(_position);
|
||||||
|
@ -194,7 +194,7 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
|
||||||
|
|
||||||
// update torso rotation based on head lean
|
// update torso rotation based on head lean
|
||||||
_skeleton.joint[AVATAR_JOINT_TORSO].rotation = glm::quat(glm::radians(glm::vec3(
|
_skeleton.joint[AVATAR_JOINT_TORSO].rotation = glm::quat(glm::radians(glm::vec3(
|
||||||
_head.getLeanForward(), 0.0f, _head.getLeanSideways())));
|
_head.getLeanForward(), 0.0f, _head.getLeanSideways())));
|
||||||
|
|
||||||
// apply joint data (if any) to skeleton
|
// apply joint data (if any) to skeleton
|
||||||
bool enableHandMovement = true;
|
bool enableHandMovement = true;
|
||||||
|
@ -205,25 +205,16 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
|
||||||
enableHandMovement &= (it->jointID != AVATAR_JOINT_RIGHT_WRIST);
|
enableHandMovement &= (it->jointID != AVATAR_JOINT_RIGHT_WRIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update avatar skeleton
|
||||||
|
_skeleton.update(deltaTime, getOrientation(), _position);
|
||||||
|
|
||||||
|
|
||||||
|
// if this is not my avatar, then hand position comes from transmitted data
|
||||||
|
_skeleton.joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = _handPosition;
|
||||||
|
|
||||||
//update the movement of the hand and process handshaking with other avatars...
|
//update the movement of the hand and process handshaking with other avatars...
|
||||||
updateHandMovementAndTouching(deltaTime, enableHandMovement);
|
updateHandMovementAndTouching(deltaTime, enableHandMovement);
|
||||||
|
|
||||||
// use speed and angular velocity to determine walking vs. standing
|
|
||||||
if (_speed + fabs(_bodyYawDelta) > 0.2) {
|
|
||||||
_mode = AVATAR_MODE_WALKING;
|
|
||||||
} else {
|
|
||||||
_mode = AVATAR_MODE_INTERACTING;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update position by velocity, and subtract the change added earlier for gravity
|
|
||||||
_position += _velocity * deltaTime;
|
|
||||||
|
|
||||||
// update avatar skeleton
|
|
||||||
_skeleton.update(deltaTime, getOrientation(), _position);
|
|
||||||
|
|
||||||
// if this is not my avatar, then hand position comes from transmitted data
|
|
||||||
_skeleton.joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = _handPosition;
|
|
||||||
|
|
||||||
_hand.simulate(deltaTime, false);
|
_hand.simulate(deltaTime, false);
|
||||||
_skeletonModel.simulate(deltaTime);
|
_skeletonModel.simulate(deltaTime);
|
||||||
_head.setBodyRotation(glm::vec3(_bodyPitch, _bodyYaw, _bodyRoll));
|
_head.setBodyRotation(glm::vec3(_bodyPitch, _bodyYaw, _bodyRoll));
|
||||||
|
@ -233,11 +224,20 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
|
||||||
_head.setScale(_scale);
|
_head.setScale(_scale);
|
||||||
_head.setSkinColor(glm::vec3(SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]));
|
_head.setSkinColor(glm::vec3(SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]));
|
||||||
_head.simulate(deltaTime, false);
|
_head.simulate(deltaTime, false);
|
||||||
|
|
||||||
|
// use speed and angular velocity to determine walking vs. standing
|
||||||
|
if (_speed + fabs(_bodyYawDelta) > 0.2) {
|
||||||
|
_mode = AVATAR_MODE_WALKING;
|
||||||
|
} else {
|
||||||
|
_mode = AVATAR_MODE_INTERACTING;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update position by velocity, and subtract the change added earlier for gravity
|
||||||
|
_position += _velocity * deltaTime;
|
||||||
|
|
||||||
// Zero thrust out now that we've added it to velocity in this frame
|
// Zero thrust out now that we've added it to velocity in this frame
|
||||||
_thrust = glm::vec3(0, 0, 0);
|
_thrust = glm::vec3(0, 0, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::setMouseRay(const glm::vec3 &origin, const glm::vec3 &direction) {
|
void Avatar::setMouseRay(const glm::vec3 &origin, const glm::vec3 &direction) {
|
||||||
|
@ -452,6 +452,8 @@ void Avatar::renderBody(bool forceRenderHead) {
|
||||||
_head.getVideoFace().render(1.0f);
|
_head.getVideoFace().render(1.0f);
|
||||||
} else {
|
} else {
|
||||||
// Render the body's voxels and head
|
// Render the body's voxels and head
|
||||||
|
glm::vec3 pos = getPosition();
|
||||||
|
//printf("Render other at %.3f, %.2f, %.2f\n", pos.x, pos.y, pos.z);
|
||||||
_skeletonModel.render(1.0f);
|
_skeletonModel.render(1.0f);
|
||||||
_head.render(1.0f, false);
|
_head.render(1.0f, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ void SkeletonModel::simulate(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonModel::render(float alpha) {
|
bool SkeletonModel::render(float alpha) {
|
||||||
|
|
||||||
if (_jointStates.isEmpty()) {
|
if (_jointStates.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue