void ShapeEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) { withWriteLock([&] { auto userData = entity->getUserData(); if (_lastUserData != userData) { _lastUserData = userData; _procedural.setProceduralData(ProceduralData::parse(_lastUserData)); } _shape = entity->getShape(); _pulseProperties = entity->getPulseProperties(); }); void* key = (void*)this; AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this] () { withWriteLock([&] { auto entity = getEntity(); _position = entity->getWorldPosition(); _dimensions = entity->getUnscaledDimensions(); // get unscaled to avoid scaling twice _orientation = entity->getWorldOrientation(); updateModelTransformAndBound(); _renderTransform = getModelTransform(); // contains parent scale, if this entity scales with its parent if (_shape == entity::Sphere) { _renderTransform.postScale(SPHERE_ENTITY_SCALE); } _renderTransform.postScale(_dimensions); });; }); }
bool ShapeEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const { if (_lastUserData != entity->getUserData()) { return true; } if (_color != entity->getColor()) { return true; } if (_alpha != entity->getAlpha()) { return true; } if (_shape != entity->getShape()) { return true; } if (_dimensions != entity->getScaledDimensions()) { return true; } if (_pulseProperties != entity->getPulseProperties()) { return true; } return false; }
bool GridEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const { bool needsUpdate = resultWithReadLock<bool>([&] { if (_color != entity->getColor()) { return true; } if (_alpha != entity->getAlpha()) { return true; } if (_followCamera != entity->getFollowCamera()) { return true; } if (_majorGridEvery != entity->getMajorGridEvery()) { return true; } if (_minorGridEvery != entity->getMinorGridEvery()) { return true; } if (_pulseProperties != entity->getPulseProperties()) { return true; } return false; }); return needsUpdate; }
void GridEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) { withWriteLock([&] { _color = entity->getColor(); _alpha = entity->getAlpha(); _pulseProperties = entity->getPulseProperties(); _followCamera = entity->getFollowCamera(); _majorGridEvery = entity->getMajorGridEvery(); _minorGridEvery = entity->getMinorGridEvery(); }); void* key = (void*)this; AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this, entity]() { withWriteLock([&] { _dimensions = entity->getScaledDimensions(); updateModelTransformAndBound(); _renderTransform = getModelTransform(); }); }); }