Merge branch 'master' of https://github.com/highfidelity/hifi into body_not_rotating

This commit is contained in:
Atlante45 2015-01-12 16:42:35 -08:00
commit 74d819fe25
10 changed files with 88 additions and 68 deletions

View file

@ -138,11 +138,13 @@ function drawLobby() {
// add an attachment on this avatar so other people see them in the lobby
MyAvatar.attach(HELMET_ATTACHMENT_URL, "Neck", {x: 0, y: 0, z: 0}, Quat.fromPitchYawRollDegrees(0, 0, 0), 1.15);
// start the drone sound
// currentDrone = Audio.playSound(droneSound, { stereo: true, loop: true, localOnly: true, volume: DRONE_VOLUME });
if (droneSound.downloaded) {
// start the drone sound
currentDrone = Audio.playSound(droneSound, { stereo: true, loop: true, localOnly: true, volume: DRONE_VOLUME });
}
// start one of our muzak sounds
// playRandomMuzak();
playRandomMuzak();
}
}
@ -353,9 +355,9 @@ function update(deltaTime) {
Overlays.editOverlay(descriptionText, { position: textOverlayPosition() });
// if the reticle is up then we may need to play the next muzak
// if (!Audio.isInjectorPlaying(currentMuzakInjector)) {
// playNextMuzak();
// }
if (currentMuzakInjector && !Audio.isInjectorPlaying(currentMuzakInjector)) {
playNextMuzak();
}
}
}

View file

@ -880,7 +880,7 @@ bool Audio::outputLocalInjector(bool isStereo, qreal volume, AudioInjector* inje
localFormat.setChannelCount(isStereo ? 2 : 1);
QAudioOutput* localOutput = new QAudioOutput(getNamedAudioDeviceForMode(QAudio::AudioOutput, _outputAudioDeviceName),
localFormat, this);
localFormat);
localOutput->setVolume(volume);
// move the localOutput to the same thread as the local injector buffer

View file

@ -197,19 +197,23 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) {
const float FAR_CLIP = 10000;
glLoadIdentity();
glOrtho(0, glCanvas->width(), glCanvas->height(), 0, NEAR_CLIP, FAR_CLIP);
glMatrixMode(GL_MODELVIEW);
renderAudioMeter();
renderStatsAndLogs();
// give external parties a change to hook in
emit application->renderingOverlay();
overlays.renderHUD();
renderPointers();
renderDomainConnectionStatusBorder();
glMatrixMode(GL_PROJECTION);
} glPopMatrix();
glMatrixMode(GL_MODELVIEW);

View file

@ -13,7 +13,8 @@
void registerAudioMetaTypes(QScriptEngine* engine) {
qScriptRegisterMetaType(engine, injectorOptionsToScriptValue, injectorOptionsFromScriptValue);
qScriptRegisterMetaType(engine, soundToScriptValue, soundFromScriptValue);
qScriptRegisterMetaType(engine, soundSharedPointerToScriptValue, soundSharedPointerFromScriptValue);
qScriptRegisterMetaType(engine, soundPointerToScriptValue, soundPointerFromScriptValue);
}
AudioScriptingInterface& AudioScriptingInterface::getInstance() {

View file

@ -29,13 +29,22 @@
#include "AudioEditBuffer.h"
#include "Sound.h"
QScriptValue soundToScriptValue(QScriptEngine* engine, SharedSoundPointer const& in) {
static int soundMetaTypeId = qRegisterMetaType<Sound*>();
QScriptValue soundSharedPointerToScriptValue(QScriptEngine* engine, SharedSoundPointer const& in) {
return engine->newQObject(in.data());
}
void soundFromScriptValue(const QScriptValue &object, SharedSoundPointer &out) {
void soundSharedPointerFromScriptValue(const QScriptValue& object, SharedSoundPointer &out) {
out = SharedSoundPointer(qobject_cast<Sound*>(object.toQObject()));
qDebug() << "Sound from script value" << out.data();
}
QScriptValue soundPointerToScriptValue(QScriptEngine* engine, Sound* const& in) {
return engine->newQObject(in);
}
void soundPointerFromScriptValue(const QScriptValue &object, Sound* &out) {
out = qobject_cast<Sound*>(object.toQObject());
}
Sound::Sound(const QUrl& url, bool isStereo) :

View file

@ -45,8 +45,12 @@ private:
typedef QSharedPointer<Sound> SharedSoundPointer;
Q_DECLARE_METATYPE(SharedSoundPointer)
QScriptValue soundSharedPointerToScriptValue(QScriptEngine* engine, SharedSoundPointer const& in);
void soundSharedPointerFromScriptValue(const QScriptValue& object, SharedSoundPointer &out);
Q_DECLARE_METATYPE(Sound*)
QScriptValue soundPointerToScriptValue(QScriptEngine* engine, Sound* const& in);
void soundPointerFromScriptValue(const QScriptValue& object, Sound* &out);
QScriptValue soundToScriptValue(QScriptEngine* engine, SharedSoundPointer const& in);
void soundFromScriptValue(const QScriptValue& object, SharedSoundPointer& out);
#endif // hifi_Sound_h

View file

@ -665,7 +665,7 @@ const EntityItem* EntityTreeElement::getEntityWithEntityItemID(const EntityItemI
}
return foundEntity;
}
EntityItem* EntityTreeElement::getEntityWithEntityItemID(const EntityItemID& id) {
EntityItem* foundEntity = NULL;
uint16_t numberOfEntities = _entityItems->size();

View file

@ -38,7 +38,7 @@ struct TextureParam {
glm::vec2 UVTranslation;
glm::vec2 UVScaling;
glm::vec4 cropping;
std::string UVSet;
QString UVSet;
glm::vec3 translation;
glm::vec3 rotation;
@ -802,14 +802,14 @@ public:
QVector<QHash<int, int> > blendshapeIndexMaps;
QVector<QPair<int, int> > partMaterialTextures;
QHash<QString, int> texcoordSetMap;
std::map<std::string, int> texcoordSetMap2;
std::map<QString, int> texcoordSetMap2;
};
class AttributeData {
public:
QVector<glm::vec2> texCoords;
QVector<int> texCoordIndices;
std::string name;
QString name;
int index;
};
@ -945,12 +945,12 @@ ExtractedMesh extractMesh(const FBXNode& object) {
data.texCoordIndices = getIntVector(subdata);
attrib.texCoordIndices = getIntVector(subdata);
} else if (subdata.name == "Name") {
attrib.name = subdata.properties.at(0).toString().toStdString();
attrib.name = subdata.properties.at(0).toString();
}
#if defined(DEBUG_FBXREADER)
else {
int unknown = 0;
std::string subname = subdata.name.data();
QString subname = subdata.name.data();
if ( (subdata.name == "Version")
|| (subdata.name == "MappingInformationType")
|| (subdata.name == "ReferenceInformationType") ) {
@ -960,7 +960,7 @@ ExtractedMesh extractMesh(const FBXNode& object) {
}
#endif
}
data.extracted.texcoordSetMap.insert(QString(attrib.name.c_str()), data.attributes.size());
data.extracted.texcoordSetMap.insert(attrib.name, data.attributes.size());
data.attributes.push_back(attrib);
} else {
AttributeData attrib;
@ -971,12 +971,12 @@ ExtractedMesh extractMesh(const FBXNode& object) {
} else if (subdata.name == "UVIndex") {
attrib.texCoordIndices = getIntVector(subdata);
} else if (subdata.name == "Name") {
attrib.name = subdata.properties.at(0).toString().toStdString();
attrib.name = subdata.properties.at(0).toString();
}
#if defined(DEBUG_FBXREADER)
else {
int unknown = 0;
std::string subname = subdata.name.data();
QString subname = subdata.name.data();
if ( (subdata.name == "Version")
|| (subdata.name == "MappingInformationType")
|| (subdata.name == "ReferenceInformationType") ) {
@ -987,9 +987,9 @@ ExtractedMesh extractMesh(const FBXNode& object) {
#endif
}
QHash<QString, int>::iterator it = data.extracted.texcoordSetMap.find(QString(attrib.name.c_str()));
QHash<QString, int>::iterator it = data.extracted.texcoordSetMap.find(attrib.name);
if (it == data.extracted.texcoordSetMap.end()) {
data.extracted.texcoordSetMap.insert(QString(attrib.name.c_str()), data.attributes.size());
data.extracted.texcoordSetMap.insert(attrib.name, data.attributes.size());
data.attributes.push_back(attrib);
} else {
// WTF same names for different UVs?
@ -1198,11 +1198,11 @@ bool checkMaterialsHaveTextures(const QHash<QString, Material>& materials,
return false;
}
int matchTextureUVSetToAttributeChannel(const std::string& texUVSetName, const QHash<QString, int>& texcoordChannels) {
if (texUVSetName.empty()) {
int matchTextureUVSetToAttributeChannel(const QString& texUVSetName, const QHash<QString, int>& texcoordChannels) {
if (texUVSetName.isEmpty()) {
return 0;
} else {
QHash<QString, int>::const_iterator tcUnit = texcoordChannels.find(QString(texUVSetName.c_str()));
QHash<QString, int>::const_iterator tcUnit = texcoordChannels.find(texUVSetName);
if (tcUnit != texcoordChannels.end()) {
int channel = (*tcUnit);
if (channel >= 2) {
@ -1220,13 +1220,13 @@ FBXLight extractLight(const FBXNode& object) {
FBXLight light;
foreach (const FBXNode& subobject, object.children) {
std::string childname = QString(subobject.name).toStdString();
QString childname = QString(subobject.name);
if (subobject.name == "Properties70") {
foreach (const FBXNode& property, subobject.children) {
int valIndex = 4;
std::string propName = QString(property.name).toStdString();
QString propName = QString(property.name);
if (property.name == "P") {
std::string propname = property.properties.at(0).toString().toStdString();
QString propname = property.properties.at(0).toString();
if (propname == "Intensity") {
light.intensity = 0.01f * property.properties.at(valIndex).value<double>();
}
@ -1238,13 +1238,13 @@ FBXLight extractLight(const FBXNode& object) {
}
#if defined(DEBUG_FBXREADER)
std::string type = object.properties.at(0).toString().toStdString();
type = object.properties.at(1).toString().toStdString();
type = object.properties.at(2).toString().toStdString();
QString type = object.properties.at(0).toString();
type = object.properties.at(1).toString();
type = object.properties.at(2).toString();
foreach (const QVariant& prop, object.properties) {
std::string proptype = prop.typeName();
std::string propval = prop.toString().toStdString();
QString proptype = prop.typeName();
QString propval = prop.toString();
if (proptype == "Properties70") {
}
}
@ -1281,7 +1281,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
QHash<QString, QString> yComponents;
QHash<QString, QString> zComponents;
std::map<std::string, FBXLight> lights;
std::map<QString, FBXLight> lights;
QVariantHash joints = mapping.value("joint").toHash();
QString jointEyeLeftName = processID(getString(joints.value("jointEyeLeft", "jointEyeLeft")));
@ -1369,7 +1369,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
int index = 4;
foreach (const FBXNode& subobject, object.children) {
if (subobject.name == propertyName) {
std::string subpropName = subobject.properties.at(0).toString().toStdString();
QString subpropName = subobject.properties.at(0).toString();
if (subpropName == "UnitScaleFactor") {
unitScaleFactor = subobject.properties.at(index).toFloat();
} else if (subpropName == "AmbientColor") {
@ -1393,8 +1393,8 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
QString id = getID(object.properties);
modelIDsToNames.insert(id, name);
std::string modelname = name.toLower().toStdString();
if (modelname.find("hifi") == 0) {
QString modelname = name.toLower();
if (modelname.startsWith("hifi")) {
hifiGlobalNodeID = id;
}
@ -1527,19 +1527,19 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
}
#if defined(DEBUG_FBXREADER)
else if (subobject.name == "TypeFlags") {
std::string attributetype = subobject.properties.at(0).toString().toStdString();
QString attributetype = subobject.properties.at(0).toString();
if (!attributetype.empty()) {
if (attributetype == "Light") {
std::string lightprop;
QString lightprop;
foreach (const QVariant& vprop, subobject.properties) {
lightprop = vprop.toString().toStdString();
lightprop = vprop.toString();
}
FBXLight light = extractLight(object);
}
}
} else {
std::string whatisthat = subobject.name;
QString whatisthat = subobject.name;
if (whatisthat == "Shape") {
}
}
@ -1604,7 +1604,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
if (property.name == propertyName) {
QString v = property.properties.at(0).toString();
if (property.properties.at(0) == "UVSet") {
tex.assign(tex.UVSet, property.properties.at(index).toString().toStdString());
tex.assign(tex.UVSet, property.properties.at(index).toString());
} else if (property.properties.at(0) == "CurrentTextureBlendMode") {
tex.assign<uint8_t>(tex.currentTextureBlendMode, property.properties.at(index).value<int>());
} else if (property.properties.at(0) == "UseMaterial") {
@ -1618,7 +1618,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
}
#if defined(DEBUG_FBXREADER)
else {
std::string propName = v.toStdString();
QString propName = v;
unknown++;
}
#endif
@ -1632,7 +1632,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
} else if (subobject.name == "FileName") {
} else if (subobject.name == "Media") {
} else {
std::string subname = subobject.name.data();
QString subname = subobject.name.data();
unknown++;
}
}
@ -1693,7 +1693,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
}
#if defined(DEBUG_FBXREADER)
else {
const std::string propname = property.properties.at(0).toString().toStdString();
const QString propname = property.properties.at(0).toString();
if (propname == "EmissiveFactor") {
}
}
@ -1703,7 +1703,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
}
#if defined(DEBUG_FBXREADER)
else {
std::string propname = subobject.name.data();
QString propname = subobject.name.data();
int unknown = 0;
if ( (propname == "Version")
||(propname == "ShadingModel")
@ -1719,21 +1719,21 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
} else if (object.name == "NodeAttribute") {
#if defined(DEBUG_FBXREADER)
std::vector<std::string> properties;
std::vector<QString> properties;
foreach(const QVariant& v, object.properties) {
properties.push_back(v.toString().toStdString());
properties.push_back(v.toString());
}
#endif
std::string attribID = getID(object.properties).toStdString();
std::string attributetype;
QString attribID = getID(object.properties);
QString attributetype;
foreach (const FBXNode& subobject, object.children) {
if (subobject.name == "TypeFlags") {
typeFlags.insert(getID(object.properties), subobject.properties.at(0).toString());
attributetype = subobject.properties.at(0).toString().toStdString();
attributetype = subobject.properties.at(0).toString();
}
}
if (!attributetype.empty()) {
if (!attributetype.isEmpty()) {
if (attributetype == "Light") {
FBXLight light = extractLight(object);
lights[attribID] = light;
@ -1781,7 +1781,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
}
#if defined(DEBUG_FBXREADER)
else {
std::string objectname = object.name.data();
QString objectname = object.name.data();
if ( objectname == "Pose"
|| objectname == "AnimationStack"
|| objectname == "AnimationLayer"
@ -1800,7 +1800,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
QString parentID = getID(connection.properties, 2);
ooChildToParent.insert(childID, parentID);
if (!hifiGlobalNodeID.isEmpty() && (parentID == hifiGlobalNodeID)) {
std::map< std::string, FBXLight >::iterator lit = lights.find(childID.toStdString());
std::map< QString, FBXLight >::iterator lit = lights.find(childID);
if (lit != lights.end()) {
lightmapLevel = (*lit).second.intensity;
if (lightmapLevel <= 0.0f) {
@ -1842,7 +1842,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
} else if (loadLightmaps && type.contains("ambient")) {
ambientTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
} else {
std::string typenam = type.data();
QString typenam = type.data();
counter++;
}
}
@ -1853,7 +1853,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
}
#if defined(DEBUG_FBXREADER)
else {
std::string objectname = child.name.data();
QString objectname = child.name.data();
if ( objectname == "Pose"
|| objectname == "CreationTime"
|| objectname == "FileId"
@ -1875,7 +1875,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
// TODO: check if is code is needed
if (!lights.empty()) {
if (hifiGlobalNodeID.isEmpty()) {
std::map< std::string, FBXLight >::iterator l = lights.begin();
std::map< QString, FBXLight >::iterator l = lights.begin();
lightmapLevel = (*l).second.intensity;
}
}

View file

@ -110,7 +110,7 @@ public:
Transform transform;
int texcoordSet;
std::string texcoordSetName;
QString texcoordSetName;
};
/// A single part of a mesh (with the same material).

View file

@ -1873,9 +1873,9 @@ void GeometryReader::run() {
if (!_reply) {
throw QString("Reply is NULL ?!");
}
std::string urlname = _url.path().toLower().toStdString();
QString urlname = _url.path().toLower();
bool urlValid = true;
urlValid &= !urlname.empty();
urlValid &= !urlname.isEmpty();
urlValid &= !_url.path().isEmpty();
urlValid &= _url.path().toLower().endsWith(".fbx")
|| _url.path().toLower().endsWith(".svo");