3
0
Fork 0
mirror of https://github.com/JulianGro/overte.git synced 2025-04-30 09:43:08 +02:00

Small tweaks to improve code readability.

This commit is contained in:
Zander Otavka 2015-08-07 09:31:21 -07:00
parent a46cc4e1c3
commit f9630942aa
3 changed files with 17 additions and 15 deletions
examples/example/ui
interface/src/ui/overlays

View file

@ -20,8 +20,10 @@ var BLUE_SQUARE_IMAGE_URL = HIFI_PUBLIC_BUCKET + "images/blue-square.svg";
var mainPanel = new OverlayPanel({
positionBinding: { avatar: "MyAvatar" },
rotation: { w: 1, x: 0, y: 0, z: 0 },
position: { x: 0, y: 0, z: 0 },
rotation: { w: 0, x: 0, y: 1, z: 0 },
offsetPosition: { x: 0, y: 0.4, z: 1 },
offsetRotation: { w: 1, x: 0, y: 0, z: 0 },
isFacingAvatar: true
});

View file

@ -52,7 +52,7 @@ void Image3DOverlay::render(RenderArgs* args) {
}
Q_ASSERT(args->_batch);
auto batch = args->_batch;
gpu::Batch* batch = args->_batch;
float imageWidth = _texture->getWidth();
float imageHeight = _texture->getHeight();

View file

@ -23,19 +23,6 @@ bool PanelAttachable::getParentVisible() const {
}
}
void PanelAttachable::applyTransformTo(Transform& transform, bool force) {
if (force || usecTimestampNow() > _transformExpiry) {
const quint64 TRANSFORM_UPDATE_PERIOD = 50000;
_transformExpiry = usecTimestampNow() + TRANSFORM_UPDATE_PERIOD;
if (getParentPanel()) {
getParentPanel()->applyTransformTo(transform, true);
transform.postTranslate(getOffsetPosition());
transform.postRotate(getOffsetRotation());
transform.postScale(getOffsetScale());
}
}
}
QScriptValue PanelAttachable::getProperty(QScriptEngine* scriptEngine, const QString &property) {
if (property == "offsetPosition") {
return vec3toScriptValue(scriptEngine, getOffsetPosition());
@ -84,3 +71,16 @@ void PanelAttachable::setProperties(const QScriptValue &properties) {
}
}
}
void PanelAttachable::applyTransformTo(Transform& transform, bool force) {
if (force || usecTimestampNow() > _transformExpiry) {
const quint64 TRANSFORM_UPDATE_PERIOD = 100000; // frequency is 10 Hz
_transformExpiry = usecTimestampNow() + TRANSFORM_UPDATE_PERIOD;
if (getParentPanel()) {
getParentPanel()->applyTransformTo(transform, true);
transform.postTranslate(getOffsetPosition());
transform.postRotate(getOffsetRotation());
transform.postScale(getOffsetScale());
}
}
}