mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
fixing fading
This commit is contained in:
parent
c404f94220
commit
15070f6374
4 changed files with 12 additions and 12 deletions
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include <PointerManager.h>
|
||||
|
||||
std::function<bool()> EntityTreeRenderer::_entitiesShouldFadeFunction;
|
||||
std::function<bool()> EntityTreeRenderer::_entitiesShouldFadeFunction = []() { return true; };
|
||||
|
||||
QString resolveScriptURL(const QString& scriptUrl) {
|
||||
auto normalizedScriptUrl = DependencyManager::get<ResourceManager>()->normalizeURL(scriptUrl);
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include <ObjectMotionState.h>
|
||||
|
||||
#include "EntityTreeRenderer.h"
|
||||
#include "RenderableLightEntityItem.h"
|
||||
#include "RenderableLineEntityItem.h"
|
||||
#include "RenderableModelEntityItem.h"
|
||||
|
@ -44,8 +43,6 @@ enum class RenderItemStatusIcon {
|
|||
NONE = 255
|
||||
};
|
||||
|
||||
std::function<bool()> EntityRenderer::_entitiesShouldFadeFunction = []() { return true; };
|
||||
|
||||
void EntityRenderer::initEntityRenderers() {
|
||||
REGISTER_ENTITY_TYPE_WITH_FACTORY(Model, RenderableModelEntityItem::factory)
|
||||
REGISTER_ENTITY_TYPE_WITH_FACTORY(PolyVox, RenderablePolyVoxEntityItem::factory)
|
||||
|
@ -385,13 +382,13 @@ void EntityRenderer::updateModelTransformAndBound() {
|
|||
void EntityRenderer::doRenderUpdateSynchronous(const ScenePointer& scene, Transaction& transaction, const EntityItemPointer& entity) {
|
||||
DETAILED_PROFILE_RANGE(simulation_physics, __FUNCTION__);
|
||||
withWriteLock([&] {
|
||||
if (isFading()) {
|
||||
auto transparent = isTransparent();
|
||||
auto fading = isFading();
|
||||
if (fading || _prevIsTransparent != transparent) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
|
||||
auto transparent = isTransparent();
|
||||
if (_prevIsTransparent && !transparent) {
|
||||
_isFading = false;
|
||||
if (fading) {
|
||||
_isFading = Interpolate::calculateFadeRatio(_fadeStartTime) < 1.0f;
|
||||
}
|
||||
_prevIsTransparent = transparent;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "EntitiesRendererLogging.h"
|
||||
#include <graphics-scripting/Forward.h>
|
||||
#include <RenderHifi.h>
|
||||
#include "EntityTreeRenderer.h"
|
||||
|
||||
class EntityTreeRenderer;
|
||||
|
||||
|
@ -96,7 +97,7 @@ protected:
|
|||
// Called by the `render` method after `needsRenderUpdate`
|
||||
virtual void doRender(RenderArgs* args) = 0;
|
||||
|
||||
bool isFading() const { return _isFading; }
|
||||
virtual bool isFading() const { return _isFading; }
|
||||
void updateModelTransformAndBound();
|
||||
virtual bool isTransparent() const { return _isFading ? Interpolate::calculateFadeRatio(_fadeStartTime) < 1.0f : false; }
|
||||
inline bool isValidRenderItem() const { return _renderItemID != Item::INVALID_ITEM_ID; }
|
||||
|
@ -121,7 +122,6 @@ protected:
|
|||
|
||||
|
||||
static void makeStatusGetters(const EntityItemPointer& entity, Item::Status::Getters& statusGetters);
|
||||
static std::function<bool()> _entitiesShouldFadeFunction;
|
||||
const Transform& getModelTransform() const;
|
||||
|
||||
Item::Bound _bound;
|
||||
|
@ -131,7 +131,7 @@ protected:
|
|||
ItemIDs _subRenderItemIDs;
|
||||
uint64_t _fadeStartTime{ usecTimestampNow() };
|
||||
uint64_t _updateTime{ usecTimestampNow() }; // used when sorting/throttling render updates
|
||||
bool _isFading{ _entitiesShouldFadeFunction() };
|
||||
bool _isFading { EntityTreeRenderer::getEntitiesShouldFadeFunction()() };
|
||||
bool _prevIsTransparent { false };
|
||||
bool _visible { false };
|
||||
bool _isVisibleInSecondaryCamera { false };
|
||||
|
|
|
@ -146,6 +146,9 @@ public:
|
|||
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) override;
|
||||
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) override;
|
||||
|
||||
// FIXME: model mesh parts should fade individually
|
||||
bool isFading() const override { return false; }
|
||||
|
||||
protected:
|
||||
virtual void removeFromScene(const ScenePointer& scene, Transaction& transaction) override;
|
||||
virtual void onRemoveFromSceneTyped(const TypedEntityPointer& entity) override;
|
||||
|
|
Loading…
Reference in a new issue