Overte C++ Documentation
FastScriptValueUtils.h
1 //
2 // FastScriptValueUtils.cpp
3 // libraries/script-engine/src/v8/FastScriptValueUtils.cpp
4 //
5 // Created by dr Karol Suprynowicz on 2023/03/30.
6 // Copyright 2023 Overte e.V.
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 // Contains V8-specific implementations of the function converting Overte datatypes to and from script values.
13 // These are used instead of generic implementations if CONVERSIONS_OPTIMIZED_FOR_V8 is defined.
14 // V8-specific implementations can make script engine several times faster.
15 
16 #ifndef overte_FastScriptValueUtils_h
17 #define overte_FastScriptValueUtils_h
18 
19 #include <glm/glm.hpp>
20 #include <glm/gtc/quaternion.hpp>
21 
22 #include "../ScriptValue.h"
23 
24 #define CONVERSIONS_OPTIMIZED_FOR_V8
25 
26 #ifdef CONVERSIONS_OPTIMIZED_FOR_V8
27 ScriptValue qBytearrayToScriptValue(ScriptEngine* engine, const QByteArray &qByteArray);
28 
29 bool qBytearrayFromScriptValue(const ScriptValue& object, QByteArray &qByteArray);
30 
31 ScriptValue vec3ToScriptValue(ScriptEngine* engine, const glm::vec3& vec3);
32 
33 bool vec3FromScriptValue(const ScriptValue& object, glm::vec3& vec3);
34 #endif
35 
36 #endif // overte_FastScriptValueUtils_h
Provides an engine-independent interface for a scripting engine.
Definition: ScriptEngine.h:93
[ScriptInterface] Provides an engine-independent interface for QScriptValue
Definition: ScriptValue.h:40