History

vec3FromScriptValue replacement attempt

ksuprynowicz committed 3 years ago

Commit dba09251 parent 3a2075012 files · +133 −10Browse files

Showing the changes to libraries/script-engine/src/SpatialEvent.cpp (1 of 12 files). Show all

Unified · Split

libraries/script-engine/src/SpatialEvent.cpp+11−1
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include "ScriptEngine.h"
1818 #include "ScriptValueUtils.h"
1919 #include "ScriptValue.h"
20+#include "v8/FastScriptValueUtils.h"
2021
2122 SpatialEvent::SpatialEvent() :
2223 locTranslation(0.0f),
@@ -38,11 +39,20 @@ SpatialEvent::SpatialEvent(const SpatialEvent& event) { · 15 unmodified lines
3839 ScriptValue SpatialEvent::toScriptValue(ScriptEngine* engine, const SpatialEvent& event) {
3940 ScriptValue obj = engine->newObject();
4041
42+#ifdef CONVERSIONS_OPTIMIZED_FOR_V8
43+ obj.setProperty("locTranslation", vec3ToScriptValueFast(engine, event.locTranslation) );
44+ //V8TODO: optimize
45+ obj.setProperty("locRotation", quatToScriptValue(engine, event.locRotation) );
46+ obj.setProperty("absTranslation", vec3ToScriptValueFast(engine, event.absTranslation));
47+ //V8TODO: optimize
48+ obj.setProperty("absRotation", quatToScriptValue(engine, event.absRotation));
49+#else
4150 obj.setProperty("locTranslation", vec3ToScriptValue(engine, event.locTranslation) );
4251 obj.setProperty("locRotation", quatToScriptValue(engine, event.locRotation) );
4352 obj.setProperty("absTranslation", vec3ToScriptValue(engine, event.absTranslation));
4453 obj.setProperty("absRotation", quatToScriptValue(engine, event.absRotation));
45−
54+#endif
55+
4656 return obj;
4757 }
4858

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t