This commit is contained in:
Andrzej Kapolka 2014-09-05 18:04:15 -07:00
commit c9d22ea07e
16 changed files with 54 additions and 37 deletions

View file

@ -37,8 +37,8 @@ int hifiSockAddrMeta = qRegisterMetaType<HifiSockAddr>("HifiSockAddr");
AssignmentClient::AssignmentClient(int &argc, char **argv) :
QCoreApplication(argc, argv),
_assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME),
_shutdownEventListener(this)
_shutdownEventListener(this),
_assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME)
{
LogUtils::init();

View file

@ -327,7 +327,6 @@ int AudioMixer::addStreamToMixForListeningNodeWithStream(PositionalAudioStream*
const float FULL_POWER = 1.0f;
const float SQUARE_ROOT_OF_TWO_OVER_TWO = 0.71f;
const float HALF_POWER = SQUARE_ROOT_OF_TWO_OVER_TWO;
const float QUARTER_POWER = HALF_POWER * HALF_POWER;
const float ONE_OVER_TWO_PI = 1.0f / TWO_PI;
const float FILTER_CUTOFF_FREQUENCY_HZ = 1000.0f;
@ -344,8 +343,8 @@ int AudioMixer::addStreamToMixForListeningNodeWithStream(PositionalAudioStream*
((-1.0 * ONE_OVER_TWO_PI * (bearingRelativeAngleToSource + PI_OVER_TWO)) + HALF_POWER) :
((-1.0 * ONE_OVER_TWO_PI * (bearingRelativeAngleToSource - PI)) + HALF_POWER);
float distanceBetween = glm::length(relativePosition);
#if 0
float distanceBetween = glm::length(relativePosition);
qDebug() << "avatar="
<< listeningNodeStream
<< "gainL="

View file

@ -223,6 +223,20 @@ void Avatar::measureMotionDerivatives(float deltaTime) {
_lastOrientation = getOrientation();
}
void Avatar::setPosition(const glm::vec3 position, bool overideReferential) {
AvatarData::setPosition(position, overideReferential);
_lastPosition = position;
_velocity = glm::vec3(0.0f);
_lastVelocity = glm::vec3(0.0f);
}
void Avatar::slamPosition(const glm::vec3& newPosition) {
_position = newPosition;
_lastPosition = newPosition;
_velocity = glm::vec3(0.0f);
_lastVelocity = glm::vec3(0.0f);
}
void Avatar::setMouseRay(const glm::vec3 &origin, const glm::vec3 &direction) {
_mouseRayOrigin = origin;
_mouseRayDirection = direction;

View file

@ -160,6 +160,9 @@ public:
/// Scales a world space position vector relative to the avatar position and scale
/// \param vector position to be scaled. Will store the result
void scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const;
void setPosition(const glm::vec3 position, bool overideReferential = false);
void slamPosition(const glm::vec3& newPosition);
public slots:
void updateCollisionGroups();

View file

@ -108,7 +108,7 @@ JointReferential::JointReferential(Referential* referential, EntityTree* tree, A
const EntityItem* item = _tree->findEntityByID(_entityID);
const Model* model = getModel(item);
if (!isValid() || model == NULL || _jointIndex >= model->getJointStateCount()) {
if (!isValid() || model == NULL || _jointIndex >= (uint32_t)(model->getJointStateCount())) {
_refScale = item->getRadius();
model->getJointRotationInWorldFrame(_jointIndex, _refRotation);
model->getJointPositionInWorldFrame(_jointIndex, _refPosition);
@ -123,7 +123,7 @@ JointReferential::JointReferential(uint32_t jointIndex, const QUuid& entityID, E
_type = JOINT;
const EntityItem* item = _tree->findEntityByID(_entityID);
const Model* model = getModel(item);
if (!isValid() || model == NULL || _jointIndex >= model->getJointStateCount()) {
if (!isValid() || model == NULL || _jointIndex >= (uint32_t)(model->getJointStateCount())) {
qDebug() << "JointReferential::constructor(): Not Valid";
_isValid = false;
return;
@ -142,7 +142,7 @@ JointReferential::JointReferential(uint32_t jointIndex, const QUuid& entityID, E
void JointReferential::update() {
const EntityItem* item = _tree->findEntityByID(_entityID);
const Model* model = getModel(item);
if (!isValid() || model == NULL || _jointIndex >= model->getJointStateCount()) {
if (!isValid() || model == NULL || _jointIndex >= (uint32_t)(model->getJointStateCount())) {
return;
}
@ -189,4 +189,4 @@ int JointReferential::unpackExtraData(const unsigned char *sourceBuffer, int siz
sourceBuffer += sizeof(_jointIndex);
return sourceBuffer - startPosition;
}
}

View file

@ -1767,7 +1767,7 @@ void MyAvatar::maybeUpdateBillboard() {
void MyAvatar::goHome() {
qDebug("Going Home!");
setPosition(START_LOCATION);
slamPosition(START_LOCATION);
}
void MyAvatar::increaseSize() {
@ -1827,7 +1827,7 @@ void MyAvatar::goToLocationFromAddress(const QJsonObject& locationObject) {
const float DISTANCE_TO_USER = 2.0f;
glm::vec3 newPosition = glm::vec3(coordinateItems[0].toFloat(), coordinateItems[1].toFloat(),
coordinateItems[2].toFloat()) - newOrientation * IDENTITY_FRONT * DISTANCE_TO_USER;
setPosition(newPosition);
slamPosition(newPosition);
emit transformChanged();
}

View file

@ -38,7 +38,7 @@ DeviceTracker* DeviceTracker::getDevice(const Name& name) {
}
DeviceTracker* DeviceTracker::getDevice(DeviceTracker::ID deviceID) {
if ((deviceID >= 0) && (deviceID < Singleton::get()->_devicesVector.size())) {
if ((deviceID >= 0) && (deviceID < (int)(Singleton::get()->_devicesVector.size()))) {
return Singleton::get()->_devicesVector[ deviceID ];
} else {
return NULL;

View file

@ -145,7 +145,7 @@ public:
const QUuid& getSessionUUID() { return _sessionUUID; }
const glm::vec3& getPosition();
void setPosition(const glm::vec3 position, bool overideReferential = false);
virtual void setPosition(const glm::vec3 position, bool overideReferential = false);
glm::vec3 getHandPosition() const;
void setHandPosition(const glm::vec3& handPosition);

View file

@ -492,7 +492,7 @@ int EntityTree::processEditPacketData(PacketType packetType, const unsigned char
void EntityTree::notifyNewlyCreatedEntity(const EntityItem& newEntity, const SharedNodePointer& senderNode) {
_newlyCreatedHooksLock.lockForRead();
for (size_t i = 0; i < _newlyCreatedHooks.size(); i++) {
for (int i = 0; i < _newlyCreatedHooks.size(); i++) {
_newlyCreatedHooks[i]->entityCreated(newEntity, senderNode);
}
_newlyCreatedHooksLock.unlock();
@ -506,7 +506,7 @@ void EntityTree::addNewlyCreatedHook(NewlyCreatedEntityHook* hook) {
void EntityTree::removeNewlyCreatedHook(NewlyCreatedEntityHook* hook) {
_newlyCreatedHooksLock.lockForWrite();
for (size_t i = 0; i < _newlyCreatedHooks.size(); i++) {
for (int i = 0; i < _newlyCreatedHooks.size(); i++) {
if (_newlyCreatedHooks[i] == hook) {
_newlyCreatedHooks.erase(_newlyCreatedHooks.begin() + i);
break;

View file

@ -723,7 +723,6 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int
int bytesForThisEntity = 0;
EntityItemID entityItemID;
EntityItem* entityItem = NULL;
bool newEntity = false;
// Old model files don't have UUIDs in them. So we don't want to try to read those IDs from the stream.
// Since this can only happen on loading an old file, we can safely treat these as new entity cases,
@ -768,7 +767,6 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int
addEntityItem(entityItem); // add this new entity to this elements entities
entityItemID = entityItem->getEntityItemID();
_myTree->setContainingElement(entityItemID, this);
newEntity = true;
EntityItem::SimulationState newState = entityItem->getSimulationState();
_myTree->changeEntityState(entityItem, EntityItem::Static, newState);
}
@ -826,4 +824,4 @@ void EntityTreeElement::debugDump() {
entity->debugDump();
}
}

View file

@ -242,7 +242,7 @@ int Octree::readElementData(OctreeElement* destinationElement, const unsigned ch
// give this destination element the child mask from the packet
const unsigned char ALL_CHILDREN_ASSUMED_TO_EXIST = 0xFF;
if (bytesLeftToRead < sizeof(unsigned char)) {
if ((size_t)bytesLeftToRead < sizeof(unsigned char)) {
qDebug() << "UNEXPECTED: readElementData() only had " << bytesLeftToRead << " bytes. Not enough for meaningful data.";
return bytesAvailable; // assume we read the entire buffer...
}
@ -1865,7 +1865,6 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
bool Octree::readFromSVOFile(const char* fileName) {
bool fileOk = false;
bool hasBufferBreaks = false;
PacketVersion gotVersion = 0;
std::ifstream file(fileName, std::ios::in|std::ios::binary|std::ios::ate);

View file

@ -275,7 +275,7 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
// If we're switching type, then we send the last one and start over
if ((type != packetBuffer._currentType && packetBuffer._currentSize > 0) ||
(packetBuffer._currentSize + length >= _maxPacketSize)) {
(packetBuffer._currentSize + length >= (size_t)_maxPacketSize)) {
releaseQueuedPacket(packetBuffer);
initializePacket(packetBuffer, type);
}

View file

@ -30,11 +30,11 @@ void TypedArrayPrototype::set(QScriptValue array, qint32 offset) {
engine()->evaluate("throw \"ArgumentError: negative offset\"");
}
quint32 length = array.property("length").toInt32();
if (offset + length > thisObject().data().property(typedArray->_lengthName).toInt32()) {
if (offset + (qint32)length > thisObject().data().property(typedArray->_lengthName).toInt32()) {
engine()->evaluate("throw \"ArgumentError: array does not fit\"");
return;
}
for (int i = 0; i < length; ++i) {
for (quint32 i = 0; i < length; ++i) {
thisObject().setProperty(QString::number(offset + i), array.property(QString::number(i)));
}
} else {

View file

@ -50,7 +50,7 @@ QScriptValue TypedArray::newInstance(QScriptValue array) {
if (array.property(ARRAY_LENGTH_HANDLE).isValid()) {
quint32 length = array.property(ARRAY_LENGTH_HANDLE).toInt32();
QScriptValue newArray = newInstance(length);
for (int i = 0; i < length; ++i) {
for (quint32 i = 0; i < length; ++i) {
QScriptValue value = array.property(QString::number(i));
setProperty(newArray, engine()->toStringHandle(QString::number(i)),
i * _bytesPerElement, (value.isNumber()) ? value : QScriptValue(0));
@ -119,7 +119,7 @@ QScriptValue TypedArray::construct(QScriptContext* context, QScriptEngine* engin
return QScriptValue();
}
if (lengthArg.toInt32() < 0 ||
byteOffsetArg.toInt32() + lengthArg.toInt32() * cls->_bytesPerElement > arrayBuffer->size()) {
byteOffsetArg.toInt32() + lengthArg.toInt32() * (qint32)(cls->_bytesPerElement) > arrayBuffer->size()) {
engine->evaluate("throw \"RangeError: byteLength out of range\"");
return QScriptValue();
}
@ -155,7 +155,7 @@ QScriptClass::QueryFlags TypedArray::queryProperty(const QScriptValue& object,
quint32 byteOffset = object.data().property(_byteOffsetName).toInt32();
quint32 length = object.data().property(_lengthName).toInt32();
bool ok = false;
int pos = name.toArrayIndex(&ok);
quint32 pos = name.toArrayIndex(&ok);
// Check that name is a valid index and arrayBuffer exists
if (ok && pos >= 0 && pos < length) {

View file

@ -71,6 +71,8 @@ QScriptValue XMLHttpRequestClass::getStatus() const {
return QScriptValue(408);
case QNetworkReply::ContentOperationNotPermittedError:
return QScriptValue(501);
default:
break;
}
}
return QScriptValue(0);
@ -92,6 +94,8 @@ QString XMLHttpRequestClass::getStatusText() const {
return "Timeout";
case QNetworkReply::ContentOperationNotPermittedError:
return "Not Implemented";
default:
break;
}
}
return "";

View file

@ -115,7 +115,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytes[] = { 196, 15, 2 };
char expectedBytes[] = { (char)196, (char)15, (char)2 };
QByteArray expectedResult(expectedBytes, sizeof(expectedBytes)/sizeof(expectedBytes[0]));
if (encoded == expectedResult) {
@ -140,7 +140,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytesB[] = { 136, 30 };
char expectedBytesB[] = { (char)136, (char)30 };
QByteArray expectedResultB(expectedBytesB, sizeof(expectedBytesB)/sizeof(expectedBytesB[0]));
if (encoded == expectedResultB) {
@ -172,7 +172,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
qDebug() << "encoded=";
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytes[] = { 196, 15, 2 };
char expectedBytes[] = { (char)196, (char)15, (char)2 };
QByteArray expectedResult(expectedBytes, sizeof(expectedBytes)/sizeof(expectedBytes[0]));
if (encoded == expectedResult) {
@ -197,7 +197,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytesB[] = { 136, 30 };
char expectedBytesB[] = { (char)136, (char)30 };
QByteArray expectedResultB(expectedBytesB, sizeof(expectedBytesB)/sizeof(expectedBytesB[0]));
if (encoded == expectedResultB) {
@ -231,7 +231,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytes[] = { 196, 15, 2 };
char expectedBytes[] = { (char)196, (char)15, (char)2 };
QByteArray expectedResult(expectedBytes, sizeof(expectedBytes)/sizeof(expectedBytes[0]));
if (encoded == expectedResult) {
@ -264,7 +264,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytes[] = { 196, 15, 2 };
char expectedBytes[] = { (char)196, (char)15, (char)2 };
QByteArray expectedResult(expectedBytes, sizeof(expectedBytes)/sizeof(expectedBytes[0]));
if (encoded == expectedResult) {
@ -296,7 +296,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytes[] = { 196, 15, 2 };
char expectedBytes[] = { (char)196, (char)15, (char)2 };
QByteArray expectedResult(expectedBytes, sizeof(expectedBytes)/sizeof(expectedBytes[0]));
if (encoded == expectedResult) {
@ -329,7 +329,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytes[] = { 196, 15, 2 };
char expectedBytes[] = { (char)196, (char)15, (char)2 };
QByteArray expectedResult(expectedBytes, sizeof(expectedBytes)/sizeof(expectedBytes[0]));
if (encoded == expectedResult) {
@ -362,7 +362,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytes[] = { 196, 15, 2 };
char expectedBytes[] = { (char)196, (char)15, (char)2 };
QByteArray expectedResult(expectedBytes, sizeof(expectedBytes)/sizeof(expectedBytes[0]));
if (encoded == expectedResult) {
@ -395,7 +395,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytes[] = { 196, 15, 2 };
char expectedBytes[] = { (char)196, (char)15, (char)2 };
QByteArray expectedResult(expectedBytes, sizeof(expectedBytes)/sizeof(expectedBytes[0]));
if (encoded == expectedResult) {
@ -432,7 +432,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
outputBufferBits((const unsigned char*)encoded.constData(), encoded.size());
}
char expectedBytes[] = { 196, 15, 2 };
char expectedBytes[] = { (char)196, (char)15, (char)2 };
QByteArray expectedResult(expectedBytes, sizeof(expectedBytes)/sizeof(expectedBytes[0]));
if (encoded == expectedResult) {
@ -642,7 +642,7 @@ void OctreeTests::propertyFlagsTests(bool verbose) {
qDebug() << "props.getHasProperty(PARTICLE_PROP_VISIBLE)" << (props.getHasProperty(PARTICLE_PROP_VISIBLE))
<< "{ expect true }";
}
char expectedBytesD[] = { 136, 16 };
char expectedBytesD[] = { (char)136, (char)16 };
QByteArray expectedResultD(expectedBytesD, sizeof(expectedBytesD)/sizeof(expectedBytesD[0]));
testsTaken++;