2017-10-02 13:51:08 +02:00
|
|
|
#include "externals.hh"
|
|
|
|
#include "demo.hh"
|
|
|
|
|
|
|
|
|
2017-10-04 11:20:27 +02:00
|
|
|
T_Demo::T_Demo( __rd__ const uint32_t width ,
|
2017-10-02 13:51:08 +02:00
|
|
|
__rd__ const uint32_t height )
|
2017-10-04 11:20:27 +02:00
|
|
|
: width( width ) , height( height )
|
2017-10-02 13:51:08 +02:00
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
bool T_Demo::initialise( )
|
|
|
|
{
|
|
|
|
raymarcher = std::make_unique< T_Raymarcher >(
|
2017-10-04 11:20:27 +02:00
|
|
|
width , height );
|
|
|
|
dof = std::make_unique< T_DoFPass >(
|
2017-10-02 13:51:08 +02:00
|
|
|
raymarcher->output( ) , raymarcher->depth( ) );
|
2017-10-04 11:20:27 +02:00
|
|
|
bloom = std::make_unique< T_BloomPass >(
|
2017-10-02 13:51:08 +02:00
|
|
|
raymarcher->output( ) );
|
2017-10-04 11:20:27 +02:00
|
|
|
combine = std::make_unique< T_CombinePass >(
|
2017-10-02 13:51:08 +02:00
|
|
|
dof->output( ) , bloom->output( ) );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void T_Demo::makeUI( )
|
|
|
|
{
|
|
|
|
raymarcher->makeUI( );
|
|
|
|
dof->makeUI( );
|
|
|
|
bloom->makeUI( );
|
|
|
|
combine->makeUI( );
|
|
|
|
}
|
|
|
|
|
|
|
|
void T_Demo::render( )
|
|
|
|
{
|
|
|
|
raymarcher->render( );
|
|
|
|
dof->render( );
|
|
|
|
bloom->render( );
|
|
|
|
combine->render( );
|
|
|
|
}
|
|
|
|
|
|
|
|
void T_Demo::handleDND(
|
|
|
|
__rd__ ImVec2 const& move ,
|
|
|
|
__rd__ const bool hasCtrl ,
|
|
|
|
__rd__ const bool hasShift ,
|
|
|
|
__rd__ const bool lmb // Left mouse button
|
|
|
|
)
|
|
|
|
{
|
|
|
|
raymarcher->camera( ).handleDND( move , hasCtrl , hasShift , lmb );
|
|
|
|
}
|
|
|
|
|
|
|
|
void T_Demo::handleWheel(
|
|
|
|
__rd__ const float wheel ,
|
|
|
|
__rd__ const bool hasCtrl ,
|
|
|
|
__rd__ const bool hasShift
|
|
|
|
)
|
|
|
|
{
|
|
|
|
raymarcher->camera( ).handleWheel( wheel , hasCtrl , hasShift );
|
|
|
|
}
|