fixing some entity visual problems

This commit is contained in:
danteruiz 2018-08-26 21:50:01 -07:00
parent 92acaade2b
commit e4293d9ad5
5 changed files with 28 additions and 23 deletions

View file

@ -5544,7 +5544,6 @@ void Application::update(float deltaTime) {
// for nearby entities before starting bullet up.
quint64 now = usecTimestampNow();
bool renderReady = _octreeProcessor.isEntitiesRenderReady();
qDebug() << "--> render ready: " << renderReady;
if (isServerlessMode() || (_octreeProcessor.isLoadSequenceComplete() && renderReady)) {
// we've received a new full-scene octree stats packet, or it's been long enough to try again anyway
_lastPhysicsCheckTime = now;

View file

@ -13,6 +13,7 @@
#include "EntityTreeRenderer.h"
#include "ModelEntityItem.h"
#include "InterfaceLogging.h"
#include "Application.h"
const int SafeLanding::SEQUENCE_MODULO = std::numeric_limits<OCTREE_PACKET_SEQUENCE>::max() + 1;
@ -129,7 +130,7 @@ bool SafeLanding::isLoadSequenceComplete() {
float SafeLanding::loadingProgressPercentage() {
Locker lock(_lock);
if (_maxTrackedEntityCount > 0) {
float trackedEntityCount = (float)_trackedEntities.size();
float trackedEntityCount = (float)_trackedEntitiesRenderStatus.size();
return ((_maxTrackedEntityCount - trackedEntityCount) / _maxTrackedEntityCount);
}
@ -170,16 +171,18 @@ bool SafeLanding::isEntityPhysicsComplete() {
bool SafeLanding::entitiesRenderReady() {
Locker lock(_lock);
auto entityTree = qApp->getEntities();
for (auto entityMapIter = _trackedEntitiesRenderStatus.begin(); entityMapIter != _trackedEntitiesRenderStatus.end(); ++entityMapIter) {
auto entity = entityMapIter->second;
bool visuallyReady = entity->isVisuallyReady();
qDebug() << "is entityType: " << EntityTypes::getEntityTypeName(entity->getType()) << " " << visuallyReady << " " << entityMapIter->first;
if (visuallyReady) {
if (visuallyReady || !entityTree->renderableForEntityId(entityMapIter->first)) {
entityMapIter = _trackedEntitiesRenderStatus.erase(entityMapIter);
if (entityMapIter == _trackedEntitiesRenderStatus.end()) {
break;
}
} else {
entity->requestRenderUpdate();
}
}
qDebug() << "list size: -> " << _trackedEntitiesRenderStatus.size();

View file

@ -1297,9 +1297,21 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
}
});
// Check for removal
ModelPointer model;
withReadLock([&] { model = _model; });
withWriteLock([&] {
bool visuallyReady = true;
if (_hasModel) {
if (model && _didLastVisualGeometryRequestSucceed) {
visuallyReady = (_prevModelLoaded && _texturesLoaded);
// qDebug() << visuallyReady;
}
}
entity->setVisuallyReady(visuallyReady);
});
// Check for removal
if (!_hasModel) {
if (model) {
model->removeFromScene(scene, transaction);
@ -1445,7 +1457,7 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
if (!jointsMapped()) {
mapJoints(entity, model->getJointNames());
//else the joint have been mapped before but we have a new animation to load
} else if (_animation && (_animation->getURL().toString() != entity->getAnimationURL())) {
} else if (_animation && (_animation->getURL().toString() != entity->getAnimationURL())) {
_animation = DependencyManager::get<AnimationCache>()->getAnimation(entity->getAnimationURL());
_jointMappingCompleted = false;
mapJoints(entity, model->getJointNames());
@ -1455,11 +1467,6 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
}
emit requestRenderUpdate();
}
withWriteLock([&] {
bool visuallyReady = ((_prevModelLoaded && _texturesLoaded) || model->getURL().isEmpty());
entity->setVisuallyReady(visuallyReady);
});
}
void ModelEntityRenderer::setIsVisibleInSecondaryCamera(bool value) {

View file

@ -291,11 +291,12 @@ void ZoneEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scen
bool visuallyReady = true;
uint32_t skyboxMode = entity->getSkyboxMode();
if (skyboxMode == COMPONENT_MODE_ENABLED) {
if (skyboxMode == COMPONENT_MODE_ENABLED && !_skyboxTextureURL.isEmpty()) {
bool skyboxLoadedOrFailed = (_skyboxTexture && (_skyboxTexture->isLoaded() || _skyboxTexture->isFailed()));
qDebug() << entity->getEntityItemID() << "------> " << _skyboxTexture->isFailed() << _skyboxTexture->isLoaded() << _skyboxTextureURL.isEmpty();
visuallyReady = (_skyboxTextureURL.isEmpty() || skyboxLoadedOrFailed);
visuallyReady = skyboxLoadedOrFailed;
}
entity->setVisuallyReady(visuallyReady);
if (bloomChanged) {

View file

@ -223,7 +223,7 @@
function startInterstitialPage() {
if (timer === null) {
updateOverlays(Window.isPhysicsEnabled());
updateOverlays(false);
startAudio();
target = 0;
currentProgress = 0.1;
@ -364,7 +364,6 @@
});
function update() {
var downloadInfo = GlobalServices.getDownloadInfo();
var physicsEnabled = Window.isPhysicsEnabled();
var thisInterval = Date.now();
var deltaTime = (thisInterval - lastInterval);
@ -373,14 +372,11 @@
var domainLoadingProgressPercentage = Window.domainLoadingProgress();
var progress = MAX_X_SIZE * domainLoadingProgressPercentage;
//print(progress);
if (progress >= target) {
print(progress);
//if (progress >= target) {
target = progress;
}
//}
if (physicsEnabled && target < MAX_X_SIZE) {
target = MAX_X_SIZE;
}
currentProgress = lerp(currentProgress, target, 0.2);
var properties = {
localPosition: { x: (1.85 - (currentProgress / 2) - (-0.029 * (currentProgress / MAX_X_SIZE))), y: -0.935, z: 0.0 },
@ -391,7 +387,6 @@
};
Overlays.editOverlay(loadingBarProgress, properties);
print(JSON.stringify(downloadInfo));
if ((physicsEnabled && (currentProgress >= (MAX_X_SIZE - EPSILON)))) {
updateOverlays((physicsEnabled || connectionToDomainFailed));
endAudio();