fractorium/Source/Fractorium/FractoriumToolbar.cpp
mfeemster eecd3c254f --User changes
-Remove Hue as a saved parameter, as well as animation parameters associated with it. It's now a GUI-only field that is never saved.
 -Make histogram, density filter buffer, and all associated fields always float, even when using double. In that case, only the iteration calculations are now double. Suggested by Thomas Ludwig.
 -Print all three kernels in EmberRender when the --dump_kernel option is specified.
 -Apply variations filter to randoms.

--Bug fixes
 -Fix bug where hue was not being preserved when switching controllers and embers. Very hard to repro bug, but mostly overcome by eliminating hue as a saved parameter.

--Code changes
 -De-templatized DEOpenCLKernelCreator and FinalAccumOpenCLKernelCreator. They now just take a bool as a parameter to specify double precision.
 -To accommodate the buffers being float, introduce a new #define types in EmberCL called real4_bucket, and real4reals_bucket.
 -Density and spatial filtering structs now use this type.
 -ConvertDensityFilter() and ConvertSpatialFilter() no longer return a value, they just assign to the member.
2015-08-10 20:10:23 -07:00

103 lines
2.6 KiB
C++

#include "FractoriumPch.h"
#include "Fractorium.h"
/// <summary>
/// Initialize the toolbar UI.
/// </summary>
void Fractorium::InitToolbarUI()
{
auto clGroup = new QActionGroup(this);
clGroup->addAction(ui.ActionCpu);
clGroup->addAction(ui.ActionCL);
auto spGroup = new QActionGroup(this);
spGroup->addAction(ui.ActionSP);
spGroup->addAction(ui.ActionDP);
SyncOptionsToToolbar();
connect(ui.ActionCpu, SIGNAL(triggered(bool)), this, SLOT(OnActionCpu(bool)), Qt::QueuedConnection);
connect(ui.ActionCL, SIGNAL(triggered(bool)), this, SLOT(OnActionCL(bool)), Qt::QueuedConnection);
connect(ui.ActionSP, SIGNAL(triggered(bool)), this, SLOT(OnActionSP(bool)), Qt::QueuedConnection);
connect(ui.ActionDP, SIGNAL(triggered(bool)), this, SLOT(OnActionDP(bool)), Qt::QueuedConnection);
}
/// <summary>
/// Called when the CPU render option on the toolbar is clicked.
/// </summary>
/// <param name="checked">Check state, action only taken if true.</param>
void Fractorium::OnActionCpu(bool checked)
{
if (checked && m_Settings->OpenCL())
{
m_Settings->OpenCL(false);
ShutdownAndRecreateFromOptions();
}
}
/// <summary>
/// Called when the OpenCL render option on the toolbar is clicked.
/// </summary>
/// <param name="checked">Check state, action only taken if true.</param>
void Fractorium::OnActionCL(bool checked)
{
if (checked && !m_Settings->OpenCL())
{
m_Settings->OpenCL(true);
ShutdownAndRecreateFromOptions();
}
}
/// <summary>
/// Called when the single precision render option on the toolbar is clicked.
/// </summary>
/// <param name="checked">Check state, action only taken if true.</param>
void Fractorium::OnActionSP(bool checked)
{
if (checked && m_Settings->Double())
{
m_Settings->Double(false);
ShutdownAndRecreateFromOptions();
}
}
/// <summary>
/// Called when the double precision render option on the toolbar is clicked.
/// </summary>
/// <param name="checked">Check state, action only taken if true.</param>
void Fractorium::OnActionDP(bool checked)
{
if (checked && !m_Settings->Double())
{
m_Settings->Double(true);
ShutdownAndRecreateFromOptions();
}
}
/// <summary>
/// Sync options data to the check state of the toolbar buttons.
/// This does not trigger a clicked() event.
/// </summary>
void Fractorium::SyncOptionsToToolbar()
{
if (m_Settings->OpenCL())
{
ui.ActionCpu->setChecked(false);
ui.ActionCL->setChecked(true);
}
else
{
ui.ActionCpu->setChecked(true);
ui.ActionCL->setChecked(false);
}
if (m_Settings->Double())
{
ui.ActionSP->setChecked(false);
ui.ActionDP->setChecked(true);
}
else
{
ui.ActionSP->setChecked(true);
ui.ActionDP->setChecked(false);
}
}