replace .f with .0f as per coding standard

This commit is contained in:
Andrew Meadows 2014-04-10 07:53:11 -07:00
parent c88be1ac34
commit 4942e93daa
2 changed files with 28 additions and 28 deletions

View file

@ -233,22 +233,22 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode) {
// quick check before falling into the code below: // quick check before falling into the code below:
// (a 10 degree breadth of an almost 2 meter avatar kicks in at about 12m) // (a 10 degree breadth of an almost 2 meter avatar kicks in at about 12m)
const float MIN_VOICE_SPHERE_DISTANCE = 12.f; const float MIN_VOICE_SPHERE_DISTANCE = 12.0f;
if (distanceToTarget > MIN_VOICE_SPHERE_DISTANCE) { if (distanceToTarget > MIN_VOICE_SPHERE_DISTANCE) {
// render voice intensity sphere for avatars that are farther away // render voice intensity sphere for avatars that are farther away
const float MAX_SPHERE_ANGLE = 10.f * RADIANS_PER_DEGREE; const float MAX_SPHERE_ANGLE = 10.0f * RADIANS_PER_DEGREE;
const float MIN_SPHERE_ANGLE = 1.f * RADIANS_PER_DEGREE; const float MIN_SPHERE_ANGLE = 1.0f * RADIANS_PER_DEGREE;
const float MIN_SPHERE_SIZE = 0.01f; const float MIN_SPHERE_SIZE = 0.01f;
const float SPHERE_LOUDNESS_SCALING = 0.0005f; const float SPHERE_LOUDNESS_SCALING = 0.0005f;
const float SPHERE_COLOR[] = { 0.5f, 0.8f, 0.8f }; const float SPHERE_COLOR[] = { 0.5f, 0.8f, 0.8f };
float height = getSkeletonHeight(); float height = getSkeletonHeight();
glm::vec3 delta = height * (getHead()->getCameraOrientation() * IDENTITY_UP) / 2.f; glm::vec3 delta = height * (getHead()->getCameraOrientation() * IDENTITY_UP) / 2.0f;
float angle = abs(angleBetween(toTarget + delta, toTarget - delta)); float angle = abs(angleBetween(toTarget + delta, toTarget - delta));
float sphereRadius = getHead()->getAverageLoudness() * SPHERE_LOUDNESS_SCALING; float sphereRadius = getHead()->getAverageLoudness() * SPHERE_LOUDNESS_SCALING;
if (renderMode == NORMAL_RENDER_MODE && (sphereRadius > MIN_SPHERE_SIZE) && if (renderMode == NORMAL_RENDER_MODE && (sphereRadius > MIN_SPHERE_SIZE) &&
(angle < MAX_SPHERE_ANGLE) && (angle > MIN_SPHERE_ANGLE)) { (angle < MAX_SPHERE_ANGLE) && (angle > MIN_SPHERE_ANGLE)) {
glColor4f(SPHERE_COLOR[0], SPHERE_COLOR[1], SPHERE_COLOR[2], 1.f - angle / MAX_SPHERE_ANGLE); glColor4f(SPHERE_COLOR[0], SPHERE_COLOR[1], SPHERE_COLOR[2], 1.0f - angle / MAX_SPHERE_ANGLE);
glPushMatrix(); glPushMatrix();
glTranslatef(_position.x, _position.y, _position.z); glTranslatef(_position.x, _position.y, _position.z);
glScalef(height, height, height); glScalef(height, height, height);
@ -280,9 +280,9 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode) {
glm::vec3 chatAxis = glm::axis(chatRotation); glm::vec3 chatAxis = glm::axis(chatRotation);
glRotatef(glm::degrees(glm::angle(chatRotation)), chatAxis.x, chatAxis.y, chatAxis.z); glRotatef(glm::degrees(glm::angle(chatRotation)), chatAxis.x, chatAxis.y, chatAxis.z);
glColor3f(0.f, 0.8f, 0.f); glColor3f(0.0f, 0.8f, 0.0f);
glRotatef(180.f, 0.f, 1.f, 0.f); glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
glRotatef(180.f, 0.f, 0.f, 1.f); glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
glScalef(_scale * CHAT_MESSAGE_SCALE, _scale * CHAT_MESSAGE_SCALE, 1.0f); glScalef(_scale * CHAT_MESSAGE_SCALE, _scale * CHAT_MESSAGE_SCALE, 1.0f);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
@ -298,7 +298,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode) {
_chatMessage[lastIndex] = '\0'; _chatMessage[lastIndex] = '\0';
textRenderer(CHAT)->draw(-width / 2.0f, 0, _chatMessage.c_str()); textRenderer(CHAT)->draw(-width / 2.0f, 0, _chatMessage.c_str());
_chatMessage[lastIndex] = lastChar; _chatMessage[lastIndex] = lastChar;
glColor3f(0.f, 1.f, 0.f); glColor3f(0.0f, 1.0f, 0.0f);
textRenderer(CHAT)->draw(width / 2.0f - lastWidth, 0, _chatMessage.c_str() + lastIndex); textRenderer(CHAT)->draw(width / 2.0f - lastWidth, 0, _chatMessage.c_str() + lastIndex);
} }
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
@ -550,7 +550,7 @@ bool Avatar::findParticleCollisions(const glm::vec3& particleCenter, float parti
const PalmData* palm = handData->getPalm(i); const PalmData* palm = handData->getPalm(i);
if (palm && palm->hasPaddle()) { if (palm && palm->hasPaddle()) {
// create a disk collision proxy where the hand is // create a disk collision proxy where the hand is
glm::vec3 fingerAxis(0.f); glm::vec3 fingerAxis(0.0f);
for (size_t f = 0; f < palm->getNumFingers(); ++f) { for (size_t f = 0; f < palm->getNumFingers(); ++f) {
const FingerData& finger = (palm->getFingers())[f]; const FingerData& finger = (palm->getFingers())[f];
if (finger.isActive()) { if (finger.isActive()) {
@ -692,8 +692,8 @@ void Avatar::renderJointConnectingCone(glm::vec3 position1, glm::vec3 position2,
glm::vec3 perpCos = glm::normalize(glm::cross(axis, perpSin)); glm::vec3 perpCos = glm::normalize(glm::cross(axis, perpSin));
perpSin = glm::cross(perpCos, axis); perpSin = glm::cross(perpCos, axis);
float anglea = 0.f; float anglea = 0.0f;
float angleb = 0.f; float angleb = 0.0f;
for (int i = 0; i < NUM_BODY_CONE_SIDES; i ++) { for (int i = 0; i < NUM_BODY_CONE_SIDES; i ++) {
@ -743,8 +743,8 @@ void Avatar::updateCollisionFlags() {
void Avatar::setScale(float scale) { void Avatar::setScale(float scale) {
_scale = scale; _scale = scale;
if (_targetScale * (1.f - RESCALING_TOLERANCE) < _scale && if (_targetScale * (1.0f - RESCALING_TOLERANCE) < _scale &&
_scale < _targetScale * (1.f + RESCALING_TOLERANCE)) { _scale < _targetScale * (1.0f + RESCALING_TOLERANCE)) {
_scale = _targetScale; _scale = _targetScale;
} }
} }

View file

@ -63,8 +63,8 @@ bool collideShapesCoarse(const QVector<const Shape*>& shapesA, const QVector<con
} }
} }
if (tempCollisions.size() > 0) { if (tempCollisions.size() > 0) {
glm::vec3 totalPenetration(0.f); glm::vec3 totalPenetration(0.0f);
glm::vec3 averageContactPoint(0.f); glm::vec3 averageContactPoint(0.0f);
for (int j = 0; j < tempCollisions.size(); ++j) { for (int j = 0; j < tempCollisions.size(); ++j) {
CollisionInfo* c = tempCollisions.getCollision(j); CollisionInfo* c = tempCollisions.getCollision(j);
totalPenetration = addPenetrations(totalPenetration, c->_penetration); totalPenetration = addPenetrations(totalPenetration, c->_penetration);
@ -86,7 +86,7 @@ bool sphereSphere(const SphereShape* sphereA, const SphereShape* sphereB, Collis
float distance = sqrtf(distanceSquared); float distance = sqrtf(distanceSquared);
if (distance < EPSILON) { if (distance < EPSILON) {
// the spheres are on top of each other, so we pick an arbitrary penetration direction // the spheres are on top of each other, so we pick an arbitrary penetration direction
BA = glm::vec3(0.f, 1.f, 0.f); BA = glm::vec3(0.0f, 1.0f, 0.0f);
distance = totalRadius; distance = totalRadius;
} else { } else {
BA /= distance; BA /= distance;
@ -121,7 +121,7 @@ bool sphereCapsule(const SphereShape* sphereA, const CapsuleShape* capsuleB, Col
} }
if (absAxialDistance > capsuleB->getHalfHeight()) { if (absAxialDistance > capsuleB->getHalfHeight()) {
// sphere hits capsule on a cap --> recompute radialAxis to point from spherA to cap center // sphere hits capsule on a cap --> recompute radialAxis to point from spherA to cap center
float sign = (axialDistance > 0.f) ? 1.f : -1.f; float sign = (axialDistance > 0.0f) ? 1.0f : -1.0f;
radialAxis = BA + (sign * capsuleB->getHalfHeight()) * capsuleAxis; radialAxis = BA + (sign * capsuleB->getHalfHeight()) * capsuleAxis;
radialDistance2 = glm::length2(radialAxis); radialDistance2 = glm::length2(radialAxis);
if (radialDistance2 > totalRadius2) { if (radialDistance2 > totalRadius2) {
@ -153,12 +153,12 @@ bool sphereCapsule(const SphereShape* sphereA, const CapsuleShape* capsuleB, Col
return false; return false;
} }
// ... but still defined for the cap case // ... but still defined for the cap case
if (axialDistance < 0.f) { if (axialDistance < 0.0f) {
// we're hitting the start cap, so we negate the capsuleAxis // we're hitting the start cap, so we negate the capsuleAxis
capsuleAxis *= -1; capsuleAxis *= -1;
} }
// penetration points from A into B // penetration points from A into B
float sign = (axialDistance > 0.f) ? -1.f : 1.f; float sign = (axialDistance > 0.0f) ? -1.0f : 1.0f;
collision->_penetration = (sign * (totalRadius + capsuleB->getHalfHeight() - absAxialDistance)) * capsuleAxis; collision->_penetration = (sign * (totalRadius + capsuleB->getHalfHeight() - absAxialDistance)) * capsuleAxis;
// contactPoint is on surface of sphereA // contactPoint is on surface of sphereA
collision->_contactPoint = sphereA->getPosition() + (sign * sphereA->getRadius()) * capsuleAxis; collision->_contactPoint = sphereA->getPosition() + (sign * sphereA->getRadius()) * capsuleAxis;
@ -191,7 +191,7 @@ bool capsuleSphere(const CapsuleShape* capsuleA, const SphereShape* sphereB, Col
if (absAxialDistance > capsuleA->getHalfHeight()) { if (absAxialDistance > capsuleA->getHalfHeight()) {
// sphere hits capsule on a cap // sphere hits capsule on a cap
// --> recompute radialAxis and closestApproach // --> recompute radialAxis and closestApproach
float sign = (axialDistance > 0.f) ? 1.f : -1.f; float sign = (axialDistance > 0.0f) ? 1.0f : -1.0f;
closestApproach = capsuleA->getPosition() + (sign * capsuleA->getHalfHeight()) * capsuleAxis; closestApproach = capsuleA->getPosition() + (sign * capsuleA->getHalfHeight()) * capsuleAxis;
radialAxis = closestApproach - sphereB->getPosition(); radialAxis = closestApproach - sphereB->getPosition();
radialDistance2 = glm::length2(radialAxis); radialDistance2 = glm::length2(radialAxis);
@ -224,11 +224,11 @@ bool capsuleSphere(const CapsuleShape* capsuleA, const SphereShape* sphereB, Col
return false; return false;
} }
// ... but still defined for the cap case // ... but still defined for the cap case
if (axialDistance < 0.f) { if (axialDistance < 0.0f) {
// we're hitting the start cap, so we negate the capsuleAxis // we're hitting the start cap, so we negate the capsuleAxis
capsuleAxis *= -1; capsuleAxis *= -1;
} }
float sign = (axialDistance > 0.f) ? 1.f : -1.f; float sign = (axialDistance > 0.0f) ? 1.0f : -1.0f;
collision->_penetration = (sign * (totalRadius + capsuleA->getHalfHeight() - absAxialDistance)) * capsuleAxis; collision->_penetration = (sign * (totalRadius + capsuleA->getHalfHeight() - absAxialDistance)) * capsuleAxis;
// contactPoint is on surface of sphereA // contactPoint is on surface of sphereA
collision->_contactPoint = closestApproach + (sign * capsuleA->getRadius()) * capsuleAxis; collision->_contactPoint = closestApproach + (sign * capsuleA->getRadius()) * capsuleAxis;
@ -251,7 +251,7 @@ bool capsuleCapsule(const CapsuleShape* capsuleA, const CapsuleShape* capsuleB,
// d = [(B - A) . (a - (a.b)b)] / (1 - (a.b)^2) // d = [(B - A) . (a - (a.b)b)] / (1 - (a.b)^2)
float aDotB = glm::dot(axisA, axisB); float aDotB = glm::dot(axisA, axisB);
float denominator = 1.f - aDotB * aDotB; float denominator = 1.0f - aDotB * aDotB;
float totalRadius = capsuleA->getRadius() + capsuleB->getRadius(); float totalRadius = capsuleA->getRadius() + capsuleB->getRadius();
if (denominator > EPSILON) { if (denominator > EPSILON) {
// distances to points of closest approach // distances to points of closest approach
@ -261,12 +261,12 @@ bool capsuleCapsule(const CapsuleShape* capsuleA, const CapsuleShape* capsuleB,
// clamp the distances to the ends of the capsule line segments // clamp the distances to the ends of the capsule line segments
float absDistanceA = fabs(distanceA); float absDistanceA = fabs(distanceA);
if (absDistanceA > capsuleA->getHalfHeight() + capsuleA->getRadius()) { if (absDistanceA > capsuleA->getHalfHeight() + capsuleA->getRadius()) {
float signA = distanceA < 0.f ? -1.f : 1.f; float signA = distanceA < 0.0f ? -1.0f : 1.0f;
distanceA = signA * capsuleA->getHalfHeight(); distanceA = signA * capsuleA->getHalfHeight();
} }
float absDistanceB = fabs(distanceB); float absDistanceB = fabs(distanceB);
if (absDistanceB > capsuleB->getHalfHeight() + capsuleB->getRadius()) { if (absDistanceB > capsuleB->getHalfHeight() + capsuleB->getRadius()) {
float signB = distanceB < 0.f ? -1.f : 1.f; float signB = distanceB < 0.0f ? -1.0f : 1.0f;
distanceB = signB * capsuleB->getHalfHeight(); distanceB = signB * capsuleB->getHalfHeight();
} }
@ -293,7 +293,7 @@ bool capsuleCapsule(const CapsuleShape* capsuleA, const CapsuleShape* capsuleB,
{ {
// the capsule centers are on top of each other! // the capsule centers are on top of each other!
// give up on a valid penetration direction and just use the yAxis // give up on a valid penetration direction and just use the yAxis
BA = glm::vec3(0.f, 1.f, 0.f); BA = glm::vec3(0.0f, 1.0f, 0.0f);
distance = glm::max(capsuleB->getRadius(), capsuleA->getRadius()); distance = glm::max(capsuleB->getRadius(), capsuleA->getRadius());
} }
} else { } else {
@ -325,7 +325,7 @@ bool capsuleCapsule(const CapsuleShape* capsuleA, const CapsuleShape* capsuleB,
float distance = sqrtf(distanceSquared); float distance = sqrtf(distanceSquared);
if (distance < EPSILON) { if (distance < EPSILON) {
// the spheres are on top of each other, so we pick an arbitrary penetration direction // the spheres are on top of each other, so we pick an arbitrary penetration direction
BA = glm::vec3(0.f, 1.f, 0.f); BA = glm::vec3(0.0f, 1.0f, 0.0f);
} else { } else {
BA /= distance; BA /= distance;
} }