mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Code review issues addressed.
This commit is contained in:
parent
1a4a165c8b
commit
aa0cab2180
4 changed files with 27 additions and 22 deletions
|
@ -62,11 +62,12 @@ void Hand::calculateGeometry() {
|
|||
for (size_t f = 0; f < palm.getNumFingers(); ++f) {
|
||||
FingerData& finger = palm.getFingers()[f];
|
||||
if (finger.isActive()) {
|
||||
const float standardBallRadius = 0.01f;
|
||||
_leapBalls.resize(_leapBalls.size() + 1);
|
||||
HandBall& ball = _leapBalls.back();
|
||||
ball.rotation = _baseOrientation;
|
||||
ball.position = finger.getTipPosition();
|
||||
ball.radius = 0.01;
|
||||
ball.radius = standardBallRadius;
|
||||
ball.touchForce = 0.0;
|
||||
ball.isCollidable = true;
|
||||
}
|
||||
|
@ -161,9 +162,10 @@ void Hand::renderHandSpheres() {
|
|||
for (size_t i = 0; i < getNumPalms(); ++i) {
|
||||
PalmData& palm = getPalms()[i];
|
||||
if (palm.isActive()) {
|
||||
const float palmThickness = 0.002f;
|
||||
glColor4f(_ballColor.r, _ballColor.g, _ballColor.b, 0.25);
|
||||
glm::vec3 tip = palm.getPosition();
|
||||
glm::vec3 root = palm.getPosition() + palm.getNormal() * 0.002f;
|
||||
glm::vec3 root = palm.getPosition() + palm.getNormal() * palmThickness;
|
||||
Avatar::renderJointConnectingCone(root, tip, 0.05, 0.03);
|
||||
}
|
||||
}
|
||||
|
@ -235,23 +237,22 @@ void Hand::updateFingerParticles(float deltaTime) {
|
|||
glm::vec3 particleEmitterPosition = finger.getTipPosition();
|
||||
|
||||
// this aspect is still being designed....
|
||||
|
||||
glm::vec3 tilt = glm::vec3
|
||||
(
|
||||
30.0f * sinf( t * 0.55f ),
|
||||
0.0f,
|
||||
30.0f * cosf( t * 0.75f )
|
||||
);
|
||||
const float tiltMag = 30.0f;
|
||||
const float tiltXFreq = 0.55f;
|
||||
const float tiltZFreq = 0.75f;
|
||||
glm::vec3 tilt = glm::vec3(tiltMag * sinf( t * tiltXFreq ),
|
||||
0.0f,
|
||||
tiltMag * cosf( t * tiltZFreq ));
|
||||
|
||||
glm::quat particleEmitterRotation = glm::quat(glm::radians(tilt));
|
||||
|
||||
_particleSystem.setEmitterPosition(_fingerParticleEmitter[0], particleEmitterPosition);
|
||||
_particleSystem.setEmitterRotation(_fingerParticleEmitter[0], particleEmitterRotation);
|
||||
|
||||
float radius = 0.005f;
|
||||
glm::vec4 color(1.0f, 0.6f, 0.0f, 0.5f);
|
||||
glm::vec3 velocity(0.0f, 0.005f, 0.0f);
|
||||
float lifespan = 0.3f;
|
||||
const float radius = 0.005f;
|
||||
const glm::vec4 color(1.0f, 0.6f, 0.0f, 0.5f);
|
||||
const glm::vec3 velocity(0.0f, 0.005f, 0.0f);
|
||||
const float lifespan = 0.3f;
|
||||
_particleSystem.emitParticlesNow(_fingerParticleEmitter[0], 1, radius, color, velocity, lifespan);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
static const float fingerVectorRadix = 4; // bits of precision when converting from float<->fixed
|
||||
|
||||
AvatarData::AvatarData(Node* owningNode) :
|
||||
NodeData(owningNode),
|
||||
_handPosition(0,0,0),
|
||||
|
@ -140,9 +142,9 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
*destinationBuffer++ = (unsigned char)fingerVectors.size();
|
||||
|
||||
for (size_t i = 0; i < fingerVectors.size(); ++i) {
|
||||
destinationBuffer += packFloatScalarToSignedTwoByteFixed(destinationBuffer, fingerVectors[i].x, 4);
|
||||
destinationBuffer += packFloatScalarToSignedTwoByteFixed(destinationBuffer, fingerVectors[i].y, 4);
|
||||
destinationBuffer += packFloatScalarToSignedTwoByteFixed(destinationBuffer, fingerVectors[i].z, 4);
|
||||
destinationBuffer += packFloatScalarToSignedTwoByteFixed(destinationBuffer, fingerVectors[i].x, fingerVectorRadix);
|
||||
destinationBuffer += packFloatScalarToSignedTwoByteFixed(destinationBuffer, fingerVectors[i].y, fingerVectorRadix);
|
||||
destinationBuffer += packFloatScalarToSignedTwoByteFixed(destinationBuffer, fingerVectors[i].z, fingerVectorRadix);
|
||||
}
|
||||
|
||||
// skeleton joints
|
||||
|
@ -253,9 +255,9 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
if (numFingerVectors > 0) {
|
||||
std::vector<glm::vec3> fingerVectors(numFingerVectors);
|
||||
for (size_t i = 0; i < numFingerVectors; ++i) {
|
||||
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerVectors[i].x), 4);
|
||||
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerVectors[i].y), 4);
|
||||
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerVectors[i].z), 4);
|
||||
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerVectors[i].x), fingerVectorRadix);
|
||||
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerVectors[i].y), fingerVectorRadix);
|
||||
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerVectors[i].z), fingerVectorRadix);
|
||||
}
|
||||
_handData->decodeRemoteData(fingerVectors);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,9 @@ HandData::HandData(AvatarData* owningAvatar) :
|
|||
_baseOrientation(0.0f, 0.0f, 0.0f, 1.0f),
|
||||
_owningAvatarData(owningAvatar)
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
_palms.push_back(PalmData(this));
|
||||
}
|
||||
}
|
||||
|
||||
PalmData::PalmData(HandData* owningHandData) :
|
||||
|
@ -23,8 +24,9 @@ _rawNormal(0, 1, 0),
|
|||
_isActive(false),
|
||||
_owningHandData(owningHandData)
|
||||
{
|
||||
for (int i = 0; i < NUM_FINGERS_PER_HAND; ++i)
|
||||
for (int i = 0; i < NUM_FINGERS_PER_HAND; ++i) {
|
||||
_fingers.push_back(FingerData(this, owningHandData));
|
||||
}
|
||||
}
|
||||
|
||||
FingerData::FingerData(PalmData* owningPalmData, HandData* owningHandData) :
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
// position conversion
|
||||
glm::vec3 leapPositionToWorldPosition(const glm::vec3& leapPosition) {
|
||||
float unitScale = 0.001; // convert mm to meters
|
||||
const float unitScale = 0.001; // convert mm to meters
|
||||
return _basePosition + _baseOrientation * (leapPosition * unitScale);
|
||||
}
|
||||
glm::vec3 leapDirectionToWorldDirection(const glm::vec3& leapDirection) {
|
||||
|
|
Loading…
Reference in a new issue