END_TEST;
}
+int UtcDaliApplicationSetViewModeN(void)
+{
+ Application application;
+
+ try
+ {
+ application.SetViewMode( STEREO_VERTICAL );
+ DALI_TEST_CHECK( false ); // Should not get here
+ }
+ catch( ... )
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliApplicationGetViewModeN(void)
+{
+ Application application;
+
+ try
+ {
+ (void) application.GetViewMode();
+ DALI_TEST_CHECK( false ); // Should not get here
+ }
+ catch( ... )
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliApplicationSetStereoBaseN(void)
+{
+ Application application;
+
+ try
+ {
+ application.SetStereoBase( 1.0f );
+ DALI_TEST_CHECK( false ); // Should not get here
+ }
+ catch( ... )
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliApplicationGetStereoBaseN(void)
+{
+ Application application;
+
+ try
+ {
+ (void) application.GetStereoBase();
+ DALI_TEST_CHECK( false ); // Should not get here
+ }
+ catch( ... )
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
int UtcDaliApplicationInitSignalP(void)
{
Application application = Application::New();
void SceneCreated();
/**
+ * @copydoc Dali::Application::SetViewMode();
+ */
+ void SetViewMode( ViewMode viewMode );
+
+ /**
+ * @copydoc Dali::Application::SetStereoBase();
+ */
+ void SetStereoBase( float stereoBase );
+
+ /**
* @brief Renders once more even if we're paused
* @note Will not work if the window is hidden.
*/
virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
/**
+ * @brief Set the stereoscopic 3D view mode
+ * @param[in] viewMode The new view mode
+ */
+ virtual void SetViewMode( ViewMode viewMode ) = 0;
+
+ /**
* @brief Called when Render thread has started
*/
virtual void StartRender() = 0;
gThreadLocalAdaptor = this;
}
+// Stereoscopy
+
+void Adaptor::SetViewMode( ViewMode viewMode )
+{
+ WindowPane defaultWindow = mWindowFrame.front();
+ defaultWindow.surface->SetViewMode( viewMode );
+
+ mCore->SetViewMode( viewMode );
+}
+
+ViewMode Adaptor::GetViewMode() const
+{
+ return mCore->GetViewMode();
+}
+
+void Adaptor::SetStereoBase( float stereoBase )
+{
+ mCore->SetStereoBase( stereoBase );
+}
+
+float Adaptor::GetStereoBase() const
+{
+ return mCore->GetStereoBase();
+}
+
void Adaptor::SetRootLayoutDirection( std::string locale )
{
Dali::Stage stage = Dali::Stage::GetCurrent();
*/
virtual TraceInterface& GetSystemTraceInterface();
+public: // Stereoscopy
+
+ /**
+ * @copydoc Dali::Integration::Core::SetViewMode()
+ */
+ void SetViewMode( ViewMode viewMode );
+
+ /**
+ * @copydoc Dali::Integration::Core::GetViewMode()
+ */
+ ViewMode GetViewMode() const;
+
+ /**
+ * @copydoc Dali::Integration::Core::SetStereoBase()
+ */
+ void SetStereoBase( float stereoBase );
+
+ /**
+ * @copydoc Dali::Integration::Core::GetStereoBase()
+ */
+ float GetStereoBase() const;
+
public: // Signals
/**
mImpl->SceneCreated();
}
+void Adaptor::SetViewMode( ViewMode mode )
+{
+ mImpl->SetViewMode( mode );
+}
+
+void Adaptor::SetStereoBase( float stereoBase )
+{
+ mImpl->SetStereoBase( stereoBase );
+}
+
void Adaptor::RenderOnce()
{
mImpl->RenderOnce();
mAdaptor->SetUseHardwareVSync(false);
}
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetStereoBase( mCommandLineOptions->stereoBase );
+ if( mCommandLineOptions->viewMode != 0 )
+ {
+ ViewMode viewMode = MONO;
+ if( mCommandLineOptions->viewMode <= STEREO_INTERLACED )
+ {
+ viewMode = static_cast<ViewMode>( mCommandLineOptions->viewMode );
+ }
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetViewMode( viewMode );
+ }
+
if( ! mStylesheet.empty() )
{
Dali::StyleMonitor::Get().SetTheme( mStylesheet );
return mMainWindow;
}
+// Stereoscopy
+
+void Application::SetViewMode( ViewMode viewMode )
+{
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetViewMode( viewMode );
+}
+
+ViewMode Application::GetViewMode() const
+{
+ return Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).GetViewMode();
+}
+
+void Application::SetStereoBase( float stereoBase )
+{
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetStereoBase( stereoBase );
+}
+
+float Application::GetStereoBase() const
+{
+ return Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).GetStereoBase();
+}
+
void Application::ReplaceWindow( const PositionSize& positionSize, const std::string& name )
{
Dali::Window newWindow = Dali::Window::New( positionSize, name, mMainWindowMode == Dali::Application::TRANSPARENT );
*/
static ApplicationPtr GetPreInitializedApplication();
+public: // Stereoscopy
+
+ /**
+ * @copydoc Dali::Application::SetViewMode()
+ */
+ void SetViewMode( ViewMode viewMode );
+
+ /**
+ * @copydoc Dali::Application::GetViewMode()
+ */
+ ViewMode GetViewMode() const;
+
+ /**
+ * @copydoc Dali::Application::SetStereoBase()
+ */
+ void SetStereoBase( float stereoBase );
+
+ /**
+ * @copydoc Dali::Application::GetStereoBase()
+ */
+ float GetStereoBase() const;
+
public: // Lifecycle functionality
/**
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{ "width", "Stage Width" },
{ "height", "Stage Height" },
{ "dpi", "Emulated DPI" },
+ { "view", "Stereocopic 3D view mode ([0]=MONO, 1=STEREO_HORIZONTAL, 2=STEREO_VERTICAL, 3=STEREO_INTERLACED)" },
+ { "stereo-base", "Distance in millimeters between left/right cameras [65.0]" },
{ "help", "Help" },
{ NULL, NULL }
};
OPTION_STAGE_WIDTH,
OPTION_STAGE_HEIGHT,
OPTION_DPI,
+ OPTION_STEREO_MODE,
+ OPTION_STEREO_BASE,
OPTION_HELP
};
-typedef Dali::Vector< int32_t > UnhandledContainer;
+typedef Dali::Vector< int > UnhandledContainer;
void ShowHelp()
{
} // unnamed namespace
-CommandLineOptions::CommandLineOptions(int32_t *argc, char **argv[])
+CommandLineOptions::CommandLineOptions(int *argc, char **argv[])
: noVSyncOnRender(0),
- stageWidth(0), stageHeight(0)
+ stageWidth(0), stageHeight(0),
+ viewMode(0),
+ stereoBase(65)
{
// Exit gracefully if no arguments provided
if ( !argc || !argv )
if ( *argc > 1 )
{
// We do not want to print out errors.
- int32_t origOptErrValue( opterr );
+ int origOptErrValue( opterr );
opterr = 0;
- int32_t help( 0 );
+ int help( 0 );
const struct option options[]=
{
{ EXPECTED_ARGS[OPTION_STAGE_WIDTH].opt, required_argument, NULL, 'w' }, // "--width"
{ EXPECTED_ARGS[OPTION_STAGE_HEIGHT].opt, required_argument, NULL, 'h' }, // "--height"
{ EXPECTED_ARGS[OPTION_DPI].opt, required_argument, NULL, 'd' }, // "--dpi"
+ { EXPECTED_ARGS[OPTION_STEREO_MODE].opt, required_argument, NULL, 'v' }, // "--view"
+ { EXPECTED_ARGS[OPTION_STEREO_BASE].opt, required_argument, NULL, 's' }, // "--stereo-base"
{ EXPECTED_ARGS[OPTION_HELP].opt, no_argument, &help, '?' }, // "--help"
{ 0, 0, 0, 0 } // end of options
};
- int32_t shortOption( 0 );
- int32_t optionIndex( 0 );
+ int shortOption( 0 );
+ int optionIndex( 0 );
- const char* optString = "-w:h:d:"; // The '-' ensures that argv is NOT permuted
+ const char* optString = "-w:h:d:v:s:"; // The '-' ensures that argv is NOT permuted
bool optionProcessed( false );
UnhandledContainer unhandledOptions; // We store indices of options we do not handle here
break;
}
+ case 'v':
+ {
+ if ( optarg )
+ {
+ viewMode = atoi(optarg);
+ optionProcessed = true;
+ }
+ break;
+ }
+
+ case 's':
+ {
+ if ( optarg )
+ {
+ stereoBase = atoi(optarg);
+ optionProcessed = true;
+ }
+ break;
+ }
+
case -1:
{
// All command-line options have been parsed.
{
if ( unhandledOptions.Count() > 0 )
{
- int32_t index( 1 );
+ int index( 1 );
// Overwrite the argv with the values from the unhandled indices
const UnhandledContainer::ConstIterator endIter = unhandledOptions.End();
#define __DALI_INTERNAL_COMMAND_LINE_OPTIONS_H__
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <string>
-#include <cstdint> // int32_t
namespace Dali
{
* -w|--width Stage Width
* -h|--height Stage Height
* -d|--dpi Emulated DPI
+ * -v|--view Viewing mode
+ * -s|--stereo-base Eye separation for stereoscopic rendering (in mm)
* --help Help
* @endcode
*
* @param[in,out] argv The argument list
* @note Supported options are stripped from argv, and argc is updated appropriately.
*/
- CommandLineOptions( int32_t *argc, char **argv[] );
+ CommandLineOptions(int *argc, char **argv[]);
/**
* Destructor
public: // Command line parsed values
- int32_t noVSyncOnRender; ///< If 1, then the user does not want VSync on Render
- int32_t stageWidth; ///< The width of the stage required. 0 if not set.
- int32_t stageHeight; ///< The height of the stage required. 0 if not set.
- std::string stageDPI; ///< DPI stored as hxv, where h is horizontal DPI and v is vertical DPI
+ int noVSyncOnRender; ///< If 1, then the user does not want VSync on Render
+ int stageWidth; ///< The width of the stage required. 0 if not set.
+ int stageHeight; ///< The height of the stage required. 0 if not set.
+ int viewMode; ///< Stereocopic 3D view mode (0=MONO, 1=STEREO_HORIZONTAL, 2=STEREO_VERTICAL, 3=STEREO_INTERLACED)
+ int stereoBase; ///< The distance in millimeters between left/right cameras
+ std::string stageDPI; ///< DPI stored as hxv, where h is horizontal DPI and v is vertical DPI
};
} // namespace Adaptor
virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
/**
+ * @brief Set the stereoscopic 3D view mode
+ * @param[in] viewMode The new view mode
+ */
+ virtual void SetViewMode( ViewMode viewMode ) = 0;
+
+ /**
* @brief Get the screen rotation angle of the window
*/
virtual int GetScreenRotationAngle() = 0;
DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::MoveResize: %d, %d, %d, %d\n", mPositionSize.x, mPositionSize.y, mPositionSize.width, mPositionSize.height );
}
+void WindowRenderSurface::SetViewMode( ViewMode viewMode )
+{
+ mWindowBase->SetViewMode( viewMode );
+}
+
void WindowRenderSurface::StartRender()
{
}
virtual void MoveResize( Dali::PositionSize positionSize) override;
/**
+ * @copydoc Dali::RenderSurface::SetViewMode()
+ */
+ virtual void SetViewMode( ViewMode viewMode ) override;
+
+ /**
* @copydoc Dali::RenderSurface::StartRender()
*/
virtual void StartRender() override;
dpiVertical = int( yres + 0.5f );
}
+void WindowBaseEcoreWl::SetViewMode( ViewMode viewMode )
+{
+}
+
int WindowBaseEcoreWl::GetScreenRotationAngle()
{
int transform = 0;
virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetViewMode()
+ */
+ virtual void SetViewMode( ViewMode viewMode ) override;
+
+ /**
* @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
*/
virtual int GetScreenRotationAngle() override;
dpiVertical = int( yres + 0.5f );
}
+void WindowBaseEcoreWl2::SetViewMode( ViewMode viewMode )
+{
+}
+
int WindowBaseEcoreWl2::GetScreenRotationAngle()
{
int transform = 0;
virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetViewMode()
+ */
+ virtual void SetViewMode( ViewMode viewMode ) override;
+
+ /**
* @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
*/
virtual int GetScreenRotationAngle() override;
{
}
+void NativeRenderSurfaceEcoreWl::SetViewMode( ViewMode viewMode )
+{
+}
+
void NativeRenderSurfaceEcoreWl::StartRender()
{
}
virtual void MoveResize( Dali::PositionSize positionSize) override;
/**
+ * @copydoc Dali::RenderSurface::SetViewMode()
+ */
+ virtual void SetViewMode( ViewMode viewMode ) override;
+
+ /**
* @copydoc Dali::RenderSurface::StartRender()
*/
virtual void StartRender() override;
virtual void MoveResize( Dali::PositionSize positionSize) override {}
/**
+ * @copydoc Dali::RenderSurface::SetViewMode()
+ */
+ void SetViewMode( ViewMode viewMode ) override {}
+
+ /**
* @copydoc Dali::RenderSurface::StartRender()
*/
virtual void StartRender() override;
dpiVertical = int( yres + 0.5f );
}
+void WindowBaseEcoreX::SetViewMode( ViewMode viewMode )
+{
+ Ecore_X_Atom viewModeAtom( ecore_x_atom_get( "_E_COMP_3D_APP_WIN" ) );
+
+ if( viewModeAtom != None )
+ {
+ unsigned int value( static_cast< unsigned int >( viewMode ) );
+ ecore_x_window_prop_card32_set( mEcoreWindow, viewModeAtom, &value, 1 );
+ }
+}
+
int WindowBaseEcoreX::GetScreenRotationAngle()
{
return 0;
virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetViewMode()
+ */
+ virtual void SetViewMode( ViewMode viewMode ) override;
+
+ /**
* @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
*/
virtual int GetScreenRotationAngle() override;
return Internal::Adaptor::GetImplementation(*this).GetLanguage();
}
-void Application::SetViewMode( ViewMode /*viewMode*/ )
+void Application::SetViewMode( ViewMode viewMode )
{
+ Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
}
ViewMode Application::GetViewMode() const
{
- return ViewMode::MONO;
+ return Internal::Adaptor::GetImplementation(*this).GetViewMode();
}
-void Application::SetStereoBase( float /*stereoBase*/ )
+void Application::SetStereoBase( float stereoBase )
{
+ Internal::Adaptor::GetImplementation(*this).SetStereoBase( stereoBase );
}
float Application::GetStereoBase() const
{
- return 0.f;
+ return Internal::Adaptor::GetImplementation(*this).GetStereoBase();
}
Application::AppSignalType& Application::InitSignal()
* @brief Sets the viewing mode for the application.
* @SINCE_1_0.0
* @param[in] viewMode The new viewing mode
- * @DEPRECATED_1_3.39
*/
void SetViewMode( ViewMode viewMode );
* @brief Gets the current viewing mode.
* @SINCE_1_0.0
* @return The current viewing mode
- * @DEPRECATED_1_3.39
*/
ViewMode GetViewMode() const;
* between 50mm and 70mm. The default value is 65mm.
* @SINCE_1_0.0
* @param[in] stereoBase The stereo base (eye separation) for Stereoscopic 3D
- * @DEPRECATED_1_3.39
*/
void SetStereoBase( float stereoBase );
*
* @SINCE_1_0.0
* @return The stereo base (eye separation) for Stereoscopic 3D
- * @DEPRECATED_1_3.39
*/
float GetStereoBase() const;