mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-09 07:33:19 +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;
|
||||
averageContactPoint += collision->_contactPoint;
|
||||
}
|
||||
averagePenetration /= float(handCollisions.size());
|
||||
averagePenetration /= (float)handCollisions.size();
|
||||
if (isMyHand) {
|
||||
// our hand against other avatar
|
||||
// for now we resolve it to test shapes/collisions
|
||||
|
@ -176,7 +176,7 @@ void Hand::collideAgainstAvatar(Avatar* avatar, bool isMyHand) {
|
|||
} else {
|
||||
// someone else's hand against MyAvatar
|
||||
// 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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
qSort(fingerIndices.begin(), fingerIndices.end());
|
||||
|
|
|
@ -1588,7 +1588,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
|||
int numVertices = extracted.mesh.vertices.size();
|
||||
jointShapeInfo.numVertices = numVertices;
|
||||
if (numVertices > 0) {
|
||||
averageVertex /= float(jointShapeInfo.numVertices);
|
||||
averageVertex /= (float)jointShapeInfo.numVertices;
|
||||
float averageRadius = 0.f;
|
||||
foreach (const glm::vec3& vertex, extracted.mesh.vertices) {
|
||||
averageRadius += glm::distance(vertex, averageVertex);
|
||||
|
@ -1619,7 +1619,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
|||
} else {
|
||||
// collide the joint like a sphere
|
||||
if (jointShapeInfo.numVertices > 0) {
|
||||
jointShapeInfo.averageVertex /= float(jointShapeInfo.numVertices);
|
||||
jointShapeInfo.averageVertex /= (float)jointShapeInfo.numVertices;
|
||||
joint.shapePosition = jointShapeInfo.averageVertex;
|
||||
} else {
|
||||
joint.shapePosition = glm::vec3(0.f);
|
||||
|
@ -1629,7 +1629,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
|||
&& jointShapeInfo.numVertices > 0) {
|
||||
// the bone projection algorithm was not able to compute the joint radius
|
||||
// so we use an alternative measure
|
||||
jointShapeInfo.averageRadius /= float(jointShapeInfo.numVertices);
|
||||
jointShapeInfo.averageRadius /= (float)jointShapeInfo.numVertices;
|
||||
joint.boneRadius = jointShapeInfo.averageRadius;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,11 +31,11 @@ void GeometryCache::renderHemisphere(int slices, int stacks) {
|
|||
GLfloat* vertexData = new GLfloat[vertices * 3];
|
||||
GLfloat* vertex = vertexData;
|
||||
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);
|
||||
|
||||
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++) = cosf(theta) * radius;
|
||||
|
@ -181,7 +181,7 @@ void GeometryCache::renderHalfCylinder(int slices, int stacks) {
|
|||
float y = (float)i / (stacks - 1);
|
||||
|
||||
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
|
||||
*(vertex++) = sinf(theta);
|
||||
|
|
|
@ -160,7 +160,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) {
|
|||
|
||||
// Center of coordinate system -> upper left of bar
|
||||
glPushMatrix();
|
||||
glTranslatef(float(barX), float(y), 0.0f);
|
||||
glTranslatef((float)barX, (float)y, 0.0f);
|
||||
|
||||
// Render captions
|
||||
setColorRGBA(COLOR_TEXT);
|
||||
|
@ -202,7 +202,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) {
|
|||
// Render scale indicators
|
||||
setColorRGBA(COLOR_INDICATOR);
|
||||
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
|
||||
|
@ -210,8 +210,8 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) {
|
|||
for (size_t i = 0; i < N_CHANNELS; ++i) {
|
||||
|
||||
ChannelIndex chIdx = ChannelIndex(i);
|
||||
int wIn = int(barWidth * inputStream(chIdx).getValue() * UNIT_SCALE / scaleMax);
|
||||
int wOut = int(barWidth * outputStream(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);
|
||||
|
||||
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
|
||||
int lowPassFixPt = -int(std::numeric_limits<short>::min()) * _lowPassCoeff;
|
||||
int lowPassFixPt = -(int)(std::numeric_limits<short>::min()) * _lowPassCoeff;
|
||||
unsigned downsample = _downsampleRatio;
|
||||
// keep half of the buffer for writing and ensure an even vertex count
|
||||
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* outPtr = _vertices + MAX_COORDS_PER_CHANNEL * ch;
|
||||
int sample = 0, x = usedWidth;
|
||||
for (int i = int(usedSamples); --i >= 0 ;) {
|
||||
for (int i = (int)usedSamples; --i >= 0 ;) {
|
||||
if (inPtr == basePtr) {
|
||||
// handle boundary, reading the circular sample buffer
|
||||
inPtr = endPtr;
|
||||
|
|
|
@ -1096,7 +1096,7 @@ QScriptValue ScriptedMetavoxelGuide::visit(QScriptContext* context, QScriptEngin
|
|||
QScriptValue minimum = infoValue.property(guide->_minimumHandle);
|
||||
MetavoxelInfo info = {
|
||||
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() };
|
||||
|
||||
// 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.");
|
||||
|
||||
int fullMonths = int(months);
|
||||
int fullMonths = (int)months;
|
||||
qreal fractionalMonth = months - fullMonths;
|
||||
|
||||
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.");
|
||||
|
||||
int fullYears = int(years);
|
||||
int fullYears = (int)years;
|
||||
qreal fractionalYear = years - fullYears;
|
||||
|
||||
QDateTime endDate = d->reference;
|
||||
|
|
|
@ -189,7 +189,7 @@ void ShapeColliderTests::sphereMissesCapsule() {
|
|||
float delta = 1.3f * (totalRadius + halfHeightB) / (numberOfSteps - 1);
|
||||
for (int i = 0; i < numberOfSteps; ++i) {
|
||||
// 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 agains capsuleB
|
||||
|
|
Loading…
Reference in a new issue