2017-11-23 22:44:20 +01:00
|
|
|
#include "externals.hh"
|
2017-11-23 23:05:14 +01:00
|
|
|
#include "common.hh"
|
2017-11-23 22:44:20 +01:00
|
|
|
#include "ui.hh"
|
|
|
|
#include "ui-colorgrading.hh"
|
|
|
|
#include "ui-overrides.hh"
|
|
|
|
#include "ui-sync.hh"
|
2017-11-24 07:26:02 +01:00
|
|
|
#include "ui-utilities.hh"
|
2017-11-23 22:44:20 +01:00
|
|
|
|
|
|
|
#include <imgui_internal.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace sov {
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
char const* BuildLabel_(
|
|
|
|
uint32_t& counter ,
|
|
|
|
T_StringBuilder& sb ) noexcept
|
|
|
|
{
|
|
|
|
sb.clear( ) << "##temp label " << counter << '\0';
|
|
|
|
counter ++;
|
|
|
|
return sb.data( );
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace <anon>
|
|
|
|
|
|
|
|
|
2017-11-29 14:08:25 +01:00
|
|
|
A_SyncData::~A_SyncData( ) { }
|
|
|
|
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
/*= FLOAT OVERRIDES ==========================================================*/
|
|
|
|
|
|
|
|
M_DECL_SOVUI( Float )
|
|
|
|
{
|
|
|
|
using namespace ImGui;
|
|
|
|
auto& ov{ dynamic_cast< T_Float& >( ovp ) };
|
|
|
|
char const* const label( BuildLabel_( counter , sb ) );
|
|
|
|
const bool changed( ov.slider( )
|
2017-11-29 14:08:25 +01:00
|
|
|
? SliderFloat( label , &data[ 0 ] , ov.min( ) , ov.max( ) ,
|
2017-11-23 22:44:20 +01:00
|
|
|
ov.decimals( ) , ov.power( ) )
|
2017-11-29 14:08:25 +01:00
|
|
|
: DragFloat( label , &data[ 0 ] , ov.step( ) , ov.min( ) ,
|
2017-11-23 22:44:20 +01:00
|
|
|
ov.max( ) , ov.decimals( ) , ov.power( ) ) );
|
2017-11-29 14:08:25 +01:00
|
|
|
return changed;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
M_DECL_SOVUI( Float2 )
|
|
|
|
{
|
|
|
|
using namespace ImGui;
|
|
|
|
auto& ov{ dynamic_cast< T_Float2& >( ovp ) };
|
|
|
|
float v[ 2 ];
|
|
|
|
for ( auto i = 0 ; i < 2 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
v[ i ] = data[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
char const* const label( BuildLabel_( counter , sb ) );
|
|
|
|
const bool changed( ov.slider( )
|
|
|
|
? SliderFloat2( label , v , ov.min( ) , ov.max( ) ,
|
|
|
|
ov.decimals( ) , ov.power( ) )
|
|
|
|
: DragFloat2( label , v , ov.step( ) , ov.min( ) ,
|
|
|
|
ov.max( ) , ov.decimals( ) , ov.power( ) ) );
|
|
|
|
if ( changed ) {
|
|
|
|
for ( auto i = 0 ; i < 2 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ i ] = v[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-11-29 14:08:25 +01:00
|
|
|
return changed;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
M_DECL_SOVUI( Float3 )
|
|
|
|
{
|
|
|
|
using namespace ImGui;
|
|
|
|
auto& ov{ dynamic_cast< T_Float3& >( ovp ) };
|
|
|
|
float v[ 3 ];
|
|
|
|
for ( auto i = 0 ; i < 3 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
v[ i ] = data[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
char const* const label( BuildLabel_( counter , sb ) );
|
|
|
|
const bool changed( ov.slider( )
|
|
|
|
? SliderFloat3( label , v , ov.min( ) , ov.max( ) ,
|
|
|
|
ov.decimals( ) , ov.power( ) )
|
|
|
|
: DragFloat3( label , v , ov.step( ) , ov.min( ) ,
|
|
|
|
ov.max( ) , ov.decimals( ) , ov.power( ) ) );
|
|
|
|
if ( changed ) {
|
|
|
|
for ( auto i = 0 ; i < 3 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ i ] = v[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-11-29 14:08:25 +01:00
|
|
|
return changed;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
M_DECL_SOVUI( Float4 )
|
|
|
|
{
|
|
|
|
using namespace ImGui;
|
|
|
|
auto& ov{ dynamic_cast< T_Float4& >( ovp ) };
|
|
|
|
float v[ 4 ];
|
|
|
|
for ( auto i = 0 ; i < 4 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
v[ i ] = data[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
char const* const label( BuildLabel_( counter , sb ) );
|
|
|
|
const bool changed( ov.slider( )
|
|
|
|
? SliderFloat4( label , v , ov.min( ) , ov.max( ) ,
|
|
|
|
ov.decimals( ) , ov.power( ) )
|
|
|
|
: DragFloat4( label , v , ov.step( ) , ov.min( ) ,
|
|
|
|
ov.max( ) , ov.decimals( ) , ov.power( ) ) );
|
|
|
|
if ( changed ) {
|
|
|
|
for ( auto i = 0 ; i < 4 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ i ] = v[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-11-29 14:08:25 +01:00
|
|
|
return changed;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*= INTEGER OVERRIDES ========================================================*/
|
|
|
|
|
|
|
|
M_DECL_SOVUI( Integer )
|
|
|
|
{
|
|
|
|
using namespace ImGui;
|
|
|
|
auto& ov{ dynamic_cast< T_Integer& >( ovp ) };
|
2017-11-29 14:08:25 +01:00
|
|
|
int32_t v = int32_t( data[ 0 ] );
|
2017-11-23 22:44:20 +01:00
|
|
|
|
|
|
|
char const* const label( BuildLabel_( counter , sb ) );
|
|
|
|
const bool changed( ov.slider( )
|
2017-11-29 14:08:25 +01:00
|
|
|
? SliderInt( label , &v , ov.min( ) , ov.max( ) )
|
|
|
|
: DragInt( label , &v , ov.step( ) , ov.min( ) , ov.max( ) ) );
|
2017-11-23 22:44:20 +01:00
|
|
|
if ( changed ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ 0 ] = v;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
2017-11-29 14:08:25 +01:00
|
|
|
return changed;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
M_DECL_SOVUI( Integer2 )
|
|
|
|
{
|
|
|
|
using namespace ImGui;
|
|
|
|
auto& ov{ dynamic_cast< T_Integer2& >( ovp ) };
|
|
|
|
int32_t v[ 2 ];
|
|
|
|
for ( auto i = 0 ; i < 2 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
v[ i ] = data[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
char const* const label( BuildLabel_( counter , sb ) );
|
|
|
|
const bool changed( ov.slider( )
|
|
|
|
? SliderInt2( label , v , ov.min( ) , ov.max( ) )
|
|
|
|
: DragInt2( label , v , ov.step( ) , ov.min( ) , ov.max( ) ) );
|
|
|
|
if ( changed ) {
|
|
|
|
for ( auto i = 0 ; i < 2 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ i ] = v[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-11-29 14:08:25 +01:00
|
|
|
return changed;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
M_DECL_SOVUI( Integer3 )
|
|
|
|
{
|
|
|
|
using namespace ImGui;
|
|
|
|
auto& ov{ dynamic_cast< T_Integer3& >( ovp ) };
|
|
|
|
int32_t v[ 3 ];
|
|
|
|
for ( auto i = 0 ; i < 3 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
v[ i ] = data[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
char const* const label( BuildLabel_( counter , sb ) );
|
|
|
|
const bool changed( ov.slider( )
|
|
|
|
? SliderInt3( label , v , ov.min( ) , ov.max( ) )
|
|
|
|
: DragInt3( label , v , ov.step( ) , ov.min( ) , ov.max( ) ) );
|
|
|
|
if ( changed ) {
|
|
|
|
for ( auto i = 0 ; i < 3 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ i ] = v[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-11-29 14:08:25 +01:00
|
|
|
return changed;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
M_DECL_SOVUI( Integer4 )
|
|
|
|
{
|
|
|
|
using namespace ImGui;
|
|
|
|
auto& ov{ dynamic_cast< T_Integer4& >( ovp ) };
|
|
|
|
int32_t v[ 4 ];
|
|
|
|
for ( auto i = 0 ; i < 4 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
v[ i ] = data[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
char const* const label( BuildLabel_( counter , sb ) );
|
|
|
|
const bool changed( ov.slider( )
|
|
|
|
? SliderInt4( label , v , ov.min( ) , ov.max( ) )
|
|
|
|
: DragInt4( label , v , ov.step( ) , ov.min( ) , ov.max( ) ) );
|
|
|
|
if ( changed ) {
|
|
|
|
for ( auto i = 0 ; i < 4 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ i ] = v[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-11-29 14:08:25 +01:00
|
|
|
return changed;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*= COLOR GRADING OVERRIDES ==================================================*/
|
|
|
|
|
|
|
|
M_DECL_SOVUI( ColorGrading )
|
|
|
|
{
|
|
|
|
using namespace ImGui;
|
|
|
|
auto& ov{ dynamic_cast< T_ColorGrading& >( ovp ) };
|
|
|
|
float v[ 3 ];
|
|
|
|
for ( auto i = 0 ; i < 3 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
v[ i ] = data[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
char const* const label{ BuildLabel_( counter , sb ) };
|
|
|
|
const bool changed{ ColorGradingControls(
|
|
|
|
label ,
|
|
|
|
&v[ 0 ] , &v[ 1 ] , &v[ 2 ] ,
|
|
|
|
ov.base( ) , ov.unit( ) ) };
|
|
|
|
|
|
|
|
if ( changed ) {
|
|
|
|
for ( auto i = 0 ; i < 3 ; i ++ ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ i ] = v[ i ];
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-11-29 14:08:25 +01:00
|
|
|
return changed;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*= CAMERA OVERRIDES =========================================================*/
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
glm::vec3 VectorFromInputs_(
|
|
|
|
T_CamOverride::T_VectorConfig const& vc ,
|
2017-11-29 14:08:25 +01:00
|
|
|
A_SyncData const& data ) noexcept
|
2017-11-23 22:44:20 +01:00
|
|
|
{
|
2017-11-29 14:08:25 +01:00
|
|
|
return glm::vec3{ data[ vc.x ] , data[ vc.y ] , data[ vc.z ] };
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void InputsFromVector_(
|
|
|
|
T_CamOverride::T_VectorConfig const& vc ,
|
2017-11-29 14:08:25 +01:00
|
|
|
A_SyncData& data ,
|
2017-11-23 22:44:20 +01:00
|
|
|
glm::vec3 const& v ) noexcept
|
|
|
|
{
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ vc.x ] = v.x;
|
|
|
|
data[ vc.y ] = v.y;
|
|
|
|
data[ vc.z ] = v.z;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
struct T_MouseCam_ : public virtual A_MouseCtrl
|
|
|
|
{
|
2017-11-24 07:26:02 +01:00
|
|
|
T_CameraMouseControl camera;
|
2017-11-23 22:44:20 +01:00
|
|
|
T_CamOverride& ov;
|
2017-11-29 14:08:25 +01:00
|
|
|
T_OwnPtr< A_SyncData > data;
|
2017-11-23 22:44:20 +01:00
|
|
|
|
|
|
|
T_MouseCam_( T_Camera& cam ,
|
2017-11-29 14:08:25 +01:00
|
|
|
T_CamOverride& ov ,
|
|
|
|
A_SyncData const& data ) noexcept
|
|
|
|
: camera( cam ) , ov( ov ) , data( data.clone( ) )
|
2017-11-23 22:44:20 +01:00
|
|
|
{ }
|
|
|
|
|
|
|
|
void handleDragAndDrop(
|
|
|
|
ImVec2 const& move ,
|
2017-11-24 11:48:08 +01:00
|
|
|
T_KbdMods modifiers ,
|
2017-11-23 22:44:20 +01:00
|
|
|
T_MouseButtons buttons ) noexcept override;
|
|
|
|
|
|
|
|
void handleWheel(
|
|
|
|
float wheel ,
|
2017-11-24 11:48:08 +01:00
|
|
|
T_KbdMods modifiers ,
|
2017-11-23 22:44:20 +01:00
|
|
|
T_MouseButtons buttons ) noexcept override;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
void T_MouseCam_::handleDragAndDrop(
|
|
|
|
ImVec2 const& move ,
|
2017-11-24 11:48:08 +01:00
|
|
|
T_KbdMods modifiers ,
|
2017-11-23 22:44:20 +01:00
|
|
|
T_MouseButtons buttons ) noexcept
|
|
|
|
{
|
|
|
|
if ( !ov.enabled( ) ) {
|
|
|
|
UI::Sync( ).clearMouseDelegate( );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
camera.handleDragAndDrop( move , modifiers , buttons );
|
|
|
|
|
2017-11-24 07:26:02 +01:00
|
|
|
auto& cam{ camera.camera };
|
2017-11-29 14:08:25 +01:00
|
|
|
InputsFromVector_( ov.target( ) , *data , cam.lookAt( ) );
|
2017-11-23 22:44:20 +01:00
|
|
|
if ( ov.mode( ) == T_CamOverride::CM_ANGLES ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
InputsFromVector_( ov.angles( ) , *data , cam.angles( ) );
|
|
|
|
(*data)[ ov.distance( ) ] = cam.distance( );
|
2017-11-23 22:44:20 +01:00
|
|
|
} else {
|
2017-11-29 14:08:25 +01:00
|
|
|
InputsFromVector_( ov.position( ) , *data , cam.position( ) );
|
|
|
|
InputsFromVector_( ov.up( ) , *data , cam.upVector( ) );
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void T_MouseCam_::handleWheel(
|
|
|
|
const float wheel ,
|
2017-11-24 11:48:08 +01:00
|
|
|
T_KbdMods modifiers ,
|
2017-11-23 22:44:20 +01:00
|
|
|
T_MouseButtons buttons ) noexcept
|
|
|
|
{
|
|
|
|
if ( !ov.enabled( ) ) {
|
|
|
|
UI::Sync( ).clearMouseDelegate( );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
camera.handleWheel( wheel , modifiers , buttons );
|
|
|
|
|
2017-11-24 07:26:02 +01:00
|
|
|
auto& cam{ camera.camera };
|
2017-11-24 11:48:08 +01:00
|
|
|
if ( modifiers & E_KbdMod::SHIFT ) {
|
2017-11-23 22:44:20 +01:00
|
|
|
auto const& fc( ov.fovConfig( ) );
|
|
|
|
if ( fc.mode == T_CamOverride::FM_FOV ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
(*data)[ fc.inputIndex ] = cam.fieldOfView( );
|
2017-11-23 22:44:20 +01:00
|
|
|
} else {
|
2017-11-29 14:08:25 +01:00
|
|
|
(*data)[ fc.inputIndex ] = cam.nearPlane( );
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
} else {
|
2017-11-29 14:08:25 +01:00
|
|
|
InputsFromVector_( ov.target( ) , *data , cam.lookAt( ) );
|
2017-11-23 22:44:20 +01:00
|
|
|
if ( ov.mode( ) == T_CamOverride::CM_ANGLES ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
InputsFromVector_( ov.angles( ) , *data , cam.angles( ) );
|
|
|
|
(*data)[ ov.distance( ) ] = cam.distance( );
|
2017-11-23 22:44:20 +01:00
|
|
|
} else {
|
2017-11-29 14:08:25 +01:00
|
|
|
InputsFromVector_( ov.position( ) , *data , cam.position( ) );
|
|
|
|
InputsFromVector_( ov.up( ) , *data , cam.upVector( ) );
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace <anon>
|
|
|
|
|
|
|
|
M_DECL_SOVUI( Camera )
|
|
|
|
{
|
|
|
|
auto& ov{ dynamic_cast< T_CamOverride& >( ovp ) };
|
|
|
|
auto& camera{ ov.camData( ) };
|
|
|
|
auto const& fc{ ov.fovConfig( ) };
|
|
|
|
|
|
|
|
if ( !ov.enabled( ) || !ov.prevEnabled( ) ) {
|
|
|
|
// Set field of view / near plane
|
|
|
|
if ( fc.mode == T_CamOverride::FM_FOV ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
camera.fieldOfView( data[ fc.inputIndex ] );
|
2017-11-23 22:44:20 +01:00
|
|
|
} else {
|
2017-11-29 14:08:25 +01:00
|
|
|
camera.nearPlane( data[ fc.inputIndex ] );
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set camera parameters
|
|
|
|
const glm::vec3 lookAt{ VectorFromInputs_(
|
2017-11-29 14:08:25 +01:00
|
|
|
ov.target( ) , data ) };
|
2017-11-23 22:44:20 +01:00
|
|
|
if ( ov.mode( ) == T_CamOverride::CM_ANGLES ) {
|
|
|
|
const glm::vec3 angles{ VectorFromInputs_(
|
2017-11-29 14:08:25 +01:00
|
|
|
ov.angles( ) , data ) };
|
|
|
|
const float distance{ data[ ov.distance( ) ] };
|
2017-11-23 22:44:20 +01:00
|
|
|
camera.camera( lookAt , angles , distance );
|
|
|
|
} else {
|
|
|
|
const glm::vec3 position{ VectorFromInputs_(
|
2017-11-29 14:08:25 +01:00
|
|
|
ov.position( ) , data ) };
|
2017-11-23 22:44:20 +01:00
|
|
|
const glm::vec3 up{ VectorFromInputs_(
|
2017-11-29 14:08:25 +01:00
|
|
|
ov.up( ) , data ) };
|
2017-11-23 22:44:20 +01:00
|
|
|
camera.camera( lookAt , position , up );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ov.prevEnabled( ) = ov.enabled( );
|
|
|
|
|
|
|
|
// Draw UI
|
|
|
|
char const* const name( BuildLabel_( counter , sb ) );
|
|
|
|
auto& sui{ UI::Sync( ) };
|
|
|
|
bool mouseHandler{ sui.isCurrentDelegate( ov.id( ) ) };
|
|
|
|
using namespace ImGui;
|
|
|
|
PushItemWidth( 0 ); // Compensate for -1
|
|
|
|
PushID( GetCurrentWindow( )->GetID( name ) );
|
|
|
|
const bool handlerChanged{ Checkbox( "Mouse control" , &mouseHandler ) };
|
|
|
|
Separator( );
|
2017-11-24 07:26:02 +01:00
|
|
|
const auto changes{ CameraUI( camera ) };
|
2017-11-23 22:44:20 +01:00
|
|
|
PopID( );
|
|
|
|
PopItemWidth( );
|
|
|
|
|
|
|
|
if ( handlerChanged ) {
|
|
|
|
if ( mouseHandler ) {
|
|
|
|
sui.delegateMouse( ov.id( ) ,
|
2017-11-29 14:08:25 +01:00
|
|
|
NewOwned< T_MouseCam_ >( camera , ov , data ) );
|
2017-11-23 22:44:20 +01:00
|
|
|
} else {
|
|
|
|
sui.clearMouseDelegate( );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update values
|
2017-11-24 07:26:02 +01:00
|
|
|
if ( changes & E_CameraChange::FOV ) {
|
2017-11-23 22:44:20 +01:00
|
|
|
if ( fc.mode == T_CamOverride::FM_FOV ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ fc.inputIndex ] = camera.fieldOfView( );
|
2017-11-23 22:44:20 +01:00
|
|
|
} else {
|
2017-11-29 14:08:25 +01:00
|
|
|
data[ fc.inputIndex ] = camera.nearPlane( );
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-11-24 07:26:02 +01:00
|
|
|
if ( changes & E_CameraChange::MATRIX ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
InputsFromVector_( ov.target( ) , data , camera.lookAt( ) );
|
2017-11-23 22:44:20 +01:00
|
|
|
if ( ov.mode( ) == T_CamOverride::CM_ANGLES ) {
|
2017-11-29 14:08:25 +01:00
|
|
|
InputsFromVector_( ov.angles( ) , data , camera.angles( ) );
|
|
|
|
data[ ov.distance( ) ] = camera.distance( );
|
2017-11-23 22:44:20 +01:00
|
|
|
} else {
|
2017-11-29 14:08:25 +01:00
|
|
|
InputsFromVector_( ov.position( ) , data , camera.position( ) );
|
|
|
|
InputsFromVector_( ov.up( ) , data , camera.upVector( ) );
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-11-29 14:08:25 +01:00
|
|
|
return changes;
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace sov
|