Merge branch 'spectator-camera' of https://github.com/highfidelity/hifi into dk/hmdPreviewFix

This commit is contained in:
David Kelly 2017-07-12 16:50:51 -07:00
commit 4b3cf5ee2e
13 changed files with 11 additions and 65 deletions

View file

@ -108,9 +108,6 @@ void AvatarMixerClientData::ignoreOther(SharedNodePointer self, SharedNodePointe
void AvatarMixerClientData::removeFromRadiusIgnoringSet(SharedNodePointer self, const QUuid& other) {
if (isRadiusIgnoring(other)) {
_radiusIgnoredOthers.erase(other);
auto exitingSpaceBubblePacket = NLPacket::create(PacketType::ExitingSpaceBubble, NUM_BYTES_RFC4122_UUID);
exitingSpaceBubblePacket->write(other.toRfc4122());
DependencyManager::get<NodeList>()->sendUnreliablePacket(*exitingSpaceBubblePacket, *self);
}
}

View file

@ -40,9 +40,9 @@ public:
QUuid attachedEntityId{};
glm::vec3 position{};
glm::quat orientation{};
float vFoV{ 45.0f };
float nearClipPlaneDistance{ 0.1f };
float farClipPlaneDistance{ 100.0f };
float vFoV{ DEFAULT_FIELD_OF_VIEW_DEGREES };
float nearClipPlaneDistance{ DEFAULT_NEAR_CLIP };
float farClipPlaneDistance{ DEFAULT_FAR_CLIP };
SecondaryCameraJobConfig() : render::Task::Config(false) {}
signals:
void dirty();

View file

@ -63,7 +63,6 @@ AvatarManager::AvatarManager(QObject* parent) :
packetReceiver.registerListener(PacketType::BulkAvatarData, this, "processAvatarDataPacket");
packetReceiver.registerListener(PacketType::KillAvatar, this, "processKillAvatar");
packetReceiver.registerListener(PacketType::AvatarIdentity, this, "processAvatarIdentityPacket");
packetReceiver.registerListener(PacketType::ExitingSpaceBubble, this, "processExitingSpaceBubble");
// when we hear that the user has ignored an avatar by session UUID
// immediately remove that avatar instead of waiting for the absence of packets from avatar mixer
@ -320,9 +319,6 @@ void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar
if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble) {
emit DependencyManager::get<UsersScriptingInterface>()->enteredIgnoreRadius();
}
if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble || removalReason == YourAvatarEnteredTheirBubble) {
DependencyManager::get<NodeList>()->radiusIgnoreNodeBySessionID(avatar->getSessionUUID(), true);
} else if (removalReason == KillAvatarReason::AvatarDisconnected) {
// remove from node sets, if present
DependencyManager::get<NodeList>()->removeFromIgnoreMuteSets(avatar->getSessionUUID());

View file

@ -131,7 +131,6 @@ void AudioDeviceList::resetDevice(bool contextIsHMD, const QString& device) {
void AudioDeviceList::onDeviceChanged(const QAudioDeviceInfo& device) {
auto oldDevice = _selectedDevice;
_selectedDevice = device;
QModelIndex index;
for (auto i = 0; i < _devices.size(); ++i) {
AudioDevice& device = _devices[i];
@ -139,7 +138,6 @@ void AudioDeviceList::onDeviceChanged(const QAudioDeviceInfo& device) {
device.selected = false;
} else if (device.info == _selectedDevice) {
device.selected = true;
index = createIndex(i, 0);
}
}

View file

@ -1453,8 +1453,7 @@ void Avatar::addToScene(AvatarSharedPointer myHandle, const render::ScenePointer
if (scene) {
auto nodelist = DependencyManager::get<NodeList>();
if (showAvatars
&& !nodelist->isIgnoringNode(getSessionUUID())
&& !nodelist->isRadiusIgnoringNode(getSessionUUID())) {
&& !nodelist->isIgnoringNode(getSessionUUID())) {
render::Transaction transaction;
addToScene(myHandle, scene, transaction);
scene->enqueueTransaction(transaction);

View file

@ -170,13 +170,6 @@ void AvatarHashMap::processKillAvatar(QSharedPointer<ReceivedMessage> message, S
removeAvatar(sessionUUID, reason);
}
void AvatarHashMap::processExitingSpaceBubble(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode) {
// read the node id
QUuid sessionUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
auto nodeList = DependencyManager::get<NodeList>();
nodeList->radiusIgnoreNodeBySessionID(sessionUUID, false);
}
void AvatarHashMap::removeAvatar(const QUuid& sessionUUID, KillAvatarReason removalReason) {
QWriteLocker locker(&_hashLock);

View file

@ -60,7 +60,6 @@ protected slots:
void processAvatarDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
void processAvatarIdentityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
void processKillAvatar(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
void processExitingSpaceBubble(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
protected:
AvatarHashMap();

View file

@ -241,10 +241,6 @@ void NodeList::reset() {
_numNoReplyDomainCheckIns = 0;
// lock and clear our set of radius ignored IDs
_radiusIgnoredSetLock.lockForWrite();
_radiusIgnoredNodeIDs.clear();
_radiusIgnoredSetLock.unlock();
// lock and clear our set of ignored IDs
_ignoredSetLock.lockForWrite();
_ignoredNodeIDs.clear();
@ -810,22 +806,6 @@ void NodeList::sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationN
sendPacket(std::move(ignorePacket), *destinationNode);
}
void NodeList::radiusIgnoreNodeBySessionID(const QUuid& nodeID, bool radiusIgnoreEnabled) {
if (radiusIgnoreEnabled) {
QReadLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // read lock for insert
// add this nodeID to our set of ignored IDs
_radiusIgnoredNodeIDs.insert(nodeID);
} else {
QWriteLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // write lock for unsafe_erase
_radiusIgnoredNodeIDs.unsafe_erase(nodeID);
}
}
bool NodeList::isRadiusIgnoringNode(const QUuid& nodeID) const {
QReadLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // read lock for reading
return _radiusIgnoredNodeIDs.find(nodeID) != _radiusIgnoredNodeIDs.cend();
}
void NodeList::ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled) {
// enumerate the nodes to send a reliable ignore packet to each that can leverage it
if (!nodeID.isNull() && _sessionUUID != nodeID) {

View file

@ -77,8 +77,6 @@ public:
void toggleIgnoreRadius() { ignoreNodesInRadius(!getIgnoreRadiusEnabled()); }
void enableIgnoreRadius() { ignoreNodesInRadius(true); }
void disableIgnoreRadius() { ignoreNodesInRadius(false); }
void radiusIgnoreNodeBySessionID(const QUuid& nodeID, bool radiusIgnoreEnabled);
bool isRadiusIgnoringNode(const QUuid& other) const;
void ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled);
bool isIgnoringNode(const QUuid& nodeID) const;
void personalMuteNodeBySessionID(const QUuid& nodeID, bool muteEnabled);
@ -166,8 +164,6 @@ private:
QTimer _keepAlivePingTimer;
bool _requestsDomainListData;
mutable QReadWriteLock _radiusIgnoredSetLock;
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _radiusIgnoredNodeIDs;
mutable QReadWriteLock _ignoredSetLock;
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs;
mutable QReadWriteLock _personalMutedSetLock;

View file

@ -105,7 +105,6 @@ public:
UsernameFromIDReply,
ViewFrustum,
RequestsDomainListData,
ExitingSpaceBubble,
PerAvatarGainSet,
EntityScriptGetStatus,
EntityScriptGetStatusReply,

View file

@ -25,7 +25,6 @@ var DEFAULT_SCRIPTS_COMBINED = [
"system/tablet-goto.js",
"system/marketplaces/marketplaces.js",
"system/edit.js",
"system/spectatorCamera.js",
"system/notifications.js",
"system/dialTone.js",
"system/firstPersonHMD.js",

View file

@ -46,11 +46,7 @@
// -Far clip plane distance
// -viewFinderOverlay: The in-world overlay that displays the spectator camera's view.
// -camera: The in-world entity that corresponds to the spectator camera.
// -cameraIsDynamic: "false" for now while we figure out why dynamic, parented overlays
// drift with respect to their parent.
// -vFoV: The vertical field of view of the spectator camera.
// -nearClipPlaneDistance: The near clip plane distance of the spectator camera (aka "camera").
// -farClipPlaneDistance: The far clip plane distance of the spectator camera.
// -cameraIsDynamic: "false" for now - maybe it shouldn't be? False means that the camera won't drift when you let go...
// -cameraRotation: The rotation of the spectator camera.
// -cameraPosition: The position of the spectator camera.
// -glassPaneWidth: The width of the glass pane above the spectator camera that holds the viewFinderOverlay.
@ -61,9 +57,6 @@
var viewFinderOverlay = false;
var camera = false;
var cameraIsDynamic = false;
var vFoV = 45.0;
var nearClipPlaneDistance = 0.1;
var farClipPlaneDistance = 100.0;
var cameraRotation;
var cameraPosition;
var glassPaneWidth = 0.16;
@ -75,9 +68,6 @@
// Sets the special texture size based on the window it is displayed in, which doesn't include the menu bar
spectatorCameraConfig.enableSecondaryCameraRenderConfigs(true);
spectatorCameraConfig.resetSizeSpectatorCamera(Window.innerWidth, Window.innerHeight);
spectatorCameraConfig.vFoV = vFoV;
spectatorCameraConfig.nearClipPlaneDistance = nearClipPlaneDistance;
spectatorCameraConfig.farClipPlaneDistance = farClipPlaneDistance;
cameraRotation = MyAvatar.orientation, cameraPosition = inFrontOf(1, Vec3.sum(MyAvatar.position, { x: 0, y: 0.3, z: 0 }));
camera = Entities.addEntity({
"angularDamping": 1,
@ -85,11 +75,11 @@
"collidesWith": "static,dynamic,kinematic,",
"collisionMask": 7,
"dynamic": cameraIsDynamic,
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/spectator-camera.fbx?7",
"modelURL": Script.resolvePath("spectator-camera.fbx"),
"registrationPoint": {
"x": 0.53,
"x": 0.56,
"y": 0.545,
"z": 0.16
"z": 0.23
},
"rotation": cameraRotation,
"position": cameraPosition,
@ -354,9 +344,9 @@
function registerButtonMappings() {
var VRDevices = Controller.getDeviceNames().toString();
if (VRDevices) {
if (VRDevices.includes("Vive")) {
if (VRDevices.indexOf("Vive") !== -1) {
controllerType = "Vive";
} else if (VRDevices.includes("OculusTouch")) {
} else if (VRDevices.indexOf("OculusTouch") !== -1) {
controllerType = "OculusTouch";
} else {
sendToQml({ method: 'updateControllerMappingCheckbox', setting: switchViewFromController, controller: controllerType });
@ -393,7 +383,7 @@
// Relevant Variables:
// -SPECTATOR_CAMERA_QML_SOURCE: The path to the SpectatorCamera QML
// -onSpectatorCameraScreen: true/false depending on whether we're looking at the spectator camera app.
var SPECTATOR_CAMERA_QML_SOURCE = "../SpectatorCamera.qml";
var SPECTATOR_CAMERA_QML_SOURCE = Script.resourcesPath() + "qml/hifi/SpectatorCamera.qml";
var onSpectatorCameraScreen = false;
function onTabletButtonClicked() {
if (!tablet) {