8 #ifndef META_OCEAN_INTERACTION_JS_LIBRARY_H
9 #define META_OCEAN_INTERACTION_JS_LIBRARY_H
40 typedef std::vector<std::shared_ptr<JSContext>>
JSContexts;
165 static void functionLoad(
const v8::FunctionCallbackInfo<v8::Value>& info);
184 v8::Isolate* isolate_ =
nullptr;
This class implements a wrapper for a JavaScript context.
Definition: JSContext.h:37
This class implements the java script interaction library object.
Definition: JSLibrary.h:32
v8::Local< v8::ObjectTemplate > globalTemplate()
Returns the global template object holding definitions of all global custom JavaScript object templat...
~JSLibrary() override
Destructs a java script library object.
void onMouseMove(const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &button, const Vector2 &screenPosition, const Line3 &ray, const Rendering::ObjectId pickedObject, const Vector3 &pickedPosition, const Timestamp timestamp) override
Mouse move event function.
void unload(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp) override
Unloads all loaded scripts.
static bool unregisterLibrary()
Unregisters this library at the global interaction manager.
static void registerLibrary()
Creates this library and registeres it at the global interaction manager.
void onKeyPress(const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &key, const Timestamp timestamp) override
Key press function.
void postFileLoad(const UserInterface &userInterface, const std::string &filename, const bool succeeded) override
Post file load interaction function.
std::vector< std::shared_ptr< JSContext > > JSContexts
Definition of a vector holding JavaScript contexts.
Definition: JSLibrary.h:40
JSLibrary()
Creates a new java script library object.
void onMousePress(const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &button, const Vector2 &screenPosition, const Line3 &ray, const Rendering::ObjectId pickedObject, const Vector3 &pickedPosition, const Timestamp timestamp) override
Mouse press event function.
std::unique_ptr< v8::Platform > platform_
The platform for all contexts.
Definition: JSLibrary.h:178
JSContexts jsContexts_
All JavaScript context objects.
Definition: JSLibrary.h:190
std::string translatePickingObject(const Rendering::EngineRef &engine, const Rendering::ObjectId objectId)
Translates a given rendering object id into a named picking object.
void preFileLoad(const UserInterface &userInterface, const std::string &filename) override
Pre file load interaction function.
void releaseGlobalTemplate()
Releases the global template object.
v8::Isolate::CreateParams createParams_
The create parameters for the isolate.
Definition: JSLibrary.h:181
void postUpdate(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Rendering::ViewRef &view, const Timestamp timestamp) override
Post update interaction function.
v8::Persistent< v8::ObjectTemplate > globalTemplate_
Global template object holding definitions of all global custom JavaScript object templates (e....
Definition: JSLibrary.h:187
bool load(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp, const std::string &filename) override
Loads a new interaction file.
static void functionLoad(const v8::FunctionCallbackInfo< v8::Value > &info)
Load function for additional java script file.
bool unload(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp, const std::string &filename) override
Unloads one specific loaded interaction files.
void onKeyRelease(const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &key, const Timestamp timestamp) override
Key release function.
void onMouseRelease(const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &button, const Vector2 &screenPosition, const Line3 &ray, const Rendering::ObjectId pickedObject, const Vector3 &pickedPosition, const Timestamp timestamp) override
Mouse release event function.
Timestamp preUpdate(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Rendering::ViewRef &view, const Timestamp timestamp) override
Pre update interaction function.
Lock lock_
The library's lock.
Definition: JSLibrary.h:193
This class implements the base class for all interaction libraries.
Definition: interaction/Library.h:29
This class holds UI elements of the application from which the interaction is executed.
Definition: UserInterface.h:28
This class implements an infinite line in 3D space.
Definition: Line3.h:70
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements a timestamp.
Definition: Timestamp.h:36
size_t ObjectId
Definition of a object id.
Definition: rendering/Rendering.h:59
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15