mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 12:18:36 +02:00
switch to QRect instead of vec4
This commit is contained in:
parent
6b5fd1e807
commit
8f3d48190a
12 changed files with 39 additions and 37 deletions
|
@ -361,7 +361,7 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit
|
||||||
}
|
}
|
||||||
|
|
||||||
var recommendedRect = Controller.getRecommendedOverlayRect();
|
var recommendedRect = Controller.getRecommendedOverlayRect();
|
||||||
var recommendedDimmensions = { x: recommendedRect.z - recommendedRect.x, y: recommendedRect.w - recommendedRect.y };
|
var recommendedDimmensions = { x: recommendedRect.width, y: recommendedRect.height };
|
||||||
that.windowDimensions = recommendedDimmensions; // Controller.getViewportDimensions();
|
that.windowDimensions = recommendedDimmensions; // Controller.getViewportDimensions();
|
||||||
that.origin = { x: recommendedRect.x, y: recommendedRect.y };
|
that.origin = { x: recommendedRect.x, y: recommendedRect.y };
|
||||||
// Maybe fixme: Keeping the same percent of the window size isn't always the right thing.
|
// Maybe fixme: Keeping the same percent of the window size isn't always the right thing.
|
||||||
|
@ -369,7 +369,7 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit
|
||||||
// If we change that, the places to do so are onResizeViewport, save (maybe), and the initial move based on Settings, below.
|
// If we change that, the places to do so are onResizeViewport, save (maybe), and the initial move based on Settings, below.
|
||||||
that.onResizeViewport = function (newSize) { // Can be overridden or extended by clients.
|
that.onResizeViewport = function (newSize) { // Can be overridden or extended by clients.
|
||||||
var recommendedRect = Controller.getRecommendedOverlayRect();
|
var recommendedRect = Controller.getRecommendedOverlayRect();
|
||||||
var recommendedDimmensions = { x: recommendedRect.z - recommendedRect.x, y: recommendedRect.w - recommendedRect.y };
|
var recommendedDimmensions = { x: recommendedRect.width, y: recommendedRect.height };
|
||||||
var originRelativeX = (that.x - that.origin.x);
|
var originRelativeX = (that.x - that.origin.x);
|
||||||
var originRelativeY = (that.y - that.origin.y);
|
var originRelativeY = (that.y - that.origin.y);
|
||||||
var fractionX = clamp(originRelativeX / that.windowDimensions.x, 0, 1);
|
var fractionX = clamp(originRelativeX / that.windowDimensions.x, 0, 1);
|
||||||
|
@ -384,7 +384,7 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit
|
||||||
this.fractionKey = optionalPersistenceKey + '.fraction';
|
this.fractionKey = optionalPersistenceKey + '.fraction';
|
||||||
this.save = function () {
|
this.save = function () {
|
||||||
var recommendedRect = Controller.getRecommendedOverlayRect();
|
var recommendedRect = Controller.getRecommendedOverlayRect();
|
||||||
var screenSize = { x: recommendedRect.z - recommendedRect.x, y: recommendedRect.w - recommendedRect.y };
|
var screenSize = { x: recommendedRect.width, y: recommendedRect.height };
|
||||||
if (screenSize.x > 0 && screenSize.y > 0) {
|
if (screenSize.x > 0 && screenSize.y > 0) {
|
||||||
// Guard against invalid screen size that can occur at shut-down.
|
// Guard against invalid screen size that can occur at shut-down.
|
||||||
var fraction = {x: that.x / screenSize.x, y: that.y / screenSize.y};
|
var fraction = {x: that.x / screenSize.x, y: that.y / screenSize.y};
|
||||||
|
@ -428,7 +428,7 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit
|
||||||
};
|
};
|
||||||
that.checkResize = function () { // Can be overriden or extended, but usually not. See onResizeViewport.
|
that.checkResize = function () { // Can be overriden or extended, but usually not. See onResizeViewport.
|
||||||
var recommendedRect = Controller.getRecommendedOverlayRect();
|
var recommendedRect = Controller.getRecommendedOverlayRect();
|
||||||
var currentWindowSize = { x: recommendedRect.z - recommendedRect.x, y: recommendedRect.w - recommendedRect.y };
|
var currentWindowSize = { x: recommendedRect.width, y: recommendedRect.height };
|
||||||
|
|
||||||
if ((currentWindowSize.x !== that.windowDimensions.x) || (currentWindowSize.y !== that.windowDimensions.y)) {
|
if ((currentWindowSize.x !== that.windowDimensions.x) || (currentWindowSize.y !== that.windowDimensions.y)) {
|
||||||
that.onResizeViewport(currentWindowSize);
|
that.onResizeViewport(currentWindowSize);
|
||||||
|
@ -453,7 +453,7 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit
|
||||||
if (this.fractionKey || optionalInitialPositionFunction) {
|
if (this.fractionKey || optionalInitialPositionFunction) {
|
||||||
var savedFraction = JSON.parse(Settings.getValue(this.fractionKey) || '0'); // getValue can answer empty string
|
var savedFraction = JSON.parse(Settings.getValue(this.fractionKey) || '0'); // getValue can answer empty string
|
||||||
var recommendedRect = Controller.getRecommendedOverlayRect();
|
var recommendedRect = Controller.getRecommendedOverlayRect();
|
||||||
var screenSize = { x: recommendedRect.z - recommendedRect.x, y: recommendedRect.w - recommendedRect.y };
|
var screenSize = { x: recommendedRect.width, y: recommendedRect.height };
|
||||||
if (savedFraction) {
|
if (savedFraction) {
|
||||||
// If we have saved data, keep the toolbar at the same proportion of the screen width/height.
|
// If we have saved data, keep the toolbar at the same proportion of the screen width/height.
|
||||||
that.move(savedFraction.x * screenSize.x, savedFraction.y * screenSize.y);
|
that.move(savedFraction.x * screenSize.x, savedFraction.y * screenSize.y);
|
||||||
|
|
|
@ -56,7 +56,9 @@ FocusScope {
|
||||||
function handleSizeChanged() {
|
function handleSizeChanged() {
|
||||||
var oldRecommendedRect = recommendedRect;
|
var oldRecommendedRect = recommendedRect;
|
||||||
var newRecommendedRectJS = Controller.getRecommendedOverlayRect();
|
var newRecommendedRectJS = Controller.getRecommendedOverlayRect();
|
||||||
var newRecommendedRect = Qt.vector4d(newRecommendedRectJS.x, newRecommendedRectJS.y, newRecommendedRectJS.z, newRecommendedRectJS.w);
|
var newRecommendedRect = Qt.vector4d(newRecommendedRectJS.x, newRecommendedRectJS.y,
|
||||||
|
newRecommendedRectJS.x + newRecommendedRectJS.width,
|
||||||
|
newRecommendedRectJS.y + newRecommendedRectJS.height);
|
||||||
if (oldRecommendedRect != Qt.vector4d(0,0,0,0)
|
if (oldRecommendedRect != Qt.vector4d(0,0,0,0)
|
||||||
&& oldRecommendedRect != newRecommendedRect) {
|
&& oldRecommendedRect != newRecommendedRect) {
|
||||||
d.repositionAll();
|
d.repositionAll();
|
||||||
|
@ -217,7 +219,6 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRepositionChildren(predicate) {
|
function getRepositionChildren(predicate) {
|
||||||
console.log("getRepositionChildren()...");
|
|
||||||
var currentWindows = [];
|
var currentWindows = [];
|
||||||
if (!desktop) {
|
if (!desktop) {
|
||||||
console.log("Could not find desktop");
|
console.log("Could not find desktop");
|
||||||
|
@ -238,7 +239,7 @@ FocusScope {
|
||||||
var oldRecommendedRect = recommendedRect;
|
var oldRecommendedRect = recommendedRect;
|
||||||
var oldRecommendedDimmensions = { x: oldRecommendedRect.z - oldRecommendedRect.x, y: oldRecommendedRect.w - oldRecommendedRect.y };
|
var oldRecommendedDimmensions = { x: oldRecommendedRect.z - oldRecommendedRect.x, y: oldRecommendedRect.w - oldRecommendedRect.y };
|
||||||
var newRecommendedRect = Controller.getRecommendedOverlayRect();
|
var newRecommendedRect = Controller.getRecommendedOverlayRect();
|
||||||
var newRecommendedDimmensions = { x: newRecommendedRect.z - newRecommendedRect.x, y: newRecommendedRect.w - newRecommendedRect.y };
|
var newRecommendedDimmensions = { x: newRecommendedRect.width, y: newRecommendedRect.height };
|
||||||
|
|
||||||
var windows = d.getTopLevelWindows();
|
var windows = d.getTopLevelWindows();
|
||||||
for (var i = 0; i < windows.length; ++i) {
|
for (var i = 0; i < windows.length; ++i) {
|
||||||
|
@ -280,7 +281,7 @@ FocusScope {
|
||||||
var oldRecommendedRect = recommendedRect;
|
var oldRecommendedRect = recommendedRect;
|
||||||
var oldRecommendedDimmensions = { x: oldRecommendedRect.z - oldRecommendedRect.x, y: oldRecommendedRect.w - oldRecommendedRect.y };
|
var oldRecommendedDimmensions = { x: oldRecommendedRect.z - oldRecommendedRect.x, y: oldRecommendedRect.w - oldRecommendedRect.y };
|
||||||
var newRecommendedRect = Controller.getRecommendedOverlayRect();
|
var newRecommendedRect = Controller.getRecommendedOverlayRect();
|
||||||
var newRecommendedDimmensions = { x: newRecommendedRect.z - newRecommendedRect.x, y: newRecommendedRect.w - newRecommendedRect.y };
|
var newRecommendedDimmensions = { x: newRecommendedRect.width, y: newRecommendedRect.height };
|
||||||
repositionWindow(targetWindow, false, oldRecommendedRect, oldRecommendedDimmensions, newRecommendedRect, newRecommendedDimmensions);
|
repositionWindow(targetWindow, false, oldRecommendedRect, oldRecommendedDimmensions, newRecommendedRect, newRecommendedDimmensions);
|
||||||
|
|
||||||
showDesktop();
|
showDesktop();
|
||||||
|
@ -299,11 +300,13 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
var recommended = Controller.getRecommendedOverlayRect();
|
var recommended = Controller.getRecommendedOverlayRect();
|
||||||
|
var maxX = recommended.x + recommended.width;
|
||||||
|
var maxY = recommended.y + recommended.height;
|
||||||
var newPosition = Qt.vector2d(targetWindow.x, targetWindow.y);
|
var newPosition = Qt.vector2d(targetWindow.x, targetWindow.y);
|
||||||
|
|
||||||
// if we asked to force reposition, or if the window is completely outside of the recommended rectangle, reposition it
|
// if we asked to force reposition, or if the window is completely outside of the recommended rectangle, reposition it
|
||||||
if (forceReposition || (targetWindow.x > recommended.z || (targetWindow.x + targetWindow.width) < recommended.x) ||
|
if (forceReposition || (targetWindow.x > maxX || (targetWindow.x + targetWindow.width) < recommended.x) ||
|
||||||
(targetWindow.y > recommended.w || (targetWindow.y + targetWindow.height) < recommended.y)) {
|
(targetWindow.y > maxY || (targetWindow.y + targetWindow.height) < recommended.y)) {
|
||||||
newPosition.x = -1
|
newPosition.x = -1
|
||||||
newPosition.y = -1
|
newPosition.y = -1
|
||||||
}
|
}
|
||||||
|
|
|
@ -4888,8 +4888,9 @@ glm::uvec2 Application::getUiSize() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::uvec4 Application::getRecommendedOverlayRect() const {
|
QRect Application::getRecommendedOverlayRect() const {
|
||||||
glm::uvec4 result(glm::uvec2(0), getUiSize());
|
auto uiSize = getUiSize();
|
||||||
|
QRect result(0, 0, uiSize.x, uiSize.y);
|
||||||
if (_displayPlugin) {
|
if (_displayPlugin) {
|
||||||
result = getActiveDisplayPlugin()->getRecommendedOverlayRect();
|
result = getActiveDisplayPlugin()->getRecommendedOverlayRect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ public:
|
||||||
QRect getRenderingGeometry() const;
|
QRect getRenderingGeometry() const;
|
||||||
|
|
||||||
glm::uvec2 getUiSize() const;
|
glm::uvec2 getUiSize() const;
|
||||||
glm::uvec4 getRecommendedOverlayRect() const;
|
QRect getRecommendedOverlayRect() const;
|
||||||
QSize getDeviceSize() const;
|
QSize getDeviceSize() const;
|
||||||
bool hasFocus() const;
|
bool hasFocus() const;
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ glm::vec2 ControllerScriptingInterface::getViewportDimensions() const {
|
||||||
|
|
||||||
QVariant ControllerScriptingInterface::getRecommendedOverlayRect() const {
|
QVariant ControllerScriptingInterface::getRecommendedOverlayRect() const {
|
||||||
auto rect = qApp->getRecommendedOverlayRect();
|
auto rect = qApp->getRecommendedOverlayRect();
|
||||||
return vec4toVariant(vec4(rect.x, rect.y, rect.z, rect.w));
|
return qRectToVariant(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
controller::InputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) {
|
controller::InputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ static const float reticleSize = TWO_PI / 100.0f;
|
||||||
static QString _tooltipId;
|
static QString _tooltipId;
|
||||||
|
|
||||||
const uvec2 CompositorHelper::VIRTUAL_SCREEN_SIZE = uvec2(3960, 1188); // ~10% more pixel density than old version, 72dx240d FOV
|
const uvec2 CompositorHelper::VIRTUAL_SCREEN_SIZE = uvec2(3960, 1188); // ~10% more pixel density than old version, 72dx240d FOV
|
||||||
const uvec4 CompositorHelper::VIRTUAL_SCREEN_RECOMMENDED_OVERLAY_RECT = uvec4(956, 0, 3004, 1188); // don't include entire width only center 2048
|
const QRect CompositorHelper::VIRTUAL_SCREEN_RECOMMENDED_OVERLAY_RECT = QRect(956, 0, 2048, 1188); // don't include entire width only center 2048
|
||||||
const float CompositorHelper::VIRTUAL_UI_ASPECT_RATIO = (float)VIRTUAL_SCREEN_SIZE.x / (float)VIRTUAL_SCREEN_SIZE.y;
|
const float CompositorHelper::VIRTUAL_UI_ASPECT_RATIO = (float)VIRTUAL_SCREEN_SIZE.x / (float)VIRTUAL_SCREEN_SIZE.y;
|
||||||
const vec2 CompositorHelper::VIRTUAL_UI_TARGET_FOV = vec2(PI * 3.0f / 2.0f, PI * 3.0f / 2.0f / VIRTUAL_UI_ASPECT_RATIO);
|
const vec2 CompositorHelper::VIRTUAL_UI_TARGET_FOV = vec2(PI * 3.0f / 2.0f, PI * 3.0f / 2.0f / VIRTUAL_UI_ASPECT_RATIO);
|
||||||
const vec2 CompositorHelper::MOUSE_EXTENTS_ANGULAR_SIZE = vec2(PI * 2.0f, PI * 0.95f); // horizontal: full sphere, vertical: ~5deg from poles
|
const vec2 CompositorHelper::MOUSE_EXTENTS_ANGULAR_SIZE = vec2(PI * 2.0f, PI * 0.95f); // horizontal: full sphere, vertical: ~5deg from poles
|
||||||
|
|
|
@ -42,7 +42,7 @@ class CompositorHelper : public QObject, public Dependency {
|
||||||
Q_PROPERTY(bool reticleOverDesktop READ getReticleOverDesktop WRITE setReticleOverDesktop)
|
Q_PROPERTY(bool reticleOverDesktop READ getReticleOverDesktop WRITE setReticleOverDesktop)
|
||||||
public:
|
public:
|
||||||
static const uvec2 VIRTUAL_SCREEN_SIZE;
|
static const uvec2 VIRTUAL_SCREEN_SIZE;
|
||||||
static const uvec4 VIRTUAL_SCREEN_RECOMMENDED_OVERLAY_RECT;
|
static const QRect VIRTUAL_SCREEN_RECOMMENDED_OVERLAY_RECT;
|
||||||
static const float VIRTUAL_UI_ASPECT_RATIO;
|
static const float VIRTUAL_UI_ASPECT_RATIO;
|
||||||
static const vec2 VIRTUAL_UI_TARGET_FOV;
|
static const vec2 VIRTUAL_UI_TARGET_FOV;
|
||||||
static const vec2 MOUSE_EXTENTS_ANGULAR_SIZE;
|
static const vec2 MOUSE_EXTENTS_ANGULAR_SIZE;
|
||||||
|
|
|
@ -34,7 +34,7 @@ glm::uvec2 HmdDisplayPlugin::getRecommendedUiSize() const {
|
||||||
return CompositorHelper::VIRTUAL_SCREEN_SIZE;
|
return CompositorHelper::VIRTUAL_SCREEN_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::uvec4 HmdDisplayPlugin::getRecommendedOverlayRect() const {
|
QRect HmdDisplayPlugin::getRecommendedOverlayRect() const {
|
||||||
return CompositorHelper::VIRTUAL_SCREEN_RECOMMENDED_OVERLAY_RECT;
|
return CompositorHelper::VIRTUAL_SCREEN_RECOMMENDED_OVERLAY_RECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
void setEyeRenderPose(uint32_t frameIndex, Eye eye, const glm::mat4& pose) override final;
|
void setEyeRenderPose(uint32_t frameIndex, Eye eye, const glm::mat4& pose) override final;
|
||||||
bool isDisplayVisible() const override { return isHmdMounted(); }
|
bool isDisplayVisible() const override { return isHmdMounted(); }
|
||||||
|
|
||||||
glm::uvec4 getRecommendedOverlayRect() const override final;
|
QRect getRecommendedOverlayRect() const override final;
|
||||||
|
|
||||||
virtual glm::mat4 getHeadPose() const override;
|
virtual glm::mat4 getHeadPose() const override;
|
||||||
|
|
||||||
|
|
|
@ -106,9 +106,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// The recommended bounds for primary overlay placement
|
// The recommended bounds for primary overlay placement
|
||||||
virtual glm::uvec4 getRecommendedOverlayRect() const {
|
virtual QRect getRecommendedOverlayRect() const {
|
||||||
auto recommendedSize = getRecommendedUiSize();
|
auto recommendedSize = getRecommendedUiSize();
|
||||||
return glm::uvec4(0, 0, recommendedSize.x, recommendedSize.y);
|
return QRect(0, 0, recommendedSize.x, recommendedSize.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stereo specific methods
|
// Stereo specific methods
|
||||||
|
|
|
@ -162,7 +162,7 @@ QScriptValue qVectorVec3ToScriptValue(QScriptEngine* engine, const QVector<glm::
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glm::vec3 vec3FromVariant(const QVariant &object, bool& valid) {
|
glm::vec3 vec3FromVariant(const QVariant& object, bool& valid) {
|
||||||
glm::vec3 v;
|
glm::vec3 v;
|
||||||
valid = false;
|
valid = false;
|
||||||
if (!object.isValid() || object.isNull()) {
|
if (!object.isValid() || object.isNull()) {
|
||||||
|
@ -201,30 +201,27 @@ glm::vec3 vec3FromVariant(const QVariant &object, bool& valid) {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 vec3FromVariant(const QVariant &object) {
|
glm::vec3 vec3FromVariant(const QVariant& object) {
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
return vec3FromVariant(object, valid);
|
return vec3FromVariant(object, valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec4 vec4FromVariant(const QVariant &object, bool& valid) {
|
glm::vec4 vec4FromVariant(const QVariant& object, bool& valid) {
|
||||||
glm::vec4 v;
|
glm::vec4 v;
|
||||||
valid = false;
|
valid = false;
|
||||||
if (!object.isValid() || object.isNull()) {
|
if (!object.isValid() || object.isNull()) {
|
||||||
return v;
|
return v;
|
||||||
}
|
} else if (object.canConvert<float>()) {
|
||||||
else if (object.canConvert<float>()) {
|
|
||||||
v = glm::vec4(object.toFloat());
|
v = glm::vec4(object.toFloat());
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
} else if (object.canConvert<QVector4D>()) {
|
||||||
else if (object.canConvert<QVector4D>()) {
|
|
||||||
auto qvec4 = qvariant_cast<QVector4D>(object);
|
auto qvec4 = qvariant_cast<QVector4D>(object);
|
||||||
v.x = qvec4.x();
|
v.x = qvec4.x();
|
||||||
v.y = qvec4.y();
|
v.y = qvec4.y();
|
||||||
v.z = qvec4.z();
|
v.z = qvec4.z();
|
||||||
v.w = qvec4.w();
|
v.w = qvec4.w();
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
auto map = object.toMap();
|
auto map = object.toMap();
|
||||||
auto x = map["x"];
|
auto x = map["x"];
|
||||||
auto y = map["y"];
|
auto y = map["y"];
|
||||||
|
@ -241,12 +238,12 @@ glm::vec4 vec4FromVariant(const QVariant &object, bool& valid) {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec4 vec4FromVariant(const QVariant &object) {
|
glm::vec4 vec4FromVariant(const QVariant& object) {
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
return vec4FromVariant(object, valid);
|
return vec4FromVariant(object, valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue quatToScriptValue(QScriptEngine* engine, const glm::quat &quat) {
|
QScriptValue quatToScriptValue(QScriptEngine* engine, const glm::quat& quat) {
|
||||||
QScriptValue obj = engine->newObject();
|
QScriptValue obj = engine->newObject();
|
||||||
if (quat.x != quat.x || quat.y != quat.y || quat.z != quat.z || quat.w != quat.w) {
|
if (quat.x != quat.x || quat.y != quat.y || quat.z != quat.z || quat.w != quat.w) {
|
||||||
// if quat contains a NaN don't try to convert it
|
// if quat contains a NaN don't try to convert it
|
||||||
|
@ -259,7 +256,7 @@ QScriptValue quatToScriptValue(QScriptEngine* engine, const glm::quat &quat) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void quatFromScriptValue(const QScriptValue &object, glm::quat &quat) {
|
void quatFromScriptValue(const QScriptValue& object, glm::quat &quat) {
|
||||||
quat.x = object.property("x").toVariant().toFloat();
|
quat.x = object.property("x").toVariant().toFloat();
|
||||||
quat.y = object.property("y").toVariant().toFloat();
|
quat.y = object.property("y").toVariant().toFloat();
|
||||||
quat.z = object.property("z").toVariant().toFloat();
|
quat.z = object.property("z").toVariant().toFloat();
|
||||||
|
@ -297,12 +294,12 @@ glm::quat quatFromVariant(const QVariant &object, bool& isValid) {
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat quatFromVariant(const QVariant &object) {
|
glm::quat quatFromVariant(const QVariant& object) {
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
return quatFromVariant(object, valid);
|
return quatFromVariant(object, valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant quatToVariant(const glm::quat &quat) {
|
QVariant quatToVariant(const glm::quat& quat) {
|
||||||
if (quat.x != quat.x || quat.y != quat.y || quat.z != quat.z) {
|
if (quat.x != quat.x || quat.y != quat.y || quat.z != quat.z) {
|
||||||
// if vec3 contains a NaN don't try to convert it
|
// if vec3 contains a NaN don't try to convert it
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
|
@ -74,9 +74,10 @@ glm::quat quatFromVariant(const QVariant &object);
|
||||||
// Rect
|
// Rect
|
||||||
QScriptValue qRectToScriptValue(QScriptEngine* engine, const QRect& rect);
|
QScriptValue qRectToScriptValue(QScriptEngine* engine, const QRect& rect);
|
||||||
void qRectFromScriptValue(const QScriptValue& object, QRect& rect);
|
void qRectFromScriptValue(const QScriptValue& object, QRect& rect);
|
||||||
|
|
||||||
QVariant qRectToVariant(const QRect& rect);
|
|
||||||
QRect qRectFromVariant(const QVariant& object, bool& isValid);
|
QRect qRectFromVariant(const QVariant& object, bool& isValid);
|
||||||
|
QRect qRectFromVariant(const QVariant& object);
|
||||||
|
QVariant qRectToVariant(const QRect& rect);
|
||||||
|
|
||||||
|
|
||||||
// xColor
|
// xColor
|
||||||
QScriptValue xColorToScriptValue(QScriptEngine* engine, const xColor& color);
|
QScriptValue xColorToScriptValue(QScriptEngine* engine, const xColor& color);
|
||||||
|
|
Loading…
Reference in a new issue