summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2019-04-30 15:03:09 +0300
committerAntti Määttä <antti.maatta@qt.io>2019-05-02 10:21:53 +0000
commita007e67eb90da23286728b5c21bf6c786ffc80ae (patch)
tree453fb2917489f9dcb8355f608b4347e8290c1398
parent3dc7636713c98ce2748d367f8525fcab85a6c425 (diff)
Remove CTegraApplication to reduce intermediary classes
Use the INDDView in the ViewerApp directly. Change-Id: If502dd51d4ea87fc96d892cb9255df42b06fa4f3 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Pasi Keränen <pasi.keranen@qt.io>
-rw-r--r--src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro8
-rw-r--r--src/Runtime/Source/engine/Qt3DSRenderRuntimeBinding.cpp2
-rw-r--r--src/Runtime/Source/engine/Qt3DSRenderRuntimeBindingImplRenderer.cpp2
-rw-r--r--src/Runtime/Source/engine/Qt3DSRuntimeView.cpp (renamed from src/Runtime/Source/engine/Qt3DSTegraApplication.cpp)217
-rw-r--r--src/Runtime/Source/engine/Qt3DSRuntimeView.h (renamed from src/Runtime/Source/engine/Qt3DSTegraApplication.h)145
-rw-r--r--src/Runtime/Source/engine/Qt3DSTegraInputEngine.h2
-rw-r--r--src/Runtime/Source/viewer/Qt3DSViewerApp.cpp210
-rw-r--r--src/Runtime/Source/viewer/Qt3DSViewerApp.h2
8 files changed, 189 insertions, 399 deletions
diff --git a/src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro b/src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro
index c01bc952..73eb9950 100644
--- a/src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro
+++ b/src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro
@@ -36,7 +36,6 @@ SOURCES += \
../Source/engine/Qt3DSRenderRuntimeBinding.cpp \
../Source/engine/Qt3DSRenderRuntimeBindingImplRenderer.cpp \
../Source/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp \
- ../Source/engine/Qt3DSTegraApplication.cpp \
../Source/engine/Qt3DSTegraInputEngine.cpp \
../Source/runtime/Qt3DSActivationManager.cpp \
../Source/runtime/Qt3DSAnimationSystem.cpp \
@@ -155,7 +154,8 @@ SOURCES += \
../Source/runtimerender/Qt3DSDistanceFieldRenderer.cpp \
../Source/runtimerender/Qt3DSFontDatabase.cpp \
../Source/runtimerender/Qt3DSDistanceFieldGlyphCacheManager.cpp \
- ../Source/runtimerender/Qt3DSDistanceFieldGlyphCache.cpp
+ ../Source/runtimerender/Qt3DSDistanceFieldGlyphCache.cpp \
+ ../Source/engine/Qt3DSRuntimeView.cpp
HEADERS += \
../Source/foundation/ConvertUTF.h \
@@ -228,7 +228,6 @@ HEADERS += \
../Source/runtimerender/q3dsqmlrender.h \
../Source/engine/Qt3DSRenderRuntimeBinding.h \
../Source/engine/Qt3DSRenderRuntimeBindingImpl.h \
- ../Source/engine/Qt3DSTegraApplication.h \
../Source/engine/Qt3DSTegraInputEngine.h \
../Source/runtime/Qt3DSActivationManager.h \
../Source/runtime/Qt3DSAnimationSystem.h \
@@ -426,7 +425,8 @@ HEADERS += \
../Source/runtimerender/Qt3DSDistanceFieldRenderer.h \
../Source/runtimerender/Qt3DSFontDatabase_p.h \
../Source/runtimerender/Qt3DSDistanceFieldGlyphCacheManager_p.h \
- ../Source/runtimerender/Qt3DSDistanceFieldGlyphCache_p.h
+ ../Source/runtimerender/Qt3DSDistanceFieldGlyphCache_p.h \
+ ../Source/engine/Qt3DSRuntimeView.h
win32 {
SOURCES += \
diff --git a/src/Runtime/Source/engine/Qt3DSRenderRuntimeBinding.cpp b/src/Runtime/Source/engine/Qt3DSRenderRuntimeBinding.cpp
index 4ef33604..10496753 100644
--- a/src/Runtime/Source/engine/Qt3DSRenderRuntimeBinding.cpp
+++ b/src/Runtime/Source/engine/Qt3DSRenderRuntimeBinding.cpp
@@ -32,7 +32,7 @@
#include "Qt3DSRenderRuntimeBindingImpl.h"
#include "Qt3DSSceneManager.h"
#include "Qt3DSIScene.h"
-#include "Qt3DSTegraApplication.h"
+#include "Qt3DSRuntimeView.h"
#include "Qt3DSQmlEngine.h"
#include "Qt3DSRenderUIPLoader.h"
#include "Qt3DSPresentationFrameData.h"
diff --git a/src/Runtime/Source/engine/Qt3DSRenderRuntimeBindingImplRenderer.cpp b/src/Runtime/Source/engine/Qt3DSRenderRuntimeBindingImplRenderer.cpp
index eff57579..b41c83b9 100644
--- a/src/Runtime/Source/engine/Qt3DSRenderRuntimeBindingImplRenderer.cpp
+++ b/src/Runtime/Source/engine/Qt3DSRenderRuntimeBindingImplRenderer.cpp
@@ -29,7 +29,7 @@
****************************************************************************/
#include "EnginePrefix.h"
#include "Qt3DSRenderRuntimeBindingImpl.h"
-#include "Qt3DSTegraApplication.h"
+#include "Qt3DSRuntimeView.h"
#include "Qt3DSWindowSystem.h"
#include "Qt3DSRenderLoadedTexture.h"
diff --git a/src/Runtime/Source/engine/Qt3DSTegraApplication.cpp b/src/Runtime/Source/engine/Qt3DSRuntimeView.cpp
index cf1c4a90..f2ce9d67 100644
--- a/src/Runtime/Source/engine/Qt3DSTegraApplication.cpp
+++ b/src/Runtime/Source/engine/Qt3DSRuntimeView.cpp
@@ -31,7 +31,7 @@
//==============================================================================
// Includes
//==============================================================================
-#include "Qt3DSTegraApplication.h"
+#include "Qt3DSRuntimeView.h"
#include "Qt3DSTegraInputEngine.h"
#include "Qt3DSDataLogger.h"
#include "Qt3DSFileStream.h"
@@ -45,6 +45,7 @@
#include "Qt3DSKernelTypes.h"
#include "Qt3DSRenderContextCore.h"
#include "Qt3DSRenderer.h"
+#include "Qt3DSRenderBufferManager.h"
#include "Qt3DSDLLManager.h"
#include "foundation/Qt3DSSimpleTypes.h"
@@ -86,9 +87,9 @@ namespace {
bool CaselessEqual(const char *lhs, const char *rhs)
{
- if (lhs == NULL)
+ if (lhs == nullptr)
lhs = "";
- if (rhs == NULL)
+ if (rhs == nullptr)
rhs = "";
return Q3DStudio_stricmp(lhs, rhs) == 0;
}
@@ -114,7 +115,7 @@ const eastl::string &GetAppDir(const eastl::string &inAppExe)
#ifdef Qt3DS_OS_QNX
char theBuf[1024] = { 0 };
FILE *exefile = fopen("/proc/self/exefile", "r");
- if (exefile != NULL) {
+ if (exefile != nullptr) {
fgets(theBuf, sizeof(theBuf), exefile);
fclose(exefile);
theAppDir->assign(theBuf);
@@ -132,11 +133,7 @@ const eastl::string &GetAppDir(const eastl::string &inAppExe)
using namespace qt3ds;
using namespace qt3ds::foundation;
-//==============================================================================
-/**
- * CNDDView
- */
-class CNDDView : public INDDView
+class CRuntimeView : public IRuntimeView
{
//==============================================================================
// Fields
@@ -146,13 +143,14 @@ private:
CTegraInputEngine *m_InputEngine; ///< Handles all user input events
// Pre graphics init objects
NVScopedRefCounted<qt3ds::render::IQt3DSRenderFactoryCore> m_RuntimeFactoryCore;
- NVScopedRefCounted<qt3ds::runtime::IApplicationCore>
- m_ApplicationCore; ///< Base application before graphis
+ ///< Base application before graphics
+ NVScopedRefCounted<qt3ds::runtime::IApplicationCore> m_ApplicationCore;
// Post graphics init objects
NVScopedRefCounted<qt3ds::render::IQt3DSRenderFactory> m_RuntimeFactory;
NVScopedRefCounted<qt3ds::runtime::IApplication> m_Application; ///< Application after graphics
- CPresentation *m_Presentation; ///< Currently loaded presentation, this should be removed in the future
+ ///< Currently loaded presentation, this should be removed in the future
+ CPresentation *m_Presentation;
CPausingTimeProvider m_TimeProvider;
IWindowSystem &m_WindowSystem;
@@ -164,11 +162,11 @@ private:
bool m_showOnScreenStats;
public:
- CNDDView(ITimeProvider &inTimeProvider, IWindowSystem &inWindowSystem,
- IAudioPlayer *inAudioPlayer);
- ~CNDDView();
+ CRuntimeView(ITimeProvider &inTimeProvider, IWindowSystem &inWindowSystem,
+ IAudioPlayer *inAudioPlayer);
+ ~CRuntimeView() override;
- QT3DS_IMPLEMENT_REF_COUNT_ADDREF_RELEASE_OVERRIDE(qt3ds::render::g_BaseAllocator);
+ QT3DS_IMPLEMENT_REF_COUNT_ADDREF_RELEASE_OVERRIDE(qt3ds::render::g_BaseAllocator)
bool BeginLoad(const QString &sourcePath, const QStringList &variantList) override;
bool HasOfflineLoadingCompleted() override;
@@ -221,16 +219,15 @@ public:
bool RegisterScriptCallback(int callbackType, qml_Function func, void *inUserData) override;
void FireEvent(const TEventCommandHash inEventType, eastl::string inArgument) override;
qt3ds::foundation::Option<SPresentationSize> GetPresentationSize() override;
-
void BootupPreGraphicsInitObjects();
};
-CNDDView::CNDDView(ITimeProvider &inTimeProvider, IWindowSystem &inWindowSystem,
- IAudioPlayer *inAudioPlayer)
- : m_RenderEngine(NULL)
- , m_InputEngine(NULL)
- , m_Application(NULL)
- , m_Presentation(NULL)
+CRuntimeView::CRuntimeView(ITimeProvider &inTimeProvider, IWindowSystem &inWindowSystem,
+ IAudioPlayer *inAudioPlayer)
+ : m_RenderEngine(nullptr)
+ , m_InputEngine(nullptr)
+ , m_Application(nullptr)
+ , m_Presentation(nullptr)
, m_TimeProvider(inTimeProvider)
, m_WindowSystem(inWindowSystem)
, m_AudioPlayer(inAudioPlayer)
@@ -240,11 +237,11 @@ CNDDView::CNDDView(ITimeProvider &inTimeProvider, IWindowSystem &inWindowSystem,
{
}
-CNDDView::~CNDDView()
+CRuntimeView::~CRuntimeView()
{
}
-bool CNDDView::BeginLoad(const QString &sourcePath, const QStringList &variantList)
+bool CRuntimeView::BeginLoad(const QString &sourcePath, const QStringList &variantList)
{
bool theResult = false;
@@ -267,9 +264,9 @@ bool CNDDView::BeginLoad(const QString &sourcePath, const QStringList &variantLi
return theResult;
}
-bool CNDDView::HasOfflineLoadingCompleted()
+bool CRuntimeView::HasOfflineLoadingCompleted()
{
- if (m_Application.mPtr == NULL) {
+ if (m_Application.mPtr == nullptr) {
if (m_ApplicationCore)
return m_ApplicationCore->HasCompletedLoading();
else
@@ -278,7 +275,7 @@ bool CNDDView::HasOfflineLoadingCompleted()
return true;
}
-bool CNDDView::InitializeGraphics(const QSurfaceFormat &format)
+bool CRuntimeView::InitializeGraphics(const QSurfaceFormat &format)
{
m_ApplicationCore->EndLoad();
// Next call will initialize the render portion of the scenes. This *must* have a loaded
@@ -295,25 +292,25 @@ bool CNDDView::InitializeGraphics(const QSurfaceFormat &format)
m_Presentation = m_Application->GetPrimaryPresentation();
QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigSlideEntered,
- signalProxy(), &QINDDViewSignalProxy::SigSlideEntered);
+ signalProxy(), &QRuntimeViewSignalProxy::SigSlideEntered);
QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigSlideExited,
- signalProxy(), &QINDDViewSignalProxy::SigSlideExited);
+ signalProxy(), &QRuntimeViewSignalProxy::SigSlideExited);
QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigCustomSignal,
- signalProxy(), &QINDDViewSignalProxy::SigCustomSignal);
+ signalProxy(), &QRuntimeViewSignalProxy::SigCustomSignal);
m_TimeProvider.Reset();
return true;
}
-void CNDDView::Cleanup()
+void CRuntimeView::Cleanup()
{
// Q3DStudio_virtual_delete( m_Timer, CTimer );
// Q3DStudio_virtual_delete( m_PerfFileStream, CFileStream );
- m_Application = NULL;
+ m_Application = nullptr;
Q3DStudio_virtual_delete(m_InputEngine, CTegraInputEngine);
if (m_RenderEngine) {
m_RenderEngine->Release();
- m_RenderEngine = NULL;
+ m_RenderEngine = nullptr;
}
CDLLManager &theDLLManager = CDLLManager::GetDLLManager();
@@ -321,14 +318,14 @@ void CNDDView::Cleanup()
if (m_Presentation)
QObject::disconnect(m_Presentation->signalProxy(), 0, signalProxy(), 0);
- m_InputEngine = NULL;
- m_RenderEngine = NULL;
- m_Presentation = NULL;
+ m_InputEngine = nullptr;
+ m_RenderEngine = nullptr;
+ m_Presentation = nullptr;
}
-bool CNDDView::CanRender()
+bool CRuntimeView::CanRender()
{
- return m_Application.mPtr != NULL;
+ return m_Application.mPtr != nullptr;
}
//==============================================================================
@@ -337,9 +334,9 @@ bool CNDDView::CanRender()
* returns KD_TRUE to call egl_render and swap properly, KD_FALSE if there has been no scene update
*or redraw.
*/
-void CNDDView::Render()
+void CRuntimeView::Render()
{
- if (m_Application.mPtr == NULL) {
+ if (m_Application.mPtr == nullptr) {
// InitializeGraphics has not been called
QT3DS_ASSERT(false);
}
@@ -378,7 +375,7 @@ void CNDDView::Render()
}
}
-bool CNDDView::WasLastFrameDirty()
+bool CRuntimeView::WasLastFrameDirty()
{
if (m_Application)
return m_Application->IsApplicationDirty();
@@ -390,9 +387,9 @@ bool CNDDView::WasLastFrameDirty()
* nv_main APP-SPECIFIC message call
* HandleMessage
*/
-bool CNDDView::HandleMessage(const QEvent *inEvent)
+bool CRuntimeView::HandleMessage(const QEvent *inEvent)
{
- if (m_Application.mPtr == NULL || m_RenderEngine == NULL)
+ if (m_Application.mPtr == nullptr || m_RenderEngine == nullptr)
return 0;
bool ret = false;
@@ -423,32 +420,32 @@ bool CNDDView::HandleMessage(const QEvent *inEvent)
return ret ? 1 : 0;
}
-void CNDDView::Pause()
+void CRuntimeView::Pause()
{
m_TimeProvider.Pause();
}
-void CNDDView::UnPause()
+void CRuntimeView::UnPause()
{
m_TimeProvider.UnPause();
}
-bool CNDDView::IsPaused()
+bool CRuntimeView::IsPaused()
{
return m_TimeProvider.IsPaused();
}
-INT32 CNDDView::GetFrameCount()
+INT32 CRuntimeView::GetFrameCount()
{
return m_Application->GetFrameCount();
}
-void CNDDView::showOnScreenStats(bool show)
+void CRuntimeView::showOnScreenStats(bool show)
{
m_showOnScreenStats = show;
}
-CInputEngine *CNDDView::GetInputEngine()
+CInputEngine *CRuntimeView::GetInputEngine()
{
return m_InputEngine;
}
@@ -457,7 +454,7 @@ CInputEngine *CNDDView::GetInputEngine()
/**
* Generates an event in the presentation.
*/
-void CNDDView::GoToSlideByName(const char *elementPath, const char *slideName)
+void CRuntimeView::GoToSlideByName(const char *elementPath, const char *slideName)
{
if (m_Application) {
if (!elementPath || !slideName)
@@ -473,7 +470,7 @@ void CNDDView::GoToSlideByName(const char *elementPath, const char *slideName)
}
}
-void CNDDView::GoToSlideByIndex(const char *elementPath, const int slideIndex)
+void CRuntimeView::GoToSlideByIndex(const char *elementPath, const int slideIndex)
{
if (m_Application) {
if (!elementPath || slideIndex < 0)
@@ -486,7 +483,7 @@ void CNDDView::GoToSlideByIndex(const char *elementPath, const int slideIndex)
}
}
-void CNDDView::GoToSlideRelative(const char *elementPath, const bool next, const bool wrap)
+void CRuntimeView::GoToSlideRelative(const char *elementPath, const bool next, const bool wrap)
{
if (m_Application) {
if (!elementPath)
@@ -499,7 +496,7 @@ void CNDDView::GoToSlideRelative(const char *elementPath, const bool next, const
}
}
-bool CNDDView::GetSlideInfo(const char *elementPath, int &currentIndex, int &previousIndex,
+bool CRuntimeView::GetSlideInfo(const char *elementPath, int &currentIndex, int &previousIndex,
QString &currentName, QString &previousName)
{
if (m_Application && elementPath) {
@@ -512,7 +509,7 @@ bool CNDDView::GetSlideInfo(const char *elementPath, int &currentIndex, int &pre
return false;
}
-void CNDDView::SetPresentationAttribute(const char *presId, const char *, const char *value)
+void CRuntimeView::SetPresentationAttribute(const char *presId, const char *, const char *value)
{
if (m_Application) {
if (!presId || !value)
@@ -525,7 +522,7 @@ void CNDDView::SetPresentationAttribute(const char *presId, const char *, const
}
}
-bool CNDDView::RegisterScriptCallback(int callbackType, qml_Function func, void *inUserData)
+bool CRuntimeView::RegisterScriptCallback(int callbackType, qml_Function func, void *inUserData)
{
if (m_Application) {
Q3DStudio::CQmlEngine &theBridgeEngine
@@ -537,7 +534,7 @@ bool CNDDView::RegisterScriptCallback(int callbackType, qml_Function func, void
return false;
}
-void CNDDView::GoToTime(const char *elementPath, const float time)
+void CRuntimeView::GoToTime(const char *elementPath, const float time)
{
if (m_Application) {
if (!elementPath || time < 0.0)
@@ -550,13 +547,13 @@ void CNDDView::GoToTime(const char *elementPath, const float time)
}
}
-void CNDDView::SetGlobalAnimationTime(qint64 inMilliSecs)
+void CRuntimeView::SetGlobalAnimationTime(qint64 inMilliSecs)
{
if (m_Application)
m_Application->SetTimeMilliSecs(inMilliSecs);
}
-void CNDDView::SetDataInputValue(
+void CRuntimeView::SetDataInputValue(
const QString &name, const QVariant &value,
Q3DSDataInput::ValueRole property = Q3DSDataInput::ValueRole::Value)
{
@@ -565,7 +562,7 @@ void CNDDView::SetDataInputValue(
theBridgeEngine.SetDataInputValue(name, value, property);
}
-QList<QString> CNDDView::dataInputs() const
+QList<QString> CRuntimeView::dataInputs() const
{
if (m_Application)
return m_Application->dataInputs();
@@ -573,17 +570,17 @@ QList<QString> CNDDView::dataInputs() const
return {};
}
-float CNDDView::dataInputMax(const QString &name) const
+float CRuntimeView::dataInputMax(const QString &name) const
{
return m_Application->dataInputMax(name);
}
-float CNDDView::dataInputMin(const QString &name) const
+float CRuntimeView::dataInputMin(const QString &name) const
{
return m_Application->dataInputMin(name);
}
-void CNDDView::SetAttribute(const char *elementPath, const char *attributeName, const char *value)
+void CRuntimeView::SetAttribute(const char *elementPath, const char *attributeName, const char *value)
{
if (m_Application) {
if (!elementPath || !attributeName || !value)
@@ -596,7 +593,7 @@ void CNDDView::SetAttribute(const char *elementPath, const char *attributeName,
}
}
-bool CNDDView::GetAttribute(const char *elementPath, const char *attributeName, void *value)
+bool CRuntimeView::GetAttribute(const char *elementPath, const char *attributeName, void *value)
{
if (m_Application) {
if (!elementPath || !attributeName || !value)
@@ -611,7 +608,7 @@ bool CNDDView::GetAttribute(const char *elementPath, const char *attributeName,
return false;
}
-void CNDDView::FireEvent(const char *element, const char *evtName)
+void CRuntimeView::FireEvent(const char *element, const char *evtName)
{
if (m_Application) {
if (!element || !evtName)
@@ -624,7 +621,7 @@ void CNDDView::FireEvent(const char *element, const char *evtName)
}
}
-bool CNDDView::PeekCustomAction(char *&outElementPath, char *&outActionName)
+bool CRuntimeView::PeekCustomAction(char *&outElementPath, char *&outActionName)
{
bool actionAvailable = true;
@@ -632,7 +629,7 @@ bool CNDDView::PeekCustomAction(char *&outElementPath, char *&outActionName)
Q3DStudio::CQmlEngine &theBridgeEngine
= static_cast<Q3DStudio::CQmlEngine &>(m_RuntimeFactoryCore->GetScriptEngineQml());
- Q3DStudio::TElement *theElement = NULL;
+ Q3DStudio::TElement *theElement = nullptr;
actionAvailable = theBridgeEngine.PeekSignal(theElement, outActionName);
if (actionAvailable && theElement)
outElementPath = (char *)theElement->m_Path.c_str();
@@ -641,24 +638,24 @@ bool CNDDView::PeekCustomAction(char *&outElementPath, char *&outActionName)
return actionAvailable;
}
-void CNDDView::FireEvent(const TEventCommandHash inEventType, eastl::string inArgument)
+void CRuntimeView::FireEvent(const TEventCommandHash inEventType, eastl::string inArgument)
{
if (m_Application) {
CPresentation *thePresentation = m_Application->GetPrimaryPresentation();
TElement *theScene = thePresentation->GetRoot();
if (inArgument.empty()) {
- thePresentation->FireEvent(inEventType, theScene, NULL, NULL, ATTRIBUTETYPE_NONE,
+ thePresentation->FireEvent(inEventType, theScene, nullptr, nullptr, ATTRIBUTETYPE_NONE,
ATTRIBUTETYPE_NONE);
} else {
UVariant inArg;
inArg.m_StringHandle = thePresentation->GetStringTable().GetHandle(inArgument.c_str());
- thePresentation->FireEvent(inEventType, theScene, &inArg, NULL, ATTRIBUTETYPE_STRING,
+ thePresentation->FireEvent(inEventType, theScene, &inArg, nullptr, ATTRIBUTETYPE_STRING,
ATTRIBUTETYPE_NONE);
}
}
}
-qt3ds::foundation::Option<SPresentationSize> CNDDView::GetPresentationSize()
+qt3ds::foundation::Option<SPresentationSize> CRuntimeView::GetPresentationSize()
{
if (m_Application) {
CPresentation *thePresentation = m_Application->GetPrimaryPresentation();
@@ -672,7 +669,7 @@ qt3ds::foundation::Option<SPresentationSize> CNDDView::GetPresentationSize()
/**
* Perform the initialization steps prior to loading any presentation.
*/
-void CNDDView::BootupPreGraphicsInitObjects()
+void CRuntimeView::BootupPreGraphicsInitObjects()
{
qCInfo(TRACE_INFO) << "CNDDView::BootupPreGraphicsInitObjects: DoInitialize";
// Create engines and runtime
@@ -680,100 +677,36 @@ void CNDDView::BootupPreGraphicsInitObjects()
m_RuntimeFactoryCore = qt3ds::render::IQt3DSRenderFactoryCore::CreateRenderFactoryCore(
theAppDir.c_str(), m_WindowSystem, m_TimeProvider);
- m_ApplicationCore = qt3ds::runtime::IApplicationCore::CreateApplicationCore(*m_RuntimeFactoryCore,
+ m_ApplicationCore = qt3ds::runtime::IApplication::CreateApplicationCore(*m_RuntimeFactoryCore,
theAppDir.c_str());
if (m_ApplicationCore && m_visitor)
m_ApplicationCore->setAssetVisitor(m_visitor);
m_InputEngine = static_cast<CTegraInputEngine *>(CreateInputEngine());
- Q3DStudio_ASSERT(m_InputEngine != NULL);
+ Q3DStudio_ASSERT(m_InputEngine != nullptr);
qCInfo(TRACE_INFO) << "CNDDView::DoInitialize: Successfully initialized!";
}
-void CNDDView::setAssetVisitor(qt3ds::Qt3DSAssetVisitor *v)
+void CRuntimeView::setAssetVisitor(qt3ds::Qt3DSAssetVisitor *v)
{
m_visitor = v;
if (m_ApplicationCore)
m_ApplicationCore->setAssetVisitor(v);
}
-INDDView &INDDView::Create(ITimeProvider &inProvider, IWindowSystem &inWindowSystem,
+IRuntimeView &IRuntimeView::Create(ITimeProvider &inProvider, IWindowSystem &inWindowSystem,
IAudioPlayer *inAudioPlayer)
{
- return *QT3DS_NEW(qt3ds::render::g_BaseAllocator, CNDDView)(inProvider, inWindowSystem,
+ return *QT3DS_NEW(qt3ds::render::g_BaseAllocator, CRuntimeView)(inProvider, inWindowSystem,
inAudioPlayer);
}
-QINDDViewSignalProxy *INDDView::signalProxy()
+QRuntimeViewSignalProxy *IRuntimeView::signalProxy()
{
return &m_SignalProxy;
}
-//==============================================================================
-/**
- * CTegraApplication
- */
-CTegraApplication::CTegraApplication(ITimeProvider &inProvider, IWindowSystem &inWindowSystem,
- IAudioPlayer *inAudioPlayer)
-{
- m_NDDView = INDDView::Create(inProvider, inWindowSystem, inAudioPlayer);
-}
-
-CTegraApplication::~CTegraApplication()
-{
-}
-
-bool CTegraApplication::BeginLoad(const QString &sourcePath, const QStringList &variantList)
-{
-#ifndef QT3DS_NO_SEARCH_PATH
- // We need these later on in case we try to load any files
- // such as images
- NvFSAppendSearchPath("/res");
- NvFSAppendSearchPath("/res/..");
- NvFSAppendSearchPath("/data");
-#endif
-
- bool theResult = false;
-
- qCInfo(TRACE_INFO) << "CTegraApplication::BeginLoad: Attempting presentation beginload";
-
- if (!sourcePath.isEmpty()) {
- // If there was a presentation file then we have to load it or something failed.
- if (m_NDDView->BeginLoad(sourcePath, variantList)) {
- qCInfo(TRACE_INFO)
- << "CTegraApplication::BeginLoad: Successfully begin loading presentation: "
- << sourcePath;
- theResult = true;
- } else {
- qCInfo(TRACE_INFO) << "CTegraApplication::BeginLoad: Failed to load presentation: "
- << sourcePath;
- theResult = false;
- }
- } else {
- // If there wasn't, then we are still in an OK state.
- qCInfo(TRACE_INFO) << "CTegraApplication::BeginLoad: Presentation file not provided";
- theResult = true;
- }
-
- qCInfo(TRACE_INFO) << "CTegraApplication::BeginLoad: End beginload";
- return theResult;
-}
-
-bool CTegraApplication::InitializeGraphics(const QSurfaceFormat &format)
-{
- return m_NDDView->InitializeGraphics(format);
-}
-
-void CTegraApplication::Render()
-{
- m_NDDView->Render();
-}
-
-bool CTegraApplication::HandleMessage(const QEvent *inEvent)
-{
- return m_NDDView->HandleMessage(inEvent);
-}
} // namespace Q3DStudio
diff --git a/src/Runtime/Source/engine/Qt3DSTegraApplication.h b/src/Runtime/Source/engine/Qt3DSRuntimeView.h
index 0b3ba635..87418c8e 100644
--- a/src/Runtime/Source/engine/Qt3DSTegraApplication.h
+++ b/src/Runtime/Source/engine/Qt3DSRuntimeView.h
@@ -28,8 +28,8 @@
**
****************************************************************************/
-#ifndef QT3DS_TEGRA_APPLICATION_H
-#define QT3DS_TEGRA_APPLICATION_H
+#ifndef QT3DS_RUNTIME_VIEW_H
+#define QT3DS_RUNTIME_VIEW_H
#include "EnginePrefix.h"
#include "Qt3DSIStateful.h"
@@ -52,7 +52,7 @@
typedef void (*qml_Function)(void *inUserData);
-class QINDDViewSignalProxy : public QObject
+class QRuntimeViewSignalProxy : public QObject
{
Q_OBJECT
Q_SIGNALS:
@@ -149,10 +149,10 @@ public:
qt3ds::foundation::Option<qt3ds::QT3DSVec3> inColor) = 0;
};
-class INDDView : public qt3ds::foundation::NVRefCounted
+class IRuntimeView : public qt3ds::foundation::NVRefCounted
{
public:
- virtual ~INDDView(){}
+ virtual ~IRuntimeView(){}
public: // loading
virtual bool BeginLoad(const QString &sourcePath, const QStringList &variantList) = 0;
@@ -208,140 +208,15 @@ public:
virtual void setAssetVisitor(qt3ds::Qt3DSAssetVisitor *) = 0;
public:
- static INDDView &Create(ITimeProvider &inProvider, IWindowSystem &inWindowSystem,
- IAudioPlayer *inAudioPlayer = NULL);
+ static IRuntimeView &Create(ITimeProvider &inProvider, IWindowSystem &inWindowSystem,
+ IAudioPlayer *inAudioPlayer = nullptr);
public:
- QINDDViewSignalProxy *signalProxy();
+ QRuntimeViewSignalProxy *signalProxy();
private:
- QINDDViewSignalProxy m_SignalProxy;
+ QRuntimeViewSignalProxy m_SignalProxy;
};
-class CTegraApplication
-{
- //==============================================================================
- // Fields
- //==============================================================================
-private:
- qt3ds::foundation::NVScopedRefCounted<INDDView> m_NDDView;
-
-public:
- CTegraApplication(ITimeProvider &inProvider, IWindowSystem &inWindowSystem,
- IAudioPlayer *inAudioPlayer = 0);
- virtual ~CTegraApplication();
- // loading
- bool BeginLoad(const QString &sourcePath, const QStringList &variantList);
- // asynchronous BeginLoad completed? That only valid for binary presentation, for text
- // presentation, always true
- bool HasOfflineLoadingCompleted() { return m_NDDView->HasOfflineLoadingCompleted(); }
- // Invokes m_ApplicationCore->CreateApplication(), a blocking function ensures binary loading
- // completed
- bool InitializeGraphics(const QSurfaceFormat& format);
-
- void Cleanup() { m_NDDView->Cleanup(); }
- bool CanRender() { return m_NDDView->CanRender(); }
- void Render();
- bool WasLastFrameDirty() { return m_NDDView->WasLastFrameDirty(); }
-
- bool HandleMessage(const QEvent *inEvent);
- void Pause() { m_NDDView->Pause(); }
- void UnPause() { m_NDDView->UnPause(); }
- bool IsPaused() { return m_NDDView->IsPaused(); }
- INT32 GetFrameCount() { return m_NDDView->GetFrameCount(); }
-
-public:
- CInputEngine *GetInputEngine() { return m_NDDView->GetInputEngine(); }
- // Only valid after InitializeGraphics
- ITegraApplicationRenderEngine *GetTegraRenderEngine()
- {
- return m_NDDView->GetTegraRenderEngine();
- }
-
-public:
- void GoToSlideByName(const char *elementPath, const char *slideName)
- {
- m_NDDView->GoToSlideByName(elementPath, slideName);
- }
- void GoToSlideByIndex(const char *elementPath, const int slideIndex)
- {
- m_NDDView->GoToSlideByIndex(elementPath, slideIndex);
- }
- void GoToSlideRelative(const char *elementPath, const bool next, const bool wrap)
- {
- m_NDDView->GoToSlideRelative(elementPath, next, wrap);
- }
- bool GetSlideInfo(const char *elementPath, int &currentIndex, int &previousIndex,
- QString &currentName, QString &previousName)
- {
- return m_NDDView->GetSlideInfo(elementPath, currentIndex, previousIndex,
- currentName, previousName);
- }
- void SetPresentationAttribute(const char *presId, const char *, const char *value)
- {
- m_NDDView->SetPresentationAttribute(presId, nullptr, value);
- }
- void GoToTime(const char *elementPath, const float time)
- {
- m_NDDView->GoToTime(elementPath, time);
- }
- void SetGlobalAnimationTime(qint64 inMilliSecs)
- {
- m_NDDView->SetGlobalAnimationTime(inMilliSecs);
- }
- void SetDataInputValue(const QString &name, const QVariant &value,
- Q3DSDataInput::ValueRole property = Q3DSDataInput::ValueRole::Value)
- {
- m_NDDView->SetDataInputValue(name, value, property);
- }
- QList<QString> dataInputs() const
- {
- return m_NDDView->dataInputs();
- }
- float datainputMax(const QString &name) const
- {
- return m_NDDView->dataInputMax(name);
- }
- float datainputMin(const QString &name) const
- {
- return m_NDDView->dataInputMin(name);
- }
- void SetAttribute(const char *elementPath, const char *attributeName, const char *value)
- {
- m_NDDView->SetAttribute(elementPath, attributeName, value);
- }
- bool GetAttribute(const char *elementPath, const char *attributeName, void *value)
- {
- return m_NDDView->GetAttribute(elementPath, attributeName, value);
- }
- void FireEvent(const char *element, const char *evtName)
- {
- m_NDDView->FireEvent(element, evtName);
- }
- bool PeekCustomAction(char *&outElementPath, char *&outActionName)
- {
- return m_NDDView->PeekCustomAction(outElementPath, outActionName);
- }
- bool RegisterScriptCallback(int callbackType, qml_Function func, void *inUserData)
- {
- return m_NDDView->RegisterScriptCallback(callbackType, func, inUserData);
- };
- void FireEvent(const TEventCommandHash inEventType, eastl::string inArgument)
- {
- m_NDDView->FireEvent(inEventType, inArgument);
- }
- qt3ds::foundation::Option<SPresentationSize> GetPrimaryPresentationSize()
- {
- return m_NDDView->GetPresentationSize();
- }
- qt3ds::foundation::NVScopedRefCounted<INDDView> getNDDView()
- {
- return m_NDDView;
- }
- void setPresentationId(const QString &id)
- {
- m_NDDView->setPresentationId(id);
- }
-};
} // namespace Q3DStudio
-#endif // QT3DS_TEGRA_APPLICATION_H
+#endif // QT3DS_RUNTIME_VIEW_H
diff --git a/src/Runtime/Source/engine/Qt3DSTegraInputEngine.h b/src/Runtime/Source/engine/Qt3DSTegraInputEngine.h
index 14047f16..29f20f29 100644
--- a/src/Runtime/Source/engine/Qt3DSTegraInputEngine.h
+++ b/src/Runtime/Source/engine/Qt3DSTegraInputEngine.h
@@ -35,7 +35,7 @@
// Includes
//==============================================================================
#include "Qt3DSInputEngine.h"
-#include "Qt3DSTegraApplication.h"
+#include "Qt3DSRuntimeView.h"
#include "Qt3DSInputEventTypes.h"
#include "Qt3DSPresentation.h"
diff --git a/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp b/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp
index 77581073..24d768e9 100644
--- a/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp
+++ b/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp
@@ -31,7 +31,7 @@
#include <algorithm>
#include "EnginePrefix.h"
-#include "Qt3DSTegraApplication.h"
+#include "Qt3DSRuntimeView.h"
#include "Qt3DSViewerApp.h"
#include "Qt3DSTegraInputEngine.h"
#include "Qt3DSInputFrame.h" // keyboard mapping
@@ -68,7 +68,7 @@ void EASTL_DEBUG_BREAK()
#include <ShellAPI.h>
#include "Qt3DSInputFrame.h"
-void HandleController(Q3DStudio::CTegraApplication &inApplication)
+void HandleController(Q3DStudio::IRuntimeView &inView)
{
static const class XInputLibrary
{
@@ -122,7 +122,7 @@ void HandleController(Q3DStudio::CTegraApplication &inApplication)
static DWORD userLastPacketNumber[MAX_USERS] = { 0 };
static WORD userLastButtons[MAX_USERS] = { 0 };
- Q3DStudio::CInputEngine *input = inApplication.GetInputEngine();
+ Q3DStudio::CInputEngine *input = inView.GetInputEngine();
if (input != NULL && library.GetState) {
// for each controller
for (DWORD userIndex = 0; userIndex < MAX_USERS; ++userIndex) {
@@ -222,7 +222,7 @@ struct SWindowSystemImpl : public Q3DStudio::IWindowSystem
}
// For platforms that support it, we get the egl info for render plugins
// Feel free to return NULL.
- SEGLInfo *GetEGLInfo() override { return NULL; }
+ SEGLInfo *GetEGLInfo() override { return nullptr; }
// on some systems we allow our default render target to be a offscreen buffer
// otherwise return 0;
int GetDefaultRenderTargetID() override { return m_OffscreenID; }
@@ -234,7 +234,7 @@ class Q3DSViewerAppImpl
{
public:
Q3DSViewerAppImpl(Q3DStudio::IAudioPlayer *inAudioPlayer)
- : m_tegraApp(0)
+ : m_view(nullptr)
, m_appInitSuccessful(false)
, m_AudioPlayer(inAudioPlayer)
{
@@ -242,8 +242,8 @@ public:
initResource();
#endif
}
- Q3DStudio::CTegraApplication *m_tegraApp; ///< pointer to internal "tegra appliction"
- bool m_appInitSuccessful; ///< true if m_tegraApp is initialized successful
+ Q3DStudio::IRuntimeView *m_view;
+ bool m_appInitSuccessful; ///< true if m_view is initialized successful
std::vector<int> m_mouseButtons;
Q3DStudio::IWindowSystem *m_WindowSystem;
@@ -278,11 +278,11 @@ Q3DSViewerApp::~Q3DSViewerApp()
delete m_Impl.m_AudioPlayer;
- if (m_Impl.m_tegraApp) {
- disconnect(m_Impl.m_tegraApp->getNDDView()->signalProxy(), 0);
+ if (m_Impl.m_view) {
+ disconnect(m_Impl.m_view->signalProxy(), nullptr);
- m_Impl.m_tegraApp->Cleanup();
- Q3DStudio_virtual_delete(m_Impl.m_tegraApp, CTegraApplication);
+ m_Impl.m_view->Cleanup();
+ m_Impl.m_view->release();
if (GetMemoryManager().GetLineTracker())
GetMemoryManager().GetLineTracker()->Report();
@@ -296,8 +296,8 @@ void Q3DSViewerApp::setOffscreenId(int offscreenID)
{
static_cast<SWindowSystemImpl *>(m_Impl.m_WindowSystem)->m_OffscreenID
= offscreenID;
- if (m_Impl.m_tegraApp && m_Impl.m_tegraApp->GetTegraRenderEngine())
- m_Impl.m_tegraApp->GetTegraRenderEngine()->ensureRenderTarget();
+ if (m_Impl.m_view && m_Impl.m_view->GetTegraRenderEngine())
+ m_Impl.m_view->GetTegraRenderEngine()->ensureRenderTarget();
}
bool Q3DSViewerApp::InitializeApp(int winWidth, int winHeight, const QSurfaceFormat &format,
@@ -318,37 +318,19 @@ bool Q3DSViewerApp::InitializeApp(int winWidth, int winHeight, const QSurfaceFor
m_Impl.m_WindowSystem->SetWindowDimensions(QSize(winWidth, winHeight));
// create our internal application
- if (hasValidPresentationFile && !m_Impl.m_tegraApp) {
+ if (hasValidPresentationFile && !m_Impl.m_view) {
static_cast<SWindowSystemImpl *>(m_Impl.m_WindowSystem)->m_OffscreenID = offscreenID;
static_cast<SWindowSystemImpl *>(m_Impl.m_WindowSystem)->m_DepthBitCount
= format.depthBufferSize();
- // create memory manager
- // GetMemoryManager( ).Initialize( "GlobalManager", g_ChunkSize, g_ChunkCount );
// create internal app
- m_Impl.m_tegraApp = Q3DStudio_virtual_new(CTegraApplication)
- CTegraApplication(g_GlobalTimeProvider, *m_Impl.m_WindowSystem,
- m_Impl.m_AudioPlayer);
+ m_Impl.m_view = &IRuntimeView::Create(g_GlobalTimeProvider, *m_Impl.m_WindowSystem,
+ m_Impl.m_AudioPlayer);
if (assetVisitor)
- m_Impl.m_tegraApp->getNDDView()->setAssetVisitor(assetVisitor);
+ m_Impl.m_view->setAssetVisitor(assetVisitor);
- m_Impl.m_appInitSuccessful = m_Impl.m_tegraApp->BeginLoad(source, variantList);
-
- // Simulate killing the application during loading. Useful for finding serious issues with
- // loading.
- /*for ( unsigned idx = 0; idx < 100; ++idx )
- {
- Sleep( 10*idx );
- m_Impl.m_tegraApp->Cleanup();
- Q3DStudio_virtual_delete( m_Impl.m_tegraApp, CTegraApplication );
-
- m_Impl.m_tegraApp =
- Q3DStudio_virtual_new(CTegraApplication)CTegraApplication(g_GlobalTimeProvider,
- *m_Impl.m_WindowSystem);
- m_Impl.m_appInitSuccessful = m_Impl.m_tegraApp->BeginLoad( viewerArgs ) ? true :
- false;
- }*/
+ m_Impl.m_appInitSuccessful = m_Impl.m_view->BeginLoad(source, variantList);
if (m_Impl.m_appInitSuccessful == false) {
m_Impl.m_error = QObject::tr("Viewer launch failure! Failed to load: '%1'").arg(source);
@@ -357,7 +339,7 @@ bool Q3DSViewerApp::InitializeApp(int winWidth, int winHeight, const QSurfaceFor
return false;
}
- bool success = m_Impl.m_tegraApp->InitializeGraphics(format);
+ bool success = m_Impl.m_view->InitializeGraphics(format);
if (!success) {
m_Impl.m_error = QObject::tr("Viewer launch failure! Failed to load: '%1'").arg(source);
m_Impl.m_error.append("\n");
@@ -366,12 +348,12 @@ bool Q3DSViewerApp::InitializeApp(int winWidth, int winHeight, const QSurfaceFor
}
// Connect signals
- connect(m_Impl.m_tegraApp->getNDDView()->signalProxy(),
- &QINDDViewSignalProxy::SigSlideEntered, this, &Q3DSViewerApp::SigSlideEntered);
- connect(m_Impl.m_tegraApp->getNDDView()->signalProxy(),
- &QINDDViewSignalProxy::SigSlideExited, this, &Q3DSViewerApp::SigSlideExited);
- connect(m_Impl.m_tegraApp->getNDDView()->signalProxy(),
- &QINDDViewSignalProxy::SigCustomSignal, this, &Q3DSViewerApp::SigCustomSignal);
+ connect(m_Impl.m_view->signalProxy(),
+ &QRuntimeViewSignalProxy::SigSlideEntered, this, &Q3DSViewerApp::SigSlideEntered);
+ connect(m_Impl.m_view->signalProxy(),
+ &QRuntimeViewSignalProxy::SigSlideExited, this, &Q3DSViewerApp::SigSlideExited);
+ connect(m_Impl.m_view->signalProxy(),
+ &QRuntimeViewSignalProxy::SigCustomSignal, this, &Q3DSViewerApp::SigCustomSignal);
Resize(winWidth, winHeight);
@@ -382,7 +364,7 @@ bool Q3DSViewerApp::InitializeApp(int winWidth, int winHeight, const QSurfaceFor
bool Q3DSViewerApp::IsInitialised(void)
{
- return m_Impl.m_tegraApp != NULL && m_Impl.m_appInitSuccessful == true;
+ return m_Impl.m_view != nullptr && m_Impl.m_appInitSuccessful;
}
int Q3DSViewerApp::GetWindowHeight()
@@ -420,30 +402,30 @@ void Q3DSViewerApp::setupSearchPath(std::vector<std::string> &cmdLineArgs)
void Q3DSViewerApp::Render()
{
- if (m_Impl.m_tegraApp && m_Impl.m_tegraApp->GetTegraRenderEngine()) {
+ if (m_Impl.m_view && m_Impl.m_view->GetTegraRenderEngine()) {
if (m_Impl.m_appInitSuccessful) {
for (QEvent *e : m_Impl.m_pendingEvents) {
- m_Impl.m_tegraApp->HandleMessage(e);
+ m_Impl.m_view->HandleMessage(e);
delete e;
}
m_Impl.m_pendingEvents.clear();
#ifdef WIN32
- HandleController(*m_Impl.m_tegraApp);
+ HandleController(*m_Impl.m_view);
#endif
- m_Impl.m_tegraApp->Render();
+ m_Impl.m_view->Render();
}
}
}
void Q3DSViewerApp::SaveState()
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- if (m_Impl.m_tegraApp->GetTegraRenderEngine()) {
+ if (m_Impl.m_view->GetTegraRenderEngine()) {
ITegraRenderStateManager &manager =
- m_Impl.m_tegraApp->GetTegraRenderEngine()->GetTegraRenderStateManager();
+ m_Impl.m_view->GetTegraRenderEngine()->GetTegraRenderStateManager();
manager.SaveAllState();
}
@@ -451,12 +433,12 @@ void Q3DSViewerApp::SaveState()
void Q3DSViewerApp::RestoreState()
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- if (m_Impl.m_tegraApp->GetTegraRenderEngine()) {
+ if (m_Impl.m_view->GetTegraRenderEngine()) {
ITegraRenderStateManager &manager =
- m_Impl.m_tegraApp->GetTegraRenderEngine()->GetTegraRenderStateManager();
+ m_Impl.m_view->GetTegraRenderEngine()->GetTegraRenderStateManager();
manager.RestoreAllState();
}
@@ -464,8 +446,8 @@ void Q3DSViewerApp::RestoreState()
bool Q3DSViewerApp::WasLastFrameDirty()
{
- if (m_Impl.m_tegraApp)
- return m_Impl.m_tegraApp->WasLastFrameDirty();
+ if (m_Impl.m_view)
+ return m_Impl.m_view->WasLastFrameDirty();
return false;
}
@@ -482,29 +464,29 @@ void Q3DSViewerApp::Resize(int width, int height)
QSize newSize(width, height);
m_Impl.m_WindowSystem->SetWindowDimensions(newSize);
- if (m_Impl.m_appInitSuccessful && m_Impl.m_tegraApp
- && m_Impl.m_tegraApp->GetTegraRenderEngine()) {
+ if (m_Impl.m_appInitSuccessful && m_Impl.m_view
+ && m_Impl.m_view->GetTegraRenderEngine()) {
QResizeEvent event = QResizeEvent(newSize, oldSize);
- m_Impl.m_tegraApp->HandleMessage(&event);
+ m_Impl.m_view->HandleMessage(&event);
}
}
void Q3DSViewerApp::HandleKeyInput(Q3DStudio::EKeyCode inKeyCode, bool isPressed)
{
- if (!m_Impl.m_tegraApp || inKeyCode == Q3DStudio::KEY_NOKEY)
+ if (!m_Impl.m_view || inKeyCode == Q3DStudio::KEY_NOKEY)
return;
- CInputEngine *input = m_Impl.m_tegraApp->GetInputEngine();
+ CInputEngine *input = m_Impl.m_view->GetInputEngine();
if (input)
input->HandleKeyboard(inKeyCode, isPressed);
}
void Q3DSViewerApp::HandleMouseMove(int x, int y, bool isPressed)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- CInputEngine *input = m_Impl.m_tegraApp->GetInputEngine();
+ CInputEngine *input = m_Impl.m_view->GetInputEngine();
if (input) {
input->BeginPickInput();
input->EndPickInput();
@@ -516,7 +498,7 @@ void Q3DSViewerApp::HandleMouseMove(int x, int y, bool isPressed)
void Q3DSViewerApp::HandleMousePress(int x, int y, int mouseButton, bool isPressed)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
bool hasButton
@@ -539,14 +521,14 @@ void Q3DSViewerApp::HandleMousePress(int x, int y, int mouseButton, bool isPress
m_Impl.m_mouseButtons.push_back(mouseButton);
qCInfo(qt3ds::TRACE_INFO)
<< "ViewerApp: Mouse down of frame "
- << m_Impl.m_tegraApp->GetFrameCount();
+ << m_Impl.m_view->GetFrameCount();
} else {
m_Impl.m_mouseButtons.erase(std::remove(m_Impl.m_mouseButtons.begin(),
m_Impl.m_mouseButtons.end(), mouseButton),
m_Impl.m_mouseButtons.end());
}
- CInputEngine *input = m_Impl.m_tegraApp->GetInputEngine();
+ CInputEngine *input = m_Impl.m_view->GetInputEngine();
if (input) {
input->BeginPickInput();
@@ -562,10 +544,10 @@ void Q3DSViewerApp::HandleMousePress(int x, int y, int mouseButton, bool isPress
void Q3DSViewerApp::HandleMouseWheel(int x, int y, int orientation, int numSteps)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- CInputEngine *input = m_Impl.m_tegraApp->GetInputEngine();
+ CInputEngine *input = m_Impl.m_view->GetInputEngine();
if (input) {
input->SetPickInput(static_cast<Q3DStudio::FLOAT>(x), static_cast<Q3DStudio::FLOAT>(y), 0);
input->SetScrollValue(orientation == 0 ? VSCROLLWHEEL : HSCROLLWHEEL, numSteps);
@@ -574,52 +556,52 @@ void Q3DSViewerApp::HandleMouseWheel(int x, int y, int orientation, int numSteps
void Q3DSViewerApp::GoToSlideByName(const char *elementPath, const char *slideName)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->GoToSlideByName(elementPath, slideName);
+ m_Impl.m_view->GoToSlideByName(elementPath, slideName);
}
void Q3DSViewerApp::GoToSlideByIndex(const char *elementPath, const int slideIndex)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->GoToSlideByIndex(elementPath, slideIndex);
+ m_Impl.m_view->GoToSlideByIndex(elementPath, slideIndex);
}
void Q3DSViewerApp::GoToSlideRelative(const char *elementPath, const bool next, const bool wrap)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->GoToSlideRelative(elementPath, next, wrap);
+ m_Impl.m_view->GoToSlideRelative(elementPath, next, wrap);
}
bool Q3DSViewerApp::GetSlideInfo(const char *elementPath, int &currentIndex, int &previousIndex,
QString &currentName, QString &previousName)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return false;
- return m_Impl.m_tegraApp->GetSlideInfo(elementPath, currentIndex, previousIndex,
+ return m_Impl.m_view->GetSlideInfo(elementPath, currentIndex, previousIndex,
currentName, previousName);
}
void Q3DSViewerApp::SetPresentationActive(const char *presId, const bool active)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->SetPresentationAttribute(presId, nullptr, active ? "True" : "False");
+ m_Impl.m_view->SetPresentationAttribute(presId, nullptr, active ? "True" : "False");
}
void Q3DSViewerApp::GoToTime(const char *elementPath, const float time)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->GoToTime(elementPath, time);
+ m_Impl.m_view->GoToTime(elementPath, time);
}
void Q3DSViewerApp::PlaySoundFile(const char *soundPath)
@@ -633,36 +615,36 @@ void Q3DSViewerApp::PlaySoundFile(const char *soundPath)
void Q3DSViewerApp::SetAttribute(const char *elementPath, const char *attributeName,
const char *value)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->SetAttribute(elementPath, attributeName, value);
+ m_Impl.m_view->SetAttribute(elementPath, attributeName, value);
}
bool Q3DSViewerApp::GetAttribute(const char *elementPath, const char *attributeName, void *value)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return false;
- return m_Impl.m_tegraApp->GetAttribute(elementPath, attributeName, value);
+ return m_Impl.m_view->GetAttribute(elementPath, attributeName, value);
}
void Q3DSViewerApp::FireEvent(const char *elementPath, const char *evtName)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->FireEvent(elementPath, evtName);
+ m_Impl.m_view->FireEvent(elementPath, evtName);
}
bool Q3DSViewerApp::PeekCustomAction(std::string &outElementPath, std::string &outActionName)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return false;
- char *theElementPath = NULL;
- char *theActioName = NULL;
- bool retVal = m_Impl.m_tegraApp->PeekCustomAction(theElementPath, theActioName);
+ char *theElementPath = nullptr;
+ char *theActioName = nullptr;
+ bool retVal = m_Impl.m_view->PeekCustomAction(theElementPath, theActioName);
if (theElementPath)
outElementPath = theElementPath;
@@ -675,7 +657,7 @@ bool Q3DSViewerApp::PeekCustomAction(std::string &outElementPath, std::string &o
bool Q3DSViewerApp::RegisterScriptCallback(ViewerCallbackType::Enum inCallbackType,
const qml_Function inCallback, void *inUserData)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return false;
// convert to int
@@ -687,24 +669,24 @@ bool Q3DSViewerApp::RegisterScriptCallback(ViewerCallbackType::Enum inCallbackTy
else
return false;
- bool retVal = m_Impl.m_tegraApp->RegisterScriptCallback(callbackType, inCallback, inUserData);
+ bool retVal = m_Impl.m_view->RegisterScriptCallback(callbackType, inCallback, inUserData);
return retVal;
}
void Q3DSViewerApp::SetScaleMode(ViewerScaleModes::Enum inScale)
{
- if (m_Impl.m_tegraApp && m_Impl.m_tegraApp->GetTegraRenderEngine()) {
- m_Impl.m_tegraApp->GetTegraRenderEngine()->SetScaleMode(
+ if (m_Impl.m_view && m_Impl.m_view->GetTegraRenderEngine()) {
+ m_Impl.m_view->GetTegraRenderEngine()->SetScaleMode(
static_cast<TegraRenderScaleModes::Enum>(inScale));
}
}
ViewerScaleModes::Enum Q3DSViewerApp::GetScaleMode()
{
- if (m_Impl.m_tegraApp && m_Impl.m_tegraApp->GetTegraRenderEngine()) {
+ if (m_Impl.m_view && m_Impl.m_view->GetTegraRenderEngine()) {
return static_cast<ViewerScaleModes::Enum>(
- m_Impl.m_tegraApp->GetTegraRenderEngine()->GetScaleMode());
+ m_Impl.m_view->GetTegraRenderEngine()->GetScaleMode());
}
return ViewerScaleModes::ExactSize;
@@ -712,8 +694,8 @@ ViewerScaleModes::Enum Q3DSViewerApp::GetScaleMode()
void Q3DSViewerApp::setMatteColor(const QColor &color)
{
- if (m_Impl.m_tegraApp && m_Impl.m_tegraApp->GetTegraRenderEngine()) {
- m_Impl.m_tegraApp->GetTegraRenderEngine()->SetMatteColor(
+ if (m_Impl.m_view && m_Impl.m_view->GetTegraRenderEngine()) {
+ m_Impl.m_view->GetTegraRenderEngine()->SetMatteColor(
qt3ds::QT3DSVec4(color.redF(), color.greenF(),
color.blueF(), color.alphaF()));
}
@@ -721,71 +703,71 @@ void Q3DSViewerApp::setMatteColor(const QColor &color)
void Q3DSViewerApp::setShowOnScreenStats(bool inShow)
{
- if (m_Impl.m_tegraApp && m_Impl.m_tegraApp->GetTegraRenderEngine())
- m_Impl.m_tegraApp->getNDDView()->showOnScreenStats(inShow);
+ if (m_Impl.m_view && m_Impl.m_view->GetTegraRenderEngine())
+ m_Impl.m_view->showOnScreenStats(inShow);
}
void Q3DSViewerApp::SetShadeMode(ViewerShadeModes::Enum inShadeMode)
{
- if (m_Impl.m_tegraApp && m_Impl.m_tegraApp->GetTegraRenderEngine()) {
+ if (m_Impl.m_view && m_Impl.m_view->GetTegraRenderEngine()) {
StaticAssert<ViewerShadeModes::Shaded == TegraRenderShadeModes::Shaded>::valid_expression();
StaticAssert<ViewerShadeModes::ShadedWireframe
== TegraRenderShadeModes::ShadedWireframe>::valid_expression();
StaticAssert<ViewerShadeModes::Wireframe
== TegraRenderShadeModes::Wireframe>::valid_expression();
- m_Impl.m_tegraApp->GetTegraRenderEngine()->SetShadeMode(
+ m_Impl.m_view->GetTegraRenderEngine()->SetShadeMode(
static_cast<TegraRenderShadeModes::Enum>(inShadeMode));
}
}
void Q3DSViewerApp::SetGlobalAnimationTime(qint64 inMilliSecs)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->SetGlobalAnimationTime(inMilliSecs);
+ m_Impl.m_view->SetGlobalAnimationTime(inMilliSecs);
}
void Q3DSViewerApp::SetDataInputValue(
const QString &name, const QVariant &value, Q3DSDataInput::ValueRole valueRole)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->SetDataInputValue(name, value, valueRole);
+ m_Impl.m_view->SetDataInputValue(name, value, valueRole);
}
void Q3DSViewerApp::setPresentationId(const QString &id)
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return;
- m_Impl.m_tegraApp->setPresentationId(id);
+ m_Impl.m_view->setPresentationId(id);
}
QList<QString> Q3DSViewerApp::dataInputs() const
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return {};
- return m_Impl.m_tegraApp->dataInputs();
+ return m_Impl.m_view->dataInputs();
}
float Q3DSViewerApp::dataInputMax(const QString &name) const
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return 0.0f;
- return m_Impl.m_tegraApp->datainputMax(name);
+ return m_Impl.m_view->dataInputMax(name);
}
float Q3DSViewerApp::dataInputMin(const QString &name) const
{
- if (!m_Impl.m_tegraApp)
+ if (!m_Impl.m_view)
return 0.0f;
- return m_Impl.m_tegraApp->datainputMin(name);
+ return m_Impl.m_view->dataInputMin(name);
}
Q3DSViewerApp &Q3DSViewerApp::Create(void *glContext, Q3DStudio::IAudioPlayer *inAudioPlayer)
diff --git a/src/Runtime/Source/viewer/Qt3DSViewerApp.h b/src/Runtime/Source/viewer/Qt3DSViewerApp.h
index d89c4706..65dcda0a 100644
--- a/src/Runtime/Source/viewer/Qt3DSViewerApp.h
+++ b/src/Runtime/Source/viewer/Qt3DSViewerApp.h
@@ -42,7 +42,7 @@
#include <QtGui/qsurfaceformat.h>
namespace Q3DStudio {
-class CTegraApplication;
+class IRuntimeView;
class IWindowSystem;
class IAudioPlayer;
}