Merge remote-tracking branch 'origin' into marketplaces_html

This commit is contained in:
elisa-lj11 2016-08-30 10:42:56 -07:00
commit fa941e4a1b
7 changed files with 73 additions and 28 deletions

View file

@ -392,7 +392,6 @@ void Agent::processAgentAvatarAndAudio(float deltaTime) {
const int16_t* nextSoundOutput = NULL; const int16_t* nextSoundOutput = NULL;
if (_avatarSound) { if (_avatarSound) {
const QByteArray& soundByteArray = _avatarSound->getByteArray(); const QByteArray& soundByteArray = _avatarSound->getByteArray();
nextSoundOutput = reinterpret_cast<const int16_t*>(soundByteArray.data() nextSoundOutput = reinterpret_cast<const int16_t*>(soundByteArray.data()
+ _numAvatarSoundSentBytes); + _numAvatarSoundSentBytes);
@ -442,6 +441,10 @@ void Agent::processAgentAvatarAndAudio(float deltaTime) {
audioPacket->writePrimitive(headOrientation); audioPacket->writePrimitive(headOrientation);
} else if (nextSoundOutput) { } else if (nextSoundOutput) {
// write the codec
QString codecName;
audioPacket->writeString(codecName);
// assume scripted avatar audio is mono and set channel flag to zero // assume scripted avatar audio is mono and set channel flag to zero
audioPacket->writePrimitive((quint8)0); audioPacket->writePrimitive((quint8)0);

View file

@ -1220,7 +1220,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
_defaultSkyboxAmbientTexture = textureCache->getImageTexture(skyboxAmbientUrl, NetworkTexture::CUBE_TEXTURE, { { "generateIrradiance", true } }); _defaultSkyboxAmbientTexture = textureCache->getImageTexture(skyboxAmbientUrl, NetworkTexture::CUBE_TEXTURE, { { "generateIrradiance", true } });
_defaultSkybox->setCubemap(_defaultSkyboxTexture); _defaultSkybox->setCubemap(_defaultSkyboxTexture);
_defaultSkybox->setColor({ 1.0, 1.0, 1.0 });
EntityItem::setEntitiesShouldFadeFunction([this]() { EntityItem::setEntitiesShouldFadeFunction([this]() {
SharedNodePointer entityServerNode = DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::EntityServer); SharedNodePointer entityServerNode = DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::EntityServer);
@ -4327,8 +4326,9 @@ namespace render {
sceneKeyLight->setIntensity(DEFAULT_SKYBOX_INTENSITY); sceneKeyLight->setIntensity(DEFAULT_SKYBOX_INTENSITY);
sceneKeyLight->setAmbientIntensity(DEFAULT_SKYBOX_AMBIENT_INTENSITY); sceneKeyLight->setAmbientIntensity(DEFAULT_SKYBOX_AMBIENT_INTENSITY);
sceneKeyLight->setDirection(DEFAULT_SKYBOX_DIRECTION); sceneKeyLight->setDirection(DEFAULT_SKYBOX_DIRECTION);
// fall through: render a skybox, if available // fall through: render a skybox (if available), or the defaults (if requested)
} }
case model::SunSkyStage::SKY_BOX: { case model::SunSkyStage::SKY_BOX: {
auto skybox = skyStage->getSkybox(); auto skybox = skyStage->getSkybox();
if (!skybox->empty()) { if (!skybox->empty()) {
@ -4336,25 +4336,32 @@ namespace render {
skybox->render(batch, args->getViewFrustum()); skybox->render(batch, args->getViewFrustum());
break; break;
} }
// fall through: render defaults, if available // fall through: render defaults (if requested)
} }
case model::SunSkyStage::SKY_DEFAULT_AMBIENT_TEXTURE: { case model::SunSkyStage::SKY_DEFAULT_AMBIENT_TEXTURE: {
if (Menu::getInstance()->isOptionChecked(MenuOption::DefaultSkybox)) { if (Menu::getInstance()->isOptionChecked(MenuOption::DefaultSkybox)) {
auto scene = DependencyManager::get<SceneScriptingInterface>()->getStage(); auto scene = DependencyManager::get<SceneScriptingInterface>()->getStage();
auto sceneKeyLight = scene->getKeyLight(); auto sceneKeyLight = scene->getKeyLight();
auto defaultSkyboxAmbientTexture = qApp->getDefaultSkyboxAmbientTexture(); auto defaultSkyboxAmbientTexture = qApp->getDefaultSkyboxAmbientTexture();
// do not set the ambient sphere - it peaks too high, and causes flashing when turning // set the ambient sphere uniformly - the defaultSkyboxAmbientTexture has peaks that cause flashing when turning
sceneKeyLight->setAmbientSphere(DependencyManager::get<TextureCache>()->getWhiteTexture()->getIrradiance());
sceneKeyLight->setAmbientMap(defaultSkyboxAmbientTexture); sceneKeyLight->setAmbientMap(defaultSkyboxAmbientTexture);
// fall through: render defaults skybox
} else {
break;
} }
// fall through: render defaults, if available
} }
case model::SunSkyStage::SKY_DEFAULT_TEXTURE: case model::SunSkyStage::SKY_DEFAULT_TEXTURE:
if (Menu::getInstance()->isOptionChecked(MenuOption::DefaultSkybox)) { if (Menu::getInstance()->isOptionChecked(MenuOption::DefaultSkybox)) {
qApp->getDefaultSkybox()->render(batch, args->getViewFrustum()); qApp->getDefaultSkybox()->render(batch, args->getViewFrustum());
} }
break;
// Any other cases require no extra rendering
case model::SunSkyStage::NO_BACKGROUND: case model::SunSkyStage::NO_BACKGROUND:
default: default:
// this line intentionally left blank
break; break;
} }
} }

View file

@ -113,17 +113,19 @@ void EntityTreeRenderer::resetEntitiesScriptEngine() {
void EntityTreeRenderer::clear() { void EntityTreeRenderer::clear() {
leaveAllEntities(); leaveAllEntities();
// unload and stop the engine
if (_entitiesScriptEngine) { if (_entitiesScriptEngine) {
// Unload and stop the engine here (instead of in its deleter) to // do this here (instead of in deleter) to avoid marshalling unload signals back to this thread
// avoid marshalling unload signals back to this thread
_entitiesScriptEngine->unloadAllEntityScripts(); _entitiesScriptEngine->unloadAllEntityScripts();
_entitiesScriptEngine->stop(); _entitiesScriptEngine->stop();
} }
// reset the engine
if (_wantScripts && !_shuttingDown) { if (_wantScripts && !_shuttingDown) {
resetEntitiesScriptEngine(); resetEntitiesScriptEngine();
} }
// remove all entities from the scene
auto scene = _viewState->getMain3DScene(); auto scene = _viewState->getMain3DScene();
render::PendingChanges pendingChanges; render::PendingChanges pendingChanges;
foreach(auto entity, _entitiesInScene) { foreach(auto entity, _entitiesInScene) {
@ -132,6 +134,10 @@ void EntityTreeRenderer::clear() {
scene->enqueuePendingChanges(pendingChanges); scene->enqueuePendingChanges(pendingChanges);
_entitiesInScene.clear(); _entitiesInScene.clear();
// reset the zone to the default (while we load the next scene)
_bestZone = nullptr;
applyZonePropertiesToScene(_bestZone);
OctreeRenderer::clear(); OctreeRenderer::clear();
} }

View file

@ -49,6 +49,11 @@ void Skybox::updateSchemaBuffer() const {
} }
} }
void Skybox::clear() {
_schemaBuffer.edit<Schema>().color = vec3(0);
setCubemap(nullptr);
}
void Skybox::prepare(gpu::Batch& batch, int textureSlot, int bufferSlot) const { void Skybox::prepare(gpu::Batch& batch, int textureSlot, int bufferSlot) const {
if (bufferSlot > -1) { if (bufferSlot > -1) {
batch.setUniformBuffer(bufferSlot, _schemaBuffer); batch.setUniformBuffer(bufferSlot, _schemaBuffer);

View file

@ -36,7 +36,7 @@ public:
const gpu::TexturePointer& getCubemap() const { return _cubemap; } const gpu::TexturePointer& getCubemap() const { return _cubemap; }
virtual bool empty() { return _schemaBuffer.get<Schema>().color == vec3(0) && !_cubemap; } virtual bool empty() { return _schemaBuffer.get<Schema>().color == vec3(0) && !_cubemap; }
virtual void clear() { setCubemap(nullptr); } virtual void clear();
void prepare(gpu::Batch& batch, int textureSlot = SKYBOX_SKYMAP_SLOT, int bufferSlot = SKYBOX_CONSTANTS_SLOT) const; void prepare(gpu::Batch& batch, int textureSlot = SKYBOX_SKYMAP_SLOT, int bufferSlot = SKYBOX_CONSTANTS_SLOT) const;
virtual void render(gpu::Batch& batch, const ViewFrustum& frustum) const; virtual void render(gpu::Batch& batch, const ViewFrustum& frustum) const;
@ -51,7 +51,7 @@ protected:
class Schema { class Schema {
public: public:
glm::vec3 color { 1.0f, 1.0f, 1.0f }; glm::vec3 color { 0.0f, 0.0f, 0.0f };
float blend { 0.0f }; float blend { 0.0f };
}; };

View file

@ -1369,7 +1369,13 @@ var PropertiesTool = function (opts) {
}); });
webView.webEventReceived.connect(function (data) { webView.webEventReceived.connect(function (data) {
data = JSON.parse(data); try {
data = JSON.parse(data);
}
catch(e) {
print('Edit.js received web event that was not valid json.')
return;
}
var i, properties, dY, diff, newPosition; var i, properties, dY, diff, newPosition;
if (data.type === "print") { if (data.type === "print") {
if (data.message) { if (data.message) {
@ -1418,7 +1424,9 @@ var PropertiesTool = function (opts) {
pushCommandForSelections(); pushCommandForSelections();
selectionManager._update(); selectionManager._update();
} else if(data.type === 'saveUserData'){ } else if(data.type === 'saveUserData'){
Entities.editEntity(data.id, data.properties) //the event bridge and json parsing handle our avatar id string differently.
var actualID = data.id.split('"')[1];
Entities.editEntity(actualID, data.properties);
} else if (data.type === "showMarketplace") { } else if (data.type === "showMarketplace") {
showMarketplace(); showMarketplace();
} else if (data.type === "action") { } else if (data.type === "action") {

View file

@ -333,7 +333,13 @@ function userDataChanger(groupName, keyName, checkBoxElement, userDataElement, d
var properties = {}; var properties = {};
var parsedData = {}; var parsedData = {};
try { try {
parsedData = JSON.parse(userDataElement.value); if ($('#userdata-editor').css('height') !== "0px") {
//if there is an expanded, we want to use its json.
parsedData = getEditorJSON();
} else {
parsedData = JSON.parse(userDataElement.value);
}
} catch (e) {} } catch (e) {}
if (!(groupName in parsedData)) { if (!(groupName in parsedData)) {
@ -441,7 +447,11 @@ function hideUserDataTextArea() {
function showStaticUserData() { function showStaticUserData() {
$('#static-userdata').show(); $('#static-userdata').show();
$('#static-userdata').css('height', $('#userdata-editor').height()) $('#static-userdata').css('height', $('#userdata-editor').height())
$('#static-userdata').text(editor.getText()); if (editor !== null) {
$('#static-userdata').text(editor.getText());
}
}; };
function removeStaticUserData() { function removeStaticUserData() {
@ -450,7 +460,10 @@ function removeStaticUserData() {
function setEditorJSON(json) { function setEditorJSON(json) {
editor.set(json) editor.set(json)
editor.expandAll(); if (editor.hasOwnProperty('expandAll')) {
editor.expandAll();
}
}; };
function getEditorJSON() { function getEditorJSON() {
@ -745,11 +758,13 @@ function loaded() {
} else { } else {
properties = data.selections[0].properties; properties = data.selections[0].properties;
if (lastEntityID !== properties.id && lastEntityID !== null && editor !== null) {
if (lastEntityID !== '"' + properties.id + '"' && lastEntityID !== null && editor !== null) {
saveJSONUserData(true); saveJSONUserData(true);
} }
//the event bridge and json parsing handle our avatar id string differently.
lastEntityID = properties.id; lastEntityID = '"' + properties.id + '"';
elID.innerHTML = properties.id; elID.innerHTML = properties.id;
elType.innerHTML = properties.type; elType.innerHTML = properties.type;
@ -840,26 +855,27 @@ function loaded() {
FIXME: See FIXME for property-script-url. FIXME: See FIXME for property-script-url.
elScriptTimestamp.value = properties.scriptTimestamp; elScriptTimestamp.value = properties.scriptTimestamp;
*/ */
hideUserDataTextArea();
var json = null; var json = null;
try { try {
json = JSON.parse(properties.userData); json = JSON.parse(properties.userData);
} catch (e) {
//normal text
deleteJSONEditor();
elUserData.value = properties.userData;
showUserDataTextArea();
showNewJSONEditorButton();
hideSaveUserDataButton();
}
if (json !== null) {
if (editor === null) { if (editor === null) {
createJSONEditor(); createJSONEditor();
} }
setEditorJSON(json); setEditorJSON(json);
showSaveUserDataButton(); showSaveUserDataButton();
hideUserDataTextArea();
hideNewJSONEditorButton(); hideNewJSONEditorButton();
} catch (e) {
//normal text
elUserData.value = properties.userData;
showUserDataTextArea();
showNewJSONEditorButton();
hideSaveUserDataButton();
} }
elHyperlinkHref.value = properties.href; elHyperlinkHref.value = properties.href;