2017-11-16 12:20:21 +01:00
|
|
|
#pragma once
|
2017-11-24 07:28:17 +01:00
|
|
|
#include "c-camera.hh"
|
2017-11-23 23:37:52 +01:00
|
|
|
#include "c-sync.hh"
|
2017-11-16 12:20:21 +01:00
|
|
|
|
|
|
|
namespace sov {
|
|
|
|
|
2017-11-16 23:15:44 +01:00
|
|
|
/*= FLOATING POINT DRAGGERS/SLIDERS ============================================*/
|
2017-11-16 12:20:21 +01:00
|
|
|
|
2017-11-16 23:15:44 +01:00
|
|
|
// Float values, common
|
|
|
|
class A_Float : public A_SyncOverride
|
2017-11-16 12:20:21 +01:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
T_Optional< float > min_;
|
|
|
|
T_Optional< float > max_;
|
|
|
|
T_Optional< float > step_;
|
|
|
|
T_Optional< ebcl::T_StaticArray< char , 12 > > decimals_;
|
|
|
|
T_Optional< float > power_;
|
2017-11-18 16:13:07 +01:00
|
|
|
bool slider_{ false };
|
2017-11-16 12:20:21 +01:00
|
|
|
|
|
|
|
protected:
|
2017-11-16 23:15:44 +01:00
|
|
|
A_Float( char const* const type ,
|
|
|
|
T_String const& title ) noexcept
|
|
|
|
: A_SyncOverride( type , title )
|
|
|
|
{}
|
2017-11-16 12:20:21 +01:00
|
|
|
|
2017-11-20 16:16:53 +01:00
|
|
|
void copyTo( A_Float& other ) const noexcept
|
|
|
|
{
|
|
|
|
other.min_ = min_;
|
|
|
|
other.max_ = max_;
|
|
|
|
other.step_ = step_;
|
|
|
|
other.decimals_ = decimals_;
|
|
|
|
other.power_ = power_;
|
|
|
|
other.slider_ = slider_;
|
|
|
|
other.location( ) = location( );
|
|
|
|
}
|
2017-11-16 12:20:21 +01:00
|
|
|
|
2017-11-20 16:16:53 +01:00
|
|
|
public:
|
2017-11-16 12:20:21 +01:00
|
|
|
bool setMin( const float v ) noexcept;
|
|
|
|
bool setMax( const float v ) noexcept;
|
|
|
|
bool setStep( const float v ) noexcept;
|
|
|
|
bool setDecimals( const uint32_t n ) noexcept;
|
|
|
|
bool setPower( const float v ) noexcept;
|
2017-11-16 23:15:44 +01:00
|
|
|
void setSlider( ) noexcept;
|
2017-11-16 12:20:21 +01:00
|
|
|
|
|
|
|
float min( ) const noexcept { return min_ ? *min_ : 0.0f; }
|
|
|
|
float max( ) const noexcept { return max_ ? *max_ : 0.0f; }
|
|
|
|
float step( ) const noexcept { return step_ ? *step_ : .001f; }
|
|
|
|
char const* decimals( ) const noexcept { return decimals_ ? &(*decimals_)[ 0 ] : "%.3f"; }
|
|
|
|
float power( ) const noexcept { return power_ ? *power_ : 1.0f; }
|
2017-11-16 23:15:44 +01:00
|
|
|
bool slider( ) const noexcept { return slider_; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// Single float values
|
|
|
|
class T_Float : public A_Float
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_Float( T_String const& input ,
|
|
|
|
T_String const& title ) noexcept;
|
2017-11-20 16:16:53 +01:00
|
|
|
|
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
2017-11-16 23:15:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// 2 float values
|
|
|
|
class T_Float2 : public A_Float
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_Float2( T_String const& input0 ,
|
|
|
|
T_String const& input1 ,
|
|
|
|
T_String const& title ) noexcept;
|
2017-11-20 16:16:53 +01:00
|
|
|
|
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
2017-11-16 23:15:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// 3 float values
|
|
|
|
class T_Float3 : public A_Float
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_Float3( T_String const& input0 ,
|
|
|
|
T_String const& input1 ,
|
|
|
|
T_String const& input2 ,
|
|
|
|
T_String const& title ) noexcept;
|
2017-11-20 16:16:53 +01:00
|
|
|
|
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
2017-11-16 12:20:21 +01:00
|
|
|
};
|
|
|
|
|
2017-11-16 23:15:44 +01:00
|
|
|
// 4 float values
|
|
|
|
class T_Float4 : public A_Float
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_Float4( T_String const& input0 ,
|
|
|
|
T_String const& input1 ,
|
|
|
|
T_String const& input2 ,
|
|
|
|
T_String const& input3 ,
|
|
|
|
T_String const& title ) noexcept;
|
2017-11-20 16:16:53 +01:00
|
|
|
|
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
2017-11-16 23:15:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-18 15:17:42 +01:00
|
|
|
/*= INTEGER DRAGGERS/SLIDES ====================================================*/
|
|
|
|
|
|
|
|
// Integers, common
|
|
|
|
class A_Integer : public A_SyncOverride
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
T_Optional< int32_t > min_;
|
|
|
|
T_Optional< int32_t > max_;
|
|
|
|
T_Optional< float > step_;
|
2017-11-18 16:13:07 +01:00
|
|
|
bool slider_{ false };
|
2017-11-18 15:17:42 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
A_Integer( char const* const type ,
|
|
|
|
T_String const& title ) noexcept
|
|
|
|
: A_SyncOverride( type , title )
|
|
|
|
{}
|
|
|
|
|
2017-11-20 16:16:53 +01:00
|
|
|
void copyTo( A_Integer& other ) const noexcept
|
|
|
|
{
|
|
|
|
other.min_ = min_;
|
|
|
|
other.max_ = max_;
|
|
|
|
other.step_ = step_;
|
|
|
|
other.slider_ = slider_;
|
|
|
|
other.location( ) = location( );
|
|
|
|
}
|
2017-11-18 15:17:42 +01:00
|
|
|
|
2017-11-20 16:16:53 +01:00
|
|
|
public:
|
2017-11-18 15:17:42 +01:00
|
|
|
bool setMin( const int32_t v ) noexcept;
|
|
|
|
bool setMax( const int32_t v ) noexcept;
|
|
|
|
bool setStep( const float v ) noexcept;
|
|
|
|
bool setPower( const float v ) noexcept;
|
|
|
|
void setSlider( ) noexcept;
|
|
|
|
|
|
|
|
float min( ) const noexcept { return min_ ? *min_ : 0.0f; }
|
|
|
|
float max( ) const noexcept { return max_ ? *max_ : 0.0f; }
|
|
|
|
float step( ) const noexcept { return step_ ? *step_ : .001f; }
|
|
|
|
bool slider( ) const noexcept { return slider_; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// Single integers
|
|
|
|
class T_Integer : public A_Integer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_Integer( T_String const& input ,
|
|
|
|
T_String const& title ) noexcept;
|
2017-11-20 16:16:53 +01:00
|
|
|
|
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
2017-11-18 15:17:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// 2 integers
|
|
|
|
class T_Integer2 : public A_Integer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_Integer2( T_String const& input0 ,
|
|
|
|
T_String const& input1 ,
|
|
|
|
T_String const& title ) noexcept;
|
2017-11-20 16:16:53 +01:00
|
|
|
|
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
2017-11-18 15:17:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// 3 integers
|
|
|
|
class T_Integer3 : public A_Integer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_Integer3( T_String const& input0 ,
|
|
|
|
T_String const& input1 ,
|
|
|
|
T_String const& input2 ,
|
|
|
|
T_String const& title ) noexcept;
|
2017-11-20 16:16:53 +01:00
|
|
|
|
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
2017-11-18 15:17:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// 4 integers
|
|
|
|
class T_Integer4 : public A_Integer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_Integer4( T_String const& input0 ,
|
|
|
|
T_String const& input1 ,
|
|
|
|
T_String const& input2 ,
|
|
|
|
T_String const& input3 ,
|
|
|
|
T_String const& title ) noexcept;
|
2017-11-20 16:16:53 +01:00
|
|
|
|
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
2017-11-18 15:17:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-19 21:54:13 +01:00
|
|
|
/*= COLOR GRADING CONTROLS =====================================================*/
|
|
|
|
|
|
|
|
class T_ColorGrading : public A_SyncOverride
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
T_Optional< float > base_;
|
|
|
|
T_Optional< float > unit_;
|
|
|
|
|
|
|
|
public:
|
|
|
|
T_ColorGrading( T_String const& iRed ,
|
|
|
|
T_String const& iGreen ,
|
|
|
|
T_String const& iBlue ,
|
|
|
|
T_String const& title ) noexcept;
|
|
|
|
|
|
|
|
bool setBase( const float v ) noexcept;
|
|
|
|
bool setUnit( const float v ) noexcept;
|
|
|
|
|
|
|
|
float base( ) const noexcept { return base_ ? *base_ : 0.f; }
|
|
|
|
float unit( ) const noexcept { return unit_ ? *unit_ : 1.f; }
|
2017-11-20 16:16:53 +01:00
|
|
|
|
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
2017-11-19 21:54:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-20 10:05:09 +01:00
|
|
|
/*= CAMERA CONTROLS ============================================================*/
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
class T_CamOverride : public A_SyncOverride
|
2017-11-20 10:05:09 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum E_SetState {
|
|
|
|
S_OK , // Inputs were set
|
|
|
|
S_DEF , // Duplicate definition
|
|
|
|
S_INPUTS , // Duplicate inputs
|
|
|
|
};
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
enum E_CamMode {
|
2017-11-20 10:05:09 +01:00
|
|
|
CM_INVALID ,
|
|
|
|
CM_ANGLES ,
|
|
|
|
CM_VECTORS
|
|
|
|
};
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
enum E_FovMode {
|
2017-11-20 10:05:09 +01:00
|
|
|
FM_INVALID ,
|
|
|
|
FM_FOV ,
|
|
|
|
FM_NEARPLANE ,
|
|
|
|
};
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
struct T_FovConfig
|
2017-11-20 10:05:09 +01:00
|
|
|
{
|
2017-11-23 22:44:20 +01:00
|
|
|
E_FovMode mode;
|
2017-11-20 10:05:09 +01:00
|
|
|
uint32_t inputIndex;
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
T_FovConfig( E_FovMode mode , uint32_t idx ) noexcept
|
2017-11-20 10:05:09 +01:00
|
|
|
: mode( mode ) , inputIndex( idx )
|
|
|
|
{ assert( mode != FM_INVALID ); }
|
|
|
|
};
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
struct T_VectorConfig
|
2017-11-20 10:05:09 +01:00
|
|
|
{
|
|
|
|
uint32_t x , y , z;
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
T_VectorConfig( uint32_t x , uint32_t y ,
|
|
|
|
uint32_t z ) noexcept
|
2017-11-20 10:05:09 +01:00
|
|
|
: x(x),y(y),z(z)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
private:
|
|
|
|
T_Optional< T_FovConfig > fovConfig_;
|
|
|
|
T_Optional< T_VectorConfig > target_;
|
2017-11-20 10:05:09 +01:00
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
T_Optional< T_VectorConfig > upVector_;
|
|
|
|
T_Optional< T_VectorConfig > position_;
|
2017-11-20 10:05:09 +01:00
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
T_Optional< T_VectorConfig > angles_;
|
2017-11-20 10:05:09 +01:00
|
|
|
T_Optional< uint32_t > distance_;
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
E_CamMode camMode_;
|
2017-11-20 10:05:09 +01:00
|
|
|
T_Camera camera_;
|
|
|
|
|
2017-11-20 11:36:30 +01:00
|
|
|
bool prevEnabled_{ false };
|
|
|
|
|
2017-11-20 10:05:09 +01:00
|
|
|
public:
|
|
|
|
T_CamOverride( T_String const& title ) noexcept;
|
2017-11-20 16:16:53 +01:00
|
|
|
P_SyncOverride clone( ) const noexcept override;
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Set configuration
|
|
|
|
|
2017-11-20 10:05:09 +01:00
|
|
|
E_SetState setFieldOfView(
|
|
|
|
T_String const& input ) noexcept;
|
|
|
|
E_SetState setNearPlane(
|
|
|
|
T_String const& input ) noexcept;
|
|
|
|
|
|
|
|
E_SetState setTarget(
|
|
|
|
T_String const& inX ,
|
|
|
|
T_String const& inY ,
|
|
|
|
T_String const& inZ ) noexcept;
|
|
|
|
|
|
|
|
E_SetState setUpVector(
|
|
|
|
T_String const& inX ,
|
|
|
|
T_String const& inY ,
|
|
|
|
T_String const& inZ ) noexcept;
|
|
|
|
E_SetState setPositionVector(
|
|
|
|
T_String const& inX ,
|
|
|
|
T_String const& inY ,
|
|
|
|
T_String const& inZ ) noexcept;
|
|
|
|
|
|
|
|
E_SetState setAngles(
|
|
|
|
T_String const& in1 ,
|
|
|
|
T_String const& in2 ,
|
|
|
|
T_String const& in3 ) noexcept;
|
|
|
|
E_SetState setDistance(
|
|
|
|
T_String const& input ) noexcept;
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Check configuration
|
|
|
|
|
2017-11-20 10:05:09 +01:00
|
|
|
bool isFovConfigured( ) const noexcept
|
|
|
|
{ return fovConfig_; }
|
|
|
|
bool isTargetConfigured( ) const noexcept
|
|
|
|
{ return target_; }
|
|
|
|
bool checkValidConfig( ) noexcept;
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Read configuration
|
|
|
|
|
|
|
|
T_FovConfig const& fovConfig( ) const noexcept
|
|
|
|
{ return *fovConfig_; }
|
|
|
|
T_VectorConfig const& target( ) const noexcept
|
|
|
|
{ return *target_; }
|
|
|
|
E_CamMode mode( ) const noexcept
|
|
|
|
{ return camMode_; }
|
|
|
|
|
|
|
|
auto const& angles( ) const noexcept
|
|
|
|
{ return *angles_; }
|
|
|
|
auto const& distance( ) const noexcept
|
|
|
|
{ return *distance_; }
|
|
|
|
|
|
|
|
auto const& position( ) const noexcept
|
|
|
|
{ return *position_; }
|
|
|
|
auto const& up( ) const noexcept
|
|
|
|
{ return *upVector_; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// State
|
|
|
|
|
2017-11-20 10:05:09 +01:00
|
|
|
T_Camera& camData( ) noexcept
|
|
|
|
{ return camera_; }
|
|
|
|
T_Camera const& camData( ) const noexcept
|
|
|
|
{ return camera_; }
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
bool& prevEnabled( ) noexcept
|
|
|
|
{ return prevEnabled_; }
|
2017-11-20 14:32:53 +01:00
|
|
|
|
2017-11-20 10:05:09 +01:00
|
|
|
private:
|
|
|
|
E_SetState setVector(
|
2017-11-23 22:44:20 +01:00
|
|
|
T_Optional< T_VectorConfig >& vector ,
|
2017-11-20 10:05:09 +01:00
|
|
|
T_String const& inX ,
|
|
|
|
T_String const& inY ,
|
|
|
|
T_String const& inZ ) noexcept;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-17 14:09:36 +01:00
|
|
|
/*= PARSER CONFIGURATION =======================================================*/
|
|
|
|
|
|
|
|
// Get a parser configuration that will be able to parse UI override definitions.
|
|
|
|
ebcl::T_SRDParserConfig GetParserConfig( );
|
|
|
|
|
2017-11-16 12:20:21 +01:00
|
|
|
|
|
|
|
} // namespace
|