mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-06-30 21:36:33 -04:00
--Code changes
-Fix build. -Cleanup warnings.
This commit is contained in:
@ -192,9 +192,9 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="i">The index in the file of the ember</param>
|
||||
/// <returns>The default ember name</returns>
|
||||
static QString DefaultEmberName(uint i)
|
||||
static QString DefaultEmberName(T i)
|
||||
{
|
||||
return DefaultFilename() + "_" + ToString(i);
|
||||
return DefaultFilename() + "_" + ToString<T>(i);
|
||||
}
|
||||
|
||||
QString m_Filename;
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
/// This is meant to be a root level item.
|
||||
/// </summary>
|
||||
/// <param name="p">The parent widget of this item</param>
|
||||
explicit EmberTreeWidgetItemBase(QTreeWidget* p = 0)
|
||||
explicit EmberTreeWidgetItemBase(QTreeWidget* p)
|
||||
: QTreeWidgetItem(p)
|
||||
{
|
||||
}
|
||||
@ -29,11 +29,11 @@ public:
|
||||
/// This is meant to be the child of a root level item.
|
||||
/// </summary>
|
||||
/// <param name="p">The parent widget of this item</param>
|
||||
explicit EmberTreeWidgetItemBase(QTreeWidgetItem* p = 0)
|
||||
explicit EmberTreeWidgetItemBase(QTreeWidgetItem* p)
|
||||
: QTreeWidgetItem(p)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set the preview image for the tree widget item.
|
||||
/// </summary>
|
||||
@ -43,7 +43,6 @@ public:
|
||||
void SetImage(vector<byte>& v, uint width, uint height)
|
||||
{
|
||||
int size = 64;
|
||||
|
||||
m_Image = QImage(width, height, QImage::Format_RGBA8888);
|
||||
memcpy(m_Image.scanLine(0), v.data(), v.size() * sizeof(v[0]));//Memcpy the data in.
|
||||
m_Pixmap = QPixmap::fromImage(m_Image).scaled(QSize(size, size), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);//Create a QPixmap out of the QImage, scaled to size.
|
||||
|
@ -116,7 +116,7 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set
|
||||
m_QualitySpin->setValue(m_Settings->FinalQuality());
|
||||
m_TemporalSamplesSpin->setValue(m_Settings->FinalTemporalSamples());
|
||||
m_SupersampleSpin->setValue(m_Settings->FinalSupersample());
|
||||
m_StripsSpin->setValue(m_Settings->FinalStrips());
|
||||
m_StripsSpin->setValue(int(m_Settings->FinalStrips()));
|
||||
Scale(eScaleType(m_Settings->FinalScale()));
|
||||
|
||||
if (m_Settings->FinalExt() == "jpg")
|
||||
@ -622,7 +622,7 @@ void FractoriumFinalRenderDialog::showEvent(QShowEvent* e)
|
||||
{
|
||||
if (CreateControllerFromGUI(true))
|
||||
{
|
||||
int index = m_Fractorium->m_Controller->Index() + 1;
|
||||
int index = int(m_Fractorium->m_Controller->Index()) + 1;
|
||||
#ifdef DO_DOUBLE
|
||||
Ember<double> ed;
|
||||
EmberFile<double> efi;
|
||||
@ -644,7 +644,7 @@ void FractoriumFinalRenderDialog::showEvent(QShowEvent* e)
|
||||
});//Copy the whole file, will take about 0.2ms per ember in the file.
|
||||
#endif
|
||||
m_Controller->SetEmberFile(efi);//Copy the temp file into the final render controller.
|
||||
ui.FinalRenderCurrentSpin->setMaximum(efi.Size());
|
||||
ui.FinalRenderCurrentSpin->setMaximum(int(efi.Size()));
|
||||
ui.FinalRenderCurrentSpin->blockSignals(true);
|
||||
ui.FinalRenderCurrentSpin->setValue(index);//Set the currently selected ember to the one that was being edited.
|
||||
ui.FinalRenderCurrentSpin->blockSignals(false);
|
||||
|
@ -142,7 +142,7 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
|
||||
[&](size_t strip) { },//Error.
|
||||
[&](Ember<T>& finalEmber)//Final strip.
|
||||
{
|
||||
QImage image(finalEmber.m_FinalRasW, finalEmber.m_FinalRasH, QImage::Format_RGBA8888);//The label wants RGBA.
|
||||
QImage image(int(finalEmber.m_FinalRasW), int(finalEmber.m_FinalRasH), QImage::Format_RGBA8888);//The label wants RGBA.
|
||||
memcpy(image.scanLine(0), m_PreviewFinalImage.data(), finalEmber.m_FinalRasW * finalEmber.m_FinalRasH * 4);//Memcpy the data in.
|
||||
QPixmap pixmap(QPixmap::fromImage(image));
|
||||
QMetaObject::invokeMethod(widget, "setPixmap", Qt::QueuedConnection, Q_ARG(QPixmap, pixmap));
|
||||
|
@ -43,7 +43,7 @@ struct FinalRenderGuiState
|
||||
double m_Quality;
|
||||
uint m_TemporalSamples;
|
||||
uint m_Supersample;
|
||||
uint m_Strips;
|
||||
size_t m_Strips;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
@ -211,7 +211,7 @@ static vector<pair<size_t, size_t>> Devices(const QList<QVariant>& selectedDevic
|
||||
auto& devices = OpenCLInfo::Instance()->DeviceIndices();
|
||||
vec.reserve(selectedDevices.size());
|
||||
|
||||
for (size_t i = 0; i < selectedDevices.size(); i++)
|
||||
for (int i = 0; i < selectedDevices.size(); i++)
|
||||
{
|
||||
auto index = selectedDevices[i].toUInt();
|
||||
|
||||
@ -235,9 +235,9 @@ static void SetupDeviceTable(QTableWidget* table, const QList<QVariant>& setting
|
||||
bool primary = false;
|
||||
auto& deviceNames = OpenCLInfo::Instance()->AllDeviceNames();
|
||||
table->clearContents();
|
||||
table->setRowCount(deviceNames.size());
|
||||
table->setRowCount(int(deviceNames.size()));
|
||||
|
||||
for (size_t i = 0; i < deviceNames.size(); i++)
|
||||
for (int i = 0; i < deviceNames.size(); i++)
|
||||
{
|
||||
auto checkItem = new QTableWidgetItem();
|
||||
auto radio = new QRadioButton();
|
||||
@ -405,4 +405,4 @@ static QList<T> GetAllParents(QWidget* widget)
|
||||
}
|
||||
|
||||
return parents;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
|
||||
|
||||
if (auto top = tree->topLevelItem(0))
|
||||
{
|
||||
for (size_t i = start; m_PreviewRun && i < end && i < m_EmberFile.Size(); i++)
|
||||
for (auto i = start; m_PreviewRun && i < end && i < m_EmberFile.Size(); i++)
|
||||
{
|
||||
Ember<T> ember = m_EmberFile.m_Embers[i];
|
||||
ember.SyncSize();
|
||||
@ -112,7 +112,7 @@ FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
|
||||
|
||||
if (m_PreviewRenderer->Run(m_PreviewFinalImage) == eRenderStatus::RENDER_OK)
|
||||
{
|
||||
if (auto treeItem = dynamic_cast<EmberTreeWidgetItem<T>*>(top->child(i)))
|
||||
if (auto treeItem = dynamic_cast<EmberTreeWidgetItem<T>*>(top->child(int(i))))
|
||||
{
|
||||
//It is critical that Qt::BlockingQueuedConnection is passed because this is running on a different thread than the UI.
|
||||
//This ensures the events are processed in order as each preview is updated, and that control does not return here
|
||||
@ -173,8 +173,8 @@ template <typename T> Ember<T>* FractoriumEmberController<T>::CurrentEmber() { r
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::ConstrainDimensions(Ember<T>& ember)
|
||||
{
|
||||
ember.m_FinalRasW = std::min<int>(m_Fractorium->ui.GLDisplay->MaxTexSize(), ember.m_FinalRasW);
|
||||
ember.m_FinalRasH = std::min<int>(m_Fractorium->ui.GLDisplay->MaxTexSize(), ember.m_FinalRasH);
|
||||
ember.m_FinalRasW = std::min<int>(m_Fractorium->ui.GLDisplay->MaxTexSize(), int(ember.m_FinalRasW));
|
||||
ember.m_FinalRasH = std::min<int>(m_Fractorium->ui.GLDisplay->MaxTexSize(), int(ember.m_FinalRasH));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -190,7 +190,7 @@ void FractoriumEmberController<T>::SetEmber(size_t index)
|
||||
{
|
||||
if (auto top = m_Fractorium->ui.LibraryTree->topLevelItem(0))
|
||||
{
|
||||
for (uint i = 0; i < top->childCount(); i++)
|
||||
for (int i = 0; i < top->childCount(); i++)
|
||||
{
|
||||
if (auto emberItem = dynamic_cast<EmberTreeWidgetItem<T>*>(top->child(i)))
|
||||
emberItem->setSelected(i == index);
|
||||
@ -229,7 +229,7 @@ void FractoriumEmberController<T>::Update(std::function<void (void)> func, bool
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::UpdateXform(std::function<void(Xform<T>*)> func, eXformUpdate updateType, bool updateRender, eProcessAction action)
|
||||
{
|
||||
size_t i = 0;
|
||||
int i = 0;
|
||||
bool isCurrentFinal = m_Ember.IsFinalXform(CurrentXform());
|
||||
bool doFinal = updateType != eXformUpdate::UPDATE_SELECTED_EXCEPT_FINAL && updateType != eXformUpdate::UPDATE_ALL_EXCEPT_FINAL;
|
||||
|
||||
|
@ -199,7 +199,7 @@ public:
|
||||
virtual void RandomXaos() { }
|
||||
|
||||
//Palette.
|
||||
virtual int InitPaletteList(const string& s) { return 0; }
|
||||
virtual size_t InitPaletteList(const string& s) { return 0; }
|
||||
virtual bool FillPaletteTable(const string& s) { return false; }
|
||||
virtual void ApplyPaletteToEmber() { }
|
||||
virtual void PaletteAdjust() { }
|
||||
@ -240,9 +240,9 @@ protected:
|
||||
bool m_Shared;
|
||||
bool m_LastEditWasUndoRedo;
|
||||
vector<pair<size_t, size_t>> m_Devices;
|
||||
uint m_SubBatchCount;
|
||||
size_t m_SubBatchCount;
|
||||
uint m_FailedRenders;
|
||||
uint m_UndoIndex;
|
||||
size_t m_UndoIndex;
|
||||
double m_LockedScale;
|
||||
eRendererType m_RenderType;
|
||||
eEditUndoState m_EditState;
|
||||
@ -443,7 +443,7 @@ public:
|
||||
virtual void RandomXaos() override;
|
||||
|
||||
//Palette.
|
||||
virtual int InitPaletteList(const string& s) override;
|
||||
virtual size_t InitPaletteList(const string& s) override;
|
||||
virtual bool FillPaletteTable(const string& s) override;
|
||||
virtual void ApplyPaletteToEmber() override;
|
||||
virtual void PaletteAdjust() override;
|
||||
|
@ -18,7 +18,7 @@ void Fractorium::InitLibraryUI()
|
||||
/// <returns>A pair containing the index of the item clicked and a pointer to the item</param>
|
||||
pair<size_t, QTreeWidgetItem*> Fractorium::GetCurrentEmberIndex()
|
||||
{
|
||||
size_t index = 0;
|
||||
int index = 0;
|
||||
QTreeWidgetItem* item = nullptr;
|
||||
auto tree = ui.LibraryTree;
|
||||
|
||||
@ -141,7 +141,7 @@ void FractoriumEmberController<T>::FillLibraryTree(int selectIndex)
|
||||
emberItem->setSelected(true);
|
||||
|
||||
QCoreApplication::flush();
|
||||
RenderPreviews(0, m_EmberFile.Size());
|
||||
RenderPreviews(0, uint(m_EmberFile.Size()));
|
||||
tree->expandAll();
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ void FractoriumEmberController<T>::UpdateLibraryTree()
|
||||
//the pointers contained in the EmberTreeWidgetItems. So reassign all pointers here.
|
||||
SyncPointers();
|
||||
tree->blockSignals(false);
|
||||
RenderPreviews(childCount, m_EmberFile.Size());
|
||||
RenderPreviews(childCount, uint(m_EmberFile.Size()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ void FractoriumEmberController<T>::RenderPreviews(uint start, uint end)
|
||||
}
|
||||
|
||||
tree->blockSignals(false);
|
||||
m_PreviewResult = QtConcurrent::run(m_PreviewRenderFunc, 0, m_EmberFile.Size());
|
||||
m_PreviewResult = QtConcurrent::run(m_PreviewRenderFunc, 0, uint(m_EmberFile.Size()));
|
||||
}
|
||||
else
|
||||
m_PreviewResult = QtConcurrent::run(m_PreviewRenderFunc, start, end);
|
||||
|
@ -60,7 +60,7 @@ void FractoriumEmberController<T>::NewFlock(size_t count)
|
||||
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
m_SheepTools->Random(ember, m_FilteredVariations, static_cast<intmax_t>(QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Frand<T>(-2, 2)), 0, MAX_CL_VARS);
|
||||
m_SheepTools->Random(ember, m_FilteredVariations, static_cast<intmax_t>(QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedFrand<T>(-2, 2)), 0, MAX_CL_VARS);
|
||||
ParamsToEmber(ember);
|
||||
ember.m_Index = i;
|
||||
ember.m_Name = m_EmberFile.m_Filename.toStdString() + "_" + ToString(i + 1ULL).toStdString();
|
||||
@ -119,7 +119,7 @@ void FractoriumEmberController<T>::NewRandomFlameInCurrentFile()
|
||||
{
|
||||
Ember<T> ember;
|
||||
StopPreviewRender();
|
||||
m_SheepTools->Random(ember, m_FilteredVariations, static_cast<int>(QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Frand<T>(-2, 2)), 0, MAX_CL_VARS);
|
||||
m_SheepTools->Random(ember, m_FilteredVariations, static_cast<int>(QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedFrand<T>(-2, 2)), 0, MAX_CL_VARS);
|
||||
ParamsToEmber(ember);
|
||||
ember.m_Name = EmberFile<T>::DefaultEmberName(m_EmberFile.Size() + 1).toStdString();
|
||||
ember.m_Index = m_EmberFile.Size();
|
||||
@ -172,7 +172,7 @@ void FractoriumEmberController<T>::OpenAndPrepFiles(const QStringList& filenames
|
||||
EmberFile<T> emberFile;
|
||||
XmlToEmber<T> parser;
|
||||
vector<Ember<T>> embers;
|
||||
uint previousSize = append ? m_EmberFile.Size() : 0;
|
||||
uint previousSize = append ? uint(m_EmberFile.Size()) : 0u;
|
||||
StopPreviewRender();
|
||||
emberFile.m_Filename = filenames[0];
|
||||
|
||||
@ -366,7 +366,7 @@ void Fractorium::OnActionSaveCurrentScreen(bool checked)
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::SaveCurrentToOpenedFile()
|
||||
{
|
||||
size_t i;
|
||||
uint i;
|
||||
bool fileFound = false;
|
||||
|
||||
for (i = 0; i < m_EmberFile.Size(); i++)
|
||||
@ -415,7 +415,7 @@ void FractoriumEmberController<T>::Undo()
|
||||
{
|
||||
int index = m_Ember.GetTotalXformIndex(CurrentXform());
|
||||
m_LastEditWasUndoRedo = true;
|
||||
m_UndoIndex = std::max(0u, m_UndoIndex - 1u);
|
||||
m_UndoIndex = std::max<size_t>(0u, m_UndoIndex - 1u);
|
||||
SetEmber(m_UndoList[m_UndoIndex], true);
|
||||
m_EditState = eEditUndoState::UNDO_REDO;
|
||||
|
||||
@ -439,7 +439,7 @@ void FractoriumEmberController<T>::Redo()
|
||||
{
|
||||
int index = m_Ember.GetTotalXformIndex(CurrentXform());
|
||||
m_LastEditWasUndoRedo = true;
|
||||
m_UndoIndex = std::min<uint>(m_UndoIndex + 1, m_UndoList.size() - 1);
|
||||
m_UndoIndex = std::min<size_t>(m_UndoIndex + 1, m_UndoList.size() - 1);
|
||||
SetEmber(m_UndoList[m_UndoIndex], true);
|
||||
m_EditState = eEditUndoState::UNDO_REDO;
|
||||
|
||||
@ -506,7 +506,7 @@ void Fractorium::OnActionCopyAllXml(bool checked) { m_Controller->CopyAllXml();
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::PasteXmlAppend()
|
||||
{
|
||||
uint i, previousSize = m_EmberFile.Size();
|
||||
size_t previousSize = m_EmberFile.Size();
|
||||
string s, errors;
|
||||
XmlToEmber<T> parser;
|
||||
vector<Ember<T>> embers;
|
||||
@ -514,7 +514,7 @@ void FractoriumEmberController<T>::PasteXmlAppend()
|
||||
auto b = codec->fromUnicode(QApplication::clipboard()->text());
|
||||
s.reserve(b.size());
|
||||
|
||||
for (i = 0; i < b.size(); i++)
|
||||
for (auto i = 0; i < b.size(); i++)
|
||||
{
|
||||
if (uint(b[i]) < 128u)
|
||||
s.push_back(b[i]);
|
||||
@ -532,7 +532,7 @@ void FractoriumEmberController<T>::PasteXmlAppend()
|
||||
|
||||
if (!embers.empty())
|
||||
{
|
||||
for (i = 0; i < embers.size(); i++)
|
||||
for (auto i = 0; i < embers.size(); i++)
|
||||
{
|
||||
embers[i].m_Index = m_EmberFile.Size();
|
||||
ConstrainDimensions(embers[i]);//Do not exceed the max texture size.
|
||||
@ -560,7 +560,6 @@ void Fractorium::OnActionPasteXmlAppend(bool checked) { m_Controller->PasteXmlAp
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::PasteXmlOver()
|
||||
{
|
||||
uint i;
|
||||
string s, errors;
|
||||
XmlToEmber<T> parser;
|
||||
auto backupEmber = m_EmberFile.m_Embers[0];
|
||||
@ -568,7 +567,7 @@ void FractoriumEmberController<T>::PasteXmlOver()
|
||||
auto b = codec->fromUnicode(QApplication::clipboard()->text());
|
||||
s.reserve(b.size());
|
||||
|
||||
for (i = 0; i < b.size(); i++)
|
||||
for (auto i = 0; i < b.size(); i++)
|
||||
{
|
||||
if (uint(b[i]) < 128u)
|
||||
s.push_back(b[i]);
|
||||
@ -587,7 +586,7 @@ void FractoriumEmberController<T>::PasteXmlOver()
|
||||
|
||||
if (m_EmberFile.Size())
|
||||
{
|
||||
for (i = 0; i < m_EmberFile.Size(); i++)
|
||||
for (auto i = 0; i < m_EmberFile.Size(); i++)
|
||||
{
|
||||
m_EmberFile.m_Embers[i].m_Index = i;
|
||||
ConstrainDimensions(m_EmberFile.m_Embers[i]);//Do not exceed the max texture size.
|
||||
@ -698,8 +697,8 @@ void FractoriumEmberController<T>::AddReflectiveSymmetry()
|
||||
Update([&]()
|
||||
{
|
||||
m_Ember.AddSymmetry(-1, m_Rand);
|
||||
int index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||
FillXforms(index);
|
||||
auto index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||
FillXforms(int(index));
|
||||
});
|
||||
}
|
||||
|
||||
@ -716,8 +715,8 @@ void FractoriumEmberController<T>::AddRotationalSymmetry()
|
||||
Update([&]()
|
||||
{
|
||||
m_Ember.AddSymmetry(2, m_Rand);
|
||||
int index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||
FillXforms(index);
|
||||
auto index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||
FillXforms(int(index));
|
||||
});
|
||||
}
|
||||
|
||||
@ -734,8 +733,8 @@ void FractoriumEmberController<T>::AddBothSymmetry()
|
||||
Update([&]()
|
||||
{
|
||||
m_Ember.AddSymmetry(-2, m_Rand);
|
||||
int index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||
FillXforms(index);
|
||||
auto index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||
FillXforms(int(index));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ void Fractorium::InitPaletteUI()
|
||||
/// <param name="s">The full path to the palette files folder</param>
|
||||
/// <returns>The number of palettes successfully added</returns>
|
||||
template <typename T>
|
||||
int FractoriumEmberController<T>::InitPaletteList(const string& s)
|
||||
size_t FractoriumEmberController<T>::InitPaletteList(const string& s)
|
||||
{
|
||||
QDirIterator it(s.c_str(), QStringList() << "*.xml", QDir::Files, QDirIterator::FollowSymlinks);
|
||||
m_PaletteList.Clear();
|
||||
@ -84,7 +84,7 @@ bool FractoriumEmberController<T>::FillPaletteTable(const string& s)
|
||||
auto palettePreviewTable = m_Fractorium->ui.PalettePreviewTable;
|
||||
m_CurrentPaletteFilePath = m_Fractorium->ui.PaletteFilenameCombo->property("path").toString().toStdString() + "/" + s;
|
||||
|
||||
if (size_t paletteSize = m_PaletteList.Size(m_CurrentPaletteFilePath))
|
||||
if (int paletteSize = int(m_PaletteList.Size(m_CurrentPaletteFilePath)))
|
||||
{
|
||||
paletteTable->clear();
|
||||
paletteTable->blockSignals(true);
|
||||
@ -98,7 +98,7 @@ bool FractoriumEmberController<T>::FillPaletteTable(const string& s)
|
||||
paletteTable->setHorizontalHeaderItem(1, paletteHeader);
|
||||
|
||||
//Palette list table.
|
||||
for (size_t i = 0; i < paletteSize; i++)
|
||||
for (auto i = 0; i < paletteSize; i++)
|
||||
{
|
||||
if (auto p = m_PaletteList.GetPalette(m_CurrentPaletteFilePath, i))
|
||||
{
|
||||
@ -106,7 +106,7 @@ bool FractoriumEmberController<T>::FillPaletteTable(const string& s)
|
||||
auto nameCol = new QTableWidgetItem(p->m_Name.c_str());
|
||||
nameCol->setToolTip(p->m_Name.c_str());
|
||||
paletteTable->setItem(i, 0, nameCol);
|
||||
QImage image(v.data(), p->Size(), PALETTE_CELL_HEIGHT, QImage::Format_RGB888);
|
||||
QImage image(v.data(), int(p->Size()), PALETTE_CELL_HEIGHT, QImage::Format_RGB888);
|
||||
auto paletteItem = new PaletteTableWidgetItem<T>(p);
|
||||
paletteItem->setData(Qt::DecorationRole, QPixmap::fromImage(image));
|
||||
paletteTable->setItem(i, 1, paletteItem);
|
||||
@ -168,7 +168,7 @@ void FractoriumEmberController<T>::UpdateAdjustedPaletteGUI(Palette<T>& palette)
|
||||
{
|
||||
//Use the adjusted palette to fill the preview palette control so the user can see the effects of applying the adjustements.
|
||||
vector<byte> v = palette.MakeRgbPaletteBlock(PALETTE_CELL_HEIGHT);//Make the palette repeat for PALETTE_CELL_HEIGHT rows.
|
||||
m_FinalPaletteImage = QImage(palette.Size(), PALETTE_CELL_HEIGHT, QImage::Format_RGB888);//Create a QImage out of it.
|
||||
m_FinalPaletteImage = QImage(int(palette.Size()), PALETTE_CELL_HEIGHT, QImage::Format_RGB888);//Create a QImage out of it.
|
||||
memcpy(m_FinalPaletteImage.scanLine(0), v.data(), v.size() * sizeof(v[0]));//Memcpy the data in.
|
||||
QPixmap pixmap(QPixmap::fromImage(m_FinalPaletteImage));//Create a QPixmap out of the QImage.
|
||||
previewPaletteItem->setData(Qt::DecorationRole, pixmap.scaled(QSize(pixmap.width(), palettePreviewTable->rowHeight(0) + 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));//Set the pixmap on the palette tab.
|
||||
@ -235,7 +235,7 @@ void Fractorium::OnPaletteCellClicked(int row, int col)
|
||||
{
|
||||
if (auto item = dynamic_cast<PaletteTableWidgetItemBase*>(ui.PaletteListTable->item(row, 1)))
|
||||
{
|
||||
auto index = item->Index();
|
||||
auto index = int(item->Index());
|
||||
|
||||
if (m_PreviousPaletteRow != index)
|
||||
{
|
||||
@ -272,7 +272,7 @@ void Fractorium::OnPaletteRandomSelectButtonClicked(bool checked)
|
||||
uint i = 0;
|
||||
int rowCount = ui.PaletteListTable->rowCount() - 1;
|
||||
|
||||
while ((i = QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Rand(rowCount)) == uint(m_PreviousPaletteRow));
|
||||
while ((i = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(rowCount)) == uint(m_PreviousPaletteRow));
|
||||
|
||||
if (checked)
|
||||
OnPaletteCellDoubleClicked(i, 1);//Will clear the adjustments.
|
||||
@ -287,22 +287,21 @@ void Fractorium::OnPaletteRandomSelectButtonClicked(bool checked)
|
||||
/// </summary>
|
||||
void Fractorium::OnPaletteRandomAdjustButtonClicked(bool checked)
|
||||
{
|
||||
auto gRand = QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand.get();
|
||||
m_PaletteHueSpin->setValue(-180 + gRand->Rand(361));
|
||||
m_PaletteSaturationSpin->setValue(-50 + gRand->Rand(101));//Full range of these leads to bad palettes, so clamp range.
|
||||
m_PaletteBrightnessSpin->setValue(-50 + gRand->Rand(101));
|
||||
m_PaletteContrastSpin->setValue(-50 + gRand->Rand(101));
|
||||
m_PaletteHueSpin->setValue(-180 + QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(361));
|
||||
m_PaletteSaturationSpin->setValue(-50 + QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(101));//Full range of these leads to bad palettes, so clamp range.
|
||||
m_PaletteBrightnessSpin->setValue(-50 + QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(101));
|
||||
m_PaletteContrastSpin->setValue(-50 + QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(101));
|
||||
|
||||
//Doing frequency and blur together gives bad palettes that are just a solid color.
|
||||
if (gRand->RandBit())
|
||||
if (QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRandBit())
|
||||
{
|
||||
m_PaletteBlurSpin->setValue(gRand->Rand(21));
|
||||
m_PaletteBlurSpin->setValue(QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(21));
|
||||
m_PaletteFrequencySpin->setValue(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_PaletteBlurSpin->setValue(0);
|
||||
m_PaletteFrequencySpin->setValue(1 + gRand->Rand(10));
|
||||
m_PaletteFrequencySpin->setValue(1 + QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(10));
|
||||
}
|
||||
|
||||
OnPaletteAdjust(0);
|
||||
|
@ -260,7 +260,7 @@ bool FractoriumEmberController<T>::SyncSizes()
|
||||
if (!m_GLController->SizesMatch())
|
||||
{
|
||||
m_GLController->ClearWindow();
|
||||
gl->SetDimensions(m_Ember.m_FinalRasW, m_Ember.m_FinalRasH);
|
||||
gl->SetDimensions(int(m_Ember.m_FinalRasW), int(m_Ember.m_FinalRasH));
|
||||
gl->Allocate();
|
||||
gl->SetViewport();
|
||||
|
||||
@ -660,12 +660,12 @@ bool Fractorium::CreateControllerFromOptions()
|
||||
|
||||
if (!m_Controller.get() || (m_Controller->SizeOfT() != elementSize))
|
||||
{
|
||||
double hue = m_PaletteHueSpin->value();
|
||||
double sat = m_PaletteSaturationSpin->value();
|
||||
double bright = m_PaletteBrightnessSpin->value();
|
||||
double con = m_PaletteContrastSpin->value();
|
||||
double blur = m_PaletteBlurSpin->value();
|
||||
double freq = m_PaletteFrequencySpin->value();
|
||||
auto hue = m_PaletteHueSpin->value();
|
||||
auto sat = m_PaletteSaturationSpin->value();
|
||||
auto bright = m_PaletteBrightnessSpin->value();
|
||||
auto con = m_PaletteContrastSpin->value();
|
||||
auto blur = m_PaletteBlurSpin->value();
|
||||
auto freq = m_PaletteFrequencySpin->value();
|
||||
#ifdef DO_DOUBLE
|
||||
Ember<double> ed;
|
||||
EmberFile<double> efd;
|
||||
|
@ -180,8 +180,8 @@ void FractoriumSettings::FinalTemporalSamples(uint i) { setValue(FINALTEMPO
|
||||
uint FractoriumSettings::FinalSupersample() { return value(FINALSUPERSAMPLE).toUInt(); }
|
||||
void FractoriumSettings::FinalSupersample(uint i) { setValue(FINALSUPERSAMPLE, i); }
|
||||
|
||||
uint FractoriumSettings::FinalStrips() { return value(FINALSTRIPS).toUInt(); }
|
||||
void FractoriumSettings::FinalStrips(uint i) { setValue(FINALSTRIPS, i); }
|
||||
size_t FractoriumSettings::FinalStrips() { return value(FINALSTRIPS).toULongLong(); }
|
||||
void FractoriumSettings::FinalStrips(size_t i) { setValue(FINALSTRIPS, uint(i)); }
|
||||
|
||||
/// <summary>
|
||||
/// Xml file saving settings.
|
||||
|
@ -77,16 +77,16 @@ public:
|
||||
|
||||
bool EarlyClip();
|
||||
void EarlyClip(bool b);
|
||||
|
||||
|
||||
bool YAxisUp();
|
||||
void YAxisUp(bool b);
|
||||
|
||||
bool Transparency();
|
||||
void Transparency(bool b);
|
||||
|
||||
|
||||
bool OpenCL();
|
||||
void OpenCL(bool b);
|
||||
|
||||
|
||||
bool Double();
|
||||
void Double(bool b);
|
||||
|
||||
@ -113,13 +113,13 @@ public:
|
||||
|
||||
uint OpenCLSubBatch();
|
||||
void OpenCLSubBatch(uint i);
|
||||
|
||||
|
||||
uint RandomCount();
|
||||
void RandomCount(uint i);
|
||||
|
||||
bool FinalEarlyClip();
|
||||
void FinalEarlyClip(bool b);
|
||||
|
||||
|
||||
bool FinalYAxisUp();
|
||||
void FinalYAxisUp(bool b);
|
||||
|
||||
@ -131,7 +131,7 @@ public:
|
||||
|
||||
bool FinalDouble();
|
||||
void FinalDouble(bool b);
|
||||
|
||||
|
||||
bool FinalSaveXml();
|
||||
void FinalSaveXml(bool b);
|
||||
|
||||
@ -143,10 +143,10 @@ public:
|
||||
|
||||
bool FinalKeepAspect();
|
||||
void FinalKeepAspect(bool b);
|
||||
|
||||
|
||||
uint FinalScale();
|
||||
void FinalScale(uint i);
|
||||
|
||||
|
||||
QString FinalExt();
|
||||
void FinalExt(const QString& s);
|
||||
|
||||
@ -168,8 +168,8 @@ public:
|
||||
uint FinalSupersample();
|
||||
void FinalSupersample(uint i);
|
||||
|
||||
uint FinalStrips();
|
||||
void FinalStrips(uint i);
|
||||
size_t FinalStrips();
|
||||
void FinalStrips(size_t i);
|
||||
|
||||
uint XmlTemporalSamples();
|
||||
void XmlTemporalSamples(uint i);
|
||||
|
@ -101,7 +101,7 @@ void FractoriumEmberController<T>::AddXform()
|
||||
newXform.m_Weight = 0.25;
|
||||
newXform.m_ColorX = m_Rand.Frand01<T>();
|
||||
m_Ember.AddXform(newXform);
|
||||
int index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||
int index = int(m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1));//Set index to the last item before final.
|
||||
FillXforms(index);
|
||||
});
|
||||
}
|
||||
@ -148,7 +148,7 @@ void FractoriumEmberController<T>::AddLinkedXform()
|
||||
|
||||
xform->SetXaos(count - 1, 1);//Set the xaos value for the previous xform pointing to the new one to one.
|
||||
xform->m_Opacity = 0;//Clear the opacity of the previous xform.
|
||||
int index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||
int index = int(m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1));//Set index to the last item before final.
|
||||
FillXforms(index);
|
||||
FillXaos();
|
||||
}, eXformUpdate::UPDATE_CURRENT);
|
||||
@ -178,7 +178,7 @@ void FractoriumEmberController<T>::DuplicateXform()
|
||||
for (auto& it : vec)
|
||||
m_Ember.AddXform(it);
|
||||
|
||||
int index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||
int index = int(m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1));//Set index to the last item before final.
|
||||
FillXforms(index);//Handles xaos.
|
||||
});
|
||||
}
|
||||
@ -257,7 +257,7 @@ void FractoriumEmberController<T>::DeleteXforms()
|
||||
|
||||
if (offset)
|
||||
{
|
||||
int index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final. Note final is requeried one last time.
|
||||
int index = int(m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1));//Set index to the last item before final. Note final is requeried one last time.
|
||||
FillXforms(index);
|
||||
UpdateRender();
|
||||
}
|
||||
@ -284,7 +284,7 @@ void FractoriumEmberController<T>::AddFinalXform()
|
||||
auto combo = m_Fractorium->ui.CurrentXformCombo;
|
||||
final.AddVariation(new LinearVariation<T>());//Just a placeholder so other parts of the code don't see it as being empty.
|
||||
m_Ember.SetFinalXform(final);
|
||||
int index = m_Ember.TotalXformCount() - 1;//Set index to the last item.
|
||||
int index = int(m_Ember.TotalXformCount() - 1);//Set index to the last item.
|
||||
FillXforms(index);
|
||||
});
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ void Fractorium::OnCurvesBlueRadioButtonToggled(bool checked) { if (checked) ui
|
||||
template <typename T>
|
||||
QColor FractoriumEmberController<T>::ColorIndexToQColor(double d)
|
||||
{
|
||||
v4T entry = m_Ember.m_Palette[Clamp<int>(d * COLORMAP_LENGTH_MINUS_1, 0, m_Ember.m_Palette.Size())];
|
||||
v4T entry = m_Ember.m_Palette[Clamp<size_t>(d * COLORMAP_LENGTH_MINUS_1, 0, m_Ember.m_Palette.Size())];
|
||||
entry.r *= 255;
|
||||
entry.g *= 255;
|
||||
entry.b *= 255;
|
||||
@ -220,9 +220,9 @@ void FractoriumEmberController<T>::FillCurvesControl()
|
||||
{
|
||||
m_Fractorium->ui.CurvesView->blockSignals(true);
|
||||
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
for (auto i = 0; i < 4; i++)
|
||||
{
|
||||
for (size_t j = 1; j < 3; j++)//Only do middle points.
|
||||
for (auto j = 1; j < 3; j++)//Only do middle points.
|
||||
{
|
||||
QPointF point(m_Ember.m_Curves.m_Points[i][j].x, m_Ember.m_Curves.m_Points[i][j].y);
|
||||
m_Fractorium->ui.CurvesView->Set(i, j, point);
|
||||
|
@ -255,13 +255,13 @@ void GLEmberController<T>::QueryMatrices(bool print)
|
||||
|
||||
if (print)
|
||||
{
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
for (glm::length_t i = 0; i < 4; i++)
|
||||
qDebug() << "Viewport[" << i << "] = " << m_Viewport[i] << "\n";
|
||||
|
||||
for (size_t i = 0; i < 16; i++)
|
||||
for (glm::length_t i = 0; i < 16; i++)
|
||||
qDebug() << "Modelview[" << i << "] = " << glm::value_ptr(m_Modelview)[i] << "\n";
|
||||
|
||||
for (size_t i = 0; i < 16; i++)
|
||||
for (glm::length_t i = 0; i < 16; i++)
|
||||
qDebug() << "Projection[" << i << "] = " << glm::value_ptr(m_Projection)[i] << "\n";
|
||||
}
|
||||
}
|
||||
|
@ -995,7 +995,7 @@ int GLEmberController<T>::UpdateHover(v3T& glCoords)
|
||||
bool post = m_Fractorium->ui.PostAffineGroupBox->isChecked();
|
||||
bool preAll = pre && m_Fractorium->DrawAllPre();
|
||||
bool postAll = post && m_Fractorium->DrawAllPost();
|
||||
uint bestIndex = -1;
|
||||
int bestIndex = -1;
|
||||
T bestDist = 10;
|
||||
auto ember = m_FractoriumEmberController->CurrentEmber();
|
||||
m_HoverType = eHoverType::HoverNone;
|
||||
@ -1012,12 +1012,12 @@ int GLEmberController<T>::UpdateHover(v3T& glCoords)
|
||||
if (CheckXformHover(m_SelectedXform, glCoords, bestDist, checkSelPre, checkSelPost))
|
||||
{
|
||||
m_HoverXform = m_SelectedXform;
|
||||
bestIndex = ember->GetTotalXformIndex(m_SelectedXform);
|
||||
bestIndex = int(ember->GetTotalXformIndex(m_SelectedXform));
|
||||
}
|
||||
}
|
||||
|
||||
//Check all xforms.
|
||||
for (size_t i = 0; i < ember->TotalXformCount(); i++)
|
||||
for (int i = 0; i < int(ember->TotalXformCount()); i++)
|
||||
{
|
||||
auto xform = ember->GetTotalXform(i);
|
||||
|
||||
@ -1186,7 +1186,8 @@ void GLEmberController<T>::CalcDragXAxis()
|
||||
|
||||
if (GetShift())
|
||||
{
|
||||
v3T snapped = GetControl() ? SnapToNormalizedAngle(m_MouseWorldPos + m_DragHandleOffset, 24) : m_MouseWorldPos + m_DragHandleOffset;
|
||||
auto posOffset = m_MouseWorldPos + m_DragHandleOffset;
|
||||
v3T snapped = GetControl() ? SnapToNormalizedAngle(posOffset, 24u) : posOffset;
|
||||
auto startDiff = (v2T(m_MouseDownWorldPos) * scale) - m_DragSrcTransform.O();
|
||||
auto endDiff = (v2T(snapped) * scale) - m_DragSrcTransform.O();
|
||||
T startAngle = std::atan2(startDiff.y, startDiff.x);
|
||||
@ -1222,11 +1223,12 @@ void GLEmberController<T>::CalcDragXAxis()
|
||||
else
|
||||
{
|
||||
v3T diff;
|
||||
auto posOffset = m_MouseWorldPos + m_DragHandleOffset;
|
||||
|
||||
if (GetControl())
|
||||
diff = SnapToGrid(m_MouseWorldPos + m_DragHandleOffset) - m_MouseDownWorldPos;
|
||||
diff = SnapToGrid(posOffset) - m_MouseDownWorldPos;
|
||||
else
|
||||
diff = (m_MouseWorldPos + m_DragHandleOffset) - m_MouseDownWorldPos;
|
||||
diff = posOffset - m_MouseDownWorldPos;
|
||||
|
||||
auto origXPlusOff = v3T(m_DragSrcTransform.X(), 0) + (diff * scale);
|
||||
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform)
|
||||
@ -1274,7 +1276,8 @@ void GLEmberController<T>::CalcDragYAxis()
|
||||
|
||||
if (GetShift())
|
||||
{
|
||||
v3T snapped = GetControl() ? SnapToNormalizedAngle(m_MouseWorldPos + m_DragHandleOffset, 24) : m_MouseWorldPos + m_DragHandleOffset;
|
||||
auto posOffset = m_MouseWorldPos + m_DragHandleOffset;
|
||||
v3T snapped = GetControl() ? SnapToNormalizedAngle(posOffset, 24u) : posOffset;
|
||||
auto startDiff = (v2T(m_MouseDownWorldPos) * scale) - m_DragSrcTransform.O();
|
||||
auto endDiff = (v2T(snapped) * scale) - m_DragSrcTransform.O();
|
||||
T startAngle = std::atan2(startDiff.y, startDiff.x);
|
||||
@ -1310,11 +1313,12 @@ void GLEmberController<T>::CalcDragYAxis()
|
||||
else
|
||||
{
|
||||
v3T diff;
|
||||
auto posOffset = m_MouseWorldPos + m_DragHandleOffset;
|
||||
|
||||
if (GetControl())
|
||||
diff = SnapToGrid(m_MouseWorldPos + m_DragHandleOffset) - m_MouseDownWorldPos;
|
||||
diff = SnapToGrid(posOffset) - m_MouseDownWorldPos;
|
||||
else
|
||||
diff = (m_MouseWorldPos + m_DragHandleOffset) - m_MouseDownWorldPos;
|
||||
diff = posOffset - m_MouseDownWorldPos;
|
||||
|
||||
auto origXPlusOff = v3T(m_DragSrcTransform.Y(), 0) + (diff * scale);
|
||||
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform)
|
||||
|
@ -43,6 +43,8 @@ void SpinBox::SetValueStealth(int d)
|
||||
blockSignals(false);
|
||||
}
|
||||
|
||||
void SpinBox::SetValueStealth(size_t d) { SetValueStealth(int(d)); }
|
||||
|
||||
/// <summary>
|
||||
/// Set whether to respond to double click events.
|
||||
/// </summary>
|
||||
|
@ -19,6 +19,7 @@ public:
|
||||
explicit SpinBox(QWidget* p = 0, int height = 16, int step = 1);
|
||||
virtual ~SpinBox() { }
|
||||
void SetValueStealth(int d);
|
||||
void SetValueStealth(size_t d);
|
||||
void DoubleClick(bool b);
|
||||
void DoubleClickZero(int val);
|
||||
void DoubleClickNonZero(int val);
|
||||
|
@ -127,10 +127,10 @@ void FractoriumVariationsDialog::OnSelectNoneButtonClicked(bool checked)
|
||||
void FractoriumVariationsDialog::Populate()
|
||||
{
|
||||
auto table = ui.VariationsTable;
|
||||
auto size = std::max<size_t>(std::max<size_t>(m_VariationList.RegSize(), m_VariationList.PreSize()), m_VariationList.PostSize());
|
||||
int size = int(std::max<size_t>(std::max<size_t>(m_VariationList.RegSize(), m_VariationList.PreSize()), m_VariationList.PostSize()));
|
||||
table->setRowCount(size);
|
||||
|
||||
for (size_t i = 0; i < size; i++)
|
||||
for (auto i = 0; i < size; i++)
|
||||
{
|
||||
if (auto pre = m_VariationList.GetVariation(i, eVariationType::VARTYPE_PRE))
|
||||
{
|
||||
|
Reference in New Issue
Block a user