mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 10:17:40 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into hdr
This commit is contained in:
commit
5ad66a17ee
3 changed files with 57 additions and 0 deletions
|
@ -1138,10 +1138,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
static int SEND_STATS_INTERVAL_MS = 10000;
|
static int SEND_STATS_INTERVAL_MS = 10000;
|
||||||
static int NEARBY_AVATAR_RADIUS_METERS = 10;
|
static int NEARBY_AVATAR_RADIUS_METERS = 10;
|
||||||
|
|
||||||
|
static glm::vec3 lastAvatarPosition = getMyAvatar()->getPosition();
|
||||||
|
static glm::mat4 lastHMDHeadPose = getHMDSensorPose();
|
||||||
|
static controller::Pose lastLeftHandPose = getMyAvatar()->getLeftHandPose();
|
||||||
|
static controller::Pose lastRightHandPose = getMyAvatar()->getRightHandPose();
|
||||||
|
|
||||||
// Periodically send fps as a user activity event
|
// Periodically send fps as a user activity event
|
||||||
QTimer* sendStatsTimer = new QTimer(this);
|
QTimer* sendStatsTimer = new QTimer(this);
|
||||||
sendStatsTimer->setInterval(SEND_STATS_INTERVAL_MS);
|
sendStatsTimer->setInterval(SEND_STATS_INTERVAL_MS);
|
||||||
connect(sendStatsTimer, &QTimer::timeout, this, [this]() {
|
connect(sendStatsTimer, &QTimer::timeout, this, [this]() {
|
||||||
|
|
||||||
QJsonObject properties = {};
|
QJsonObject properties = {};
|
||||||
MemoryInfo memInfo;
|
MemoryInfo memInfo;
|
||||||
if (getMemoryInfo(memInfo)) {
|
if (getMemoryInfo(memInfo)) {
|
||||||
|
@ -1183,6 +1189,31 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
|
|
||||||
properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false;
|
properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false;
|
||||||
|
|
||||||
|
glm::vec3 avatarPosition = getMyAvatar()->getPosition();
|
||||||
|
properties["avatar_has_moved"] = lastAvatarPosition != avatarPosition;
|
||||||
|
lastAvatarPosition = avatarPosition;
|
||||||
|
|
||||||
|
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
||||||
|
auto entityActivityTracking = entityScriptingInterface->getActivityTracking();
|
||||||
|
entityScriptingInterface->resetActivityTracking();
|
||||||
|
properties["added_entity_cnt"] = entityActivityTracking.addedEntityCount;
|
||||||
|
properties["deleted_entity_cnt"] = entityActivityTracking.deletedEntityCount;
|
||||||
|
properties["edited_entity_cnt"] = entityActivityTracking.editedEntityCount;
|
||||||
|
|
||||||
|
auto hmdHeadPose = getHMDSensorPose();
|
||||||
|
properties["hmd_head_pose_changed"] = isHMDMode() && (hmdHeadPose != lastHMDHeadPose);
|
||||||
|
lastHMDHeadPose = hmdHeadPose;
|
||||||
|
|
||||||
|
auto leftHandPose = getMyAvatar()->getLeftHandPose();
|
||||||
|
auto rightHandPose = getMyAvatar()->getRightHandPose();
|
||||||
|
// controller::Pose considers two poses to be different if either are invalid. In our case, we actually
|
||||||
|
// want to consider the pose to be unchanged if it was invalid and still is invalid, so we check that first.
|
||||||
|
properties["hand_pose_changed"] =
|
||||||
|
((leftHandPose.valid || lastLeftHandPose.valid) && (leftHandPose != lastLeftHandPose))
|
||||||
|
|| ((rightHandPose.valid || lastRightHandPose.valid) && (rightHandPose != lastRightHandPose));
|
||||||
|
lastLeftHandPose = leftHandPose;
|
||||||
|
lastRightHandPose = rightHandPose;
|
||||||
|
|
||||||
UserActivityLogger::getInstance().logAction("stats", properties);
|
UserActivityLogger::getInstance().logAction("stats", properties);
|
||||||
});
|
});
|
||||||
sendStatsTimer->start();
|
sendStatsTimer->start();
|
||||||
|
|
|
@ -40,6 +40,12 @@ void EntityScriptingInterface::queueEntityMessage(PacketType packetType,
|
||||||
getEntityPacketSender()->queueEditEntityMessage(packetType, _entityTree, entityID, properties);
|
getEntityPacketSender()->queueEditEntityMessage(packetType, _entityTree, entityID, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityScriptingInterface::resetActivityTracking() {
|
||||||
|
_activityTracking.addedEntityCount = 0;
|
||||||
|
_activityTracking.deletedEntityCount = 0;
|
||||||
|
_activityTracking.editedEntityCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool EntityScriptingInterface::canAdjustLocks() {
|
bool EntityScriptingInterface::canAdjustLocks() {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
return nodeList->isAllowedEditor();
|
return nodeList->isAllowedEditor();
|
||||||
|
@ -162,6 +168,8 @@ EntityItemProperties convertLocationFromScriptSemantics(const EntityItemProperti
|
||||||
|
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, bool clientOnly) {
|
QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, bool clientOnly) {
|
||||||
|
_activityTracking.addedEntityCount++;
|
||||||
|
|
||||||
EntityItemProperties propertiesWithSimID = convertLocationFromScriptSemantics(properties);
|
EntityItemProperties propertiesWithSimID = convertLocationFromScriptSemantics(properties);
|
||||||
propertiesWithSimID.setDimensionsInitialized(properties.dimensionsChanged());
|
propertiesWithSimID.setDimensionsInitialized(properties.dimensionsChanged());
|
||||||
|
|
||||||
|
@ -232,6 +240,8 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::addModelEntity(const QString& name, const QString& modelUrl, const QString& shapeType,
|
QUuid EntityScriptingInterface::addModelEntity(const QString& name, const QString& modelUrl, const QString& shapeType,
|
||||||
bool dynamic, const glm::vec3& position, const glm::vec3& gravity) {
|
bool dynamic, const glm::vec3& position, const glm::vec3& gravity) {
|
||||||
|
_activityTracking.addedEntityCount++;
|
||||||
|
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
properties.setType(EntityTypes::Model);
|
properties.setType(EntityTypes::Model);
|
||||||
properties.setName(name);
|
properties.setName(name);
|
||||||
|
@ -295,6 +305,8 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) {
|
QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) {
|
||||||
|
_activityTracking.editedEntityCount++;
|
||||||
|
|
||||||
EntityItemProperties properties = scriptSideProperties;
|
EntityItemProperties properties = scriptSideProperties;
|
||||||
|
|
||||||
auto dimensions = properties.getDimensions();
|
auto dimensions = properties.getDimensions();
|
||||||
|
@ -438,6 +450,8 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityScriptingInterface::deleteEntity(QUuid id) {
|
void EntityScriptingInterface::deleteEntity(QUuid id) {
|
||||||
|
_activityTracking.deletedEntityCount++;
|
||||||
|
|
||||||
EntityItemID entityID(id);
|
EntityItemID entityID(id);
|
||||||
bool shouldDelete = true;
|
bool shouldDelete = true;
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,13 @@ class EntityScriptingInterface : public OctreeScriptingInterface, public Depende
|
||||||
public:
|
public:
|
||||||
EntityScriptingInterface(bool bidOnSimulationOwnership);
|
EntityScriptingInterface(bool bidOnSimulationOwnership);
|
||||||
|
|
||||||
|
class ActivityTracking {
|
||||||
|
public:
|
||||||
|
int addedEntityCount { 0 };
|
||||||
|
int deletedEntityCount { 0 };
|
||||||
|
int editedEntityCount { 0 };
|
||||||
|
};
|
||||||
|
|
||||||
EntityEditPacketSender* getEntityPacketSender() const { return (EntityEditPacketSender*)getPacketSender(); }
|
EntityEditPacketSender* getEntityPacketSender() const { return (EntityEditPacketSender*)getPacketSender(); }
|
||||||
virtual NodeType_t getServerNodeType() const { return NodeType::EntityServer; }
|
virtual NodeType_t getServerNodeType() const { return NodeType::EntityServer; }
|
||||||
virtual OctreeEditPacketSender* createPacketSender() { return new EntityEditPacketSender(); }
|
virtual OctreeEditPacketSender* createPacketSender() { return new EntityEditPacketSender(); }
|
||||||
|
@ -73,6 +80,9 @@ public:
|
||||||
EntityTreePointer getEntityTree() { return _entityTree; }
|
EntityTreePointer getEntityTree() { return _entityTree; }
|
||||||
void setEntitiesScriptEngine(EntitiesScriptEngineProvider* engine);
|
void setEntitiesScriptEngine(EntitiesScriptEngineProvider* engine);
|
||||||
float calculateCost(float mass, float oldVelocity, float newVelocity);
|
float calculateCost(float mass, float oldVelocity, float newVelocity);
|
||||||
|
|
||||||
|
void resetActivityTracking();
|
||||||
|
ActivityTracking getActivityTracking() const { return _activityTracking; }
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
// returns true if the DomainServer will allow this Node/Avatar to make changes
|
// returns true if the DomainServer will allow this Node/Avatar to make changes
|
||||||
|
@ -226,6 +236,8 @@ private:
|
||||||
float _currentAvatarEnergy = { FLT_MAX };
|
float _currentAvatarEnergy = { FLT_MAX };
|
||||||
float getCurrentAvatarEnergy() { return _currentAvatarEnergy; }
|
float getCurrentAvatarEnergy() { return _currentAvatarEnergy; }
|
||||||
void setCurrentAvatarEnergy(float energy);
|
void setCurrentAvatarEnergy(float energy);
|
||||||
|
|
||||||
|
ActivityTracking _activityTracking;
|
||||||
|
|
||||||
float costMultiplier = { 0.01f };
|
float costMultiplier = { 0.01f };
|
||||||
float getCostMultiplier();
|
float getCostMultiplier();
|
||||||
|
|
Loading…
Reference in a new issue