Showing the changes to libraries/script-engine/src/SpatialEvent.cpp (1 of 5 files). Show all
Unified · Split
| @@ -0,0 +1,46 @@ | ||
| 1 | +// | |
| 2 | +// SpatialEvent.cpp | |
| 3 | +// script-engine/src | |
| 4 | +// | |
| 5 | +// Created by Stephen Birarda on 2014-10-27. | |
| 6 | +// Copyright 2014 High Fidelity, Inc. | |
| 7 | +// | |
| 8 | +// Distributed under the Apache License, Version 2.0. | |
| 9 | +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | |
| 10 | +// | |
| 11 | + | |
| 12 | +#include <RegisteredMetaTypes.h> | |
| 13 | + | |
| 14 | +#include "SpatialEvent.h" | |
| 15 | + | |
| 16 | +SpatialEvent::SpatialEvent() : | |
| 17 | + locTranslation(0.0f), | |
| 18 | + locRotation(), | |
| 19 | + absTranslation(0.0f), | |
| 20 | + absRotation() | |
| 21 | +{ | |
| 22 | + | |
| 23 | +} | |
| 24 | + | |
| 25 | +SpatialEvent::SpatialEvent(const SpatialEvent& event) { | |
| 26 | + locTranslation = event.locTranslation; | |
| 27 | + locRotation = event.locRotation; | |
| 28 | + absTranslation = event.absTranslation; | |
| 29 | + absRotation = event.absRotation; | |
| 30 | +} | |
| 31 | + | |
| 32 | + | |
| 33 | +QScriptValue SpatialEvent::toScriptValue(QScriptEngine* engine, const SpatialEvent& event) { | |
| 34 | + QScriptValue obj = engine->newObject(); | |
| 35 | + | |
| 36 | + obj.setProperty("locTranslation", vec3toScriptValue(engine, event.locTranslation) ); | |
| 37 | + obj.setProperty("locRotation", quatToScriptValue(engine, event.locRotation) ); | |
| 38 | + obj.setProperty("absTranslation", vec3toScriptValue(engine, event.absTranslation) ); | |
| 39 | + obj.setProperty("absRotation", quatToScriptValue(engine, event.absRotation) ); | |
| 40 | + | |
| 41 | + return obj; | |
| 42 | +} | |
| 43 | + | |
| 44 | +void SpatialEvent::fromScriptValue(const QScriptValue& object,SpatialEvent& event) { | |
| 45 | + // nothing for now... | |
| 46 | +} | |