mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 06:53:01 +02:00
Fix dimensions of rendered web entities
This commit is contained in:
parent
ecca1fea93
commit
549cb77902
5 changed files with 35 additions and 5 deletions
|
@ -140,6 +140,11 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene
|
||||||
_webSurface->resize(QSize(windowSize.x, windowSize.y));
|
_webSurface->resize(QSize(windowSize.x, windowSize.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||||
|
Parent::doRenderUpdateAsynchronousTyped(entity);
|
||||||
|
_modelTransform.postScale(entity->getDimensions());
|
||||||
|
}
|
||||||
|
|
||||||
void WebEntityRenderer::doRender(RenderArgs* args) {
|
void WebEntityRenderer::doRender(RenderArgs* args) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_lastRenderTime = usecTimestampNow();
|
_lastRenderTime = usecTimestampNow();
|
||||||
|
|
|
@ -29,6 +29,7 @@ protected:
|
||||||
virtual bool needsRenderUpdate() const override;
|
virtual bool needsRenderUpdate() const override;
|
||||||
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
||||||
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
|
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
|
||||||
|
virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
|
||||||
virtual void doRender(RenderArgs* args) override;
|
virtual void doRender(RenderArgs* args) override;
|
||||||
virtual bool isTransparent() const override;
|
virtual bool isTransparent() const override;
|
||||||
|
|
||||||
|
|
|
@ -211,12 +211,12 @@ class UrlHandler : public QObject {
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE bool canHandleUrl(const QString& url) {
|
Q_INVOKABLE bool canHandleUrl(const QString& url) {
|
||||||
static auto handler = dynamic_cast<AbstractUriHandler*>(qApp);
|
static auto handler = dynamic_cast<AbstractUriHandler*>(qApp);
|
||||||
return handler->canAcceptURL(url);
|
return handler && handler->canAcceptURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_INVOKABLE bool handleUrl(const QString& url) {
|
Q_INVOKABLE bool handleUrl(const QString& url) {
|
||||||
static auto handler = dynamic_cast<AbstractUriHandler*>(qApp);
|
static auto handler = dynamic_cast<AbstractUriHandler*>(qApp);
|
||||||
return handler->acceptURL(url);
|
return handler && handler->acceptURL(url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ setup_hifi_project(Quick Gui OpenGL)
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
||||||
|
|
||||||
# link in the shared libraries
|
# link in the shared libraries
|
||||||
link_hifi_libraries(shared networking model fbx ktx image octree gl gpu gpu-gl render model-networking networking render-utils entities entities-renderer animation audio avatars script-engine physics procedural midi)
|
link_hifi_libraries(shared networking model fbx ktx image octree gl gpu gpu-gl render model-networking networking render-utils entities entities-renderer animation audio avatars script-engine physics procedural midi ui)
|
||||||
|
|
||||||
package_libraries_for_deployment()
|
package_libraries_for_deployment()
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,15 @@
|
||||||
#include <LogHandler.h>
|
#include <LogHandler.h>
|
||||||
#include <AssetClient.h>
|
#include <AssetClient.h>
|
||||||
|
|
||||||
|
#include <gl/OffscreenGLCanvas.h>
|
||||||
|
|
||||||
#include <gpu/gl/GLBackend.h>
|
#include <gpu/gl/GLBackend.h>
|
||||||
#include <gpu/gl/GLFramebuffer.h>
|
#include <gpu/gl/GLFramebuffer.h>
|
||||||
#include <gpu/gl/GLTexture.h>
|
#include <gpu/gl/GLTexture.h>
|
||||||
#include <gpu/StandardShaderLib.h>
|
#include <gpu/StandardShaderLib.h>
|
||||||
|
|
||||||
|
#include <ui/OffscreenQmlSurface.h>
|
||||||
|
|
||||||
#include <AnimationCache.h>
|
#include <AnimationCache.h>
|
||||||
#include <SimpleEntitySimulation.h>
|
#include <SimpleEntitySimulation.h>
|
||||||
#include <EntityDynamicInterface.h>
|
#include <EntityDynamicInterface.h>
|
||||||
|
@ -427,6 +431,10 @@ namespace render {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OffscreenGLCanvas* _chromiumShareContext{ nullptr };
|
||||||
|
Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
|
||||||
|
|
||||||
|
|
||||||
// Create a simple OpenGL window that renders text in various ways
|
// Create a simple OpenGL window that renders text in various ways
|
||||||
class QTestWindow : public QWindow, public AbstractViewStateInterface {
|
class QTestWindow : public QWindow, public AbstractViewStateInterface {
|
||||||
|
|
||||||
|
@ -506,8 +514,6 @@ public:
|
||||||
AbstractViewStateInterface::setInstance(this);
|
AbstractViewStateInterface::setInstance(this);
|
||||||
_octree = DependencyManager::set<EntityTreeRenderer>(false, this, nullptr);
|
_octree = DependencyManager::set<EntityTreeRenderer>(false, this, nullptr);
|
||||||
_octree->init();
|
_octree->init();
|
||||||
// Prevent web entities from rendering
|
|
||||||
REGISTER_ENTITY_TYPE_WITH_FACTORY(Web, WebEntityItem::factory);
|
|
||||||
|
|
||||||
DependencyManager::set<ParentFinder>(_octree->getTree());
|
DependencyManager::set<ParentFinder>(_octree->getTree());
|
||||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||||
|
@ -535,6 +541,23 @@ public:
|
||||||
_renderThread.initialize(this, _initContext);
|
_renderThread.initialize(this, _initContext);
|
||||||
_initContext.makeCurrent();
|
_initContext.makeCurrent();
|
||||||
|
|
||||||
|
if (nsightActive()) {
|
||||||
|
// Prevent web entities from rendering
|
||||||
|
REGISTER_ENTITY_TYPE_WITH_FACTORY(Web, WebEntityItem::factory);
|
||||||
|
} else {
|
||||||
|
_chromiumShareContext = new OffscreenGLCanvas();
|
||||||
|
_chromiumShareContext->setObjectName("ChromiumShareContext");
|
||||||
|
_chromiumShareContext->create(_initContext.qglContext());
|
||||||
|
_chromiumShareContext->makeCurrent();
|
||||||
|
qt_gl_set_global_share_context(_chromiumShareContext->getContext());
|
||||||
|
|
||||||
|
// Make sure all QML surfaces share the main thread GL context
|
||||||
|
OffscreenQmlSurface::setSharedContext(_initContext.qglContext());
|
||||||
|
|
||||||
|
_initContext.makeCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// FIXME use a wait condition
|
// FIXME use a wait condition
|
||||||
QThread::msleep(1000);
|
QThread::msleep(1000);
|
||||||
_renderThread.submitFrame(gpu::FramePointer());
|
_renderThread.submitFrame(gpu::FramePointer());
|
||||||
|
@ -679,6 +702,7 @@ private:
|
||||||
_renderCount = _renderThread._presentCount.load();
|
_renderCount = _renderThread._presentCount.load();
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
_initContext.makeCurrent();
|
||||||
RenderArgs renderArgs(_renderThread._gpuContext, DEFAULT_OCTREE_SIZE_SCALE,
|
RenderArgs renderArgs(_renderThread._gpuContext, DEFAULT_OCTREE_SIZE_SCALE,
|
||||||
0, RenderArgs::DEFAULT_RENDER_MODE,
|
0, RenderArgs::DEFAULT_RENDER_MODE,
|
||||||
RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
|
RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
|
||||||
|
|
Loading…
Reference in a new issue