mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 22:31:33 +02:00
making some type casts abide by coding standard
This commit is contained in:
parent
cec3f944d7
commit
4c64c11144
9 changed files with 19 additions and 19 deletions
|
@ -167,7 +167,7 @@ void Hand::collideAgainstAvatar(Avatar* avatar, bool isMyHand) {
|
||||||
averagePenetration += collision->_penetration;
|
averagePenetration += collision->_penetration;
|
||||||
averageContactPoint += collision->_contactPoint;
|
averageContactPoint += collision->_contactPoint;
|
||||||
}
|
}
|
||||||
averagePenetration /= float(handCollisions.size());
|
averagePenetration /= (float)handCollisions.size();
|
||||||
if (isMyHand) {
|
if (isMyHand) {
|
||||||
// our hand against other avatar
|
// our hand against other avatar
|
||||||
// for now we resolve it to test shapes/collisions
|
// for now we resolve it to test shapes/collisions
|
||||||
|
@ -176,7 +176,7 @@ void Hand::collideAgainstAvatar(Avatar* avatar, bool isMyHand) {
|
||||||
} else {
|
} else {
|
||||||
// someone else's hand against MyAvatar
|
// someone else's hand against MyAvatar
|
||||||
// TODO: submit collision info to MyAvatar which should lean accordingly
|
// TODO: submit collision info to MyAvatar which should lean accordingly
|
||||||
averageContactPoint /= float(handCollisions.size());
|
averageContactPoint /= (float)handCollisions.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ void SkeletonModel::applyPalmData(int jointIndex, const QVector<int>& fingerJoin
|
||||||
direction += fingerVector / length;
|
direction += fingerVector / length;
|
||||||
}
|
}
|
||||||
fingerVector = glm::inverse(palmRotation) * fingerVector * -sign;
|
fingerVector = glm::inverse(palmRotation) * fingerVector * -sign;
|
||||||
IndexValue indexValue = { int(i), atan2f(fingerVector.z, fingerVector.x) };
|
IndexValue indexValue = { (int)i, atan2f(fingerVector.z, fingerVector.x) };
|
||||||
fingerIndices.append(indexValue);
|
fingerIndices.append(indexValue);
|
||||||
}
|
}
|
||||||
qSort(fingerIndices.begin(), fingerIndices.end());
|
qSort(fingerIndices.begin(), fingerIndices.end());
|
||||||
|
|
|
@ -1588,7 +1588,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
||||||
int numVertices = extracted.mesh.vertices.size();
|
int numVertices = extracted.mesh.vertices.size();
|
||||||
jointShapeInfo.numVertices = numVertices;
|
jointShapeInfo.numVertices = numVertices;
|
||||||
if (numVertices > 0) {
|
if (numVertices > 0) {
|
||||||
averageVertex /= float(jointShapeInfo.numVertices);
|
averageVertex /= (float)jointShapeInfo.numVertices;
|
||||||
float averageRadius = 0.f;
|
float averageRadius = 0.f;
|
||||||
foreach (const glm::vec3& vertex, extracted.mesh.vertices) {
|
foreach (const glm::vec3& vertex, extracted.mesh.vertices) {
|
||||||
averageRadius += glm::distance(vertex, averageVertex);
|
averageRadius += glm::distance(vertex, averageVertex);
|
||||||
|
@ -1619,7 +1619,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
||||||
} else {
|
} else {
|
||||||
// collide the joint like a sphere
|
// collide the joint like a sphere
|
||||||
if (jointShapeInfo.numVertices > 0) {
|
if (jointShapeInfo.numVertices > 0) {
|
||||||
jointShapeInfo.averageVertex /= float(jointShapeInfo.numVertices);
|
jointShapeInfo.averageVertex /= (float)jointShapeInfo.numVertices;
|
||||||
joint.shapePosition = jointShapeInfo.averageVertex;
|
joint.shapePosition = jointShapeInfo.averageVertex;
|
||||||
} else {
|
} else {
|
||||||
joint.shapePosition = glm::vec3(0.f);
|
joint.shapePosition = glm::vec3(0.f);
|
||||||
|
@ -1629,7 +1629,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
||||||
&& jointShapeInfo.numVertices > 0) {
|
&& jointShapeInfo.numVertices > 0) {
|
||||||
// the bone projection algorithm was not able to compute the joint radius
|
// the bone projection algorithm was not able to compute the joint radius
|
||||||
// so we use an alternative measure
|
// so we use an alternative measure
|
||||||
jointShapeInfo.averageRadius /= float(jointShapeInfo.numVertices);
|
jointShapeInfo.averageRadius /= (float)jointShapeInfo.numVertices;
|
||||||
joint.boneRadius = jointShapeInfo.averageRadius;
|
joint.boneRadius = jointShapeInfo.averageRadius;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,11 @@ void GeometryCache::renderHemisphere(int slices, int stacks) {
|
||||||
GLfloat* vertexData = new GLfloat[vertices * 3];
|
GLfloat* vertexData = new GLfloat[vertices * 3];
|
||||||
GLfloat* vertex = vertexData;
|
GLfloat* vertex = vertexData;
|
||||||
for (int i = 0; i < stacks - 1; i++) {
|
for (int i = 0; i < stacks - 1; i++) {
|
||||||
float phi = PI_OVER_TWO * float(i) / float(stacks - 1);
|
float phi = PI_OVER_TWO * (float)i / (float)(stacks - 1);
|
||||||
float z = sinf(phi), radius = cosf(phi);
|
float z = sinf(phi), radius = cosf(phi);
|
||||||
|
|
||||||
for (int j = 0; j < slices; j++) {
|
for (int j = 0; j < slices; j++) {
|
||||||
float theta = TWO_PI * float(j) / float(slices);
|
float theta = TWO_PI * (float)j / (float)slices;
|
||||||
|
|
||||||
*(vertex++) = sinf(theta) * radius;
|
*(vertex++) = sinf(theta) * radius;
|
||||||
*(vertex++) = cosf(theta) * radius;
|
*(vertex++) = cosf(theta) * radius;
|
||||||
|
@ -181,7 +181,7 @@ void GeometryCache::renderHalfCylinder(int slices, int stacks) {
|
||||||
float y = (float)i / (stacks - 1);
|
float y = (float)i / (stacks - 1);
|
||||||
|
|
||||||
for (int j = 0; j <= slices; j++) {
|
for (int j = 0; j <= slices; j++) {
|
||||||
float theta = 3.f * PI_OVER_TWO + PI * float(j) / float(slices);
|
float theta = 3.f * PI_OVER_TWO + PI * (float)j / (float)slices;
|
||||||
|
|
||||||
//normals
|
//normals
|
||||||
*(vertex++) = sinf(theta);
|
*(vertex++) = sinf(theta);
|
||||||
|
|
|
@ -160,7 +160,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) {
|
||||||
|
|
||||||
// Center of coordinate system -> upper left of bar
|
// Center of coordinate system -> upper left of bar
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(float(barX), float(y), 0.0f);
|
glTranslatef((float)barX, (float)y, 0.0f);
|
||||||
|
|
||||||
// Render captions
|
// Render captions
|
||||||
setColorRGBA(COLOR_TEXT);
|
setColorRGBA(COLOR_TEXT);
|
||||||
|
@ -202,7 +202,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) {
|
||||||
// Render scale indicators
|
// Render scale indicators
|
||||||
setColorRGBA(COLOR_INDICATOR);
|
setColorRGBA(COLOR_INDICATOR);
|
||||||
for (int j = NUMBER_OF_MARKERS; --j > 0;) {
|
for (int j = NUMBER_OF_MARKERS; --j > 0;) {
|
||||||
renderVerticalLine(int(barWidth * j / NUMBER_OF_MARKERS), 0, h);
|
renderVerticalLine((barWidth * j) / NUMBER_OF_MARKERS, 0, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render bars
|
// Render bars
|
||||||
|
@ -210,8 +210,8 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) {
|
||||||
for (size_t i = 0; i < N_CHANNELS; ++i) {
|
for (size_t i = 0; i < N_CHANNELS; ++i) {
|
||||||
|
|
||||||
ChannelIndex chIdx = ChannelIndex(i);
|
ChannelIndex chIdx = ChannelIndex(i);
|
||||||
int wIn = int(barWidth * inputStream(chIdx).getValue() * UNIT_SCALE / scaleMax);
|
int wIn = (int)(barWidth * inputStream(chIdx).getValue() * UNIT_SCALE / scaleMax);
|
||||||
int wOut = int(barWidth * outputStream(chIdx).getValue() * UNIT_SCALE / scaleMax);
|
int wOut = (int)(barWidth * outputStream(chIdx).getValue() * UNIT_SCALE / scaleMax);
|
||||||
|
|
||||||
setColorRGBA(channelInfo(chIdx).colorRGBA);
|
setColorRGBA(channelInfo(chIdx).colorRGBA);
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ void Oscilloscope::render(int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetch low pass factor (and convert to fix point) / downsample factor
|
// fetch low pass factor (and convert to fix point) / downsample factor
|
||||||
int lowPassFixPt = -int(std::numeric_limits<short>::min()) * _lowPassCoeff;
|
int lowPassFixPt = -(int)(std::numeric_limits<short>::min()) * _lowPassCoeff;
|
||||||
unsigned downsample = _downsampleRatio;
|
unsigned downsample = _downsampleRatio;
|
||||||
// keep half of the buffer for writing and ensure an even vertex count
|
// keep half of the buffer for writing and ensure an even vertex count
|
||||||
unsigned usedWidth = min(_width, MAX_SAMPLES_PER_CHANNEL / (downsample * 2)) & ~1u;
|
unsigned usedWidth = min(_width, MAX_SAMPLES_PER_CHANNEL / (downsample * 2)) & ~1u;
|
||||||
|
@ -141,7 +141,7 @@ void Oscilloscope::render(int x, int y) {
|
||||||
short const* inPtr = _samples + _writePos[ch];
|
short const* inPtr = _samples + _writePos[ch];
|
||||||
short* outPtr = _vertices + MAX_COORDS_PER_CHANNEL * ch;
|
short* outPtr = _vertices + MAX_COORDS_PER_CHANNEL * ch;
|
||||||
int sample = 0, x = usedWidth;
|
int sample = 0, x = usedWidth;
|
||||||
for (int i = int(usedSamples); --i >= 0 ;) {
|
for (int i = (int)usedSamples; --i >= 0 ;) {
|
||||||
if (inPtr == basePtr) {
|
if (inPtr == basePtr) {
|
||||||
// handle boundary, reading the circular sample buffer
|
// handle boundary, reading the circular sample buffer
|
||||||
inPtr = endPtr;
|
inPtr = endPtr;
|
||||||
|
|
|
@ -1096,7 +1096,7 @@ QScriptValue ScriptedMetavoxelGuide::visit(QScriptContext* context, QScriptEngin
|
||||||
QScriptValue minimum = infoValue.property(guide->_minimumHandle);
|
QScriptValue minimum = infoValue.property(guide->_minimumHandle);
|
||||||
MetavoxelInfo info = {
|
MetavoxelInfo info = {
|
||||||
glm::vec3(minimum.property(0).toNumber(), minimum.property(1).toNumber(), minimum.property(2).toNumber()),
|
glm::vec3(minimum.property(0).toNumber(), minimum.property(1).toNumber(), minimum.property(2).toNumber()),
|
||||||
float(infoValue.property(guide->_sizeHandle).toNumber()), guide->_visitation->info.inputValues,
|
(float)infoValue.property(guide->_sizeHandle).toNumber(), guide->_visitation->info.inputValues,
|
||||||
guide->_visitation->info.outputValues, infoValue.property(guide->_isLeafHandle).toBool() };
|
guide->_visitation->info.outputValues, infoValue.property(guide->_isLeafHandle).toBool() };
|
||||||
|
|
||||||
// extract and convert the values provided by the script
|
// extract and convert the values provided by the script
|
||||||
|
|
|
@ -1594,7 +1594,7 @@ void QTimeSpan::setFromMonths(qreal months)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(hasValidReference(), "setFromMonths", "Can not set interval from time unit month if there is no reference date.");
|
Q_ASSERT_X(hasValidReference(), "setFromMonths", "Can not set interval from time unit month if there is no reference date.");
|
||||||
|
|
||||||
int fullMonths = int(months);
|
int fullMonths = (int)months;
|
||||||
qreal fractionalMonth = months - fullMonths;
|
qreal fractionalMonth = months - fullMonths;
|
||||||
|
|
||||||
QDateTime endDate = d->reference;
|
QDateTime endDate = d->reference;
|
||||||
|
@ -1631,7 +1631,7 @@ void QTimeSpan::setFromYears(qreal years)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(hasValidReference(), "setFromYears", "Can not set interval from time unit year if there is no reference date.");
|
Q_ASSERT_X(hasValidReference(), "setFromYears", "Can not set interval from time unit year if there is no reference date.");
|
||||||
|
|
||||||
int fullYears = int(years);
|
int fullYears = (int)years;
|
||||||
qreal fractionalYear = years - fullYears;
|
qreal fractionalYear = years - fullYears;
|
||||||
|
|
||||||
QDateTime endDate = d->reference;
|
QDateTime endDate = d->reference;
|
||||||
|
|
|
@ -189,7 +189,7 @@ void ShapeColliderTests::sphereMissesCapsule() {
|
||||||
float delta = 1.3f * (totalRadius + halfHeightB) / (numberOfSteps - 1);
|
float delta = 1.3f * (totalRadius + halfHeightB) / (numberOfSteps - 1);
|
||||||
for (int i = 0; i < numberOfSteps; ++i) {
|
for (int i = 0; i < numberOfSteps; ++i) {
|
||||||
// translate sphereA into world-frame
|
// translate sphereA into world-frame
|
||||||
glm::vec3 localPosition = localStartPosition + (float(i) * delta) * yAxis;
|
glm::vec3 localPosition = localStartPosition + ((float)i * delta) * yAxis;
|
||||||
sphereA.setPosition(rotation * localPosition + translation);
|
sphereA.setPosition(rotation * localPosition + translation);
|
||||||
|
|
||||||
// sphereA agains capsuleB
|
// sphereA agains capsuleB
|
||||||
|
|
Loading…
Reference in a new issue