mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi
This commit is contained in:
commit
67d24408cf
14 changed files with 68 additions and 64 deletions
|
@ -163,10 +163,18 @@ TextField {
|
|||
text: textField.label
|
||||
colorScheme: textField.colorScheme
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
Binding on anchors.right {
|
||||
when: parent.right
|
||||
value: parent.right
|
||||
}
|
||||
Binding on wrapMode {
|
||||
when: parent.right
|
||||
value: Text.WordWrap
|
||||
}
|
||||
|
||||
anchors.bottom: parent.top
|
||||
anchors.bottomMargin: 3
|
||||
wrapMode: Text.WordWrap
|
||||
visible: label != ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4632,12 +4632,6 @@ void Application::idle() {
|
|||
|
||||
_overlayConductor.update(secondsSinceLastUpdate);
|
||||
|
||||
auto myAvatar = getMyAvatar();
|
||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
|
||||
cameraMenuChanged();
|
||||
}
|
||||
_gameLoopCounter.increment();
|
||||
}
|
||||
|
||||
|
@ -5184,6 +5178,21 @@ void Application::cameraModeChanged() {
|
|||
cameraMenuChanged();
|
||||
}
|
||||
|
||||
void Application::changeViewAsNeeded(float boomLength) {
|
||||
// Switch between first and third person views as needed
|
||||
// This is called when the boom length has changed
|
||||
bool boomLengthGreaterThanMinimum = (boomLength > MyAvatar::ZOOM_MIN);
|
||||
|
||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON && boomLengthGreaterThanMinimum) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, false);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, true);
|
||||
cameraMenuChanged();
|
||||
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON && !boomLengthGreaterThanMinimum) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, true);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, false);
|
||||
cameraMenuChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::cameraMenuChanged() {
|
||||
auto menu = Menu::getInstance();
|
||||
|
|
|
@ -417,6 +417,8 @@ public slots:
|
|||
|
||||
void updateVerboseLogging();
|
||||
|
||||
void changeViewAsNeeded(float boomLength);
|
||||
|
||||
private slots:
|
||||
void onDesktopRootItemCreated(QQuickItem* qmlContext);
|
||||
void onDesktopRootContextCreated(QQmlContext* qmlContext);
|
||||
|
|
|
@ -2245,9 +2245,15 @@ void MyAvatar::updateActionMotor(float deltaTime) {
|
|||
_actionMotorVelocity = getSensorToWorldScale() * (_walkSpeed.get() * _walkSpeedScalar) * direction;
|
||||
}
|
||||
|
||||
float previousBoomLength = _boomLength;
|
||||
float boomChange = getDriveKey(ZOOM);
|
||||
_boomLength += 2.0f * _boomLength * boomChange + boomChange * boomChange;
|
||||
_boomLength = glm::clamp<float>(_boomLength, ZOOM_MIN, ZOOM_MAX);
|
||||
|
||||
// May need to change view if boom length has changed
|
||||
if (previousBoomLength != _boomLength) {
|
||||
qApp->changeViewAsNeeded(_boomLength);
|
||||
}
|
||||
}
|
||||
|
||||
void MyAvatar::updatePosition(float deltaTime) {
|
||||
|
|
|
@ -46,6 +46,13 @@ bool Billboard3DOverlay::applyTransformTo(Transform& transform, bool force) {
|
|||
return transformChanged;
|
||||
}
|
||||
|
||||
void Billboard3DOverlay::update(float duration) {
|
||||
if (isFacingAvatar()) {
|
||||
_renderVariableDirty = true;
|
||||
}
|
||||
Parent::update(duration);
|
||||
}
|
||||
|
||||
Transform Billboard3DOverlay::evalRenderTransform() {
|
||||
Transform transform = getTransform();
|
||||
bool transformChanged = applyTransformTo(transform, true);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
class Billboard3DOverlay : public Planar3DOverlay, public PanelAttachable, public Billboardable {
|
||||
Q_OBJECT
|
||||
using Parent = Planar3DOverlay;
|
||||
|
||||
public:
|
||||
Billboard3DOverlay() {}
|
||||
|
@ -26,6 +27,8 @@ public:
|
|||
void setProperties(const QVariantMap& properties) override;
|
||||
QVariant getProperty(const QString& property) override;
|
||||
|
||||
void update(float duration) override;
|
||||
|
||||
protected:
|
||||
virtual bool applyTransformTo(Transform& transform, bool force = false) override;
|
||||
|
||||
|
|
|
@ -51,11 +51,6 @@ void Image3DOverlay::update(float deltatime) {
|
|||
_texture = DependencyManager::get<TextureCache>()->getTexture(_url);
|
||||
_textureIsLoaded = false;
|
||||
}
|
||||
if (usecTimestampNow() > _transformExpiry) {
|
||||
Transform transform = getTransform();
|
||||
applyTransformTo(transform);
|
||||
setTransform(transform);
|
||||
}
|
||||
Parent::update(deltatime);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,15 +83,6 @@ xColor Text3DOverlay::getBackgroundColor() {
|
|||
return result;
|
||||
}
|
||||
|
||||
void Text3DOverlay::update(float deltatime) {
|
||||
if (usecTimestampNow() > _transformExpiry) {
|
||||
Transform transform = getTransform();
|
||||
applyTransformTo(transform);
|
||||
setTransform(transform);
|
||||
}
|
||||
Parent::update(deltatime);
|
||||
}
|
||||
|
||||
void Text3DOverlay::render(RenderArgs* args) {
|
||||
if (!_renderVisible || !getParentVisible()) {
|
||||
return; // do nothing if we're not visible
|
||||
|
@ -306,13 +297,4 @@ QSizeF Text3DOverlay::textSize(const QString& text) const {
|
|||
float pointToWorldScale = (maxHeight / FIXED_FONT_SCALING_RATIO) * _lineHeight;
|
||||
|
||||
return QSizeF(extents.x, extents.y) * pointToWorldScale;
|
||||
}
|
||||
|
||||
bool Text3DOverlay::findRayIntersection(const glm::vec3 &origin, const glm::vec3 &direction, float &distance,
|
||||
BoxFace &face, glm::vec3& surfaceNormal) {
|
||||
Transform transform = getTransform();
|
||||
applyTransformTo(transform, true);
|
||||
setTransform(transform);
|
||||
return Billboard3DOverlay::findRayIntersection(origin, direction, distance, face, surfaceNormal);
|
||||
}
|
||||
|
||||
}
|
|
@ -30,8 +30,6 @@ public:
|
|||
~Text3DOverlay();
|
||||
virtual void render(RenderArgs* args) override;
|
||||
|
||||
virtual void update(float deltatime) override;
|
||||
|
||||
virtual const render::ShapeKey getShapeKey() override;
|
||||
|
||||
// getters
|
||||
|
@ -60,9 +58,6 @@ public:
|
|||
|
||||
QSizeF textSize(const QString& test) const; // Meters
|
||||
|
||||
virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance,
|
||||
BoxFace& face, glm::vec3& surfaceNormal) override;
|
||||
|
||||
virtual Text3DOverlay* createClone() const override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -259,7 +259,6 @@ void Web3DOverlay::setupQmlSurface() {
|
|||
_webSurface->getSurfaceContext()->setContextProperty("Web3DOverlay", this);
|
||||
_webSurface->getSurfaceContext()->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());
|
||||
_webSurface->getSurfaceContext()->setContextProperty("Reticle", qApp->getApplicationCompositor().getReticleInterface());
|
||||
_webSurface->getSurfaceContext()->setContextProperty("desktop", DependencyManager::get<OffscreenUi>()->getDesktop());
|
||||
_webSurface->getSurfaceContext()->setContextProperty("HiFiAbout", AboutUtil::getInstance());
|
||||
|
||||
// Override min fps for tablet UI, for silky smooth scrolling
|
||||
|
|
|
@ -1174,7 +1174,7 @@ bool GLTFReader::addArrayOfType(const QByteArray& bin, int byteOffset, int byteL
|
|||
break;
|
||||
}
|
||||
case GLTFAccessorComponentType::UNSIGNED_INT: {
|
||||
readArray<quint8>(bin, byteOffset, byteLength, outarray, accessorType);
|
||||
readArray<quint32>(bin, byteOffset, byteLength, outarray, accessorType);
|
||||
break;
|
||||
}
|
||||
case GLTFAccessorComponentType::UNSIGNED_SHORT: {
|
||||
|
|
|
@ -190,7 +190,7 @@ namespace GLTFBufferViewTarget {
|
|||
struct GLTFBufferView {
|
||||
int buffer; //required
|
||||
int byteLength; //required
|
||||
int byteOffset;
|
||||
int byteOffset { 0 };
|
||||
int target;
|
||||
QMap<QString, bool> defined;
|
||||
void dump() {
|
||||
|
@ -470,7 +470,7 @@ namespace GLTFAccessorComponentType {
|
|||
}
|
||||
struct GLTFAccessor {
|
||||
int bufferView;
|
||||
int byteOffset;
|
||||
int byteOffset { 0 };
|
||||
int componentType; //required
|
||||
int count; //required
|
||||
int type; //required
|
||||
|
|
|
@ -171,4 +171,25 @@
|
|||
Messages.subscribe(HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL);
|
||||
Messages.messageReceived.connect(handleMessage);
|
||||
|
||||
function initializeControls() {
|
||||
if(HMD.active) {
|
||||
if (Controller.Hardware.Vive !== undefined || Controller.Hardware.OculusTouch !== undefined) {
|
||||
if (MyAvatar.useAdvancedMovementControls) {
|
||||
Controller.disableMapping(DRIVING_MAPPING_NAME);
|
||||
} else {
|
||||
Controller.enableMapping(DRIVING_MAPPING_NAME);
|
||||
}
|
||||
|
||||
if (MyAvatar.getFlyingEnabled()) {
|
||||
Controller.disableMapping(FLYING_MAPPING_NAME);
|
||||
} else {
|
||||
Controller.enableMapping(FLYING_MAPPING_NAME);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
initializeControls();
|
||||
|
||||
}()); // END LOCAL_SCOPE
|
||||
|
|
|
@ -1036,29 +1036,6 @@ SelectionDisplay = (function() {
|
|||
}
|
||||
};
|
||||
|
||||
// FUNCTION: TOGGLE SPACE MODE
|
||||
that.toggleSpaceMode = function() {
|
||||
var wantDebug = false;
|
||||
if (wantDebug) {
|
||||
print("========> ToggleSpaceMode called. =========");
|
||||
}
|
||||
if ((spaceMode === SPACE_WORLD) && (SelectionManager.selections.length > 1)) {
|
||||
if (wantDebug) {
|
||||
print("Local space editing is not available with multiple selections");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (wantDebug) {
|
||||
print("PreToggle: " + spaceMode);
|
||||
}
|
||||
spaceMode = (spaceMode === SPACE_LOCAL) ? SPACE_WORLD : SPACE_LOCAL;
|
||||
that.updateHandles();
|
||||
if (wantDebug) {
|
||||
print("PostToggle: " + spaceMode);
|
||||
print("======== ToggleSpaceMode called. <=========");
|
||||
}
|
||||
};
|
||||
|
||||
function addHandleTool(overlay, tool) {
|
||||
handleTools[overlay] = tool;
|
||||
return tool;
|
||||
|
|
Loading…
Reference in a new issue