add shader plugin register
This commit is contained in:
parent
5ca6c19e20
commit
fe1a556ad8
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
|
#include "registry.h"
|
||||||
|
|
||||||
class Driver {
|
class Driver {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -12,6 +14,8 @@ public:
|
|||||||
virtual void invokeContextEntityMethod(int contextId, QString *method, ...) = 0;
|
virtual void invokeContextEntityMethod(int contextId, QString *method, ...) = 0;
|
||||||
virtual void invokeDoricMethod(QString *method, ...) = 0;
|
virtual void invokeDoricMethod(QString *method, ...) = 0;
|
||||||
|
|
||||||
|
virtual Registry *getRegistry() = 0;
|
||||||
|
|
||||||
virtual ~Driver() = default;
|
virtual ~Driver() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include "stdarg.h"
|
#include "stdarg.h"
|
||||||
|
|
||||||
#include "native_driver.h"
|
#include "native_driver.h"
|
||||||
@ -50,3 +52,7 @@ void NativeDriver::invokeContextEntityMethod(int contextId, QString *method, ...
|
|||||||
void NativeDriver::invokeDoricMethod(QString *method, ...) {
|
void NativeDriver::invokeDoricMethod(QString *method, ...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Registry* NativeDriver::getRegistry() {
|
||||||
|
return jsEngine->registry;
|
||||||
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#ifndef NATIVE_DRIVER_H
|
#ifndef NATIVE_DRIVER_H
|
||||||
#define NATIVE_DRIVER_H
|
#define NATIVE_DRIVER_H
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "engine/js_engine.h"
|
#include "engine/js_engine.h"
|
||||||
|
|
||||||
@ -28,6 +26,8 @@ public:
|
|||||||
|
|
||||||
void invokeContextEntityMethod(int contextId, QString *method, ...) override;
|
void invokeContextEntityMethod(int contextId, QString *method, ...) override;
|
||||||
void invokeDoricMethod(QString *method, ...) override;
|
void invokeDoricMethod(QString *method, ...) override;
|
||||||
|
|
||||||
|
Registry * getRegistry() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NATIVE_DRIVER_H
|
#endif // NATIVE_DRIVER_H
|
||||||
|
@ -7,12 +7,15 @@
|
|||||||
#include "native/native_empty.h"
|
#include "native/native_empty.h"
|
||||||
#include "native/native_log.h"
|
#include "native/native_log.h"
|
||||||
#include "native/native_timer.h"
|
#include "native/native_timer.h"
|
||||||
|
#include "registry.h"
|
||||||
|
|
||||||
class JSEngine {
|
class JSEngine {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QJSEngine *engine = new QJSEngine();
|
QJSEngine *engine = new QJSEngine();
|
||||||
|
|
||||||
|
Registry *registry = new Registry();
|
||||||
|
|
||||||
JSEngine();
|
JSEngine();
|
||||||
|
|
||||||
void prepareContext(int contextId, QString *script);
|
void prepareContext(int contextId, QString *script);
|
||||||
|
@ -8,4 +8,5 @@ Q_INVOKABLE void NativeBridge::function(int contextId, QString module, QString m
|
|||||||
"callbackId: " + callbackId + ", " +
|
"callbackId: " + callbackId + ", " +
|
||||||
"arguments: " + jsValue.toString();
|
"arguments: " + jsValue.toString();
|
||||||
Context *context = ContextManager::getInstance()->getContext(contextId);
|
Context *context = ContextManager::getInstance()->getContext(contextId);
|
||||||
|
context->driver->getRegistry();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
|
#include "plugin/shader_plugin.h"
|
||||||
|
|
||||||
Registry::Registry() {
|
Registry::Registry() {
|
||||||
registerNativePlugin(typeid(ShaderPlugin).name());
|
registerNativePlugin(typeid(ShaderPlugin).name());
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
#define REGISTRY_H
|
#define REGISTRY_H
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QSet>
|
|
||||||
|
|
||||||
#include "plugin/shader_plugin.h"
|
|
||||||
|
|
||||||
class Registry {
|
class Registry {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user