Merge pull request #12882 from samcake/workload

Workload: merging upstream master back
This commit is contained in:
Andrew Meadows 2018-04-12 15:49:32 -07:00 committed by GitHub
commit 1e82a952b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 47 additions and 52 deletions

View file

@ -4,8 +4,8 @@ set(EXTERNAL_NAME serverless-content)
ExternalProject_Add(
${EXTERNAL_NAME}
URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC66-v3.zip
URL_MD5 ea608c2e4c90539ab3c1d66acf0e005a
URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC66-v4.zip
URL_MD5 d4f42f630986c83427ff39e1fe9908c6
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""

View file

@ -18,7 +18,7 @@ bool MaterialEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityP
if (entity->getMaterial() != _drawMaterial) {
return true;
}
if (entity->getParentID() != _parentID || entity->getClientOnly() != _clientOnly || entity->getOwningAvatarID() != _owningAvatarID) {
if (entity->getParentID() != _parentID) {
return true;
}
if (entity->getMaterialMappingPos() != _materialMappingPos || entity->getMaterialMappingScale() != _materialMappingScale || entity->getMaterialMappingRot() != _materialMappingRot) {
@ -31,8 +31,6 @@ void MaterialEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer&
withWriteLock([&] {
_drawMaterial = entity->getMaterial();
_parentID = entity->getParentID();
_clientOnly = entity->getClientOnly();
_owningAvatarID = entity->getOwningAvatarID();
_materialMappingPos = entity->getMaterialMappingPos();
_materialMappingScale = entity->getMaterialMappingScale();
_materialMappingRot = entity->getMaterialMappingRot();
@ -102,7 +100,7 @@ void MaterialEntityRenderer::doRender(RenderArgs* args) {
graphics::MaterialPointer drawMaterial;
Transform textureTransform;
withReadLock([&] {
parentID = _clientOnly ? _owningAvatarID : _parentID;
parentID = _parentID;
renderTransform = _renderTransform;
drawMaterial = _drawMaterial;
textureTransform.setTranslation(glm::vec3(_materialMappingPos, 0));

View file

@ -32,8 +32,6 @@ private:
ShapeKey getShapeKey() override;
QUuid _parentID;
bool _clientOnly;
QUuid _owningAvatarID;
glm::vec2 _materialMappingPos;
glm::vec2 _materialMappingScale;
float _materialMappingRot;

View file

@ -241,14 +241,18 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
_activityTracking.addedEntityCount++;
auto nodeList = DependencyManager::get<NodeList>();
auto sessionID = nodeList->getSessionUUID();
EntityItemProperties propertiesWithSimID = properties;
if (clientOnly) {
auto nodeList = DependencyManager::get<NodeList>();
const QUuid myNodeID = nodeList->getSessionUUID();
const QUuid myNodeID = sessionID;
propertiesWithSimID.setClientOnly(clientOnly);
propertiesWithSimID.setOwningAvatarID(myNodeID);
}
propertiesWithSimID.setLastEditedBy(sessionID);
bool scalesWithParent = propertiesWithSimID.getScalesWithParent();
propertiesWithSimID = convertPropertiesFromScriptSemantics(propertiesWithSimID, scalesWithParent);
@ -308,6 +312,11 @@ QUuid EntityScriptingInterface::addModelEntity(const QString& name, const QStrin
if (!textures.isEmpty()) {
properties.setTextures(textures);
}
auto nodeList = DependencyManager::get<NodeList>();
auto sessionID = nodeList->getSessionUUID();
properties.setLastEditedBy(sessionID);
return addEntity(properties);
}
@ -363,7 +372,11 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
_activityTracking.editedEntityCount++;
auto nodeList = DependencyManager::get<NodeList>();
auto sessionID = nodeList->getSessionUUID();
EntityItemProperties properties = scriptSideProperties;
properties.setLastEditedBy(sessionID);
EntityItemID entityID(id);
if (!_entityTree) {
@ -379,7 +392,6 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
return;
}
auto nodeList = DependencyManager::get<NodeList>();
if (entity->getClientOnly() && entity->getOwningAvatarID() != nodeList->getSessionUUID()) {
// don't edit other avatar's avatarEntities
return;

View file

@ -27,6 +27,10 @@ MaterialEntityItem::MaterialEntityItem(const EntityItemID& entityItemID) : Entit
_type = EntityTypes::Material;
}
MaterialEntityItem::~MaterialEntityItem() {
removeMaterial();
}
EntityItemProperties MaterialEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
COPY_ENTITY_PROPERTY_TO_PROPERTIES(materialURL, getMaterialURL);
@ -249,28 +253,12 @@ void MaterialEntityItem::setParentID(const QUuid& parentID) {
}
}
void MaterialEntityItem::setClientOnly(bool clientOnly) {
if (getClientOnly() != clientOnly) {
removeMaterial();
EntityItem::setClientOnly(clientOnly);
applyMaterial();
}
}
void MaterialEntityItem::setOwningAvatarID(const QUuid& owningAvatarID) {
if (getOwningAvatarID() != owningAvatarID) {
removeMaterial();
EntityItem::setOwningAvatarID(owningAvatarID);
applyMaterial();
}
}
void MaterialEntityItem::removeMaterial() {
graphics::MaterialPointer material = getMaterial();
if (!material) {
return;
}
QUuid parentID = getClientOnly() ? getOwningAvatarID() : getParentID();
QUuid parentID = getParentID();
if (parentID.isNull()) {
return;
}
@ -294,7 +282,7 @@ void MaterialEntityItem::removeMaterial() {
void MaterialEntityItem::applyMaterial() {
_retryApply = false;
graphics::MaterialPointer material = getMaterial();
QUuid parentID = getClientOnly() ? getOwningAvatarID() : getParentID();
QUuid parentID = getParentID();
if (!material || parentID.isNull()) {
return;
}
@ -328,11 +316,6 @@ void MaterialEntityItem::postParentFixup() {
applyMaterial();
}
void MaterialEntityItem::preDelete() {
EntityItem::preDelete();
removeMaterial();
}
void MaterialEntityItem::update(const quint64& now) {
if (_retryApply) {
applyMaterial();

View file

@ -21,6 +21,7 @@ public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
MaterialEntityItem(const EntityItemID& entityItemID);
~MaterialEntityItem();
ALLOW_INSTANTIATION // This class can be instantiated
@ -77,14 +78,11 @@ public:
void setUserData(const QString& userData) override;
void setParentID(const QUuid& parentID) override;
void setClientOnly(bool clientOnly) override;
void setOwningAvatarID(const QUuid& owningAvatarID) override;
void applyMaterial();
void removeMaterial();
void postParentFixup() override;
void preDelete() override;
private:
// URL for this material. Currently, only JSON format is supported. Set to "userData" to use the user data to live edit a material.

View file

@ -128,6 +128,7 @@ public:
uint8 _wrapModeV = WRAP_REPEAT;
uint8 _wrapModeW = WRAP_REPEAT;
uint8 _mipOffset = 0;
uint8 _minMip = 0;
uint8 _maxMip = MAX_MIP_LEVEL;
@ -142,6 +143,7 @@ public:
_wrapModeU == other._wrapModeU &&
_wrapModeV == other._wrapModeV &&
_wrapModeW == other._wrapModeW &&
_mipOffset == other._mipOffset &&
_minMip == other._minMip &&
_maxMip == other._maxMip;
}
@ -164,6 +166,7 @@ public:
ComparisonFunction getComparisonFunction() const { return ComparisonFunction(_desc._comparisonFunc); }
bool doComparison() const { return getComparisonFunction() != ALWAYS; }
uint8 getMipOffset() const { return _desc._mipOffset; }
uint8 getMinMip() const { return _desc._minMip; }
uint8 getMaxMip() const { return _desc._maxMip; }

View file

@ -522,11 +522,20 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
auto lightStage = renderContext->_scene->getStage<LightStage>();
assert(lightStage);
assert(lightStage->getNumLights() > 0);
auto lightAndShadow = lightStage->getCurrentKeyLightAndShadow();
const auto& globalShadow = lightAndShadow.second;
// Bind the shadow buffers
if (globalShadow) {
for (unsigned int i = 0; i < globalShadow->getCascadeCount(); i++) {
batch.setResourceTexture(SHADOW_MAP_UNIT+i, globalShadow->getCascade(i).map);
}
}
auto program = deferredLightingEffect->_directionalSkyboxLight;
LightLocationsPtr locations = deferredLightingEffect->_directionalSkyboxLightLocations;
// auto keyLight = lightAndShadow.first;
auto keyLight = lightAndShadow.first;
graphics::LightPointer ambientLight;
if (lightStage && lightStage->_currentFrame._ambientLights.size()) {
@ -547,18 +556,6 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
}
if (deferredLightingEffect->_shadowMapEnabled && keyLightCastShadows) {
auto lightAndShadow = lightStage->getCurrentKeyLightAndShadow();
const auto& globalShadow = lightAndShadow.second;
// Bind the shadow buffers
if (globalShadow) {
for (unsigned int i = 0; i < globalShadow->getCascadeCount(); i++) {
batch.setResourceTexture(SHADOW_MAP_UNIT + i, globalShadow->getCascade(i).map);
}
if (locations->shadowTransformBuffer >= 0) {
batch.setUniformBuffer(locations->shadowTransformBuffer, globalShadow->getBuffer());
}
}
// If the keylight has an ambient Map then use the Skybox version of the pass
// otherwise use the ambient sphere version
@ -581,6 +578,12 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
}
}
if (locations->shadowTransformBuffer >= 0) {
if (globalShadow) {
batch.setUniformBuffer(locations->shadowTransformBuffer, globalShadow->getBuffer());
}
}
batch.setPipeline(program);
}

View file

@ -208,8 +208,8 @@ Rectangle {
anchors.rightMargin: 0
anchors.topMargin: 0
minimumValue: 5
maximumValue: 50
value: 3
maximumValue: 75
value: 5
onValueChanged: { _workload.broadcastChangeResolution(value) }
}