Merge branch 'master' of https://github.com/worklist/hifi into dev4

This commit is contained in:
Eric Johnston 2013-08-07 11:13:42 -07:00
commit 5373f85d30
4 changed files with 37 additions and 25 deletions

View file

@ -2743,7 +2743,7 @@ void Application::updateAvatar(float deltaTime) {
// If I'm in paint mode, send a voxel out to VOXEL server nodes. // If I'm in paint mode, send a voxel out to VOXEL server nodes.
if (_paintOn) { if (_paintOn) {
glm::vec3 avatarPos = _myAvatar.getPosition(); glm::vec3 avatarPos = _myAvatar.getPosition();
// For some reason, we don't want to flip X and Z here. // For some reason, we don't want to flip X and Z here.
@ -2754,7 +2754,7 @@ void Application::updateAvatar(float deltaTime) {
if (_paintingVoxel.x >= 0.0 && _paintingVoxel.x <= 1.0 && if (_paintingVoxel.x >= 0.0 && _paintingVoxel.x <= 1.0 &&
_paintingVoxel.y >= 0.0 && _paintingVoxel.y <= 1.0 && _paintingVoxel.y >= 0.0 && _paintingVoxel.y <= 1.0 &&
_paintingVoxel.z >= 0.0 && _paintingVoxel.z <= 1.0) { _paintingVoxel.z >= 0.0 && _paintingVoxel.z <= 1.0) {
PACKET_TYPE message = (_destructiveAddVoxel->isChecked() ? PACKET_TYPE message = (_destructiveAddVoxel->isChecked() ?
PACKET_TYPE_SET_VOXEL_DESTRUCTIVE : PACKET_TYPE_SET_VOXEL); PACKET_TYPE_SET_VOXEL_DESTRUCTIVE : PACKET_TYPE_SET_VOXEL);
sendVoxelEditMessage(message, _paintingVoxel); sendVoxelEditMessage(message, _paintingVoxel);
@ -3962,24 +3962,27 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng
// But, also identify the sender, and keep track of the contained jurisdiction root for this server // But, also identify the sender, and keep track of the contained jurisdiction root for this server
Node* voxelServer = NodeList::getInstance()->nodeWithAddress(&senderAddress); Node* voxelServer = NodeList::getInstance()->nodeWithAddress(&senderAddress);
uint16_t nodeID = voxelServer->getNodeID();
VoxelPositionSize jurisditionDetails;
voxelDetailsForCode(_voxelSceneStats.getJurisdictionRoot(), jurisditionDetails);
// see if this is the first we've heard of this node... // quick fix for crash... why would voxelServer be NULL?
if (_voxelServerJurisdictions.find(nodeID) == _voxelServerJurisdictions.end()) { if (voxelServer) {
printf("stats from new voxel server... v[%f, %f, %f, %f]\n", uint16_t nodeID = voxelServer->getNodeID();
jurisditionDetails.x, jurisditionDetails.y, jurisditionDetails.z, jurisditionDetails.s);
// Add the jurisditionDetails object to the list of "fade outs" VoxelPositionSize jurisditionDetails;
VoxelFade fade(VoxelFade::FADE_OUT, NODE_ADDED_RED, NODE_ADDED_GREEN, NODE_ADDED_BLUE); voxelDetailsForCode(_voxelSceneStats.getJurisdictionRoot(), jurisditionDetails);
fade.voxelDetails = jurisditionDetails;
_voxelFades.push_back(fade); // see if this is the first we've heard of this node...
if (_voxelServerJurisdictions.find(nodeID) == _voxelServerJurisdictions.end()) {
printf("stats from new voxel server... v[%f, %f, %f, %f]\n",
jurisditionDetails.x, jurisditionDetails.y, jurisditionDetails.z, jurisditionDetails.s);
// Add the jurisditionDetails object to the list of "fade outs"
VoxelFade fade(VoxelFade::FADE_OUT, NODE_ADDED_RED, NODE_ADDED_GREEN, NODE_ADDED_BLUE);
fade.voxelDetails = jurisditionDetails;
_voxelFades.push_back(fade);
}
// store jurisdiction details for later use
_voxelServerJurisdictions[nodeID] = jurisditionDetails;
} }
// store jurisdiction details for later use
_voxelServerJurisdictions[nodeID] = jurisditionDetails;
return statsMessageLength; return statsMessageLength;
} }

View file

@ -24,7 +24,7 @@ BendyLine::BendyLine(){
_gravityForce = glm::vec3(0.0f, 0.0f, 0.0f); _gravityForce = glm::vec3(0.0f, 0.0f, 0.0f);
_basePosition = glm::vec3(0.0f, 0.0f, 0.0f); _basePosition = glm::vec3(0.0f, 0.0f, 0.0f);
_baseDirection = glm::vec3(0.0f, 0.0f, 0.0f); _baseDirection = glm::vec3(0.0f, 1.0f, 0.0f);
_midPosition = glm::vec3(0.0f, 0.0f, 0.0f); _midPosition = glm::vec3(0.0f, 0.0f, 0.0f);
_endPosition = glm::vec3(0.0f, 0.0f, 0.0f); _endPosition = glm::vec3(0.0f, 0.0f, 0.0f);
_midVelocity = glm::vec3(0.0f, 0.0f, 0.0f); _midVelocity = glm::vec3(0.0f, 0.0f, 0.0f);

View file

@ -30,10 +30,12 @@ const float MINIMUM_EYE_ROTATION_DOT = 0.5f; // based on a dot product: 1.0 is
const float EYEBALL_RADIUS = 0.017; const float EYEBALL_RADIUS = 0.017;
const float EYELID_RADIUS = 0.019; const float EYELID_RADIUS = 0.019;
const float EYEBALL_COLOR[3] = { 0.9f, 0.9f, 0.8f }; const float EYEBALL_COLOR[3] = { 0.9f, 0.9f, 0.8f };
const float HAIR_SPRING_FORCE = 7.0f;
const float HAIR_TORQUE_FORCE = 0.1f; const float HAIR_SPRING_FORCE = 15.0f;
const float HAIR_GRAVITY_FORCE = 0.02f; const float HAIR_TORQUE_FORCE = 0.2f;
const float HAIR_GRAVITY_FORCE = 0.001f;
const float HAIR_DRAG = 10.0f; const float HAIR_DRAG = 10.0f;
const float HAIR_LENGTH = 0.09f; const float HAIR_LENGTH = 0.09f;
const float HAIR_THICKNESS = 0.03f; const float HAIR_THICKNESS = 0.03f;
const float NOSE_LENGTH = 0.025; const float NOSE_LENGTH = 0.025;
@ -75,7 +77,7 @@ Head::Head(Avatar* owningAvatar) :
_bodyRotation(0.0f, 0.0f, 0.0f), _bodyRotation(0.0f, 0.0f, 0.0f),
_renderLookatVectors(false), _renderLookatVectors(false),
_mohawkTriangleFan(NULL), _mohawkTriangleFan(NULL),
_mohawkColors(NULL), _mohawkColors(NULL),
_saccade(0.0f, 0.0f, 0.0f), _saccade(0.0f, 0.0f, 0.0f),
_saccadeTarget(0.0f, 0.0f, 0.0f), _saccadeTarget(0.0f, 0.0f, 0.0f),
_leftEyeBlink(0.0f), _leftEyeBlink(0.0f),
@ -129,7 +131,6 @@ void Head::reset() {
} }
void Head::resetHairPhysics() { void Head::resetHairPhysics() {
//glm::vec3 up = getUpDirection();
for (int t = 0; t < NUM_HAIR_TUFTS; t ++) { for (int t = 0; t < NUM_HAIR_TUFTS; t ++) {
for (int t = 0; t < NUM_HAIR_TUFTS; t ++) { for (int t = 0; t < NUM_HAIR_TUFTS; t ++) {
@ -333,10 +334,17 @@ void Head::setScale (float scale) {
delete[] _mohawkTriangleFan; delete[] _mohawkTriangleFan;
delete[] _mohawkColors; delete[] _mohawkColors;
createMohawk(); createMohawk();
if (USING_PHYSICAL_MOHAWK) {
for (int t = 0; t < NUM_HAIR_TUFTS; t ++) {
resetHairPhysics(); _hairTuft[t].setLength (_scale * HAIR_LENGTH );
_hairTuft[t].setThickness(_scale * HAIR_THICKNESS);
}
}
} }
void Head::createMohawk() { void Head::createMohawk() {
uint16_t nodeId = UNKNOWN_NODE_ID; uint16_t nodeId = UNKNOWN_NODE_ID;
if (_owningAvatar->getOwningNode()) { if (_owningAvatar->getOwningNode()) {
@ -737,6 +745,7 @@ void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosi
} }
void Head::updateHairPhysics(float deltaTime) { void Head::updateHairPhysics(float deltaTime) {
glm::quat orientation = getOrientation(); glm::quat orientation = getOrientation();
glm::vec3 up = orientation * IDENTITY_UP; glm::vec3 up = orientation * IDENTITY_UP;
glm::vec3 front = orientation * IDENTITY_FRONT; glm::vec3 front = orientation * IDENTITY_FRONT;

View file

@ -114,7 +114,7 @@ private:
float _returnSpringScale; //strength of return springs float _returnSpringScale; //strength of return springs
glm::vec3 _bodyRotation; glm::vec3 _bodyRotation;
bool _renderLookatVectors; bool _renderLookatVectors;
BendyLine _hairTuft[NUM_HAIR_TUFTS]; BendyLine _hairTuft[NUM_HAIR_TUFTS];
glm::vec3* _mohawkTriangleFan; glm::vec3* _mohawkTriangleFan;
glm::vec3* _mohawkColors; glm::vec3* _mohawkColors;
glm::vec3 _saccade; glm::vec3 _saccade;