mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 15:47:02 +02:00
load tablet overlay models with higher priority
This commit is contained in:
parent
aeaa95b7a0
commit
15661987be
5 changed files with 16 additions and 1 deletions
|
@ -22,6 +22,7 @@ ModelOverlay::ModelOverlay()
|
||||||
_modelTextures(QVariantMap())
|
_modelTextures(QVariantMap())
|
||||||
{
|
{
|
||||||
_model->init();
|
_model->init();
|
||||||
|
_model->setLoadingPriority(_loadPriority);
|
||||||
_isLoaded = false;
|
_isLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,9 +31,11 @@ ModelOverlay::ModelOverlay(const ModelOverlay* modelOverlay) :
|
||||||
_model(std::make_shared<Model>(std::make_shared<Rig>(), nullptr, this)),
|
_model(std::make_shared<Model>(std::make_shared<Rig>(), nullptr, this)),
|
||||||
_modelTextures(QVariantMap()),
|
_modelTextures(QVariantMap()),
|
||||||
_url(modelOverlay->_url),
|
_url(modelOverlay->_url),
|
||||||
_updateModel(false)
|
_updateModel(false),
|
||||||
|
_loadPriority(modelOverlay->getLoadPriority())
|
||||||
{
|
{
|
||||||
_model->init();
|
_model->init();
|
||||||
|
_model->setLoadingPriority(_loadPriority);
|
||||||
if (_url.isValid()) {
|
if (_url.isValid()) {
|
||||||
_updateModel = true;
|
_updateModel = true;
|
||||||
_isLoaded = false;
|
_isLoaded = false;
|
||||||
|
@ -113,6 +116,12 @@ void ModelOverlay::setProperties(const QVariantMap& properties) {
|
||||||
_updateModel = true;
|
_updateModel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto loadPriorityProperty = properties["loadPriority"];
|
||||||
|
if (loadPriorityProperty.isValid()) {
|
||||||
|
_loadPriority = loadPriorityProperty.toFloat();
|
||||||
|
_model->setLoadingPriority(_loadPriority);
|
||||||
|
}
|
||||||
|
|
||||||
auto urlValue = properties["url"];
|
auto urlValue = properties["url"];
|
||||||
if (urlValue.isValid() && urlValue.canConvert<QString>()) {
|
if (urlValue.isValid() && urlValue.canConvert<QString>()) {
|
||||||
_url = urlValue.toString();
|
_url = urlValue.toString();
|
||||||
|
|
|
@ -41,6 +41,8 @@ public:
|
||||||
|
|
||||||
void locationChanged(bool tellPhysics) override;
|
void locationChanged(bool tellPhysics) override;
|
||||||
|
|
||||||
|
float getLoadPriority() const { return _loadPriority; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ModelPointer _model;
|
ModelPointer _model;
|
||||||
|
@ -49,6 +51,7 @@ private:
|
||||||
QUrl _url;
|
QUrl _url;
|
||||||
bool _updateModel = { false };
|
bool _updateModel = { false };
|
||||||
bool _scaleToFit = { false };
|
bool _scaleToFit = { false };
|
||||||
|
float _loadPriority { 0.0f };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_ModelOverlay_h
|
#endif // hifi_ModelOverlay_h
|
||||||
|
|
|
@ -1336,6 +1336,7 @@ function MyController(hand) {
|
||||||
var stylusProperties = {
|
var stylusProperties = {
|
||||||
name: "stylus",
|
name: "stylus",
|
||||||
url: Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx",
|
url: Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx",
|
||||||
|
loadPriority: 10.0,
|
||||||
localPosition: Vec3.sum({ x: 0.0,
|
localPosition: Vec3.sum({ x: 0.0,
|
||||||
y: WEB_TOUCH_Y_OFFSET,
|
y: WEB_TOUCH_Y_OFFSET,
|
||||||
z: 0.0 },
|
z: 0.0 },
|
||||||
|
|
|
@ -120,6 +120,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
||||||
modelURL: modelURL,
|
modelURL: modelURL,
|
||||||
url: modelURL, // for overlay
|
url: modelURL, // for overlay
|
||||||
grabbable: true, // for overlay
|
grabbable: true, // for overlay
|
||||||
|
loadPriority: 10.0, // for overlay
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
"grabbableKey": {"grabbable": true}
|
"grabbableKey": {"grabbable": true}
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -219,6 +219,7 @@
|
||||||
var tmpStylusID = Overlays.addOverlay("model", {
|
var tmpStylusID = Overlays.addOverlay("model", {
|
||||||
name: "stylus",
|
name: "stylus",
|
||||||
url: Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx",
|
url: Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx",
|
||||||
|
loadPriority: 10.0,
|
||||||
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, {x: 0, y: 0.1, z: -2})),
|
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, {x: 0, y: 0.1, z: -2})),
|
||||||
dimensions: { x: 0.01, y: 0.01, z: 0.2 },
|
dimensions: { x: 0.01, y: 0.01, z: 0.2 },
|
||||||
solid: true,
|
solid: true,
|
||||||
|
|
Loading…
Reference in a new issue