8#ifndef META_OCEAN_INTERACTION_JS_LIBRARY_H
9#define META_OCEAN_INTERACTION_JS_LIBRARY_H
40 using JSContexts = std::vector<std::shared_ptr<JSContext>>;
165 static void functionLoad(
const v8::FunctionCallbackInfo<v8::Value>& info);
std::vector< std::shared_ptr< JSContext > > JSContexts
Definition of a vector holding JavaScript contexts.
Definition JSLibrary.h:40
v8::Isolate * isolate_
The isolate for all contexts.
Definition JSLibrary.h:184
~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 registers 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.
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.
friend class JSContext
Definition JSLibrary.h:33
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
v8::Local< v8::ObjectTemplate > globalTemplate()
Returns the global template object holding definitions of all global custom JavaScript object templat...
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
Library(const std::string &name)
Creates a new library object.
This class holds UI elements of the application from which the interaction is executed.
Definition UserInterface.h:28
This class implements a recursive lock object.
Definition Lock.h:31
This class implements a timestamp.
Definition Timestamp.h:64
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition Vector2.h:28
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition Vector3.h:29
LineT3< Scalar > Line3
Definition of the Line3 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single o...
Definition Line3.h:27
Ocean::ObjectRef< Engine > EngineRef
Definition of an engine reference object.
Definition Engine.h:30
size_t ObjectId
Definition of a object id.
Definition rendering/Rendering.h:59
SmartObjectRef< View > ViewRef
Definition of a smart object reference holding a view node.
Definition View.h:39
Namespace of the Interaction JavaScript library.
Definition JavaScript.h:24
Namespace of the Interaction library.
Definition Empty.h:19
The namespace covering the entire Ocean framework.
Definition Accessor.h:15