Merge pull request #4580 from birarda/master

use non-persistent settings to avoid lobby crash confusion
This commit is contained in:
Clément Brisset 2015-04-02 17:37:24 +02:00
commit 01dc1b058c
12 changed files with 125 additions and 67 deletions

View file

@ -13,8 +13,6 @@
set(_TBB_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib) set(_TBB_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)
file(GLOB_RECURSE _TBB_LIBRARIES "${_TBB_LIBRARY_DIR}/*.dylib") file(GLOB_RECURSE _TBB_LIBRARIES "${_TBB_LIBRARY_DIR}/*.dylib")
message(${_TBB_LIBRARIES})
# raise an error if we found none # raise an error if we found none
if (NOT _TBB_LIBRARIES) if (NOT _TBB_LIBRARIES)
message(FATAL_ERROR "Did not find any TBB libraries") message(FATAL_ERROR "Did not find any TBB libraries")

View file

@ -14,6 +14,7 @@ Script.load("selectAudioDevice.js");
Script.load("controllers/hydra/hydraMove.js"); Script.load("controllers/hydra/hydraMove.js");
Script.load("headMove.js"); Script.load("headMove.js");
Script.load("inspect.js"); Script.load("inspect.js");
Script.load("lobby.js");
Script.load("notifications.js"); Script.load("notifications.js");
Script.load("look.js"); Script.load("look.js");
Script.load("users.js"); Script.load("users.js");

View file

@ -45,8 +45,6 @@ var panelsCenterShift = Vec3.subtract(panelsCenter, orbCenter);
var ORB_SHIFT = { x: 0, y: -1.4, z: -0.8}; var ORB_SHIFT = { x: 0, y: -1.4, z: -0.8};
var HELMET_ATTACHMENT_URL = HIFI_PUBLIC_BUCKET + "models/attachments/IronManMaskOnly.fbx"
var LOBBY_PANEL_WALL_URL = HIFI_PUBLIC_BUCKET + "models/sets/Lobby/PanelWallForInterface.fbx"; var LOBBY_PANEL_WALL_URL = HIFI_PUBLIC_BUCKET + "models/sets/Lobby/PanelWallForInterface.fbx";
var LOBBY_BLANK_PANEL_TEXTURE_URL = HIFI_PUBLIC_BUCKET + "models/sets/Lobby/Texture.jpg"; var LOBBY_BLANK_PANEL_TEXTURE_URL = HIFI_PUBLIC_BUCKET + "models/sets/Lobby/Texture.jpg";
var LOBBY_SHELL_URL = HIFI_PUBLIC_BUCKET + "models/sets/Lobby/LobbyShellForInterface.fbx"; var LOBBY_SHELL_URL = HIFI_PUBLIC_BUCKET + "models/sets/Lobby/LobbyShellForInterface.fbx";
@ -137,9 +135,6 @@ function drawLobby() {
orbShell = Overlays.addOverlay("model", orbShellProps); orbShell = Overlays.addOverlay("model", orbShellProps);
descriptionText = Overlays.addOverlay("text3d", descriptionTextProps); descriptionText = Overlays.addOverlay("text3d", descriptionTextProps);
// 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);
if (droneSound.downloaded) { if (droneSound.downloaded) {
// start the drone sound // start the drone sound
if (!currentDrone) { if (!currentDrone) {
@ -237,6 +232,8 @@ function playRandomMuzak() {
} }
function cleanupLobby() { function cleanupLobby() {
toggleEnvironmentRendering(true);
// for each of the 21 placeholder textures, set them back to default so the cached model doesn't have changed textures // for each of the 21 placeholder textures, set them back to default so the cached model doesn't have changed textures
var panelTexturesReset = {}; var panelTexturesReset = {};
panelTexturesReset["textures"] = {}; panelTexturesReset["textures"] = {};
@ -254,15 +251,18 @@ function cleanupLobby() {
panelWall = false; panelWall = false;
orbShell = false; orbShell = false;
if (currentDrone) {
currentDrone.stop(); currentDrone.stop();
currentMuzakInjector.stop(); currentDrone = null
}
if (currentMuzakInjector) {
currentMuzakInjector.stop();
currentMuzakInjector = null; currentMuzakInjector = null;
}
places = {}; places = {};
toggleEnvironmentRendering(true);
MyAvatar.detachOne(HELMET_ATTACHMENT_URL);
} }
function actionStartEvent(event) { function actionStartEvent(event) {
@ -311,10 +311,8 @@ function maybeCleanupLobby() {
} }
function toggleEnvironmentRendering(shouldRender) { function toggleEnvironmentRendering(shouldRender) {
Menu.setIsOptionChecked("Voxels", shouldRender); Scene.shouldRenderAvatars = shouldRender;
Menu.setIsOptionChecked("Entities", shouldRender); Scene.shouldRenderEntities = shouldRender;
Menu.setIsOptionChecked("Metavoxels", shouldRender);
Menu.setIsOptionChecked("Avatars", shouldRender);
} }
function handleLookAt(pickRay) { function handleLookAt(pickRay) {

View file

@ -11,13 +11,21 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
var createdRenderMenu = false;
var ENTITIES_MENU = "Developer > Entities";
var COLLISION_UPDATES_TO_SERVER = "Don't send collision updates to server";
var RENDER_MENU = "Developer > Render";
var ENTITIES_ITEM = "Entities";
var AVATARS_ITEM = "Avatars";
function setupMenus() { function setupMenus() {
if (!Menu.menuExists("Developer")) { if (!Menu.menuExists("Developer")) {
Menu.addMenu("Developer"); Menu.addMenu("Developer");
} }
if (!Menu.menuExists("Developer > Entities")) { if (!Menu.menuExists(ENTITIES_MENU)) {
Menu.addMenu("Developer > Entities"); Menu.addMenu(ENTITIES_MENU);
// NOTE: these menu items aren't currently working. I've temporarily removed them. Will add them back once we // NOTE: these menu items aren't currently working. I've temporarily removed them. Will add them back once we
// rewire these to work // rewire these to work
@ -31,27 +39,55 @@ function setupMenus() {
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Do Precision Picking", isCheckable: true, isChecked: false }); Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Do Precision Picking", isCheckable: true, isChecked: false });
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Disable Light Entities", isCheckable: true, isChecked: false }); Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Disable Light Entities", isCheckable: true, isChecked: false });
*/ */
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't send collision updates to server", isCheckable: true, isChecked: false }); Menu.addMenuItem({ menuName: ENTITIES_MENU, menuItemName: COLLISION_UPDATES_TO_SERVER, isCheckable: true, isChecked: false });
}
if (!Menu.menuExists(RENDER_MENU)) {
Menu.addMenu(RENDER_MENU);
createdRenderMenu = true;
}
if (!Menu.menuItemExists(RENDER_MENU, ENTITIES_ITEM)) {
Menu.addMenuItem({ menuName: RENDER_MENU, menuItemName: ENTITIES_ITEM, isCheckable: true, isChecked: Scene.shouldRenderEntities })
}
if (!Menu.menuItemExists(RENDER_MENU, AVATARS_ITEM)) {
Menu.addMenuItem({ menuName: RENDER_MENU, menuItemName: AVATARS_ITEM, isCheckable: true, isChecked: Scene.shouldRenderAvatars })
} }
} }
Menu.menuItemEvent.connect(function (menuItem) { Menu.menuItemEvent.connect(function (menuItem) {
print("menuItemEvent() in JS... menuItem=" + menuItem); print("menuItemEvent() in JS... menuItem=" + menuItem);
if (menuItem == "Don't send collision updates to server") { if (menuItem == COLLISION_UPDATES_TO_SERVER) {
var dontSendUpdates = Menu.isOptionChecked("Don't send collision updates to server"); var dontSendUpdates = Menu.isOptionChecked(COLLISION_UPDATES_TO_SERVER);
print(" dontSendUpdates... checked=" + dontSendUpdates); print(" dontSendUpdates... checked=" + dontSendUpdates);
Entities.setSendPhysicsUpdates(!dontSendUpdates); Entities.setSendPhysicsUpdates(!dontSendUpdates);
} else if (menuItem == ENTITIES_ITEM) {
Scene.shouldRenderEntities = Menu.isOptionChecked(ENTITIES_ITEM);
} else if (menuItem == AVATARS_ITEM) {
Scene.shouldRenderAvatars = Menu.isOptionChecked(AVATARS_ITEM);
} }
}); });
setupMenus(); Scene.shouldRenderAvatarsChanged.connect(function(shouldRenderAvatars) {
Menu.setIsOptionChecked(AVATARS_ITEM, shouldRenderAvatars)
});
// register our scriptEnding callback Scene.shouldRenderEntitiesChanged.connect(function(shouldRenderEntities) {
Script.scriptEnding.connect(scriptEnding); Menu.setIsOptionChecked(ENTITIES_ITEM, shouldRenderEntities)
});
function scriptEnding() { function scriptEnding() {
Menu.removeMenu("Developer > Entities"); Menu.removeMenu(ENTITIES_MENU);
if (createdRenderMenu) {
Menu.removeMenu(RENDER_MENU);
} else {
Menu.removeMenuItem(RENDER_MENU, ENTITIES_ITEM);
Menu.removeMenuItem(RENDER_MENU, AVATARS_ITEM);
}
} }
setupMenus(); setupMenus();
Script.scriptEnding.connect(scriptEnding); Script.scriptEnding.connect(scriptEnding);

View file

@ -2259,7 +2259,7 @@ void Application::update(float deltaTime) {
if (queryIsDue || viewIsDifferentEnough) { if (queryIsDue || viewIsDifferentEnough) {
_lastQueriedTime = now; _lastQueriedTime = now;
if (Menu::getInstance()->isOptionChecked(MenuOption::Entities)) { if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
queryOctree(NodeType::EntityServer, PacketTypeEntityQuery, _entityServerJurisdictions); queryOctree(NodeType::EntityServer, PacketTypeEntityQuery, _entityServerJurisdictions);
} }
_lastQueriedViewFrustum = _viewFrustum; _lastQueriedViewFrustum = _viewFrustum;
@ -2972,7 +2972,7 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs
DependencyManager::get<GeometryCache>()->renderSphere(originSphereRadius, 15, 15, glm::vec4(1.0f, 0.0f, 0.0f, 1.0f)); DependencyManager::get<GeometryCache>()->renderSphere(originSphereRadius, 15, 15, glm::vec4(1.0f, 0.0f, 0.0f, 1.0f));
// render models... // render models...
if (Menu::getInstance()->isOptionChecked(MenuOption::Entities)) { if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
PerformanceTimer perfTimer("entities"); PerformanceTimer perfTimer("entities");
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"Application::displaySide() ... entities..."); "Application::displaySide() ... entities...");
@ -2994,16 +2994,14 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs
} }
} }
bool mirrorMode = (theCamera.getMode() == CAMERA_MODE_MIRROR); bool mirrorMode = (theCamera.getMode() == CAMERA_MODE_MIRROR);
{ {
PerformanceTimer perfTimer("avatars"); PerformanceTimer perfTimer("avatars");
DependencyManager::get<AvatarManager>()->renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, DependencyManager::get<AvatarManager>()->renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE,
false, selfAvatarOnly); false, selfAvatarOnly);
} }
{ {
DependencyManager::get<DeferredLightingEffect>()->setAmbientLightMode(getRenderAmbientLight()); DependencyManager::get<DeferredLightingEffect>()->setAmbientLightMode(getRenderAmbientLight());
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage(); auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();

View file

@ -268,8 +268,6 @@ Menu::Menu() {
QMenu* renderOptionsMenu = developerMenu->addMenu("Render"); QMenu* renderOptionsMenu = developerMenu->addMenu("Render");
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Atmosphere, Qt::SHIFT | Qt::Key_A, true); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Atmosphere, Qt::SHIFT | Qt::Key_A, true);
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Avatars, 0, true);
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Entities, 0, true);
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AmbientOcclusion); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AmbientOcclusion);
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::DontFadeOnOctreeServerChanges); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::DontFadeOnOctreeServerChanges);

View file

@ -119,7 +119,6 @@ namespace MenuOption {
const QString AudioSourceInject = "Generated Audio"; const QString AudioSourceInject = "Generated Audio";
const QString AudioSourcePinkNoise = "Pink Noise"; const QString AudioSourcePinkNoise = "Pink Noise";
const QString AudioSourceSine440 = "Sine 440hz"; const QString AudioSourceSine440 = "Sine 440hz";
const QString Avatars = "Avatars";
const QString BandwidthDetails = "Bandwidth Details"; const QString BandwidthDetails = "Bandwidth Details";
const QString BlueSpeechSphere = "Blue Sphere While Speaking"; const QString BlueSpeechSphere = "Blue Sphere While Speaking";
const QString BookmarkLocation = "Bookmark Location"; const QString BookmarkLocation = "Bookmark Location";
@ -156,7 +155,6 @@ namespace MenuOption {
const QString EnableCharacterController = "Enable avatar collisions"; const QString EnableCharacterController = "Enable avatar collisions";
const QString EnableGlowEffect = "Enable Glow Effect (Warning: Poor Oculus Performance)"; const QString EnableGlowEffect = "Enable Glow Effect (Warning: Poor Oculus Performance)";
const QString EnableVRMode = "Enable VR Mode"; const QString EnableVRMode = "Enable VR Mode";
const QString Entities = "Entities";
const QString ExpandMyAvatarSimulateTiming = "Expand /myAvatar/simulation"; const QString ExpandMyAvatarSimulateTiming = "Expand /myAvatar/simulation";
const QString ExpandMyAvatarTiming = "Expand /myAvatar"; const QString ExpandMyAvatarTiming = "Expand /myAvatar";
const QString ExpandOtherAvatarTiming = "Expand /otherAvatar"; const QString ExpandOtherAvatarTiming = "Expand /otherAvatar";

View file

@ -364,9 +364,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
: GLOW_FROM_AVERAGE_LOUDNESS; : GLOW_FROM_AVERAGE_LOUDNESS;
// render body // render body
if (Menu::getInstance()->isOptionChecked(MenuOption::Avatars)) {
renderBody(frustum, renderMode, postLighting, glowLevel); renderBody(frustum, renderMode, postLighting, glowLevel);
}
if (!postLighting && renderMode != SHADOW_RENDER_MODE) { if (!postLighting && renderMode != SHADOW_RENDER_MODE) {
// add local lights // add local lights

View file

@ -25,6 +25,7 @@
#include "AvatarManager.h" #include "AvatarManager.h"
#include "Menu.h" #include "Menu.h"
#include "MyAvatar.h" #include "MyAvatar.h"
#include "SceneScriptingInterface.h"
// 70 times per second - target is 60hz, but this helps account for any small deviations // 70 times per second - target is 60hz, but this helps account for any small deviations
// in the update loop // in the update loop
@ -122,6 +123,7 @@ void AvatarManager::renderAvatars(Avatar::RenderMode renderMode, bool postLighti
glm::vec3 cameraPosition = Application::getInstance()->getCamera()->getPosition(); glm::vec3 cameraPosition = Application::getInstance()->getCamera()->getPosition();
if (!selfAvatarOnly) { if (!selfAvatarOnly) {
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()) {
foreach (const AvatarSharedPointer& avatarPointer, _avatarHash) { foreach (const AvatarSharedPointer& avatarPointer, _avatarHash) {
Avatar* avatar = static_cast<Avatar*>(avatarPointer.data()); Avatar* avatar = static_cast<Avatar*>(avatarPointer.data());
if (!avatar->isInitialized()) { if (!avatar->isInitialized()) {
@ -131,6 +133,7 @@ void AvatarManager::renderAvatars(Avatar::RenderMode renderMode, bool postLighti
avatar->setDisplayingLookatVectors(renderLookAtVectors); avatar->setDisplayingLookatVectors(renderLookAtVectors);
} }
renderAvatarFades(cameraPosition, renderMode); renderAvatarFades(cameraPosition, renderMode);
}
} else { } else {
// just render myAvatar // just render myAvatar
_myAvatar->render(cameraPosition, renderMode, postLighting); _myAvatar->render(cameraPosition, renderMode, postLighting);

View file

@ -14,6 +14,7 @@
#include "Application.h" #include "Application.h"
#include "Menu.h" #include "Menu.h"
#include "OctreePacketProcessor.h" #include "OctreePacketProcessor.h"
#include "SceneScriptingInterface.h"
void OctreePacketProcessor::processPacket(const SharedNodePointer& sendingNode, const QByteArray& packet) { void OctreePacketProcessor::processPacket(const SharedNodePointer& sendingNode, const QByteArray& packet) {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
@ -81,13 +82,13 @@ void OctreePacketProcessor::processPacket(const SharedNodePointer& sendingNode,
switch(voxelPacketType) { switch(voxelPacketType) {
case PacketTypeEntityErase: { case PacketTypeEntityErase: {
if (Menu::getInstance()->isOptionChecked(MenuOption::Entities)) { if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
app->_entities.processEraseMessage(mutablePacket, sendingNode); app->_entities.processEraseMessage(mutablePacket, sendingNode);
} }
} break; } break;
case PacketTypeEntityData: { case PacketTypeEntityData: {
if (Menu::getInstance()->isOptionChecked(MenuOption::Entities)) { if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
app->_entities.processDatagram(mutablePacket, sendingNode); app->_entities.processDatagram(mutablePacket, sendingNode);
} }
} break; } break;

View file

@ -65,3 +65,17 @@ float SceneScriptingInterface::getSunIntensity() const {
model::SunSkyStagePointer SceneScriptingInterface::getSkyStage() const { model::SunSkyStagePointer SceneScriptingInterface::getSkyStage() const {
return _skyStage; return _skyStage;
} }
void SceneScriptingInterface::setShouldRenderAvatars(bool shouldRenderAvatars) {
if (shouldRenderAvatars != _shouldRenderAvatars) {
_shouldRenderAvatars = shouldRenderAvatars;
emit shouldRenderAvatarsChanged(_shouldRenderAvatars);
}
}
void SceneScriptingInterface::setShouldRenderEntities(bool shouldRenderEntities) {
if (shouldRenderEntities != _shouldRenderEntities) {
_shouldRenderEntities = shouldRenderEntities;
emit shouldRenderEntitiesChanged(_shouldRenderEntities);
}
}

View file

@ -22,6 +22,9 @@ class SceneScriptingInterface : public QObject, public Dependency {
Q_OBJECT Q_OBJECT
SINGLETON_DEPENDENCY SINGLETON_DEPENDENCY
Q_PROPERTY(bool shouldRenderAvatars READ shouldRenderAvatars WRITE setShouldRenderAvatars)
Q_PROPERTY(bool shouldRenderEntities READ shouldRenderEntities WRITE setShouldRenderEntities)
public: public:
Q_INVOKABLE void setStageOrientation(const glm::quat& orientation); Q_INVOKABLE void setStageOrientation(const glm::quat& orientation);
@ -42,11 +45,23 @@ public:
model::SunSkyStagePointer getSkyStage() const; model::SunSkyStagePointer getSkyStage() const;
Q_INVOKABLE void setShouldRenderAvatars(bool shouldRenderAvatars);
Q_INVOKABLE bool shouldRenderAvatars() const { return _shouldRenderAvatars; }
Q_INVOKABLE void setShouldRenderEntities(bool shouldRenderEntities);
Q_INVOKABLE bool shouldRenderEntities() const { return _shouldRenderEntities; }
signals:
void shouldRenderAvatarsChanged(bool shouldRenderAvatars);
void shouldRenderEntitiesChanged(bool shouldRenderEntities);
protected: protected:
SceneScriptingInterface() {}; SceneScriptingInterface() {};
~SceneScriptingInterface() {}; ~SceneScriptingInterface() {};
model::SunSkyStagePointer _skyStage = model::SunSkyStagePointer(new model::SunSkyStage()); model::SunSkyStagePointer _skyStage = model::SunSkyStagePointer(new model::SunSkyStage());
bool _shouldRenderAvatars = true;
bool _shouldRenderEntities = true;
}; };
#endif // hifi_SceneScriptingInterface_h #endif // hifi_SceneScriptingInterface_h