0.4.1.3 Beta 10/14/2014

--User Changes
 Size is no longer fixed to the window size.
 Size scaling is done differently in the final render dialog. This fixes several bugs.
 Remove Xml saving size from settings and options dialog, it no longer applies.
 Final render can be broken into strips.
 Set default save path to the desktop if none is found in the settings file.
 Set default output size to 1920x1080 if none is found in the settings file.

--Bug Fixes
 Better memory size reporting in final render dialog.

--Code Changes
 Migrate to C++11, Qt 5.3.1, and Visual Studio 2013.
 Change most instances of unsigned int to size_t, and int to intmax_t.
 Add m_OrigPixPerUnit and m_ScaleType to Ember for scaling purposes.
 Replace some sprintf_s() calls in XmlToEmber with ostringstream.
 Move more non-templated members into RendererBase.
 Add CopyVec() overload that takes a per element function pointer.
 Add vector Memset().
 Replace '&' with '+' instead of "&" in XmlToEmber for much faster parsing.
 Break strips rendering out into EmberCommon and call from EmberRender and Fractorium.
 Make AddAndWriteBuffer() just call WriteBuffer().
 Make AddAndWriteImage() delete the existing image first before replacing it.
 Add SetOutputTexture() to RendererCL to support making new textures in response to resize events.
 Remove multiple return statements in RendererCL, and replace with a bool that tracks results.
 Add ToDouble(), MakeEnd(), ToString() and Exists() wrappers in Fractorium.
 Add Size() wrapper in EmberFile.
 Make QString function arguments const QString&, and string with const string&.
 Make ShowCritical() wrapper for invoking a message box from another thread.
 Add combo box to TwoButtonWidget and rename.
This commit is contained in:
mfeemster 2014-10-14 08:53:15 -07:00
parent 44c90abb32
commit 9e94170a70
80 changed files with 4358 additions and 3661 deletions

View File

@ -13,7 +13,7 @@
<!--
Change this for every release.
-->
<?define ProductCode="{2EA7558B-E7F2-4138-8F19-AC019735D729}"?>
<?define ProductCode="{38F12108-7903-4502-91EE-7125DC2B15A2}"?>
<Product Id="$(var.ProductCode)" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package

View File

@ -279,6 +279,7 @@
<ClInclude Include="..\..\..\Source\Ember\Interpolate.h" />
<ClInclude Include="..\..\..\Source\Ember\PaletteList.h" />
<ClInclude Include="..\..\..\Source\Ember\Renderer.h" />
<ClInclude Include="..\..\..\Source\Ember\RendererBase.h" />
<ClInclude Include="..\..\..\Source\Ember\SpatialFilter.h" />
<ClInclude Include="..\..\..\Source\Ember\Iterator.h" />
<ClInclude Include="..\..\..\Source\Ember\Palette.h" />
@ -313,6 +314,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\Source\Ember\Renderer.cpp" />
<ClCompile Include="..\..\..\Source\Ember\RendererBase.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\libxml2\win32\VC10\libxml2.vcxproj">

View File

@ -110,6 +110,9 @@
<ClInclude Include="..\..\..\Source\Ember\VariationsDC.h">
<Filter>Header Files\Variations</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\Ember\RendererBase.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\Source\Ember\DllMain.cpp">
@ -127,5 +130,8 @@
<ClCompile Include="..\..\..\Source\Ember\Renderer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\Ember\RendererBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -245,6 +245,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)"</
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<StringPooling>true</StringPooling>
<FloatingPointExceptions>false</FloatingPointExceptions>
<AdditionalOptions>/bigobj -Zm150 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -276,6 +277,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)"</
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<StringPooling>true</StringPooling>
<FloatingPointExceptions>false</FloatingPointExceptions>
<AdditionalOptions>/bigobj -Zm150 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -399,7 +401,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)"</
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_TwoButtonWidget.cpp">
<ClCompile Include="GeneratedFiles\Debug\moc_TwoButtonComboWidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@ -479,11 +481,11 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)"</
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\ReleaseNvidia\moc_TwoButtonWidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ClCompile Include="GeneratedFiles\ReleaseNvidia\moc_TwoButtonComboWidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_AboutDialog.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -545,7 +547,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)"</
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_TwoButtonWidget.cpp">
<ClCompile Include="GeneratedFiles\Release\moc_TwoButtonComboWidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@ -701,31 +703,31 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)"</
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/FractoriumSettings.h"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/FractoriumSettings.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
</CustomBuild>
<CustomBuild Include="..\..\..\Source\Fractorium\TwoButtonWidget.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing TwoButtonWidget.h...</Message>
<CustomBuild Include="..\..\..\Source\Fractorium\TwoButtonComboWidget.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing TwoButtonComboWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing TwoButtonWidget.h...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonComboWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing TwoButtonComboWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing TwoButtonWidget.h...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|Win32'">Moc%27ing TwoButtonWidget.h...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonComboWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing TwoButtonComboWidget.h...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|Win32'">Moc%27ing TwoButtonComboWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing TwoButtonWidget.h...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">Moc%27ing TwoButtonWidget.h...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonComboWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonComboWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing TwoButtonComboWidget.h...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">Moc%27ing TwoButtonComboWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonComboWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(AMDAPPSDKROOT)\include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='ReleaseNvidia|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/TwoButtonComboWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(ProjectDir)..\..\..\..\glew\include" "-I$(CUDA_PATH)include" "-I.\GeneratedFiles\$(ConfigurationName)\."</Command>
</CustomBuild>
<ClInclude Include="..\..\..\Source\EmberCommon\EmberCommon.h" />
<ClInclude Include="..\..\..\Source\Fractorium\FinalRenderEmberController.h" />
@ -1119,7 +1121,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)"</
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties UicDir=".\GeneratedFiles" MocDir=".\GeneratedFiles\$(ConfigurationName)" MocOptions="" RccDir=".\GeneratedFiles" lupdateOnBuild="0" lupdateOptions="" lreleaseOptions="" Qt5Version_x0020_Win32="5.3.1" Qt5Version_x0020_x64="5.3.1" />
<UserProperties UicDir=".\GeneratedFiles" MocDir=".\GeneratedFiles\$(ConfigurationName)" MocOptions="" RccDir=".\GeneratedFiles" lupdateOnBuild="0" lupdateOptions="" lreleaseOptions="" Qt5Version_x0020_Win32="5.4" Qt5Version_x0020_x64="5.4" />
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@ -133,15 +133,6 @@
<ClCompile Include="..\..\..\Source\Fractorium\GLEmberController.cpp">
<Filter>Controllers</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_TwoButtonWidget.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_TwoButtonWidget.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\ReleaseNvidia\moc_TwoButtonWidget.cpp">
<Filter>Generated Files\ReleaseNvidia</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_TableWidget.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
@ -232,6 +223,15 @@
<ClCompile Include="GeneratedFiles\ReleaseNvidia\moc_AboutDialog.cpp">
<Filter>Generated Files\ReleaseNvidia</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_TwoButtonComboWidget.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_TwoButtonComboWidget.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\ReleaseNvidia\moc_TwoButtonComboWidget.cpp">
<Filter>Generated Files\ReleaseNvidia</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GeneratedFiles\ui_Fractorium.h">
@ -323,7 +323,7 @@
<CustomBuild Include="..\..\..\Source\Fractorium\FractoriumSettings.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="..\..\..\Source\Fractorium\TwoButtonWidget.h">
<CustomBuild Include="..\..\..\Source\Fractorium\TwoButtonComboWidget.h">
<Filter>Widgets</Filter>
</CustomBuild>
</ItemGroup>

View File

@ -1,3 +1,35 @@
0.4.1.3 Beta 10/14/2014
--User Changes
Size is no longer fixed to the window size.
Size scaling is done differently in the final render dialog. This fixes several bugs.
Remove Xml saving size from settings and options dialog, it no longer applies.
Final render can be broken into strips.
Set default save path to the desktop if none is found in the settings file.
Set default output size to 1920x1080 if none is found in the settings file.
--Bug Fixes
Better memory size reporting in final render dialog.
--Code Changes
Migrate to C++11, Qt 5.3.1, and Visual Studio 2013.
Change most instances of unsigned int to size_t, and int to intmax_t.
Add m_OrigPixPerUnit and m_ScaleType to Ember for scaling purposes.
Replace some sprintf_s() calls in XmlToEmber with ostringstream.
Move more non-templated members into RendererBase.
Add CopyVec() overload that takes a per element function pointer.
Add vector Memset().
Replace '&' with '+' instead of "&amp;" in XmlToEmber for much faster parsing.
Break strips rendering out into EmberCommon and call from EmberRender and Fractorium.
Make AddAndWriteBuffer() just call WriteBuffer().
Make AddAndWriteImage() delete the existing image first before replacing it.
Add SetOutputTexture() to RendererCL to support making new textures in response to resize events.
Remove multiple return statements in RendererCL, and replace with a bool that tracks results.
Add ToDouble(), MakeEnd(), ToString() and Exists() wrappers in Fractorium.
Add Size() wrapper in EmberFile.
Make QString function arguments const QString&, and string with const string&.
Make ShowCritical() wrapper for invoking a message box from another thread.
Add combo box to TwoButtonWidget and rename.
0.4.1.2 Beta 08/05/2014
--User Changes
Add --yaxisup and --supersample options for command line programs.

View File

@ -39,7 +39,7 @@ public:
/// <param name="rasW">The width in pixels of the raster image/histogram</param>
/// <param name="rasH">The height in pixels of the raster image/histogram</param>
/// <param name="aspectRatio">The aspect ratio, generally 1</param>
CarToRas(T carLlX, T carLlY, T carUrX, T carUrY, unsigned int rasW, unsigned int rasH, T aspectRatio)
CarToRas(T carLlX, T carLlY, T carUrX, T carUrY, size_t rasW, size_t rasH, T aspectRatio)
{
Init(carLlX, carLlY, carUrX, carUrY, rasW, rasH, aspectRatio);
}
@ -113,7 +113,7 @@ public:
/// <param name="rasW">The width in pixels of the raster image/histogram</param>
/// <param name="rasH">The height in pixels of the raster image/histogram</param>
/// <param name="aspectRatio">The aspect ratio, generally 1</param>
void Init(T carLlX, T carLlY, T carUrX, T carUrY, unsigned int rasW, unsigned int rasH, T aspectRatio)
void Init(T carLlX, T carLlY, T carUrX, T carUrY, size_t rasW, size_t rasH, T aspectRatio)
{
m_RasWidth = rasW;
m_RasHeight = rasH;
@ -156,10 +156,10 @@ public:
/// <param name="cartY">The cartesian y</param>
/// <param name="rasX">The converted raster x</param>
/// <param name="rasY">The converted raster y</param>
inline void Convert(T cartX, T cartY, unsigned int& rasX, unsigned int& rasY)
inline void Convert(T cartX, T cartY, size_t& rasX, size_t& rasY)
{
rasX = (unsigned int)(m_PixPerImageUnitW * cartX - m_RasLlX);
rasY = (unsigned int)(m_RasLlY - (m_PixPerImageUnitH * cartY));
rasX = (size_t)(m_PixPerImageUnitW * cartX - m_RasLlX);
rasY = (size_t)(m_RasLlY - (m_PixPerImageUnitH * cartY));
}
/// <summary>
@ -173,9 +173,9 @@ public:
/// <param name="cartX">The cartesian x</param>
/// <param name="cartY">The cartesian y</param>
/// <param name="singleBufferIndex">The converted single raster buffer index</param>
inline void Convert(T cartX, T cartY, unsigned int& singleBufferIndex)
inline void Convert(T cartX, T cartY, size_t& singleBufferIndex)
{
singleBufferIndex = (unsigned int)(m_PixPerImageUnitW * cartX - m_RasLlX) + (m_RasWidth * (unsigned int)(m_PixPerImageUnitH * cartY - m_RasLlY));
singleBufferIndex = (size_t)(m_PixPerImageUnitW * cartX - m_RasLlX) + (m_RasWidth * (size_t)(m_PixPerImageUnitH * cartY - m_RasLlY));
}
/// <summary>
@ -190,9 +190,9 @@ public:
/// </summary>
/// <param name="point">The cartesian y</param>
/// <param name="singleBufferIndex">The converted single raster buffer index</param>
inline void Convert(Point<T>& point, unsigned int& singleBufferIndex)
inline void Convert(Point<T>& point, size_t& singleBufferIndex)
{
singleBufferIndex = (unsigned int)(m_PixPerImageUnitW * point.m_X - m_RasLlX) + (m_RasWidth * (unsigned int)(m_PixPerImageUnitH * point.m_Y - m_RasLlY));
singleBufferIndex = (size_t)(m_PixPerImageUnitW * point.m_X - m_RasLlX) + (m_RasWidth * (size_t)(m_PixPerImageUnitH * point.m_Y - m_RasLlY));
}
/// <summary>
@ -221,8 +221,8 @@ public:
/// <summary>
/// Accessors.
/// </summary>
inline unsigned int RasWidth() const { return m_RasWidth; }
inline unsigned int RasHeight() const { return m_RasHeight; }
inline size_t RasWidth() const { return m_RasWidth; }
inline size_t RasHeight() const { return m_RasHeight; }
inline T OneRow() const { return m_OneRow; }
inline T OneCol() const { return m_OneCol; }
inline T PixPerImageUnitW() const { return m_PixPerImageUnitW; }
@ -239,7 +239,7 @@ public:
inline T PadCarUrY() const { return m_PadCarUrY; }
private:
unsigned int m_RasWidth, m_RasHeight;//The width and height of the raster image.
size_t m_RasWidth, m_RasHeight;//The width and height of the raster image.
T m_OneRow;//The distance that one raster row represents in the cartesian plane.
T m_OneCol;//The distance that one raster column represents in the cartesian plane.
T m_PixPerImageUnitW;//The number of columns in the raster plane that a horizontal distance of 1 in the cartesian plane represents. The higher the number, the more zoomed in.

View File

@ -18,7 +18,7 @@ public:
DensityFilterBase() { }
virtual ~DensityFilterBase() { }
virtual int FilterWidth() const { return 0; }
virtual intmax_t FilterWidth() const { return 0; }
};
/// <summary>
@ -42,7 +42,7 @@ public:
/// <param name="maxRad">The maximum filter radius</param>
/// <param name="curve">The curve of the filter</param>
/// <param name="supersample">The supersample of the ember this filter will be used with</param>
DensityFilter(T minRad, T maxRad, T curve, unsigned int supersample)
DensityFilter(T minRad, T maxRad, T curve, size_t supersample)
{
m_MinRad = minRad;
m_MaxRad = maxRad;
@ -99,10 +99,10 @@ public:
/// <returns>True if success, else false.</returns>
bool Create()
{
int i, j, w;
size_t w;
int intFilterCount, maxIndex;
int rowSize;
int filterLoop;
size_t filterLoop;
int keepThresh = 100;
unsigned int filterCoefIndex = 0;
T decFilterCount;
@ -147,8 +147,8 @@ public:
//Generate the filter coefficients.
for (filterLoop = 0; filterLoop < maxIndex; filterLoop++)
{
int dej, dek;
int coefIndex;
intmax_t dej, dek;
size_t coefIndex;
T filterSum = 0.0;
T filterVal;
T filterHeight;
@ -218,9 +218,9 @@ public:
//This will populate one quadrant of filter indices.
//Really only need 1/8th, but that would require a sparse matrix.
for (j = 0; j <= m_FilterWidth; j++)
for (intmax_t j = 0; j <= m_FilterWidth; j++)
{
for (i = 0; i <= j; i++, filterCoefIndex++)
for (intmax_t i = 0; i <= j; i++, filterCoefIndex++)
{
if (j == 0 && i == 0)
{
@ -265,7 +265,7 @@ public:
/// <returns>The string representation of this density estimation filter</returns>
string ToString() const
{
unsigned int i, j, coefIndex = 0, w = m_FilterWidth + 1;
size_t i, j, coefIndex = 0, w = m_FilterWidth + 1;
stringstream ss;
ss
@ -312,15 +312,15 @@ public:
inline T MinRad() const { return m_MinRad; }
inline T MaxRad() const { return m_MaxRad; }
inline T Curve() const { return m_Curve; }
inline unsigned int Supersample() const { return m_Supersample; }
inline unsigned int KernelSize() const { return m_KernelSize; }
inline unsigned int MaxFilterIndex() const { return m_MaxFilterIndex; }
inline unsigned int MaxFilteredCounts() const { return m_MaxFilteredCounts; }
virtual int FilterWidth() const override { return m_FilterWidth; }
inline unsigned int BufferSize() const { return (unsigned int)m_Widths.size(); }
inline unsigned int CoefsSizeBytes() const { return BufferSize() * m_KernelSize * sizeof(T); }
inline unsigned int WidthsSizeBytes() const { return BufferSize() * sizeof(T); }
inline unsigned int CoefsIndicesSizeBytes() const { return (unsigned int)(m_CoefIndices.size() * sizeof(unsigned int)); }
inline size_t Supersample() const { return m_Supersample; }
inline size_t KernelSize() const { return m_KernelSize; }
inline size_t MaxFilterIndex() const { return m_MaxFilterIndex; }
inline size_t MaxFilteredCounts() const { return m_MaxFilteredCounts; }
virtual intmax_t FilterWidth() const override { return m_FilterWidth; }
inline size_t BufferSize() const { return m_Widths.size(); }
inline size_t CoefsSizeBytes() const { return BufferSize() * m_KernelSize * sizeof(T); }
inline size_t WidthsSizeBytes() const { return BufferSize() * sizeof(T); }
inline size_t CoefsIndicesSizeBytes() const { return (m_CoefIndices.size() * sizeof(m_CoefIndices[0])); }
inline const T* Coefs() const { return m_Coefs.data(); }
inline const T* Widths() const { return m_Widths.data(); }
inline const unsigned int* CoefIndices() const { return m_CoefIndices.data(); }
@ -329,11 +329,11 @@ private:
T m_MinRad;
T m_MaxRad;//The original specified filter radius.
T m_Curve;
unsigned int m_Supersample;
unsigned int m_KernelSize;
unsigned int m_MaxFilterIndex;
unsigned int m_MaxFilteredCounts;
int m_FilterWidth;//The new radius after scaling for super sample and rounding. This is what's actually used.
size_t m_Supersample;
size_t m_KernelSize;
size_t m_MaxFilterIndex;
size_t m_MaxFilteredCounts;
intmax_t m_FilterWidth;//The new radius after scaling for super sample and rounding. This is what's actually used.
vector<T> m_Coefs;
vector<T> m_Widths;
vector<unsigned int> m_CoefIndices;

View File

@ -91,6 +91,7 @@ public:
m_FinalRasH = ember.m_FinalRasH;
m_OrigFinalRasW = ember.m_OrigFinalRasW;
m_OrigFinalRasH = ember.m_OrigFinalRasH;
m_OrigPixPerUnit = ember.m_OrigPixPerUnit;
m_Supersample = ember.m_Supersample;
m_Passes = ember.m_Passes;
m_TemporalSamples = ember.m_TemporalSamples;
@ -137,11 +138,12 @@ public:
m_ParentFilename = ember.m_ParentFilename;
m_Index = ember.m_Index;
m_ScaleType = ember.ScaleType();
m_Palette = ember.m_Palette;
m_Xforms.clear();
for (unsigned int i = 0; i < ember.XformCount(); i++)
for (size_t i = 0; i < ember.XformCount(); i++)
{
if (Xform<U>* p = ember.GetXform(i))
{
@ -181,6 +183,7 @@ public:
m_FinalRasH = 1080;
m_OrigFinalRasW = 1920;
m_OrigFinalRasH = 1080;
m_OrigPixPerUnit = 240;
m_Supersample = 1;
m_Passes = 1;
m_TemporalSamples = 1000;
@ -233,6 +236,7 @@ public:
//Internal values.
m_Index = 0;
m_ScaleType = eScaleType::SCALE_NONE;
m_Xforms.reserve(12);
m_Edits = nullptr;
@ -253,9 +257,9 @@ public:
/// Add the specified number of empty xforms.
/// </summary>
/// <param name="count">The number of xforms to add</param>
void AddXforms(unsigned int count)
void AddXforms(size_t count)
{
for (unsigned int i = 0; i < count; i++)
for (size_t i = 0; i < count; i++)
{
Xform<T> xform;
@ -267,7 +271,7 @@ public:
/// Add empty padding xforms until the total xform count is xformPad.
/// </summary>
/// <param name="xformPad">The total number of xforms to finish with</param>
void PadXforms(unsigned int xformPad)
void PadXforms(size_t xformPad)
{
if (xformPad > XformCount())
AddXforms(xformPad - XformCount());
@ -279,7 +283,7 @@ public:
/// <param name="xformPad">The total number of xforms if additional padding xforms are desired. Default: 0.</param>
/// <param name="doFinal">Whether to copy the final xform. Default: false.</param>
/// <returns>The newly constructed ember</returns>
Ember<T> Copy(unsigned int xformPad = 0, bool doFinal = false)
Ember<T> Copy(size_t xformPad = 0, bool doFinal = false)
{
Ember<T> ember(*this);
@ -311,7 +315,7 @@ public:
/// </summary>
/// <param name="i">The index to delete</param>
/// <returns>True if success, else false.</returns>
bool DeleteXform(unsigned int i)
bool DeleteXform(size_t i)
{
Xform<T>* xform;
@ -320,11 +324,11 @@ public:
m_Xforms.erase(m_Xforms.begin() + i);
//Now shuffle xaos values from i on back by 1 for every xform.
for (unsigned int x1 = 0; x1 < XformCount(); x1++)
for (size_t x1 = 0; x1 < XformCount(); x1++)
{
if ((xform = GetXform(x1)))
{
for (unsigned int x2 = i + 1; x2 <= XformCount(); x2++)//Iterate from the position after the deletion index up to the old count.
for (size_t x2 = i + 1; x2 <= XformCount(); x2++)//Iterate from the position after the deletion index up to the old count.
xform->SetXaos(x2 - 1, xform->Xaos(x2));
xform->TruncateXaos();//Make sure no old values are hanging around in case more xforms are added to this ember later.
@ -342,7 +346,7 @@ public:
/// </summary>
/// <param name="i">The index to delete</param>
/// <returns>True if success, else false.</returns>
bool DeleteTotalXform(unsigned int i)
bool DeleteTotalXform(size_t i)
{
if (DeleteXform(i))
{ }
@ -359,7 +363,7 @@ public:
/// </summary>
/// <param name="i">The index to get</param>
/// <returns>A pointer to the xform at the index if successful, else nullptr.</returns>
Xform<T>* GetXform(unsigned int i) const
Xform<T>* GetXform(size_t i) const
{
if (i < XformCount())
return (Xform<T>*)&m_Xforms[i];
@ -373,7 +377,7 @@ public:
/// <param name="i">The index to get</param>
/// <param name="forceFinal">If true, return the final xform when its index is requested even if one is not present</param>
/// <returns>A pointer to the xform at the index if successful, else nullptr.</returns>
Xform<T>* GetTotalXform(unsigned int i, bool forceFinal = false) const
Xform<T>* GetTotalXform(size_t i, bool forceFinal = false) const
{
if (i < XformCount())
return (Xform<T>*)&m_Xforms[i];
@ -388,13 +392,13 @@ public:
/// </summary>
/// <param name="xform">A pointer to the xform to find</param>
/// <returns>The index of the matched xform if found, else -1.</returns>
int GetXformIndex(Xform<T>* xform) const
intmax_t GetXformIndex(Xform<T>* xform) const
{
int index = -1;
intmax_t index = -1;
for (unsigned int i = 0; i < m_Xforms.size(); i++)
for (size_t i = 0; i < m_Xforms.size(); i++)
if (GetXform(i) == xform)
return (int)i;
return (intmax_t)i;
return index;
}
@ -404,13 +408,13 @@ public:
/// </summary>
/// <param name="xform">A pointer to the xform to find</param>
/// <returns>The index of the matched xform if found, else -1.</returns>
int GetTotalXformIndex(Xform<T>* xform) const
intmax_t GetTotalXformIndex(Xform<T>* xform) const
{
unsigned int totalXformCount = TotalXformCount();
size_t totalXformCount = TotalXformCount();
for (unsigned int i = 0; i < totalXformCount; i++)
for (size_t i = 0; i < totalXformCount; i++)
if (GetTotalXform(i) == xform)
return (int)i;
return (intmax_t)i;
return -1;
}
@ -449,7 +453,7 @@ public:
/// </summary>
void DeleteMotionElements()
{
for (unsigned int i = 0; i < TotalXformCount(); i++)
for (size_t i = 0; i < TotalXformCount(); i++)
GetTotalXform(i)->DeleteMotionElements();
}
@ -458,7 +462,7 @@ public:
/// </summary>
void CacheXforms()
{
for (unsigned int i = 0; i < TotalXformCount(); i++)
for (size_t i = 0; i < TotalXformCount(); i++)
{
Xform<T>* xform = GetTotalXform(i);
@ -467,9 +471,13 @@ public:
}
}
/// <summary>
/// Set the projection function pointer based on the
/// values of the 3D fields.
/// </summary>
void SetProjFunc()
{
unsigned int projBits = ProjBits();
size_t projBits = ProjBits();
if (!projBits)//No 3D at all, then do nothing.
{
@ -514,11 +522,11 @@ public:
/// Determine whether xaos is used in any xform, excluding final.
/// </summary>
/// <returns>True if any xaos found, else false.</returns>
bool XaosPresent()
bool XaosPresent() const
{
bool b = false;
ForEach(m_Xforms, [&](Xform<T>& xform) { b |= xform.XaosPresent(); });//If at least one entry is not equal to 1, then xaos is present.
ForEach(m_Xforms, [&](const Xform<T>& xform) { b |= xform.XaosPresent(); });//If at least one entry is not equal to 1, then xaos is present.
return b;
}
@ -538,20 +546,41 @@ public:
/// <param name="width">New width</param>
/// <param name="height">New height</param>
/// <param name="onlyScaleIfNewIsSmaller">True to only scale if the new dimensions are smaller than the original, else always scale.</param>
void SetSizeAndAdjustScale(unsigned int width, unsigned int height, bool onlyScaleIfNewIsSmaller, eScaleType scaleType)
void SetSizeAndAdjustScale(size_t width, size_t height, bool onlyScaleIfNewIsSmaller, eScaleType scaleType)
{
if ((onlyScaleIfNewIsSmaller && (width < m_FinalRasW || height < m_FinalRasH)) || !onlyScaleIfNewIsSmaller)
if ((onlyScaleIfNewIsSmaller && (width < m_OrigFinalRasW || height < m_OrigFinalRasH)) || !onlyScaleIfNewIsSmaller)
{
if (scaleType == SCALE_WIDTH)
m_PixelsPerUnit *= T(width) / T(m_FinalRasW);
m_PixelsPerUnit = m_OrigPixPerUnit * (T(width) / T(m_OrigFinalRasW));
else if (scaleType == SCALE_HEIGHT)
m_PixelsPerUnit *= T(height) / T(m_FinalRasH);
m_PixelsPerUnit = m_OrigPixPerUnit * (T(height) / T(m_OrigFinalRasH));
}
m_ScaleType = scaleType;
m_FinalRasW = width;
m_FinalRasH = height;
}
/// <summary>
/// Set the original final output image dimensions to be equal to the current ones.
/// </summary>
void SyncSize()
{
m_OrigFinalRasW = m_FinalRasW;
m_OrigFinalRasH = m_FinalRasH;
m_OrigPixPerUnit = m_PixelsPerUnit;
}
/// <summary>
/// Set the current final output image dimensions to be equal to the original ones.
/// </summary>
void RestoreSize()
{
m_FinalRasW = m_OrigFinalRasW;
m_FinalRasH = m_OrigFinalRasH;
m_PixelsPerUnit = m_OrigPixPerUnit;
}
/// <summary>
/// Set all xform weights to 1 / xform count.
/// </summary>
@ -586,7 +615,7 @@ public:
/// </summary>
void GetPresentVariations(vector<Variation<T>*>& variations, bool baseOnly = true) const
{
unsigned int i = 0, xformIndex = 0, totalVarCount = m_FinalXform.TotalVariationCount();
size_t i = 0, xformIndex = 0, totalVarCount = m_FinalXform.TotalVariationCount();
variations.clear();
ForEach(m_Xforms, [&](const Xform<T>& xform) { totalVarCount += xform.TotalVariationCount(); });
@ -675,7 +704,7 @@ public:
return;
bool allID, final;
unsigned int i, j, k, l, maxXformCount, totalXformCount;
size_t l, maxXformCount, totalXformCount;
T bgAlphaSave = m_Background.a;
T coefSave[2] {0, 0};
vector<Xform<T>*> xformVec;
@ -683,15 +712,15 @@ public:
//Palette and others
if (embers[0].m_PaletteInterp == INTERP_HSV)
{
for (i = 0; i < 256; i++)
for (glm::length_t i = 0; i < 256; i++)
{
T t[3], s[4] = { 0, 0, 0, 0 };
for (k = 0; k < size; k++)
for (glm::length_t k = 0; k < size; k++)
{
Palette<T>::RgbToHsv(glm::value_ptr(embers[k].m_Palette[i]), t);
for (j = 0; j < 3; j++)
for (size_t j = 0; j < 3; j++)
s[j] += coefs[k] * t[j];
s[3] += coefs[k] * embers[k].m_Palette[i][3];
@ -700,16 +729,16 @@ public:
Palette<T>::HsvToRgb(s, glm::value_ptr(m_Palette[i]));
m_Palette[i][3] = s[3];
for (j = 0; j < 4; j++)
for (glm::length_t j = 0; j < 4; j++)
Clamp<T>(m_Palette[i][j], 0, 1);
}
}
else if (embers[0].m_PaletteInterp == INTERP_SWEEP)
{
//Sweep - not the best option for float indices.
for (i = 0; i < 256; i++)
for (glm::length_t i = 0; i < 256; i++)
{
j = (i < (256 * coefs[0])) ? 0 : 1;
size_t j = (i < (256 * coefs[0])) ? 0 : 1;
m_Palette[i] = embers[j].m_Palette[i];
}
}
@ -764,9 +793,9 @@ public:
xformVec.reserve(size);
//Populate the xform list member such that each element is a merge of all of the xforms at that position in all of the embers.
for (i = 0; i < totalXformCount; i++)//For each xform to populate.
for (size_t i = 0; i < totalXformCount; i++)//For each xform to populate.
{
for (j = 0; j < size; j++)//For each ember in the list.
for (size_t j = 0; j < size; j++)//For each ember in the list.
{
if (i < embers[j].TotalXformCount())//Xform in this position in this ember.
{
@ -784,7 +813,7 @@ public:
//Now have a merged list, so interpolate the weight values.
//This includes all xforms plus final.
for (i = 0; i < totalXformCount; i++)
for (size_t i = 0; i < totalXformCount; i++)
{
Xform<T>* thisXform = GetTotalXform(i);
@ -796,7 +825,7 @@ public:
coefs[1] = 1 - coefs[0];
}
for (j = 0; j < thisXform->TotalVariationCount(); j++)//For each variation in this xform.
for (size_t j = 0; j < thisXform->TotalVariationCount(); j++)//For each variation in this xform.
{
Variation<T>* var = thisXform->GetVariation(j);
ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(var);//Will use below if it's parametric.
@ -806,7 +835,7 @@ public:
if (parVar != nullptr)
parVar->Clear();
for (k = 0; k < size; k++)//For each ember in the list.
for (size_t k = 0; k < size; k++)//For each ember in the list.
{
Xform<T>* tempXform = embers[k].GetTotalXform(i);//Xform in this position in this ember, including final.
@ -867,7 +896,7 @@ public:
//Post part.
allID = true;
for (k = 0; k < size; k++)//For each ember in the list.
for (size_t k = 0; k < size; k++)//For each ember in the list.
{
if (i < embers[k].TotalXformCount())//Xform in this position in this ember.
{
@ -896,7 +925,7 @@ public:
thisXform->m_Affine.m_Mat = m23T(0);
thisXform->m_Post.m_Mat = m23T(0);
for (k = 0; k < size; k++)
for (size_t k = 0; k < size; k++)
{
Xform<T>* tempXform = embers[k].GetTotalXform(i);//Xform in this position in this ember.
@ -930,23 +959,23 @@ public:
//Omit final xform from chaos processing.
if (Interpolater<T>::AnyXaosPresent(embers, size))
{
for (i = 0; i < XformCount(); i++)
for (size_t i = 0; i < XformCount(); i++)
{
m_Xforms[i].SetXaos(i, 0);//First make each xform xaos array be maxXformCount elements long and set them to zero.
//Now fill them with interpolated values.
for (j = 0; j < size; j++)//For each ember in the list.
for (size_t j = 0; j < size; j++)//For each ember in the list.
{
Xform<T>* tempXform = embers[j].GetXform(i);
for (k = 0; k < XformCount(); k++)//For each xaos entry in this xform's xaos array, sum it with the same entry in all of the embers multiplied by the coef for that ember.
for (size_t k = 0; k < XformCount(); k++)//For each xaos entry in this xform's xaos array, sum it with the same entry in all of the embers multiplied by the coef for that ember.
{
m_Xforms[i].SetXaos(k, m_Xforms[i].Xaos(k) + tempXform->Xaos(k) * coefs[j]);
}
}
//Make sure no xaos entries for this xform were less than zero.
for (k = 0; k < XformCount(); k++)
for (size_t k = 0; k < XformCount(); k++)
if (m_Xforms[i].Xaos(k) < 0)
m_Xforms[i].SetXaos(k, 0);
}
@ -994,7 +1023,7 @@ public:
/// <param name="angle">The angle to rotate by</param>
void RotateAffines(T angle)
{
for (unsigned int i = 0; i < XformCount(); i++)//Only look at normal xforms, exclude final.
for (size_t i = 0; i < XformCount(); i++)//Only look at normal xforms, exclude final.
{
//Don't rotate xforms with animate set to 0.
if (m_Xforms[i].m_Animate == 0)
@ -1021,7 +1050,7 @@ public:
/// <param name="rand">The random context to use for generating random symmetry</param>
void AddSymmetry(int sym, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
{
int i, k, result = 0;
size_t i, k, result = 0;
T a;
if (sym == 0)
@ -1102,9 +1131,9 @@ public:
/// Return a uint with bits set to indicate which kind of projection should be done.
/// </summary>
/// <param name="onlyScaleIfNewIsSmaller">A uint with bits set for each kind of projection that is needed</param>
unsigned int ProjBits()
size_t ProjBits()
{
unsigned int val = 0;
size_t val = 0;
if (m_CamZPos != 0) val |= PROJBITS_ZPOS;
if (m_CamPerspective != 0) val |= PROJBITS_PERSP;
@ -1251,6 +1280,7 @@ public:
m_PaletteInterp = INTERP_HSV;
m_Index = 0;
m_ParentFilename = "";
m_ScaleType = eScaleType::SCALE_NONE;
if (useDefaults)
{
@ -1339,20 +1369,21 @@ public:
/// <returns>The string representation of this ember</returns>
string ToString() const
{
unsigned int i;
size_t i;
ostringstream ss;
ss << "FinalRasW: " << m_FinalRasW << endl
<< "FinalRasH: " << m_FinalRasH << endl
<< "OrigRasW: " << m_OrigFinalRasW << endl
<< "OrigRasH: " << m_OrigFinalRasH << endl
ss << "Final Raster Width: " << m_FinalRasW << endl
<< "Final Raster Height: " << m_FinalRasH << endl
<< "Original Raster Width: " << m_OrigFinalRasW << endl
<< "Original Raster Height: " << m_OrigFinalRasH << endl
<< "Supersample: " << m_Supersample << endl
<< "Passes: " << m_Passes << endl
<< "TemporalSamples: " << m_TemporalSamples << endl
<< "Temporal Samples: " << m_TemporalSamples << endl
<< "Symmetry: " << m_Symmetry << endl
<< "Quality: " << m_Quality << endl
<< "PixelsPerUnit: " << m_PixelsPerUnit << endl
<< "Pixels Per Unit: " << m_PixelsPerUnit << endl
<< "Original Pixels Per Unit: " << m_OrigPixPerUnit << endl
<< "Zoom: " << m_Zoom << endl
<< "ZPos: " << m_CamZPos << endl
<< "Perspective: " << m_CamPerspective << endl
@ -1366,8 +1397,8 @@ public:
<< "Brightness: " << m_Brightness << endl
<< "Gamma: " << m_Gamma << endl
<< "Vibrancy: " << m_Vibrancy << endl
<< "GammaThresh: " << m_GammaThresh << endl
<< "HighlightPower: " << m_HighlightPower << endl
<< "Gamma Threshold: " << m_GammaThresh << endl
<< "Highlight Power: " << m_HighlightPower << endl
<< "Time: " << m_Time << endl
<< "Background: " << m_Background.r << ", " << m_Background.g << ", " << m_Background.b << ", " << m_Background.a << endl
@ -1391,6 +1422,8 @@ public:
//Add palette info here if needed.
<< "Name: " << m_Name << endl
<< "Index: " << m_Index << endl
<< "Scale Type: " << m_ScaleType << endl
<< "Parent Filename: " << m_ParentFilename << endl
<< endl;
@ -1410,34 +1443,36 @@ public:
/// </summary>
inline const Xform<T>* Xforms() const { return &m_Xforms[0]; }
inline Xform<T>* NonConstXforms() { return &m_Xforms[0]; }
inline unsigned int XformCount() const { return (unsigned int)m_Xforms.size(); }
inline size_t XformCount() const { return m_Xforms.size(); }
inline const Xform<T>* FinalXform() const { return &m_FinalXform; }
inline Xform<T>* NonConstFinalXform() { return &m_FinalXform; }
inline bool UseFinalXform() const { return !m_FinalXform.Empty(); }
inline unsigned int TotalXformCount() const { return XformCount() + (UseFinalXform() ? 1 : 0); }
inline size_t TotalXformCount() const { return XformCount() + (UseFinalXform() ? 1 : 0); }
inline int PaletteIndex() const { return m_Palette.m_Index; }
inline T BlurCoef() { return m_BlurCoef; }
inline eScaleType ScaleType() const { return m_ScaleType; }
//The width and height in pixels of the final output image. The size of the histogram and DE filtering buffers will differ from this.
//Xml fields: "size".
unsigned int m_FinalRasW;
unsigned int m_FinalRasH;
unsigned int m_OrigFinalRasW;//Keep track of the originals read from the Xml, because...
unsigned int m_OrigFinalRasH;//the dimension may change in an editor and the originals are needed for the aspect ratio.
size_t m_FinalRasW;
size_t m_FinalRasH;
size_t m_OrigFinalRasW;//Keep track of the originals read from the Xml, because...
size_t m_OrigFinalRasH;//the dimension may change in an editor and the originals are needed for the aspect ratio.
T m_OrigPixPerUnit;
//The multiplier in size of the histogram and DE filtering buffers. Must be at least one, preferrably never larger than 4, only useful at 2.
//Xml field: "supersample" or "overample (deprecated)".
unsigned int m_Supersample;
size_t m_Supersample;
//Times to run the algorithm while clearing the histogram, but not the filter. Almost always set to 1 and may even be deprecated.
//Xml field: "passes".
unsigned int m_Passes;
size_t m_Passes;
//When animating, split each pass into this many pieces, each doing a fraction of the total iterations. Each temporal sample
//will render an interpolated instance of the ember that is a fraction of the current ember and the next one.
//When rendering a single image, this field is always set to 1.
//Xml field: "temporal_samples".
unsigned int m_TemporalSamples;
size_t m_TemporalSamples;
//Whether or not any symmetry was added. This field is in a bit of a state of conflict right now as flam3 has a severe bug.
//Xml field: "symmetry".
@ -1611,9 +1646,14 @@ public:
xmlDocPtr m_Edits;
//The 0-based position of this ember in the file it was contained in.
int m_Index;
size_t m_Index;
private:
/// <summary>
/// The type of scaling used when resizing.
/// </summary>
eScaleType m_ScaleType;
/// <summary>
/// Interpolation function that takes the address of a member variable of type T as a template parameter.
/// This is an alternative to using macros.
@ -1651,7 +1691,7 @@ private:
/// <param name="embers">The list of embers to interpolate</param>
/// <param name="coefs">The list of coefficients to interpolate</param>
/// <param name="size">The size of the lists, both must match.</param>
template <unsigned int Ember<T>::*m>
template <size_t Ember<T>::*m>
void InterpI(Ember<T>* embers, vector<T>& coefs, size_t size)
{
T t = 0;
@ -1659,7 +1699,7 @@ private:
for (size_t k = 0; k < size; k++)
t += coefs[k] * embers[k].*m;
this->*m = (int)Rint(t);
this->*m = (size_t)Rint(t);
}
/// <summary>
@ -1672,7 +1712,7 @@ private:
/// <param name="coefs">The list of coefficients to interpolate</param>
/// <param name="size">The size of the lists, both must match.</param>
template <T Xform<T>::*m>
void InterpXform(Xform<T>* xform, unsigned int i, Ember<T>* embers, vector<T>& coefs, size_t size)
void InterpXform(Xform<T>* xform, size_t i, Ember<T>* embers, vector<T>& coefs, size_t size)
{
xform->*m = T(0);

View File

@ -40,7 +40,7 @@ public:
/// <param name="start">Whether a new file is to be started</param>
/// <param name="finish">Whether an existing file is to be ended</param>
/// <returns>True if successful, else false</returns>
bool Save(string filename, Ember<T>& ember, unsigned int printEditDepth, bool doEdits, bool intPalette, bool hexPalette, bool append = false, bool start = false, bool finish = false)
bool Save(const string& filename, Ember<T>& ember, size_t printEditDepth, bool doEdits, bool intPalette, bool hexPalette, bool append = false, bool start = false, bool finish = false)
{
vector<Ember<T>> vec;
@ -61,7 +61,7 @@ public:
/// <param name="start">Whether a new file is to be started</param>
/// <param name="finish">Whether an existing file is to be ended</param>
/// <returns>True if successful, else false</returns>
bool Save(string filename, vector<Ember<T>>& embers, unsigned int printEditDepth, bool doEdits, bool intPalette, bool hexPalette, bool append = false, bool start = false, bool finish = false)
bool Save(const string& filename, vector<Ember<T>>& embers, size_t printEditDepth, bool doEdits, bool intPalette, bool hexPalette, bool append = false, bool start = false, bool finish = false)
{
bool b = false;
string temp;
@ -124,9 +124,9 @@ public:
/// <param name="intPalette">If true use integers instead of floating point numbers when embedding a non-hex formatted palette, else use floating point numbers.</param>
/// <param name="hexPalette">If true, embed a hexadecimal palette instead of Xml Color tags, else use Xml color tags.</param>
/// <returns>The Xml string representation of the passed in ember</returns>
string ToString(Ember<T>& ember, string extraAttributes, unsigned int printEditDepth, bool doEdits, bool intPalette, bool hexPalette = true)
string ToString(Ember<T>& ember, string extraAttributes, size_t printEditDepth, bool doEdits, bool intPalette, bool hexPalette = true)
{
unsigned int i, j;
size_t i, j;
string s;
ostringstream os;
vector<Variation<T>*> variations;
@ -144,7 +144,7 @@ public:
os << " zoom=\"" << ember.m_Zoom << "\"";
os << " rotate=\"" << ember.m_Rotate << "\"";
os << " supersample=\"" << max(1u, ember.m_Supersample) << "\"";
os << " supersample=\"" << max<size_t>(1, ember.m_Supersample) << "\"";
os << " filter=\"" << ember.m_SpatialFilterRadius << "\"";
os << " filter_shape=\"" << ToLower(SpatialFilterCreator<T>::ToString(ember.m_SpatialFilterType)) << "\"";
@ -227,7 +227,7 @@ public:
for (j = 0; j < 8; j++)
{
int idx = 8 * i + j;
size_t idx = 8 * i + j;
os << hex << setw(2) << setfill('0') << (int)Rint(ember.m_Palette[idx][0] * 255);
os << hex << setw(2) << setfill('0') << (int)Rint(ember.m_Palette[idx][1] * 255);
@ -295,13 +295,13 @@ public:
xmlDocPtr CreateNewEditdoc(Ember<T>* parent0, Ember<T>* parent1, string action, string nick, string url, string id, string comment, int sheepGen = 0, int sheepId = 0)
{
char timeString[128];
char buffer[128];
char commentString[128];
time_t myTime;
string s;
xmlDocPtr commentDoc = nullptr;
xmlDocPtr doc = xmlNewDoc(XC "1.0");
xmlNodePtr rootNode = nullptr, node = nullptr, nodeCopy = nullptr;
xmlNodePtr rootComment = nullptr;
ostringstream os;
//Create the root node, called "edit".
rootNode = xmlNewNode(nullptr, XC "edit");
@ -342,25 +342,32 @@ public:
node = xmlNewChild(rootNode, nullptr, XC "sheep", nullptr);
//Create the sheep attributes.
sprintf_s(buffer, 128, "%d", sheepGen);
xmlNewProp(node, XC "generation", XC buffer);
os << sheepGen;
s = os.str();
xmlNewProp(node, XC "generation", XC s.c_str());
os.str("");
sprintf_s(buffer, 128, "%d", sheepId);
xmlNewProp(node, XC "id", XC buffer);
os << sheepId;
s = os.str();
xmlNewProp(node, XC "id", XC s.c_str());
os.str("");
}
//Check for the parents.
//If parent 0 not specified, this is a randomly generated genome.
if (parent0)
{
os << parent0->m_Index;
s = os.str();
if (parent0->m_Edits)
{
//Copy the node from the parent.
node = xmlDocGetRootElement(parent0->m_Edits);
nodeCopy = xmlCopyNode(node, 1);
AddFilenameWithoutAmpersand(nodeCopy, parent0->m_ParentFilename);
sprintf_s(buffer, 128, "%d", parent0->m_Index);
xmlNewProp(nodeCopy, XC "index", XC buffer);
xmlNewProp(nodeCopy, XC "index", XC s.c_str());
xmlAddChild(rootNode, nodeCopy);
}
else
@ -368,21 +375,24 @@ public:
//Insert a (parent has no edit) message.
nodeCopy = xmlNewChild(rootNode, nullptr, XC "edit", nullptr);
AddFilenameWithoutAmpersand(nodeCopy, parent0->m_ParentFilename);
sprintf_s(buffer, 128, "%d", parent0->m_Index);
xmlNewProp(nodeCopy, XC "index", XC buffer);
xmlNewProp(nodeCopy, XC "index", XC s.c_str());
}
os.str("");
}
if (parent1)
{
os << parent1->m_Index;
s = os.str();
if (parent1->m_Edits)
{
//Copy the node from the parent.
node = xmlDocGetRootElement(parent1->m_Edits);
nodeCopy = xmlCopyNode(node, 1);
AddFilenameWithoutAmpersand(nodeCopy, parent1->m_ParentFilename);
sprintf_s(buffer, 128, "%d", parent1->m_Index);
xmlNewProp(nodeCopy, XC "index", XC buffer);
xmlNewProp(nodeCopy, XC "index", XC s.c_str());
xmlAddChild(rootNode, nodeCopy);
}
else
@ -390,22 +400,25 @@ public:
//Insert a (parent has no edit) message.
nodeCopy = xmlNewChild(rootNode, nullptr, XC "edit",nullptr);
AddFilenameWithoutAmpersand(nodeCopy, parent1->m_ParentFilename);
sprintf_s(buffer, 128, "%d", parent1->m_Index);
xmlNewProp(nodeCopy, XC "index", XC buffer);
xmlNewProp(nodeCopy, XC "index", XC s.c_str());
}
os.str("");
}
//Comment string:
//This one's hard, since the comment string must be treated as
//a valid XML document. Create a new document using the comment
//a valid XML document. Create a new document using the comment
//string as the in-memory document, and then copy all children of
//the root node into the edit structure
//Parsing the comment string should be done once and then copied
//for each new edit doc, but that's for later.
if (comment != "")
{
sprintf_s(commentString, 128, "<comm>%s</comm>", comment.c_str());
commentDoc = xmlReadMemory(commentString, (int)strlen(commentString), "comment.env", nullptr, XML_PARSE_NONET);
os << "<comm>" << comment << "</comm>";
s = os.str();
commentDoc = xmlReadMemory(s.c_str(), (int)s.length(), "comment.env", nullptr, XML_PARSE_NONET);
os.str("");
//Check for errors.
if (commentDoc != nullptr)
@ -429,7 +442,7 @@ public:
}
}
//Return the xml doc.
//Return the Xml doc.
return doc;
}
@ -442,9 +455,9 @@ private:
/// <param name="isFinal">True if the xform is the final xform in the ember, else false.</param>
/// <param name="doMotion">If true, include motion elements in the Xml string, else omit.</param>
/// <returns>The Xml string representation of the passed in xform</returns>
string ToString(Xform<T>& xform, unsigned int xformCount, bool isFinal, bool doMotion)
string ToString(Xform<T>& xform, size_t xformCount, bool isFinal, bool doMotion)
{
unsigned int i, j;
size_t i, j;
ostringstream os;
if (doMotion)
@ -561,13 +574,13 @@ private:
/// <param name="formatting">If true, include newlines and tabs, else don't.</param>
/// <param name="printEditDepth">How deep the edit depth goes</param>
/// <returns>The edit node Xml string</returns>
string ToString(xmlNodePtr editNode, unsigned int tabs, bool formatting, unsigned int printEditDepth)
string ToString(xmlNodePtr editNode, size_t tabs, bool formatting, size_t printEditDepth)
{
bool indentPrinted = false;
const char* tabString = " ", *attStr;
const char* editString = "edit";
const char* sheepString = "sheep";
unsigned int ti;//, editOrSheep = 0;
size_t ti;//, editOrSheep = 0;
xmlAttrPtr attPtr = nullptr, curAtt = nullptr;
xmlNodePtr childPtr = nullptr, curChild = nullptr;
ostringstream os;

View File

@ -36,11 +36,11 @@ public:
/// <param name="sourceEmbers">The array of embers to align</param>
/// <param name="destEmbers">The array which will contain the aligned embers </param>
/// <param name="count">The number of elements in sourceEmbers</param>
static void Align(Ember<T>* sourceEmbers, Ember<T>* destEmbers, unsigned int count)
static void Align(Ember<T>* sourceEmbers, Ember<T>* destEmbers, size_t count)
{
bool aligned = true;
bool currentFinal, final = sourceEmbers[0].UseFinalXform();
unsigned int i, xf, currentCount, maxCount = sourceEmbers[0].XformCount();
size_t i, xf, currentCount, maxCount = sourceEmbers[0].XformCount();
Xform<T>* destXform;
Xform<T>* destOtherXform;
@ -80,7 +80,7 @@ public:
//All embers will have the same number of xforms at this point.
for (i = 0; i < count; i++)
{
unsigned int ii;
size_t ii;
for (xf = 0; xf < maxCount; xf++)//This will include both normal xforms and the final.
{
@ -104,7 +104,7 @@ public:
//If the current xform index is greater than what the original xform count was for this ember, then it's a padding xform.
if (xf >= sourceEmbers[i].TotalXformCount() && !aligned)
{
unsigned int found = 0;
size_t found = 0;
//Remove linear.
destXform->DeleteVariationById(VAR_LINEAR);
@ -304,7 +304,7 @@ public:
/// <returns>True if at least one ember contained xaos, else false.</returns>
static bool AnyXaosPresent(Ember<T>* embers, size_t size)
{
for (unsigned int i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
if (embers[i].XaosPresent())
return true;
@ -316,7 +316,7 @@ public:
/// </summary>
/// <param name="embers">The vector of embers to inspect for the greatest xform count</param>
/// <returns>The greatest non-final xform count in any of the embers</returns>
static unsigned int MaxXformCount(vector<Ember<T>>& embers)
static size_t MaxXformCount(vector<Ember<T>>& embers)
{
return MaxXformCount(embers.data(), embers.size());
}
@ -327,9 +327,9 @@ public:
/// <param name="embers">The array of embers to inspect</param>
/// <param name="size">The size of the embers array</param>
/// <returns>The greatest non-final xform count in any of the embers</returns>
static unsigned int MaxXformCount(Ember<T>* embers, size_t size)
static size_t MaxXformCount(Ember<T>* embers, size_t size)
{
unsigned int i, maxCount = 0;
size_t i, maxCount = 0;
for (i = 0; i < size; i++)
if (embers[i].XformCount() > maxCount)
@ -473,7 +473,7 @@ public:
{
Xform<T> xform;
for (unsigned int xf = 0; xf < xforms.size(); xf++)
for (size_t xf = 0; xf < xforms.size(); xf++)
MergeXformVariations1Way(xforms[xf], &xform, false, clearWeights);
return xform;
@ -488,7 +488,7 @@ public:
/// <param name="clearWeights">If true, set variation weights in dest to 0, else copy weights</param>
static void MergeXformVariations1Way(Xform<T>* source, Xform<T>* dest, bool parVarsOnly, bool clearWeights)
{
for (unsigned int i = 0; i < source->TotalVariationCount(); i++)//Iterate through the first xform's variations.
for (size_t i = 0; i < source->TotalVariationCount(); i++)//Iterate through the first xform's variations.
{
Variation<T>* var = source->GetVariation(i);//Grab the variation at index in in the first xform.
Variation<T>* var2 = dest->GetVariationById(var->VariationId());//See if the same variation exists in the second xform.
@ -551,19 +551,19 @@ public:
ParamWithName<T>* secondParams = second->Params();
//Iterate through each of the source variations.
for (unsigned int i = 0; i < first.size(); i++)
for (size_t i = 0; i < first.size(); i++)
{
ParametricVariation<T>* firstVar = first[i];
//Make sure the source variation at this index is the same type as the variation being written to.
if (firstVar->VariationId() == second->VariationId())
{
unsigned int size = firstVar->ParamCount();
size_t size = firstVar->ParamCount();
ParamWithName<T>* firstParams = firstVar->Params();
//Multiply each parameter of the variation at this index by the coefficient at this index, and add
//the result to the corresponding parameter in second.
for (unsigned int j = 0; j < size; j++)
for (size_t j = 0; j < size; j++)
{
if (!firstParams[j].IsPrecalc())
*(secondParams[j].Param()) += c[i] * firstParams[j].ParamVal();
@ -584,7 +584,7 @@ public:
/// <param name="cxAng">The vec2 vector to store the polar angular values</param>
/// <param name="cxMag">The vec2 vector to store the polar magnitude values</param>
/// <param name="cxTrn">The vec2 vector to store the polar translation values</param>
static void ConvertLinearToPolar(vector<Ember<T>>& embers, int xfi, int cflag, vector<v2T>& cxAng, vector<v2T>& cxMag, vector<v2T>& cxTrn)
static void ConvertLinearToPolar(vector<Ember<T>>& embers, size_t xfi, size_t cflag, vector<v2T>& cxAng, vector<v2T>& cxMag, vector<v2T>& cxTrn)
{
ConvertLinearToPolar(embers.data(), embers.size(), xfi, cflag, cxAng, cxMag, cxTrn);
}
@ -600,7 +600,7 @@ public:
/// <param name="cxAng">The vec2 vector to store the polar angular values</param>
/// <param name="cxMag">The vec2 vector to store the polar magnitude values</param>
/// <param name="cxTrn">The vec2 vector to store the polar translation values</param>
static void ConvertLinearToPolar(Ember<T>* embers, size_t size, int xfi, int cflag, vector<v2T>& cxAng, vector<v2T>& cxMag, vector<v2T>& cxTrn)
static void ConvertLinearToPolar(Ember<T>* embers, size_t size, size_t xfi, size_t cflag, vector<v2T>& cxAng, vector<v2T>& cxMag, vector<v2T>& cxTrn)
{
if (size == cxAng.size() &&
size == cxMag.size() &&
@ -707,9 +707,9 @@ public:
/// </summary>
/// <param name="embers">The array of embers</param>
/// <param name="count">The size of the embers array</param>
static void AsymmetricRefAngles(Ember<T>* embers, unsigned int count)
static void AsymmetricRefAngles(Ember<T>* embers, size_t count)
{
unsigned int k, xfi, col;
size_t k, xfi;
T cxang[4][2], c1[2], d;
for (xfi = 0; xfi < embers[0].XformCount(); xfi++)//Final xforms don't rotate regardless of their symmetry.
@ -718,7 +718,7 @@ public:
{
//Establish the angle for each component.
//Should potentially functionalize.
for (col = 0; col < 2; col++)
for (glm::length_t col = 0; col < 2; col++)
{
c1[0] = embers[k].GetXform(xfi)->m_Affine.m_Mat[0][col];//A,D then B,E.
c1[1] = embers[k].GetXform(xfi)->m_Affine.m_Mat[1][col];
@ -729,7 +729,7 @@ public:
for (k = 1; k < count; k++)
{
for (col = 0; col < 2; col++)
for (size_t col = 0; col < 2; col++)
{
int sym0, sym1;
int padSymFlag;
@ -832,7 +832,7 @@ public:
/// <param name="numXforms">The number xforms in the ember</param>
/// <param name="thisXform">The index of this xform within the ember</param>
/// <returns>The stagger coefficient</returns>
static inline T GetStaggerCoef(T t, T staggerPercent, int numXforms, int thisXform)
static inline T GetStaggerCoef(T t, T staggerPercent, size_t numXforms, size_t thisXform)
{
//maxStag is the spacing between xform start times if staggerPercent = 1.0.
T maxStag = T(numXforms - 1) / numXforms;

View File

@ -32,10 +32,10 @@
/// </summary>
#ifndef __ISAAC64
typedef unsigned long int ISAAC_INT;
typedef unsigned int ISAAC_INT;
const ISAAC_INT GOLDEN_RATIO = ISAAC_INT(0x9e3779b9);
#else
typedef uint64_t ISAAC_INT;
typedef size_t ISAAC_INT;
const ISAAC_INT GOLDEN_RATIO = ISAAC_INT(0x9e3779b97f4a7c13);
#endif

View File

@ -58,7 +58,7 @@ public:
/// Accessors.
/// </summary>
const unsigned char* XformDistributions() const { return m_XformDistributions.empty() ? nullptr : &m_XformDistributions[0]; }
const unsigned int XformDistributionsSize() const { return (unsigned int)m_XformDistributions.size(); }
const size_t XformDistributionsSize() const { return m_XformDistributions.size(); }
/// <summary>
/// Virtual empty iteration function that will be overidden in derived iterator classes.
@ -69,7 +69,7 @@ public:
/// <param name="samples">The buffer to store the output points</param>
/// <param name="rand">The random context to use</param>
/// <returns>The number of bad values</returns>
virtual unsigned int Iterate(Ember<T>& ember, unsigned int count, unsigned int skip, Point<T>* samples, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) { return 0; }
virtual size_t Iterate(Ember<T>& ember, size_t count, size_t skip, Point<T>* samples, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) { return 0; }
/// <summary>
/// Initialize the xform selection vector by normalizing the weights of all xforms and
@ -85,8 +85,8 @@ public:
/// <returns>True if success, else false.</returns>
bool InitDistributions(Ember<T>& ember)
{
unsigned int i;
unsigned int distribCount = ember.XaosPresent() ? (unsigned int)ember.XformCount() + 1 : 1;
size_t i;
size_t distribCount = ember.XaosPresent() ? ember.XformCount() + 1 : 1;
const Xform<T>* xforms = ember.Xforms();
if (m_XformDistributions.size() < CHOOSE_XFORM_GRAIN * distribCount)
@ -95,7 +95,7 @@ public:
if (m_XformDistributions.size() < CHOOSE_XFORM_GRAIN * distribCount)
return false;
for (unsigned int distrib = 0; distrib < distribCount; distrib++)
for (size_t distrib = 0; distrib < distribCount; distrib++)
{
T totalDensity = 0;
@ -115,7 +115,7 @@ public:
//only the first xform will get used.
//Calculate how much of a fraction of a the total density each element represents.
unsigned int j = 0;
size_t j = 0;
T tempDensity = 0, currentDensityLimit = 0, densityPerElement = totalDensity / CHOOSE_XFORM_GRAIN;
//Assign xform indices in order to each element of m_XformDistributions.
@ -135,7 +135,7 @@ public:
while (tempDensity < currentDensityLimit && j < CHOOSE_XFORM_GRAIN)
{
//printf("offset = %d, xform = %d, running sum = %f\n", j, i, tempDensity);
m_XformDistributions[(distrib * CHOOSE_XFORM_GRAIN) + j] = i;
m_XformDistributions[(distrib * CHOOSE_XFORM_GRAIN) + j] = (unsigned char)i;
tempDensity += densityPerElement;
j++;
}
@ -181,9 +181,9 @@ protected:
/// <param name="point">The point which initially had the bad values and which will store the newly computed values</param>
/// <param name="rand">The random context this iterator is using</param>
/// <returns>True if a good value was computed within 5 tries, else false</returns>
inline bool DoBadVals(Xform<T>* xforms, unsigned int& badVals, Point<T>* point, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
inline bool DoBadVals(Xform<T>* xforms, size_t& badVals, Point<T>* point, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
{
unsigned int xformIndex, consec = 0;
size_t xformIndex, consec = 0;
Point<T> firstBadPoint;
while (consec < 5)
@ -246,9 +246,9 @@ protected:
/// <param name="index">The index to retrieve</param>
/// <param name="distribOffset">When xaos is prsent, the index of the previous xform used. Default: 0 (xaos not present).</param>
/// <returns></returns>
unsigned int NextXformFromIndex(unsigned int index, unsigned int distribOffset = 0)
size_t NextXformFromIndex(size_t index, size_t distribOffset = 0)
{
return (unsigned int)m_XformDistributions[(index % CHOOSE_XFORM_GRAIN) + (CHOOSE_XFORM_GRAIN * distribOffset)];
return (size_t)m_XformDistributions[(index % CHOOSE_XFORM_GRAIN) + (CHOOSE_XFORM_GRAIN * distribOffset)];
}
vector<unsigned char> m_XformDistributions;
@ -278,9 +278,9 @@ public:
/// <param name="samples">The buffer to store the output points</param>
/// <param name="rand">The random context to use</param>
/// <returns>The number of bad values</returns>
virtual unsigned int Iterate(Ember<T>& ember, unsigned int count, unsigned int skip, Point<T>* samples, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
virtual size_t Iterate(Ember<T>& ember, size_t count, size_t skip, Point<T>* samples, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
{
unsigned int i, badVals = 0;
size_t i, badVals = 0;
Point<T> tempPoint, p1;
Xform<T>* xforms = ember.NonConstXforms();
@ -401,9 +401,9 @@ public:
/// <param name="point">The point which initially had the bad values and which will store the newly computed values</param>
/// <param name="rand">The random context this iterator is using</param>
/// <returns>True if a good value was computed within 5 tries, else false</returns>
inline bool DoBadVals(Xform<T>* xforms, unsigned int& xformIndex, unsigned int lastXformUsed, unsigned int& badVals, Point<T>* point, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
inline bool DoBadVals(Xform<T>* xforms, size_t& xformIndex, size_t lastXformUsed, size_t& badVals, Point<T>* point, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
{
unsigned int consec = 0;
size_t consec = 0;
Point<T> firstBadPoint;
while (consec < 5)
@ -442,11 +442,11 @@ public:
/// <param name="samples">The buffer to store the output points</param>
/// <param name="rand">The random context to use</param>
/// <returns>The number of bad values</returns>
virtual unsigned int Iterate(Ember<T>& ember, unsigned int count, unsigned int skip, Point<T>* samples, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
virtual size_t Iterate(Ember<T>& ember, size_t count, size_t skip, Point<T>* samples, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
{
unsigned int i, xformIndex;
unsigned int lastXformUsed = 0;
unsigned int badVals = 0;
size_t i, xformIndex;
size_t lastXformUsed = 0;
size_t badVals = 0;
Point<T> tempPoint, p1;
Xform<T>* xforms = ember.NonConstXforms();

View File

@ -39,7 +39,7 @@ public:
/// <param name="index">The index in the palette file</param>
/// <param name="size">The size of the palette which should be 256</param>
/// <param name="xmlPaletteEntries">A pointer to 256 color entries</param>
Palette(string name, int index, unsigned int size, v4T* xmlPaletteEntries)
Palette(const string& name, int index, unsigned int size, v4T* xmlPaletteEntries)
{
m_Name = name;
m_Index = index;

View File

@ -32,7 +32,7 @@ public:
/// <param name="filename">The full path to the file to read</param>
/// <param name="force">If true, override the initialization state and force a read, else observe the initialization state.</param>
/// <returns>The initialization state</returns>
bool Init(string filename, bool force = false)
bool Init(const string& filename, bool force = false)
{
if (!m_Init || force)
{
@ -93,7 +93,7 @@ public:
/// </summary>
/// <param name="name">The name of the palette to retrieve</param>
/// <returns>A pointer to the palette if found, else nullptr</returns>
Palette<T>* GetPaletteByName(string& name)
Palette<T>* GetPaletteByName(const string&& name)
{
for (unsigned int i = 0; i < Count(); i++)
if (m_Palettes[i].m_Name == name)

File diff suppressed because it is too large Load Diff

View File

@ -1,149 +1,19 @@
#pragma once
#include "Ember.h"
#include "RendererBase.h"
#include "Iterator.h"
#include "Utils.h"
#include "SpatialFilter.h"
#include "DensityFilter.h"
#include "TemporalFilter.h"
#include "Interpolate.h"
#include "CarToRas.h"
#include "EmberToXml.h"
/// <summary>
/// Renderer, RenderCallback and EmberStats classes.
/// Renderer.
/// </summary>
namespace EmberNs
{
/// <summary>
/// Function pointers present a major restriction when dealing
/// with member functions, and that is they can only point to
/// static ones. So instead of a straight function pointer, use
/// a callback class with a single virtual callback
/// member function.
/// Template argument expected to be float or double.
/// </summary>
class EMBER_API RenderCallback
{
public:
/// <summary>
/// Virtual destructor to ensure anything declared in derived classes gets cleaned up.
/// </summary>
virtual ~RenderCallback() { }
/// <summary>
/// Empty progress function to be implemented in derived classes to take action on progress updates.
/// </summary>
/// <param name="ember">The ember currently being rendered</param>
/// <param name="foo">An extra dummy parameter</param>
/// <param name="fraction">The progress fraction from 0-100</param>
/// <param name="stage">The stage of iteration. 1 is iterating, 2 is density filtering, 2 is final accumulation.</param>
/// <param name="etaMs">The estimated milliseconds to completion of the current stage</param>
/// <returns>Override should return 0 if an abort is requested, else 1 to continue rendering</returns>
virtual int ProgressFunc(Ember<float>& ember, void* foo, double fraction, int stage, double etaMs) { return 0; }
virtual int ProgressFunc(Ember<double>& ember, void* foo, double fraction, int stage, double etaMs) { return 0; }
};
/// <summary>
/// Render statistics for the number of iterations ran,
/// number of bad values calculated during iteration, and
/// the total time for the entire render from the start of
/// iteration to the end of final accumulation.
/// </summary>
class EMBER_API EmberStats
{
public:
/// <summary>
/// Constructor which sets all values to 0.
/// </summary>
EmberStats()
{
Clear();
}
void Clear()
{
m_Iters = 0;
m_Badvals = 0;
m_IterMs = 0;
m_RenderMs = 0;
}
uint64_t m_Iters, m_Badvals;
double m_IterMs, m_RenderMs;
};
/// <summary>
/// The types of available renderers.
/// Add more in the future as different rendering methods are experimented with.
/// Possible values might be: CPU+OpenGL, Particle, Inverse.
/// </summary>
enum eRendererType { CPU_RENDERER, OPENCL_RENDERER };
/// <summary>
/// A base class with virtual functions to allow both templating and polymorphism to work together.
/// Derived classes will implement all of these functions.
/// Note that functions which return a decimal number use the most precise type, double.
/// </summary>
class EMBER_API RendererBase : public EmberReport
{
public:
RendererBase() { }
virtual ~RendererBase() { }
virtual void SetEmber(Ember<float>& ember, eProcessAction action = FULL_RENDER) { }
virtual void SetEmber(vector<Ember<float>>& embers) { }
virtual void SetEmber(Ember<double>& ember, eProcessAction action = FULL_RENDER) { }
virtual void SetEmber(vector<Ember<double>>& embers) { }
virtual void Callback(RenderCallback* callback) { }
virtual bool CreateSpatialFilter(bool& newAlloc) { return false; }
virtual bool CreateTemporalFilter(bool& newAlloc) { return false; }
virtual void ComputeBounds() { }
virtual bool Ok() const { return false; }
virtual void Reset() { }
virtual void EnterRender() { }
virtual void LeaveRender() { }
virtual void EnterFinalAccum() { }
virtual void LeaveFinalAccum() { }
virtual void EnterResize() { }
virtual void LeaveResize() { }
virtual void Abort() { }
virtual bool Aborted() { return false; }
virtual bool InRender() { return false; }
virtual bool InFinalAccum() { return false; }
virtual unsigned int NumChannels() const { return 0; }
virtual void NumChannels(unsigned int numChannels) { }
virtual eRendererType RendererType() const { return CPU_RENDERER; }
virtual void ReclaimOnResize(bool reclaimOnResize) { }
virtual bool EarlyClip() const { return false; }
virtual void EarlyClip(bool earlyClip) { }
virtual bool YAxisUp() const { return false; }
virtual void YAxisUp(bool yup) { }
virtual void ThreadCount(unsigned int threads, const char* seedString = nullptr) { }
virtual void Transparency(bool transparency) { }
virtual void InteractiveFilter(eInteractiveFilter filter) { }
virtual unsigned int FinalRasW() const { return 0; }
virtual unsigned int FinalRasH() const { return 0; }
virtual unsigned int SuperRasW() const { return 0; }
virtual unsigned int SuperRasH() const { return 0; }
virtual unsigned int FinalBufferSize() const { return 0; }
virtual unsigned int GutterWidth() const { return 0; }
virtual double ScaledQuality() const { return 0; }
virtual double LowerLeftX(bool gutter = true) const { return 0; }
virtual double LowerLeftY(bool gutter = true) const { return 0; }
virtual double UpperRightX(bool gutter = true) const { return 0; }
virtual double UpperRightY(bool gutter = true) const { return 0; }
virtual uint64_t MemoryRequired(bool includeFinal) { return 0; }
virtual uint64_t MemoryAvailable() { return 0; }
virtual bool PrepFinalAccumVector(vector<unsigned char>& pixels) { return false; }
virtual eProcessState ProcessState() const { return NONE; }
virtual eProcessAction ProcessAction() const { return NOTHING; }
virtual EmberStats Stats() const { EmberStats stats; return stats; }
virtual eRenderStatus Run(vector<unsigned char>& finalImage, double time = 0, unsigned int subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) { return RENDER_ERROR; }
virtual EmberImageComments ImageComments(unsigned int printEditDepth = 0, bool intPalette = false, bool hexPalette = true) { EmberImageComments comments; return comments; }
virtual DensityFilterBase* GetDensityFilter() { return nullptr; }
};
/// <summary>
/// Renderer is the main class where all of the execution takes place.
/// It is intended that the program have one instance of it that it
@ -154,7 +24,7 @@ public:
/// The final image output vector is also passed in because the calling code has more
/// use for it than this class does.
/// Several functions are made virtual and have a default CPU-based implementation
/// that roughly matches what flam3 did. However they can be overriden in derived classes
/// that roughly matches what flam3 did. However they can be overridden in derived classes
/// to provide alternative rendering implementations, such as using the GPU.
/// Since this is a templated class, it's supposed to be entirely implemented in this .h file.
/// However, VC++ 2010 has very crippled support for lambdas, which Renderer makes use of.
@ -179,36 +49,24 @@ public:
Renderer();
virtual ~Renderer();
virtual void ComputeBounds();
//Non-virtual processing functions.
void ComputeCamera();
void ChangeVal(std::function<void (void)> func, eProcessAction action);
virtual void SetEmber(Ember<T>& ember, eProcessAction action = FULL_RENDER);
virtual void SetEmber(vector<Ember<T>>& embers);
void AddEmber(Ember<T>& ember);
bool CreateTemporalFilter(bool& newAlloc);
bool AssignIterator();
virtual bool PrepFinalAccumVector(vector<unsigned char>& pixels);
virtual eRenderStatus Run(vector<unsigned char>& finalImage, double time = 0, unsigned int subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0);
virtual EmberImageComments ImageComments(unsigned int printEditDepth = 0, bool intPalette = false, bool hexPalette = true);
virtual uint64_t MemoryRequired(bool includeFinal);
//Virtual functions to be overriden in derived renderers that use the GPU.
virtual uint64_t MemoryAvailable();
virtual void Reset();
virtual bool Ok() const;
virtual bool CreateDEFilter(bool& newAlloc);
virtual bool CreateSpatialFilter(bool& newAlloc);
virtual unsigned int SubBatchSize() const;
virtual void SubBatchSize(unsigned int sbs);
virtual unsigned int NumChannels() const;
virtual void NumChannels(unsigned int numChannels);
virtual eRendererType RendererType() const;
virtual unsigned int ThreadCount() const;
virtual void ThreadCount(unsigned int threads, const char* seedString = nullptr);
virtual void Callback(RenderCallback* callback);
//Virtual processing functions overriden from RendererBase.
virtual void ComputeBounds() override;
virtual void SetEmber(Ember<T>& ember, eProcessAction action = FULL_RENDER) override;
virtual void SetEmber(vector<Ember<T>>& embers) override;
virtual bool CreateDEFilter(bool& newAlloc) override;
virtual bool CreateSpatialFilter(bool& newAlloc) override;
virtual bool CreateTemporalFilter(bool& newAlloc) override;
virtual size_t HistBucketSize() const override { return sizeof(glm::detail::tvec4<bucketT, glm::defaultp>); }
virtual eRenderStatus Run(vector<unsigned char>& finalImage, double time = 0, size_t subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) override;
virtual EmberImageComments ImageComments(EmberStats& stats, size_t printEditDepth = 0, bool intPalette = false, bool hexPalette = true) override;
protected:
//Virtual functions to be overriden in derived renderers that use the GPU, but not accessed outside.
//New virtual functions to be overridden in derived renderers that use the GPU, but not accessed outside.
virtual void MakeDmap(T colorScalar);
virtual bool Alloc();
virtual bool ResetBuckets(bool resetHist = true, bool resetAccum = true);
@ -216,148 +74,84 @@ protected:
virtual eRenderStatus GaussianDensityFilter();
virtual eRenderStatus AccumulatorToFinalImage(vector<unsigned char>& pixels, size_t finalOffset);
virtual eRenderStatus AccumulatorToFinalImage(unsigned char* pixels, size_t finalOffset);
virtual EmberStats Iterate(uint64_t iterCount, unsigned int pass, unsigned int temporalSample);
virtual EmberStats Iterate(size_t iterCount, size_t pass, size_t temporalSample);
public:
//Accessors for render properties.
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> RandVec();
bool RandVec(vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>>& randVec);
inline bool LockAccum() const;
void LockAccum(bool lockAccum);
virtual bool EarlyClip() const;
virtual void EarlyClip(bool earlyClip);
virtual bool YAxisUp() const;
virtual void YAxisUp(bool yup);
inline bool InsertPalette() const;
void InsertPalette(bool insertPalette);
inline bool ReclaimOnResize() const;
virtual void ReclaimOnResize(bool reclaimOnResize);
inline bool Transparency() const;
virtual void Transparency(bool transparency);
inline unsigned int BytesPerChannel() const;
void BytesPerChannel(unsigned int bytesPerChannel);
//Non-virtual render properties, getters and setters.
inline T PixelAspectRatio() const;
void PixelAspectRatio(T pixelAspectRatio);
inline eInteractiveFilter InteractiveFilter() const;
virtual void InteractiveFilter(eInteractiveFilter filter);
//Threading control.
virtual void EnterRender();
virtual void LeaveRender();
virtual void EnterFinalAccum();
virtual void LeaveFinalAccum();
virtual void EnterResize();
virtual void LeaveResize();
virtual void Abort();
virtual bool Aborted();
virtual bool InRender();
virtual bool InFinalAccum();
//Renderer properties, getters only.
virtual unsigned int SuperRasW() const;
virtual unsigned int SuperRasH() const;
inline unsigned int SuperSize() const;
virtual unsigned int FinalBufferSize() const;
inline unsigned int FinalRowSize() const;
unsigned int FinalDimensions() const;
inline unsigned int PixelSize() const;
virtual unsigned int GutterWidth() const;
inline unsigned int DensityFilterOffset() const;
virtual double ScaledQuality() const;
//Non-virtual renderer properties, getters only.
inline T Scale() const;
inline T PixelsPerUnitX() const;
inline T PixelsPerUnitY() const;
virtual double LowerLeftX(bool gutter = true) const;
virtual double LowerLeftY(bool gutter = true) const;
virtual double UpperRightX(bool gutter = true) const;
virtual double UpperRightY(bool gutter = true) const;
inline T K1() const;
inline T K2() const;
inline uint64_t TotalIterCount() const;
inline uint64_t ItersPerTemporalSample() const;
virtual eProcessState ProcessState() const;
virtual eProcessAction ProcessAction() const;
virtual EmberStats Stats() const;
inline const CarToRas<T>* CoordMap() const;
inline glm::detail::tvec4<bucketT, glm::defaultp>* HistBuckets();
inline glm::detail::tvec4<bucketT, glm::defaultp>* AccumulatorBuckets();
inline SpatialFilter<T>* GetSpatialFilter();
inline TemporalFilter<T>* GetTemporalFilter();
virtual DensityFilter<T>* GetDensityFilter();
//Ember wrappers, getters only.
inline bool XaosPresent();
unsigned int FinalRasW() const;
unsigned int FinalRasH() const;
inline unsigned int Supersample() const;
inline unsigned int Passes() const;
inline unsigned int TemporalSamples() const;
inline unsigned int PaletteIndex() const;
inline T Time() const;
inline T Quality() const;
inline T SpatialFilterRadius() const;
inline T PixelsPerUnit() const;
inline T Zoom() const;
inline T CenterX() const;
inline T CenterY() const;
inline T Rotate() const;
inline T Hue() const;
inline T Brightness() const;
inline T Contrast() const;
inline T Gamma() const;
inline T Vibrancy() const;
inline T GammaThresh() const;
inline T HighlightPower() const;
inline Color<T> Background() const;
inline const Xform<T>* Xforms() const;
inline Xform<T>* NonConstXforms();
inline unsigned int XformCount() const;
inline const Xform<T>* FinalXform() const;
inline Xform<T>* NonConstFinalXform();
inline bool UseFinalXform() const;
inline const Palette<T>* GetPalette() const;
inline ePaletteMode PaletteMode() const;
//Virtual renderer properties overridden from RendererBase, getters only.
virtual double ScaledQuality() const override;
virtual double LowerLeftX(bool gutter = true) const override;
virtual double LowerLeftY(bool gutter = true) const override;
virtual double UpperRightX(bool gutter = true) const override;
virtual double UpperRightY(bool gutter = true) const override;
virtual DensityFilterBase* GetDensityFilter() override;
//Iterator wrappers.
const unsigned char* XformDistributions() const;
const unsigned int XformDistributionsSize() const;
Point<T>* Samples(unsigned int threadIndex) const;
//Non-virtual ember wrappers, getters only.
inline bool XaosPresent() const;
inline size_t Supersample() const;
inline size_t PaletteIndex() const;
inline T Time() const;
inline T Quality() const;
inline T SpatialFilterRadius() const;
inline T PixelsPerUnit() const;
inline T Zoom() const;
inline T CenterX() const;
inline T CenterY() const;
inline T Rotate() const;
inline T Hue() const;
inline T Brightness() const;
inline T Contrast() const;
inline T Gamma() const;
inline T Vibrancy() const;
inline T GammaThresh() const;
inline T HighlightPower() const;
inline Color<T> Background() const;
inline const Xform<T>* Xforms() const;
inline Xform<T>* NonConstXforms();
inline size_t XformCount() const;
inline const Xform<T>* FinalXform() const;
inline Xform<T>* NonConstFinalXform();
inline bool UseFinalXform() const;
inline const Palette<T>* GetPalette() const;
inline ePaletteMode PaletteMode() const;
void* m_ProgressParameter;
//Virtual ember wrappers overridden from RendererBase, getters only.
virtual size_t Passes() const override;
virtual size_t TemporalSamples() const override;
virtual size_t FinalRasW() const override;
virtual size_t FinalRasH() const override;
//Non-virtual iterator wrappers.
const unsigned char* XformDistributions() const;
const size_t XformDistributionsSize() const;
Point<T>* Samples(size_t threadIndex) const;
protected:
//Non-virtual functions that might be needed by a derived class.
void PrepFinalAccumVals(Color<T>& background, T& g, T& linRange, T& vibrancy);
private:
//Miscellaneous functions used only in this class.
void Accumulate(Point<T>* samples, unsigned int sampleCount, const Palette<bucketT>* palette);
/*inline*/ void AddToAccum(const glm::detail::tvec4<bucketT, glm::defaultp>& bucket, int i, int ii, int j, int jj);
//Miscellaneous non-virtual functions used only in this class.
void Accumulate(Point<T>* samples, size_t sampleCount, const Palette<bucketT>* palette);
/*inline*/ void AddToAccum(const glm::detail::tvec4<bucketT, glm::defaultp>& bucket, intmax_t i, intmax_t ii, intmax_t j, intmax_t jj);
template <typename accumT> void GammaCorrection(glm::detail::tvec4<bucketT, glm::defaultp>& bucket, Color<T>& background, T g, T linRange, T vibrancy, bool doAlpha, bool scale, accumT* correctedChannels);
protected:
bool m_EarlyClip;
bool m_YAxisUp;
bool m_Transparency;
unsigned int m_SuperRasW;
unsigned int m_SuperRasH;
unsigned int m_SuperSize;
unsigned int m_GutterWidth;
unsigned int m_DensityFilterOffset;
unsigned int m_NumChannels;
unsigned int m_BytesPerChannel;
unsigned int m_SubBatchSize;
unsigned int m_ThreadsToUse;
T m_ScaledQuality;
T m_Scale;
T m_PixelsPerUnitX;
T m_PixelsPerUnitY;
@ -370,30 +164,14 @@ protected:
T m_K2;
T m_Vibrancy;//Accumulate these after each temporal sample.
T m_Gamma;
T m_ScaledQuality;
Color<T> m_Background;
Affine2D<T> m_RotMat;
volatile bool m_Abort;
bool m_LockAccum;
bool m_InRender;
bool m_InFinalAccum;
bool m_InsertPalette;
bool m_ReclaimOnResize;
unsigned int m_VibGamCount;
unsigned int m_LastPass;
unsigned int m_LastTemporalSample;
uint64_t m_LastIter;
double m_LastIterPercent;
eProcessAction m_ProcessAction;
eProcessState m_ProcessState;
eInteractiveFilter m_InteractiveFilter;
EmberStats m_Stats;
Ember<T> m_Ember;
Ember<T> m_TempEmber;
Ember<T> m_LastEmber;
vector<Ember<T>> m_Embers;
CarToRas<T> m_CarToRas;
RenderCallback* m_Callback;
Iterator<T>* m_Iterator;
unique_ptr<StandardIterator<T>> m_StandardIterator;
unique_ptr<XaosIterator<T>> m_XaosIterator;
@ -404,12 +182,6 @@ protected:
unique_ptr<TemporalFilter<T>> m_TemporalFilter;
unique_ptr<DensityFilter<T>> m_DensityFilter;
vector<vector<Point<T>>> m_Samples;
vector<uint64_t> m_SubBatch;
vector<uint64_t> m_BadVals;
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> m_Rand;
tbb::task_group m_TaskGroup;
CriticalSection m_RenderingCs, m_AccumCs, m_FinalAccumCs, m_ResizeCs;
Timing m_RenderTimer, m_IterTimer, m_ProgressTimer;
EmberToXml<T> m_EmberToXml;
};

View File

@ -0,0 +1,635 @@
#include "EmberPch.h"
#include "RendererBase.h"
namespace EmberNs
{
/// <summary>
/// Constructor that sets default values.
/// The thread count is set to the number of cores detected on the system.
/// </summary>
RendererBase::RendererBase()
{
m_Abort = false;
m_LockAccum = false;
m_EarlyClip = false;
m_YAxisUp = false;
m_InsertPalette = false;
m_ReclaimOnResize = false;
m_SubBatchSize = 1024 * 10;
m_NumChannels = 3;
m_BytesPerChannel = 1;
m_SuperSize = 0;
m_Transparency = false;
ThreadCount(Timing::ProcessorCount());
m_Callback = nullptr;
m_ProgressParameter = nullptr;
m_LastPass = 0;
m_LastTemporalSample = 0;
m_LastIter = 0;
m_LastIterPercent = 0;
m_InteractiveFilter = FILTER_LOG;
m_ProcessState = NONE;
m_ProcessAction = FULL_RENDER;
m_InRender = false;
m_InFinalAccum = false;
}
/// <summary>
/// Non-virtual processing functions.
/// </summary>
/// <summary>
/// Abort the render and call a function to do something, most likely change a value.
/// Then update the current process action to the one specified.
/// The current process action will only be set if it makes sense based
/// on the current process state. If the value specified doesn't make sense
/// the next best choice will be made. If nothing makes sense, a complete
/// re-render will be triggered on the next call to Run().
/// </summary>
/// <param name="func">The function to execute</param>
/// <param name="action">The desired process action</param>
void RendererBase::ChangeVal(std::function<void(void)> func, eProcessAction action)
{
Abort();
EnterRender();
func();
//If they want a full render, don't bother inspecting process state, just start over.
if (action == FULL_RENDER)
{
m_ProcessState = NONE;
m_ProcessAction = FULL_RENDER;
}
//Keep iterating is when rendering has completed and the user increases the quality.
//Rendering can be started where it left off by adding just the difference between the
//new and old quality values.
else if (action == KEEP_ITERATING)
{
if (m_ProcessState == ACCUM_DONE && TemporalSamples() == 1 && Passes() == 1)
{
m_ProcessState = ITER_STARTED;
m_ProcessAction = KEEP_ITERATING;
}
else//Invaid process state to handle KEEP_ITERATING, so just start over.
{
m_ProcessState = NONE;
m_ProcessAction = FULL_RENDER;
}
}
else if (action == FILTER_AND_ACCUM)
{
//If in the middle of a render, cannot skip to filtering or accum, so just start over.
if (m_ProcessState == NONE || m_ProcessState == ITER_STARTED)
{
m_ProcessState = NONE;
m_ProcessAction = FULL_RENDER;
}
//If passes == 1, set the state to ITER_DONE and the next process action to FILTER_AND_ACCUM.
else
{
m_ProcessState = Passes() == 1 ? ITER_DONE : NONE;
m_ProcessAction = Passes() == 1 ? FILTER_AND_ACCUM : FULL_RENDER;//Cannot just filter if passes > 1 because filtering is done with each pass.
}
}
//Run accum only.
else if (action == ACCUM_ONLY)
{
//Doesn't make sense if in the middle of iterating, so just start over.
if (m_ProcessState == NONE || m_ProcessState == ITER_STARTED)
{
m_ProcessAction = FULL_RENDER;
}
else if (m_ProcessState == ITER_DONE)//If iterating is done, can start at density filtering and proceed.
{
m_ProcessAction = FILTER_AND_ACCUM;
}
else if (m_ProcessState == FILTER_DONE)//Density filtering is done, so the process action is assigned as desired.
{
m_ProcessAction = ACCUM_ONLY;
}
else if (m_ProcessState == ACCUM_DONE)//Final accum is done, so back up and run final accum again.
{
m_ProcessState = FILTER_DONE;
m_ProcessAction = ACCUM_ONLY;
}
}
LeaveRender();
}
/// <summary>
/// Return the amount of memory needed to render the current ember.
/// Optionally include the memory needed for the final output image.
/// </summary>
/// <param name="includeFinal">If true include the memory needed for the final output image, else don't.</param>
/// <returns>The memory required to render the current ember</returns>
size_t RendererBase::MemoryRequired(size_t strips, bool includeFinal)
{
bool newFilterAlloc = false;
CreateSpatialFilter(newFilterAlloc);
CreateTemporalFilter(newFilterAlloc);
ComputeBounds();
//Because ComputeBounds() was called, this includes gutter.
size_t histSize = (SuperSize() * HistBucketSize()) / strips;
return (histSize * 2) + (includeFinal ? FinalBufferSize() : 0);//Multiply hist by 2 to account for the density filtering buffer which is the same size as the histogram.
}
/// <summary>
/// Get a copy of the vector of random contexts.
/// Useful for debugging because the returned vector can be used for future renders to
/// produce the exact same output.
/// </summary>
/// <returns>The vector of random contexts to assign</returns>
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> RendererBase::RandVec() { return m_Rand; }
/// <summary>
/// Set the vector of random contexts.
/// Assignment will only take place if the size of the vector matches
/// the number of threads used for rendering.
/// Reset the rendering process.
/// </summary>
/// <param name="randVec">The vector of random contexts to assign</param>
/// <returns>True if the size of the vector matched the number of threads used for rendering, else false.</returns>
bool RendererBase::RandVec(vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>>& randVec)
{
bool b = false;
if (randVec.size() == ThreadCount())
{
ChangeVal([&]
{
m_Rand = randVec;
b = true;
}, FULL_RENDER);
}
return b;
}
/// <summary>
/// Resize the passed in vector to be large enough to handle the output image.
/// If m_ReclaimOnResize is true, and the vector is already larger than needed,
/// it will be shrunk to the needed size. However if m_ReclaimOnResize is false,
/// it will be left alone if already large enough.
/// ComputeBounds() must be called before calling this function.
/// </summary>
/// <param name="pixels">The vector to allocate</param>
/// <returns>True if the vector contains enough space to hold the output image</returns>
bool RendererBase::PrepFinalAccumVector(vector<unsigned char>& pixels)
{
EnterResize();
size_t size = FinalBufferSize();
if (m_ReclaimOnResize)
{
if (pixels.size() != size)
{
pixels.resize(size);
pixels.shrink_to_fit();
}
}
else
{
if (pixels.size() < size)
pixels.resize(size);
}
LeaveResize();
return pixels.size() >= size;//Ensure allocation went ok.
}
/// <summary>
/// Virtual processing functions.
/// </summary>
/// <summary>
/// Get a status indicating whether this renderer is ok.
/// Return true for this class, derived classes will inspect GPU hardware
/// to determine if they are ok.
/// </summary>
/// <returns>Always true for this class</returns>
bool RendererBase::Ok() const
{
return true;
}
/// <summary>
/// The amount of RAM available to render with.
/// </summary>
/// <returns>An unsigned 64-bit integer specifying how much memory is available</returns>
size_t RendererBase::MemoryAvailable()
{
size_t memAvailable = 0;
#ifdef WIN32
MEMORYSTATUSEX stat;
stat.dwLength = sizeof(stat);
GlobalMemoryStatusEx(&stat);
memAvailable = stat.ullTotalPhys;
#elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
memAvailable = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE);
#elif defined __APPLE__
#ifdef __LP64__
long physmem;
size_t len = sizeof(physmem);
static int mib[2] = { CTL_HW, HW_MEMSIZE };
#else
size_t physmem;
size_t len = sizeof(physmem);
static int mib[2] = { CTL_HW, HW_PHYSMEM };
#endif
if (sysctl(mib, 2, &physmem, &len, nullptr, 0) == 0 && len == sizeof(physmem))
{
memAvailable = physmem;
}
else
{
cout << "Warning: unable to determine physical memory." << endl;
memAvailable = 4e9;
}
#else
cout << "Warning: unable to determine physical memory." << endl;
memAvailable = 4e9;
#endif
return memAvailable;
}
/// <summary>
/// Non-virtual renderer properties, getters only.
/// </summary>
size_t RendererBase::SuperRasW() const { return m_SuperRasW; }
size_t RendererBase::SuperRasH() const { return m_SuperRasH; }
size_t RendererBase::SuperSize() const { return m_SuperSize; }
size_t RendererBase::FinalRowSize() const { return FinalRasW() * PixelSize(); }
size_t RendererBase::FinalDimensions() const { return FinalRasW() * FinalRasH(); }
size_t RendererBase::FinalBufferSize() const { return FinalRowSize() * FinalRasH(); }
size_t RendererBase::PixelSize() const { return NumChannels() * BytesPerChannel(); }
size_t RendererBase::GutterWidth() const { return m_GutterWidth; }
size_t RendererBase::DensityFilterOffset() const { return m_DensityFilterOffset; }
size_t RendererBase::TotalIterCount() const { return (size_t)((size_t)Round(ScaledQuality()) * FinalRasW() * FinalRasH()); }//Use Round() because there can be some roundoff error when interpolating.
size_t RendererBase::ItersPerTemporalSample() const { return (size_t)ceil(double(TotalIterCount()) / double(Passes() * TemporalSamples())); }
eProcessState RendererBase::ProcessState() const { return m_ProcessState; }
eProcessAction RendererBase::ProcessAction() const { return m_ProcessAction; }
EmberStats RendererBase::Stats() const { return m_Stats; }
/// <summary>
/// Non-virtual render properties, getters and setters.
/// </summary>
/// <summary>
/// Get whether the histogram is locked during accumulation.
/// This is to prevent two threads from writing to the same histogram
/// bucket at once.
/// The current implementation matches flam3 and is very innefficient
/// to the point of negating any gains gotten from multi-threading.
/// Future workarounds may be tried in the future.
/// Default: false.
/// </summary>
/// <returns>True if the histogram is locked during accumulation, else false.</returns>
bool RendererBase::LockAccum() const { return m_LockAccum; }
/// <summary>
/// Set whether the histogram is locked during accumulation.
/// This is to prevent two threads from writing to the same histogram
/// bucket at once.
/// The current implementation matches flam3 and is very innefficient
/// to the point of negating any gains gotten from multi-threading.
/// Different workarounds may be tried in the future.
/// Reset the rendering process.
/// </summary>
/// <param name="lockAccum">True if the histogram should be locked when accumulating, else false</param>
void RendererBase::LockAccum(bool lockAccum)
{
ChangeVal([&] { m_LockAccum = lockAccum; }, FULL_RENDER);
}
/// <summary>
/// Get whether color clipping and gamma correction is done before
/// or after spatial filtering.
/// Default: false.
/// </summary>
/// <returns>True if early clip, else false.</returns>
bool RendererBase::EarlyClip() const { return m_EarlyClip; }
/// <summary>
/// Set whether color clipping and gamma correction is done before
/// or after spatial filtering.
/// Set the render state to FILTER_AND_ACCUM.
/// </summary>
/// <param name="earlyClip">True if early clip, else false.</param>
void RendererBase::EarlyClip(bool earlyClip)
{
ChangeVal([&] { m_EarlyClip = earlyClip; }, FILTER_AND_ACCUM);
}
/// <summary>
/// Get whether the positive Y coordinate of the final output image is up.
/// Default: false.
/// </summary>
/// <returns>True if up, else false.</returns>
bool RendererBase::YAxisUp() const { return m_YAxisUp; }
/// <summary>
/// Set whether the positive Y axis of the final output image is up.
/// </summary>
/// <param name="yup">True if the positive y axis is up, else false.</param>
void RendererBase::YAxisUp(bool yup)
{
ChangeVal([&] { m_YAxisUp = yup; }, ACCUM_ONLY);
}
/// <summary>
/// Get whether to insert the palette as a block of colors in the final output image.
/// This is useful for debugging palette issues.
/// Default: 1.
/// </summary>
/// <returns>True if inserting the palette, else false.</returns>
bool RendererBase::InsertPalette() const { return m_InsertPalette; }
/// <summary>
/// Set whether to insert the palette as a block of colors in the final output image.
/// This is useful for debugging palette issues.
/// Set the render state to ACCUM_ONLY.
/// </summary>
/// <param name="insertPalette">True if inserting the palette, else false.</param>
void RendererBase::InsertPalette(bool insertPalette)
{
ChangeVal([&] { m_InsertPalette = insertPalette; }, ACCUM_ONLY);
}
/// <summary>
/// Get whether to reclaim unused memory in the final output buffer
/// when a smaller size is requested than has been previously allocated.
/// Default: false.
/// </summary>
/// <returns>True if reclaim, else false.</returns>
bool RendererBase::ReclaimOnResize() const { return m_ReclaimOnResize; }
/// <summary>
/// Set whether to reclaim unused memory in the final output buffer
/// when a smaller size is requested than has been previously allocated.
/// Reset the rendering process.
/// </summary>
/// <param name="reclaimOnResize">True if reclaim, else false.</param>
void RendererBase::ReclaimOnResize(bool reclaimOnResize)
{
ChangeVal([&] { m_ReclaimOnResize = reclaimOnResize; }, FULL_RENDER);
}
/// <summary>
/// Get whether to use transparency in the alpha channel.
/// This only applies when the number of channels is 4 and the output
/// image is Png.
/// Default: false.
/// </summary>
/// <returns>True if using transparency, else false.</returns>
bool RendererBase::Transparency() const { return m_Transparency; }
/// <summary>
/// Set whether to use transparency in the alpha channel.
/// This only applies when the number of channels is 4 and the output
/// image is Png.
/// Set the render state to ACCUM_ONLY.
/// </summary>
/// <param name="transparency">True if using transparency, else false.</param>
void RendererBase::Transparency(bool transparency)
{
ChangeVal([&] { m_Transparency = transparency; }, ACCUM_ONLY);
}
/// <summary>
/// Set the sub batch size. This is the size of of the chunks that the iteration
/// trajectory will be broken up into.
/// Reset the rendering process.
/// </summary>
/// <param name="sbs">The sub batch size to set</param>
void RendererBase::SubBatchSize(size_t sbs)
{
ChangeVal([&] { m_SubBatchSize = sbs; }, FULL_RENDER);
}
/// <summary>
/// Set the callback object.
/// </summary>
/// <param name="callback">The callback object to set</param>
void RendererBase::Callback(RenderCallback* callback)
{
m_Callback = callback;
}
/// <summary>
/// Set the number of threads to use when rendering.
/// This will also reset the vector of random contexts to be the same size
/// as the number of specified threads.
/// Since this is where they get set up, the caller can optionally pass in
/// a seed string, however it's only used if threads is 1.
/// This is useful for debugging since it will run the same point trajectory
/// every time.
/// Reset the rendering process.
/// </summary>
/// <param name="threads">The number of threads to use</param>
/// <param name="seedString">The seed string to use if threads is 1. Default: nullptr.</param>
void RendererBase::ThreadCount(size_t threads, const char* seedString)
{
ChangeVal([&]
{
Timing t;
size_t i, size;
const size_t isaacSize = 1 << ISAAC_SIZE;
ISAAC_INT seeds[isaacSize];
m_ThreadsToUse = threads > 0 ? threads : 1;
m_Rand.clear();
m_SubBatch.clear();
m_SubBatch.resize(m_ThreadsToUse);
m_BadVals.resize(m_ThreadsToUse);
if (seedString)
{
memset(seeds, 0, isaacSize * sizeof(ISAAC_INT));
memcpy((char*)seeds, seedString, min(strlen(seedString), isaacSize * sizeof(ISAAC_INT)));
}
//This is critical for multithreading, otherwise the threads all happen
//too close to each other in time, resulting in bad randomization.
while (m_Rand.size() < m_ThreadsToUse)
{
size = m_Rand.size();
if (seedString)
{
ISAAC_INT newSize = (ISAAC_INT)(size + 5 + (t.Toc() + t.EndTime()));
#ifdef ISAAC_FLAM3_DEBUG
QTIsaac<ISAAC_SIZE, ISAAC_INT> isaac(0, 0, 0, seeds);
#else
QTIsaac<ISAAC_SIZE, ISAAC_INT> isaac(newSize, newSize * 2, newSize * 3, seeds);
#endif
m_Rand.push_back(isaac);
for (i = 0; i < (isaacSize * sizeof(ISAAC_INT)); i++)
((unsigned char*)seeds)[i]++;
}
else
{
for (i = 0; i < isaacSize; i++)
{
t.Toc();
seeds[i] = (ISAAC_INT)((t.EndTime() * i) + (size + 1));
}
t.Toc();
ISAAC_INT r = (ISAAC_INT)((size * i) + i + t.EndTime());
QTIsaac<ISAAC_SIZE, ISAAC_INT> isaac(r, r * 2, r * 3, seeds);
m_Rand.push_back(isaac);
}
}
}, FULL_RENDER);
}
/// <summary>
/// Get the bytes per channel of the output image.
/// The only acceptable values are 1 and 2, and 2 is only
/// used when the output is Png.
/// Default: 1.
/// </summary>
/// <returns></returns>
size_t RendererBase::BytesPerChannel() const { return m_BytesPerChannel; }
/// <summary>
/// Set the bytes per channel of the output image.
/// The only acceptable values are 1 and 2, and 2 is only
/// used when the output is Png.
/// Set the render state to ACCUM_ONLY.
/// </summary>
/// <param name="bytesPerChannel">The bytes per channel.</param>
void RendererBase::BytesPerChannel(size_t bytesPerChannel)
{
ChangeVal([&]
{
if (bytesPerChannel == 0 || bytesPerChannel > 2)
m_BytesPerChannel = 1;
else
m_BytesPerChannel = bytesPerChannel;
}, ACCUM_ONLY);
}
/// <summary>
/// Get the number of channels per pixel in the output image. 3 for RGB images
/// like Bitmap and Jpeg, 4 for Png.
/// Default is 3.
/// </summary>
/// <returns>The number of channels per pixel in the output image</returns>
size_t RendererBase::NumChannels() const { return m_NumChannels; }
/// <summary>
/// Get the type of filter to use for preview renders during interactive rendering.
/// Using basic log scaling is quicker, but doesn't provide any bluring.
/// Full DE is much slower, but provides a more realistic preview of what the final image
/// will look like.
/// Default: FILTER_LOG.
/// </summary>
/// <returns>The type of filter to use</returns>
eInteractiveFilter RendererBase::InteractiveFilter() const { return m_InteractiveFilter; }
/// <summary>
/// Set the type of filter to use for preview renders during interactive rendering.
/// Using basic log scaling is quicker, but doesn't provide any bluring.
/// Full DE is much slower, but provides a more realistic preview of what the final image
/// will look like.
/// Reset the rendering process.
/// </summary>
/// <param name="filter">The filter.</param>
void RendererBase::InteractiveFilter(eInteractiveFilter filter)
{
ChangeVal([&] { m_InteractiveFilter = filter; }, FULL_RENDER);
}
/// <summary>
/// Virtual render properties, getters and setters.
/// </summary>
/// <summary>
/// Set the number of channels per pixel in the output image. 3 for RGB images
/// like Bitmap and Jpeg, 4 for Png.
/// Default is 3.
/// Set the render state to ACCUM_ONLY.
/// </summary>
/// <param name="numChannels">The number of channels per pixel in the output image</param>
void RendererBase::NumChannels(size_t numChannels)
{
ChangeVal([&] { m_NumChannels = numChannels; }, ACCUM_ONLY);
}
/// <summary>
/// Get the number of threads used when rendering.
/// Default: use all avaliable cores.
/// </summary>
/// <returns>The number of threads used when rendering</returns>
size_t RendererBase::ThreadCount() const { return m_ThreadsToUse; }
/// <summary>
/// Get the sub batch size. This is the size of of the chunks that the iteration
/// trajectory will be broken up into.
/// Default: 10k.
/// </summary>
/// <returns>The sub batch size</returns>
size_t RendererBase::SubBatchSize() const { return m_SubBatchSize; }
/// <summary>
/// Get the renderer type enum.
/// CPU_RENDERER for this class, other values for derived classes.
/// </summary>
/// <returns>CPU_RENDERER</returns>
eRendererType RendererBase::RendererType() const { return CPU_RENDERER; }
/// <summary>
/// //Non-virtual threading control.
/// </summary>
/// <summary>
/// Stop rendering, ensure all locks are exited and reset the rendering state.
/// </summary>
void RendererBase::Reset()
{
Abort();
EnterRender();
EnterFinalAccum();
LeaveFinalAccum();
LeaveRender();
m_ProcessState = NONE;
m_ProcessAction = FULL_RENDER;
}
void RendererBase::EnterRender() { m_RenderingCs.Enter(); }
void RendererBase::LeaveRender() { m_RenderingCs.Leave(); }
void RendererBase::EnterFinalAccum() { m_FinalAccumCs.Enter(); m_InFinalAccum = true; }
void RendererBase::LeaveFinalAccum() { m_FinalAccumCs.Leave(); m_InFinalAccum = false; }
void RendererBase::EnterResize() { m_ResizeCs.Enter(); }
void RendererBase::LeaveResize() { m_ResizeCs.Leave(); }
void RendererBase::Abort() { m_Abort = true; }
bool RendererBase::Aborted() { return m_Abort; }
bool RendererBase::InRender() { return m_InRender; }
bool RendererBase::InFinalAccum() { return m_InFinalAccum; }
}

229
Source/Ember/RendererBase.h Normal file
View File

@ -0,0 +1,229 @@
#pragma once
#include "Utils.h"
#include "Ember.h"
#include "DensityFilter.h"
/// <summary>
/// RendererBase, RenderCallback and EmberStats classes.
/// </summary>
namespace EmberNs
{
/// <summary>
/// Function pointers present a major restriction when dealing
/// with member functions, and that is they can only point to
/// static ones. So instead of a straight function pointer, use
/// a callback class with a single virtual callback
/// member function.
/// Template argument expected to be float or double.
/// </summary>
class EMBER_API RenderCallback
{
public:
/// <summary>
/// Virtual destructor to ensure anything declared in derived classes gets cleaned up.
/// </summary>
virtual ~RenderCallback() { }
/// <summary>
/// Empty progress function to be implemented in derived classes to take action on progress updates.
/// </summary>
/// <param name="ember">The ember currently being rendered</param>
/// <param name="foo">An extra dummy parameter</param>
/// <param name="fraction">The progress fraction from 0-100</param>
/// <param name="stage">The stage of iteration. 1 is iterating, 2 is density filtering, 2 is final accumulation.</param>
/// <param name="etaMs">The estimated milliseconds to completion of the current stage</param>
/// <returns>Override should return 0 if an abort is requested, else 1 to continue rendering</returns>
virtual int ProgressFunc(Ember<float>& ember, void* foo, double fraction, int stage, double etaMs) { return 0; }
virtual int ProgressFunc(Ember<double>& ember, void* foo, double fraction, int stage, double etaMs) { return 0; }
};
/// <summary>
/// Render statistics for the number of iterations ran,
/// number of bad values calculated during iteration, and
/// the total time for the entire render from the start of
/// iteration to the end of final accumulation.
/// </summary>
class EMBER_API EmberStats
{
public:
/// <summary>
/// Constructor which sets all values to 0.
/// </summary>
EmberStats()
{
Clear();
}
void Clear()
{
m_Iters = 0;
m_Badvals = 0;
m_IterMs = 0;
m_RenderMs = 0;
}
EmberStats& operator += (const EmberStats& stats)
{
m_Iters += stats.m_Iters;
m_Badvals += stats.m_Badvals;
m_IterMs += stats.m_IterMs;
m_RenderMs += stats.m_RenderMs;
return *this;
}
size_t m_Iters, m_Badvals;
double m_IterMs, m_RenderMs;
};
/// <summary>
/// The types of available renderers.
/// Add more in the future as different rendering methods are experimented with.
/// Possible values might be: CPU+OpenGL, Particle, Inverse.
/// </summary>
enum eRendererType { CPU_RENDERER, OPENCL_RENDERER };
/// <summary>
/// A base class with virtual functions to allow both templating and polymorphism to work together.
/// Derived classes will implement all of these functions.
/// Note that functions which return a decimal number use the most precise type, double.
/// </summary>
class EMBER_API RendererBase : public EmberReport
{
public:
RendererBase();
virtual ~RendererBase() { }
//Non-virtual processing functions.
void ChangeVal(std::function<void(void)> func, eProcessAction action);
size_t MemoryRequired(size_t strips, bool includeFinal);
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> RandVec();
bool RandVec(vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>>& randVec);
bool PrepFinalAccumVector(vector<unsigned char>& pixels);
//Virtual processing functions.
virtual bool Ok() const;
virtual size_t MemoryAvailable();
virtual void SetEmber(Ember<float>& ember, eProcessAction action = FULL_RENDER) { }
virtual void SetEmber(vector<Ember<float>>& embers) { }
virtual void SetEmber(Ember<double>& ember, eProcessAction action = FULL_RENDER) { }
virtual void SetEmber(vector<Ember<double>>& embers) { }
//Abstract processing functions.
virtual bool CreateDEFilter(bool& newAlloc) = 0;
virtual bool CreateSpatialFilter(bool& newAlloc) = 0;
virtual bool CreateTemporalFilter(bool& newAlloc) = 0;
virtual void ComputeBounds() = 0;
virtual eRenderStatus Run(vector<unsigned char>& finalImage, double time = 0, size_t subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) = 0;
virtual EmberImageComments ImageComments(EmberStats& stats, size_t printEditDepth = 0, bool intPalette = false, bool hexPalette = true) = 0;
virtual DensityFilterBase* GetDensityFilter() = 0;
//Non-virtual renderer properties, getters only.
size_t SuperRasW() const;
size_t SuperRasH() const;
size_t SuperSize() const;
size_t FinalRowSize() const;
size_t FinalDimensions() const;
size_t FinalBufferSize() const;
size_t PixelSize() const;
size_t GutterWidth() const;
size_t DensityFilterOffset() const;
size_t TotalIterCount() const;
size_t ItersPerTemporalSample() const;
eProcessState ProcessState() const;
eProcessAction ProcessAction() const;
EmberStats Stats() const;
//Non-virtual render getters and setters.
bool LockAccum() const;
void LockAccum(bool lockAccum);
bool EarlyClip() const;
void EarlyClip(bool earlyClip);
bool YAxisUp() const;
void YAxisUp(bool yup);
bool InsertPalette() const;
void InsertPalette(bool insertPalette);
bool ReclaimOnResize() const;
void ReclaimOnResize(bool reclaimOnResize);
bool Transparency() const;
void Transparency(bool transparency);
void SubBatchSize(size_t subBatchSize);
void Callback(RenderCallback* callback);
void ThreadCount(size_t threads, const char* seedString = nullptr);
size_t BytesPerChannel() const;
void BytesPerChannel(size_t bytesPerChannel);
size_t NumChannels() const;
eInteractiveFilter InteractiveFilter() const;
void InteractiveFilter(eInteractiveFilter filter);
//Virtual render properties, getters and setters.
virtual void NumChannels(size_t numChannels);
virtual size_t ThreadCount() const;
virtual size_t SubBatchSize() const;
virtual eRendererType RendererType() const;
//Abstract render properties, getters only.
virtual size_t Passes() const = 0;
virtual size_t TemporalSamples() const = 0;
virtual size_t HistBucketSize() const = 0;
virtual size_t FinalRasW() const = 0;
virtual size_t FinalRasH() const = 0;
virtual double ScaledQuality() const = 0;
virtual double LowerLeftX(bool gutter = true) const = 0;
virtual double LowerLeftY(bool gutter = true) const = 0;
virtual double UpperRightX(bool gutter = true) const = 0;
virtual double UpperRightY(bool gutter = true) const = 0;
//Non-virtual threading control.
void Reset();
void EnterRender();
void LeaveRender();
void EnterFinalAccum();
void LeaveFinalAccum();
void EnterResize();
void LeaveResize();
void Abort();
bool Aborted();
bool InRender();
bool InFinalAccum();
void* m_ProgressParameter;
protected:
bool m_EarlyClip;
bool m_YAxisUp;
bool m_Transparency;
bool m_LockAccum;
bool m_InRender;
bool m_InFinalAccum;
bool m_InsertPalette;
bool m_ReclaimOnResize;
volatile bool m_Abort;
size_t m_SuperRasW;
size_t m_SuperRasH;
size_t m_SuperSize;
size_t m_GutterWidth;
size_t m_DensityFilterOffset;
size_t m_NumChannels;
size_t m_BytesPerChannel;
size_t m_SubBatchSize;
size_t m_ThreadsToUse;
size_t m_VibGamCount;
size_t m_LastPass;
size_t m_LastTemporalSample;
double m_LastIterPercent;
size_t m_LastIter;
eProcessAction m_ProcessAction;
eProcessState m_ProcessState;
eInteractiveFilter m_InteractiveFilter;
EmberStats m_Stats;
RenderCallback* m_Callback;
vector<size_t> m_SubBatch;
vector<size_t> m_BadVals;
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> m_Rand;
tbb::task_group m_TaskGroup;
CriticalSection m_RenderingCs, m_AccumCs, m_FinalAccumCs, m_ResizeCs;
Timing m_RenderTimer, m_IterTimer, m_ProgressTimer;
};
}

View File

@ -61,7 +61,7 @@ public:
/// </summary>
/// <param name="palettePath">The full path and filename of the palette file</param>
/// <param name="renderer">A pre-constructed renderer to use. The caller should not delete this.</param>
SheepTools(string palettePath, Renderer<T, bucketT>* renderer)
SheepTools(const string& palettePath, Renderer<T, bucketT>* renderer)
{
Timing t;
@ -113,10 +113,10 @@ public:
/// <param name="ember">The ember whose xforms will be truncated</param>
/// <param name="maxVars">The maximum number of variations each xform can have</param>
/// <returns>A string describing what was done</returns>
string TruncateVariations(Ember<T>& ember, unsigned int maxVars)
string TruncateVariations(Ember<T>& ember, size_t maxVars)
{
int smallest;
unsigned int i, j, numVars;
intmax_t smallest;
size_t i, j, numVars;
T sv = 0;
ostringstream os;
@ -188,7 +188,8 @@ public:
/// <returns>A string describing what was done</returns>
string Mutate(Ember<T>& ember, eMutateMode mode, vector<eVariationId>& useVars, int sym, T speed)
{
unsigned int i, j, k, x, done, modXform;
bool done = false;
size_t modXform;
char ministr[32];
T randSelect;
ostringstream os;
@ -226,14 +227,14 @@ public:
//Create a random flame, and use the variations to replace those in the original.
Random(mutation, useVars, sym, ember.TotalXformCount());
for (i = 0; i < ember.TotalXformCount(); i++)
for (size_t i = 0; i < ember.TotalXformCount(); i++)
{
Xform<T>* xform1 = ember.GetTotalXform(i);
Xform<T>* xform2 = mutation.GetTotalXform(i);
if (xform1 && xform2)
{
for (j = 0; j < xform1->TotalVariationCount(); j++)
for (size_t j = 0; j < xform1->TotalVariationCount(); j++)
{
Variation<T>* var1 = xform1->GetVariation(j);
Variation<T>* var2 = xform2->GetVariationById(var1->VariationId());
@ -242,10 +243,10 @@ public:
{
xform1->ClearAndDeleteVariations();
for (k = 0; k < xform2->TotalVariationCount(); k++)
for (size_t k = 0; k < xform2->TotalVariationCount(); k++)
xform1->AddVariation(xform2->GetVariation(k)->Copy());
done = 1;
done = true;
}
}
}
@ -271,8 +272,8 @@ public:
}
else
{
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
for (glm::length_t i = 0; i < 2; i++)
for (glm::length_t j = 0; j < 3; j++)
xform1->m_Affine.m_Mat[i][j] = xform2->m_Affine.m_Mat[i][j];
}
}
@ -283,13 +284,13 @@ public:
}
else if (mode == MUTATE_POST_XFORMS)
{
bool same = (m_Rand.Rand() & 3) > 0;//25% chance of using the same post for all of them.
unsigned int b = 1 + m_Rand.Rand() % 6;
unsigned int same = m_Rand.Rand() & 3;//25% chance of using the same post for all of them.
sprintf_s(ministr, 32, "(%d%s)", b, (same > 0) ? " same" : "");
sprintf_s(ministr, 32, "(%d%s)", b, same ? " same" : "");
os << "mutate post xforms " << ministr;
for (i = 0; i < ember.TotalXformCount(); i++)
for (size_t i = 0; i < ember.TotalXformCount(); i++)
{
int copy = (i > 0) && same;
Xform<T>* xform = ember.GetTotalXform(i);
@ -405,7 +406,7 @@ public:
}
else if (mode == MUTATE_DELETE_XFORM)
{
unsigned int nx = m_Rand.Rand() % ember.TotalXformCount();
size_t nx = m_Rand.Rand() % ember.TotalXformCount();
os << "mutate delete xform " << nx;
if (ember.TotalXformCount() > 1)
@ -417,13 +418,13 @@ public:
Random(mutation, useVars, sym, ember.TotalXformCount());
//Change all the coefs by a fraction of the random.
for (x = 0; x < ember.TotalXformCount(); x++)
for (size_t x = 0; x < ember.TotalXformCount(); x++)
{
Xform<T>* xform1 = ember.GetTotalXform(x);
Xform<T>* xform2 = mutation.GetTotalXform(x);
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
for (glm::length_t i = 0; i < 2; i++)
for (glm::length_t j = 0; j < 3; j++)
xform1->m_Affine.m_Mat[i][j] += speed * xform2->m_Affine.m_Mat[i][j];
//Eventually, mutate the parametric variation parameters here.
@ -443,7 +444,8 @@ public:
/// <returns>A string describing what was done</returns>
string Cross(Ember<T>& ember0, Ember<T>& ember1, Ember<T>& emberOut, int crossMode)
{
unsigned int i, rb;
unsigned int rb;
size_t i;
T t;
ostringstream os;
char ministr[32];
@ -579,7 +581,8 @@ public:
if (m_Rand.Frand01<T>() < T(0.4))
{
//Select the starting parent.
unsigned int ci, startParent = m_Rand.RandBit();
size_t ci;
unsigned int startParent = m_Rand.RandBit();
os << " cmap_cross " << startParent << ":";
@ -617,14 +620,15 @@ public:
/// <param name="useVars">A list of variations to use. If empty, any variation can be used.</param>
/// <param name="sym">The symmetry type to use from -2 to 2</param>
/// <param name="specXforms">The number of xforms to use. If 0, a quasi random count is used.</param>
void Random(Ember<T>& ember, vector<eVariationId>& useVars, int sym, int specXforms)
void Random(Ember<T>& ember, vector<eVariationId>& useVars, int sym, size_t specXforms)
{
bool postid, addfinal = false;
int var, samed, multid, samepost;
unsigned int i, j, k, n, varCount = (unsigned int)m_VariationList.Size();
glm::length_t i, j, k, n;
size_t varCount = m_VariationList.Size();
Palette<T> palette;
static unsigned int xformDistrib[] =
static size_t xformDistrib[] =
{
2, 2, 2, 2,
3, 3, 3, 3,
@ -853,8 +857,8 @@ public:
T TryColors(Ember<T>& ember, int colorResolution)
{
unsigned char* p;
unsigned int i, hits = 0, res = colorResolution;
unsigned int pixTotal, res3 = res * res * res;
size_t i, hits = 0, res = colorResolution;
size_t pixTotal, res3 = res * res * res;
T scalar;
Ember<T> adjustedEmber = ember;
@ -865,8 +869,8 @@ public:
//Scale the image so that the total number of pixels is ~10,000.
pixTotal = ember.m_FinalRasW * ember.m_FinalRasH;
scalar = sqrt(T(10000) / pixTotal);
adjustedEmber.m_FinalRasW = (unsigned int)(ember.m_FinalRasW * scalar);
adjustedEmber.m_FinalRasH = (unsigned int)(ember.m_FinalRasH * scalar);
adjustedEmber.m_FinalRasW = (size_t)(ember.m_FinalRasW * scalar);
adjustedEmber.m_FinalRasH = (size_t)(ember.m_FinalRasH * scalar);
adjustedEmber.m_PixelsPerUnit *= scalar;
adjustedEmber.m_Passes = 1;
adjustedEmber.m_TemporalSamples = 1;
@ -887,6 +891,7 @@ public:
m_Hist.resize(res3);
memset(m_Hist.data(), 0, res3);
p = m_FinalImage.data();
for (i = 0; i < m_Renderer->FinalDimensions(); i++)
@ -913,7 +918,7 @@ public:
/// <param name="changePalette">Change palette if true, else don't</param>
void ChangeColors(Ember<T>& ember, bool changePalette)
{
unsigned int i;
size_t i;
Xform<T>* xform0;
Xform<T>* xform1;
@ -966,13 +971,13 @@ public:
/// <param name="ember">The ember to get a random xform from</param>
/// <param name="excluded">Optionally exclude an xform. Pass -1 to include all for consideration.</param>
/// <returns>The random xform if successful, else nullptr.</returns>
Xform<T>* RandomXform(Ember<T>& ember, int excluded)
Xform<T>* RandomXform(Ember<T>& ember, intmax_t excluded)
{
int ntries = 0;
size_t ntries = 0;
while (ntries++ < 100)
{
int i = m_Rand.Rand() % ember.TotalXformCount();
size_t i = m_Rand.Rand() % ember.TotalXformCount();
if (i != excluded)
{
@ -1000,7 +1005,7 @@ public:
//Insert motion magic here :
//If there are motion elements, modify the contents of
//the result xforms before rotate is called.
for (unsigned int i = 0; i < ember.TotalXformCount(); i++)
for (size_t i = 0; i < ember.TotalXformCount(); i++)
{
Xform<T>* xform1 = ember.GetTotalXform(i);
Xform<T>* xform2 = rotated.GetTotalXform(i);
@ -1024,7 +1029,7 @@ public:
/// <param name="seqFlag">True if embers points to the first or last ember in the entire sequence, else false.</param>
void Edge(Ember<T>* embers, Ember<T>& result, T blend, bool seqFlag)
{
unsigned int i, si;
size_t i, si;
Ember<T> spun[2], prealign[2];
//Insert motion magic here :
@ -1160,7 +1165,7 @@ public:
void ApplyTemplate(Ember<T>& ember, Ember<T>& templ)
{
//Check for invalid values - only replace those with valid ones.
for (unsigned int i = 0; i < 3; i++)
for (glm::length_t i = 0; i < 3; i++)
if (templ.m_Background[i] >= 0)
ember.m_Background[i] = templ.m_Background[i];
@ -1280,9 +1285,9 @@ public:
/// <param name="bmin">The bmin[0] and bmin[1] will be the minimum x and y values.</param>
/// <param name="bmax">The bmax[0] and bmax[1] will be the maximum x and y values.</param>
/// <returns>The number of iterations ran</returns>
uint64_t EstimateBoundingBox(Ember<T>& ember, T eps, unsigned int samples, T* bmin, T* bmax)
size_t EstimateBoundingBox(Ember<T>& ember, T eps, size_t samples, T* bmin, T* bmax)
{
unsigned int i, lowTarget, highTarget;
size_t i, lowTarget, highTarget;
T min[2], max[2];
if (ember.XaosPresent())
@ -1293,7 +1298,7 @@ public:
m_Iterator->InitDistributions(ember);
m_Samples.resize(samples);
uint64_t bv = m_Iterator->Iterate(ember, samples, 20, m_Samples.data(), m_Rand);//Use a special fuse of 20, all other calls to this will use 15, or 100.
size_t bv = m_Iterator->Iterate(ember, samples, 20, m_Samples.data(), m_Rand);//Use a special fuse of 20, all other calls to this will use 15, or 100.
if (bv / T(samples) > eps)
eps = 3 * bv / T(samples);
@ -1301,7 +1306,7 @@ public:
if (eps > T(0.3))
eps = T(0.3);
lowTarget = (int)(samples * eps);
lowTarget = (size_t)(samples * eps);
highTarget = samples - lowTarget;
min[0] = min[1] = 1e10;

View File

@ -51,7 +51,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
SpatialFilter(eSpatialFilterType filterType, T support, T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
SpatialFilter(eSpatialFilterType filterType, T support, T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
{
m_FilterType = filterType;
m_Support = support;
@ -152,7 +152,7 @@ public:
/// <returns>The string representation of this filter</returns>
string ToString() const
{
unsigned int i;
size_t i;
stringstream ss;
ss
@ -179,9 +179,9 @@ public:
/// </summary>
void Apply() { }
inline int FinalFilterWidth() const { return m_FinalFilterWidth; }
inline unsigned int Supersample() const { return m_Supersample; }
inline unsigned int BufferSize() const { return (unsigned int)m_Filter.size(); }
inline unsigned int BufferSizeBytes() const { return BufferSize() * sizeof(T); }
inline size_t Supersample() const { return m_Supersample; }
inline size_t BufferSize() const { return m_Filter.size(); }
inline size_t BufferSizeBytes() const { return BufferSize() * sizeof(T); }
inline T Support() const { return m_Support; }
inline T FilterRadius() const { return m_FilterRadius; }
inline T PixelAspectRatio() const { return m_PixelAspectRatio; }
@ -231,7 +231,7 @@ private:
}
int m_FinalFilterWidth;//The final width that the filter ends up being.
unsigned int m_Supersample;//The supersample value of the ember using this filter to render.
size_t m_Supersample;//The supersample value of the ember using this filter to render.
T m_Support;//Extra value.
T m_FilterRadius;//The requested filter radius.
T m_PixelAspectRatio;//The aspect ratio of the ember using this filter to render, usually 1.
@ -253,7 +253,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
GaussianFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
GaussianFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(GAUSSIAN_SPATIAL_FILTER, T(1.5), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -281,7 +281,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
HermiteFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
HermiteFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(HERMITE_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -316,7 +316,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
BoxFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
BoxFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(BOX_SPATIAL_FILTER, T(0.5), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -347,7 +347,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
TriangleFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
TriangleFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(TRIANGLE_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -381,7 +381,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
BellFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
BellFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(BELL_SPATIAL_FILTER, T(1.5), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -422,7 +422,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
BsplineFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
BsplineFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(BSPLINE_SPATIAL_FILTER, T(2.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -467,7 +467,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
Lanczos3Filter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
Lanczos3Filter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(LANCZOS3_SPATIAL_FILTER, T(3.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -501,7 +501,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
Lanczos2Filter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
Lanczos2Filter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(LANCZOS2_SPATIAL_FILTER, T(2.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -535,7 +535,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
MitchellFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
MitchellFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(MITCHELL_SPATIAL_FILTER, T(2.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -588,7 +588,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
BlackmanFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
BlackmanFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(BLACKMAN_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -616,7 +616,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
CatromFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
CatromFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(CATROM_SPATIAL_FILTER, T(2.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -659,7 +659,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
HammingFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
HammingFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(HAMMING_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -687,7 +687,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
HanningFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
HanningFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(HANNING_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -715,7 +715,7 @@ public:
/// <param name="filterRadius">The filter radius</param>
/// <param name="superSample">The supersample of the ember being rendered</param>
/// <param name="pixelAspectRatio">The pixel aspect ratio being used to render. Default: 1.</param>
QuadraticFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
QuadraticFilter(T filterRadius, size_t superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter<T>(QUADRATIC_SPATIAL_FILTER, T(1.5), filterRadius, superSample, pixelAspectRatio) { }
/// <summary>
@ -756,7 +756,7 @@ public:
/// <param name="superSample">The supersample value of the ember using this filter to render</param>
/// <param name="pixelAspectRatio">The aspect ratio of the ember using this filter to render. Default: 1.</param>
/// <returns>A pointer to the newly created filter object</returns>
static SpatialFilter<T>* Create(eSpatialFilterType filterType, T filterRadius, unsigned int superSample, T pixelAspectRatio = 1)
static SpatialFilter<T>* Create(eSpatialFilterType filterType, T filterRadius, size_t superSample, T pixelAspectRatio = 1)
{
SpatialFilter<T>* filter = nullptr;
@ -829,7 +829,7 @@ public:
/// </summary>
/// <param name="filterType">The string name of the filter</param>
/// <returns>The filter type enum</returns>
static eSpatialFilterType FromString(string filterType)
static eSpatialFilterType FromString(const string& filterType)
{
if (!_stricmp(filterType.c_str(), "Gaussian"))
return GAUSSIAN_SPATIAL_FILTER;

View File

@ -47,9 +47,9 @@ public:
/// <param name="passes">The number of passes used in the ember being rendered</param>
/// <param name="temporalSamples">The number of temporal samples in the ember being rendered</param>
/// <param name="filterWidth">The width of the filter.</param>
TemporalFilter(eTemporalFilterType filterType, unsigned int passes, unsigned int temporalSamples, T filterWidth)
TemporalFilter(eTemporalFilterType filterType, size_t passes, size_t temporalSamples, T filterWidth)
{
unsigned int i, steps = passes * temporalSamples;
size_t i, steps = passes * temporalSamples;
m_Passes = passes;
m_TemporalSamples = temporalSamples;
@ -117,7 +117,7 @@ public:
/// <returns>The string representation of this filter</returns>
string ToString() const
{
unsigned int i;
size_t i;
stringstream ss;
ss << "Temporal Filter:" << endl
@ -146,8 +146,8 @@ public:
/// Accessors.
/// </summary>
size_t Size() const { return m_Filter.size(); }
unsigned int Passes() const { return m_Passes; }
unsigned int TemporalSamples() const { return m_TemporalSamples; }
size_t Passes() const { return m_Passes; }
size_t TemporalSamples() const { return m_TemporalSamples; }
T FilterWidth() const { return m_FilterWidth; }
T FilterExp() const { return m_FilterExp; }
T SumFilt() const { return m_SumFilt; }
@ -164,7 +164,7 @@ protected:
{
m_SumFilt = 0;
for (unsigned int i = 0; i < Size(); i++)
for (size_t i = 0; i < Size(); i++)
{
m_Filter[i] /= maxFilt;
m_SumFilt += m_Filter[i];
@ -176,8 +176,8 @@ protected:
T m_SumFilt;//The sum of all filter values.
T m_FilterWidth;
T m_FilterExp;
unsigned int m_Passes;
unsigned int m_TemporalSamples;
size_t m_Passes;
size_t m_TemporalSamples;
vector<T> m_Deltas;//Delta vector.
vector<T> m_Filter;//Filter vector.
eTemporalFilterType m_FilterType;//The type of filter this is.
@ -198,14 +198,14 @@ public:
/// <param name="temporalSamples">The number of temporal samples in the ember being rendered</param>
/// <param name="filterWidth">The width of the filter.</param>
/// <param name="filterExp">The filter exp.</param>
ExpTemporalFilter(unsigned int passes, unsigned int temporalSamples, T filterWidth, T filterExp)
ExpTemporalFilter(size_t passes, size_t temporalSamples, T filterWidth, T filterExp)
: TemporalFilter<T>(BOX_TEMPORAL_FILTER, passes, temporalSamples, filterWidth)
{
if (Size() > 1)
{
T slpx, maxFilt = 0;
for (unsigned int i = 0; i < Size(); i++)
for (size_t i = 0; i < Size(); i++)
{
if (filterExp >= 0)
slpx = (T(i) + 1) / Size();
@ -240,7 +240,7 @@ public:
/// <param name="passes">The number of passes used in the ember being rendered</param>
/// <param name="temporalSamples">The number of temporal samples in the ember being rendered</param>
/// <param name="filterWidth">The width of the filter.</param>
GaussianTemporalFilter(unsigned int passes, unsigned int temporalSamples, T filterWidth)
GaussianTemporalFilter(size_t passes, size_t temporalSamples, T filterWidth)
: TemporalFilter<T>(GAUSSIAN_TEMPORAL_FILTER, passes, temporalSamples, filterWidth)
{
if (Size() > 1)
@ -248,7 +248,7 @@ public:
T maxFilt = 0, halfSteps = T(Size()) / T(2);
GaussianFilter<T> gaussian(1, 1);//Just pass dummy values, they are unused in this case.
for (unsigned int i = 0; i < Size(); i++)
for (size_t i = 0; i < Size(); i++)
{
m_Filter[i] = gaussian.Filter(gaussian.Support() * fabs(i - halfSteps) / halfSteps);
@ -276,12 +276,12 @@ public:
/// <param name="passes">The number of passes used in the ember being rendered</param>
/// <param name="temporalSamples">The number of temporal samples in the ember being rendered</param>
/// <param name="filterWidth">The width of the filter.</param>
BoxTemporalFilter(unsigned int passes, unsigned int temporalSamples, T filterWidth)
BoxTemporalFilter(size_t passes, size_t temporalSamples, T filterWidth)
: TemporalFilter<T>(BOX_TEMPORAL_FILTER, passes, temporalSamples, filterWidth)
{
if (Size() > 1)
{
for (unsigned int i = 0; i < Size(); i++)
for (size_t i = 0; i < Size(); i++)
m_Filter[i] = 1;
FinishFilter(1);
@ -305,7 +305,7 @@ public:
/// <param name="filterWidth">The width of the filter</param>
/// <param name="filterExp">The filter exp, only used with Exp filter, otherwise ignored.</param>
/// <returns>A pointer to the newly created filter object</returns>
static TemporalFilter<T>* Create(eTemporalFilterType filterType, unsigned int passes, unsigned int temporalSamples, T filterWidth, T filterExp = 1)
static TemporalFilter<T>* Create(eTemporalFilterType filterType, size_t passes, size_t temporalSamples, T filterWidth, T filterExp = 1)
{
TemporalFilter<T>* filter = nullptr;
@ -342,7 +342,7 @@ public:
/// </summary>
/// <param name="filterType">The string name of the filter</param>
/// <returns>The filter type enum</returns>
static eTemporalFilterType FromString(string filterType)
static eTemporalFilterType FromString(const string& filterType)
{
if (!_stricmp(filterType.c_str(), "box"))
return BOX_TEMPORAL_FILTER;

View File

@ -115,7 +115,7 @@ public:
/// Add string to report.
/// </summary>
/// <param name="s">The string to add</param>
virtual void AddToReport(string s) { m_ErrorReport.push_back(s); }
virtual void AddToReport(const string& s) { m_ErrorReport.push_back(s); }
/// <summary>
/// Add a vector of strings to report.
@ -138,7 +138,7 @@ public:
{
stringstream ss;
ForEach(errorReport, [&](string s) { ss << s << endl; });
ForEach(errorReport, [&](const string& s) { ss << s << endl; });
return ss.str();
}
@ -218,7 +218,28 @@ static void CopyVec(vector<T>& dest, const vector<U>& source)
dest.resize(source.size());
for (size_t i = 0; i < source.size(); i++)
dest[i] = T(source[i]);//Valid assignment operator between T and U types must be defined somewhere.
dest[i] = (T)source[i];//Valid assignment operator between T and U types must be defined somewhere.
}
/// <summary>
/// Clear dest and copy all of the elements of vector source with elements of type U to the vector
/// dest with elements of type T.
/// Call a function on each element after it's been copied.
/// </summary>
/// <param name="dest">The vector of type T to copy to</param>
/// <param name="source">The vector of type U to copy from</param>
/// <param name="perElementOperation">A function to call on each element after it's copied</param>
template <typename T, typename U>
static void CopyVec(vector<T>& dest, const vector<U>& source, std::function<void(T& t)> perElementOperation)
{
dest.clear();
dest.resize(source.size());
for (size_t i = 0; i < source.size(); i++)
{
dest[i] = (T)source[i];//Valid assignment operator between T and U types must be defined somewhere.
perElementOperation(dest[i]);
}
}
/// <summary>
@ -246,6 +267,18 @@ static void ClearVec(vector<T*>& vec, bool arrayDelete = false)
vec.clear();
}
/// <summary>
/// Thin wrapper around passing a vector to memset() to relieve
/// the caller of having to pass the size.
/// </summary>
/// <param name="vec">The vector to memset</param>
/// <param name="val">The value to set each element to, default 0.</param>
template<typename T>
static inline void Memset(vector<T>& vec, int val = 0)
{
memset((void*)vec.data(), val, vec.size() * sizeof(vec[0]));
}
/// <summary>
/// System floor() extremely slow because it accounts for various error conditions.
/// This is a much faster version that works on data that is not NaN.
@ -761,7 +794,7 @@ static string ToUpper(const string& str)
/// <param name="str">The string to trim</param>
/// <param name="ch">The character to trim. Default: space.</param>
/// <returns>The trimmed string</returns>
static string Trim(string& str, char ch = ' ')
static string Trim(const string& str, char ch = ' ')
{
string ret;

View File

@ -1336,8 +1336,8 @@ public:
eVariationAssignType AssignType() const { return m_AssignType; }
const Xform<T>* ParentXform() const { return m_Xform; }
void ParentXform(Xform<T>* xform) { m_Xform = xform; }
int IndexInXform() { return m_Xform ? m_Xform->GetVariationIndex(this) : -1; }
int XformIndexInEmber() { return m_Xform ? m_Xform->IndexInParentEmber() : -1; }
intmax_t IndexInXform() { return m_Xform ? m_Xform->GetVariationIndex(this) : -1; }
intmax_t XformIndexInEmber() { return m_Xform ? m_Xform->IndexInParentEmber() : -1; }
T m_Weight;//The weight of the variation.
@ -1822,7 +1822,7 @@ public:
/// Accessors.
/// </summary>
ParamWithName<T>* Params() { return &m_Params[0]; }
unsigned int ParamCount() { return (unsigned int)m_Params.size(); }
size_t ParamCount() { return m_Params.size(); }
const vector<ParamWithName<T>>& ParamsVec() const { return m_Params; }
protected:

View File

@ -433,7 +433,7 @@ public:
/// </summary>
/// <param name="name">The name to search for</param>
/// <returns>A pointer to the variation if found, else nullptr.</returns>
Variation<T>* GetVariation(string& name)
Variation<T>* GetVariation(const string& name)
{
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
@ -449,7 +449,7 @@ public:
/// <param name="name">The name of the variation in the list to make a copy of</param>
/// <param name="weight">The weight to assign the new copy. Default: 1</param>
/// <returns>A pointer to the variation with a matching name, else nullptr.</returns>
Variation<T>* GetVariationCopy(string name, T weight = 1) { return MakeCopyWithWeight(GetVariation(name), weight); }
Variation<T>* GetVariationCopy(const string& name, T weight = 1) { return MakeCopyWithWeight(GetVariation(name), weight); }
/// <summary>
/// Get a parametric variation at the specified index.
@ -464,7 +464,7 @@ public:
/// </summary>
/// <param name="name">The name of the variation in the parametric variations list to retrieve</param>
/// <returns>The parametric variation with a matching name, else nullptr.</returns>
ParametricVariation<T>* GetParametricVariation(string name)
ParametricVariation<T>* GetParametricVariation(const string& name)
{
for (unsigned int i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != nullptr; i++)
if (!_stricmp(name.c_str(), m_ParametricVariations[i]->Name().c_str()))
@ -478,7 +478,7 @@ public:
/// </summary>
/// <param name="name">The name of the variation whose index is returned</param>
/// <returns>The index of the variation with the matching name, else -1</returns>
int GetVariationIndex(string name)
int GetVariationIndex(const string& name)
{
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))

View File

@ -29,7 +29,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n"
@ -66,7 +66,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x);\n"
@ -106,7 +106,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r2 = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares);\n"
@ -151,7 +151,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t c1 = sin(precalcSumSquares);\n"
@ -196,7 +196,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSqrtSumSquares);\n"
@ -235,7 +235,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (precalcAtanxy * M_1_PI);\n"
@ -272,7 +272,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares * sin(precalcAtanxy + precalcSqrtSumSquares);\n"
@ -313,7 +313,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t a = precalcSqrtSumSquares * precalcAtanxy;\n"
@ -361,7 +361,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string weightByPI = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -424,7 +424,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = Zeps(precalcSqrtSumSquares);\n"
@ -466,7 +466,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = Zeps(precalcSqrtSumSquares);\n"
@ -505,7 +505,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * precalcSina * cos(precalcSqrtSumSquares);\n"
@ -553,7 +553,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t a = precalcAtanxy;\n"
@ -606,7 +606,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * sqrt(precalcSqrtSumSquares);\n"
@ -654,7 +654,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t nx = vIn.x < 0.0 ? (vIn.x * 2.0) : vIn.x;\n"
@ -705,7 +705,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string dx2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -782,7 +782,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = 2 * xform->m_VariationWeights[" << varIndex << "] / (precalcSqrtSumSquares + 1);\n"
@ -828,7 +828,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t dx = tan(3 * vIn.y);\n"
@ -875,7 +875,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t dx = xform->m_VariationWeights[" << varIndex << "] * exp(vIn.x - 1.0);\n"
@ -921,7 +921,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * pow(precalcSqrtSumSquares, precalcSina);\n"
@ -964,7 +964,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t a = vIn.x * M_PI;\n"
@ -1014,7 +1014,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t dx = Zeps(xform->m_C * xform->m_C);\n"
@ -1069,7 +1069,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t dx = M_PI * Zeps(xform->m_C * xform->m_C);\n"
@ -1121,7 +1121,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string blobLow = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1207,7 +1207,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string pdjA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1308,7 +1308,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string fan2X = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1399,7 +1399,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rings2Val = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1468,7 +1468,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = (xform->m_VariationWeights[" << varIndex << "] * 2.0) / (precalcSqrtSumSquares + 1.0);\n"
@ -1506,7 +1506,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t denom = 0.25 * precalcSumSquares + 1;\n"
@ -1542,7 +1542,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x);\n"
@ -1581,7 +1581,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -1658,7 +1658,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t tempr = MwcNext01(mwc) * M_2PI;\n"
@ -1700,7 +1700,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -1798,7 +1798,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -1900,7 +1900,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t tmpr = MwcNext01(mwc) * M_2PI;\n"
@ -1939,7 +1939,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t angle = MwcNext01(mwc) * M_2PI;\n"
@ -1987,7 +1987,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -2062,7 +2062,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string slices = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2144,7 +2144,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string sides = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2249,7 +2249,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string c1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2329,7 +2329,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2398,7 +2398,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t angle = MwcNext01(mwc) * xform->m_VariationWeights[" << varIndex << "] * M_PI;\n"
@ -2435,7 +2435,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) / cos(vIn.y);\n"
@ -2468,7 +2468,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) - 0.5);\n"
@ -2505,7 +2505,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t ang = xform->m_VariationWeights[" << varIndex << "] * MwcNext01(mwc) * M_PI;\n"
@ -2546,7 +2546,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = MwcNext01(mwc) * xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares;\n"
@ -2592,7 +2592,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares;\n"
@ -2643,7 +2643,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = MwcNext01(mwc) * xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares;\n"
@ -2686,7 +2686,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] /Zeps(fabs((vIn.x - vIn.y) * (vIn.x + vIn.y)));\n"
@ -2729,7 +2729,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rot = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -2837,7 +2837,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string m = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -2935,7 +2935,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string petals = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3002,7 +3002,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string eccentricity = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3068,7 +3068,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string height = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3139,7 +3139,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3250,7 +3250,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string shift = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3408,7 +3408,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t roundX = Rint(vIn.x);\n"
@ -3483,7 +3483,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t wx = xform->m_VariationWeights[" << varIndex << "] * 1.3029400317411197908970256609023;\n"
@ -3563,7 +3563,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string size = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3663,7 +3663,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string powerR = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3748,7 +3748,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string xAmp = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3851,7 +3851,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t tmp = precalcSumSquares + 1.0;\n"
@ -3926,7 +3926,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string weightDivPiDiv2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4010,7 +4010,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string beta = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4101,7 +4101,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t expx = exp(vIn.x) * 0.5;\n"
@ -4162,7 +4162,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string spin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4274,7 +4274,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string w2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4352,7 +4352,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4452,7 +4452,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string separation = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4544,7 +4544,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string vvar = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4604,7 +4604,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4741,7 +4741,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4837,7 +4837,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string xSize = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4925,7 +4925,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4996,7 +4996,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string space = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5065,7 +5065,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5153,7 +5153,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -5250,7 +5250,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5332,7 +5332,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string inside = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5400,7 +5400,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string freqX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5475,7 +5475,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t expe = xform->m_VariationWeights[" << varIndex << "] * exp(vIn.x);\n"
@ -5513,7 +5513,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string base = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5569,7 +5569,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) * cosh(vIn.y);\n"
@ -5603,7 +5603,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cos(vIn.x) * cosh(vIn.y);\n"
@ -5642,7 +5642,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t tansin = sin(2.0 * vIn.x);\n"
@ -5687,7 +5687,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t secsin = sin(vIn.x);\n"
@ -5732,7 +5732,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t cscsin = sin(vIn.x);\n"
@ -5777,7 +5777,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t cotsin = sin(2.0 * vIn.x);\n"
@ -5821,7 +5821,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t sinhsin = sin(vIn.y);\n"
@ -5864,7 +5864,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t coshsin = sin(vIn.y);\n"
@ -5908,7 +5908,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t tanhsin = sin(2.0 * vIn.y);\n"
@ -5953,7 +5953,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t sechsin = sin(vIn.y);\n"
@ -5998,7 +5998,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t cschsin = sin(vIn.y);\n"
@ -6043,7 +6043,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t cothsin = sin(2.0 * vIn.y);\n"
@ -6090,7 +6090,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string symmetry = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -6175,7 +6175,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string spread = "parVars[" + ToUpper(m_Params[i++].Name()) + index;

View File

@ -27,7 +27,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t t = xform->m_VariationWeights[" << varIndex << "] / sqrt(precalcSumSquares + 1.0);\n"
@ -77,7 +77,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -187,7 +187,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string bwrapsCellsize = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -347,7 +347,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
@ -423,7 +423,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string blurZoomLength = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -485,7 +485,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string blurPixelizeSize = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -575,7 +575,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x0 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -731,7 +731,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -819,7 +819,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string blurLinearLength = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -886,7 +886,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string v = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -992,7 +992,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = vOut.y = 0;\n"
@ -1024,7 +1024,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = vOut.y = 0;\n"
@ -1056,7 +1056,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = vOut.y = 0;\n"
@ -1097,7 +1097,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n";
@ -1147,7 +1147,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t angle = MwcNext01(mwc) * M_2PI;\n"
@ -1190,7 +1190,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r2 = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares + SQR(vIn.z));\n"
@ -1231,7 +1231,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string cx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1317,7 +1317,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1412,7 +1412,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1529,7 +1529,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1599,7 +1599,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1727,7 +1727,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string hole = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1840,7 +1840,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string hole = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2028,7 +2028,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t avgr = xform->m_VariationWeights[" << varIndex << "] * (sqrt(SQR(vIn.y) + SQR(vIn.x + 1)) / sqrt(SQR(vIn.y) + SQR(vIn.x - 1)));\n"
@ -2074,7 +2074,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string real = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2161,7 +2161,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rootFace = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2232,7 +2232,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t a = M_2PI / (precalcSqrtSumSquares + 1);\n"
@ -2283,7 +2283,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string five = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -2362,7 +2362,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string sc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2470,7 +2470,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string v2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -2616,7 +2616,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t x = LRint(vIn.x);\n"
@ -2719,7 +2719,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2786,7 +2786,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2882,7 +2882,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2977,7 +2977,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3066,7 +3066,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3190,7 +3190,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3292,7 +3292,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3401,7 +3401,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string v = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -3469,7 +3469,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3568,7 +3568,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3651,7 +3651,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3749,7 +3749,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3852,7 +3852,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string parity = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4019,7 +4019,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string in = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4158,7 +4158,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string c1r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4257,7 +4257,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4371,7 +4371,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string powx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4528,7 +4528,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string t3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4640,7 +4640,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string frequency = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4770,7 +4770,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string shiftX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4892,7 +4892,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string ampX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4996,7 +4996,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string distort = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5064,7 +5064,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "];\n"
@ -5109,7 +5109,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string vvar2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -5180,7 +5180,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string freqX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5295,7 +5295,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5404,7 +5404,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5475,7 +5475,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string weight01 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5528,7 +5528,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) * (cosh(vIn.y) + 1.0) * Sqr(sin(vIn.x));\n"
@ -5563,7 +5563,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] / precalcSumSquares;\n"
@ -5616,7 +5616,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;

View File

@ -30,7 +30,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string effect = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -80,7 +80,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n"
@ -119,7 +119,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string numerator = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -195,7 +195,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -248,7 +248,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x - ((SQR(vIn.x) * vIn.x) / 3)) + vIn.x * SQR(vIn.y);\n"
@ -290,7 +290,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -359,7 +359,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string pull = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -466,7 +466,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -634,7 +634,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -792,7 +792,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -947,7 +947,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1036,7 +1036,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1092,7 +1092,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t rad = sqrt(MwcNext01(mwc));\n"
@ -1136,7 +1136,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1217,7 +1217,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1320,7 +1320,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1404,7 +1404,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string mode = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1505,7 +1505,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1584,7 +1584,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1658,7 +1658,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string powx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1712,7 +1712,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string powx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1771,7 +1771,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1829,7 +1829,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1893,7 +1893,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1976,7 +1976,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t sinX = sin(vIn.x);\n"
@ -2018,7 +2018,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t e = 1 / precalcSumSquares + SQR(M_2_PI);\n"
@ -2092,7 +2092,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t inZ, otherZ, tempTz, tempPz;\n"
@ -2178,7 +2178,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t d = Zeps(precalcSumSquares);\n"
@ -2246,7 +2246,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t a = precalcAtanyx;\n"
@ -2327,7 +2327,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2414,7 +2414,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2501,7 +2501,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string reA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2600,7 +2600,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string reA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2754,7 +2754,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2886,7 +2886,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string min = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2966,7 +2966,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3036,7 +3036,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string even = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3120,7 +3120,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3225,7 +3225,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3331,7 +3331,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3400,7 +3400,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string in = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3473,7 +3473,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rotate = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3556,7 +3556,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3667,7 +3667,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string shift = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3749,7 +3749,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string ww = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3812,7 +3812,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n"
@ -3884,7 +3884,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4016,7 +4016,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4126,7 +4126,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4226,7 +4226,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string move = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4322,7 +4322,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string push = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4410,7 +4410,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rotate = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4496,7 +4496,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;

View File

@ -42,7 +42,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string in = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -211,7 +211,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string spinIn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -430,7 +430,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -546,7 +546,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -611,7 +611,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t d = Zeps(precalcSumSquares);\n"
@ -648,7 +648,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t d = Zeps(precalcSumSquares);\n"
@ -1162,7 +1162,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string strength = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1242,7 +1242,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1325,7 +1325,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string w = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1414,7 +1414,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string m_k = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1658,7 +1658,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) - 0.5);\n"
@ -1730,7 +1730,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rho = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1918,7 +1918,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string stretchX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2027,7 +2027,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2145,7 +2145,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2286,7 +2286,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string spin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2436,7 +2436,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string at = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2567,7 +2567,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2634,7 +2634,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2721,7 +2721,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3011,7 +3011,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string a1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3173,7 +3173,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
@ -3220,7 +3220,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
@ -3268,7 +3268,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
@ -3317,7 +3317,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
@ -3371,7 +3371,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n"
@ -3430,7 +3430,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n"
@ -3483,7 +3483,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
@ -3530,7 +3530,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
@ -3583,7 +3583,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n"
@ -3642,7 +3642,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n"
@ -3696,7 +3696,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
@ -3745,7 +3745,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
@ -3792,7 +3792,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
@ -3837,7 +3837,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string base = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3896,7 +3896,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSqrtSumSquares);\n"
@ -3938,7 +3938,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string q01 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4048,7 +4048,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4461,7 +4461,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string deltaX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4645,7 +4645,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4782,7 +4782,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string r1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4898,7 +4898,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string re = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4973,7 +4973,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t r = MwcNext01(mwc) * xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares;\n"
@ -5015,7 +5015,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string blobLow = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5103,7 +5103,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -5242,7 +5242,7 @@ MAKEPREPOSTPARVAR(Blocky, blocky, BLOCKY)
// virtual string OpenCLString() override
// {
// ostringstream ss;
// int varIndex = IndexInXform();
// intmax_t varIndex = IndexInXform();
//
// ss << "\t{\n"
// << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n"
@ -5273,7 +5273,7 @@ MAKEPREPOSTPARVAR(Blocky, blocky, BLOCKY)
// virtual string OpenCLString() override
// {
// ostringstream ss;
// int varIndex = IndexInXform();
// intmax_t varIndex = IndexInXform();
//
// ss << "\t{\n"
// << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"

View File

@ -37,7 +37,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -145,7 +145,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string sc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -303,7 +303,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string sc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -431,7 +431,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string sc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -669,7 +669,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string xpand = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -900,7 +900,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string xpand = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1042,7 +1042,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t expx = exp(vIn.x) * 0.5;\n"
@ -1098,7 +1098,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string xpow = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1178,7 +1178,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1262,7 +1262,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string delta = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1357,7 +1357,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string vv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1433,7 +1433,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1503,7 +1503,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string freq = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1563,7 +1563,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string slices = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1738,7 +1738,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x);\n"
@ -1845,7 +1845,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string xdist = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1974,7 +1974,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2081,7 +2081,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t a = M_PI / (precalcSqrtSumSquares + 1);\n"
@ -2160,7 +2160,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string scatter = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2742,7 +2742,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index;

View File

@ -39,7 +39,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -121,7 +121,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string origin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -232,7 +232,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string cubeC1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -390,7 +390,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string offset = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -551,7 +551,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss;
int varIndex = IndexInXform();
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
<< "\t\treal_t x = LRint(vIn.x);\n"
@ -664,7 +664,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string offset = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -825,7 +825,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string scatterArea = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.
@ -970,7 +970,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x0 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params.

View File

@ -169,7 +169,7 @@ public:
//Must manually add them via the AddVariation() function so that
//the variation's m_IndexInXform member gets properly set to this.
for (unsigned int i = 0; i < xform.TotalVariationCount(); i++)
for (size_t i = 0; i < xform.TotalVariationCount(); i++)
{
Variation<T>* var = nullptr;
@ -199,7 +199,7 @@ public:
/// </summary>
void Init()
{
static unsigned int count = 0;
static size_t count = 0;
m_Weight = 0;
m_ColorSpeed = T(0.5);
@ -302,7 +302,7 @@ public:
const_cast<Xform<T>*>(this)->AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++, count++)
for (size_t i = 0; i < variations.size(); i++, count++)
{
if (count == index)
{
@ -327,7 +327,7 @@ public:
const_cast<Xform<T>*>(this)->AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++)
for (size_t i = 0; i < variations.size(); i++)
{
if (variations[i] != nullptr && variations[i]->VariationId() == id)
{
@ -346,13 +346,13 @@ public:
/// </summary>
/// <param name="name">The name to search for</param>
/// <returns>A pointer to the variation if found, else nullptr.</returns>
Variation<T>* GetVariationByName(string name) const
Variation<T>* GetVariationByName(const string& name) const
{
Variation<T>* var = nullptr;
const_cast<Xform<T>*>(this)->AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++)
for (size_t i = 0; i < variations.size(); i++)
{
if (variations[i] != nullptr && variations[i]->Name() == name)
{
@ -372,13 +372,13 @@ public:
/// </summary>
/// <param name="var">A pointer to the variation to search for</param>
/// <returns>The index of the variation if found, else -1</returns>
int GetVariationIndex(Variation<T>* var) const
intmax_t GetVariationIndex(Variation<T>* var) const
{
int count = 0, index = -1;
intmax_t count = 0, index = -1;
const_cast<Xform<T>*>(this)->AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++, count++)
for (size_t i = 0; i < variations.size(); i++, count++)
{
if (variations[i] == var)
{
@ -404,7 +404,7 @@ public:
AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++)
for (size_t i = 0; i < variations.size(); i++)
{
if (variations[i] != nullptr && variations[i]->VariationId() == id)
{
@ -497,7 +497,7 @@ public:
/// </summary>
/// <param name="i">The index to set</param>
/// <param name="val">The xaos value to set it to</param>
void SetXaos(unsigned int i, T val)
void SetXaos(size_t i, T val)
{
if (i < m_Xaos.size())
{
@ -520,7 +520,7 @@ public:
bool XaosPresent() const
{
if (m_ParentEmber)
for (unsigned int i = 0; i < m_Xaos.size(); i++)
for (size_t i = 0; i < m_Xaos.size(); i++)
if (i < m_ParentEmber->XformCount())
if (!IsClose<T>(m_Xaos[i], 1))
return true;//If at least one entry is not equal to 1, then xaos is present.
@ -683,15 +683,14 @@ public:
/// <param name="blend">The time blending value 0-1</param>
void ApplyMotion(Xform<T>& xform, T blend)
{
unsigned int i, j, k;
Xform<T>* mot = xform.m_Motion.data();
//Loop over the motion elements and add their contribution to the original vals.
for (i = 0; i < xform.m_Motion.size(); i++)
for (size_t i = 0; i < xform.m_Motion.size(); i++)
{
//Original only pulls these from the first motion xform which is a bug. Want to pull it from each one.
Xform<T>* currentMot = &xform.m_Motion[i];
int freq = currentMot->m_MotionFreq;
intmax_t freq = currentMot->m_MotionFreq;
eMotion func = currentMot->m_MotionFunc;
//Clamp these to the appropriate range after all are applied.
@ -703,7 +702,7 @@ public:
APPMOT(m_ColorSpeed);
APPMOT(m_Animate);
for (j = 0; j < currentMot->TotalVariationCount(); j++)//For each variation in the motion xform.
for (size_t j = 0; j < currentMot->TotalVariationCount(); j++)//For each variation in the motion xform.
{
Variation<T>* motVar = currentMot->GetVariation(j);//Get the variation, which may or may not be present in this xform.
ParametricVariation<T>* motParVar = dynamic_cast<ParametricVariation<T>*>(motVar);
@ -730,7 +729,7 @@ public:
ParamWithName<T>* params = parVar->Params();
ParamWithName<T>* motParams = motParVar->Params();
for (k = 0; k < motParVar->ParamCount(); k++)
for (size_t k = 0; k < motParVar->ParamCount(); k++)
{
if (!motParams[k].IsPrecalc())
*(params[k].Param()) += motParams[k].ParamVal() * Interpolater<T>::MotionFuncs(func, freq * blend);
@ -738,9 +737,9 @@ public:
}
}
for (j = 0; j < 2; j++)
for (glm::length_t j = 0; j < 2; j++)
{
for (k = 0; k < 3; k++)
for (glm::length_t k = 0; k < 3; k++)
{
APPMOT(m_Affine.m_Mat[j][k]);
APPMOT(m_Post.m_Mat[j][k]);
@ -762,17 +761,17 @@ public:
/// The precalc flags are duplicated in each variation. Each value here
/// is true if any of the variations need it precalculated.
/// </summary>
inline bool NeedPrecalcSumSquares() const { return m_NeedPrecalcSumSquares; }
inline bool NeedPrecalcSumSquares() const { return m_NeedPrecalcSumSquares; }
inline bool NeedPrecalcSqrtSumSquares() const { return m_NeedPrecalcSqrtSumSquares; }
inline bool NeedPrecalcAngles() const { return m_NeedPrecalcAngles; }
inline bool NeedPrecalcAtanXY() const { return m_NeedPrecalcAtanXY; }
inline bool NeedPrecalcAtanYX() const { return m_NeedPrecalcAtanYX; }
inline bool NeedPrecalcAngles() const { return m_NeedPrecalcAngles; }
inline bool NeedPrecalcAtanXY() const { return m_NeedPrecalcAtanXY; }
inline bool NeedPrecalcAtanYX() const { return m_NeedPrecalcAtanYX; }
inline bool NeedAnyPrecalc() const { return NeedPrecalcSumSquares() || NeedPrecalcSqrtSumSquares() || NeedPrecalcAngles() || NeedPrecalcAtanXY() || NeedPrecalcAtanYX(); }
bool HasPost() const { return m_HasPost; }
unsigned int PreVariationCount() const { return (unsigned int)m_PreVariations.size(); }
unsigned int VariationCount() const { return (unsigned int)m_Variations.size(); }
unsigned int PostVariationCount() const { return (unsigned int)m_PostVariations.size(); }
unsigned int TotalVariationCount() const { return PreVariationCount() + VariationCount() + PostVariationCount(); }
size_t PreVariationCount() const { return m_PreVariations.size(); }
size_t VariationCount() const { return m_Variations.size(); }
size_t PostVariationCount() const { return m_PostVariations.size(); }
size_t TotalVariationCount() const { return PreVariationCount() + VariationCount() + PostVariationCount(); }
bool Empty() const { return TotalVariationCount() == 0 && m_Affine.IsID(); }//Use this instead of padding like the original did.
T VizAdjusted() const { return m_VizAdjusted; }
T ColorSpeedCache() const { return m_ColorSpeedCache; }
@ -780,7 +779,7 @@ public:
const vector<T>& XaosVec() const { return m_Xaos; }
Ember<T>* ParentEmber() const { return m_ParentEmber; }
void ParentEmber(Ember<T>* ember) { m_ParentEmber = ember; }
int IndexInParentEmber() { return m_ParentEmber ? m_ParentEmber->GetTotalXformIndex(this) : -1; }
intmax_t IndexInParentEmber() { return m_ParentEmber ? m_ParentEmber->GetTotalXformIndex(this) : -1; }
/// <summary>
/// Set the precalc flags based on whether any variation in the vector needs them.
@ -1135,7 +1134,7 @@ public:
const_cast<Xform<T>*>(this)->AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++)
for (size_t i = 0; i < variations.size(); i++)
ss << variations[i]->ToString() << endl;
ss << endl;
@ -1143,7 +1142,7 @@ public:
if (XaosPresent())
{
for (unsigned int i = 0; i < m_Xaos.size(); i++)
for (size_t i = 0; i < m_Xaos.size(); i++)
ss << m_Xaos[i] << " ";
ss << endl;
@ -1207,7 +1206,7 @@ public:
T m_Animate;//Whether or not this xform rotates during animation. 0 means stationary, > 0 means rotate. Use T instead of bool so it can be interpolated.
T m_Wind[2];
eMotion m_MotionFunc;
int m_MotionFreq;
intmax_t m_MotionFreq;
vector<Xform<T>> m_Motion;
string m_Name;

View File

@ -252,11 +252,12 @@ public:
char* bn;
const char* xmlPtr;
const char* loc = __FUNCTION__;
unsigned int emberSize;
size_t emberSize;
size_t bufSize;
xmlDocPtr doc;//Parsed XML document tree.
xmlNodePtr rootnode;
Locale locale;//Sets and restores on exit.
//Timing t;
m_ErrorReport.clear();
//Parse XML string into internal document.
@ -264,6 +265,7 @@ public:
bufSize = strlen(xmlPtr);
embers.reserve(bufSize / 2500);//The Xml text for an ember is around 2500 bytes, but can be much more. Pre-allocate to aovid unnecessary resizing.
doc = xmlReadMemory(xmlPtr, (int)bufSize, filename, nullptr, XML_PARSE_NONET);//Forbid network access during read.
//t.Toc("xmlReadMemory");
if (doc == nullptr)
{
@ -275,10 +277,12 @@ public:
rootnode = xmlDocGetRootElement(doc);
//Scan for <flame> nodes, starting with this node.
//t.Tic();
bn = basename((char*)filename);
ScanForEmberNodes(rootnode, bn, embers);
xmlFreeDoc(doc);
emberSize = (unsigned int)embers.size();
emberSize = embers.size();
//t.Toc("ScanForEmberNodes");
//Check to see if the first control point or the second-to-last
//control point has interpolation="smooth". This is invalid
@ -322,6 +326,7 @@ public:
/// <summary>
/// Parse the specified file and place the results in the vector of embers passed in.
/// This will strip out ampersands because the Xml parser can't handle them.
/// </summary>
/// <param name="filename">Full path and filename</param>
/// <param name="embers">The newly constructed embers based on what was parsed</param>
@ -330,7 +335,7 @@ public:
{
const char* loc = __FUNCTION__;
string buf;
//Ensure palette list is setup first.
if (!m_PaletteList.Init())
{
@ -340,11 +345,7 @@ public:
if (ReadFile(filename, buf))
{
if (buf.find_first_of('&') != std::string::npos)
{
FindAndReplace<string>(buf, "&", "&amp;");
}
std::replace(buf.begin(), buf.end(), '&', '+');
return Parse((unsigned char*)buf.data(), filename, embers);
}
else
@ -459,7 +460,7 @@ public:
/// <param name="i">The unsigned 64-bit integer to convert</param>
/// <param name="radix">The radix of the integer. Default: 10.</param>
/// <returns>The converted string</returns>
static string Itos64(uint64_t i, int radix = 10)
static string Itos64(size_t i, int radix = 10)
{
char ch[64];
@ -517,7 +518,7 @@ private:
// m_ErrorReport.push_back(string(loc) + " : Error interpolating missing palette colors");
currentEmber.CacheXforms();
currentEmber.m_Index = (int)embers.size();
currentEmber.m_Index = embers.size();
currentEmber.m_ParentFilename = parentFileString;
embers.push_back(currentEmber);
}
@ -562,7 +563,7 @@ private:
//First parse out simple float reads.
if (ParseAndAssignFloat(curAtt->name, attStr, "time", currentEmber.m_Time, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "scale", currentEmber.m_PixelsPerUnit, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "scale", currentEmber.m_PixelsPerUnit, ret)) { currentEmber.m_OrigPixPerUnit = currentEmber.m_PixelsPerUnit; }
else if (ParseAndAssignFloat(curAtt->name, attStr, "rotate", currentEmber.m_Rotate, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "zoom", currentEmber.m_Zoom, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "filter", currentEmber.m_SpatialFilterRadius, ret)) { }
@ -1481,7 +1482,7 @@ private:
}
/// <summary>
/// Wrapper to parse an unsigned int Xml value and convert it to unsigned int.
/// Wrapper to parse an int Xml string value and convert it to an int.
/// </summary>
/// <param name="name">The xml tag to parse</param>
/// <param name="attStr">The name of the Xml attribute</param>
@ -1489,21 +1490,8 @@ private:
/// <param name="val">The parsed value</param>
/// <param name="b">Bitwise ANDed with true if name matched str and the call to Atoi() succeeded, else false. Used for keeping a running value between successive calls.</param>
/// <returns>True if the tag was matched, else false</returns>
bool ParseAndAssignInt(const xmlChar* name, const char* attStr, const char* str, unsigned int& val, bool& b)
{
return ParseAndAssignInt(name, attStr, str, (int&)val, b);
}
/// <summary>
/// Wrapper to parse an int Xml value and convert it to int.
/// </summary>
/// <param name="name">The xml tag to parse</param>
/// <param name="attStr">The name of the Xml attribute</param>
/// <param name="str">The name of the Xml tag</param>
/// <param name="val">The parsed value</param>
/// <param name="b">Bitwise ANDed with true if name matched str and the call to Atoi() succeeded, else false. Used for keeping a running value between successive calls.</param>
/// <returns>True if the tag was matched, else false</returns>
bool ParseAndAssignInt(const xmlChar* name, const char* attStr, const char* str, int& val, bool& b)
template <typename intT>
bool ParseAndAssignInt(const xmlChar* name, const char* attStr, const char* str, intT& val, bool& b)
{
bool ret = false;
T fval = 0;
@ -1511,7 +1499,7 @@ private:
if (!Compare(name, str))
{
b &= Atof(attStr, fval);
val = (int)fval;
val = (intT)fval;
ret = true;//Means the strcmp() was right, but doesn't necessarily mean the conversion went ok.
}

View File

@ -297,8 +297,8 @@ bool EmberAnimate(EmberOptions& opt)
}
writeSuccess = false;
comments = renderer->ImageComments(opt.PrintEditDepth(), opt.IntPalette(), opt.HexPalette());
stats = renderer->Stats();
comments = renderer->ImageComments(stats, opt.PrintEditDepth(), opt.IntPalette(), opt.HexPalette());
os.str("");
os << comments.m_NumIters << " / " << renderer->TotalIterCount() << " (" << std::fixed << std::setprecision(2) << ((double)stats.m_Iters/(double)renderer->TotalIterCount() * 100) << "%)";

View File

@ -85,7 +85,7 @@ template <typename T> string DEOpenCLKernelCreator<T>::LogScaleAssignDEEntryPoin
/// <param name="filterWidth">Filter width</param>
/// <returns>The kernel source</returns>
template <typename T>
string DEOpenCLKernelCreator<T>::GaussianDEKernel(unsigned int ss, unsigned int filterWidth)
string DEOpenCLKernelCreator<T>::GaussianDEKernel(size_t ss, unsigned int filterWidth)
{
if ((typeid(T) == typeid(double)) || (filterWidth > MaxDEFilterSize()))//Type double does not use cache.
{
@ -120,7 +120,7 @@ string DEOpenCLKernelCreator<T>::GaussianDEKernel(unsigned int ss, unsigned int
/// <param name="filterWidth">Filter width</param>
/// <returns>The name of the density estimation filtering entry point kernel function</returns>
template <typename T>
string DEOpenCLKernelCreator<T>::GaussianDEEntryPoint(unsigned int ss, unsigned int filterWidth)
string DEOpenCLKernelCreator<T>::GaussianDEEntryPoint(size_t ss, unsigned int filterWidth)
{
if ((typeid(T) == typeid(double)) || (filterWidth > MaxDEFilterSize()))//Type double does not use cache.
{
@ -292,7 +292,7 @@ string DEOpenCLKernelCreator<T>::CreateLogScaleAssignDEKernelString()
/// <param name="ss">The supersample being used</param>
/// <returns>The kernel string</returns>
template <typename T>
string DEOpenCLKernelCreator<T>::CreateGaussianDEKernel(unsigned int ss)
string DEOpenCLKernelCreator<T>::CreateGaussianDEKernel(size_t ss)
{
bool doSS = ss > 1;
bool doScf = !(ss & 1);
@ -552,7 +552,7 @@ string DEOpenCLKernelCreator<T>::CreateGaussianDEKernel(unsigned int ss)
/// <param name="ss">The supersample being used</param>
/// <returns>The kernel string</returns>
template <typename T>
string DEOpenCLKernelCreator<T>::CreateGaussianDEKernelNoLocalCache(unsigned int ss)
string DEOpenCLKernelCreator<T>::CreateGaussianDEKernelNoLocalCache(size_t ss)
{
bool doSS = ss > 1;
bool doScf = !(ss & 1);

View File

@ -39,8 +39,8 @@ public:
string LogScaleSumDEEntryPoint();
string LogScaleAssignDEKernel();
string LogScaleAssignDEEntryPoint();
string GaussianDEKernel(unsigned int ss, unsigned int filterWidth);
string GaussianDEEntryPoint(unsigned int ss, unsigned int filterWidth);
string GaussianDEKernel(size_t ss, unsigned int filterWidth);
string GaussianDEEntryPoint(size_t ss, unsigned int filterWidth);
//Miscellaneous static functions.
static unsigned int MaxDEFilterSize();
@ -51,8 +51,8 @@ private:
//Kernel creators.
string CreateLogScaleSumDEKernelString();
string CreateLogScaleAssignDEKernelString();
string CreateGaussianDEKernel(unsigned int ss);
string CreateGaussianDEKernelNoLocalCache(unsigned int ss);
string CreateGaussianDEKernel(size_t ss);
string CreateGaussianDEKernelNoLocalCache(size_t ss);
string m_LogScaleSumDEKernel;
string m_LogScaleSumDEEntryPoint;

View File

@ -63,7 +63,7 @@ template <typename T> string FinalAccumOpenCLKernelCreator<T>::FinalAccumLateCli
/// <param name="transparency">True if channels equals 4 and using transparency, else false.</param>
/// <returns>The name of the gamma correction entry point kernel function</returns>
template <typename T>
string FinalAccumOpenCLKernelCreator<T>::GammaCorrectionEntryPoint(unsigned int channels, bool transparency)
string FinalAccumOpenCLKernelCreator<T>::GammaCorrectionEntryPoint(size_t channels, bool transparency)
{
bool alphaCalc = ((channels > 3) && transparency);
return alphaCalc ? m_GammaCorrectionWithAlphaCalcEntryPoint : m_GammaCorrectionWithoutAlphaCalcEntryPoint;
@ -76,7 +76,7 @@ string FinalAccumOpenCLKernelCreator<T>::GammaCorrectionEntryPoint(unsigned int
/// <param name="transparency">True if channels equals 4 and using transparency, else false.</param>
/// <returns>The gamma correction kernel string</returns>
template <typename T>
string FinalAccumOpenCLKernelCreator<T>::GammaCorrectionKernel(unsigned int channels, bool transparency)
string FinalAccumOpenCLKernelCreator<T>::GammaCorrectionKernel(size_t channels, bool transparency)
{
bool alphaCalc = ((channels > 3) && transparency);
return alphaCalc ? m_GammaCorrectionWithAlphaCalcKernel : m_GammaCorrectionWithoutAlphaCalcKernel;
@ -92,7 +92,7 @@ string FinalAccumOpenCLKernelCreator<T>::GammaCorrectionKernel(unsigned int chan
/// <param name="alphaScale">Storage for the alpha scale value used in the kernel. 255 if transparency is true, else 0.</param>
/// <returns>The name of the final accumulation entry point kernel function</returns>
template <typename T>
string FinalAccumOpenCLKernelCreator<T>::FinalAccumEntryPoint(bool earlyClip, unsigned int channels, bool transparency, T& alphaBase, T& alphaScale)
string FinalAccumOpenCLKernelCreator<T>::FinalAccumEntryPoint(bool earlyClip, size_t channels, bool transparency, T& alphaBase, T& alphaScale)
{
bool alphaCalc = ((channels > 3) && transparency);
bool alphaAccum = channels > 3;
@ -135,7 +135,7 @@ string FinalAccumOpenCLKernelCreator<T>::FinalAccumEntryPoint(bool earlyClip, un
/// <param name="transparency">True if channels equals 4 and using transparency, else false.</param>
/// <returns>The final accumulation kernel string</returns>
template <typename T>
string FinalAccumOpenCLKernelCreator<T>::FinalAccumKernel(bool earlyClip, unsigned int channels, bool transparency)
string FinalAccumOpenCLKernelCreator<T>::FinalAccumKernel(bool earlyClip, size_t channels, bool transparency)
{
bool alphaCalc = (channels > 3 && transparency);
bool alphaAccum = channels > 3;
@ -172,7 +172,7 @@ string FinalAccumOpenCLKernelCreator<T>::FinalAccumKernel(bool earlyClip, unsign
/// <param name="transparency">True if channels equals 4 and using transparency, else false.</param>
/// <returns>The final accumulation kernel string</returns>
template <typename T>
string FinalAccumOpenCLKernelCreator<T>::CreateFinalAccumKernelString(bool earlyClip, unsigned int channels, bool transparency)
string FinalAccumOpenCLKernelCreator<T>::CreateFinalAccumKernelString(bool earlyClip, size_t channels, bool transparency)
{
return CreateFinalAccumKernelString(earlyClip, (channels > 3 && transparency), channels > 3);
}

View File

@ -46,13 +46,13 @@ public:
string FinalAccumLateClipWithAlphaCalcWithAlphaAccumEntryPoint();
string FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumKernel();
string FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumEntryPoint();
string GammaCorrectionEntryPoint(unsigned int channels, bool transparency);
string GammaCorrectionKernel(unsigned int channels, bool transparency);
string FinalAccumEntryPoint(bool earlyClip, unsigned int channels, bool transparency, T& alphaBase, T& alphaScale);
string FinalAccumKernel(bool earlyClip, unsigned int channels, bool transparency);
string GammaCorrectionEntryPoint(size_t channels, bool transparency);
string GammaCorrectionKernel(size_t channels, bool transparency);
string FinalAccumEntryPoint(bool earlyClip, size_t channels, bool transparency, T& alphaBase, T& alphaScale);
string FinalAccumKernel(bool earlyClip, size_t channels, bool transparency);
private:
string CreateFinalAccumKernelString(bool earlyClip, unsigned int channels, bool transparency);
string CreateFinalAccumKernelString(bool earlyClip, size_t channels, bool transparency);
string CreateGammaCorrectionKernelString(bool alphaCalc);
string CreateFinalAccumKernelString(bool earlyClip, bool alphaCalc, bool alphaAccum);

View File

@ -46,7 +46,7 @@ template <typename T>
string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, string& parVarDefines, bool lockAccum, bool doAccum)
{
bool doublePrecision = typeid(T) == typeid(double);
unsigned int i, v, varIndex, varCount, totalXformCount = ember.TotalXformCount();
size_t i, v, varIndex, varCount, totalXformCount = ember.TotalXformCount();
ostringstream kernelIterBody, xformFuncs, os;
vector<Variation<T>*> variations;
@ -57,7 +57,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
for (i = 0; i < totalXformCount; i++)
{
Xform<T>* xform = ember.GetTotalXform(i);
unsigned int totalVarCount = xform->TotalVariationCount();
size_t totalVarCount = xform->TotalVariationCount();
bool needPrecalcSumSquares = false;
bool needPrecalcSqrtSumSquares = false;
bool needPrecalcAngles = false;
@ -395,7 +395,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
if (ember.UseFinalXform())
{
unsigned int finalIndex = ember.TotalXformCount() - 1;
size_t finalIndex = ember.TotalXformCount() - 1;
//CPU takes an extra step here to preserve the opacity of the randomly selected xform, rather than the final xform's opacity.
//The same thing takes place here automatically because secondPoint.m_LastXfUsed is used below to retrieve the opacity when accumulating.
@ -564,7 +564,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
///
/// The variations the use these #defines by first looking up the index of the
/// xform they belong to in the parent ember and generating the OpenCL string based on that
/// in their overriden OpenCLString() functions.
/// in their overridden OpenCLString() functions.
/// Template argument expected to be float or double.
/// </summary>
/// <param name="ember">The ember to create the values from</param>
@ -574,7 +574,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
template <typename T>
void IterOpenCLKernelCreator<T>::ParVarIndexDefines(Ember<T>& ember, pair<string, vector<T>>& params, bool doVals, bool doString)
{
unsigned int i, j, k, size = 0, xformCount = ember.TotalXformCount();
size_t i, j, k, size = 0, xformCount = ember.TotalXformCount();
Xform<T>* xform;
ostringstream os;
@ -585,7 +585,7 @@ void IterOpenCLKernelCreator<T>::ParVarIndexDefines(Ember<T>& ember, pair<string
{
if (xform = ember.GetTotalXform(i))
{
unsigned int varCount = xform->TotalVariationCount();
size_t varCount = xform->TotalVariationCount();
for (j = 0; j < varCount; j++)
{
@ -632,7 +632,7 @@ void IterOpenCLKernelCreator<T>::ParVarIndexDefines(Ember<T>& ember, pair<string
template <typename T>
bool IterOpenCLKernelCreator<T>::IsBuildRequired(Ember<T>& ember1, Ember<T>& ember2)
{
unsigned int i, j, xformCount = ember1.TotalXformCount();
size_t i, j, xformCount = ember1.TotalXformCount();
if (xformCount != ember2.TotalXformCount())
return true;
@ -653,7 +653,7 @@ bool IterOpenCLKernelCreator<T>::IsBuildRequired(Ember<T>& ember1, Ember<T>& emb
{
Xform<T>* xform1 = ember1.GetTotalXform(i);
Xform<T>* xform2 = ember2.GetTotalXform(i);
unsigned int varCount = xform1->TotalVariationCount();
size_t varCount = xform1->TotalVariationCount();
if (xform1->HasPost() != xform2->HasPost())
return true;
@ -706,7 +706,7 @@ string IterOpenCLKernelCreator<T>::CreateZeroizeKernelString()
template <typename T>
string IterOpenCLKernelCreator<T>::CreateProjectionString(Ember<T>& ember)
{
unsigned int projBits = ember.ProjBits();
size_t projBits = ember.ProjBits();
ostringstream os;
if (projBits)

View File

@ -132,7 +132,7 @@ void OpenCLWrapper::ClearPrograms()
/// <param name="size">The size in bytes of the buffer</param>
/// <param name="flags">The buffer flags. Default: CL_MEM_READ_WRITE.</param>
/// <returns>True if success, else false.</returns>
bool OpenCLWrapper::AddBuffer(string name, size_t size, cl_mem_flags flags)
bool OpenCLWrapper::AddBuffer(const string& name, size_t size, cl_mem_flags flags)
{
cl_int err;
@ -153,16 +153,16 @@ bool OpenCLWrapper::AddBuffer(string name, size_t size, cl_mem_flags flags)
}
else if (GetBufferSize(bufferIndex) != size)//If it did exist, only create and add if the sizes were different.
{
m_Buffers[bufferIndex] = NamedBuffer(cl::Buffer(m_Context, flags, 0, NULL, &err), "emptybuffer");
m_Buffers[bufferIndex] = NamedBuffer(cl::Buffer(m_Context, flags, 0, NULL, &err), "emptybuffer");//First clear out the original so the two don't exist in memory at once.
cl::Buffer buff(m_Context, flags, size, NULL, &err);
cl::Buffer buff(m_Context, flags, size, NULL, &err);//Create the new buffer.
if (!CheckCL(err, "cl::Buffer()"))
return false;
NamedBuffer nb(buff, name);
NamedBuffer nb(buff, name);//Make a named buffer out of the new buffer.
m_Buffers[bufferIndex] = nb;
m_Buffers[bufferIndex] = nb;//Finally, assign.
}
//If the buffer existed and the sizes were the same, take no action.
@ -182,49 +182,14 @@ bool OpenCLWrapper::AddBuffer(string name, size_t size, cl_mem_flags flags)
/// <param name="name">The name of the buffer</param>
/// <param name="data">A pointer to the buffer</param>
/// <param name="size">The size in bytes of the buffer</param>
/// <param name="flags">The buffer flags. Default: CL_MEM_READ_WRITE.</param>
/// <returns>True if success, else false.</returns>
bool OpenCLWrapper::AddAndWriteBuffer(string name, void* data, size_t size)
bool OpenCLWrapper::AddAndWriteBuffer(const string& name, void* data, size_t size, cl_mem_flags flags)
{
cl_int err;
bool b = false;
if (m_Init)
{
int bufferIndex = FindBufferIndex(name);
//Easy case: totally new buffer, so just create and add.
if (bufferIndex == -1)
{
cl::Buffer buff(m_Context, CL_MEM_READ_WRITE, size, NULL, &err);
if (!CheckCL(err, "cl::Buffer()"))
return b;
NamedBuffer nb(buff, name);
m_Buffers.push_back(nb);
b = WriteBuffer((unsigned int)m_Buffers.size() - 1, data, size);
}
else//Harder case: the buffer already exists. Replace or overwrite?
{
if (GetBufferSize(bufferIndex) == size)//Size was equal, so just copy data without creating a new buffer.
{
b = WriteBuffer(bufferIndex, data, size);
}
else//Size was not equal, so create entirely new buffer, replace, and copy data.
{
cl::Buffer buff(m_Context, CL_MEM_READ_WRITE, size, NULL, &err);
if (!CheckCL(err, "cl::Buffer()"))
return b;
NamedBuffer nb(buff, name);
m_Buffers[bufferIndex] = nb;
b = WriteBuffer(bufferIndex, data, size);
}
}
}
if (AddBuffer(name, size, flags))
b = WriteBuffer(name, data, size);
return b;
}
@ -236,7 +201,7 @@ bool OpenCLWrapper::AddAndWriteBuffer(string name, void* data, size_t size)
/// <param name="data">A pointer to the buffer</param>
/// <param name="size">The size in bytes of the buffer</param>
/// <returns>True if success, else false.</returns>
bool OpenCLWrapper::WriteBuffer(string name, void* data, size_t size)
bool OpenCLWrapper::WriteBuffer(const string& name, void* data, size_t size)
{
int bufferIndex = FindBufferIndex(name);
@ -274,7 +239,7 @@ bool OpenCLWrapper::WriteBuffer(unsigned int bufferIndex, void* data, size_t siz
/// <param name="data">A pointer to a buffer to copy the data to</param>
/// <param name="size">The size in bytes of the buffer</param>
/// <returns>True if success, else false.</returns>
bool OpenCLWrapper::ReadBuffer(string name, void* data, size_t size)
bool OpenCLWrapper::ReadBuffer(const string& name, void* data, size_t size)
{
int bufferIndex = FindBufferIndex(name);
@ -310,7 +275,7 @@ bool OpenCLWrapper::ReadBuffer(unsigned int bufferIndex, void* data, size_t size
/// </summary>
/// <param name="name">The name of the buffer to search for</param>
/// <returns>The index if found, else -1.</returns>
int OpenCLWrapper::FindBufferIndex(string name)
int OpenCLWrapper::FindBufferIndex(const string& name)
{
for (unsigned int i = 0; i < m_Buffers.size(); i++)
if (m_Buffers[i].m_Name == name)
@ -324,7 +289,7 @@ int OpenCLWrapper::FindBufferIndex(string name)
/// </summary>
/// <param name="name">The name of the buffer to search for</param>
/// <returns>The size of the buffer if found, else 0.</returns>
unsigned int OpenCLWrapper::GetBufferSize(string name)
unsigned int OpenCLWrapper::GetBufferSize(const string& name)
{
unsigned int bufferIndex = FindBufferIndex(name);
@ -369,7 +334,7 @@ void OpenCLWrapper::ClearBuffers()
/// <param name="shared">True if shared with an OpenGL texture, else false. Default: false.</param>
/// <param name="texName">The texture ID of the shared OpenGL texture if shared. Default: 0.</param>
/// <returns>True if success, else false.</returns>
bool OpenCLWrapper::AddAndWriteImage(string name, cl_mem_flags flags, const cl::ImageFormat& format, ::size_t width, ::size_t height, ::size_t row_pitch, void* data, bool shared, GLuint texName)
bool OpenCLWrapper::AddAndWriteImage(const string& name, cl_mem_flags flags, const cl::ImageFormat& format, ::size_t width, ::size_t height, ::size_t row_pitch, void* data, bool shared, GLuint texName)
{
cl_int err;
@ -432,10 +397,10 @@ bool OpenCLWrapper::AddAndWriteImage(string name, cl_mem_flags flags, const cl::
}
else
{
NamedImage2D namedImage = m_Images[imageIndex];
if (!CompareImageParams(namedImage.m_Image, flags, format, width, height, row_pitch))
if (!CompareImageParams(m_Images[imageIndex].m_Image, flags, format, width, height, row_pitch))
{
m_Images[imageIndex] = NamedImage2D();//First clear out the original so the two don't exist in memory at once.
NamedImage2D namedImage(cl::Image2D(m_Context, flags, format, width, height, row_pitch, data, &err), name);
if (CheckCL(err, "cl::Image2D()"))
@ -517,7 +482,7 @@ bool OpenCLWrapper::WriteImage2D(unsigned int index, bool shared, ::size_t width
/// <param name="shared">True if shared with an OpenGL texture, else false.</param>
/// <param name="data">A pointer to a buffer to copy the data to</param>
/// <returns>True if success, else false.</returns>
bool OpenCLWrapper::ReadImage(string name, ::size_t width, ::size_t height, ::size_t row_pitch, bool shared, void* data)
bool OpenCLWrapper::ReadImage(const string& name, ::size_t width, ::size_t height, ::size_t row_pitch, bool shared, void* data)
{
if (m_Init)
{
@ -583,7 +548,7 @@ bool OpenCLWrapper::ReadImage(unsigned int imageIndex, ::size_t width, ::size_t
/// <param name="name">The name of the image to search for</param>
/// <param name="shared">True if shared with an OpenGL texture, else false.</param>
/// <returns>The index if found, else -1.</returns>
int OpenCLWrapper::FindImageIndex(string name, bool shared)
int OpenCLWrapper::FindImageIndex(const string& name, bool shared)
{
if (shared)
{
@ -607,7 +572,7 @@ int OpenCLWrapper::FindImageIndex(string name, bool shared)
/// <param name="name">The name of the image to search for</param>
/// <param name="shared">True if shared with an OpenGL texture, else false.</param>
/// <returns>The size of the 2D image if found, else 0.</returns>
unsigned int OpenCLWrapper::GetImageSize(string name, bool shared)
unsigned int OpenCLWrapper::GetImageSize(const string& name, bool shared)
{
int imageIndex = FindImageIndex(name, shared);
return GetImageSize(imageIndex, shared);
@ -745,7 +710,7 @@ bool OpenCLWrapper::CreateImage2DGL(IMAGEGL2D& image2DGL, cl_mem_flags flags, GL
/// </summary>
/// <param name="name">The name of the image to acquire</param>
/// <returns>True if success, else false.</returns>
bool OpenCLWrapper::EnqueueAcquireGLObjects(string name)
bool OpenCLWrapper::EnqueueAcquireGLObjects(const string& name)
{
int index = FindImageIndex(name, true);
@ -780,7 +745,7 @@ bool OpenCLWrapper::EnqueueAcquireGLObjects(IMAGEGL2D& image)
/// </summary>
/// <param name="name">The name of the image to release</param>
/// <returns>True if success, else false.</returns>
bool OpenCLWrapper::EnqueueReleaseGLObjects(string name)
bool OpenCLWrapper::EnqueueReleaseGLObjects(const string& name)
{
int index = FindImageIndex(name, true);
@ -953,7 +918,7 @@ bool OpenCLWrapper::SetImageArg(unsigned int kernelIndex, unsigned int argIndex,
/// </summary>
/// <param name="name">The name of the kernel to search for</param>
/// <returns>The index if found, else -1.</returns>
int OpenCLWrapper::FindKernelIndex(string name)
int OpenCLWrapper::FindKernelIndex(const string& name)
{
for (unsigned int i = 0; i < m_Programs.size(); i++)
if (m_Programs[i].m_Name == name)

View File

@ -111,32 +111,32 @@ public:
void ClearPrograms();
//Buffers.
bool AddBuffer(string name, size_t size, cl_mem_flags flags = CL_MEM_READ_WRITE);
bool AddAndWriteBuffer(string name, void* data, size_t size);
bool WriteBuffer(string name, void* data, size_t size);
bool AddBuffer(const string& name, size_t size, cl_mem_flags flags = CL_MEM_READ_WRITE);
bool AddAndWriteBuffer(const string& name, void* data, size_t size, cl_mem_flags flags = CL_MEM_READ_WRITE);
bool WriteBuffer(const string& name, void* data, size_t size);
bool WriteBuffer(unsigned int bufferIndex, void* data, size_t size);
bool ReadBuffer(string name, void* data, size_t size);
bool ReadBuffer(const string& name, void* data, size_t size);
bool ReadBuffer(unsigned int bufferIndex, void* data, size_t size);
int FindBufferIndex(string name);
unsigned int GetBufferSize(string name);
int FindBufferIndex(const string& name);
unsigned int GetBufferSize(const string& name);
unsigned int GetBufferSize(unsigned int bufferIndex);
void ClearBuffers();
//Images.
bool AddAndWriteImage(string name, cl_mem_flags flags, const cl::ImageFormat& format, ::size_t width, ::size_t height, ::size_t row_pitch, void* data = NULL, bool shared = false, GLuint texName = 0);
bool AddAndWriteImage(const string& name, cl_mem_flags flags, const cl::ImageFormat& format, ::size_t width, ::size_t height, ::size_t row_pitch, void* data = NULL, bool shared = false, GLuint texName = 0);
bool WriteImage2D(unsigned int index, bool shared, ::size_t width, ::size_t height, ::size_t row_pitch, void* data);
bool ReadImage(string name, ::size_t width, ::size_t height, ::size_t row_pitch, bool shared, void* data);
bool ReadImage(const string& name, ::size_t width, ::size_t height, ::size_t row_pitch, bool shared, void* data);
bool ReadImage(unsigned int imageIndex, ::size_t width, ::size_t height, ::size_t row_pitch, bool shared, void* data);
int FindImageIndex(string name, bool shared);
unsigned int GetImageSize(string name, bool shared);
int FindImageIndex(const string& name, bool shared);
unsigned int GetImageSize(const string& name, bool shared);
unsigned int GetImageSize(unsigned int imageIndex, bool shared);
bool CompareImageParams(cl::Image& image, cl_mem_flags flags, const cl::ImageFormat& format, ::size_t width, ::size_t height, ::size_t row_pitch);
void ClearImages(bool shared);
bool CreateImage2D(cl::Image2D& image2D, cl_mem_flags flags, cl::ImageFormat format, ::size_t width, ::size_t height, ::size_t row_pitch = 0, void* data = NULL);
bool CreateImage2DGL(IMAGEGL2D& image2DGL, cl_mem_flags flags, GLenum target, GLint miplevel, GLuint texobj);
bool EnqueueAcquireGLObjects(string name);
bool EnqueueAcquireGLObjects(const string& name);
bool EnqueueAcquireGLObjects(IMAGEGL2D& image);
bool EnqueueReleaseGLObjects(string name);
bool EnqueueReleaseGLObjects(const string& name);
bool EnqueueReleaseGLObjects(IMAGEGL2D& image);
bool EnqueueAcquireGLObjects(const VECTOR_CLASS<cl::Memory>* memObjects = NULL);
bool EnqueueReleaseGLObjects(const VECTOR_CLASS<cl::Memory>* memObjects = NULL);
@ -170,7 +170,7 @@ public:
}
//Kernels.
int FindKernelIndex(string name);
int FindKernelIndex(const string& name);
bool RunKernel(unsigned int kernelIndex, unsigned int totalGridWidth, unsigned int totalGridHeight, unsigned int totalGridDepth, unsigned int blockWidth, unsigned int blockHeight, unsigned int blockDepth);
//Info.

View File

@ -63,7 +63,7 @@ RendererCL<T>::~RendererCL()
}
/// <summary>
/// Ordinary member functions for OpenCL specific tasks.
/// Non-virtual member functions for OpenCL specific tasks.
/// </summary>
/// <summary>
@ -82,16 +82,17 @@ template <typename T>
bool RendererCL<T>::Init(unsigned int platform, unsigned int device, bool shared, GLuint outputTexID)
{
//Timing t;
bool b = true;
m_OutputTexID = outputTexID;
const char* loc = __FUNCTION__;
if (!m_Wrapper.Ok() || PlatformIndex() != platform || DeviceIndex() != device)
{
m_Init = false;
m_Wrapper.Init(platform, device, shared);
b = m_Wrapper.Init(platform, device, shared);
}
if (m_Wrapper.Ok() && !m_Init)
if (b && m_Wrapper.Ok() && !m_Init)
{
m_NVidia = ToLower(m_Wrapper.DeviceAndPlatformNames()).find_first_of("nvidia") != string::npos && m_Wrapper.LocalMemSize() > (32 * 1024);
m_WarpSize = m_NVidia ? 32 : 64;
@ -102,11 +103,11 @@ bool RendererCL<T>::Init(unsigned int platform, unsigned int device, bool shared
string logAssignProgram = m_DEOpenCLKernelCreator.LogScaleAssignDEKernel();
string logSumProgram = m_DEOpenCLKernelCreator.LogScaleSumDEKernel();//Build a couple of simple programs to ensure OpenCL is working right.
if (!m_Wrapper.AddProgram(m_IterOpenCLKernelCreator.ZeroizeEntryPoint(), zeroizeProgram, m_IterOpenCLKernelCreator.ZeroizeEntryPoint(), m_DoublePrecision)) { m_ErrorReport.push_back(loc); return false; }
if (!m_Wrapper.AddProgram(m_DEOpenCLKernelCreator.LogScaleAssignDEEntryPoint(), logAssignProgram, m_DEOpenCLKernelCreator.LogScaleAssignDEEntryPoint(), m_DoublePrecision)) { m_ErrorReport.push_back(loc); return false; }
if (!m_Wrapper.AddProgram(m_DEOpenCLKernelCreator.LogScaleSumDEEntryPoint(), logSumProgram, m_DEOpenCLKernelCreator.LogScaleSumDEEntryPoint(), m_DoublePrecision)) { m_ErrorReport.push_back(loc); return false; }
if (b && !(b = m_Wrapper.AddProgram(m_IterOpenCLKernelCreator.ZeroizeEntryPoint(), zeroizeProgram, m_IterOpenCLKernelCreator.ZeroizeEntryPoint(), m_DoublePrecision))) { m_ErrorReport.push_back(loc); }
if (b && !(b = m_Wrapper.AddProgram(m_DEOpenCLKernelCreator.LogScaleAssignDEEntryPoint(), logAssignProgram, m_DEOpenCLKernelCreator.LogScaleAssignDEEntryPoint(), m_DoublePrecision))) { m_ErrorReport.push_back(loc); }
if (b && !(b = m_Wrapper.AddProgram(m_DEOpenCLKernelCreator.LogScaleSumDEEntryPoint(), logSumProgram, m_DEOpenCLKernelCreator.LogScaleSumDEEntryPoint(), m_DoublePrecision))) { m_ErrorReport.push_back(loc); }
if (!m_Wrapper.AddAndWriteImage("Palette", CL_MEM_READ_ONLY, m_PaletteFormat, 256, 1, 0, NULL)) { m_ErrorReport.push_back(loc); return false; }
if (b && !(b = m_Wrapper.AddAndWriteImage("Palette", CL_MEM_READ_ONLY, m_PaletteFormat, 256, 1, 0, NULL))) { m_ErrorReport.push_back(loc); }
//This is the maximum box dimension for density filtering which consists of (blockSize * blockSize) + (2 * filterWidth).
//These blocks must be square, and ideally, 32x32.
@ -119,7 +120,29 @@ bool RendererCL<T>::Init(unsigned int platform, unsigned int device, bool shared
//t.Toc(loc);
}
return m_Init;
return b;
}
template <typename T>
bool RendererCL<T>::SetOutputTexture(GLuint outputTexID)
{
bool success = true;
const char* loc = __FUNCTION__;
if (!m_Wrapper.Ok())
return false;
m_OutputTexID = outputTexID;
EnterResize();
if (!m_Wrapper.AddAndWriteImage(m_FinalImageName, CL_MEM_WRITE_ONLY, m_FinalFormat, FinalRasW(), FinalRasH(), 0, NULL, m_Wrapper.Shared(), m_OutputTexID))
{
m_ErrorReport.push_back(loc);
success = false;
}
LeaveResize();
return success;
}
/// <summary>
@ -182,6 +205,49 @@ bool RendererCL<T>::ReadPoints(vector<PointCL<T>>& vec)
return false;
}
/// <summary>
/// Clear the histogram buffer with all zeroes.
/// </summary>
/// <returns>True if success, else false.</returns>
template <typename T>
bool RendererCL<T>::ClearHist()
{
return ClearBuffer(m_HistBufferName, (unsigned int)SuperRasW(), (unsigned int)SuperRasH(), sizeof(v4T));
}
/// <summary>
/// Clear the desnity filtering buffer with all zeroes.
/// </summary>
/// <returns>True if success, else false.</returns>
template <typename T>
bool RendererCL<T>::ClearAccum()
{
return ClearBuffer(m_AccumBufferName, (unsigned int)SuperRasW(), (unsigned int)SuperRasH(), sizeof(v4T));
}
/// <summary>
/// Write values from a host side CPU buffer into the temporary points buffer.
/// Used for debugging.
/// </summary>
/// <param name="vec">The host side buffer whose values to write</param>
/// <returns>True if success, else false.</returns>
template <typename T>
bool RendererCL<T>::WritePoints(vector<PointCL<T>>& vec)
{
return m_Wrapper.WriteBuffer(m_PointsBufferName, (void*)vec.data(), vec.size() * sizeof(vec[0]));
}
/// <summary>
/// Get the kernel string for the last built iter program.
/// </summary>
/// <returns>The string representation of the kernel for the last built iter program.</returns>
template <typename T>
string RendererCL<T>::IterKernel() { return m_IterKernel; }
/// <summary>
/// Virtual functions overridden from RendererCLBase.
/// </summary>
/// <summary>
/// Read the final image buffer buffer into the host side CPU buffer.
/// This must be called before saving the final output image to file.
@ -214,7 +280,7 @@ bool RendererCL<T>::ClearFinal()
if (!b)
m_ErrorReport.push_back(__FUNCTION__);
return b;
}
else
@ -222,46 +288,7 @@ bool RendererCL<T>::ClearFinal()
}
/// <summary>
/// Clear the histogram buffer with all zeroes.
/// </summary>
/// <returns>True if success, else false.</returns>
template <typename T>
bool RendererCL<T>::ClearHist()
{
return ClearBuffer(m_HistBufferName, SuperRasW(), SuperRasH(), sizeof(v4T));
}
/// <summary>
/// Clear the desnity filtering buffer with all zeroes.
/// </summary>
/// <returns>True if success, else false.</returns>
template <typename T>
bool RendererCL<T>::ClearAccum()
{
return ClearBuffer(m_AccumBufferName, SuperRasW(), SuperRasH(), sizeof(v4T));
}
/// <summary>
/// Write values from a host side CPU buffer into the temporary points buffer.
/// Used for debugging.
/// </summary>
/// <param name="vec">The host side buffer whose values to write</param>
/// <returns>True if success, else false.</returns>
template <typename T>
bool RendererCL<T>::WritePoints(vector<PointCL<T>>& vec)
{
return m_Wrapper.WriteBuffer(m_PointsBufferName, (void*)vec.data(), vec.size() * sizeof(vec[0]));
}
/// <summary>
/// Get the kernel string for the last built iter program.
/// </summary>
/// <returns>The string representation of the kernel for the last built iter program.</returns>
template <typename T>
string RendererCL<T>::IterKernel() { return m_IterKernel; }
/// <summary>
/// Public virtual functions overriden from Renderer.
/// Public virtual functions overridden from Renderer or RendererBase.
/// </summary>
/// <summary>
@ -269,7 +296,7 @@ string RendererCL<T>::IterKernel() { return m_IterKernel; }
/// </summary>
/// <returns>An unsigned 64-bit integer specifying how much video memory is available</returns>
template <typename T>
unsigned __int64 RendererCL<T>::MemoryAvailable()
size_t RendererCL<T>::MemoryAvailable()
{
return Ok() ? m_Wrapper.GetInfo<cl_ulong>(PlatformIndex(), DeviceIndex(), CL_DEVICE_GLOBAL_MEM_SIZE) : 0ULL;
}
@ -290,7 +317,7 @@ bool RendererCL<T>::Ok() const
/// </summary>
/// <param name="numChannels">The number of channels, ignored.</param>
template <typename T>
void RendererCL<T>::NumChannels(unsigned int numChannels)
void RendererCL<T>::NumChannels(size_t numChannels)
{
m_NumChannels = 4;
}
@ -322,7 +349,7 @@ void RendererCL<T>::ClearErrorReport()
/// </summary>
/// <returns>The number of iterations ran in a single kernel call</returns>
template <typename T>
unsigned int RendererCL<T>::SubBatchSize() const
size_t RendererCL<T>::SubBatchSize() const
{
return m_IterBlocksWide * m_IterBlocksHigh * SQR(m_IterCountPerKernel);
}
@ -333,24 +360,11 @@ unsigned int RendererCL<T>::SubBatchSize() const
/// </summary>
/// <returns>1</returns>
template <typename T>
unsigned int RendererCL<T>::ThreadCount() const
size_t RendererCL<T>::ThreadCount() const
{
return 1;
}
/// <summary>
/// Override to always set the thread count to 1 for OpenCL.
/// Specific seeds can't be used for OpenCL. If a repeatable trajectory
/// is needed for debugging, use the base class.
/// </summary>
/// <param name="threads">The number of threads to use, ignored.</param>
/// <param name="seedString">The seed string to use if threads is 1, ignored. Default: NULL.</param>
template <typename T>
void RendererCL<T>::ThreadCount(unsigned int threads, const char* seedString)
{
Renderer<T, T>::ThreadCount(threads, seedString);
}
/// <summary>
/// Create the density filter in the base class and copy the filter values
/// to the corresponding OpenCL buffers.
@ -360,22 +374,25 @@ void RendererCL<T>::ThreadCount(unsigned int threads, const char* seedString)
template <typename T>
bool RendererCL<T>::CreateDEFilter(bool& newAlloc)
{
bool b = true;
if (Renderer<T, T>::CreateDEFilter(newAlloc))
{
//Copy coefs and widths here. Convert and copy the other filter params right before calling the filtering kernel.
if (newAlloc)
{
DensityFilter<T>* filter = GetDensityFilter();
const char* loc = __FUNCTION__;
DensityFilter<T>* filter = dynamic_cast<DensityFilter<T>*>(GetDensityFilter());
if (!m_Wrapper.AddAndWriteBuffer(m_DECoefsBufferName, (void*)filter->Coefs(), filter->CoefsSizeBytes())) { m_ErrorReport.push_back(__FUNCTION__); return false; }
if (!m_Wrapper.AddAndWriteBuffer(m_DEWidthsBufferName, (void*)filter->Widths(), filter->WidthsSizeBytes())) { m_ErrorReport.push_back(__FUNCTION__); return false; }
if (!m_Wrapper.AddAndWriteBuffer(m_DECoefIndicesBufferName, (void*)filter->CoefIndices(), filter->CoefsIndicesSizeBytes())) { m_ErrorReport.push_back(__FUNCTION__); return false; }
if (b && !(b = m_Wrapper.AddAndWriteBuffer(m_DECoefsBufferName, (void*)filter->Coefs(), filter->CoefsSizeBytes()))) { m_ErrorReport.push_back(loc); }
if (b && !(b = m_Wrapper.AddAndWriteBuffer(m_DEWidthsBufferName, (void*)filter->Widths(), filter->WidthsSizeBytes()))) { m_ErrorReport.push_back(loc); }
if (b && !(b = m_Wrapper.AddAndWriteBuffer(m_DECoefIndicesBufferName, (void*)filter->CoefIndices(), filter->CoefsIndicesSizeBytes()))) { m_ErrorReport.push_back(loc); }
}
return true;
}
else
b = false;
return false;
return b;
}
/// <summary>
@ -387,15 +404,18 @@ bool RendererCL<T>::CreateDEFilter(bool& newAlloc)
template <typename T>
bool RendererCL<T>::CreateSpatialFilter(bool& newAlloc)
{
bool b = true;
if (Renderer<T, T>::CreateSpatialFilter(newAlloc))
{
if (newAlloc)
if (!m_Wrapper.AddAndWriteBuffer(m_SpatialFilterCoefsBufferName, (void*)GetSpatialFilter()->Filter(), GetSpatialFilter()->BufferSizeBytes())) { m_ErrorReport.push_back(__FUNCTION__); return false; }
if (b && !(b = m_Wrapper.AddAndWriteBuffer(m_SpatialFilterCoefsBufferName, (void*)GetSpatialFilter()->Filter(), GetSpatialFilter()->BufferSizeBytes()))) { m_ErrorReport.push_back(__FUNCTION__); }
return true;
}
else
b = false;
return false;
return b;
}
/// <summary>
@ -435,7 +455,7 @@ vector<string> RendererCL<T>::ErrorReport()
}
/// <summary>
/// Protected virtual functions overriden from Renderer.
/// Protected virtual functions overridden from Renderer.
/// </summary>
/// <summary>
@ -469,26 +489,21 @@ bool RendererCL<T>::Alloc()
size_t accumLength = SuperSize() * sizeof(v4T);
const char* loc = __FUNCTION__;
if (!m_Wrapper.AddBuffer(m_EmberBufferName, sizeof(m_EmberCL))) { m_ErrorReport.push_back(loc); return false; }
if (!m_Wrapper.AddBuffer(m_ParVarsBufferName, 128 * sizeof(T))) { m_ErrorReport.push_back(loc); return false; }
if (!m_Wrapper.AddBuffer(m_DistBufferName, CHOOSE_XFORM_GRAIN)) { m_ErrorReport.push_back(loc); return false; }//Will be resized for xaos.
if (!m_Wrapper.AddBuffer(m_CarToRasBufferName, sizeof(m_CarToRasCL))) { m_ErrorReport.push_back(loc); return false; }
if (!m_Wrapper.AddBuffer(m_DEFilterParamsBufferName, sizeof(m_DensityFilterCL))) { m_ErrorReport.push_back(loc); return false; }
if (!m_Wrapper.AddBuffer(m_SpatialFilterParamsBufferName, sizeof(m_SpatialFilterCL))) { m_ErrorReport.push_back(loc); return false; }
if (b && !(b = m_Wrapper.AddBuffer(m_EmberBufferName, sizeof(m_EmberCL)))) { m_ErrorReport.push_back(loc); }
if (b && !(b = m_Wrapper.AddBuffer(m_ParVarsBufferName, 128 * sizeof(T)))) { m_ErrorReport.push_back(loc); }
if (b && !(b = m_Wrapper.AddBuffer(m_DistBufferName, CHOOSE_XFORM_GRAIN))) { m_ErrorReport.push_back(loc); }//Will be resized for xaos.
if (b && !(b = m_Wrapper.AddBuffer(m_CarToRasBufferName, sizeof(m_CarToRasCL)))) { m_ErrorReport.push_back(loc); }
if (b && !(b = m_Wrapper.AddBuffer(m_DEFilterParamsBufferName, sizeof(m_DensityFilterCL)))) { m_ErrorReport.push_back(loc); }
if (b && !(b = m_Wrapper.AddBuffer(m_SpatialFilterParamsBufferName, sizeof(m_SpatialFilterCL)))) { m_ErrorReport.push_back(loc); }
if (!m_Wrapper.AddBuffer(m_HistBufferName, histLength)) { m_ErrorReport.push_back(loc); return false; }//Histogram. Will memset to zero later.
if (!m_Wrapper.AddBuffer(m_AccumBufferName, accumLength)) { m_ErrorReport.push_back(loc); return false; }//Accum buffer.
if (!m_Wrapper.AddBuffer(m_PointsBufferName, TotalIterKernelCount() * sizeof(PointCL<T>))) { m_ErrorReport.push_back(loc); return false; }//Points between iter calls.
if (!m_Wrapper.AddAndWriteImage(m_FinalImageName, CL_MEM_WRITE_ONLY, m_FinalFormat, FinalRasW(), FinalRasH(), 0, NULL, m_Wrapper.Shared(), m_OutputTexID))
{
m_ErrorReport.push_back(loc);
LeaveResize();
return false;
}
if (b && !(b = m_Wrapper.AddBuffer(m_HistBufferName, histLength))) { m_ErrorReport.push_back(loc); }//Histogram. Will memset to zero later.
if (b && !(b = m_Wrapper.AddBuffer(m_AccumBufferName, accumLength))) { m_ErrorReport.push_back(loc); }//Accum buffer.
if (b && !(b = m_Wrapper.AddBuffer(m_PointsBufferName, TotalIterKernelCount() * sizeof(PointCL<T>)))) { m_ErrorReport.push_back(loc); }//Points between iter calls.
if (b && !(b = SetOutputTexture(m_OutputTexID))) { m_ErrorReport.push_back(loc); }
LeaveResize();
return true;
return b;
}
/// <summary>
@ -590,7 +605,7 @@ eRenderStatus RendererCL<T>::AccumulatorToFinalImage(unsigned char* pixels, size
/// <param name="temporalSample">The temporal sample within the current pass this is running for</param>
/// <returns>Rendering statistics</returns>
template <typename T>
EmberStats RendererCL<T>::Iterate(unsigned __int64 iterCount, unsigned int pass, unsigned int temporalSample)
EmberStats RendererCL<T>::Iterate(size_t iterCount, size_t pass, size_t temporalSample)
{
bool b = true;
EmberStats stats;//Do not record bad vals with with GPU. If the user needs to investigate bad vals, use the CPU.
@ -685,17 +700,17 @@ bool RendererCL<T>::BuildIterProgramForEmber(bool doAccum)
/// <param name="itersRan">The storage for the number of iterations ran</param>
/// <returns>True if success, else false.</returns>
template <typename T>
bool RendererCL<T>::RunIter(unsigned __int64 iterCount, unsigned int pass, unsigned int temporalSample, unsigned __int64& itersRan)
bool RendererCL<T>::RunIter(size_t iterCount, size_t pass, size_t temporalSample, size_t& itersRan)
{
Timing t;//, t2(4);
bool b = false;
unsigned int fuse, argIndex;
bool b = true;
unsigned int seed, fuse, argIndex;
unsigned int iterCountPerKernel = m_IterCountPerKernel;
unsigned int iterCountPerBlock = iterCountPerKernel * m_IterBlockWidth * m_IterBlockHeight;
unsigned int seed;
unsigned int fuseFreq = m_SubBatchSize / m_IterCountPerKernel;
unsigned __int64 itersRemaining, localIterCount = 0;
unsigned int supersize = (unsigned int)SuperSize();
int kernelIndex = m_Wrapper.FindKernelIndex(m_IterOpenCLKernelCreator.IterEntryPoint());
size_t fuseFreq = m_SubBatchSize / m_IterCountPerKernel;
size_t itersRemaining, localIterCount = 0;
double percent, etaMs;
const char* loc = __FUNCTION__;
@ -706,21 +721,20 @@ bool RendererCL<T>::RunIter(unsigned __int64 iterCount, unsigned int pass, unsig
if (kernelIndex != -1)
{
b = true;
m_EmberCL = ConvertEmber(m_Ember);
m_CarToRasCL = ConvertCarToRas(*CoordMap());
if (!m_Wrapper.WriteBuffer (m_EmberBufferName, (void*)&m_EmberCL, sizeof(m_EmberCL))) { m_ErrorReport.push_back(loc); return false; }
if (!m_Wrapper.AddAndWriteBuffer(m_DistBufferName, (void*)XformDistributions(), XformDistributionsSize())) { m_ErrorReport.push_back(loc); return false; }//Will be resized for xaos.
if (!m_Wrapper.WriteBuffer (m_CarToRasBufferName, (void*)&m_CarToRasCL, sizeof(m_CarToRasCL))) { m_ErrorReport.push_back(loc); return false; }
if (b && !(b = m_Wrapper.WriteBuffer (m_EmberBufferName, (void*)&m_EmberCL, sizeof(m_EmberCL)))) { m_ErrorReport.push_back(loc); }
if (b && !(b = m_Wrapper.AddAndWriteBuffer(m_DistBufferName, (void*)XformDistributions(), XformDistributionsSize()))) { m_ErrorReport.push_back(loc); }//Will be resized for xaos.
if (b && !(b = m_Wrapper.WriteBuffer (m_CarToRasBufferName, (void*)&m_CarToRasCL, sizeof(m_CarToRasCL)))) { m_ErrorReport.push_back(loc); }
if (!m_Wrapper.AddAndWriteImage("Palette", CL_MEM_READ_ONLY, m_PaletteFormat, m_Dmap.m_Entries.size(), 1, 0, m_Dmap.m_Entries.data())) { m_ErrorReport.push_back(loc); return false; }
if (b && !(b = m_Wrapper.AddAndWriteImage("Palette", CL_MEM_READ_ONLY, m_PaletteFormat, m_Dmap.m_Entries.size(), 1, 0, m_Dmap.m_Entries.data()))) { m_ErrorReport.push_back(loc); }
//If animating, treat each temporal sample as a newly started render for fusing purposes.
if (temporalSample > 0)
m_Calls = 0;
while (itersRan < iterCount && !m_Abort)
while (b && itersRan < iterCount && !m_Abort)
{
argIndex = 0;
seed = m_Rand[0].Rand();
@ -744,27 +758,26 @@ bool RendererCL<T>::RunIter(unsigned __int64 iterCount, unsigned int pass, unsig
iterCountThisLaunch = iterCountPerKernel * (gridW * gridH * m_IterBlockWidth * m_IterBlockHeight);
}
if (!m_Wrapper.SetArg (kernelIndex, argIndex++, iterCountPerKernel)) { m_ErrorReport.push_back(loc); return false; }//Number of iters for each thread to run.
if (!m_Wrapper.SetArg (kernelIndex, argIndex++, fuse)) { m_ErrorReport.push_back(loc); return false; }//Number of iters to fuse.
if (!m_Wrapper.SetArg (kernelIndex, argIndex++, seed)) { m_ErrorReport.push_back(loc); return false; }//Seed.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_EmberBufferName)) { m_ErrorReport.push_back(loc); return false; }//Flame.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_ParVarsBufferName)) { m_ErrorReport.push_back(loc); return false; }//Parametric variation parameters.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_DistBufferName)) { m_ErrorReport.push_back(loc); return false; }//Xform distributions.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_CarToRasBufferName)) { m_ErrorReport.push_back(loc); return false; }//Coordinate converter.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_HistBufferName)) { m_ErrorReport.push_back(loc); return false; }//Histogram.
if (!m_Wrapper.SetArg (kernelIndex, argIndex++, SuperSize())) { m_ErrorReport.push_back(loc); return false; }//Histogram size.
if (!m_Wrapper.SetImageArg (kernelIndex, argIndex++, false, "Palette")) { m_ErrorReport.push_back(loc); return false; }//Palette.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_PointsBufferName)) { m_ErrorReport.push_back(loc); return false; }//Random start points.
if (b && !(b = m_Wrapper.SetArg (kernelIndex, argIndex++, iterCountPerKernel))) { m_ErrorReport.push_back(loc); }//Number of iters for each thread to run.
if (b && !(b = m_Wrapper.SetArg (kernelIndex, argIndex++, fuse))) { m_ErrorReport.push_back(loc); }//Number of iters to fuse.
if (b && !(b = m_Wrapper.SetArg (kernelIndex, argIndex++, seed))) { m_ErrorReport.push_back(loc); }//Seed.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_EmberBufferName))) { m_ErrorReport.push_back(loc); }//Flame.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_ParVarsBufferName))) { m_ErrorReport.push_back(loc); }//Parametric variation parameters.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_DistBufferName))) { m_ErrorReport.push_back(loc); }//Xform distributions.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_CarToRasBufferName))) { m_ErrorReport.push_back(loc); }//Coordinate converter.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_HistBufferName))) { m_ErrorReport.push_back(loc); }//Histogram.
if (b && !(b = m_Wrapper.SetArg (kernelIndex, argIndex++, supersize))) { m_ErrorReport.push_back(loc); }//Histogram size.
if (b && !(b = m_Wrapper.SetImageArg (kernelIndex, argIndex++, false, "Palette"))) { m_ErrorReport.push_back(loc); }//Palette.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_PointsBufferName))) { m_ErrorReport.push_back(loc); }//Random start points.
if (!m_Wrapper.RunKernel(kernelIndex,
if (b && !(b = m_Wrapper.RunKernel(kernelIndex,
gridW * IterBlockWidth(),//Total grid dims.
gridH * IterBlockHeight(),
1,
IterBlockWidth(),//Individual block dims.
IterBlockHeight(),
1))
1)))
{
b = false;
m_Abort = true;
m_ErrorReport.push_back(loc);
break;
@ -808,6 +821,7 @@ bool RendererCL<T>::RunIter(unsigned __int64 iterCount, unsigned int pass, unsig
}
else
{
b = false;
m_ErrorReport.push_back(loc);
}
@ -823,6 +837,7 @@ template <typename T>
eRenderStatus RendererCL<T>::RunLogScaleFilter()
{
//Timing t(4);
bool b = true;
int kernelIndex;
const char* loc = __FUNCTION__;
eRenderStatus status = RENDER_OK;
@ -843,23 +858,23 @@ eRenderStatus RendererCL<T>::RunLogScaleFilter()
OpenCLWrapper::MakeEvenGridDims(blockW, blockH, gridW, gridH);
if (!m_Wrapper.AddAndWriteBuffer(m_DEFilterParamsBufferName, (void*)&m_DensityFilterCL, sizeof(m_DensityFilterCL))) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }
if (b && !(b = m_Wrapper.AddAndWriteBuffer(m_DEFilterParamsBufferName, (void*)&m_DensityFilterCL, sizeof(m_DensityFilterCL)))) { m_ErrorReport.push_back(loc); }
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_HistBufferName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//Histogram.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_AccumBufferName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//Accumulator.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_DEFilterParamsBufferName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//DensityFilterCL.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_HistBufferName))) { m_ErrorReport.push_back(loc); }//Histogram.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_AccumBufferName))) { m_ErrorReport.push_back(loc); }//Accumulator.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, m_DEFilterParamsBufferName))) { m_ErrorReport.push_back(loc); }//DensityFilterCL.
//t.Tic();
if (!m_Wrapper.RunKernel(kernelIndex, gridW, gridH, 1, blockW, blockH, 1)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }
if (b && !(b = m_Wrapper.RunKernel(kernelIndex, gridW, gridH, 1, blockW, blockH, 1))) { m_ErrorReport.push_back(loc); }
//t.Toc(loc);
}
else
{
status = RENDER_ERROR;
b = false;
m_ErrorReport.push_back(loc);
}
return status;
return b ? RENDER_OK : RENDER_ERROR;
}
/// <summary>
@ -870,11 +885,11 @@ eRenderStatus RendererCL<T>::RunLogScaleFilter()
template <typename T>
eRenderStatus RendererCL<T>::RunDensityFilter()
{
bool b = true;
Timing t(4);//, t2(4);
m_DensityFilterCL = ConvertDensityFilter();
int kernelIndex = MakeAndGetDensityFilterProgram(Supersample(), m_DensityFilterCL.m_FilterWidth);
const char* loc = __FUNCTION__;
eRenderStatus status = RENDER_OK;
if (kernelIndex != -1)
{
@ -909,17 +924,17 @@ eRenderStatus RendererCL<T>::RunDensityFilter()
double totalChunks = chunkSizeW * chunkSizeH;
if (!m_Wrapper.AddAndWriteBuffer(m_DEFilterParamsBufferName, (void*)&m_DensityFilterCL, sizeof(m_DensityFilterCL))) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }
if (b && !(b = m_Wrapper.AddAndWriteBuffer(m_DEFilterParamsBufferName, (void*)&m_DensityFilterCL, sizeof(m_DensityFilterCL)))) { m_ErrorReport.push_back(loc); }
for (unsigned int row = 0; row < chunkSizeH; row++)
for (unsigned int row = 0; b && !m_Abort && row < chunkSizeH; row++)
{
for (unsigned int col = 0; col < chunkSizeW; col++)
for (unsigned int col = 0; b && !m_Abort && col < chunkSizeW; col++)
{
//t2.Tic();
if (!RunDensityFilterPrivate(kernelIndex, gridW, gridH, blockSizeW, blockSizeH, chunkSizeW, chunkSizeH, row, col)) { m_Abort = true; m_ErrorReport.push_back(loc); return RENDER_ERROR; }
if (b && !(b = RunDensityFilterPrivate(kernelIndex, gridW, gridH, blockSizeW, blockSizeH, chunkSizeW, chunkSizeH, row, col))) { m_Abort = true; m_ErrorReport.push_back(loc); }
//t2.Toc(loc);
if (m_Callback)
if (b && m_Callback)
{
double percent = (double((row * chunkSizeW) + (col + 1)) / totalChunks) * 100.0;
double etaMs = ((100.0 - percent) / percent) * t.Toc();
@ -927,24 +942,21 @@ eRenderStatus RendererCL<T>::RunDensityFilter()
if (!m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, percent, 1, etaMs))
Abort();
}
if (m_Abort)
return RENDER_ABORT;
}
}
if (m_Callback)
if (b && m_Callback)
m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, 100.0, 1, 0.0);
//t2.Toc(__FUNCTION__ " all passes");
}
else
{
status = RENDER_ERROR;
b = false;
m_ErrorReport.push_back(loc);
}
return status;
return m_Abort ? RENDER_ABORT : (b ? RENDER_OK : RENDER_ERROR);
}
/// <summary>
@ -955,6 +967,7 @@ template <typename T>
eRenderStatus RendererCL<T>::RunFinalAccum()
{
//Timing t(4);
bool b = true;
T alphaBase;
T alphaScale;
int accumKernelIndex = MakeAndGetFinalAccumProgram(alphaBase, alphaScale);
@ -964,19 +977,18 @@ eRenderStatus RendererCL<T>::RunFinalAccum()
unsigned int blockW;
unsigned int blockH;
const char* loc = __FUNCTION__;
eRenderStatus status = RENDER_OK;
if (!m_Abort && accumKernelIndex != -1)
{
//This is needed with or without early clip.
m_SpatialFilterCL = ConvertSpatialFilter();
if (!m_Wrapper.AddAndWriteBuffer(m_SpatialFilterParamsBufferName, (void*)&m_SpatialFilterCL, sizeof(m_SpatialFilterCL))) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }
if (b && !(b = m_Wrapper.AddAndWriteBuffer(m_SpatialFilterParamsBufferName, (void*)&m_SpatialFilterCL, sizeof(m_SpatialFilterCL)))) { m_ErrorReport.push_back(loc); }
//Since early clip requires gamma correcting the entire accumulator first,
//it can't be done inside of the normal final accumulation kernel, so
//an additional kernel must be launched first.
if (EarlyClip())
if (b && EarlyClip())
{
int gammaCorrectKernelIndex = MakeAndGetGammaCorrectionProgram();
@ -989,15 +1001,15 @@ eRenderStatus RendererCL<T>::RunFinalAccum()
gridH = m_SpatialFilterCL.m_SuperRasH;
OpenCLWrapper::MakeEvenGridDims(blockW, blockH, gridW, gridH);
if (!m_Wrapper.SetBufferArg(gammaCorrectKernelIndex, argIndex++, m_AccumBufferName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//Accumulator.
if (!m_Wrapper.SetBufferArg(gammaCorrectKernelIndex, argIndex++, m_SpatialFilterParamsBufferName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//SpatialFilterCL.
if (b && !(b = m_Wrapper.SetBufferArg(gammaCorrectKernelIndex, argIndex++, m_AccumBufferName))) { m_ErrorReport.push_back(loc); }//Accumulator.
if (b && !(b = m_Wrapper.SetBufferArg(gammaCorrectKernelIndex, argIndex++, m_SpatialFilterParamsBufferName))) { m_ErrorReport.push_back(loc); }//SpatialFilterCL.
if (!m_Wrapper.RunKernel(gammaCorrectKernelIndex, gridW, gridH, 1, blockW, blockH, 1)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }
if (b && !(b = m_Wrapper.RunKernel(gammaCorrectKernelIndex, gridW, gridH, 1, blockW, blockH, 1))) { m_ErrorReport.push_back(loc); }
}
else
{
b = false;
m_ErrorReport.push_back(loc);
return RENDER_ERROR;
}
}
@ -1008,30 +1020,30 @@ eRenderStatus RendererCL<T>::RunFinalAccum()
gridH = m_SpatialFilterCL.m_FinalRasH;
OpenCLWrapper::MakeEvenGridDims(blockW, blockH, gridW, gridH);
if (!m_Wrapper.SetBufferArg(accumKernelIndex, argIndex++, m_AccumBufferName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//Accumulator.
if (!m_Wrapper.SetImageArg(accumKernelIndex, argIndex++, m_Wrapper.Shared(), m_FinalImageName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//Final image.
if (!m_Wrapper.SetBufferArg(accumKernelIndex, argIndex++, m_SpatialFilterParamsBufferName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//SpatialFilterCL.
if (!m_Wrapper.SetBufferArg(accumKernelIndex, argIndex++, m_SpatialFilterCoefsBufferName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//Filter coefs.
if (!m_Wrapper.SetArg (accumKernelIndex, argIndex++, alphaBase)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//Alpha base.
if (!m_Wrapper.SetArg (accumKernelIndex, argIndex++, alphaScale)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }//Alpha scale.
if (b && !(b = m_Wrapper.SetBufferArg(accumKernelIndex, argIndex++, m_AccumBufferName))) { m_ErrorReport.push_back(loc); }//Accumulator.
if (b && !(b = m_Wrapper.SetImageArg (accumKernelIndex, argIndex++, m_Wrapper.Shared(), m_FinalImageName))) { m_ErrorReport.push_back(loc); }//Final image.
if (b && !(b = m_Wrapper.SetBufferArg(accumKernelIndex, argIndex++, m_SpatialFilterParamsBufferName))) { m_ErrorReport.push_back(loc); }//SpatialFilterCL.
if (b && !(b = m_Wrapper.SetBufferArg(accumKernelIndex, argIndex++, m_SpatialFilterCoefsBufferName))) { m_ErrorReport.push_back(loc); }//Filter coefs.
if (b && !(b = m_Wrapper.SetArg (accumKernelIndex, argIndex++, alphaBase))) { m_ErrorReport.push_back(loc); }//Alpha base.
if (b && !(b = m_Wrapper.SetArg (accumKernelIndex, argIndex++, alphaScale))) { m_ErrorReport.push_back(loc); }//Alpha scale.
if (m_Wrapper.Shared())
if (!m_Wrapper.EnqueueAcquireGLObjects(m_FinalImageName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }
if (b && m_Wrapper.Shared())
if (b && !(b = m_Wrapper.EnqueueAcquireGLObjects(m_FinalImageName))) { m_ErrorReport.push_back(loc); }
if (!m_Wrapper.RunKernel(accumKernelIndex, gridW, gridH, 1, blockW, blockH, 1)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }
if (b && !(b = m_Wrapper.RunKernel(accumKernelIndex, gridW, gridH, 1, blockW, blockH, 1))) { m_ErrorReport.push_back(loc); }
if (m_Wrapper.Shared())
if (!m_Wrapper.EnqueueReleaseGLObjects(m_FinalImageName)) { m_ErrorReport.push_back(loc); return RENDER_ERROR; }
if (b && m_Wrapper.Shared())
if (b && !(b = m_Wrapper.EnqueueReleaseGLObjects(m_FinalImageName))) { m_ErrorReport.push_back(loc); }
//t.Toc((char*)loc);
}
else
{
status = RENDER_ERROR;
b = false;
m_ErrorReport.push_back(loc);
}
return status;
return b ? RENDER_OK : RENDER_ERROR;
}
/// <summary>
@ -1043,8 +1055,9 @@ eRenderStatus RendererCL<T>::RunFinalAccum()
/// <param name="elementSize">Size of each element</param>
/// <returns>True if success, else false.</returns>
template <typename T>
bool RendererCL<T>::ClearBuffer(string bufferName, unsigned int width, unsigned int height, unsigned int elementSize)
bool RendererCL<T>::ClearBuffer(const string& bufferName, unsigned int width, unsigned int height, unsigned int elementSize)
{
bool b = true;
int kernelIndex = m_Wrapper.FindKernelIndex(m_IterOpenCLKernelCreator.ZeroizeEntryPoint());
unsigned int argIndex = 0;
const char* loc = __FUNCTION__;
@ -1058,17 +1071,18 @@ bool RendererCL<T>::ClearBuffer(string bufferName, unsigned int width, unsigned
OpenCLWrapper::MakeEvenGridDims(blockW, blockH, gridW, gridH);
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex++, bufferName)) { m_ErrorReport.push_back(loc); return false; }//Buffer of unsigned char.
if (!m_Wrapper.SetArg (kernelIndex, argIndex++, width * elementSize)) { m_ErrorReport.push_back(loc); return false; }//Width.
if (!m_Wrapper.SetArg (kernelIndex, argIndex++, height)) { m_ErrorReport.push_back(loc); return false; }//Height.
if (!m_Wrapper.RunKernel(kernelIndex, gridW, gridH, 1, blockW, blockH, 1)) { m_ErrorReport.push_back(loc); return false; }
return true;
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex++, bufferName))) { m_ErrorReport.push_back(loc); }//Buffer of unsigned char.
if (b && !(b = m_Wrapper.SetArg (kernelIndex, argIndex++, width * elementSize))) { m_ErrorReport.push_back(loc); }//Width.
if (b && !(b = m_Wrapper.SetArg (kernelIndex, argIndex++, height))) { m_ErrorReport.push_back(loc); }//Height.
if (b && !(b = m_Wrapper.RunKernel(kernelIndex, gridW, gridH, 1, blockW, blockH, 1))) { m_ErrorReport.push_back(loc); }
}
else
{
b = false;
m_ErrorReport.push_back(loc);
}
return false;
return b;
}
/// <summary>
@ -1092,23 +1106,23 @@ bool RendererCL<T>::RunDensityFilterPrivate(unsigned int kernelIndex, unsigned i
unsigned int argIndex = 0;
const char* loc = __FUNCTION__;
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_HistBufferName)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//Histogram.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_AccumBufferName)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//Accumulator.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_DEFilterParamsBufferName)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//FlameDensityFilterCL.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_DECoefsBufferName)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//Coefs.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_DEWidthsBufferName)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//Widths.
if (!m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_DECoefIndicesBufferName)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//Coef indices.
if (!m_Wrapper.SetArg( kernelIndex, argIndex, chunkSizeW)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//Chunk size width (gapW + 1).
if (!m_Wrapper.SetArg( kernelIndex, argIndex, chunkSizeH)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//Chunk size height (gapH + 1).
if (!m_Wrapper.SetArg( kernelIndex, argIndex, rowParity)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//Row parity.
if (!m_Wrapper.SetArg( kernelIndex, argIndex, colParity)) { m_ErrorReport.push_back(loc); return false; } argIndex++;//Col parity.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_HistBufferName))) { m_ErrorReport.push_back(loc); } argIndex++;//Histogram.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_AccumBufferName))) { m_ErrorReport.push_back(loc); } argIndex++;//Accumulator.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_DEFilterParamsBufferName))) { m_ErrorReport.push_back(loc); } argIndex++;//FlameDensityFilterCL.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_DECoefsBufferName))) { m_ErrorReport.push_back(loc); } argIndex++;//Coefs.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_DEWidthsBufferName))) { m_ErrorReport.push_back(loc); } argIndex++;//Widths.
if (b && !(b = m_Wrapper.SetBufferArg(kernelIndex, argIndex, m_DECoefIndicesBufferName))) { m_ErrorReport.push_back(loc); } argIndex++;//Coef indices.
if (b && !(b = m_Wrapper.SetArg( kernelIndex, argIndex, chunkSizeW))) { m_ErrorReport.push_back(loc); } argIndex++;//Chunk size width (gapW + 1).
if (b && !(b = m_Wrapper.SetArg( kernelIndex, argIndex, chunkSizeH))) { m_ErrorReport.push_back(loc); } argIndex++;//Chunk size height (gapH + 1).
if (b && !(b = m_Wrapper.SetArg( kernelIndex, argIndex, rowParity))) { m_ErrorReport.push_back(loc); } argIndex++;//Row parity.
if (b && !(b = m_Wrapper.SetArg( kernelIndex, argIndex, colParity))) { m_ErrorReport.push_back(loc); } argIndex++;//Col parity.
//t.Toc(__FUNCTION__ " set args");
//t.Tic();
if (!m_Wrapper.RunKernel(kernelIndex, gridW, gridH, 1, blockW, blockH, 1)) { m_ErrorReport.push_back(loc); return false; }//Method 7, accumulating to temp box area.
if (b && !(b = m_Wrapper.RunKernel(kernelIndex, gridW, gridH, 1, blockW, blockH, 1))) { m_ErrorReport.push_back(loc); }//Method 7, accumulating to temp box area.
//t.Toc(__FUNCTION__ " RunKernel()");
return true;
return b;
}
/// <summary>
@ -1118,7 +1132,7 @@ bool RendererCL<T>::RunDensityFilterPrivate(unsigned int kernelIndex, unsigned i
/// <param name="filterWidth">Width of the gaussian filter</param>
/// <returns>The kernel index if successful, else -1.</returns>
template <typename T>
int RendererCL<T>::MakeAndGetDensityFilterProgram(unsigned int ss, unsigned int filterWidth)
int RendererCL<T>::MakeAndGetDensityFilterProgram(size_t ss, unsigned int filterWidth)
{
string deEntryPoint = m_DEOpenCLKernelCreator.GaussianDEEntryPoint(ss, filterWidth);
int kernelIndex = m_Wrapper.FindKernelIndex(deEntryPoint);
@ -1210,21 +1224,21 @@ template <typename T>
DensityFilterCL<T> RendererCL<T>::ConvertDensityFilter()
{
DensityFilterCL<T> filterCL;
DensityFilter<T>* densityFilter = GetDensityFilter();
DensityFilter<T>* densityFilter = dynamic_cast<DensityFilter<T>*>(GetDensityFilter());
filterCL.m_Supersample = Supersample();
filterCL.m_SuperRasW = SuperRasW();
filterCL.m_SuperRasH = SuperRasH();
filterCL.m_Supersample = (unsigned int)Supersample();
filterCL.m_SuperRasW = (unsigned int)SuperRasW();
filterCL.m_SuperRasH = (unsigned int)SuperRasH();
filterCL.m_K1 = K1();
filterCL.m_K2 = K2();
if (densityFilter)
{
filterCL.m_Curve = densityFilter->Curve();
filterCL.m_KernelSize = densityFilter->KernelSize();
filterCL.m_MaxFilterIndex = densityFilter->MaxFilterIndex();
filterCL.m_MaxFilteredCounts = densityFilter->MaxFilteredCounts();
filterCL.m_FilterWidth = densityFilter->FilterWidth();
filterCL.m_KernelSize = (unsigned int)densityFilter->KernelSize();
filterCL.m_MaxFilterIndex = (unsigned int)densityFilter->MaxFilterIndex();
filterCL.m_MaxFilteredCounts = (unsigned int)densityFilter->MaxFilteredCounts();
filterCL.m_FilterWidth = (unsigned int)densityFilter->FilterWidth();
}
return filterCL;
@ -1244,15 +1258,15 @@ SpatialFilterCL<T> RendererCL<T>::ConvertSpatialFilter()
PrepFinalAccumVals(background, g, linRange, vibrancy);
filterCL.m_SuperRasW = SuperRasW();
filterCL.m_SuperRasH = SuperRasH();
filterCL.m_FinalRasW = FinalRasW();
filterCL.m_FinalRasH = FinalRasH();
filterCL.m_Supersample = Supersample();
filterCL.m_FilterWidth = GetSpatialFilter()->FinalFilterWidth();
filterCL.m_NumChannels = Renderer<T, T>::NumChannels();
filterCL.m_BytesPerChannel = BytesPerChannel();
filterCL.m_DensityFilterOffset = DensityFilterOffset();
filterCL.m_SuperRasW = (unsigned int)SuperRasW();
filterCL.m_SuperRasH = (unsigned int)SuperRasH();
filterCL.m_FinalRasW = (unsigned int)FinalRasW();
filterCL.m_FinalRasH = (unsigned int)FinalRasH();
filterCL.m_Supersample = (unsigned int)Supersample();
filterCL.m_FilterWidth = (unsigned int)GetSpatialFilter()->FinalFilterWidth();
filterCL.m_NumChannels = (unsigned int)Renderer<T, T>::NumChannels();
filterCL.m_BytesPerChannel = (unsigned int)BytesPerChannel();
filterCL.m_DensityFilterOffset = (unsigned int)DensityFilterOffset();
filterCL.m_Transparency = Transparency();
filterCL.m_YAxisUp = (unsigned int)m_YAxisUp;
filterCL.m_Vibrancy = vibrancy;
@ -1333,7 +1347,7 @@ CarToRasCL<T> RendererCL<T>::ConvertCarToRas(const CarToRas<T>& carToRas)
{
CarToRasCL<T> carToRasCL;
carToRasCL.m_RasWidth = carToRas.RasWidth();
carToRasCL.m_RasWidth = (unsigned int)carToRas.RasWidth();
carToRasCL.m_PixPerImageUnitW = carToRas.PixPerImageUnitW();
carToRasCL.m_RasLlX = carToRas.RasLlX();
carToRasCL.m_PixPerImageUnitH = carToRas.PixPerImageUnitH();

View File

@ -15,8 +15,8 @@ namespace EmberCLns
class EMBERCL_API RendererCLBase
{
public:
virtual bool ReadFinal(unsigned char* pixels) { return false; }
virtual bool ClearFinal() { return false; }
virtual bool ReadFinal(unsigned char* pixels) = 0;
virtual bool ClearFinal() = 0;
};
/// <summary>
@ -36,8 +36,9 @@ public:
RendererCL(unsigned int platform = 0, unsigned int device = 0, bool shared = false, GLuint outputTexID = 0);
~RendererCL();
//Ordinary member functions for OpenCL specific tasks.
//Non-virtual member functions for OpenCL specific tasks.
bool Init(unsigned int platform, unsigned int device, bool shared, GLuint outputTexID);
bool SetOutputTexture(GLuint outputTexID);
inline unsigned int IterCountPerKernel();
inline unsigned int IterBlocksWide();
inline unsigned int IterBlocksHigh();
@ -51,50 +52,51 @@ public:
bool ReadHist();
bool ReadAccum();
bool ReadPoints(vector<PointCL<T>>& vec);
virtual bool ReadFinal(unsigned char* pixels);
virtual bool ClearFinal();
bool ClearHist();
bool ClearAccum();
bool WritePoints(vector<PointCL<T>>& vec);
string IterKernel();
//Public virtual functions overriden from Renderer.
virtual unsigned __int64 MemoryAvailable();
virtual bool Ok() const;
virtual void NumChannels(unsigned int numChannels);
virtual void DumpErrorReport();
virtual void ClearErrorReport();
virtual unsigned int SubBatchSize() const;
virtual unsigned int ThreadCount() const;
virtual void ThreadCount(unsigned int threads, const char* seedString = NULL);
virtual bool CreateDEFilter(bool& newAlloc);
virtual bool CreateSpatialFilter(bool& newAlloc);
virtual eRendererType RendererType() const;
virtual string ErrorReportString();
virtual vector<string> ErrorReport();
//Virtual functions overridden from RendererCLBase.
virtual bool ReadFinal(unsigned char* pixels);
virtual bool ClearFinal();
//Public virtual functions overridden from Renderer or RendererBase.
virtual size_t MemoryAvailable() override;
virtual bool Ok() const override;
virtual void NumChannels(size_t numChannels) override;
virtual void DumpErrorReport() override;
virtual void ClearErrorReport() override;
virtual size_t SubBatchSize() const override;
virtual size_t ThreadCount() const override;
virtual bool CreateDEFilter(bool& newAlloc) override;
virtual bool CreateSpatialFilter(bool& newAlloc) override;
virtual eRendererType RendererType() const override;
virtual string ErrorReportString() override;
virtual vector<string> ErrorReport() override;
#ifndef TEST_CL
protected:
#endif
//Protected virtual functions overriden from Renderer.
virtual void MakeDmap(T colorScalar);
virtual bool Alloc();
virtual bool ResetBuckets(bool resetHist = true, bool resetAccum = true);
virtual eRenderStatus LogScaleDensityFilter();
virtual eRenderStatus GaussianDensityFilter();
virtual eRenderStatus AccumulatorToFinalImage(unsigned char* pixels, size_t finalOffset);
virtual EmberStats Iterate(unsigned __int64 iterCount, unsigned int pass, unsigned int temporalSample);
//Protected virtual functions overridden from Renderer.
virtual void MakeDmap(T colorScalar) override;
virtual bool Alloc() override;
virtual bool ResetBuckets(bool resetHist = true, bool resetAccum = true) override;
virtual eRenderStatus LogScaleDensityFilter() override;
virtual eRenderStatus GaussianDensityFilter() override;
virtual eRenderStatus AccumulatorToFinalImage(unsigned char* pixels, size_t finalOffset) override;
virtual EmberStats Iterate(size_t iterCount, size_t pass, size_t temporalSample) override;
private:
//Private functions for making and running OpenCL programs.
bool BuildIterProgramForEmber(bool doAccum = true);
bool RunIter(unsigned __int64 iterCount, unsigned int pass, unsigned int temporalSample, unsigned __int64& itersRan);
bool RunIter(size_t iterCount, size_t pass, size_t temporalSample, size_t& itersRan);
eRenderStatus RunLogScaleFilter();
eRenderStatus RunDensityFilter();
eRenderStatus RunFinalAccum();
bool ClearBuffer(string bufferName, unsigned int width, unsigned int height, unsigned int elementSize);
bool ClearBuffer(const string& bufferName, unsigned int width, unsigned int height, unsigned int elementSize);
bool RunDensityFilterPrivate(unsigned int kernelIndex, unsigned int gridW, unsigned int gridH, unsigned int blockW, unsigned int blockH, unsigned int chunkSizeW, unsigned int chunkSizeH, unsigned int rowParity, unsigned int colParity);
int MakeAndGetDensityFilterProgram(unsigned int ss, unsigned int filterWidth);
int MakeAndGetDensityFilterProgram(size_t ss, unsigned int filterWidth);
int MakeAndGetFinalAccumProgram(T& alphaBase, T& alphaScale);
int MakeAndGetGammaCorrectionProgram();
@ -113,8 +115,9 @@ private:
unsigned int m_MaxDEBlockSizeW;
unsigned int m_MaxDEBlockSizeH;
unsigned int m_WarpSize;
unsigned int m_Calls;
size_t m_Calls;
//Buffer names.
string m_EmberBufferName;
string m_ParVarsBufferName;
string m_DistBufferName;
@ -130,6 +133,7 @@ private:
string m_FinalImageName;
string m_PointsBufferName;
//Kernels.
string m_IterKernel;
OpenCLWrapper m_Wrapper;

View File

@ -108,7 +108,7 @@ static bool ParseEmberFile(XmlToEmber<T>& parser, string filename, vector<Ember<
/// <param name="filename">The full path and name of the file</param>
/// <returns>True if success, else false.</returns>
template <typename T>
static bool InitPaletteList(string filename)
static bool InitPaletteList(const string& filename)
{
PaletteList<T> paletteList;//Even though this is local, the members are static so they will remain.
@ -129,7 +129,7 @@ static bool InitPaletteList(string filename)
/// <param name="rgb">The RGB buffer</param>
/// <param name="width">The width of the image in pixels</param>
/// <param name="height">The height of the image in pixels</param>
static void RgbaToRgb(vector<unsigned char>& rgba, vector<unsigned char>& rgb, unsigned int width, unsigned int height)
static void RgbaToRgb(vector<unsigned char>& rgba, vector<unsigned char>& rgb, size_t width, size_t height)
{
rgb.resize(width * height * 3);
@ -143,23 +143,21 @@ static void RgbaToRgb(vector<unsigned char>& rgba, vector<unsigned char>& rgb, u
/// <summary>
/// Calculate the number of strips required if the needed amount of memory
/// is greater than the system memory, or greater than what the user want to allow.
/// is greater than the system memory, or greater than what the user wants to allow.
/// </summary>
/// <param name="mem">Amount of memory required</param>
/// <param name="memAvailable">Amount of memory available on the system</param>
/// <param name="useMem">The maximum amount of memory to use. Use max if 0.</param>
/// <returns>The number of strips to use</returns>
static unsigned int CalcStrips(double mem, double memAvailable, double useMem)
static unsigned int CalcStrips(double memRequired, double memAvailable, double useMem)
{
unsigned int strips;
double memRequired;
if (useMem > 0)
memAvailable = useMem;
else
memAvailable *= 0.8;
memRequired = mem;
if (memAvailable >= memRequired)
return 1;
@ -175,10 +173,11 @@ static unsigned int CalcStrips(double mem, double memAvailable, double useMem)
/// <param name="numerator">The numerator</param>
/// <param name="denominator">The denominator</param>
/// <returns>The next highest divisor if found, else 1.</returns>
static unsigned int NextHighestEvenDiv(unsigned int numerator, unsigned int denominator)
template <typename T>
static T NextHighestEvenDiv(T numerator, T denominator)
{
unsigned int result = 1;
unsigned int numDiv2 = numerator / 2;
T result = 1;
T numDiv2 = numerator / 2;
do
{
@ -202,10 +201,11 @@ static unsigned int NextHighestEvenDiv(unsigned int numerator, unsigned int deno
/// <param name="numerator">The numerator</param>
/// <param name="denominator">The denominator</param>
/// <returns>The next lowest divisor if found, else 1.</returns>
static unsigned int NextLowestEvenDiv(unsigned int numerator, unsigned int denominator)
template <typename T>
static T NextLowestEvenDiv(T numerator, T denominator)
{
unsigned int result = 1;
unsigned int numDiv2 = numerator / 2;
T result = 1;
T numDiv2 = numerator / 2;
denominator--;
@ -242,19 +242,19 @@ template <typename T, typename bucketT>
static Renderer<T, bucketT>* CreateRenderer(eRendererType renderType, unsigned int platform, unsigned int device, bool shared, GLuint texId, EmberReport& errorReport)
{
string s;
auto_ptr<Renderer<T, bucketT>> renderer;
unique_ptr<Renderer<T, bucketT>> renderer;
try
{
if (renderType == CPU_RENDERER)
{
s = "CPU";
renderer = auto_ptr<Renderer<T, bucketT>>(new Renderer<T, bucketT>());
renderer = unique_ptr<Renderer<T, bucketT>>(new Renderer<T, bucketT>());
}
else if (renderType == OPENCL_RENDERER)
{
s = "OpenCL";
renderer = auto_ptr<Renderer<T, bucketT>>(new RendererCL<T>(platform, device, shared, texId));
renderer = unique_ptr<Renderer<T, bucketT>>(new RendererCL<T>(platform, device, shared, texId));
if (!renderer.get() || !renderer->Ok())
{
@ -262,7 +262,7 @@ static Renderer<T, bucketT>* CreateRenderer(eRendererType renderType, unsigned i
errorReport.AddToReport(renderer->ErrorReport());
errorReport.AddToReport("Error initializing OpenCL renderer, using CPU renderer instead.");
renderer = auto_ptr<Renderer<T, bucketT>>(new Renderer<T, bucketT>());
renderer = unique_ptr<Renderer<T, bucketT>>(new Renderer<T, bucketT>());
}
}
}
@ -274,6 +274,116 @@ static Renderer<T, bucketT>* CreateRenderer(eRendererType renderType, unsigned i
return renderer.release();
}
template <typename T>
static bool StripsRender(RendererBase* renderer, Ember<T>& ember, vector<unsigned char>& finalImage, double time, size_t strips, bool yAxisUp,
std::function<void(size_t strip)> perStripStart,
std::function<void(size_t strip)> perStripFinish,
std::function<void(size_t strip)> perStripError,
std::function<void(Ember<T>& finalEmber)> allStripsFinished)
{
bool success = true;
size_t origHeight, realHeight = ember.m_FinalRasH;
T centerY = ember.m_CenterY;
T floatStripH = T(ember.m_FinalRasH) / T(strips);
T zoomScale = pow(T(2), ember.m_Zoom);
T centerBase = centerY - ((strips - 1) * floatStripH) / (2 * ember.m_PixelsPerUnit * zoomScale);
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> randVec;
ember.m_Quality *= strips;
ember.m_FinalRasH = (size_t)ceil(floatStripH);
if (strips > 1)
randVec = renderer->RandVec();
for (size_t strip = 0; strip < strips; strip++)
{
size_t stripOffset;
if (yAxisUp)
stripOffset = ember.m_FinalRasH * ((strips - strip) - 1) * renderer->FinalRowSize();
else
stripOffset = ember.m_FinalRasH * strip * renderer->FinalRowSize();
ember.m_CenterY = centerBase + ember.m_FinalRasH * T(strip) / (ember.m_PixelsPerUnit * zoomScale);
if ((ember.m_FinalRasH * (strip + 1)) > realHeight)
{
origHeight = ember.m_FinalRasH;
ember.m_FinalRasH = realHeight - origHeight * strip;
ember.m_CenterY -= (origHeight - ember.m_FinalRasH) * T(0.5) / (ember.m_PixelsPerUnit * zoomScale);
}
ember.m_CenterY;
perStripStart(strip);
if (strips > 1)
{
renderer->RandVec(randVec);//Use the same vector of ISAAC rands for each strip.
renderer->SetEmber(ember);//Set one final time after modifications for strips.
}
if ((renderer->Run(finalImage, time, 0, false, stripOffset) != RENDER_OK) || renderer->Aborted() || finalImage.empty())
{
perStripError(strip);
success = false;
break;
}
else
{
perStripFinish(strip);
}
if (strip == strips - 1)
{
//Restore the ember values to their original values.
if (strips > 1)
{
ember.m_Quality /= strips;
ember.m_FinalRasH = realHeight;
ember.m_CenterY = centerY;
renderer->SetEmber(ember);//Further processing will require the dimensions to match the original ember, so re-assign.
}
allStripsFinished(ember);
}
}
Memset(finalImage);
return success;
}
static size_t VerifyStrips(size_t height, size_t strips,
std::function<void(const string& s)> stripError1,
std::function<void(const string& s)> stripError2,
std::function<void(const string& s)> stripError3)
{
ostringstream os;
if (strips > height)
{
os << "Cannot have more strips than rows: " << strips << " > " << height << ". Setting strips = rows.";
stripError1(os.str()); os.str("");
strips = height;
}
if (height % strips != 0)
{
os << "A strips value of " << strips << " does not divide evenly into a height of " << height << ".";
stripError2(os.str()); os.str("");
strips = NextHighestEvenDiv(height, strips);
if (strips == 1)//No higher divisor, check for a lower one.
strips = NextLowestEvenDiv(height, strips);
os << "Setting strips to " << strips << ".";
stripError3(os.str()); os.str("");
}
return strips;
}
/// <summary>
/// Simple macro to print a string if the --verbose options has been specified.
/// </summary>

View File

@ -12,10 +12,10 @@
/// <param name="width">Width of the image in pixels</param>
/// <param name="height">Height of the image in pixels</param>
/// <returns>True if success, else false</returns>
static bool WritePpm(const char* filename, unsigned char* image, int width, int height)
static bool WritePpm(const char* filename, unsigned char* image, size_t width, size_t height)
{
bool b = false;
unsigned int size = width * height * 3;
size_t size = width * height * 3;
FILE* file;
if (fopen_s(&file, filename, "wb") == 0)
@ -44,7 +44,7 @@ static bool WritePpm(const char* filename, unsigned char* image, int width, int
/// <param name="url">Url of the author</param>
/// <param name="nick">Nickname of the author</param>
/// <returns>True if success, else false</returns>
static bool WriteJpeg(const char* filename, unsigned char* image, unsigned int width, unsigned int height, int quality, bool enableComments, EmberImageComments& comments, string id, string url, string nick)
static bool WriteJpeg(const char* filename, unsigned char* image, size_t width, size_t height, int quality, bool enableComments, EmberImageComments& comments, string id, string url, string nick)
{
bool b = false;
FILE* file;
@ -70,8 +70,8 @@ static bool WriteJpeg(const char* filename, unsigned char* image, unsigned int w
jpeg_stdio_dest(&info, file);
info.in_color_space = JCS_RGB;
info.input_components = 3;
info.image_width = width;
info.image_height = height;
info.image_width = (JDIMENSION)width;
info.image_height = (JDIMENSION)height;
jpeg_set_defaults(&info);
jpeg_set_quality(&info, quality, TRUE);
jpeg_start_compress(&info, TRUE);
@ -135,7 +135,7 @@ static bool WriteJpeg(const char* filename, unsigned char* image, unsigned int w
/// <param name="url">Url of the author</param>
/// <param name="nick">Nickname of the author</param>
/// <returns>True if success, else false</returns>
static bool WritePng(const char* filename, unsigned char* image, unsigned int width, unsigned int height, int bytesPerChannel, bool enableComments, EmberImageComments& comments, string id, string url, string nick)
static bool WritePng(const char* filename, unsigned char* image, size_t width, size_t height, size_t bytesPerChannel, bool enableComments, EmberImageComments& comments, string id, string url, string nick)
{
bool b = false;
FILE* file;
@ -197,7 +197,7 @@ static bool WritePng(const char* filename, unsigned char* image, unsigned int wi
png_init_io(png_ptr, file);
png_set_IHDR(png_ptr, info_ptr, width, height, 8 * bytesPerChannel,
png_set_IHDR(png_ptr, info_ptr, (png_uint_32)width, (png_uint_32)height, 8 * (png_uint_32)bytesPerChannel,
PNG_COLOR_TYPE_RGBA,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE,
@ -232,17 +232,17 @@ static bool WritePng(const char* filename, unsigned char* image, unsigned int wi
/// <param name="height">The height.</param>
/// <param name="newSize">The size of the new buffer created</param>
/// <returns>The converted buffer if successful, else NULL.</returns>
static BYTE* ConvertRGBToBMPBuffer(BYTE* buffer, int width, int height, long& newSize)
static BYTE* ConvertRGBToBMPBuffer(BYTE* buffer, size_t width, size_t height, size_t& newSize)
{
if (NULL == buffer || width == 0 || height == 0)
return NULL;
int padding = 0;
int scanlinebytes = width * 3;
size_t padding = 0;
size_t scanlinebytes = width * 3;
while ((scanlinebytes + padding ) % 4 != 0)
padding++;
int psw = scanlinebytes + padding;
size_t psw = scanlinebytes + padding;
newSize = height * psw;
BYTE* newBuf = new BYTE[newSize];
@ -251,12 +251,12 @@ static BYTE* ConvertRGBToBMPBuffer(BYTE* buffer, int width, int height, long& ne
{
memset (newBuf, 0, newSize);
long bufpos = 0;
long newpos = 0;
size_t bufpos = 0;
size_t newpos = 0;
for (int y = 0; y < height; y++)
for (size_t y = 0; y < height; y++)
{
for (int x = 0; x < 3 * width; x += 3)
for (size_t x = 0; x < 3 * width; x += 3)
{
bufpos = y * 3 * width + x; // position in original buffer
newpos = (height - y - 1) * psw + x; // position in padded buffer
@ -286,11 +286,11 @@ static BYTE* ConvertRGBToBMPBuffer(BYTE* buffer, int width, int height, long& ne
/// <param name="height">Height of the image in pixels</param>
/// <param name="paddedSize">Padded size, greater than or equal to total image size.</param>
/// <returns>True if success, else false</returns>
static bool SaveBmp(const char* filename, BYTE* image, int width, int height, long paddedSize)
static bool SaveBmp(const char* filename, BYTE* image, size_t width, size_t height, size_t paddedSize)
{
BITMAPFILEHEADER bmfh;
BITMAPINFOHEADER info;
unsigned long bwritten;
DWORD bwritten;
HANDLE file;
memset (&bmfh, 0, sizeof (BITMAPFILEHEADER));
memset (&info, 0, sizeof (BITMAPINFOHEADER));
@ -298,12 +298,12 @@ static bool SaveBmp(const char* filename, BYTE* image, int width, int height, lo
bmfh.bfType = 0x4d42; // 0x4d42 = 'BM'
bmfh.bfReserved1 = 0;
bmfh.bfReserved2 = 0;
bmfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + paddedSize;
bmfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + (DWORD)paddedSize;
bmfh.bfOffBits = 0x36;
info.biSize = sizeof(BITMAPINFOHEADER);
info.biWidth = width;
info.biHeight = height;
info.biWidth = (LONG)width;
info.biHeight = (LONG)height;
info.biPlanes = 1;
info.biBitCount = 24;
info.biCompression = BI_RGB;
@ -331,7 +331,7 @@ static bool SaveBmp(const char* filename, BYTE* image, int width, int height, lo
return false;
}
if (WriteFile(file, image, paddedSize, &bwritten, NULL) == false)
if (WriteFile(file, image, (DWORD)paddedSize, &bwritten, NULL) == false)
{
CloseHandle(file);
return false;
@ -349,10 +349,10 @@ static bool SaveBmp(const char* filename, BYTE* image, int width, int height, lo
/// <param name="width">Width of the image in pixels</param>
/// <param name="height">Height of the image in pixels</param>
/// <returns>True if success, else false</returns>
static bool WriteBmp(const char* filename, unsigned char* image, int width, int height)
static bool WriteBmp(const char* filename, unsigned char* image, size_t width, size_t height)
{
bool b = false;
long newSize;
size_t newSize;
auto_ptr<BYTE> bgrBuf(ConvertRGBToBMPBuffer(image, width, height, newSize));
if (bgrBuf.get())

View File

@ -61,7 +61,7 @@ bool EmberGenome(EmberOptions& opt)
bool exactTimeMatch, randomMode, didColor, seqFlag;
unsigned int i, j, i0, i1, rep, val, frame, frameCount, count = 0;
unsigned int ftime, firstFrame, lastFrame;
unsigned int n, tot, totb, totw;
size_t n, tot, totb, totw;
T avgPix, fractionBlack, fractionWhite, blend, spread, mix0, mix1;
string token, filename;
ostringstream os, os2;

View File

@ -28,9 +28,9 @@ bool EmberRender(EmberOptions& opt)
Timing t;
bool writeSuccess = false;
unsigned char* finalImagep;
unsigned int i, channels, strip, strips, realHeight, origHeight;
size_t stripOffset;
T centerY, centerBase, zoomScale, floatStripH;
size_t i, channels;
size_t strips;
size_t iterCount;
string filename;
ostringstream os;
vector<Ember<T>> embers;
@ -188,6 +188,7 @@ bool EmberRender(EmberOptions& opt)
embers[i].m_FinalRasH = 1080;
}
stats.Clear();
renderer->SetEmber(embers[i]);
renderer->PrepFinalAccumVector(finalImage);//Must manually call this first because it could be erroneously made smaller due to strips if called inside Renderer::Run().
@ -197,40 +198,17 @@ bool EmberRender(EmberOptions& opt)
}
else
{
strips = CalcStrips((double)renderer->MemoryRequired(false), (double)renderer->MemoryAvailable(), opt.UseMem());
strips = CalcStrips((double)renderer->MemoryRequired(1, true), (double)renderer->MemoryAvailable(), opt.UseMem());
if (strips > 1)
VerbosePrint("Setting strips to " << strips << " with specified memory usage of " << opt.UseMem());
}
if (strips > embers[i].m_FinalRasH)
{
cout << "Cannot have more strips than rows: " << opt.Strips() << " > " << embers[i].m_FinalRasH << ". Setting strips = rows." << endl;
opt.Strips(strips = embers[i].m_FinalRasH);
}
strips = VerifyStrips(embers[i].m_FinalRasH, strips,
[&](const string& s) { cout << s << endl; },//Greater than height.
[&](const string& s) { cout << s << endl; },//Mod height != 0.
[&](const string& s) { cout << s << endl; });//Final strips value to be set.
if (embers[i].m_FinalRasH % strips != 0)
{
cout << "A strips value of " << strips << " does not divide evenly into a height of " << embers[i].m_FinalRasH;
strips = NextHighestEvenDiv(embers[i].m_FinalRasH, strips);
if (strips == 1)//No higher divisor, check for a lower one.
strips = NextLowestEvenDiv(embers[i].m_FinalRasH, strips);
cout << ". Setting strips to " << strips << "." << endl;
}
embers[i].m_Quality *= strips;
realHeight = embers[i].m_FinalRasH;
floatStripH = T(embers[i].m_FinalRasH) / T(strips);
embers[i].m_FinalRasH = (unsigned int)ceil(floatStripH);
centerY = embers[i].m_CenterY;
zoomScale = pow(T(2), embers[i].m_Zoom);
centerBase = centerY - ((strips - 1) * floatStripH) / (2 * embers[i].m_PixelsPerUnit * zoomScale);
if (strips > 1)
randVec = renderer->RandVec();
//For testing incremental renderer.
//int sb = 1;
//bool resume = false, success = false;
@ -242,104 +220,84 @@ bool EmberRender(EmberOptions& opt)
//}
//while (success && renderer->ProcessState() != ACCUM_DONE);
for (strip = 0; strip < strips; strip++)
StripsRender<T>(renderer.get(), embers[i], finalImage, 0, strips, opt.YAxisUp(),
[&](size_t strip)//Pre strip.
{
stripOffset = (size_t)embers[i].m_FinalRasH * strip * renderer->FinalRowSize();
embers[i].m_CenterY = centerBase + embers[i].m_FinalRasH * T(strip) / (embers[i].m_PixelsPerUnit * zoomScale);
if ((embers[i].m_FinalRasH * (strip + 1)) > realHeight)
{
origHeight = embers[i].m_FinalRasH;
embers[i].m_FinalRasH = realHeight - origHeight * strip;
embers[i].m_CenterY -= (origHeight - embers[i].m_FinalRasH) * T(0.5) / (embers[i].m_PixelsPerUnit * zoomScale);
}
if (opt.Verbose() && (strips > 1) && strip > 0)
cout << endl;
if (strips > 1)
{
renderer->RandVec(randVec);//Use the same vector of ISAAC rands for each strip.
renderer->SetEmber(embers[i]);//Set one final time after modifications for strips.
if (opt.Verbose() && (strips > 1) && strip > 0)
cout << endl;
VerbosePrint("Strip = " << (strip + 1) << "/" << strips);
}
if ((renderer->Run(finalImage, 0, 0, false, stripOffset) != RENDER_OK) || renderer->Aborted() || finalImage.empty())
{
cout << "Error: image rendering failed, skipping to next image." << endl;
renderer->DumpErrorReport();//Something went wrong, print errors.
break;//Exit strips loop, resume next iter in embers loop.
}
progress->Clear();
//Original wrote every strip as a full image which could be very slow with many large images.
//Only write once all strips for this image are finished.
if (strip == strips - 1)
{
if (!opt.Out().empty())
{
filename = opt.Out();
}
else if (opt.NameEnable() && !embers[i].m_Name.empty())
{
filename = opt.Prefix() + embers[i].m_Name + opt.Suffix() + "." + opt.Format();
}
else
{
ostringstream ssLocal;
ssLocal << opt.Prefix() << setfill('0') << setw(5) << i << opt.Suffix() << "." << opt.Format();
filename = ssLocal.str();
}
writeSuccess = false;
comments = renderer->ImageComments(opt.PrintEditDepth(), opt.IntPalette(), opt.HexPalette());
stats = renderer->Stats();
os.str("");
os << comments.m_NumIters << " / " << renderer->TotalIterCount() << " (" << std::fixed << std::setprecision(2) << ((double)stats.m_Iters/(double)renderer->TotalIterCount() * 100) << "%)";
VerbosePrint("\nIters ran/requested: " + os.str());
VerbosePrint("Bad values: " << stats.m_Badvals);
VerbosePrint("Render time: " + t.Format(stats.m_RenderMs));
VerbosePrint("Pure iter time: " + t.Format(stats.m_IterMs));
VerbosePrint("Iters/sec: " << unsigned __int64(stats.m_Iters / (stats.m_IterMs / 1000.0)) << endl);
VerbosePrint("Writing " + filename);
if ((opt.Format() == "jpg" || opt.Format() == "bmp") && renderer->NumChannels() == 4)
{
RgbaToRgb(finalImage, vecRgb, renderer->FinalRasW(), realHeight);
finalImagep = vecRgb.data();
}
else
{
finalImagep = finalImage.data();
}
if (opt.Format() == "png")
writeSuccess = WritePng(filename.c_str(), finalImagep, renderer->FinalRasW(), realHeight, opt.BitsPerChannel() / 8, opt.PngComments(), comments, opt.Id(), opt.Url(), opt.Nick());
else if (opt.Format() == "jpg")
writeSuccess = WriteJpeg(filename.c_str(), finalImagep, renderer->FinalRasW(), realHeight, opt.JpegQuality(), opt.JpegComments(), comments, opt.Id(), opt.Url(), opt.Nick());
else if (opt.Format() == "ppm")
writeSuccess = WritePpm(filename.c_str(), finalImagep, renderer->FinalRasW(), realHeight);
else if (opt.Format() == "bmp")
writeSuccess = WriteBmp(filename.c_str(), finalImagep, renderer->FinalRasW(), realHeight);
if (!writeSuccess)
cout << "Error writing " << filename << endl;
}
}
//Restore the ember values to their original values.
if (strips > 1)
},
[&](size_t strip)//Post strip.
{
embers[i].m_Quality /= strips;
embers[i].m_FinalRasH = realHeight;
embers[i].m_CenterY = centerY;
memset(finalImage.data(), 0, finalImage.size());
}
progress->Clear();
stats += renderer->Stats();
},
[&](size_t strip)//Error.
{
cout << "Error: image rendering failed, skipping to next image." << endl;
renderer->DumpErrorReport();//Something went wrong, print errors.
},
//Final strip.
//Original wrote every strip as a full image which could be very slow with many large images.
//Only write once all strips for this image are finished.
[&](Ember<T>& finalEmber)
{
if (!opt.Out().empty())
{
filename = opt.Out();
}
else if (opt.NameEnable() && !finalEmber.m_Name.empty())
{
filename = opt.Prefix() + finalEmber.m_Name + opt.Suffix() + "." + opt.Format();
}
else
{
ostringstream ssLocal;
ssLocal << opt.Prefix() << setfill('0') << setw(5) << i << opt.Suffix() << "." << opt.Format();
filename = ssLocal.str();
}
//TotalIterCount() is actually using ScaledQuality() which does not get reset upon ember assignment,
//so it ends up using the correct value for quality * strips.
writeSuccess = false;
iterCount = renderer->TotalIterCount();
comments = renderer->ImageComments(stats, opt.PrintEditDepth(), opt.IntPalette(), opt.HexPalette());
os.str("");
os << comments.m_NumIters << " / " << iterCount << " (" << std::fixed << std::setprecision(2) << (((double)stats.m_Iters / (double)iterCount) * 100) << "%)";
VerbosePrint("\nIters ran/requested: " + os.str());
VerbosePrint("Bad values: " << stats.m_Badvals);
VerbosePrint("Render time: " + t.Format(stats.m_RenderMs));
VerbosePrint("Pure iter time: " + t.Format(stats.m_IterMs));
VerbosePrint("Iters/sec: " << unsigned __int64(stats.m_Iters / (stats.m_IterMs / 1000.0)) << endl);
VerbosePrint("Writing " + filename);
if ((opt.Format() == "jpg" || opt.Format() == "bmp") && renderer->NumChannels() == 4)
{
RgbaToRgb(finalImage, vecRgb, finalEmber.m_FinalRasW, finalEmber.m_FinalRasH);
finalImagep = vecRgb.data();
}
else
{
finalImagep = finalImage.data();
}
if (opt.Format() == "png")
writeSuccess = WritePng(filename.c_str(), finalImagep, finalEmber.m_FinalRasW, finalEmber.m_FinalRasH, opt.BitsPerChannel() / 8, opt.PngComments(), comments, opt.Id(), opt.Url(), opt.Nick());
else if (opt.Format() == "jpg")
writeSuccess = WriteJpeg(filename.c_str(), finalImagep, finalEmber.m_FinalRasW, finalEmber.m_FinalRasH, opt.JpegQuality(), opt.JpegComments(), comments, opt.Id(), opt.Url(), opt.Nick());
else if (opt.Format() == "ppm")
writeSuccess = WritePpm(filename.c_str(), finalImagep, finalEmber.m_FinalRasW, finalEmber.m_FinalRasH);
else if (opt.Format() == "bmp")
writeSuccess = WriteBmp(filename.c_str(), finalImagep, finalEmber.m_FinalRasW, finalEmber.m_FinalRasH);
if (!writeSuccess)
cout << "Error writing " << filename << endl;
});
if (opt.EmberCL() && opt.DumpKernel())
cout << "Iteration kernel: \n" << ((RendererCL<T>*)renderer.get())->IterKernel() << endl;

View File

@ -94,7 +94,7 @@ string GetEmberCLKernelString(Ember<float>& ember, bool iter, bool log, bool de,
return os.str();
}
void MakeTestAllVarsRegPrePostComboFile(string filename)
void MakeTestAllVarsRegPrePostComboFile(const string& filename)
{
EmberToXml<float> writer;
vector<Ember<float>> embers;
@ -1322,7 +1322,7 @@ void TestOperations()
vector<Variation<T>*> varVec;
//stringVec.push_back("%");
//varVec = FindVarsWith<T>(stringVec);
//varVec = FindVarsWith<T>(Vec);
//
//for (size_t i = 0; i < varVec.size(); i++)
//{

View File

@ -76,6 +76,14 @@ public:
m_Embers.clear();
}
/// <summary>
/// Thin wrapper to get the size of the vector of embers.
/// </summary>
size_t Size()
{
return m_Embers.size();
}
/// <summary>
/// Ensure all ember names are unique.
/// </summary>
@ -89,7 +97,7 @@ public:
{
if (i != j && m_Embers[i].m_Name == m_Embers[j].m_Name)
{
m_Embers[j].m_Name = m_Embers[j].m_Name + "_" + QString::number(++x).toStdString();
m_Embers[j].m_Name = m_Embers[j].m_Name + "_" + ToString(++x).toStdString();
j = 0;
}
}
@ -109,7 +117,7 @@ public:
/// Ensures a given input filename is unique by appending a count to the end.
/// </summary>
/// <returns>The passed in name if it was unique, else a uniquely made name.</returns>
static QString UniqueFilename(QString& filename)
static QString UniqueFilename(const QString& filename)
{
if (!QFile::exists(filename))
return filename;
@ -117,13 +125,13 @@ public:
int counter = 2;
QString newPath;
QFileInfo original(filename);
QString path = original.absolutePath() + QDir::separator();
QString path = original.absolutePath() + '/';
QString base = original.completeBaseName();
QString extension = original.suffix();
do
{
newPath = path + base + "_" + QString::number(counter++) + "." + extension;
newPath = path + base + "_" + ToString(counter++) + "." + extension;
}
while (QFile::exists(newPath));
@ -138,7 +146,7 @@ public:
/// <returns>The default ember name</returns>
static QString DefaultEmberName(unsigned int i)
{
return DefaultFilename() + "-" + QString::number(i);
return DefaultFilename() + "-" + ToString(i);
}
QString m_Filename;

View File

@ -18,7 +18,7 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set
int row = 0, spinHeight = 20;
unsigned int i;
double dmax = numeric_limits<double>::max();
QTableWidget* table = ui.FinalRenderGeometryTable;
QTableWidget* table = ui.FinalRenderParamsTable;
QTableWidgetItem* item = NULL;
m_Fractorium = (Fractorium*)parent;
@ -31,30 +31,51 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set
connect(ui.FinalRenderDoublePrecisionCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnDoublePrecisionCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.FinalRenderPlatformCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(OnPlatformComboCurrentIndexChanged(int)), Qt::QueuedConnection);
connect(ui.FinalRenderDoAllCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnDoAllCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.FinalRenderDoSequenceCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnDoSequenceCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.FinalRenderCurrentSpin, SIGNAL(valueChanged(int)), this, SLOT(OnFinalRenderCurrentSpinChanged(int)), Qt::QueuedConnection);
connect(ui.FinalRenderApplyToAllCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnApplyAllCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.FinalRenderKeepAspectCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnKeepAspectCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.FinalRenderScaleNoneRadioButton, SIGNAL(toggled(bool)), this, SLOT(OnScaleRadioButtonChanged(bool)), Qt::QueuedConnection);
connect(ui.FinalRenderScaleWidthRadioButton, SIGNAL(toggled(bool)), this, SLOT(OnScaleRadioButtonChanged(bool)), Qt::QueuedConnection);
connect(ui.FinalRenderScaleHeightRadioButton, SIGNAL(toggled(bool)), this, SLOT(OnScaleRadioButtonChanged(bool)), Qt::QueuedConnection);
SetupSpinner<DoubleSpinBox, double>(ui.FinalRenderSizeTable, this, row, 1, m_WidthScaleSpin, spinHeight, 0.001, 99.99, 0.1, SIGNAL(valueChanged(double)), SLOT(OnFinalRenderWidthScaleChanged(double)), true, 1.0, 1.0, 1.0);
SetupSpinner<DoubleSpinBox, double>(ui.FinalRenderSizeTable, this, row, 1, m_HeightScaleSpin, spinHeight, 0.001, 99.99, 0.1, SIGNAL(valueChanged(double)), SLOT(OnFinalRenderHeightScaleChanged(double)), true, 1.0, 1.0, 1.0);
m_WidthScaleSpin->setDecimals(3);
m_HeightScaleSpin->setDecimals(3);
m_WidthScaleSpin->setSuffix(" ( )");
m_HeightScaleSpin->setSuffix(" ( )");
m_WidthScaleSpin->SmallStep(0.001);
m_HeightScaleSpin->SmallStep(0.001);
SetupSpinner<SpinBox, int> (table, this, row, 1, m_WidthSpin, spinHeight, 10, 100000, 50, SIGNAL(valueChanged(int)), SLOT(OnWidthChanged(int)), true, 1980);
SetupSpinner<SpinBox, int> (table, this, row, 1, m_HeightSpin, spinHeight, 10, 100000, 50, SIGNAL(valueChanged(int)), SLOT(OnHeightChanged(int)), true, 1080);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_QualitySpin, spinHeight, 1, dmax, 50, SIGNAL(valueChanged(double)), SLOT(OnQualityChanged(double)), true, 1000);
SetupSpinner<SpinBox, int> (table, this, row, 1, m_TemporalSamplesSpin, spinHeight, 1, 5000, 50, SIGNAL(valueChanged(int)), SLOT(OnTemporalSamplesChanged(int)), true, 1000);
SetupSpinner<SpinBox, int> (table, this, row, 1, m_SupersampleSpin, spinHeight, 1, 4, 1, SIGNAL(valueChanged(int)), SLOT(OnSupersampleChanged(int)), true, 2);
row = 0;
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_QualitySpin, spinHeight, 1, dmax, 50, SIGNAL(valueChanged(double)), SLOT(OnQualityChanged(double)), true, 1000, 1000, 1000);
SetupSpinner<SpinBox, int> (table, this, row, 1, m_TemporalSamplesSpin, spinHeight, 1, 5000, 50, SIGNAL(valueChanged(int)), SLOT(OnTemporalSamplesChanged(int)), true, 1000, 1000, 1000);
SetupSpinner<SpinBox, int> (table, this, row, 1, m_SupersampleSpin, spinHeight, 1, 4, 1, SIGNAL(valueChanged(int)), SLOT(OnSupersampleChanged(int)), true, 2, 1, 1);
SetupSpinner<SpinBox, int> (table, this, row, 1, m_StripsSpin, spinHeight, 1, 64, 1, SIGNAL(valueChanged(int)), SLOT(OnStripsChanged(int)), true, 1, 1, 1);
row++;//Memory usage.
m_MemoryCellIndex = row++;//Memory usage.
m_PathCellIndex = row;
TwoButtonWidget* tbw = new TwoButtonWidget("...", "Open", 22, 40, 22, table);
table->setCellWidget(row, 1, tbw);
QStringList comboList;
comboList.append("jpg");
comboList.append("png");
m_Tbcw = new TwoButtonComboWidget("...", "Open", comboList, 22, 40, 22, table);
table->setCellWidget(row, 1, m_Tbcw);
table->item(row++, 1)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
connect(tbw->m_Button1, SIGNAL(clicked(bool)), this, SLOT(OnFileButtonClicked(bool)), Qt::QueuedConnection);
connect(tbw->m_Button2, SIGNAL(clicked(bool)), this, SLOT(OnShowFolderButtonClicked(bool)), Qt::QueuedConnection);
connect(m_Tbcw->m_Button1, SIGNAL(clicked(bool)), this, SLOT(OnFileButtonClicked(bool)), Qt::QueuedConnection);
connect(m_Tbcw->m_Button2, SIGNAL(clicked(bool)), this, SLOT(OnShowFolderButtonClicked(bool)), Qt::QueuedConnection);
connect(m_Tbcw->m_Combo, SIGNAL(currentIndexChanged(int)), this, SLOT(OnFinalRenderExtIndexChanged(int)), Qt::QueuedConnection);
m_PrefixEdit = new QLineEdit(table);
table->setCellWidget(row++, 1, m_PrefixEdit);
m_SuffixEdit = new QLineEdit(table);
table->setCellWidget(row++, 1, m_SuffixEdit);
connect(m_PrefixEdit, SIGNAL(textChanged(const QString&)), this, SLOT(OnFinalRenderPrefixChanged(const QString&)), Qt::QueuedConnection);
connect(m_SuffixEdit, SIGNAL(textChanged(const QString&)), this, SLOT(OnFinalRenderSuffixChanged(const QString&)), Qt::QueuedConnection);
ui.StartRenderButton->disconnect(SIGNAL(clicked(bool)));
connect(ui.StartRenderButton, SIGNAL(clicked(bool)), this, SLOT(OnRenderClicked(bool)), Qt::QueuedConnection);
@ -97,22 +118,22 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set
ui.FinalRenderKeepAspectCheckBox->setChecked( m_Settings->FinalKeepAspect());
ui.FinalRenderThreadCountSpin->setValue( m_Settings->FinalThreadCount());
m_WidthSpin->setValue(m_Settings->FinalWidth());
m_HeightSpin->setValue(m_Settings->FinalHeight());
m_QualitySpin->setValue(m_Settings->FinalQuality());
m_TemporalSamplesSpin->setValue(m_Settings->FinalTemporalSamples());
m_SupersampleSpin->setValue(m_Settings->FinalSupersample());
m_StripsSpin->setValue(m_Settings->FinalStrips());
Scale((eScaleType)m_Settings->FinalScale());
if (m_Settings->FinalDoAllExt() == "jpg")
ui.FinalRenderJpgRadioButton->setChecked(true);
if (m_Settings->FinalExt() == "jpg")
m_Tbcw->m_Combo->setCurrentIndex(0);
else
ui.FinalRenderPngRadioButton->setChecked(true);
m_Tbcw->m_Combo->setCurrentIndex(1);
//Explicitly call these to enable/disable the appropriate controls.
OnOpenCLCheckBoxStateChanged(ui.FinalRenderOpenCLCheckBox->isChecked());
OnDoAllCheckBoxStateChanged(ui.FinalRenderDoAllCheckBox->isChecked());
OnDoSequenceCheckBoxStateChanged(ui.FinalRenderDoSequenceCheckBox->isChecked());
QSize s = size();
int desktopHeight = qApp->desktop()->availableGeometry().height();
@ -122,29 +143,32 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set
QWidget* w = SetTabOrder(this, ui.FinalRenderEarlyClipCheckBox, ui.FinalRenderYAxisUpCheckBox);
//Update these with new controls.
w = SetTabOrder(this, w, ui.FinalRenderTransparencyCheckBox);
w = SetTabOrder(this, w, ui.FinalRenderOpenCLCheckBox);
w = SetTabOrder(this, w, ui.FinalRenderDoublePrecisionCheckBox);
w = SetTabOrder(this, w, ui.FinalRenderSaveXmlCheckBox);
w = SetTabOrder(this, w, ui.FinalRenderDoAllCheckBox);
w = SetTabOrder(this, w, ui.FinalRenderDoSequenceCheckBox);
w = SetTabOrder(this, w, ui.FinalRenderKeepAspectCheckBox);
w = SetTabOrder(this, w, ui.FinalRenderScaleNoneRadioButton);
w = SetTabOrder(this, w, ui.FinalRenderScaleWidthRadioButton);
w = SetTabOrder(this, w, ui.FinalRenderScaleHeightRadioButton);
w = SetTabOrder(this, w, ui.FinalRenderJpgRadioButton);
w = SetTabOrder(this, w, ui.FinalRenderPngRadioButton);
w = SetTabOrder(this, w, ui.FinalRenderCurrentSpin);
w = SetTabOrder(this, w, ui.FinalRenderPlatformCombo);
w = SetTabOrder(this, w, ui.FinalRenderDeviceCombo);
w = SetTabOrder(this, w, ui.FinalRenderThreadCountSpin);
w = SetTabOrder(this, w, m_WidthSpin);
w = SetTabOrder(this, w, m_HeightSpin);
w = SetTabOrder(this, w, ui.FinalRenderApplyToAllCheckBox);
w = SetTabOrder(this, w, m_WidthScaleSpin);
w = SetTabOrder(this, w, m_HeightScaleSpin);
w = SetTabOrder(this, w, ui.FinalRenderScaleNoneRadioButton);
w = SetTabOrder(this, w, ui.FinalRenderScaleWidthRadioButton);
w = SetTabOrder(this, w, ui.FinalRenderScaleHeightRadioButton);
w = SetTabOrder(this, w, ui.FinalRenderKeepAspectCheckBox);
w = SetTabOrder(this, w, m_QualitySpin);
w = SetTabOrder(this, w, m_TemporalSamplesSpin);
w = SetTabOrder(this, w, m_SupersampleSpin);
w = SetTabOrder(this, w, tbw);
w = SetTabOrder(this, w, tbw->m_Button1);
w = SetTabOrder(this, w, tbw->m_Button2);
w = SetTabOrder(this, w, m_StripsSpin);
w = SetTabOrder(this, w, m_Tbcw);
w = SetTabOrder(this, w, m_Tbcw->m_Combo);
w = SetTabOrder(this, w, m_Tbcw->m_Button1);
w = SetTabOrder(this, w, m_Tbcw->m_Button2);
w = SetTabOrder(this, w, m_PrefixEdit);
w = SetTabOrder(this, w, m_SuffixEdit);
w = SetTabOrder(this, w, ui.FinalRenderTextOutput);
@ -166,19 +190,22 @@ bool FractoriumFinalRenderDialog::SaveXml() { return ui.FinalRenderSaveXmlCheckB
bool FractoriumFinalRenderDialog::DoAll() { return ui.FinalRenderDoAllCheckBox->isChecked(); }
bool FractoriumFinalRenderDialog::DoSequence() { return ui.FinalRenderDoSequenceCheckBox->isChecked(); }
bool FractoriumFinalRenderDialog::KeepAspect() { return ui.FinalRenderKeepAspectCheckBox->isChecked(); }
QString FractoriumFinalRenderDialog::DoAllExt() { return ui.FinalRenderJpgRadioButton->isChecked() ? "jpg" : "png"; }
QString FractoriumFinalRenderDialog::Path() { return ui.FinalRenderGeometryTable->item(6, 1)->text(); }
void FractoriumFinalRenderDialog::Path(QString s) { ui.FinalRenderGeometryTable->item(6, 1)->setText(s); }
bool FractoriumFinalRenderDialog::ApplyToAll() { return ui.FinalRenderApplyToAllCheckBox->isChecked(); }
QString FractoriumFinalRenderDialog::Ext() { return m_Tbcw->m_Combo->currentIndex() == 0 ? "jpg" : "png"; }
QString FractoriumFinalRenderDialog::Path() { return ui.FinalRenderParamsTable->item(m_PathCellIndex, 1)->text(); }
void FractoriumFinalRenderDialog::Path(const QString& s) { ui.FinalRenderParamsTable->item(m_PathCellIndex, 1)->setText(s); }
QString FractoriumFinalRenderDialog::Prefix() { return m_PrefixEdit->text(); }
QString FractoriumFinalRenderDialog::Suffix() { return m_SuffixEdit->text(); }
unsigned int FractoriumFinalRenderDialog::Current() { return ui.FinalRenderCurrentSpin->value(); }
unsigned int FractoriumFinalRenderDialog::PlatformIndex() { return ui.FinalRenderPlatformCombo->currentIndex(); }
unsigned int FractoriumFinalRenderDialog::DeviceIndex() { return ui.FinalRenderDeviceCombo->currentIndex(); }
unsigned int FractoriumFinalRenderDialog::ThreadCount() { return ui.FinalRenderThreadCountSpin->value(); }
unsigned int FractoriumFinalRenderDialog::Width() { return m_WidthSpin->value(); }
unsigned int FractoriumFinalRenderDialog::Height() { return m_HeightSpin->value(); }
double FractoriumFinalRenderDialog::WidthScale() { return m_WidthScaleSpin->value(); }
double FractoriumFinalRenderDialog::HeightScale() { return m_HeightScaleSpin->value(); }
double FractoriumFinalRenderDialog::Quality() { return m_QualitySpin->value(); }
unsigned int FractoriumFinalRenderDialog::TemporalSamples() { return m_TemporalSamplesSpin->value(); }
unsigned int FractoriumFinalRenderDialog::Supersample() { return m_SupersampleSpin->value(); }
unsigned int FractoriumFinalRenderDialog::Strips() { return m_StripsSpin->value(); }
/// <summary>
/// Capture the current state of the Gui.
@ -200,17 +227,18 @@ FinalRenderGuiState FractoriumFinalRenderDialog::State()
state.m_KeepAspect = KeepAspect();
state.m_Scale = Scale();
state.m_Path = Path();
state.m_DoAllExt = DoAllExt();
state.m_Ext = Ext();
state.m_Prefix = Prefix();
state.m_Suffix = Suffix();
state.m_PlatformIndex = PlatformIndex();
state.m_DeviceIndex = DeviceIndex();
state.m_ThreadCount = ThreadCount();
state.m_Width = Width();
state.m_Height = Height();
state.m_WidthScale = WidthScale();
state.m_HeightScale = HeightScale();
state.m_Quality = Quality();
state.m_TemporalSamples = TemporalSamples();
state.m_Supersample = Supersample();
state.m_Strips = Strips();
return state;
}
@ -237,6 +265,8 @@ eScaleType FractoriumFinalRenderDialog::Scale()
/// <param name="scale">The type of scaling to use</param>
void FractoriumFinalRenderDialog::Scale(eScaleType scale)
{
ui.FinalRenderScaleNoneRadioButton->blockSignals(true);
if (scale == SCALE_NONE)
ui.FinalRenderScaleNoneRadioButton->setChecked(true);
else if (scale == SCALE_WIDTH)
@ -245,6 +275,8 @@ void FractoriumFinalRenderDialog::Scale(eScaleType scale)
ui.FinalRenderScaleHeightRadioButton->setChecked(true);
else
ui.FinalRenderScaleNoneRadioButton->setChecked(true);
ui.FinalRenderScaleNoneRadioButton->blockSignals(false);
}
/// <summary>
@ -307,6 +339,39 @@ void FractoriumFinalRenderDialog::OnDoublePrecisionCheckBoxStateChanged(int stat
SetMemory();
}
/// <summary>
/// The do all checkbox was changed.
/// If checked, render all embers available in the currently opened file, else
/// only render the current ember.
/// </summary>
/// <param name="state">The state of the checkbox</param>
void FractoriumFinalRenderDialog::OnDoAllCheckBoxStateChanged(int state)
{
ui.FinalRenderDoSequenceCheckBox->setEnabled(ui.FinalRenderDoAllCheckBox->isChecked());
}
/// <summary>
/// The do sequence checkbox was changed.
/// If checked, render all embers available in the currently opened file as an animation sequence, else
/// render them individually.
/// </summary>
/// <param name="state">The state of the checkbox</param>
void FractoriumFinalRenderDialog::OnDoSequenceCheckBoxStateChanged(int state)
{
m_TemporalSamplesSpin->setEnabled(ui.FinalRenderDoSequenceCheckBox->isChecked());
}
/// <summary>
/// The current ember spinner was changed, update fields.
/// </summary>
/// <param name="d">Ignored</param>
void FractoriumFinalRenderDialog::OnFinalRenderCurrentSpinChanged(int d)
{
m_Controller->SetEmber(d - 1);
m_Controller->SyncCurrentToGui();
SetMemory();
}
/// <summary>
/// Populate the the device combo box with all available
/// OpenCL devices for the selected platform.
@ -324,15 +389,44 @@ void FractoriumFinalRenderDialog::OnPlatformComboCurrentIndexChanged(int index)
}
/// <summary>
/// The do all checkbox was changed.
/// If checked, render all embers available in the currently opened file, else
/// only render the current ember.
/// The apply all checkbox was changed.
/// If checked, set values for all embers in the file to the values specified in the GUI.
/// </summary>
/// <param name="state">The state of the checkbox</param>
void FractoriumFinalRenderDialog::OnDoAllCheckBoxStateChanged(int state)
void FractoriumFinalRenderDialog::OnApplyAllCheckBoxStateChanged(int state)
{
ui.FinalRenderDoSequenceCheckBox->setEnabled(ui.FinalRenderDoAllCheckBox->isChecked());
ui.FinalRenderExtensionGroupBox->setEnabled(ui.FinalRenderDoAllCheckBox->isChecked());
if (state && m_Controller.get())
m_Controller->SyncGuiToEmbers();
}
/// <summary>
/// The width spinner was changed, recompute required memory.
/// If the aspect ratio checkbox is checked, set the value of
/// the height spinner as well to be in proportion.
/// </summary>
/// <param name="d">Ignored</param>
void FractoriumFinalRenderDialog::OnFinalRenderWidthScaleChanged(double d)
{
if (ui.FinalRenderKeepAspectCheckBox->isChecked() && m_Controller.get())
m_HeightScaleSpin->SetValueStealth(m_WidthScaleSpin->value());
if (SetMemory())
m_Controller->SyncCurrentToSizeSpinners(false, true);
}
/// <summary>
/// The height spinner was changed, recompute required memory.
/// If the aspect ratio checkbox is checked, set the value of
/// the width spinner as well to be in proportion.
/// </summary>
/// <param name="d">Ignored</param>
void FractoriumFinalRenderDialog::OnFinalRenderHeightScaleChanged(double d)
{
if (ui.FinalRenderKeepAspectCheckBox->isChecked() && m_Controller.get())
m_WidthScaleSpin->SetValueStealth(m_HeightScaleSpin->value());
if (SetMemory())
m_Controller->SyncCurrentToSizeSpinners(false, true);
}
/// <summary>
@ -343,7 +437,7 @@ void FractoriumFinalRenderDialog::OnDoAllCheckBoxStateChanged(int state)
void FractoriumFinalRenderDialog::OnKeepAspectCheckBoxStateChanged(int state)
{
if (state && m_Controller.get())
m_HeightSpin->SetValueStealth(m_WidthSpin->value() / m_Controller->OriginalAspect());
m_HeightScaleSpin->SetValueStealth(m_WidthScaleSpin->value());
SetMemory();
}
@ -358,34 +452,6 @@ void FractoriumFinalRenderDialog::OnScaleRadioButtonChanged(bool checked)
SetMemory();
}
/// <summary>
/// The width spinner was changed, recompute required memory.
/// If the aspect ratio checkbox is checked, set the value of
/// the height spinner as well to be in proportion.
/// </summary>
/// <param name="d">Ignored</param>
void FractoriumFinalRenderDialog::OnWidthChanged(int d)
{
if (ui.FinalRenderKeepAspectCheckBox->isChecked() && m_Controller.get())
m_HeightSpin->SetValueStealth(m_WidthSpin->value() / m_Controller->OriginalAspect());
SetMemory();
}
/// <summary>
/// The height spinner was changed, recompute required memory.
/// If the aspect ratio checkbox is checked, set the value of
/// the width spinner as well to be in proportion.
/// </summary>
/// <param name="d">Ignored</param>
void FractoriumFinalRenderDialog::OnHeightChanged(int d)
{
if (ui.FinalRenderKeepAspectCheckBox->isChecked() && m_Controller.get())
m_WidthSpin->SetValueStealth(m_HeightSpin->value() * m_Controller->OriginalAspect());
SetMemory();
}
/// <summary>
/// The quality spinner was changed, recompute required memory.
/// </summary>
@ -413,6 +479,15 @@ void FractoriumFinalRenderDialog::OnSupersampleChanged(int d)
SetMemory();
}
/// <summary>
/// The supersample spinner was changed, recompute required memory.
/// </summary>
/// <param name="d">Ignored</param>
void FractoriumFinalRenderDialog::OnStripsChanged(int d)
{
SetMemory();
}
/// <summary>
/// If a single ember is being rendered, show the save file dialog.
/// If a more than one is being rendered, show the save folder dialog.
@ -422,26 +497,12 @@ void FractoriumFinalRenderDialog::OnSupersampleChanged(int d)
void FractoriumFinalRenderDialog::OnFileButtonClicked(bool checked)
{
bool doAll = ui.FinalRenderDoAllCheckBox->isChecked();
QString filename;
if (doAll)
filename = m_Fractorium->SetupSaveFolderDialog();
else
filename = m_Fractorium->SetupSaveImageDialog(m_Controller->Name());
QString s = m_Fractorium->SetupSaveFolderDialog();
if (filename != "")
if (Exists(s))
{
if (doAll)
{
if (!filename.endsWith(QDir::separator()))
filename += "/";
}
QFileInfo fileInfo(filename);
QString path = fileInfo.absolutePath();
m_Settings->SaveFolder(path);//Any time they exit the box with a valid value, preserve it in the settings.
Path(filename);
m_Settings->SaveFolder(s);//Any time they exit the box with a valid value, preserve it in the settings.
Path(m_Controller->ComposePath(m_Controller->Name()));//And update the GUI.
SetMemory();
}
}
@ -452,17 +513,41 @@ void FractoriumFinalRenderDialog::OnFileButtonClicked(bool checked)
/// <param name="checked">Ignored</param>
void FractoriumFinalRenderDialog::OnShowFolderButtonClicked(bool checked)
{
QString text = Path();
QString s = m_Settings->SaveFolder();
if (text != "")
{
QFileInfo fileInfo(text);
QString path = fileInfo.absolutePath();
QDir dir(path);
if (Exists(s))
QDesktopServices::openUrl(QUrl::fromLocalFile(s));
else
QDesktopServices::openUrl(QStandardPaths::standardLocations(QStandardPaths::DesktopLocation)[0]);
}
if (dir.exists())
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
}
/// <summary>
/// Change the extension of the output image, which also may change the
/// number of channels used in the final output buffer.
/// </summary>
/// <param name="d">Ignored</param>
void FractoriumFinalRenderDialog::OnFinalRenderExtIndexChanged(int d)
{
if (SetMemory())
Path(m_Controller->ComposePath(m_Controller->Name()));
}
/// <summary>
/// Change the prefix prepended to the output file name.
/// </summary>
/// <param name="s">Ignored</param>
void FractoriumFinalRenderDialog::OnFinalRenderPrefixChanged(const QString& s)
{
Path(m_Controller->ComposePath(m_Controller->Name()));
}
/// <summary>
/// Change the suffix appended to the output file name.
/// </summary>
/// <param name="s">Ignored</param>
void FractoriumFinalRenderDialog::OnFinalRenderSuffixChanged(const QString& s)
{
Path(m_Controller->ComposePath(m_Controller->Name()));
}
/// <summary>
@ -492,27 +577,41 @@ void FractoriumFinalRenderDialog::OnCancelRenderClicked(bool checked)
/// <param name="e">The event</param>
void FractoriumFinalRenderDialog::showEvent(QShowEvent* e)
{
#ifdef DO_DOUBLE
Ember<double> ed;
#else
Ember<float> ed;
#endif
if (CreateControllerFromGUI(true))
{
m_Fractorium->m_Controller->CopyEmber(ed);//Copy the current ember from the main window out in to a temp.
m_Controller->SetEmber(ed);//Copy the temp into the final render controller.
m_Controller->SetOriginalEmber(ed);
#ifdef DO_DOUBLE
Ember<double> ed;
EmberFile<double> efi;
m_Fractorium->m_Controller->CopyEmberFile(efi, [&](Ember<double>& ember)
{
ember.SyncSize();
ember.m_Quality = m_Settings->FinalQuality();
ember.m_Supersample = m_Settings->FinalSupersample();
});//Copy the whole file, will take about 0.2ms per ember in the file.
#else
Ember<float> ed;
EmberFile<float> efi;
m_Fractorium->m_Controller->CopyEmberFile(efi, [&](Ember<float>& ember)
{
ember.SyncSize();
ember.m_Quality = m_Settings->FinalQuality();
ember.m_Supersample = m_Settings->FinalSupersample();
ember.m_TemporalSamples = m_Settings->FinalTemporalSamples();
});//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.
m_Controller->SetEmber(m_Fractorium->m_Controller->Index());//Set the currently selected ember to the one that was being edited.
ui.FinalRenderCurrentSpin->setMaximum(efi.Size());
m_Controller->m_ImageCount = 0;
SetMemory();
m_Controller->ResetProgress();
QString s = m_Settings->SaveFolder();
if (Exists(s))
Path(m_Controller->ComposePath(m_Controller->Name()));//Update the GUI.
}
QDir dir(m_Settings->SaveFolder());
QString name = m_Controller->Name();
if (dir.exists() && name != "")
Path(dir.absolutePath() + "/" + name + ".png");
ui.FinalRenderTextOutput->clear();
QDialog::showEvent(e);
}
@ -542,23 +641,28 @@ bool FractoriumFinalRenderDialog::CreateControllerFromGUI(bool createRenderer)
bool ok = true;
#ifdef DO_DOUBLE
size_t size = Double() ? sizeof(double) : sizeof(float);
Ember<double> ed;
Ember<double> orig;
EmberFile<double> efd;
#else
size_t size = sizeof(float);
Ember<float> ed;
Ember<float> orig;
EmberFile<float> efd;
#endif
if (!m_Controller.get() || (m_Controller->SizeOfT() != size))
{
#ifdef DO_DOUBLE
size_t size = Double() ? sizeof(double) : sizeof(float);
Ember<double> ed;
Ember<double> orig;
EmberFile<double> efd;
#else
size_t size = sizeof(float);
Ember<float> ed;
Ember<float> orig;
EmberFile<float> efd;
#endif
//First check if a controller has already been created, and if so, save its embers and gracefully shut it down.
if (m_Controller.get())
{
m_Controller->CopyEmber(ed);//Convert float to double or save double verbatim;
m_Controller->CopyEmberFile(efd);
{
m_Controller->CopyEmberFile(efd);//Convert float to double or save double verbatim;
m_Controller->Shutdown();
}
@ -572,12 +676,7 @@ bool FractoriumFinalRenderDialog::CreateControllerFromGUI(bool createRenderer)
//Restore the ember and ember file.
if (m_Controller.get())
{
m_Controller->SetEmber(ed);//Convert float to double or set double verbatim;
m_Controller->SetEmberFile(efd);
m_Fractorium->m_Controller->CopyEmber(orig);//Copy the current ember from the main window out in to a temp.
m_Controller->SetOriginalEmber(orig);
}
m_Controller->SetEmberFile(efd);//Convert float to double or set double verbatim;
}
if (m_Controller.get())
@ -595,8 +694,13 @@ bool FractoriumFinalRenderDialog::CreateControllerFromGUI(bool createRenderer)
/// Compute the amount of memory needed via call to SyncAndComputeMemory(), then
/// assign the result to the table cell as text.
/// </summary>
void FractoriumFinalRenderDialog::SetMemory()
bool FractoriumFinalRenderDialog::SetMemory()
{
if (isVisible() && CreateControllerFromGUI(true))
ui.FinalRenderGeometryTable->item(5, 1)->setText(QLocale(QLocale::English).toString(m_Controller->SyncAndComputeMemory()));
{
ui.FinalRenderParamsTable->item(m_MemoryCellIndex, 1)->setText(ToString(m_Controller->SyncAndComputeMemory()));
return true;
}
return false;
}

View File

@ -3,7 +3,7 @@
#include "ui_FinalRenderDialog.h"
#include "SpinBox.h"
#include "DoubleSpinBox.h"
#include "TwoButtonWidget.h"
#include "TwoButtonComboWidget.h"
#include "FractoriumSettings.h"
#include "FinalRenderEmberController.h"
@ -53,21 +53,24 @@ public:
bool DoAll();
bool DoSequence();
bool KeepAspect();
bool ApplyToAll();
eScaleType Scale();
void Scale(eScaleType scale);
QString DoAllExt();
QString Ext();
QString Path();
void Path(QString s);
void Path(const QString& s);
QString Prefix();
QString Suffix();
unsigned int Current();
unsigned int PlatformIndex();
unsigned int DeviceIndex();
unsigned int ThreadCount();
unsigned int Width();
unsigned int Height();
double WidthScale();
double HeightScale();
double Quality();
unsigned int TemporalSamples();
unsigned int Supersample();
unsigned int Strips();
FinalRenderGuiState State();
public Q_SLOTS:
@ -77,17 +80,24 @@ public Q_SLOTS:
void OnTransparencyCheckBoxStateChanged(int state);
void OnOpenCLCheckBoxStateChanged(int state);
void OnDoublePrecisionCheckBoxStateChanged(int state);
void OnPlatformComboCurrentIndexChanged(int index);
void OnDoAllCheckBoxStateChanged(int state);
void OnDoSequenceCheckBoxStateChanged(int state);
void OnFinalRenderCurrentSpinChanged(int d);
void OnPlatformComboCurrentIndexChanged(int index);
void OnApplyAllCheckBoxStateChanged(int state);
void OnFinalRenderWidthScaleChanged(double d);
void OnFinalRenderHeightScaleChanged(double d);
void OnKeepAspectCheckBoxStateChanged(int state);
void OnScaleRadioButtonChanged(bool checked);
void OnWidthChanged(int d);
void OnHeightChanged(int d);
void OnQualityChanged(double d);
void OnTemporalSamplesChanged(int d);
void OnSupersampleChanged(int d);
void OnStripsChanged(int d);
void OnFileButtonClicked(bool checked);
void OnShowFolderButtonClicked(bool checked);
void OnFinalRenderExtIndexChanged(int d);
void OnFinalRenderPrefixChanged(const QString& s);
void OnFinalRenderSuffixChanged(const QString& s);
void OnRenderClicked(bool checked);
void OnCancelRenderClicked(bool checked);
@ -97,15 +107,19 @@ protected:
private:
bool CreateControllerFromGUI(bool createRenderer);
void SetMemory();
bool SetMemory();
int m_MemoryCellIndex;
int m_PathCellIndex;
OpenCLWrapper m_Wrapper;
Timing m_RenderTimer;
SpinBox* m_WidthSpin;
SpinBox* m_HeightSpin;
DoubleSpinBox* m_WidthScaleSpin;
DoubleSpinBox* m_HeightScaleSpin;
DoubleSpinBox* m_QualitySpin;
SpinBox* m_TemporalSamplesSpin;
SpinBox* m_SupersampleSpin;
SpinBox* m_StripsSpin;
TwoButtonComboWidget* m_Tbcw;
QLineEdit* m_PrefixEdit;
QLineEdit* m_SuffixEdit;
FractoriumSettings* m_Settings;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>519</width>
<height>813</height>
<height>862</height>
</rect>
</property>
<property name="sizePolicy">
@ -64,7 +64,7 @@
<x>0</x>
<y>0</y>
<width>507</width>
<height>801</height>
<height>850</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -85,137 +85,6 @@
</property>
<item>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0">
<item row="5" column="0">
<widget class="QGroupBox" name="FinalRenderScaleGroupBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="toolTip">
<string>The scaling to perform from the editor to the final rendered image</string>
</property>
<property name="title">
<string>Scale</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="FinalRenderScaleNoneRadioButton">
<property name="text">
<string>None</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="FinalRenderScaleWidthRadioButton">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="FinalRenderScaleHeightRadioButton">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="1">
<widget class="QGroupBox" name="FinalRenderExtensionGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>110</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="toolTip">
<string>The image type to save the final output as when rendering all open flames</string>
</property>
<property name="title">
<string>Render All Extension</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="FinalRenderJpgRadioButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Jpg</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="FinalRenderPngRadioButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Png</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="FinalRenderEarlyClipCheckBox">
<property name="toolTip">
@ -226,49 +95,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="FinalRenderSaveXmlCheckBox">
<property name="toolTip">
<string>Save an Xml parameter file for each flame rendered</string>
</property>
<property name="text">
<string>Save Xml</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="FinalRenderKeepAspectCheckBox">
<property name="toolTip">
<string>Maintain the aspect ratio between width and height to be equal to base width and base height</string>
</property>
<property name="text">
<string>Keep Aspect Ratio</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="FinalRenderDoSequenceCheckBox">
<property name="toolTip">
<string>Use temporal samples value to achieve motion blur effect between flames</string>
</property>
<property name="text">
<string>Render as Animation Sequence</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="FinalRenderDoAllCheckBox">
<property name="toolTip">
<string>Render all open flames instead of just the current one</string>
</property>
<property name="text">
<string>Render All</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="FinalRenderYAxisUpCheckBox">
<property name="toolTip">
@ -279,16 +105,6 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="FinalRenderDoublePrecisionCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Checked: use 64-bit double precision numbers (slower, but better image quality).&lt;/p&gt;&lt;p&gt;Unchecked: use 32-bit single precision numbers (faster, but worse image quality).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use Double Precision</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="FinalRenderOpenCLCheckBox">
<property name="toolTip">
@ -309,50 +125,119 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="FinalRenderDoublePrecisionCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Checked: use 64-bit double precision numbers (slower, but better image quality).&lt;/p&gt;&lt;p&gt;Unchecked: use 32-bit single precision numbers (faster, but worse image quality).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use Double Precision</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="FinalRenderSaveXmlCheckBox">
<property name="toolTip">
<string>Save an Xml parameter file for each flame rendered</string>
</property>
<property name="text">
<string>Save Xml</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="FinalRenderDoAllCheckBox">
<property name="toolTip">
<string>Render all open flames instead of just the current one</string>
</property>
<property name="text">
<string>Render All</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="FinalRenderDoSequenceCheckBox">
<property name="toolTip">
<string>Use temporal samples value to achieve motion blur effect between flames</string>
</property>
<property name="text">
<string>Render as Animation Sequence</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="FinalRenderPreviewLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QGridLayout" name="gridLayout_3">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<item row="0" column="0">
<widget class="QLabel" name="FinalRenderPreviewLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="FinalRenderCurrentSpin">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999999999</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QComboBox" name="FinalRenderPlatformCombo">
@ -421,7 +306,256 @@
</widget>
</item>
<item>
<widget class="TableWidget" name="FinalRenderGeometryTable">
<widget class="QCheckBox" name="FinalRenderApplyToAllCheckBox">
<property name="toolTip">
<string>Apply current operation to all flames</string>
</property>
<property name="text">
<string>Apply Parameters to All</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="FinalRenderSizeGroupBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>91</height>
</size>
</property>
<property name="title">
<string>Size</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTableWidget" name="FinalRenderSizeTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>44</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>44</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="showGrid">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="rowCount">
<number>2</number>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>85</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>35</number>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>22</number>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>22</number>
</attribute>
<row>
<property name="text">
<string>Width Scale</string>
</property>
</row>
<row>
<property name="text">
<string>Height Scale</string>
</property>
</row>
<column>
<property name="text">
<string>Field</string>
</property>
</column>
<column/>
<item row="0" column="0">
<property name="text">
<string>Width Scale</string>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string/>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>Height Scale</string>
</property>
</item>
<item row="1" column="1">
<property name="text">
<string/>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="FinalRenderScaleGroupBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>45</height>
</size>
</property>
<property name="toolTip">
<string>The scaling to perform from the editor to the final rendered image</string>
</property>
<property name="title">
<string>Scale Type</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<property name="spacing">
<number>4</number>
</property>
<item row="0" column="1">
<widget class="QRadioButton" name="FinalRenderScaleWidthRadioButton">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QRadioButton" name="FinalRenderScaleHeightRadioButton">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="FinalRenderScaleNoneRadioButton">
<property name="text">
<string>None</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="FinalRenderKeepAspectCheckBox">
<property name="toolTip">
<string>Maintain the aspect ratio between width and height to be equal to base width and base height</string>
</property>
<property name="text">
<string>Keep Aspect Ratio</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="TableWidget" name="FinalRenderParamsTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -431,13 +565,13 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
<height>178</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>200</height>
<height>178</height>
</size>
</property>
<property name="focusPolicy">
@ -521,19 +655,6 @@
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<row>
<property name="text">
<string>Width</string>
</property>
<property name="toolTip">
<string/>
</property>
</row>
<row>
<property name="text">
<string>Height</string>
</property>
</row>
<row>
<property name="text">
<string>Quality</string>
@ -549,6 +670,11 @@
<string>Supersample</string>
</property>
</row>
<row>
<property name="text">
<string>Strips</string>
</property>
</row>
<row>
<property name="text">
<string>Memory Usage</string>
@ -581,10 +707,10 @@
</column>
<item row="0" column="0">
<property name="text">
<string>Width</string>
<string>Quality</string>
</property>
<property name="toolTip">
<string>The width in pixels of the final output image</string>
<string>The quality in iterations per pixel of the final output image</string>
</property>
</item>
<item row="0" column="1">
@ -594,10 +720,10 @@
</item>
<item row="1" column="0">
<property name="text">
<string>Height</string>
<string>Temporal Samples</string>
</property>
<property name="toolTip">
<string>The height in pixels of the final output image</string>
<string>The number of interpolated renders to do for each flame when rendering as an animation sequence</string>
</property>
</item>
<item row="1" column="1">
@ -607,10 +733,10 @@
</item>
<item row="2" column="0">
<property name="text">
<string>Quality</string>
<string>Supersample</string>
</property>
<property name="toolTip">
<string>The quality in iterations per pixel of the final output image</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The number to multiply the dimensions of the histogram and density filtering buffer by to achieve anti-aliasing.&lt;/p&gt;&lt;p&gt;Use this very sparingly as it increases the required memory by n squared.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</item>
<item row="2" column="1">
@ -620,10 +746,7 @@
</item>
<item row="3" column="0">
<property name="text">
<string>Temporal Samples</string>
</property>
<property name="toolTip">
<string>The number of interpolated renders to do for each flame when rendering as an animation sequence</string>
<string>Strips</string>
</property>
</item>
<item row="3" column="1">
@ -633,10 +756,10 @@
</item>
<item row="4" column="0">
<property name="text">
<string>Supersample</string>
<string>Memory Usage</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The number to multiply the dimensions of the histogram and density filtering buffer by to achieve anti-aliasing.&lt;/p&gt;&lt;p&gt;Use this very sparingly as it increases the required memory by n squared.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>The amount of memory including the final output image required to perform this render</string>
</property>
</item>
<item row="4" column="1">
@ -645,19 +768,6 @@
</property>
</item>
<item row="5" column="0">
<property name="text">
<string>Memory Usage</string>
</property>
<property name="toolTip">
<string>The amount of memory including the final output image required to perform this render</string>
</property>
</item>
<item row="5" column="1">
<property name="text">
<string>0</string>
</property>
</item>
<item row="6" column="0">
<property name="text">
<string>Output</string>
</property>
@ -665,25 +775,25 @@
<string>The output file path for rendering a single flame, or folder location for rendering multiple flames</string>
</property>
</item>
<item row="5" column="1">
<property name="text">
<string/>
</property>
</item>
<item row="6" column="0">
<property name="text">
<string>Prefix</string>
</property>
<property name="toolTip">
<string>The prefix to attach to all image filenames</string>
</property>
</item>
<item row="6" column="1">
<property name="text">
<string/>
</property>
</item>
<item row="7" column="0">
<property name="text">
<string>Prefix</string>
</property>
<property name="toolTip">
<string>The prefix to attach to all image filenames</string>
</property>
</item>
<item row="7" column="1">
<property name="text">
<string/>
</property>
</item>
<item row="8" column="0">
<property name="text">
<string>Suffix</string>
</property>
@ -691,7 +801,7 @@
<string>The suffix to attach to all image filenames</string>
</property>
</item>
<item row="8" column="1">
<item row="7" column="1">
<property name="text">
<string/>
</property>
@ -933,20 +1043,10 @@
<tabstop>FinalRenderYAxisUpCheckBox</tabstop>
<tabstop>FinalRenderTransparencyCheckBox</tabstop>
<tabstop>FinalRenderOpenCLCheckBox</tabstop>
<tabstop>FinalRenderDoublePrecisionCheckBox</tabstop>
<tabstop>FinalRenderSaveXmlCheckBox</tabstop>
<tabstop>FinalRenderDoAllCheckBox</tabstop>
<tabstop>FinalRenderDoSequenceCheckBox</tabstop>
<tabstop>FinalRenderKeepAspectCheckBox</tabstop>
<tabstop>FinalRenderScaleNoneRadioButton</tabstop>
<tabstop>FinalRenderScaleWidthRadioButton</tabstop>
<tabstop>FinalRenderScaleHeightRadioButton</tabstop>
<tabstop>FinalRenderJpgRadioButton</tabstop>
<tabstop>FinalRenderPngRadioButton</tabstop>
<tabstop>FinalRenderPlatformCombo</tabstop>
<tabstop>FinalRenderDeviceCombo</tabstop>
<tabstop>FinalRenderThreadCountSpin</tabstop>
<tabstop>FinalRenderGeometryTable</tabstop>
<tabstop>FinalRenderParamsTable</tabstop>
<tabstop>FinalRenderTextOutput</tabstop>
<tabstop>StartRenderButton</tabstop>
<tabstop>StopRenderButton</tabstop>

View File

@ -9,14 +9,14 @@
/// It passes a pointer to the main window to the base and initializes members.
/// </summary>
/// <param name="finalRender">Pointer to the final render dialog</param>
FinalRenderEmberControllerBase::FinalRenderEmberControllerBase(FractoriumFinalRenderDialog* finalRender)
: FractoriumEmberControllerBase(finalRender->m_Fractorium)
FinalRenderEmberControllerBase::FinalRenderEmberControllerBase(FractoriumFinalRenderDialog* finalRenderDialog)
: FractoriumEmberControllerBase(finalRenderDialog->m_Fractorium)
{
m_Run = false;
m_PreviewRun = false;
m_ImageCount = 0;
m_FinishedImageCount = 0;
m_FinalRender = finalRender;
m_FinalRenderDialog = finalRenderDialog;
m_Settings = m_Fractorium->m_Settings;
}
@ -55,7 +55,7 @@ void FinalRenderEmberControllerBase::CancelRender()
while (m_Result.isRunning())
QApplication::processEvents();
m_FinalRender->ui.FinalRenderTextOutput->append("Render canceled.");
m_FinalRenderDialog->ui.FinalRenderTextOutput->append("Render canceled.");
}
}
@ -66,14 +66,23 @@ void FinalRenderEmberControllerBase::CancelRender()
/// <returns>True if a valid renderer is created or if no action is taken, else false.</returns>
bool FinalRenderEmberControllerBase::CreateRendererFromGUI()
{
bool useOpenCL = m_Wrapper.CheckOpenCL() && m_FinalRender->OpenCL();
bool useOpenCL = m_Wrapper.CheckOpenCL() && m_FinalRenderDialog->OpenCL();
return CreateRenderer(useOpenCL ? OPENCL_RENDERER : CPU_RENDERER,
m_FinalRender->PlatformIndex(),
m_FinalRender->DeviceIndex(),
m_FinalRenderDialog->PlatformIndex(),
m_FinalRenderDialog->DeviceIndex(),
false);//Not shared.
}
/// <summary>
/// Thin wrapper around invoking a call to append text to the output.
/// </summary>
/// <param name="s">The string to append</param>
void FinalRenderEmberControllerBase::Output(const QString& s)
{
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderTextOutput, "append", Qt::QueuedConnection, Q_ARG(const QString&, s));
}
/// <summary>
/// Constructor which accepts a pointer to the final render dialog and passes it to the base.
/// The main final rendering lambda function is constructed here.
@ -86,7 +95,6 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
m_FinalPreviewRenderer = auto_ptr<EmberNs::Renderer<T, T>>(new EmberNs::Renderer<T, T>());
m_FinalPreviewRenderer->Callback(NULL);
m_FinalPreviewRenderer->NumChannels(4);
m_FinalPreviewRenderer->ReclaimOnResize(true);
m_FinalPreviewRenderFunc = [&]()
{
@ -94,38 +102,43 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
m_PreviewRun = true;
m_FinalPreviewRenderer->Abort();
QLabel* widget = m_FinalRender->ui.FinalRenderPreviewLabel;
unsigned int maxDim = 100u;
QLabel* widget = m_FinalRenderDialog->ui.FinalRenderPreviewLabel;
size_t maxDim = 100;
T scalePercentage;
//Determine how to scale the scaled ember to fit in the label with a max of 100x100.
if (m_Ember.m_FinalRasW >= m_Ember.m_FinalRasH)
scalePercentage = T(maxDim) / m_Ember.m_FinalRasW;
if (m_Ember->m_FinalRasW >= m_Ember->m_FinalRasH)
scalePercentage = T(maxDim) / m_Ember->m_FinalRasW;
else
scalePercentage = T(maxDim) / m_Ember.m_FinalRasH;
scalePercentage = T(maxDim) / m_Ember->m_FinalRasH;
m_PreviewEmber = m_Ember;
m_PreviewEmber = *m_Ember;
m_PreviewEmber.m_Quality = 100;
m_PreviewEmber.m_TemporalSamples = 1;
m_PreviewEmber.m_FinalRasW = min(maxDim, unsigned int(scalePercentage * m_Ember.m_FinalRasW));
m_PreviewEmber.m_FinalRasH = min(maxDim, unsigned int(scalePercentage * m_Ember.m_FinalRasH));
m_PreviewEmber.m_PixelsPerUnit = scalePercentage * m_Ember.m_PixelsPerUnit;
m_PreviewEmber.m_FinalRasW = max<size_t>(1, min<size_t>(maxDim, size_t(scalePercentage * m_Ember->m_FinalRasW)));//Ensure neither is zero.
m_PreviewEmber.m_FinalRasH = max<size_t>(1, min<size_t>(maxDim, size_t(scalePercentage * m_Ember->m_FinalRasH)));
m_PreviewEmber.m_PixelsPerUnit = scalePercentage * m_Ember->m_PixelsPerUnit;
while (!m_FinalPreviewRenderer->Aborted() || m_FinalPreviewRenderer->InRender())
QApplication::processEvents();
m_FinalPreviewRenderer->EarlyClip(m_FinalRender->EarlyClip());
m_FinalPreviewRenderer->YAxisUp(m_FinalRender->YAxisUp());
m_FinalPreviewRenderer->Transparency(m_FinalRender->Transparency());
m_FinalPreviewRenderer->EarlyClip(m_FinalRenderDialog->EarlyClip());
m_FinalPreviewRenderer->YAxisUp(m_FinalRenderDialog->YAxisUp());
m_FinalPreviewRenderer->Transparency(m_FinalRenderDialog->Transparency());
m_FinalPreviewRenderer->SetEmber(m_PreviewEmber);
m_FinalPreviewRenderer->PrepFinalAccumVector(m_PreviewFinalImage);//Must manually call this first because it could be erroneously made smaller due to strips if called inside Renderer::Run().
if (m_FinalPreviewRenderer->Run(m_PreviewFinalImage) == RENDER_OK)
{
QImage image(m_PreviewEmber.m_FinalRasW, m_PreviewEmber.m_FinalRasH, QImage::Format_RGBA8888);//The label wants RGBA.
memcpy(image.scanLine(0), m_PreviewFinalImage.data(), m_PreviewFinalImage.size() * sizeof(m_PreviewFinalImage[0]));//Memcpy the data in.
QPixmap pixmap = QPixmap::fromImage(image);
QMetaObject::invokeMethod(widget, "setPixmap", Qt::QueuedConnection, Q_ARG(QPixmap, pixmap));
}
unsigned int strips = VerifyStrips(m_PreviewEmber.m_FinalRasH, m_FinalRenderDialog->Strips(),
[&](const string& s) { }, [&](const string& s) { }, [&](const string& s) { });
StripsRender<T>(m_FinalPreviewRenderer.get(), m_PreviewEmber, m_PreviewFinalImage, 0, strips, m_FinalRenderDialog->YAxisUp(),
[&](size_t strip) { },//Pre strip.
[&](size_t strip) { },//Post strip.
[&](size_t strip) { },//Error.
[&](Ember<T>& finalEmber)//Final strip.
{
QImage image(finalEmber.m_FinalRasW, 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));
});
m_PreviewRun = false;
m_PreviewCs.Leave();
@ -136,50 +149,53 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
//If it finishes successfully, delete the backup file.
m_FinalRenderFunc = [&]()
{
size_t i;
m_Run = true;
m_TotalTimer.Tic();//Begin timing for progress.
m_GuiState = m_FinalRender->State();//Cache render settings from the GUI before running.
m_FinishedImageCount = 0;
QFileInfo original(m_GuiState.m_Path);
QString backup = original.absolutePath() + QDir::separator() + m_GuiState.m_Prefix + original.completeBaseName() + m_GuiState.m_Suffix + "_backup.flame";
QMetaObject::invokeMethod(m_Fractorium, "OnActionSaveCurrentToOpenedFile", Qt::QueuedConnection, Q_ARG(bool, true));//First, save the current ember back to its opened file.
m_Fractorium->m_Controller->CopyEmber(m_Ember);
m_Fractorium->m_Controller->CopyEmberFile(m_EmberFile);//Copy the whole file, will take about 0.2ms per ember in the file.
m_TotalTimer.Tic();//Begin timing for progress of all operations.
size_t i;
m_GuiState = m_FinalRenderDialog->State();//Cache render settings from the GUI before running.
bool doAll = m_GuiState.m_DoAll && m_EmberFile.Size() > 1;
unsigned int currentStripForProgress = 0;//Sort of a hack to get the strip value to the progress function.
QString path = doAll ? ComposePath(QString::fromStdString(m_EmberFile.m_Embers[0].m_Name)) : ComposePath(Name());
QString backup = path + "_backup.flame";
//Save backup Xml.
if (m_GuiState.m_DoAll && m_EmberFile.m_Embers.size() > 1)
if (doAll)
m_XmlWriter.Save(backup.toStdString().c_str(), m_EmberFile.m_Embers, 0, true, false, true);
else
m_XmlWriter.Save(backup.toStdString().c_str(), m_Ember, 0, true, false, true);
m_XmlWriter.Save(backup.toStdString().c_str(), *m_Ember, 0, true, false, true);
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderTextOutput, "setText", Qt::QueuedConnection, Q_ARG(QString, "Begin rendering..."));
m_FinishedImageCount = 0;
m_Renderer->EarlyClip(m_GuiState.m_EarlyClip);
m_Renderer->YAxisUp(m_GuiState.m_YAxisUp);
m_Renderer->ThreadCount(m_GuiState.m_ThreadCount);
m_Renderer->Transparency(m_GuiState.m_Transparency);
m_Renderer->m_ProgressParameter = (void*)&currentStripForProgress;
if (m_GuiState.m_Path.endsWith(".png", Qt::CaseInsensitive) || m_Renderer->RendererType() == OPENCL_RENDERER)
if (path.endsWith(".png", Qt::CaseInsensitive) || m_Renderer->RendererType() == OPENCL_RENDERER)//This is creating the wrong thing.//TODO
m_Renderer->NumChannels(4);
else
m_Renderer->NumChannels(3);
m_GuiState.m_Strips = VerifyStrips(m_Ember->m_FinalRasH, m_GuiState.m_Strips,
[&](const string& s) { Output(QString::fromStdString(s)); },//Greater than height.
[&](const string& s) { Output(QString::fromStdString(s)); },//Mod height != 0.
[&](const string& s) { Output(QString::fromStdString(s) + "\n"); });//Final strips value to be set.
//The rendering process is different between doing a single image, and doing multiple.
if (m_GuiState.m_DoAll && m_EmberFile.m_Embers.size() > 1)
if (doAll)
{
m_ImageCount = m_EmberFile.m_Embers.size();
m_ImageCount = m_EmberFile.Size();
ResetProgress();
//Different action required for rendering as animation or not.
if (m_GuiState.m_DoSequence)
{
Ember<T>* firstEmber = &m_EmberFile.m_Embers[0];
//Need to loop through and set all w, h, q, ts, ss and t vals.
for (i = 0; i < m_EmberFile.m_Embers.size() && m_Run; i++)
for (i = 0; i < m_EmberFile.Size() && m_Run; i++)
{
Sync(m_EmberFile.m_Embers[i]);
SyncGuiToEmber(m_EmberFile.m_Embers[i], firstEmber->m_FinalRasW, firstEmber->m_FinalRasH);
if (i > 0)
{
@ -194,184 +210,145 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
m_EmberFile.m_Embers[i].m_TemporalSamples = m_GuiState.m_TemporalSamples;
}
//Not supporting strips with motion blur.
//Shouldn't be a problem because animations will be at max 4k x 4k which will take about 1.1GB
//even when using double precision, which most cards at the time of this writing already exceed.
m_GuiState.m_Strips = 1;
m_Renderer->SetEmber(m_EmberFile.m_Embers);//Copy all embers to the local storage inside the renderer.
//Render each image, cancelling if m_Run ever gets set to false.
for (i = 0; i < m_EmberFile.m_Embers.size() && m_Run; i++)
for (i = 0; i < m_EmberFile.Size() && m_Run; i++)
{
Output("Image " + ToString(m_FinishedImageCount) + ":\n" + ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name)));
m_Renderer->Reset();//Have to manually set this since the ember is not set each time through.
m_RenderTimer.Tic();//Toc() is called in the progress function.
m_RenderTimer.Tic();//Toc() is called in RenderComplete().
if (m_Renderer->Run(m_FinalImage, i) != RENDER_OK)
StripsRender<T>(m_Renderer.get(), m_EmberFile.m_Embers[i], m_FinalImage, i, m_GuiState.m_Strips, m_GuiState.m_YAxisUp,
[&](size_t strip) { currentStripForProgress = strip; },//Pre strip.
[&](size_t strip) { m_Stats = m_Renderer->Stats(); },//Post strip.
[&](size_t strip)//Error.
{
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderTextOutput, "append", Qt::QueuedConnection, Q_ARG(QString, "Renderering failed.\n"));
m_Fractorium->ErrorReportToQTextEdit(m_Renderer->ErrorReport(), m_FinalRender->ui.FinalRenderTextOutput, false);
}
Output("Renderering failed.\n");
m_Fractorium->ErrorReportToQTextEdit(m_Renderer->ErrorReport(), m_FinalRenderDialog->ui.FinalRenderTextOutput, false);//Internally calls invoke.
},
[&](Ember<T>& finalEmber) { RenderComplete(finalEmber); });//Final strip.
}
}
else//Render all images, but not as an animation sequence (without temporal samples motion blur).
{
//Copy widget values to all embers
for (i = 0; i < m_EmberFile.m_Embers.size() && m_Run; i++)
for (i = 0; i < m_EmberFile.Size() && m_Run; i++)
{
Sync(m_EmberFile.m_Embers[i]);
m_EmberFile.m_Embers[i].m_TemporalSamples = 1;//No temporal sampling.
}
//Render each image, cancelling if m_Run ever gets set to false.
for (i = 0; i < m_EmberFile.m_Embers.size() && m_Run; i++)
for (i = 0; i < m_EmberFile.Size() && m_Run; i++)
{
Output("Image " + ToString(m_FinishedImageCount) + ":\n" + ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name)));
m_Renderer->SetEmber(m_EmberFile.m_Embers[i]);
m_RenderTimer.Tic();//Toc() is called in the progress function.
m_Renderer->PrepFinalAccumVector(m_FinalImage);//Must manually call this first because it could be erroneously made smaller due to strips if called inside Renderer::Run().
m_Stats.Clear();
Memset(m_FinalImage);
m_RenderTimer.Tic();//Toc() is called in RenderComplete().
if (m_Renderer->Run(m_FinalImage) != RENDER_OK)
StripsRender<T>(m_Renderer.get(), m_EmberFile.m_Embers[i], m_FinalImage, 0, m_GuiState.m_Strips, m_GuiState.m_YAxisUp,
[&](size_t strip) { currentStripForProgress = strip; },//Pre strip.
[&](size_t strip) { m_Stats += m_Renderer->Stats(); },//Post strip.
[&](size_t strip)//Error.
{
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderTextOutput, "append", Qt::QueuedConnection, Q_ARG(QString, "Renderering failed.\n"));
m_Fractorium->ErrorReportToQTextEdit(m_Renderer->ErrorReport(), m_FinalRender->ui.FinalRenderTextOutput, false);
}
Output("Renderering failed.\n");
m_Fractorium->ErrorReportToQTextEdit(m_Renderer->ErrorReport(), m_FinalRenderDialog->ui.FinalRenderTextOutput, false);//Internally calls invoke.
},
[&](Ember<T>& finalEmber) { RenderComplete(finalEmber); });//Final strip.
}
}
}
else//Render a single image.
{
m_ImageCount = 1;
Sync(m_Ember);
ResetProgress();
m_Ember.m_TemporalSamples = 1;
m_Renderer->SetEmber(m_Ember);
memset(m_FinalImage.data(), 0, m_FinalImage.size() * sizeof(m_FinalImage[0]));
m_RenderTimer.Tic();//Toc() is called in the progress function.
if (m_Renderer->Run(m_FinalImage) != RENDER_OK)
m_Ember->m_TemporalSamples = 1;
m_Renderer->SetEmber(*m_Ember);
m_Renderer->PrepFinalAccumVector(m_FinalImage);//Must manually call this first because it could be erroneously made smaller due to strips if called inside Renderer::Run().
m_Stats.Clear();
Memset(m_FinalImage);
Output(ComposePath(QString::fromStdString(m_Ember->m_Name)));
m_RenderTimer.Tic();//Toc() is called in RenderComplete().
StripsRender<T>(m_Renderer.get(), *m_Ember, m_FinalImage, 0, m_GuiState.m_Strips, m_GuiState.m_YAxisUp,
[&](size_t strip) { currentStripForProgress = strip; },//Pre strip.
[&](size_t strip) { m_Stats += m_Renderer->Stats(); },//Post strip.
[&](size_t strip)//Error.
{
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderTextOutput, "append", Qt::QueuedConnection, Q_ARG(QString, "Renderering failed.\n"));
m_Fractorium->ErrorReportToQTextEdit(m_Renderer->ErrorReport(), m_FinalRender->ui.FinalRenderTextOutput, false);
}
Output("Renderering failed.\n");
m_Fractorium->ErrorReportToQTextEdit(m_Renderer->ErrorReport(), m_FinalRenderDialog->ui.FinalRenderTextOutput, false);//Internally calls invoke.
},
[&](Ember<T>& finalEmber) { RenderComplete(finalEmber); });//Final strip.
}
QString totalTimeString = "All renders completed in: " + QString::fromStdString(m_TotalTimer.Format(m_TotalTimer.Toc())) + ".";
Output(totalTimeString);
QFile::remove(backup);
m_Run = false;
};
}
/// <summary>
/// Virtual functions overridden from FractoriumEmberControllerBase.
/// </summary>
/// <summary>
/// Setters for embers and ember files which convert between float and double types.
/// These are used to preserve the current ember/file when switching between renderers.
/// Note that some precision will be lost when going from double to float.
/// </summary>
template <typename T> void FinalRenderEmberController<T>::SetEmber(const Ember<float>& ember, bool verbatim) { m_Ember = ember; }
template <typename T> void FinalRenderEmberController<T>::CopyEmber(Ember<float>& ember) { ember = m_Ember; }
template <typename T> void FinalRenderEmberController<T>::SetEmberFile(const EmberFile<float>& emberFile) { m_EmberFile = emberFile; }
template <typename T> void FinalRenderEmberController<T>::CopyEmberFile(EmberFile<float>& emberFile) { emberFile = m_EmberFile; }
template <typename T> void FinalRenderEmberController<T>::SetOriginalEmber(Ember<float>& ember) { m_OriginalEmber = ember; }
template <typename T> double FinalRenderEmberController<T>::OriginalAspect() { return double(m_OriginalEmber.m_OrigFinalRasW) / m_OriginalEmber.m_OrigFinalRasH; }
template <typename T> void FinalRenderEmberController<T>::SetEmberFile(const EmberFile<float>& emberFile)
{
m_EmberFile = emberFile;
if (m_EmberFile.Size())
m_Ember = &(m_EmberFile.m_Embers[0]);
}
template <typename T> void FinalRenderEmberController<T>::CopyEmberFile(EmberFile<float>& emberFile, std::function<void(Ember<float>& ember)> perEmberOperation)
{
emberFile.m_Filename = m_EmberFile.m_Filename;
CopyVec(emberFile.m_Embers, m_EmberFile.m_Embers, perEmberOperation);
}
#ifdef DO_DOUBLE
template <typename T> void FinalRenderEmberController<T>::SetEmber(const Ember<double>& ember, bool verbatim) { m_Ember = ember; }
template <typename T> void FinalRenderEmberController<T>::CopyEmber(Ember<double>& ember) { ember = m_Ember; }
template <typename T> void FinalRenderEmberController<T>::SetEmberFile(const EmberFile<double>& emberFile) { m_EmberFile = emberFile; }
template <typename T> void FinalRenderEmberController<T>::CopyEmberFile(EmberFile<double>& emberFile) { emberFile = m_EmberFile; }
template <typename T> void FinalRenderEmberController<T>::SetOriginalEmber(Ember<double>& ember) { m_OriginalEmber = ember; }
template <typename T> void FinalRenderEmberController<T>::SetEmberFile(const EmberFile<double>& emberFile)
{
m_EmberFile = emberFile;
if (m_EmberFile.Size())
m_Ember = &(m_EmberFile.m_Embers[0]);
}
template <typename T> void FinalRenderEmberController<T>::CopyEmberFile(EmberFile<double>& emberFile, std::function<void(Ember<double>& ember)> perEmberOperation)
{
emberFile.m_Filename = m_EmberFile.m_Filename;
CopyVec(emberFile.m_Embers, m_EmberFile.m_Embers, perEmberOperation);
}
#endif
/// <summary>
/// Progress function.
/// Take special action to sync options upon finishing.
/// Set the ember at the specified index from the currently opened file as the current Ember.
/// Clears the undo state.
/// Resets the rendering process.
/// </summary>
/// <param name="ember">The ember currently being rendered</param>
/// <param name="foo">An extra dummy parameter</param>
/// <param name="fraction">The progress fraction from 0-100</param>
/// <param name="stage">The stage of iteration. 1 is iterating, 2 is density filtering, 2 is final accumulation.</param>
/// <param name="etaMs">The estimated milliseconds to completion of the current stage</param>
/// <returns>0 if the user has clicked cancel, else 1 to continue rendering.</returns>
/// <param name="index">The index in the file from which to retrieve the ember</param>
template <typename T>
int FinalRenderEmberController<T>::ProgressFunc(Ember<T>& ember, void* foo, double fraction, int stage, double etaMs)
void FinalRenderEmberController<T>::SetEmber(size_t index)
{
static int count = 0;
int intFract = (int)fraction;
if (stage == 0)
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderIterationProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, intFract));
else if (stage == 1)
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderFilteringProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, intFract));
else if (stage == 2)
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderAccumProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, intFract));
//Finished, so take special action.
if (stage == 2 && intFract == 100)
if (index < m_EmberFile.Size())
{
string renderTimeString = m_RenderTimer.Format(m_RenderTimer.Toc()), totalTimeString;
QString status, filename = m_GuiState.m_Path;
QFileInfo original(filename);
EmberStats stats = m_Renderer->Stats();
QString iters = QLocale(QLocale::English).toString(stats.m_Iters);
QString itersPerSec = QLocale(QLocale::English).toString(unsigned __int64(stats.m_Iters / (stats.m_IterMs / 1000.0)));
if (m_GuiState.m_DoAll && m_EmberFile.m_Embers.size() > 1)
filename = original.absolutePath() + QDir::separator() + m_GuiState.m_Prefix + QString::fromStdString(m_EmberFile.m_Embers[m_FinishedImageCount].m_Name) + m_GuiState.m_Suffix + "." + m_GuiState.m_DoAllExt;
else
filename = original.absolutePath() + QDir::separator() + m_GuiState.m_Prefix + original.completeBaseName() + m_GuiState.m_Suffix + "." + original.suffix();
filename = EmberFile<T>::UniqueFilename(filename);
//Save whatever options were specified on the GUI to the settings.
m_Settings->FinalEarlyClip(m_GuiState.m_EarlyClip);
m_Settings->FinalYAxisUp(m_GuiState.m_YAxisUp);
m_Settings->FinalTransparency(m_GuiState.m_Transparency);
m_Settings->FinalOpenCL(m_GuiState.m_OpenCL);
m_Settings->FinalDouble(m_GuiState.m_Double);
m_Settings->FinalPlatformIndex(m_GuiState.m_PlatformIndex);
m_Settings->FinalDeviceIndex(m_GuiState.m_DeviceIndex);
m_Settings->FinalSaveXml(m_GuiState.m_SaveXml);
m_Settings->FinalDoAll(m_GuiState.m_DoAll);
m_Settings->FinalDoSequence(m_GuiState.m_DoSequence);
m_Settings->FinalKeepAspect(m_GuiState.m_KeepAspect);
m_Settings->FinalScale(m_GuiState.m_Scale);
m_Settings->FinalDoAllExt(m_GuiState.m_DoAllExt);
m_Settings->FinalThreadCount(m_GuiState.m_ThreadCount);
m_Settings->FinalWidth(m_GuiState.m_Width);
m_Settings->FinalHeight(m_GuiState.m_Height);
m_Settings->FinalQuality(m_GuiState.m_Quality);
m_Settings->FinalTemporalSamples(m_GuiState.m_TemporalSamples);
m_Settings->FinalSupersample(m_GuiState.m_Supersample);
SaveCurrentRender(filename);
if (m_GuiState.m_SaveXml)
{
QFileInfo xmlFileInfo(filename);//Create another one in case it was modified for batch rendering.
QString newPath = xmlFileInfo.absolutePath() + QDir::separator() + xmlFileInfo.completeBaseName() + ".flame";
xmlDocPtr tempEdit = ember.m_Edits;
ember.m_Edits = m_XmlWriter.CreateNewEditdoc(&ember, NULL, "edit", m_Settings->Nick().toStdString(), m_Settings->Url().toStdString(), m_Settings->Id().toStdString(), "", 0, 0);
m_XmlWriter.Save(newPath.toStdString().c_str(), ember, 0, true, false, true);//Note that the ember passed is used, rather than m_Ember because it's what was actually rendered.
if (tempEdit != NULL)
xmlFreeDoc(tempEdit);
}
m_FinishedImageCount++;
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderIterationProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 100));//Just to be safe.
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderFilteringProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 100));
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderAccumProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 100));
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderTotalProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, int(((float)m_FinishedImageCount / (float)m_ImageCount) * 100)));
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderImageCountLabel, "setText", Qt::QueuedConnection, Q_ARG(QString, QString::number(m_FinishedImageCount) + " / " + QString::number(m_ImageCount)));
status = "Image " + QString::number(m_FinishedImageCount) + ":\nPure render time: " + QString::fromStdString(renderTimeString);
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderTextOutput, "append", Qt::QueuedConnection, Q_ARG(QString, status));
totalTimeString = m_TotalTimer.Format(m_TotalTimer.Toc());
status = "Total render time: " + QString::fromStdString(totalTimeString) + "\nTotal iters: " + iters + "\nIters/second: " + itersPerSec + "\n";
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderTextOutput, "append", Qt::QueuedConnection, Q_ARG(QString, status));
QMetaObject::invokeMethod(m_FinalRender, "MoveCursorToEnd", Qt::QueuedConnection);
if (m_FinishedImageCount != m_ImageCount)
{
ResetProgress(false);
}
m_Ember = &(m_EmberFile.m_Embers[index]);
SyncCurrentToGui();
}
else
{
m_Ember = &(m_EmberFile.m_Embers[0]);//Should never happen.
}
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderTextOutput, "update", Qt::QueuedConnection);
QApplication::processEvents();
return m_Run ? 1 : 0;
}
/// <summary>
@ -382,17 +359,17 @@ int FinalRenderEmberController<T>::ProgressFunc(Ember<T>& ember, void* foo, doub
template<typename T>
bool FinalRenderEmberController<T>::Render()
{
QString filename = m_FinalRender->Path();
QString filename = m_FinalRenderDialog->Path();
if (filename == "")
{
QMessageBox::critical(m_FinalRender, "File Error", "Please enter a valid path and filename for the output.");
m_Fractorium->ShowCritical("File Error", "Please enter a valid path and filename for the output.");
return false;
}
if (CreateRendererFromGUI())
{
m_FinalRender->ui.FinalRenderTextOutput->clear();
m_FinalRenderDialog->ui.FinalRenderTextOutput->setText("Preparing all parameters.\n");
//Note that a Qt thread must be used, rather than a tbb task.
//This is because tbb does a very poor job of allocating thread resources
@ -422,8 +399,7 @@ bool FinalRenderEmberController<T>::CreateRenderer(eRendererType renderType, uns
{
bool ok = true;
vector<string> errorReport;
QString filename = m_FinalRender->Path();
unsigned int channels = filename.endsWith(".png", Qt::CaseInsensitive) ? 4 : 3;
unsigned int channels = m_FinalRenderDialog->Ext() == "png" ? 4 : 3;
CancelRender();
@ -441,14 +417,14 @@ bool FinalRenderEmberController<T>::CreateRenderer(eRendererType renderType, uns
m_Device = device;
m_OutputTexID = 0;//Don't care about tex ID when doing final render.
m_Shared = shared;
m_Renderer = auto_ptr<EmberNs::RendererBase>(::CreateRenderer<T, T>(renderType, platform, device, shared, m_OutputTexID, emberReport));
errorReport = emberReport.ErrorReport();
if (!errorReport.empty())
{
ok = false;
QMessageBox::critical(m_Fractorium, "Renderer Creation Error", "Could not create requested renderer, fallback CPU renderer created. See info tab for details.");
m_Fractorium->ShowCritical("Renderer Creation Error", "Could not create requested renderer, fallback CPU renderer created. See info tab for details.");
m_Fractorium->ErrorReportToQTextEdit(errorReport, m_Fractorium->ui.InfoRenderingTextEdit);
}
}
@ -460,50 +436,109 @@ bool FinalRenderEmberController<T>::CreateRenderer(eRendererType renderType, uns
m_Renderer->Callback(this);
m_Renderer->NumChannels(channels);
m_Renderer->ReclaimOnResize(true);
m_Renderer->EarlyClip(m_FinalRender->EarlyClip());
m_Renderer->YAxisUp(m_FinalRender->YAxisUp());
m_Renderer->ThreadCount(m_FinalRender->ThreadCount());
m_Renderer->Transparency(m_FinalRender->Transparency());
m_Renderer->EarlyClip(m_FinalRenderDialog->EarlyClip());
m_Renderer->YAxisUp(m_FinalRenderDialog->YAxisUp());
m_Renderer->ThreadCount(m_FinalRenderDialog->ThreadCount());
m_Renderer->Transparency(m_FinalRenderDialog->Transparency());
}
else
{
ok = false;
QMessageBox::critical(m_FinalRender, "Renderer Creation Error", "Could not create renderer, aborting. See info tab for details.");
m_Fractorium->ShowCritical("Renderer Creation Error", "Could not create renderer, aborting. See info tab for details.");
}
return ok;
}
/// <summary>
/// Set various parameters in the renderer and current ember with the values
/// specified in the widgets and compute the amount of memory required to render.
/// This includes the memory needed for the final output image.
/// Progress function.
/// Take special action to sync options upon finishing.
/// </summary>
/// <returns>If successful, memory required in bytes, else zero.</returns>
/// <param name="ember">The ember currently being rendered</param>
/// <param name="foo">An extra dummy parameter</param>
/// <param name="fraction">The progress fraction from 0-100</param>
/// <param name="stage">The stage of iteration. 1 is iterating, 2 is density filtering, 2 is final accumulation.</param>
/// <param name="etaMs">The estimated milliseconds to completion of the current stage</param>
/// <returns>0 if the user has clicked cancel, else 1 to continue rendering.</returns>
template <typename T>
unsigned __int64 FinalRenderEmberController<T>::SyncAndComputeMemory()
int FinalRenderEmberController<T>::ProgressFunc(Ember<T>& ember, void* foo, double fraction, int stage, double etaMs)
{
if (m_Renderer.get())
{
bool b = false;
QString filename = m_FinalRender->Path();
unsigned int channels = filename.endsWith(".png", Qt::CaseInsensitive) ? 4 : 3;//4 channels for Png, else 3.
static int count = 0;
unsigned int strip = *((unsigned int*)m_Renderer->m_ProgressParameter);
double fracPerStrip = ceil(100.0 / m_GuiState.m_Strips);
double stripsfrac = ceil(fracPerStrip * strip) + ceil(fraction / m_GuiState.m_Strips);
int intFract = (int)stripsfrac;
Sync(m_Ember);
m_Renderer->SetEmber(m_Ember);
m_Renderer->CreateSpatialFilter(b);
m_Renderer->CreateTemporalFilter(b);
m_Renderer->NumChannels(channels);
m_Renderer->ComputeBounds();
CancelPreviewRender();
//m_FinalPreviewResult = QtConcurrent::run(m_PreviewRenderFunc);
//while (!m_FinalPreviewResult.isRunning()) { QApplication::processEvents(); }//Wait for it to start up.
m_FinalPreviewRenderFunc();
return m_Renderer->MemoryRequired(true);
if (stage == 0)
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderIterationProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, intFract));
else if (stage == 1)
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderFilteringProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, intFract));
else if (stage == 2)
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderAccumProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, intFract));
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderTextOutput, "update", Qt::QueuedConnection);
//QApplication::processEvents();
return m_Run ? 1 : 0;
}
/// <summary>
/// Virtual functions overridden from FinalRenderEmberControllerBase.
/// </summary>
/// <summary>
/// Copy current ember values to widgets.
/// </summary>
template <typename T>
void FinalRenderEmberController<T>::SyncCurrentToGui()
{
SyncCurrentToSizeSpinners(true, true);
m_FinalRenderDialog->ui.FinalRenderCurrentSpin->setSuffix(" " + Name());
m_FinalRenderDialog->Scale(m_Ember->ScaleType());
m_FinalRenderDialog->m_QualitySpin->SetValueStealth(m_Ember->m_Quality);
m_FinalRenderDialog->m_SupersampleSpin->SetValueStealth(m_Ember->m_Supersample);
m_FinalRenderDialog->Path(ComposePath(EmberFile<T>::UniqueFilename(Name())));
}
/// <summary>
/// Copy GUI values to either the current ember, or all embers in the file
/// depending on whether Render All is checked.
/// </summary>
/// <param name="widthOverride">Width override to use instead of scaling the original width</param>
/// <param name="heightOverride">Height override to use instead of scaling the original height</param>
template <typename T>
void FinalRenderEmberController<T>::SyncGuiToEmbers(size_t widthOverride, size_t heightOverride)
{
if (m_FinalRenderDialog->ApplyToAll())
{
for (size_t i = 0; i < m_EmberFile.Size(); i++)
SyncGuiToEmber(m_EmberFile.m_Embers[i], widthOverride, heightOverride);
}
else
{
SyncGuiToEmber(*m_Ember, widthOverride, heightOverride);
}
}
/// <summary>
/// Set values for scale spinners based on the ratio of the original dimensions to the current dimensions
/// of the current ember. Also update the size suffix text.
/// </summary>
/// <param name="scale">Whether to update the scale values</param>
/// <param name="size">Whether to update the size suffix text</param>
template <typename T>
void FinalRenderEmberController<T>::SyncCurrentToSizeSpinners(bool scale, bool size)
{
if (scale)
{
m_FinalRenderDialog->m_WidthScaleSpin->SetValueStealth((double)m_Ember->m_FinalRasW / m_Ember->m_OrigFinalRasW);//Work backward to determine the scale.
m_FinalRenderDialog->m_HeightScaleSpin->SetValueStealth((double)m_Ember->m_FinalRasH / m_Ember->m_OrigFinalRasH);
}
return 0;
if (size)
{
m_FinalRenderDialog->m_WidthScaleSpin->setSuffix(" (" + ToString(m_Ember->m_FinalRasW) + ")");
m_FinalRenderDialog->m_HeightScaleSpin->setSuffix(" (" + ToString(m_Ember->m_FinalRasH) + ")");
}
}
/// <summary>
@ -515,15 +550,67 @@ void FinalRenderEmberController<T>::ResetProgress(bool total)
{
if (total)
{
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderImageCountLabel, "setText", Qt::QueuedConnection, Q_ARG(QString, "0 / " + QString::number(m_ImageCount)));
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderTotalProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 0));
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderImageCountLabel, "setText", Qt::QueuedConnection, Q_ARG(const QString&, "0 / " + ToString(m_ImageCount)));
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderTotalProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 0));
}
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderIterationProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 0));
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderFilteringProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 0));
QMetaObject::invokeMethod(m_FinalRender->ui.FinalRenderAccumProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 0));
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderIterationProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 0));
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderFilteringProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 0));
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderAccumProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 0));
}
/// <summary>
/// Set various parameters in the renderer and current ember with the values
/// specified in the widgets and compute the amount of memory required to render.
/// This includes the memory needed for the final output image.
/// </summary>
/// <returns>If successful, memory required in bytes, else zero.</returns>
template <typename T>
size_t FinalRenderEmberController<T>::SyncAndComputeMemory()
{
if (m_Renderer.get())
{
bool b = false;
unsigned int channels = m_FinalRenderDialog->Ext() == "png" ? 4 : 3;//4 channels for Png, else 3.
SyncGuiToEmbers();
m_Renderer->SetEmber(*m_Ember);
m_Renderer->CreateSpatialFilter(b);
m_Renderer->CreateTemporalFilter(b);
m_Renderer->NumChannels(channels);
m_Renderer->ComputeBounds();
CancelPreviewRender();
m_FinalPreviewRenderFunc();
return m_Renderer->MemoryRequired(m_FinalRenderDialog->Strips(), true);
}
return 0;
}
/// <summary>
/// Compose a final output path given a base name.
/// This includes the base path, the prefix, the name, the suffix and the
/// extension.
/// </summary>
/// <param name="name">The base filename to compose a full path for</param>
/// <returns>The fully composed path</returns>
template <typename T>
QString FinalRenderEmberController<T>::ComposePath(const QString& name)
{
QString path = MakeEnd(m_Settings->SaveFolder(), '/');//Base path.
QString full = path + m_FinalRenderDialog->Prefix() + name + m_FinalRenderDialog->Suffix() + "." + m_FinalRenderDialog->Ext();
return full;
}
/// <summary>
/// Non-virtual functions declared in FinalRenderEmberController<T>.
/// </summary>
/// <summary>
/// Stop the preview renderer.
/// This is meant to only be called programatically and never by the user.
/// </summary>
template <typename T>
void FinalRenderEmberController<T>::CancelPreviewRender()
{
@ -534,23 +621,105 @@ void FinalRenderEmberController<T>::CancelPreviewRender()
while (m_FinalPreviewResult.isRunning()) { QApplication::processEvents(); }
}
/// <summary>
/// Action to take when rendering an image completes.
/// </summary>
/// <param name="ember">The ember currently being rendered</param>
template<typename T>
void FinalRenderEmberController<T>::RenderComplete(Ember<T>& ember)
{
string renderTimeString = m_RenderTimer.Format(m_RenderTimer.Toc()), totalTimeString;
QString status, filename = ComposePath(EmberFile<T>::UniqueFilename(QString::fromStdString(ember.m_Name)));
QString itersString = ToString(m_Stats.m_Iters);
QString itersPerSecString = ToString(size_t(m_Stats.m_Iters / (m_Stats.m_IterMs / 1000.0)));
//Save whatever options were specified on the GUI to the settings.
m_Settings->FinalEarlyClip(m_GuiState.m_EarlyClip);
m_Settings->FinalYAxisUp(m_GuiState.m_YAxisUp);
m_Settings->FinalTransparency(m_GuiState.m_Transparency);
m_Settings->FinalOpenCL(m_GuiState.m_OpenCL);
m_Settings->FinalDouble(m_GuiState.m_Double);
m_Settings->FinalPlatformIndex(m_GuiState.m_PlatformIndex);
m_Settings->FinalDeviceIndex(m_GuiState.m_DeviceIndex);
m_Settings->FinalSaveXml(m_GuiState.m_SaveXml);
m_Settings->FinalDoAll(m_GuiState.m_DoAll);
m_Settings->FinalDoSequence(m_GuiState.m_DoSequence);
m_Settings->FinalKeepAspect(m_GuiState.m_KeepAspect);
m_Settings->FinalScale(m_GuiState.m_Scale);
m_Settings->FinalExt(m_GuiState.m_Ext);
m_Settings->FinalThreadCount(m_GuiState.m_ThreadCount);
m_Settings->FinalQuality(m_GuiState.m_Quality);
m_Settings->FinalTemporalSamples(m_GuiState.m_TemporalSamples);
m_Settings->FinalSupersample(m_GuiState.m_Supersample);
m_Settings->FinalStrips(m_GuiState.m_Strips);
SaveCurrentRender(filename, false);//Don't pull from the card, the rendering process already did it.
if (m_GuiState.m_SaveXml)
{
QFileInfo xmlFileInfo(filename);//Create another one in case it was modified for batch rendering.
QString newPath = xmlFileInfo.absolutePath() + '/' + xmlFileInfo.completeBaseName() + ".flame";
xmlDocPtr tempEdit = ember.m_Edits;
ember.m_Edits = m_XmlWriter.CreateNewEditdoc(&ember, NULL, "edit", m_Settings->Nick().toStdString(), m_Settings->Url().toStdString(), m_Settings->Id().toStdString(), "", 0, 0);
m_XmlWriter.Save(newPath.toStdString().c_str(), ember, 0, true, false, true);//Note that the ember passed is used, rather than m_Ember because it's what was actually rendered.
if (tempEdit != NULL)
xmlFreeDoc(tempEdit);
}
m_FinishedImageCount++;
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderIterationProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 100));//Just to be safe.
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderFilteringProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 100));
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderAccumProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 100));
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderTotalProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, int(((float)m_FinishedImageCount / (float)m_ImageCount) * 100)));
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderImageCountLabel, "setText", Qt::QueuedConnection, Q_ARG(const QString&, ToString(m_FinishedImageCount) + " / " + ToString(m_ImageCount)));
status = "Pure render time: " + QString::fromStdString(renderTimeString);
Output(status);
totalTimeString = m_RenderTimer.Format(m_RenderTimer.Toc());
status = "Total time: " + QString::fromStdString(totalTimeString) + "\nTotal iters: " + itersString + "\nIters/second: " + itersPerSecString + "\n";
Output(status);
QMetaObject::invokeMethod(m_FinalRenderDialog, "MoveCursorToEnd", Qt::QueuedConnection);
if (m_FinishedImageCount != m_ImageCount)
{
ResetProgress(false);
}
QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderTextOutput, "update", Qt::QueuedConnection);
}
/// <summary>
/// Copy widget values to the ember passed in.
/// </summary>
/// <param name="ember">The ember whose values will be modified</param>
/// <param name="widthOverride">Width override to use instead of scaling the original width</param>
/// <param name="heightOverride">Height override to use instead of scaling the original height</param>
template <typename T>
void FinalRenderEmberController<T>::Sync(Ember<T>& ember)
void FinalRenderEmberController<T>::SyncGuiToEmber(Ember<T>& ember, size_t widthOverride, size_t heightOverride)
{
int w = m_FinalRender->m_WidthSpin->value();
int h = m_FinalRender->m_HeightSpin->value();
size_t w;
size_t h;
ember.m_FinalRasW = m_OriginalEmber.m_OrigFinalRasW;//Scale is always in terms of the original dimensions of the ember in the editor.
ember.m_FinalRasH = m_OriginalEmber.m_OrigFinalRasH;
ember.m_PixelsPerUnit = m_OriginalEmber.m_PixelsPerUnit;
ember.SetSizeAndAdjustScale(w, h, false, m_FinalRender->Scale());
ember.m_Quality = m_FinalRender->m_QualitySpin->value();
ember.m_Supersample = m_FinalRender->m_SupersampleSpin->value();
if (widthOverride && heightOverride)
{
w = widthOverride;
h = heightOverride;
}
else
{
double wScale = m_FinalRenderDialog->m_WidthScaleSpin->value();
double hScale = m_FinalRenderDialog->m_HeightScaleSpin->value();
if (m_FinalRender->ui.FinalRenderDoSequenceCheckBox->isChecked())
ember.m_TemporalSamples = m_FinalRender->m_TemporalSamplesSpin->value();
w = ember.m_OrigFinalRasW * wScale;
h = ember.m_OrigFinalRasH * hScale;
}
w = max<size_t>(w, 10);
h = max<size_t>(h, 10);
ember.SetSizeAndAdjustScale(w, h, false, m_FinalRenderDialog->Scale());
ember.m_Quality = m_FinalRenderDialog->m_QualitySpin->value();
ember.m_Supersample = m_FinalRenderDialog->m_SupersampleSpin->value();
}

View File

@ -31,17 +31,18 @@ struct FinalRenderGuiState
bool m_KeepAspect;
eScaleType m_Scale;
QString m_Path;
QString m_DoAllExt;
QString m_Ext;
QString m_Prefix;
QString m_Suffix;
unsigned int m_PlatformIndex;
unsigned int m_DeviceIndex;
unsigned int m_ThreadCount;
unsigned int m_Width;
unsigned int m_Height;
double m_WidthScale;
double m_HeightScale;
double m_Quality;
unsigned int m_TemporalSamples;
unsigned int m_Supersample;
unsigned int m_Strips;
};
/// <summary>
@ -55,20 +56,20 @@ class FinalRenderEmberControllerBase : public FractoriumEmberControllerBase
friend FractoriumFinalRenderDialog;
public:
FinalRenderEmberControllerBase(FractoriumFinalRenderDialog* finalRender);
FinalRenderEmberControllerBase(FractoriumFinalRenderDialog* finalRenderDialog);
virtual ~FinalRenderEmberControllerBase() { }
virtual unsigned __int64 SyncAndComputeMemory() { return 0; }
virtual QString Name() const { return ""; }
virtual void SyncCurrentToGui() { }
virtual void SyncGuiToEmbers(size_t widthOverride = 0, size_t heightOverride = 0) { }
virtual void SyncCurrentToSizeSpinners(bool scale, bool size) { }
virtual void ResetProgress(bool total = true) { }
virtual void SetOriginalEmber(Ember<float>& ember) { }
#ifdef DO_DOUBLE
virtual void SetOriginalEmber(Ember<double>& ember) { }
#endif
virtual size_t SyncAndComputeMemory() { return 0; }
virtual double OriginalAspect() { return 1; }
virtual QString ComposePath(const QString& name) { return ""; }
void CancelRender();
bool CreateRendererFromGUI();
void Output(const QString& s);
protected:
bool m_Run;
@ -82,7 +83,7 @@ protected:
std::function<void (void)> m_FinalPreviewRenderFunc;
FractoriumSettings* m_Settings;
FractoriumFinalRenderDialog* m_FinalRender;
FractoriumFinalRenderDialog* m_FinalRenderDialog;
FinalRenderGuiState m_GuiState;
OpenCLWrapper m_Wrapper;
CriticalSection m_PreviewCs;
@ -101,33 +102,36 @@ public:
FinalRenderEmberController(FractoriumFinalRenderDialog* finalRender);
virtual ~FinalRenderEmberController() { }
virtual void SetEmber(const Ember<float>& ember, bool verbatim = false);
virtual void CopyEmber(Ember<float>& ember);
virtual void SetEmberFile(const EmberFile<float>& emberFile);
virtual void CopyEmberFile(EmberFile<float>& emberFile);
virtual void SetOriginalEmber(Ember<float>& ember);
//Virtual functions overridden from FractoriumEmberControllerBase.
virtual void SetEmberFile(const EmberFile<float>& emberFile) override;
virtual void CopyEmberFile(EmberFile<float>& emberFile, std::function<void(Ember<float>& ember)> perEmberOperation = [&](Ember<float>& ember) { }) override;
#ifdef DO_DOUBLE
virtual void SetEmber(const Ember<double>& ember, bool verbatim = false);
virtual void CopyEmber(Ember<double>& ember);
virtual void SetEmberFile(const EmberFile<double>& emberFile);
virtual void CopyEmberFile(EmberFile<double>& emberFile);
virtual void SetOriginalEmber(Ember<double>& ember);
virtual void SetEmberFile(const EmberFile<double>& emberFile) override;
virtual void CopyEmberFile(EmberFile<double>& emberFile, std::function<void(Ember<double>& ember)> perEmberOperation = [&](Ember<double>& ember) { }) override;
#endif
virtual double OriginalAspect();
virtual int ProgressFunc(Ember<T>& ember, void* foo, double fraction, int stage, double etaMs);
virtual bool Render();
virtual bool CreateRenderer(eRendererType renderType, unsigned int platform, unsigned int device, bool shared = true);
virtual unsigned int SizeOfT() { return sizeof(T); }
virtual unsigned __int64 SyncAndComputeMemory();
virtual QString Name() const { return QString::fromStdString(m_Ember.m_Name); }
virtual void ResetProgress(bool total = true);
void CancelPreviewRender();
virtual void SetEmber(size_t index) override;
virtual bool Render() override;
virtual bool CreateRenderer(eRendererType renderType, unsigned int platform, unsigned int device, bool shared = true) override;
virtual int ProgressFunc(Ember<T>& ember, void* foo, double fraction, int stage, double etaMs) override;
virtual size_t Index() const override { return m_Ember->m_Index; }
virtual unsigned int SizeOfT() const override { return sizeof(T); }
//Virtual functions overridden from FinalRenderEmberControllerBase.
virtual void SyncCurrentToGui() override;
virtual void SyncGuiToEmbers(size_t widthOverride = 0, size_t heightOverride = 0) override;
virtual void SyncCurrentToSizeSpinners(bool scale, bool size) override;
virtual void ResetProgress(bool total = true) override;
virtual size_t SyncAndComputeMemory() override;
virtual double OriginalAspect() override { return double(m_Ember->m_OrigFinalRasW) / m_Ember->m_OrigFinalRasH; }
virtual QString Name() const override { return QString::fromStdString(m_Ember->m_Name); }
virtual QString ComposePath(const QString& name) override;
protected:
void Sync(Ember<T>& ember);
void CancelPreviewRender();
void RenderComplete(Ember<T>& ember);
void SyncGuiToEmber(Ember<T>& ember, size_t widthOverride = 0, size_t heightOverride = 0);
Ember<T> m_Ember;
Ember<T> m_OriginalEmber;
Ember<T>* m_Ember;
Ember<T> m_PreviewEmber;
EmberFile<T> m_EmberFile;
EmberToXml<T> m_XmlWriter;

View File

@ -165,18 +165,6 @@ Fractorium::~Fractorium()
m_Settings->sync();
}
/// <summary>
/// Stop the render timer and start the delayed restart timer.
/// This is a massive hack because Qt has no way of detecting when a resize event
/// is started and stopped. Detecting if mouse buttons down is also not an option
/// because the documentation says it gives the wrong result.
/// </summary>
void Fractorium::Resize()
{
if (!QCoreApplication::closingDown())
m_Controller->DelayedStartRenderTimer();
}
/// <summary>
/// Set the coordinate text in the status bar.
/// </summary>
@ -198,11 +186,9 @@ void Fractorium::SetCoordinateStatus(int x, int y, float worldX, float worldY)
template <typename T>
void FractoriumEmberController<T>::ApplyXmlSavingTemplate(Ember<T>& ember)
{
ember.m_FinalRasW = m_Fractorium->m_Settings->XmlWidth();
ember.m_FinalRasH = m_Fractorium->m_Settings->XmlHeight();
ember.m_TemporalSamples = m_Fractorium->m_Settings->XmlTemporalSamples();
ember.m_Quality = m_Fractorium->m_Settings->XmlQuality();
ember.m_Supersample = m_Fractorium->m_Settings->XmlSupersample();
ember.m_TemporalSamples = m_Fractorium->m_Settings->XmlTemporalSamples();
}
/// <summary>
@ -260,11 +246,13 @@ void Fractorium::dockLocationChanged(Qt::DockWidgetArea area)
/// </summary>
/// <summary>
/// Resize event, just pass to base.
/// Resize event, change width and height double click values to match the window size.
/// </summary>
/// <param name="e">The event</param>
void Fractorium::resizeEvent(QResizeEvent* e)
{
m_WidthSpin->DoubleClickNonZero(ui.GLParentScrollArea->width());
m_HeightSpin->DoubleClickNonZero(ui.GLParentScrollArea->height());
QMainWindow::resizeEvent(e);
}
@ -362,7 +350,7 @@ void Fractorium::dropEvent(QDropEvent* e)
void Fractorium::SetupCombo(QTableWidget* table, const QObject* receiver, int& row, int col, StealthComboBox*& comboBox, vector<string>& vals, const char* signal, const char* slot, Qt::ConnectionType connectionType)
{
comboBox = new StealthComboBox(table);
ForEach(vals, [&](string s) { comboBox->addItem(s.c_str()); });
ForEach(vals, [&](const string& s) { comboBox->addItem(s.c_str()); });
table->setCellWidget(row, col, comboBox);
connect(comboBox, signal, receiver, slot, connectionType);
row++;
@ -425,7 +413,7 @@ QStringList Fractorium::SetupOpenXmlDialog()
/// </summary>
/// <param name="defaultFilename">The default filename to populate the text box with</param>
/// <returns>The filename selected</returns>
QString Fractorium::SetupSaveXmlDialog(QString defaultFilename)
QString Fractorium::SetupSaveXmlDialog(const QString& defaultFilename)
{
//Lazy instantiate since it takes a long time.
if (!m_FileDialog)
@ -463,7 +451,7 @@ QString Fractorium::SetupSaveXmlDialog(QString defaultFilename)
/// </summary>
/// <param name="defaultFilename">The default filename to populate the text box with</param>
/// <returns>The filename selected</returns>
QString Fractorium::SetupSaveImageDialog(QString defaultFilename)
QString Fractorium::SetupSaveImageDialog(const QString& defaultFilename)
{
//Lazy instantiate since it takes a long time.
if (!m_FileDialog)
@ -502,7 +490,7 @@ QString Fractorium::SetupSaveImageDialog(QString defaultFilename)
/// Setup and show the save folder dialog.
/// This will perform lazy instantiation.
/// </summary>
/// <returns>The folder selected</returns>
/// <returns>The folder selected, with '/' appended to the end</returns>
QString Fractorium::SetupSaveFolderDialog()
{
//Lazy instantiate since it takes a long time.
@ -528,11 +516,28 @@ QString Fractorium::SetupSaveFolderDialog()
m_FolderDialog->setDirectory(m_Settings->SaveFolder());
if (m_FolderDialog->exec() == QDialog::Accepted)
filename = m_FolderDialog->selectedFiles().value(0);
{
filename = MakeEnd(m_FolderDialog->selectedFiles().value(0), '/');
}
return filename;
}
/// <summary>
/// Thin wrapper around QMessageBox::critical() to allow it to be invoked from another thread.
/// </summary>
void Fractorium::ShowCritical(const QString& title, const QString& text, bool invokeRequired)
{
if (!invokeRequired)
{
QMessageBox::critical(this, title, text);
}
else
{
QMetaObject::invokeMethod(this, "ShowCritical", Qt::QueuedConnection, Q_ARG(const QString&, title), Q_ARG(const QString&, text), Q_ARG(bool, false));
}
}
/// <summary>
/// Explicitly set the tab orders for the entire program.
/// Qt has a facility to do this, but it fails when using custom widgets in

View File

@ -71,7 +71,6 @@ public:
void SetCenter(float x, float y);
void SetRotation(double rot, bool stealth);
void SetScale(double scale);
void Resize();
void SetCoordinateStatus(int x, int y, float worldX, float worldY);
//Xforms.
@ -230,6 +229,7 @@ public slots:
void StartRenderTimer();
void IdleTimer();
bool ControllersOk();
void ShowCritical(const QString& title, const QString& text, bool invokeRequired = false);
//Can't have a template function be a slot.
void SetLibraryTreeItemData(EmberTreeWidgetItemBase* item, vector<unsigned char>& v, unsigned int width, unsigned int height);
@ -243,11 +243,11 @@ public:
static int FlipDet(Affine2D<float>& affine);
protected:
virtual void resizeEvent(QResizeEvent* e);
virtual void closeEvent(QCloseEvent* e);
virtual void dragEnterEvent(QDragEnterEvent* e);
virtual void dragMoveEvent(QDragMoveEvent* e);
virtual void dropEvent(QDropEvent* e);
virtual void resizeEvent(QResizeEvent* e) override;
virtual void closeEvent(QCloseEvent* e) override;
virtual void dragEnterEvent(QDragEnterEvent* e) override;
virtual void dragMoveEvent(QDragMoveEvent* e) override;
virtual void dropEvent(QDropEvent* e) override;
private:
void InitMenusUI();
@ -294,8 +294,8 @@ private:
//Dialogs.
QStringList SetupOpenXmlDialog();
QString SetupSaveXmlDialog(QString defaultFilename);
QString SetupSaveImageDialog(QString defaultFilename);
QString SetupSaveXmlDialog(const QString& defaultFilename);
QString SetupSaveImageDialog(const QString& defaultFilename);
QString SetupSaveFolderDialog();
QColorDialog* m_ColorDialog;
FractoriumFinalRenderDialog* m_FinalRenderDialog;
@ -461,5 +461,52 @@ static QWidget* SetTabOrder(QWidget* parent, QWidget* w1, QWidget* w2)
return w2;
}
/// <summary>
/// Wrapper around QLocale::system().toDouble().
/// </summary>
/// <param name="s">The string to convert</param>
/// <param name="ok">Pointer to boolean which stores the success value of the conversion</param>
/// <returns>The converted value if successful, else 0.</returns>
static double ToDouble(const QString &s, bool *ok)
{
return QLocale::system().toDouble(s, ok);
}
/// <summary>
/// Wrapper around QLocale::system().toString().
/// </summary>
/// <param name="s">The value to convert</param>
/// <returns>The string value if successful, else "".</returns>
template <typename T>
static QString ToString(T val)
{
return QLocale::system().toString(val);
}
/// <summary>
/// Force a QString to end with the specified value.
/// </summary>
/// <param name="s">The string to append a suffix to</param>
/// <param name="e">The suffix to append</param>
/// <returns>The original string value if it already ended in e, else the original value appended with e.</returns>
template <typename T>
static QString MakeEnd(const QString& s, T e)
{
if (!s.endsWith(e))
return s + e;
else
return s;
}
/// <summary>
/// Check if a path is not empty and exists on the file system.
/// </summary>
/// <param name="s">The path to check</param>
/// <returns>True if s was not empty and existed, else false.</returns>
static bool Exists(const QString& s)
{
return s != "" && QDir(s).exists();
}
//template void Fractorium::SetupSpinner<SpinBox, int> (QTableWidget* table, const QObject* receiver, int& row, int col, SpinBox*& spinBox, int height, int min, int max, int step, const char* signal, const char* slot, bool incRow, int val, int doubleClickZero, int doubleClickNonZero);
//template void Fractorium::SetupSpinner<DoubleSpinBox, double>(QTableWidget* table, const QObject* receiver, int& row, int col, DoubleSpinBox*& spinBox, int height, double min, double max, double step, const char* signal, const char* slot, bool incRow, double val, double doubleClickZero, double doubleClickNonZero);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1173</width>
<height>988</height>
<width>1214</width>
<height>983</height>
</rect>
</property>
<property name="sizePolicy">
@ -32,107 +32,143 @@
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="GLWidget" name="GLDisplay">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
<widget class="QScrollArea" name="GLParentScrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="mouseTracking">
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>6</number>
<widget class="QWidget" name="GLParentScrollAreaContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>930</width>
<height>942</height>
</rect>
</property>
<property name="topMargin">
<number>6</number>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
</layout>
<widget class="GLWidget" name="GLDisplay" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>914</width>
<height>824</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1173</width>
<width>1214</width>
<height>21</height>
</rect>
</property>
@ -140,7 +176,7 @@
<property name="title">
<string>&amp;File</string>
</property>
<property name="toolTipsVisible" stdset="0">
<property name="toolTipsVisible">
<bool>true</bool>
</property>
<addaction name="ActionNewFlock"/>
@ -167,7 +203,7 @@
<property name="title">
<string>&amp;Tools</string>
</property>
<property name="toolTipsVisible" stdset="0">
<property name="toolTipsVisible">
<bool>true</bool>
</property>
<addaction name="ActionAddReflectiveSymmetry"/>
@ -189,7 +225,7 @@
<property name="title">
<string>&amp;Edit</string>
</property>
<property name="toolTipsVisible" stdset="0">
<property name="toolTipsVisible">
<bool>true</bool>
</property>
<addaction name="ActionUndo"/>
@ -382,7 +418,7 @@
<x>0</x>
<y>0</y>
<width>252</width>
<height>857</height>
<height>852</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_11">
@ -485,8 +521,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>252</width>
<height>857</height>
<width>98</width>
<height>847</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -2781,8 +2817,8 @@ SpinBox
<rect>
<x>0</x>
<y>0</y>
<width>238</width>
<height>752</height>
<width>118</width>
<height>597</height>
</rect>
</property>
<property name="palette">
@ -4952,8 +4988,8 @@ SpinBox
<rect>
<x>0</x>
<y>0</y>
<width>256</width>
<height>861</height>
<width>105</width>
<height>684</height>
</rect>
</property>
<property name="sizePolicy">

View File

@ -65,7 +65,7 @@ FractoriumEmberControllerBase::~FractoriumEmberControllerBase()
/// <param name="fractorium">Pointer to the main window.</param>
template <typename T>
FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
: FractoriumEmberControllerBase(fractorium)
: FractoriumEmberControllerBase(fractorium)
{
m_PreviewRun = false;
m_PreviewRunning = false;
@ -79,7 +79,6 @@ FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
m_PreviewRenderer->Callback(NULL);
m_PreviewRenderer->NumChannels(4);
m_PreviewRenderer->ReclaimOnResize(true);
m_PreviewRenderer->EarlyClip(m_Fractorium->m_Settings->EarlyClip());
m_PreviewRenderer->YAxisUp(m_Fractorium->m_Settings->YAxisUp());
m_PreviewRenderer->SetEmber(m_Ember);//Give it an initial ember, will be updated many times later.
@ -98,7 +97,7 @@ FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
if (QTreeWidgetItem* top = tree->topLevelItem(0))
{
for (size_t i = start; m_PreviewRun && i < end && i < m_EmberFile.m_Embers.size(); i++)
for (size_t i = start; m_PreviewRun && i < end && i < m_EmberFile.Size(); i++)
{
Ember<T> ember = m_EmberFile.m_Embers[i];
@ -144,21 +143,38 @@ FractoriumEmberController<T>::~FractoriumEmberController() { }
/// Note that some precision will be lost when going from double to float.
/// </summary>
template <typename T> void FractoriumEmberController<T>::SetEmber(const Ember<float>& ember, bool verbatim) { SetEmberPrivate<float>(ember, verbatim); }
template <typename T> void FractoriumEmberController<T>::CopyEmber(Ember<float>& ember) { ember = m_Ember; }
template <typename T> void FractoriumEmberController<T>::CopyEmber(Ember<float>& ember, std::function<void(Ember<float>& ember)> perEmberOperation) { ember = m_Ember; perEmberOperation(ember); }
template <typename T> void FractoriumEmberController<T>::SetEmberFile(const EmberFile<float>& emberFile) { m_EmberFile = emberFile; }
template <typename T> void FractoriumEmberController<T>::CopyEmberFile(EmberFile<float>& emberFile) { emberFile = m_EmberFile; }
template <typename T> void FractoriumEmberController<T>::CopyEmberFile(EmberFile<float>& emberFile, std::function<void(Ember<float>& ember)> perEmberOperation)
{
emberFile.m_Filename = m_EmberFile.m_Filename;
CopyVec(emberFile.m_Embers, m_EmberFile.m_Embers, perEmberOperation);
}
template <typename T> void FractoriumEmberController<T>::SetTempPalette(const Palette<float>& palette) { m_TempPalette = palette; }
template <typename T> void FractoriumEmberController<T>::CopyTempPalette(Palette<float>& palette) { palette = m_TempPalette; }
#ifdef DO_DOUBLE
template <typename T> void FractoriumEmberController<T>::SetEmber(const Ember<double>& ember, bool verbatim) { SetEmberPrivate<double>(ember, verbatim); }
template <typename T> void FractoriumEmberController<T>::CopyEmber(Ember<double>& ember) { ember = m_Ember; }
template <typename T> void FractoriumEmberController<T>::CopyEmber(Ember<double>& ember, std::function<void(Ember<double>& ember)> perEmberOperation) { ember = m_Ember; perEmberOperation(ember); }
template <typename T> void FractoriumEmberController<T>::SetEmberFile(const EmberFile<double>& emberFile) { m_EmberFile = emberFile; }
template <typename T> void FractoriumEmberController<T>::CopyEmberFile(EmberFile<double>& emberFile) { emberFile = m_EmberFile; }
template <typename T> void FractoriumEmberController<T>::CopyEmberFile(EmberFile<double>& emberFile, std::function<void(Ember<double>& ember)> perEmberOperation)
{
emberFile.m_Filename = m_EmberFile.m_Filename;
CopyVec(emberFile.m_Embers, m_EmberFile.m_Embers, perEmberOperation);
}
template <typename T> void FractoriumEmberController<T>::SetTempPalette(const Palette<double>& palette) { m_TempPalette = palette; }
template <typename T> void FractoriumEmberController<T>::CopyTempPalette(Palette<double>& palette) { palette = m_TempPalette; }
#endif
template <typename T> Ember<T>* FractoriumEmberController<T>::CurrentEmber() { return &m_Ember; }
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);
}
/// <summary>
/// Set the ember at the specified index from the currently opened file as the current Ember.
/// Clears the undo state.
@ -168,7 +184,7 @@ template <typename T> Ember<T>* FractoriumEmberController<T>::CurrentEmber() { r
template <typename T>
void FractoriumEmberController<T>::SetEmber(size_t index)
{
if (index < m_EmberFile.m_Embers.size())
if (index < m_EmberFile.Size())
{
if (QTreeWidgetItem* top = m_Fractorium->ui.LibraryTree->topLevelItem(0))
{
@ -235,7 +251,7 @@ void FractoriumEmberController<T>::SetEmberPrivate(const Ember<U>& ember, bool v
if (!verbatim)
{
m_Ember.SetSizeAndAdjustScale(m_Fractorium->ui.GLDisplay->width(), m_Fractorium->ui.GLDisplay->height(), true, SCALE_WIDTH);
//m_Ember.SetSizeAndAdjustScale(m_Fractorium->ui.GLDisplay->width(), m_Fractorium->ui.GLDisplay->height(), true, SCALE_WIDTH);
m_Ember.m_TemporalSamples = 1;//Change once animation is supported.
m_Ember.m_Quality = m_Fractorium->m_QualitySpin->value();
m_Ember.m_Supersample = m_Fractorium->m_SupersampleSpin->value();

View File

@ -41,16 +41,16 @@ public:
//Embers.
virtual void SetEmber(const Ember<float>& ember, bool verbatim = false) { }
virtual void CopyEmber(Ember<float>& ember) { }
virtual void CopyEmber(Ember<float>& ember, std::function<void(Ember<float>& ember)> perEmberOperation = [&](Ember<float>& ember) { }) { }
virtual void SetEmberFile(const EmberFile<float>& emberFile) { }
virtual void CopyEmberFile(EmberFile<float>& emberFile) { }
virtual void CopyEmberFile(EmberFile<float>& emberFile, std::function<void(Ember<float>& ember)> perEmberOperation = [&](Ember<float>& ember) { }) { }
virtual void SetTempPalette(const Palette<float>& palette) { }
virtual void CopyTempPalette(Palette<float>& palette) { }
#ifdef DO_DOUBLE
virtual void SetEmber(const Ember<double>& ember, bool verbatim = false) { }
virtual void CopyEmber(Ember<double>& ember) { }
virtual void CopyEmber(Ember<double>& ember, std::function<void(Ember<double>& ember)> perEmberOperation = [&](Ember<double>& ember) { }) { }
virtual void SetEmberFile(const EmberFile<double>& emberFile) { }
virtual void CopyEmberFile(EmberFile<double>& emberFile) { }
virtual void CopyEmberFile(EmberFile<double>& emberFile, std::function<void(Ember<double>& ember)> perEmberOperation = [&](Ember<double>& ember) { }) { }
virtual void SetTempPalette(const Palette<double>& palette) { }
virtual void CopyTempPalette(Palette<double>& palette) { }
#endif
@ -62,14 +62,15 @@ public:
virtual void DeleteCurrentXform() { }
virtual void AddFinalXform() { }
virtual bool UseFinalXform() { return false; }
virtual size_t XformCount() { return 0; }
virtual size_t TotalXformCount() { return 0; }
virtual string Name() { return ""; }
virtual void Name(string s) { }
virtual unsigned int FinalRasW() { return 0; }
virtual size_t XformCount() const { return 0; }
virtual size_t TotalXformCount() const { return 0; }
virtual QString Name() const { return ""; }
virtual void Name(const string& s) { }
virtual unsigned int FinalRasW() const { return 0; }
virtual void FinalRasW(unsigned int w) { }
virtual unsigned int FinalRasH() { return 0; }
virtual unsigned int FinalRasH() const { return 0; }
virtual void FinalRasH(unsigned int h) { }
virtual size_t Index() const { return 0; }
virtual void AddSymmetry(int sym, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) { }
virtual void CalcNormalizedWeights() { }
@ -78,7 +79,7 @@ public:
virtual void NewEmptyFlameInCurrentFile() { }
virtual void NewRandomFlameInCurrentFile() { }
virtual void CopyFlameInCurrentFile() { }
virtual void OpenAndPrepFiles(QStringList filenames, bool append) { }
virtual void OpenAndPrepFiles(const QStringList& filenames, bool append) { }
virtual void SaveCurrentAsXml() { }
virtual void SaveEntireFileAsXml() { }
virtual void SaveCurrentToOpenedFile() { }
@ -106,6 +107,8 @@ public:
virtual void VibrancyChanged(double d) { }
virtual void HighlightPowerChanged(double d) { }
virtual void PaletteModeChanged(unsigned int i) { }
virtual void WidthChanged(unsigned int i) { }
virtual void HeightChanged(unsigned int i) { }
virtual void CenterXChanged(double d) { }
virtual void CenterYChanged(double d) { }
virtual void ScaleChanged(double d) { }
@ -165,7 +168,7 @@ public:
virtual void ClearXaos() { }
//Palette.
virtual bool InitPaletteTable(string s) { return false; }
virtual bool InitPaletteTable(const string& s) { return false; }
virtual void ApplyPaletteToEmber() { }
virtual void PaletteAdjust() { }
virtual QRgb GetQRgbFromPaletteIndex(unsigned int i) { return QRgb(); }
@ -185,7 +188,7 @@ public:
//Rendering/progress.
virtual bool Render() { return false; }
virtual bool CreateRenderer(eRendererType renderType, unsigned int platform, unsigned int device, bool shared = true) { return false; }
virtual unsigned int SizeOfT() { return 0; }
virtual unsigned int SizeOfT() const { return 0; }
virtual void ClearUndo() { }
virtual GLEmberControllerBase* GLController() { return NULL; }
bool RenderTimerRunning();
@ -195,7 +198,7 @@ public:
void Shutdown();
void UpdateRender(eProcessAction action = FULL_RENDER);
void DeleteRenderer();
void SaveCurrentRender(QString filename);
void SaveCurrentRender(const QString& filename, bool forcePull);
RendererBase* Renderer() { return m_Renderer.get(); }
vector<unsigned char>* FinalImage() { return &m_FinalImage; }
vector<unsigned char>* PreviewFinalImage() { return &m_PreviewFinalImage; }
@ -219,6 +222,7 @@ protected:
eEditUndoState m_EditState;
GLuint m_OutputTexID;
Timing m_RenderElapsedTimer;
EmberStats m_Stats;
QImage m_FinalPaletteImage;
QString m_LastSaveAll;
QString m_LastSaveCurrent;
@ -247,161 +251,165 @@ public:
virtual ~FractoriumEmberController();
//Embers.
virtual void SetEmber(const Ember<float>& ember, bool verbatim = false);
virtual void CopyEmber(Ember<float>& ember);
virtual void SetEmberFile(const EmberFile<float>& emberFile);
virtual void CopyEmberFile(EmberFile<float>& emberFile);
virtual void SetTempPalette(const Palette<float>& palette);
virtual void CopyTempPalette(Palette<float>& palette);
virtual void SetEmber(const Ember<float>& ember, bool verbatim = false) override;
virtual void CopyEmber(Ember<float>& ember, std::function<void(Ember<float>& ember)> perEmberOperation = [&](Ember<float>& ember) { }) override;
virtual void SetEmberFile(const EmberFile<float>& emberFile) override;
virtual void CopyEmberFile(EmberFile<float>& emberFile, std::function<void(Ember<float>& ember)> perEmberOperation = [&](Ember<float>& ember) { }) override;
virtual void SetTempPalette(const Palette<float>& palette) override;
virtual void CopyTempPalette(Palette<float>& palette) override;
#ifdef DO_DOUBLE
virtual void SetEmber(const Ember<double>& ember, bool verbatim = false);
virtual void CopyEmber(Ember<double>& ember);
virtual void SetEmberFile(const EmberFile<double>& emberFile);
virtual void CopyEmberFile(EmberFile<double>& emberFile);
virtual void SetTempPalette(const Palette<double>& palette);
virtual void CopyTempPalette(Palette<double>& palette);
virtual void SetEmber(const Ember<double>& ember, bool verbatim = false) override;
virtual void CopyEmber(Ember<double>& ember, std::function<void(Ember<double>& ember)> perEmberOperation = [&](Ember<double>& ember) { }) override;
virtual void SetEmberFile(const EmberFile<double>& emberFile) override;
virtual void CopyEmberFile(EmberFile<double>& emberFile, std::function<void(Ember<double>& ember)> perEmberOperation = [&](Ember<double>& ember) { }) override;
virtual void SetTempPalette(const Palette<double>& palette) override;
virtual void CopyTempPalette(Palette<double>& palette) override;
#endif
virtual void SetEmber(size_t index);
virtual void Clear() { }
virtual void AddXform();
virtual void DuplicateXform();
virtual void ClearCurrentXform();
virtual void DeleteCurrentXform();
virtual void AddFinalXform();
virtual bool UseFinalXform() { return m_Ember.UseFinalXform(); }
virtual void SetEmber(size_t index) override;
virtual void Clear() override { }
virtual void AddXform() override;
virtual void DuplicateXform() override;
virtual void ClearCurrentXform() override;
virtual void DeleteCurrentXform() override;
virtual void AddFinalXform() override;
virtual bool UseFinalXform() override { return m_Ember.UseFinalXform(); }
//virtual bool IsFinal(unsigned int i) { return false; }
virtual size_t XformCount() { return m_Ember.XformCount(); }
virtual size_t TotalXformCount() { return m_Ember.TotalXformCount(); }
virtual string Name() { return m_Ember.m_Name; }
virtual void Name(string s) { m_Ember.m_Name = s; }
virtual unsigned int FinalRasW() { return m_Ember.m_FinalRasW; }
virtual void FinalRasW(unsigned int w) { m_Ember.m_FinalRasW = w; }
virtual unsigned int FinalRasH() { return m_Ember.m_FinalRasH; }
virtual void FinalRasH(unsigned int h) { m_Ember.m_FinalRasH = h; }
virtual void AddSymmetry(int sym, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) { m_Ember.AddSymmetry(sym, rand); }
virtual void CalcNormalizedWeights() { m_Ember.CalcNormalizedWeights(m_NormalizedWeights); }
virtual size_t XformCount() const override { return m_Ember.XformCount(); }
virtual size_t TotalXformCount() const override { return m_Ember.TotalXformCount(); }
virtual QString Name() const override { return QString::fromStdString(m_Ember.m_Name); }
virtual void Name(const string& s) override { m_Ember.m_Name = s; }
virtual unsigned int FinalRasW() const override { return m_Ember.m_FinalRasW; }
virtual void FinalRasW(unsigned int w) override { m_Ember.m_FinalRasW = w; }
virtual unsigned int FinalRasH() const override { return m_Ember.m_FinalRasH; }
virtual void FinalRasH(unsigned int h) override { m_Ember.m_FinalRasH = h; }
virtual size_t Index() const override { return m_Ember.m_Index; }
virtual void AddSymmetry(int sym, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override { m_Ember.AddSymmetry(sym, rand); }
virtual void CalcNormalizedWeights() override { m_Ember.CalcNormalizedWeights(m_NormalizedWeights); }
void ConstrainDimensions(Ember<T>& ember);
Ember<T>* CurrentEmber();
//Menu.
virtual void NewFlock(unsigned int count);
virtual void NewEmptyFlameInCurrentFile();
virtual void NewRandomFlameInCurrentFile();
virtual void CopyFlameInCurrentFile();
virtual void OpenAndPrepFiles(QStringList filenames, bool append);
virtual void SaveCurrentAsXml();
virtual void SaveEntireFileAsXml();
virtual void SaveCurrentToOpenedFile();
virtual void Undo();
virtual void Redo();
virtual void CopyXml();
virtual void CopyAllXml();
virtual void PasteXmlAppend();
virtual void PasteXmlOver();
virtual void AddReflectiveSymmetry();
virtual void AddRotationalSymmetry();
virtual void AddBothSymmetry();
virtual void Flatten();
virtual void Unflatten();
virtual void ClearFlame();
virtual void NewFlock(unsigned int count) override;
virtual void NewEmptyFlameInCurrentFile() override;
virtual void NewRandomFlameInCurrentFile() override;
virtual void CopyFlameInCurrentFile() override;
virtual void OpenAndPrepFiles(const QStringList& filenames, bool append) override;
virtual void SaveCurrentAsXml() override;
virtual void SaveEntireFileAsXml() override;
virtual void SaveCurrentToOpenedFile() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void CopyXml() override;
virtual void CopyAllXml() override;
virtual void PasteXmlAppend() override;
virtual void PasteXmlOver() override;
virtual void AddReflectiveSymmetry() override;
virtual void AddRotationalSymmetry() override;
virtual void AddBothSymmetry() override;
virtual void Flatten() override;
virtual void Unflatten() override;
virtual void ClearFlame() override;
//Toolbar.
//Params.
virtual void SetCenter(double x, double y);
virtual void FillParamTablesAndPalette();
virtual void BrightnessChanged(double d);
virtual void GammaChanged(double d);
virtual void GammaThresholdChanged(double d);
virtual void VibrancyChanged(double d);
virtual void HighlightPowerChanged(double d);
virtual void PaletteModeChanged(unsigned int i);
virtual void CenterXChanged(double d);
virtual void CenterYChanged(double d);
virtual void ScaleChanged(double d);
virtual void ZoomChanged(double d);
virtual void RotateChanged(double d);
virtual void ZPosChanged(double d);
virtual void PerspectiveChanged(double d);
virtual void PitchChanged(double d);
virtual void YawChanged(double d);
virtual void DepthBlurChanged(double d);
virtual void SpatialFilterWidthChanged(double d);
virtual void SpatialFilterTypeChanged(const QString& text);
virtual void TemporalFilterWidthChanged(double d);
virtual void TemporalFilterTypeChanged(const QString& text);
virtual void DEFilterMinRadiusWidthChanged(double d);
virtual void DEFilterMaxRadiusWidthChanged(double d);
virtual void DEFilterCurveWidthChanged(double d);
virtual void PassesChanged(int d);
virtual void TemporalSamplesChanged(int d);
virtual void QualityChanged(double d);
virtual void SupersampleChanged(int d);
virtual void AffineInterpTypeChanged(int index);
virtual void InterpTypeChanged(int index);
virtual void BackgroundChanged(const QColor& col);
virtual void SetCenter(double x, double y) override;
virtual void FillParamTablesAndPalette() override;
virtual void BrightnessChanged(double d) override;
virtual void GammaChanged(double d) override;
virtual void GammaThresholdChanged(double d) override;
virtual void VibrancyChanged(double d) override;
virtual void HighlightPowerChanged(double d) override;
virtual void PaletteModeChanged(unsigned int i) override;
virtual void WidthChanged(unsigned int i) override;
virtual void HeightChanged(unsigned int i) override;
virtual void CenterXChanged(double d) override;
virtual void CenterYChanged(double d) override;
virtual void ScaleChanged(double d) override;
virtual void ZoomChanged(double d) override;
virtual void RotateChanged(double d) override;
virtual void ZPosChanged(double d) override;
virtual void PerspectiveChanged(double d) override;
virtual void PitchChanged(double d) override;
virtual void YawChanged(double d) override;
virtual void DepthBlurChanged(double d) override;
virtual void SpatialFilterWidthChanged(double d) override;
virtual void SpatialFilterTypeChanged(const QString& text) override;
virtual void TemporalFilterWidthChanged(double d) override;
virtual void TemporalFilterTypeChanged(const QString& text) override;
virtual void DEFilterMinRadiusWidthChanged(double d) override;
virtual void DEFilterMaxRadiusWidthChanged(double d) override;
virtual void DEFilterCurveWidthChanged(double d) override;
virtual void PassesChanged(int d) override;
virtual void TemporalSamplesChanged(int d) override;
virtual void QualityChanged(double d) override;
virtual void SupersampleChanged(int d) override;
virtual void AffineInterpTypeChanged(int index) override;
virtual void InterpTypeChanged(int index) override;
virtual void BackgroundChanged(const QColor& col) override;
//Xforms.
virtual void CurrentXformComboChanged(int index);
virtual void XformWeightChanged(double d);
virtual void EqualizeWeights();
virtual void XformNameChanged(int row, int col);
virtual void CurrentXformComboChanged(int index) override;
virtual void XformWeightChanged(double d) override;
virtual void EqualizeWeights() override;
virtual void XformNameChanged(int row, int col) override;
void FillWithXform(Xform<T>* xform);
Xform<T>* CurrentXform();
//Xforms Affine.
virtual void AffineSetHelper(double d, int index, bool pre);
virtual void FlipCurrentXform(bool horizontal, bool vertical, bool pre);
virtual void RotateCurrentXformByAngle(double angle, bool pre);
virtual void MoveCurrentXform(double x, double y, bool pre);
virtual void ScaleCurrentXform(double scale, bool pre);
virtual void ResetCurrentXformAffine(bool pre);
virtual void AffineSetHelper(double d, int index, bool pre) override;
virtual void FlipCurrentXform(bool horizontal, bool vertical, bool pre) override;
virtual void RotateCurrentXformByAngle(double angle, bool pre) override;
virtual void MoveCurrentXform(double x, double y, bool pre) override;
virtual void ScaleCurrentXform(double scale, bool pre) override;
virtual void ResetCurrentXformAffine(bool pre) override;
void FillAffineWithXform(Xform<T>* xform, bool pre);
//Xforms Color.
virtual void XformColorIndexChanged(double d, bool updateRender);
virtual void XformScrollColorIndexChanged(int d);
virtual void XformColorSpeedChanged(double d);
virtual void XformOpacityChanged(double d);
virtual void XformDirectColorChanged(double d);
virtual void XformColorIndexChanged(double d, bool updateRender) override;
virtual void XformScrollColorIndexChanged(int d) override;
virtual void XformColorSpeedChanged(double d) override;
virtual void XformOpacityChanged(double d) override;
virtual void XformDirectColorChanged(double d) override;
void FillColorWithXform(Xform<T>* xform);
//Xforms Variations.
virtual void SetupVariationTree();
virtual void ClearVariationsTree();
virtual void VariationSpinBoxValueChanged(double d);
virtual void SetupVariationTree() override;
virtual void ClearVariationsTree() override;
virtual void VariationSpinBoxValueChanged(double d) override;
void FillVariationTreeWithXform(Xform<T>* xform);
//Xforms Xaos.
virtual void FillXaosWithCurrentXform();
virtual QString MakeXaosNameString(unsigned int i);
virtual void XaosChanged(DoubleSpinBox* sender);
virtual void ClearXaos();
virtual void FillXaosWithCurrentXform() override;
virtual QString MakeXaosNameString(unsigned int i) override;
virtual void XaosChanged(DoubleSpinBox* sender) override;
virtual void ClearXaos() override;
//Palette.
virtual bool InitPaletteTable(string s);
virtual void ApplyPaletteToEmber();
virtual void PaletteAdjust();
virtual QRgb GetQRgbFromPaletteIndex(unsigned int i) { return QRgb(); }
virtual void PaletteCellClicked(int row, int col);
virtual bool InitPaletteTable(const string& s) override;
virtual void ApplyPaletteToEmber() override;
virtual void PaletteAdjust() override;
virtual QRgb GetQRgbFromPaletteIndex(unsigned int i) override { return QRgb(); }
virtual void PaletteCellClicked(int row, int col) override;
//Library.
virtual void SyncNames();
virtual void FillLibraryTree(int selectIndex = -1);
virtual void UpdateLibraryTree();
virtual void EmberTreeItemChanged(QTreeWidgetItem* item, int col);
virtual void EmberTreeItemDoubleClicked(QTreeWidgetItem* item, int col);
virtual void RenderPreviews(unsigned int start = UINT_MAX, unsigned int end = UINT_MAX);
virtual void StopPreviewRender();
virtual void SyncNames() override;
virtual void FillLibraryTree(int selectIndex = -1) override;
virtual void UpdateLibraryTree() override;
virtual void EmberTreeItemChanged(QTreeWidgetItem* item, int col) override;
virtual void EmberTreeItemDoubleClicked(QTreeWidgetItem* item, int col) override;
virtual void RenderPreviews(unsigned int start = UINT_MAX, unsigned int end = UINT_MAX) override;
virtual void StopPreviewRender() override;
//Info.
//Rendering/progress.
virtual bool Render();
virtual bool CreateRenderer(eRendererType renderType, unsigned int platform, unsigned int device, bool shared = true);
virtual unsigned int SizeOfT() { return sizeof(T); }
virtual int ProgressFunc(Ember<T>& ember, void* foo, double fraction, int stage, double etaMs);
virtual void ClearUndo();
virtual GLEmberControllerBase* GLController() { return m_GLController.get(); }
virtual bool Render() override;
virtual bool CreateRenderer(eRendererType renderType, unsigned int platform, unsigned int device, bool shared = true) override;
virtual unsigned int SizeOfT() const override { return sizeof(T); }
virtual int ProgressFunc(Ember<T>& ember, void* foo, double fraction, int stage, double etaMs) override;
virtual void ClearUndo() override;
virtual GLEmberControllerBase* GLController() override { return m_GLController.get(); }
private:
//Embers.
@ -424,6 +432,7 @@ private:
//Rendering/progress.
void Update(std::function<void (void)> func, bool updateRender = true, eProcessAction action = FULL_RENDER);
void UpdateCurrentXform(std::function<void (Xform<T>*)> func, bool updateRender = true, eProcessAction action = FULL_RENDER);
bool SyncSizes();
//Templated members.
bool m_PreviewRun;

View File

@ -24,7 +24,7 @@ void Fractorium::UpdateHistogramBounds()
ui.InfoBoundsLabelW->setText(QString(m_WString));
ui.InfoBoundsLabelH->setText(QString(m_HString));
ui.InfoBoundsTable->item(0, 1)->setText(QString::number(r->GutterWidth()));
ui.InfoBoundsTable->item(0, 1)->setText(ToString(r->GutterWidth()));
if (r->GetDensityFilter())
{
@ -54,5 +54,5 @@ void Fractorium::ErrorReportToQTextEdit(vector<string>& errors, QTextEdit* textE
QMetaObject::invokeMethod(textEdit, "clear", Qt::QueuedConnection);
for (size_t i = 0; i < errors.size(); i++)
QMetaObject::invokeMethod(textEdit, "append", Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(errors[i]) + "\n"));
QMetaObject::invokeMethod(textEdit, "append", Qt::QueuedConnection, Q_ARG(const QString&, QString::fromStdString(errors[i]) + "\n"));
}

View File

@ -38,7 +38,7 @@ void FractoriumEmberController<T>::SyncNames()
{
for (int i = 0; i < top->childCount(); i++)//Iterate through all of the children, which will represent the open embers.
{
if ((item = dynamic_cast<EmberTreeWidgetItem<T>*>(top->child(i))) && i < m_EmberFile.m_Embers.size())//Cast the child widget to the EmberTreeWidgetItem type.
if ((item = dynamic_cast<EmberTreeWidgetItem<T>*>(top->child(i))) && i < m_EmberFile.Size())//Cast the child widget to the EmberTreeWidgetItem type.
item->setText(0, QString::fromStdString(m_EmberFile.m_Embers[i].m_Name));
}
}
@ -72,7 +72,7 @@ void FractoriumEmberController<T>::FillLibraryTree(int selectIndex)
fileItem->setToolTip(0, m_EmberFile.m_Filename);
fileItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
for (j = 0; j < m_EmberFile.m_Embers.size(); j++)
for (j = 0; j < m_EmberFile.Size(); j++)
{
Ember<T>* ember = &m_EmberFile.m_Embers[j];
EmberTreeWidgetItem<T>* emberItem = new EmberTreeWidgetItem<T>(ember, fileItem);
@ -80,7 +80,7 @@ void FractoriumEmberController<T>::FillLibraryTree(int selectIndex)
emberItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
if (ember->m_Name.empty())
emberItem->setText(0, QString::number(j));
emberItem->setText(0, ToString(j));
else
emberItem->setText(0, ember->m_Name.c_str());
@ -96,7 +96,7 @@ void FractoriumEmberController<T>::FillLibraryTree(int selectIndex)
emberItem->setSelected(true);
QCoreApplication::flush();
RenderPreviews(0, m_EmberFile.m_Embers.size());
RenderPreviews(0, m_EmberFile.Size());
tree->expandAll();
}
@ -117,7 +117,7 @@ void FractoriumEmberController<T>::UpdateLibraryTree()
tree->blockSignals(true);
for (i = childCount; i < m_EmberFile.m_Embers.size(); i++)
for (i = childCount; i < m_EmberFile.Size(); i++)
{
Ember<T>* ember = &m_EmberFile.m_Embers[i];
EmberTreeWidgetItem<T>* emberItem = new EmberTreeWidgetItem<T>(ember, top);
@ -125,7 +125,7 @@ void FractoriumEmberController<T>::UpdateLibraryTree()
emberItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
if (ember->m_Name.empty())
emberItem->setText(0, QString::number(i));
emberItem->setText(0, ToString(i));
else
emberItem->setText(0, ember->m_Name.c_str());
@ -135,14 +135,14 @@ void FractoriumEmberController<T>::UpdateLibraryTree()
//When adding elements to the vector, they may have been reshuffled which will have invalidated
//the pointers contained in the EmberTreeWidgetItems. So reassign all pointers here.
for (i = 0; i < m_EmberFile.m_Embers.size(); i++)
for (i = 0; i < m_EmberFile.Size(); i++)
{
if (EmberTreeWidgetItem<T>* emberItem = dynamic_cast<EmberTreeWidgetItem<T>*>(top->child(i)))
emberItem->SetEmberPointer(&m_EmberFile.m_Embers[i]);
}
tree->blockSignals(false);
RenderPreviews(childCount, m_EmberFile.m_Embers.size());
RenderPreviews(childCount, m_EmberFile.Size());
}
}
@ -250,7 +250,7 @@ void FractoriumEmberController<T>::RenderPreviews(unsigned int start, unsigned i
}
tree->blockSignals(false);
m_PreviewResult = QtConcurrent::run(m_PreviewRenderFunc, 0, m_EmberFile.m_Embers.size());
m_PreviewResult = QtConcurrent::run(m_PreviewRenderFunc, 0, m_EmberFile.Size());
}
else
m_PreviewResult = QtConcurrent::run(m_PreviewRenderFunc, start, end);

View File

@ -61,9 +61,10 @@ void FractoriumEmberController<T>::NewFlock(unsigned int count)
{
m_SheepTools->Random(ember);
ParamsToEmber(ember);
ember.m_Index = i;
ember.m_OrigFinalRasW = ember.m_FinalRasW;
ember.m_OrigFinalRasH = ember.m_FinalRasH;
ember.m_Name = m_EmberFile.m_Filename.toStdString() + "-" + QString::number(i + 1).toStdString();
ember.m_Name = m_EmberFile.m_Filename.toStdString() + "-" + ToString(i + 1).toStdString();
m_EmberFile.m_Embers.push_back(ember);
}
@ -102,11 +103,12 @@ void FractoriumEmberController<T>::NewEmptyFlameInCurrentFile()
xform.m_ColorX = m_Rand.Frand01<T>();
ember.AddXform(xform);
ember.m_Palette = *m_PaletteList.GetPalette(-1);
ember.m_Name = EmberFile<T>::DefaultEmberName(m_EmberFile.m_Embers.size() + 1).toStdString();
ember.m_Name = EmberFile<T>::DefaultEmberName(m_EmberFile.Size() + 1).toStdString();
ember.m_Index = m_EmberFile.Size();
m_EmberFile.m_Embers.push_back(ember);//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync.
m_EmberFile.MakeNamesUnique();
UpdateLibraryTree();
SetEmber(m_EmberFile.m_Embers.size() - 1);
SetEmber(m_EmberFile.Size() - 1);
}
void Fractorium::OnActionNewEmptyFlameInCurrentFile(bool checked) { m_Controller->NewEmptyFlameInCurrentFile(); }
@ -126,11 +128,12 @@ void FractoriumEmberController<T>::NewRandomFlameInCurrentFile()
ParamsToEmber(ember);
ember.m_OrigFinalRasW = ember.m_FinalRasW;
ember.m_OrigFinalRasH = ember.m_FinalRasH;
ember.m_Name = EmberFile<T>::DefaultEmberName(m_EmberFile.m_Embers.size() + 1).toStdString();
ember.m_Name = EmberFile<T>::DefaultEmberName(m_EmberFile.Size() + 1).toStdString();
ember.m_Index = m_EmberFile.Size();
m_EmberFile.m_Embers.push_back(ember);//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync.
m_EmberFile.MakeNamesUnique();
UpdateLibraryTree();
SetEmber(m_EmberFile.m_Embers.size() - 1);
SetEmber(m_EmberFile.Size() - 1);
}
void Fractorium::OnActionNewRandomFlameInCurrentFile(bool checked) { m_Controller->NewRandomFlameInCurrentFile(); }
@ -146,11 +149,12 @@ void FractoriumEmberController<T>::CopyFlameInCurrentFile()
Ember<T> ember = m_Ember;
StopPreviewRender();
ember.m_Name = EmberFile<T>::DefaultEmberName(m_EmberFile.m_Embers.size() + 1).toStdString();
ember.m_Name = EmberFile<T>::DefaultEmberName(m_EmberFile.Size() + 1).toStdString();
ember.m_Index = m_EmberFile.Size();
m_EmberFile.m_Embers.push_back(ember);//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync.
m_EmberFile.MakeNamesUnique();
UpdateLibraryTree();
SetEmber(m_EmberFile.m_Embers.size() - 1);
SetEmber(m_EmberFile.Size() - 1);
}
void Fractorium::OnActionCopyFlameInCurrentFile(bool checked) { m_Controller->CopyFlameInCurrentFile(); }
@ -168,7 +172,7 @@ void Fractorium::OnActionCopyFlameInCurrentFile(bool checked) { m_Controller->Co
/// <param name="filenames">A list of full paths and filenames</param>
/// <param name="append">True to append the embers in the new files to the end of the currently open embers, false to clear and replace them</param>
template <typename T>
void FractoriumEmberController<T>::OpenAndPrepFiles(QStringList filenames, bool append)
void FractoriumEmberController<T>::OpenAndPrepFiles(const QStringList& filenames, bool append)
{
if (!filenames.empty())
{
@ -176,25 +180,24 @@ void FractoriumEmberController<T>::OpenAndPrepFiles(QStringList filenames, bool
EmberFile<T> emberFile;
XmlToEmber<T> parser;
vector<Ember<T>> embers;
unsigned int previousSize = append ? m_EmberFile.m_Embers.size() : 0;
unsigned int previousSize = append ? m_EmberFile.Size() : 0;
StopPreviewRender();
emberFile.m_Filename = filenames[0];
foreach (QString filename, filenames)
foreach(const QString& filename, filenames)
{
embers.clear();
if (parser.Parse(filename.toStdString().c_str(), embers) && !embers.empty())
{
//Disregard whatever size was specified in the file and fit it to the output window size.
for (i = 0; i < embers.size(); i++)
{
embers[i].SetSizeAndAdjustScale(m_Fractorium->ui.GLDisplay->width(), m_Fractorium->ui.GLDisplay->height(), true, SCALE_WIDTH);
ConstrainDimensions(embers[i]);//Do not exceed the max texture size.
//Also ensure it has a name.
if (embers[i].m_Name == "" || embers[i].m_Name == "No name")
embers[i].m_Name = QString::number(i).toStdString();
embers[i].m_Name = ToString(i).toStdString();
embers[i].m_Quality = m_Fractorium->m_QualitySpin->value();
embers[i].m_Supersample = m_Fractorium->m_SupersampleSpin->value();
@ -208,7 +211,7 @@ void FractoriumEmberController<T>::OpenAndPrepFiles(QStringList filenames, bool
vector<string> errors = parser.ErrorReport();
m_Fractorium->ErrorReportToQTextEdit(errors, m_Fractorium->ui.InfoFileOpeningTextEdit);
QMessageBox::critical(m_Fractorium, "Open Failed", "Could not open file, see info tab for details.");
m_Fractorium->ShowCritical("Open Failed", "Could not open file, see info tab for details.");
}
}
@ -223,7 +226,7 @@ void FractoriumEmberController<T>::OpenAndPrepFiles(QStringList filenames, bool
m_EmberFile = emberFile;
//Resync indices and names.
for (i = 0; i < m_EmberFile.m_Embers.size(); i++)
for (i = 0; i < m_EmberFile.Size(); i++)
m_EmberFile.m_Embers[i].m_Index = i;
m_EmberFile.MakeNamesUnique();
@ -261,7 +264,7 @@ void FractoriumEmberController<T>::SaveCurrentAsXml()
}
else
{
if (m_EmberFile.m_Embers.size() == 1)
if (m_EmberFile.Size() == 1)
filename = m_Fractorium->SetupSaveXmlDialog(m_EmberFile.m_Filename);//If only one ember present, just use parent filename.
else
filename = m_Fractorium->SetupSaveXmlDialog(QString::fromStdString(m_Ember.m_Name));//More than one ember present, use individual ember name.
@ -287,7 +290,7 @@ void FractoriumEmberController<T>::SaveCurrentAsXml()
m_LastSaveCurrent = filename;
}
else
QMessageBox::critical(m_Fractorium, "Save Failed", "Could not save file, try saving to a different folder.");
m_Fractorium->ShowCritical("Save Failed", "Could not save file, try saving to a different folder.");
}
}
@ -318,7 +321,7 @@ void FractoriumEmberController<T>::SaveEntireFileAsXml()
SaveCurrentToOpenedFile();//Save the current ember back to the opened file before writing to disk.
emberFile = m_EmberFile;
for (size_t i = 0; i < emberFile.m_Embers.size(); i++)
for (size_t i = 0; i < emberFile.Size(); i++)
ApplyXmlSavingTemplate(emberFile.m_Embers[i]);
if (writer.Save(filename.toStdString().c_str(), emberFile.m_Embers, 0, true, false, true))
@ -327,7 +330,7 @@ void FractoriumEmberController<T>::SaveEntireFileAsXml()
s->SaveFolder(fileInfo.canonicalPath());
}
else
QMessageBox::critical(m_Fractorium, "Save Failed", "Could not save file, try saving to a different folder.");
m_Fractorium->ShowCritical("Save Failed", "Could not save file, try saving to a different folder.");
}
}
@ -339,9 +342,9 @@ void Fractorium::OnActionSaveEntireFileAsXml(bool checked) { m_Controller->SaveE
/// <param name="checked">Ignored</param>
void Fractorium::OnActionSaveCurrentScreen(bool checked)
{
QString filename = SetupSaveImageDialog(QString::fromStdString(m_Controller->Name()));
QString filename = SetupSaveImageDialog(m_Controller->Name());
m_Controller->SaveCurrentRender(filename);
m_Controller->SaveCurrentRender(filename, true);
}
/// <summary>
@ -354,9 +357,10 @@ void FractoriumEmberController<T>::SaveCurrentToOpenedFile()
size_t i;
bool fileFound = false;
for (i = 0; i < m_EmberFile.m_Embers.size(); i++)
for (i = 0; i < m_EmberFile.Size(); i++)
{
if (m_Ember.m_Name == m_EmberFile.m_Embers[i].m_Name)
if ((m_Ember.m_Name == m_EmberFile.m_Embers[i].m_Name) &&//Check both to be extra sure.
(m_Ember.m_Index == m_EmberFile.m_Embers[i].m_Index))
{
m_EmberFile.m_Embers[i] = m_Ember;
fileFound = true;
@ -450,8 +454,6 @@ void FractoriumEmberController<T>::CopyXml()
EmberToXml<T> emberToXml;
FractoriumSettings* settings = m_Fractorium->m_Settings;
ember.m_FinalRasW = settings->XmlWidth();
ember.m_FinalRasH = settings->XmlHeight();
ember.m_Quality = settings->XmlQuality();
ember.m_Supersample = settings->XmlSupersample();
ember.m_TemporalSamples = settings->XmlTemporalSamples();
@ -473,16 +475,11 @@ void FractoriumEmberController<T>::CopyAllXml()
os << "<flames>\n";
for (size_t i = 0; i < m_EmberFile.m_Embers.size(); i++)
for (size_t i = 0; i < m_EmberFile.Size(); i++)
{
Ember<T> ember = m_EmberFile.m_Embers[i];
ember.m_FinalRasW = settings->XmlWidth();
ember.m_FinalRasH = settings->XmlHeight();
ember.m_Quality = settings->XmlQuality();
ember.m_Supersample = settings->XmlSupersample();
ember.m_TemporalSamples = settings->XmlTemporalSamples();
ApplyXmlSavingTemplate(ember);
os << emberToXml.ToString(ember, "", 0, false, false, true);
}
@ -502,7 +499,7 @@ void Fractorium::OnActionCopyAllXml(bool checked) { m_Controller->CopyAllXml();
template <typename T>
void FractoriumEmberController<T>::PasteXmlAppend()
{
unsigned int i, previousSize = m_EmberFile.m_Embers.size();
unsigned int i, previousSize = m_EmberFile.Size();
string s, errors;
XmlToEmber<T> parser;
vector<Ember<T>> embers;
@ -524,20 +521,19 @@ void FractoriumEmberController<T>::PasteXmlAppend()
if (errors != "")
{
QMessageBox::critical(m_Fractorium, "Paste Error", QString::fromStdString(errors));
m_Fractorium->ShowCritical("Paste Error", QString::fromStdString(errors));
}
if (!embers.empty())
{
for (i = 0; i < embers.size(); i++)
{
//Disregard whatever size was specified in the file and fit it to the output window size.
embers[i].m_Index = m_EmberFile.m_Embers.size();
embers[i].SetSizeAndAdjustScale(m_Fractorium->ui.GLDisplay->width(), m_Fractorium->ui.GLDisplay->height(), true, SCALE_WIDTH);
embers[i].m_Index = m_EmberFile.Size();
ConstrainDimensions(embers[i]);//Do not exceed the max texture size.
//Also ensure it has a name.
if (embers[i].m_Name == "" || embers[i].m_Name == "No name")
embers[i].m_Name = QString::number(embers[i].m_Index).toStdString();
embers[i].m_Name = ToString(embers[i].m_Index).toStdString();
m_EmberFile.m_Embers.push_back(embers[i]);//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync.
}
@ -581,20 +577,19 @@ void FractoriumEmberController<T>::PasteXmlOver()
if (errors != "")
{
QMessageBox::critical(m_Fractorium, "Paste Error", QString::fromStdString(errors));
m_Fractorium->ShowCritical("Paste Error", QString::fromStdString(errors));
}
if (!m_EmberFile.m_Embers.empty())
if (m_EmberFile.Size())
{
for (i = 0; i < m_EmberFile.m_Embers.size(); i++)
for (i = 0; i < m_EmberFile.Size(); i++)
{
//Disregard whatever size was specified in the file and fit it to the output window size.
m_EmberFile.m_Embers[i].m_Index = i;
m_EmberFile.m_Embers[i].SetSizeAndAdjustScale(m_Fractorium->ui.GLDisplay->width(), m_Fractorium->ui.GLDisplay->height(), true, SCALE_WIDTH);
ConstrainDimensions(m_EmberFile.m_Embers[i]);//Do not exceed the max texture size.
//Also ensure it has a name.
if (m_EmberFile.m_Embers[i].m_Name == "" || m_EmberFile.m_Embers[i].m_Name == "No name")
m_EmberFile.m_Embers[i].m_Name = QString::number(m_EmberFile.m_Embers[i].m_Index).toStdString();
m_EmberFile.m_Embers[i].m_Name = ToString(m_EmberFile.m_Embers[i].m_Index).toStdString();
}
}
else
@ -729,6 +724,7 @@ void Fractorium::OnActionFinalRender(bool checked)
{
//First completely stop what the current rendering process is doing.
m_Controller->DeleteRenderer();//Delete the renderer, but not the controller.
OnActionSaveCurrentToOpenedFile(true);//Save whatever was edited back to the current open file.
m_RenderStatusLabel->setText("Renderer stopped.");
m_FinalRenderDialog->show();
}

View File

@ -37,7 +37,7 @@ void Fractorium::InitPaletteUI()
/// <param name="s">The full path to the palette file</param>
/// <returns>True if successful, else false.</returns>
template <typename T>
bool FractoriumEmberController<T>::InitPaletteTable(string s)
bool FractoriumEmberController<T>::InitPaletteTable(const string& s)
{
QTableWidget* paletteTable = m_Fractorium->ui.PaletteListTable;
QTableWidget* palettePreviewTable = m_Fractorium->ui.PalettePreviewTable;
@ -93,7 +93,7 @@ bool FractoriumEmberController<T>::InitPaletteTable(string s)
vector<string> errors = m_PaletteList.ErrorReport();
m_Fractorium->ErrorReportToQTextEdit(errors, m_Fractorium->ui.InfoFileOpeningTextEdit);
QMessageBox::critical(m_Fractorium, "Palette Read Error", "Could not load palette file, all images will be black. See info tab for details.");
m_Fractorium->ShowCritical("Palette Read Error", "Could not load palette file, all images will be black. See info tab for details.");
}
return false;

View File

@ -45,8 +45,8 @@ void Fractorium::InitParamsUI()
//Geometry.
row = 0;
table = ui.GeometryTable;
SetupSpinner<SpinBox, int> (table, this, row, 1, m_WidthSpin, spinHeight, 10, 100000, 50, SIGNAL(valueChanged(int)), SLOT(OnWidthChanged(int)));
SetupSpinner<SpinBox, int> (table, this, row, 1, m_HeightSpin, spinHeight, 10, 100000, 50, SIGNAL(valueChanged(int)), SLOT(OnHeightChanged(int)));
SetupSpinner<SpinBox, int> (table, this, row, 1, m_WidthSpin, spinHeight, 10, 2048, 50, SIGNAL(valueChanged(int)), SLOT(OnWidthChanged(int)), true, width(), width(), width());
SetupSpinner<SpinBox, int> (table, this, row, 1, m_HeightSpin, spinHeight, 10, 2048, 50, SIGNAL(valueChanged(int)), SLOT(OnHeightChanged(int)), true, height(), height(), height());
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_CenterXSpin, spinHeight, -dmax, dmax, 0.05, SIGNAL(valueChanged(double)), SLOT(OnCenterXChanged(double)), true, 0, 0, 0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_CenterYSpin, spinHeight, -dmax, dmax, 0.05, SIGNAL(valueChanged(double)), SLOT(OnCenterYChanged(double)), true, 0, 0, 0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_ScaleSpin, spinHeight, 10, dmax, 20, SIGNAL(valueChanged(double)), SLOT(OnScaleChanged(double)), true, 240, 240, 240);
@ -57,8 +57,8 @@ void Fractorium::InitParamsUI()
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_PitchSpin, spinHeight, -180, 180, 1, SIGNAL(valueChanged(double)), SLOT(OnPitchChanged(double)), true, 0, 45, 0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_YawSpin, spinHeight, -180, 180, 1, SIGNAL(valueChanged(double)), SLOT(OnYawChanged(double)), true, 0, 45, 0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_DepthBlurSpin, spinHeight, -100, 100, 0.01, SIGNAL(valueChanged(double)), SLOT(OnDepthBlurChanged(double)), true, 0, 1, 0);
m_WidthSpin->setEnabled(false);//Will programatically change these to match the window size, but the user should never be allowed to.
m_HeightSpin->setEnabled(false);
//Set w/h max values.
m_CenterXSpin->setDecimals(3);
m_CenterYSpin->setDecimals(3);
m_ZPosSpin->setDecimals(3);
@ -178,9 +178,9 @@ void FractoriumEmberController<T>::BackgroundChanged(const QColor& color)
QTableWidget* colorTable = m_Fractorium->ui.ColorTable;
colorTable->item(itemRow, 1)->setBackgroundColor(color);
QString r = QString::number(color.red());
QString g = QString::number(color.green());
QString b = QString::number(color.blue());
QString r = ToString(color.red());
QString g = ToString(color.green());
QString b = ToString(color.blue());
int threshold = 105;
int delta = (color.red() * 0.299) + //Magic numbers gotten from a Stack Overflow post.
@ -218,14 +218,16 @@ void Fractorium::OnPaletteModeComboCurrentIndexChanged(int index) { m_Controller
/// Dimensions are set automatically to match the dimensions of GLWidget.
/// </summary>
/// <param name="d">Ignored</param>
void Fractorium::OnWidthChanged(int d) { }
template <typename T> void FractoriumEmberController<T>::WidthChanged(unsigned int i) { Update([&] { m_Ember.m_FinalRasW = i; }); }
void Fractorium::OnWidthChanged(int i) { m_Controller->WidthChanged(i); }
/// <summary>
/// Placeholder, do nothing.
/// Dimensions are set automatically to match the dimensions of GLWidget.
/// </summary>
/// <param name="d">Ignored</param>
void Fractorium::OnHeightChanged(int d) { }
template <typename T> void FractoriumEmberController<T>::HeightChanged(unsigned int i) { Update([&] { m_Ember.m_FinalRasH = i; }); }
void Fractorium::OnHeightChanged(int i) { m_Controller->HeightChanged(i); }
/// <summary>
/// Set the x offset applied to the center of the image.

View File

@ -27,6 +27,7 @@
#include <QItemDelegate>
#include <QApplication>
#include <QSettings>
#include <QStandardPaths>
#include <QGLWidget>
#include <QOpenGLFunctions_2_0.h>
#include <QtWidgets/QMainWindow>

View File

@ -102,14 +102,14 @@ void FractoriumEmberControllerBase::DeleteRenderer()
}
/// <summary>
/// Save the current contents of the GL window to a file.
/// Save the current render results to a file.
/// This could benefit from QImageWriter, however it's compression capabilities are
/// severely lacking. A Png file comes out larger than a bitmap, so instead use the
/// Png and Jpg wrapper functions from the command line programs.
/// This will embed the id, url and nick fields from the options in the image comments.
/// </summary>
/// <param name="filename">The full path and filename</param>
void FractoriumEmberControllerBase::SaveCurrentRender(QString filename)
void FractoriumEmberControllerBase::SaveCurrentRender(const QString& filename, bool forcePull)
{
if (filename != "")
{
@ -124,15 +124,22 @@ void FractoriumEmberControllerBase::SaveCurrentRender(QString filename)
FractoriumSettings* settings = m_Fractorium->m_Settings;
RendererCLBase* rendererCL = dynamic_cast<RendererCLBase*>(m_Renderer.get());
if (rendererCL && m_Renderer->PrepFinalAccumVector(m_FinalImage))
if (forcePull && rendererCL && m_Renderer->PrepFinalAccumVector(m_FinalImage))
{
if (!rendererCL->ReadFinal(m_FinalImage.data()))
{
QMessageBox::critical(m_Fractorium, "GPU Read Error", "Could not read image from the GPU, aborting image save.");
m_Fractorium->ShowCritical("GPU Read Error", "Could not read image from the GPU, aborting image save.", true);
return;
}
}
//Ensure dimensions are valid.
if (m_FinalImage.size() < (width * height * m_Renderer->NumChannels() * m_Renderer->BytesPerChannel()))
{
m_Fractorium->ShowCritical("Save Failed", "Dimensions didn't match, not saving.", true);
return;
}
data = m_FinalImage.data();//Png and channels = 4.
if ((suffix == "jpg" || suffix == "bmp") && m_Renderer->NumChannels() == 4)
@ -146,7 +153,7 @@ void FractoriumEmberControllerBase::SaveCurrentRender(QString filename)
string id = settings->Id().toStdString();
string url = settings->Url().toStdString();
string nick = settings->Nick().toStdString();
EmberImageComments comments = m_Renderer->ImageComments(0, false, true);
EmberImageComments comments = m_Renderer->ImageComments(m_Stats, 0, false, true);
if (suffix == "png")
b = WritePng(s.c_str(), data, width, height, 1, true, comments, id, url, nick);
@ -155,12 +162,15 @@ void FractoriumEmberControllerBase::SaveCurrentRender(QString filename)
else if (suffix == "bmp")
b = WriteBmp(s.c_str(), data, width, height);
else
QMessageBox::critical(m_Fractorium, "Save Failed", "Unrecognized format " + suffix + ", not saving.");
{
m_Fractorium->ShowCritical("Save Failed", "Unrecognized format " + suffix + ", not saving.", true);
return;
}
if (b)
settings->SaveFolder(fileInfo.canonicalPath());
else
QMessageBox::critical(m_Fractorium, "Save Failed", "Could not save file, try saving to a different folder.");
m_Fractorium->ShowCritical("Save Failed", "Could not save file, try saving to a different folder.", true);
}
}
@ -241,27 +251,56 @@ void FractoriumEmberController<T>::ClearUndo()
m_Fractorium->ui.ActionRedo->setEnabled(false);
}
/// <summary>
/// The hierarchy/order of sizes is like so:
/// Ember
/// GL Widget
/// Texture (passed to RendererCL)
/// Viewport
/// Since this uses m_GL->SizesMatch(), which uses the renderer's dimensions, this
/// must be called after the renderer has set the current ember.
/// </summary>
/// <returns>True if dimensions had to be resized due to a mismatch, else false.</returns>
template <typename T>
bool FractoriumEmberController<T>::SyncSizes()
{
bool changed = false;
GLWidget* gl = m_Fractorium->ui.GLDisplay;
RendererCL<T>* rendererCL;
if (!m_GLController->SizesMatch())
{
m_GLController->ClearWindow();
gl->SetDimensions(m_Ember.m_FinalRasW, m_Ember.m_FinalRasH);
gl->Allocate();
gl->SetViewport();
if (m_Renderer->RendererType() == OPENCL_RENDERER && (rendererCL = (RendererCL<T>*)m_Renderer.get()))
rendererCL->SetOutputTexture(gl->OutputTexID());
changed = true;
}
return changed;
}
/// <summary>
/// The main rendering function.
/// Called whenever the event loop is idle.
/// </summary>
/// <returns>True if nothing went wrong, else false.</returns>
template <typename T>
bool FractoriumEmberController<T>::Render()
{
bool success = true;
m_Rendering = true;
bool success = true;
GLWidget* gl = m_Fractorium->ui.GLDisplay;
RendererCL<T>* rendererCL;
eProcessAction action = CondenseAndClearProcessActions();
//Set dimensions first.
if ((m_Ember.m_FinalRasW != gl->width() ||
m_Ember.m_FinalRasH != gl->height()))
{
m_Ember.SetSizeAndAdjustScale(gl->width(), gl->height(), false, SCALE_WIDTH);
m_Fractorium->m_ScaleSpin->SetValueStealth(m_Ember.m_PixelsPerUnit);
action = FULL_RENDER;
}
if (m_Renderer->RendererType() == OPENCL_RENDERER)
rendererCL = (RendererCL<T>*)m_Renderer.get();
//Force temporal samples to always be 1. Perhaps change later when animation is implemented.
m_Ember.m_TemporalSamples = 1;
@ -293,6 +332,13 @@ bool FractoriumEmberController<T>::Render()
}
}
//Ensure sizes are equal and if not, update dimensions.
if (SyncSizes())
{
action = FULL_RENDER;
return true;
}
//Determining if a completely new rendering process is being started.
bool iterBegin = ProcessState() == NONE;
@ -332,11 +378,11 @@ bool FractoriumEmberController<T>::Render()
if (ProcessState() == ACCUM_DONE)
{
EmberStats stats = m_Renderer->Stats();
QString iters = ToString(stats.m_Iters);
QString scaledQuality = ToString((unsigned int)m_Renderer->ScaledQuality());
string renderTime = m_RenderElapsedTimer.Format(m_RenderElapsedTimer.Toc());
m_Fractorium->m_ProgressBar->setValue(100);
QString iters = QLocale(QLocale::English).toString(stats.m_Iters);
QString scaledQuality = QString::number((unsigned int)m_Renderer->ScaledQuality());
string renderTime = m_RenderElapsedTimer.Format(m_RenderElapsedTimer.Toc());
//Only certain status can be reported with OpenCL.
if (m_Renderer->RendererType() == OPENCL_RENDERER)
@ -346,8 +392,8 @@ bool FractoriumEmberController<T>::Render()
else
{
double percent = (double)stats.m_Badvals / (double)stats.m_Iters;
QString badVals = QLocale(QLocale::English).toString(stats.m_Badvals);
QString badPercent = QLocale(QLocale::English).toString(percent * 100, 'f', 2);
QString badVals = ToString(stats.m_Badvals);
QString badPercent = QLocale::system().toString(percent * 100, 'f', 2);
m_Fractorium->m_RenderStatusLabel->setText("Iters: " + iters + ". Scaled quality: " + scaledQuality + ". Bad values: " + badVals + " (" + badPercent + "%). Total time: " + QString::fromStdString(renderTime));
}
@ -385,7 +431,7 @@ bool FractoriumEmberController<T>::Render()
//Uncomment for debugging kernel build and execution errors.
//m_Fractorium->ui.InfoRenderingTextEdit->setText(QString::fromStdString(m_Fractorium->m_Wrapper.DumpInfo()));
//if (RendererCL<T>* rendererCL = dynamic_cast<RendererCL<T>*>(m_Renderer.get()))
//if (rendererCL)
// m_Fractorium->ui.InfoRenderingTextEdit->setText(QString::fromStdString(rendererCL->IterKernel()));
}
}
@ -404,11 +450,10 @@ bool FractoriumEmberController<T>::Render()
m_Rendering = false;
StopRenderTimer(true);
m_Fractorium->m_RenderStatusLabel->setText("Rendering failed 3 or more times, stopping all rendering, see info tab. Try changing renderer types.");
memset(m_FinalImage.data(), 0, m_FinalImage.size());
Memset(m_FinalImage);
if (m_Renderer->RendererType() == OPENCL_RENDERER)
((RendererCL<T>*)m_Renderer.get())->ClearFinal();
if (rendererCL)
rendererCL->ClearFinal();
m_GLController->ClearWindow();
}
@ -461,7 +506,7 @@ bool FractoriumEmberController<T>::CreateRenderer(eRendererType renderType, unsi
else
{
ok = false;
QMessageBox::critical(m_Fractorium, "Renderer Creation Error", "Could not create requested renderer, fallback CPU renderer created. See info tab for details.");
m_Fractorium->ShowCritical("Renderer Creation Error", "Could not create requested renderer, fallback CPU renderer created. See info tab for details.");
m_Fractorium->ErrorReportToQTextEdit(errorReport, m_Fractorium->ui.InfoRenderingTextEdit);
}
}
@ -503,7 +548,7 @@ bool FractoriumEmberController<T>::CreateRenderer(eRendererType renderType, unsi
else
{
ok = false;
QMessageBox::critical(m_Fractorium, "Renderer Creation Error", "Creating a basic CPU renderer failed, something is catastrophically wrong. Exiting program.");
m_Fractorium->ShowCritical("Renderer Creation Error", "Creating a basic CPU renderer failed, something is catastrophically wrong. Exiting program.");
QApplication::quit();
}
@ -525,7 +570,7 @@ bool Fractorium::CreateRendererFromOptions()
m_Settings->DeviceIndex()))
{
//If using OpenCL, will only get here if creating RendererCL failed, but creating a backup CPU Renderer succeeded.
QMessageBox::critical(this, "Renderer Creation Error", "Error creating renderer, most likely a GPU problem. Using CPU instead.");
ShowCritical("Renderer Creation Error", "Error creating renderer, most likely a GPU problem. Using CPU instead.");
m_Settings->OpenCL(false);
m_OptionsDialog->ui.OpenCLCheckBox->setChecked(false);
m_FinalRenderDialog->ui.FinalRenderOpenCLCheckBox->setChecked(false);

View File

@ -17,12 +17,6 @@ FractoriumSettings::FractoriumSettings(QObject* parent)
/// </summary>
void FractoriumSettings::EnsureDefaults()
{
if (FinalWidth() == 0)
FinalWidth(1920);
if (FinalHeight() == 0)
FinalHeight(1080);
if (FinalQuality() == 0)
FinalQuality(1000);
@ -32,11 +26,8 @@ void FractoriumSettings::EnsureDefaults()
if (FinalSupersample() == 0)
FinalSupersample(2);
if (XmlWidth() == 0)
XmlWidth(1920);
if (XmlHeight() == 0)
XmlHeight(1080);
if (FinalStrips() == 0)
FinalStrips(1);
if (XmlTemporalSamples() == 0)
XmlTemporalSamples(1000);
@ -89,8 +80,19 @@ void FractoriumSettings::EnsureDefaults()
if (SaveImageExt() == "")
SaveImageExt("Png (*.png)");
if (FinalDoAllExt() != "jpg" && FinalDoAllExt() != "png")
FinalDoAllExt("png");
if (FinalExt() != "jpg" && FinalExt() != "png")
FinalExt("png");
QString s = SaveFolder();
QDir dir(s);
if (s.isEmpty() || !dir.exists())
{
QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DesktopLocation);
if (!paths.empty())
SaveFolder(paths[0]);
}
}
/// <summary>
@ -170,8 +172,8 @@ void FractoriumSettings::FinalKeepAspect(bool b) { setValue(FINALKEEPASPECT,
unsigned int FractoriumSettings::FinalScale() { return value(FINALSCALE).toUInt(); }
void FractoriumSettings::FinalScale(unsigned int i) { setValue(FINALSCALE, i); }
QString FractoriumSettings::FinalDoAllExt() { return value(FINALDOALLEXT).toString(); }
void FractoriumSettings::FinalDoAllExt(QString s) { setValue(FINALDOALLEXT, s); }
QString FractoriumSettings::FinalExt() { return value(FINALEXT).toString(); }
void FractoriumSettings::FinalExt(const QString& s) { setValue(FINALEXT, s); }
unsigned int FractoriumSettings::FinalPlatformIndex() { return value(FINALPLATFORMINDEX).toUInt(); }
void FractoriumSettings::FinalPlatformIndex(unsigned int i) { setValue(FINALPLATFORMINDEX, i); }
@ -182,12 +184,6 @@ void FractoriumSettings::FinalDeviceIndex(unsigned int i) { setValue(FINALDE
unsigned int FractoriumSettings::FinalThreadCount() { return value(FINALTHREADCOUNT).toUInt(); }
void FractoriumSettings::FinalThreadCount(unsigned int i) { setValue(FINALTHREADCOUNT, i); }
unsigned int FractoriumSettings::FinalWidth() { return value(FINALWIDTH).toUInt(); }
void FractoriumSettings::FinalWidth(unsigned int i) { setValue(FINALWIDTH, i); }
unsigned int FractoriumSettings::FinalHeight() { return value(FINALHEIGHT).toUInt(); }
void FractoriumSettings::FinalHeight(unsigned int i) { setValue(FINALHEIGHT, i); }
unsigned int FractoriumSettings::FinalQuality() { return value(FINALQUALITY).toUInt(); }
void FractoriumSettings::FinalQuality(unsigned int i) { setValue(FINALQUALITY, i); }
@ -197,15 +193,12 @@ void FractoriumSettings::FinalTemporalSamples(unsigned int i) { setValue(FINALTE
unsigned int FractoriumSettings::FinalSupersample() { return value(FINALSUPERSAMPLE).toUInt(); }
void FractoriumSettings::FinalSupersample(unsigned int i) { setValue(FINALSUPERSAMPLE, i); }
unsigned int FractoriumSettings::FinalStrips() { return value(FINALSTRIPS).toUInt(); }
void FractoriumSettings::FinalStrips(unsigned int i) { setValue(FINALSTRIPS, i); }
/// <summary>
/// Xml file saving settings.
/// </summary>
unsigned int FractoriumSettings::XmlWidth() { return value(XMLWIDTH).toUInt(); }
void FractoriumSettings::XmlWidth(unsigned int i) { setValue(XMLWIDTH, i); }
unsigned int FractoriumSettings::XmlHeight() { return value(XMLHEIGHT).toUInt(); }
void FractoriumSettings::XmlHeight(unsigned int i) { setValue(XMLHEIGHT, i); }
unsigned int FractoriumSettings::XmlTemporalSamples() { return value(XMLTEMPORALSAMPLES).toUInt(); }
void FractoriumSettings::XmlTemporalSamples(unsigned int i) { setValue(XMLTEMPORALSAMPLES, i); }
@ -217,32 +210,32 @@ unsigned int FractoriumSettings::XmlSupersample() { return value(XML
void FractoriumSettings::XmlSupersample(unsigned int i) { setValue(XMLSUPERSAMPLE, i); }
QString FractoriumSettings::Id() { return value(IDENTITYID).toString(); }
void FractoriumSettings::Id(QString s) { setValue(IDENTITYID, s); }
void FractoriumSettings::Id(const QString& s) { setValue(IDENTITYID, s); }
QString FractoriumSettings::Url() { return value(IDENTITYURL).toString(); }
void FractoriumSettings::Url(QString s) { setValue(IDENTITYURL, s); }
void FractoriumSettings::Url(const QString& s) { setValue(IDENTITYURL, s); }
QString FractoriumSettings::Nick() { return value(IDENTITYNICK).toString(); }
void FractoriumSettings::Nick(QString s) { setValue(IDENTITYNICK, s); }
void FractoriumSettings::Nick(const QString& s) { setValue(IDENTITYNICK, s); }
/// <summary>
/// General operations settings.
/// </summary>
QString FractoriumSettings::OpenFolder() { return value(OPENFOLDER).toString(); }
void FractoriumSettings::OpenFolder(QString s) { setValue(OPENFOLDER, s); }
void FractoriumSettings::OpenFolder(const QString& s) { setValue(OPENFOLDER, s); }
QString FractoriumSettings::SaveFolder() { return value(SAVEFOLDER).toString(); }
void FractoriumSettings::SaveFolder(QString s) { setValue(SAVEFOLDER, s); }
void FractoriumSettings::SaveFolder(const QString& s) { setValue(SAVEFOLDER, s); }
QString FractoriumSettings::OpenXmlExt() { return value(OPENXMLEXT).toString(); }
void FractoriumSettings::OpenXmlExt(QString s) { setValue(OPENXMLEXT, s); }
void FractoriumSettings::OpenXmlExt(const QString& s) { setValue(OPENXMLEXT, s); }
QString FractoriumSettings::SaveXmlExt() { return value(SAVEXMLEXT).toString(); }
void FractoriumSettings::SaveXmlExt(QString s) { setValue(SAVEXMLEXT, s); }
void FractoriumSettings::SaveXmlExt(const QString& s) { setValue(SAVEXMLEXT, s); }
QString FractoriumSettings::OpenImageExt() { return value(OPENIMAGEEXT).toString(); }
void FractoriumSettings::OpenImageExt(QString s) { setValue(OPENIMAGEEXT, s); }
void FractoriumSettings::OpenImageExt(const QString& s) { setValue(OPENIMAGEEXT, s); }
QString FractoriumSettings::SaveImageExt() { return value(SAVEIMAGEEXT).toString(); }
void FractoriumSettings::SaveImageExt(QString s) { setValue(SAVEIMAGEEXT, s); }
void FractoriumSettings::SaveImageExt(const QString& s) { setValue(SAVEIMAGEEXT, s); }

View File

@ -30,15 +30,14 @@
#define FINALDOSEQUENCE "finalrender/dosequence"
#define FINALKEEPASPECT "finalrender/keepaspect"
#define FINALSCALE "finalrender/scale"
#define FINALDOALLEXT "finalrender/doallext"
#define FINALEXT "finalrender/ext"
#define FINALPLATFORMINDEX "finalrender/platformindex"
#define FINALDEVICEINDEX "finalrender/deviceindex"
#define FINALTHREADCOUNT "finalrender/threadcount"
#define FINALWIDTH "finalrender/width"
#define FINALHEIGHT "finalrender/height"
#define FINALQUALITY "finalrender/quality"
#define FINALTEMPORALSAMPLES "finalrender/temporalsamples"
#define FINALSUPERSAMPLE "finalrender/supersample"
#define FINALSTRIPS "finalrender/strips"
#define XMLWIDTH "xml/width"
#define XMLHEIGHT "xml/height"
@ -139,8 +138,8 @@ public:
unsigned int FinalScale();
void FinalScale(unsigned int i);
QString FinalDoAllExt();
void FinalDoAllExt(QString s);
QString FinalExt();
void FinalExt(const QString& s);
unsigned int FinalPlatformIndex();
void FinalPlatformIndex(unsigned int b);
@ -151,12 +150,6 @@ public:
unsigned int FinalThreadCount();
void FinalThreadCount(unsigned int b);
unsigned int FinalWidth();
void FinalWidth(unsigned int i);
unsigned int FinalHeight();
void FinalHeight(unsigned int i);
unsigned int FinalQuality();
void FinalQuality(unsigned int i);
@ -166,11 +159,8 @@ public:
unsigned int FinalSupersample();
void FinalSupersample(unsigned int i);
unsigned int XmlWidth();
void XmlWidth(unsigned int i);
unsigned int XmlHeight();
void XmlHeight(unsigned int i);
unsigned int FinalStrips();
void FinalStrips(unsigned int i);
unsigned int XmlTemporalSamples();
void XmlTemporalSamples(unsigned int i);
@ -182,29 +172,29 @@ public:
void XmlSupersample(unsigned int i);
QString OpenFolder();
void OpenFolder(QString s);
void OpenFolder(const QString& s);
QString SaveFolder();
void SaveFolder(QString s);
void SaveFolder(const QString& s);
QString OpenXmlExt();
void OpenXmlExt(QString s);
void OpenXmlExt(const QString& s);
QString SaveXmlExt();
void SaveXmlExt(QString s);
void SaveXmlExt(const QString& s);
QString OpenImageExt();
void OpenImageExt(QString s);
void OpenImageExt(const QString& s);
QString SaveImageExt();
void SaveImageExt(QString s);
void SaveImageExt(const QString& s);
QString Id();
void Id(QString s);
void Id(const QString& s);
QString Url();
void Url(QString s);
void Url(const QString& s);
QString Nick();
void Nick(QString s);
void Nick(const QString& s);
};

View File

@ -334,7 +334,7 @@ void Fractorium::FillXforms()
for (i = 0; i < m_Controller->XformCount(); i++)
{
combo->addItem(QString::number(i + 1));
combo->addItem(ToString(i + 1));
combo->setItemIcon(i, m_XformComboIcons[i % XFORM_COLOR_COUNT]);
}

View File

@ -213,7 +213,7 @@ void Fractorium::OnRotateCButtonClicked(bool checked)
bool ok;
bool pre = sender() == ui.PreRotateCButton;
QComboBox* combo = pre ? ui.PreRotateCombo : ui.PostRotateCombo;
double d = combo->currentText().toDouble(&ok);
double d = ToDouble(combo->currentText(), &ok);
if (ok)
m_Controller->RotateCurrentXformByAngle(d, pre);
@ -230,7 +230,7 @@ void Fractorium::OnRotateCcButtonClicked(bool checked)
bool ok;
bool pre = sender() == ui.PreRotateCcButton;
QComboBox* combo = pre ? ui.PreRotateCombo : ui.PostRotateCombo;
double d = combo->currentText().toDouble(&ok);
double d = ToDouble(combo->currentText(), &ok);
if (ok)
m_Controller->RotateCurrentXformByAngle(-d, pre);
@ -267,7 +267,7 @@ void Fractorium::OnMoveUpButtonClicked(bool checked)
bool ok;
bool pre = sender() == ui.PreMoveUpButton;
QComboBox* combo = pre ? ui.PreMoveCombo : ui.PostMoveCombo;
double d = combo->currentText().toDouble(&ok);
double d = ToDouble(combo->currentText(), &ok);
if (ok)
m_Controller->MoveCurrentXform(0, d, pre);
@ -284,7 +284,7 @@ void Fractorium::OnMoveDownButtonClicked(bool checked)
bool ok;
bool pre = sender() == ui.PreMoveDownButton;
QComboBox* combo = pre ? ui.PreMoveCombo : ui.PostMoveCombo;
double d = combo->currentText().toDouble(&ok);
double d = ToDouble(combo->currentText(), &ok);
if (ok)
m_Controller->MoveCurrentXform(0, -d, pre);
@ -301,7 +301,7 @@ void Fractorium::OnMoveLeftButtonClicked(bool checked)
bool ok;
bool pre = sender() == ui.PreMoveLeftButton;
QComboBox* combo = pre ? ui.PreMoveCombo : ui.PostMoveCombo;
double d = combo->currentText().toDouble(&ok);
double d = ToDouble(combo->currentText(), &ok);
if (ok)
m_Controller->MoveCurrentXform(-d, 0, pre);
@ -318,7 +318,7 @@ void Fractorium::OnMoveRightButtonClicked(bool checked)
bool ok;
bool pre = sender() == ui.PreMoveRightButton;
QComboBox* combo = pre ? ui.PreMoveCombo : ui.PostMoveCombo;
double d = combo->currentText().toDouble(&ok);
double d = ToDouble(combo->currentText(), &ok);
if (ok)
m_Controller->MoveCurrentXform(d, 0, pre);
@ -356,7 +356,7 @@ void Fractorium::OnScaleDownButtonClicked(bool checked)
bool ok;
bool pre = sender() == ui.PreScaleDownButton;
QComboBox* combo = pre ? ui.PreScaleCombo : ui.PostScaleCombo;
double d = combo->currentText().toDouble(&ok);
double d = ToDouble(combo->currentText(), &ok);
if (ok)
m_Controller->ScaleCurrentXform(1.0 / (d / 100.0), pre);
@ -373,7 +373,7 @@ void Fractorium::OnScaleUpButtonClicked(bool checked)
bool ok;
bool pre = sender() == ui.PreScaleUpButton;
QComboBox* combo = pre ? ui.PreScaleCombo : ui.PostScaleCombo;
double d = combo->currentText().toDouble(&ok);
double d = ToDouble(combo->currentText(), &ok);
if (ok)
m_Controller->ScaleCurrentXform(d / 100.0, pre);

View File

@ -121,7 +121,7 @@ void Fractorium::OnSoloXformCheckBoxStateChanged(int state)
if (state == Qt::Checked)
{
ui.CurrentXformCombo->setProperty("soloxform", ui.CurrentXformCombo->currentIndex());
ui.SoloXformCheckBox->setText("Solo (" + QString::number(ui.CurrentXformCombo->currentIndex() + 1) + ")");
ui.SoloXformCheckBox->setText("Solo (" + ToString(ui.CurrentXformCombo->currentIndex() + 1) + ")");
}
else if (state == Qt::Unchecked)
{

View File

@ -62,9 +62,9 @@ QString FractoriumEmberController<T>::MakeXaosNameString(unsigned int i)
if (i != -1)
{
if (m_Fractorium->ui.XaosToRadio->isChecked())
name = QString("From ") + QString::number(curr) + QString(" To ") + QString::number(i);
name = QString("From ") + ToString(curr) + QString(" To ") + ToString(i);
else
name = QString("From ") + QString::number(i) + QString(" To ") + QString::number(curr);
name = QString("From ") + ToString(i) + QString(" To ") + ToString(curr);
//if (xform->m_Name != "")
// name = name + " (" + QString::fromStdString(xform->m_Name) + ")";

View File

@ -60,7 +60,7 @@ public:
virtual void MouseRelease(QMouseEvent* e) { }
virtual void MouseMove(QMouseEvent* e) { }
virtual void Wheel(QWheelEvent* e) { }
virtual bool SyncSizes() { return false; }
virtual bool SizesMatch() { return false; }
virtual bool CheckForSizeMismatch(int w, int h) { return true; }
virtual void QueryMatrices(bool print) { }
@ -86,16 +86,16 @@ class GLEmberController : public GLEmberControllerBase
public:
GLEmberController(Fractorium* fractorium, GLWidget* glWidget, FractoriumEmberController<T>* controller);
virtual ~GLEmberController();
virtual void DrawImage();
virtual void DrawAffines(bool pre, bool post);
virtual void ClearWindow();
virtual void MousePress(QMouseEvent* e);
virtual void MouseRelease(QMouseEvent* e);
virtual void MouseMove(QMouseEvent* e);
virtual void Wheel(QWheelEvent* e);
virtual void QueryMatrices(bool print);
virtual bool SyncSizes();
virtual bool CheckForSizeMismatch(int w, int h);
virtual void DrawImage() override;
virtual void DrawAffines(bool pre, bool post) override;
virtual void ClearWindow() override;
virtual void MousePress(QMouseEvent* e) override;
virtual void MouseRelease(QMouseEvent* e) override;
virtual void MouseMove(QMouseEvent* e) override;
virtual void Wheel(QWheelEvent* e) override;
virtual void QueryMatrices(bool print) override;
virtual bool SizesMatch() override;
virtual bool CheckForSizeMismatch(int w, int h) override;
T CalcScale();
T CalcRotation();

View File

@ -120,6 +120,7 @@ void GLEmberController<T>::ClearWindow()
m_GL->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GL->glClearColor(ember->m_Background.r, ember->m_Background.g, ember->m_Background.b, 1.0);
m_GL->makeCurrent();
m_GL->swapBuffers();
m_GL->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -159,10 +160,13 @@ void GLWidget::SetMainWindow(Fractorium* f) { m_Fractorium = f; }
bool GLWidget::Init() { return m_Init; }
bool GLWidget::Drawing() { return m_Drawing; }
GLint GLWidget::MaxTexSize() { return m_MaxTexSize; }
GLuint GLWidget::OutputTexID() { return m_OutputTexID; }
/// <summary>
/// Initialize OpenGL, called once at startup after the main window constructor finishes.
/// Although it seems an awkward place to put some of this setup code, the dimensions of the
/// main window and its widgets are not fully initialized before this is called.
/// Once this is done, the render timer is started after a short delay.
/// Rendering is then clear to begin.
/// </summary>
@ -172,6 +176,20 @@ void GLWidget::initializeGL()
{
glClearColor(0.0, 0.0, 0.0, 1.0);
int w = m_Fractorium->ui.GLParentScrollArea->width();
int h = m_Fractorium->ui.GLParentScrollArea->height();
SetDimensions(w, h);
m_Fractorium->m_WidthSpin->setValue(w);
m_Fractorium->m_HeightSpin->setValue(h);
glEnable(GL_TEXTURE_2D);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_MaxTexSize);
glDisable(GL_TEXTURE_2D);
m_Fractorium->m_WidthSpin->setMaximum(m_MaxTexSize);
m_Fractorium->m_HeightSpin->setMaximum(m_MaxTexSize);
//Start with a flock of 10 random embers. Can't do this until now because the window wasn't maximized yet, so the sizes would have been off.
m_Fractorium->OnActionNewFlock(false);
m_Fractorium->m_Controller->DelayedStartRenderTimer();
@ -193,9 +211,7 @@ void GLWidget::paintGL()
RendererBase* renderer = controller->Renderer();
m_Drawing = true;
//renderer->EnterResize();
controller->GLController()->DrawImage();
//renderer->LeaveResize();//Unlock, may not be necessary.
//Affine drawing.
bool pre = m_Fractorium->ui.PreAffineGroupBox->isChecked();
@ -244,23 +260,23 @@ void GLEmberController<T>::DrawImage()
{
RendererBase* renderer = m_FractoriumEmberController->Renderer();
Ember<T>* ember = m_FractoriumEmberController->CurrentEmber();
m_GL->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GL->glClearColor(ember->m_Background.r, ember->m_Background.g, ember->m_Background.b, 1.0);
m_GL->glDisable(GL_DEPTH_TEST);
renderer->EnterFinalAccum();//Lock, may not be necessary, but just in case.
renderer->EnterResize();
if (SyncSizes())//Ensure all sizes are correct. If not, do nothing.
if (SizesMatch())//Ensure all sizes are correct. If not, do nothing.
{
vector<unsigned char>* finalImage = m_FractoriumEmberController->FinalImage();
if (renderer->RendererType() == OPENCL_RENDERER || finalImage)//Final image only matters for CPU renderer.
if (renderer->RendererType() == OPENCL_RENDERER || finalImage->size() == renderer->FinalBufferSize())
m_GL->DrawQuad();//Output image is drawn here.
}
renderer->LeaveResize();//Unlock, may not be necessary.
renderer->LeaveFinalAccum();
}
@ -575,7 +591,7 @@ void GLEmberController<T>::MouseMove(QMouseEvent* e)
glm::ivec2 mouse(e->x(), e->y());
v3T mouseFlipped(e->x(), m_Viewport[3] - e->y(), 0);//Must flip y because in OpenGL, 0,0 is bottom left, but in windows, it's top left.
Ember<T>* ember = m_FractoriumEmberController->CurrentEmber();
//First check to see if the mouse actually moved.
if (mouse == m_MousePos)
return;
@ -650,7 +666,7 @@ void GLEmberController<T>::MouseMove(QMouseEvent* e)
//if (m_HoverXform == previousHover)
// draw = false;
}
//Only update if the user was dragging or hovered over a point.
//Use repaint() to update immediately for a more responsive feel.
if ((m_DragState != DragNone) || draw)
@ -665,10 +681,10 @@ void GLEmberController<T>::MouseMove(QMouseEvent* e)
void GLWidget::mouseMoveEvent(QMouseEvent* e)
{
setFocus();//Must do this so that this window gets keyboard events.
if (GLEmberControllerBase* controller = GLController())
controller->MouseMove(e);
QGLWidget::mouseMoveEvent(e);
}
@ -711,12 +727,21 @@ void GLWidget::resizeEvent(QResizeEvent* e)
{
if (m_Fractorium)
{
m_Fractorium->m_WidthSpin->setValue(width());
m_Fractorium->m_HeightSpin->setValue(height());
//qDebug() << "GLWidget::resizeEvent() : w, h: " << width() << ", " << height() << ". oldsize: " << e->oldSize().width() << ", " << e->oldSize().height();
//m_Fractorium->m_WidthSpin->setValue(width());
//m_Fractorium->m_HeightSpin->setValue(height());
if (GLEmberControllerBase* controller = GLController())
controller->SyncSizes();//For some reason the base resize can't be called here or else it causes a crash.
// if (GLEmberControllerBase* controller = GLController())
// controller->SyncSizes();//For some reason the base resize can't be called here or else it causes a crash.
}
//QGLWidget::resizeEvent(e);
}
void GLWidget::SetDimensions(int w, int h)
{
setFixedSize(w, h);
m_Fractorium->ui.GLParentScrollAreaContents->setFixedSize(w, h);
}
/// <summary>
@ -729,13 +754,22 @@ void GLWidget::resizeEvent(QResizeEvent* e)
bool GLWidget::Allocate(bool force)
{
bool alloc = false;
bool resize = force || m_TexWidth != width() || m_TexHeight != height();
bool doIt = resize || m_OutputTexID == 0;
if (m_OutputTexID == 0)
if (doIt)
{
m_TexWidth = width();
m_TexHeight = height();
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
if (resize)
{
glBindTexture(GL_TEXTURE_2D, m_OutputTexID);
Deallocate();
}
glGenTextures(1, &m_OutputTexID);
glBindTexture(GL_TEXTURE_2D, m_OutputTexID);
@ -746,28 +780,7 @@ bool GLWidget::Allocate(bool force)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_TexWidth, m_TexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
alloc = true;
}
else
{
if (force || (m_TexWidth != width() || m_TexHeight != height()))
{
m_TexWidth = width();
m_TexHeight = height();
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(GL_TEXTURE_2D, m_OutputTexID);
Deallocate();
glGenTextures(1, &m_OutputTexID);
glBindTexture(GL_TEXTURE_2D, m_OutputTexID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);//Fractron had this as GL_LINEAR_MIPMAP_LINEAR for OpenCL and Cuda.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_TexWidth, m_TexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
alloc = true;
}
}
if (alloc)
{
glBindTexture(GL_TEXTURE_2D, 0);
@ -801,45 +814,33 @@ bool GLWidget::Deallocate()
/// </summary>
void GLWidget::SetViewport()
{
if (m_Init && (m_ViewWidth != width() || m_ViewHeight != height()))
if (m_Init && (m_ViewWidth != m_TexWidth || m_ViewHeight != m_TexHeight))
{
glViewport(0, 0, (GLint)width(), (GLint)height());
m_ViewWidth = width();
m_ViewHeight = height();
glViewport(0, 0, (GLint)m_TexWidth, (GLint)m_TexHeight);
m_ViewWidth = m_TexWidth;
m_ViewHeight = m_TexHeight;
}
}
/// <summary>
/// Synchronize the size of the renderer output image, the texture, and this window.
/// They must all match. If the renderer output size doesn't match, then the render
/// timer is stopped and restarted with a delay.
/// This will get called once or twice when a resize occurs.
/// Determine whether the dimensions of the renderer's current ember match
/// the dimensions of the widget, texture and viewport.
/// Since this uses the renderer's dimensions, this
/// must be called after the renderer has set the current ember.
/// </summary>
/// <returns>True if all sizes match, else false.</returns>
template <typename T>
bool GLEmberController<T>::SyncSizes()
bool GLEmberController<T>::SizesMatch()
{
if (m_GL->Init())
{
m_GL->SetViewport();
Ember<T>* ember = m_FractoriumEmberController->CurrentEmber();
//First make sure the dimensions of the ember match the window size.
if (CheckForSizeMismatch(m_GL->width(), m_GL->height()))
{
if (m_Fractorium)//This will stop the rendering process and start the reset timer.
m_Fractorium->Resize();
return false;
}
//The renderer and window dimensions match, now make sure the dims of the texture match.
if (!m_GL->Allocate())
return false;
return true;
}
return false;
return (ember &&
ember->m_FinalRasW == m_GL->width() &&
ember->m_FinalRasH == m_GL->height() &&
m_GL->width() == m_GL->m_TexWidth &&
m_GL->height() == m_GL->m_TexHeight &&
m_GL->m_TexWidth == m_GL->m_ViewWidth &&
m_GL->m_TexHeight == m_GL->m_ViewHeight);
}
/// <summary>

View File

@ -43,20 +43,22 @@ public:
void SetMainWindow(Fractorium* f);
bool Init();
bool Drawing();
GLint MaxTexSize();
GLuint OutputTexID();
protected:
virtual void initializeGL();
virtual void paintGL();
virtual void keyPressEvent(QKeyEvent* e);
virtual void keyReleaseEvent(QKeyEvent* e);
virtual void mousePressEvent(QMouseEvent* e);
virtual void mouseReleaseEvent(QMouseEvent* e);
virtual void mouseMoveEvent(QMouseEvent* e);
virtual void wheelEvent(QWheelEvent* e);
virtual void resizeEvent(QResizeEvent* e);
virtual void initializeGL() override;
virtual void paintGL() override;
virtual void keyPressEvent(QKeyEvent* e) override;
virtual void keyReleaseEvent(QKeyEvent* e) override;
virtual void mousePressEvent(QMouseEvent* e) override;
virtual void mouseReleaseEvent(QMouseEvent* e) override;
virtual void mouseMoveEvent(QMouseEvent* e) override;
virtual void wheelEvent(QWheelEvent* e) override;
virtual void resizeEvent(QResizeEvent* e) override;
private:
void SetDimensions(int w, int h);
bool Allocate(bool force = false);
bool Deallocate();
void SetViewport();
@ -67,6 +69,7 @@ private:
bool m_Init;
bool m_Drawing;
GLint m_MaxTexSize;
GLint m_TexWidth;
GLint m_TexHeight;
GLint m_ViewWidth;

View File

@ -21,11 +21,9 @@ FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, Q
connect(ui.OpenCLCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnOpenCLCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.PlatformCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(OnPlatformComboCurrentIndexChanged(int)), Qt::QueuedConnection);
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlWidthSpin, spinHeight, 10, 100000, 50, "", "", true, 1920);
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlHeightSpin, spinHeight, 10, 100000, 50, "", "", true, 1080);
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlTemporalSamplesSpin, spinHeight, 1, 1000, 100, "", "", true, 1000);
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlQualitySpin, spinHeight, 1, 200000, 50, "", "", true, 1000);
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlSupersampleSpin, spinHeight, 1, 4, 1, "", "", true, 2);
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlTemporalSamplesSpin, spinHeight, 1, 1000, 100, "", "", true, 1000);
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlQualitySpin, spinHeight, 1, 200000, 50, "", "", true, 1000);
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlSupersampleSpin, spinHeight, 1, 4, 1, "", "", true, 2);
m_IdEdit = new QLineEdit(ui.OptionsIdentityTable);
ui.OptionsIdentityTable->setCellWidget(0, 1, m_IdEdit);
@ -91,8 +89,6 @@ FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, Q
ui.CpuSubBatchSpin->setValue(m_Settings->CpuSubBatch());
ui.OpenCLSubBatchSpin->setValue(m_Settings->OpenCLSubBatch());
m_XmlWidthSpin->setValue(m_Settings->XmlWidth());
m_XmlHeightSpin->setValue(m_Settings->XmlHeight());
m_XmlTemporalSamplesSpin->setValue(m_Settings->XmlTemporalSamples());
m_XmlQualitySpin->setValue(m_Settings->XmlQuality());
m_XmlSupersampleSpin->setValue(m_Settings->XmlSupersample());
@ -167,8 +163,6 @@ void FractoriumOptionsDialog::accept()
m_Settings->OpenCLDEFilter(ui.OpenCLFilteringDERadioButton->isChecked());
//Xml saving.
m_Settings->XmlWidth(m_XmlWidthSpin->value());
m_Settings->XmlHeight(m_XmlHeightSpin->value());
m_Settings->XmlTemporalSamples(m_XmlTemporalSamplesSpin->value());
m_Settings->XmlQuality(m_XmlQualitySpin->value());
m_Settings->XmlSupersample(m_XmlSupersampleSpin->value());
@ -203,8 +197,6 @@ void FractoriumOptionsDialog::reject()
ui.OpenCLFilteringDERadioButton->setChecked(m_Settings->OpenCLDEFilter());
//Xml saving.
m_XmlWidthSpin->setValue(m_Settings->XmlWidth());
m_XmlHeightSpin->setValue(m_Settings->XmlHeight());
m_XmlTemporalSamplesSpin->setValue(m_Settings->XmlTemporalSamples());
m_XmlQualitySpin->setValue(m_Settings->XmlQuality());
m_XmlSupersampleSpin->setValue(m_Settings->XmlSupersample());

View File

@ -46,8 +46,6 @@ private:
Ui::OptionsDialog ui;
OpenCLWrapper m_Wrapper;
SpinBox* m_XmlWidthSpin;
SpinBox* m_XmlHeightSpin;
SpinBox* m_XmlTemporalSamplesSpin;
SpinBox* m_XmlQualitySpin;
SpinBox* m_XmlSupersampleSpin;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>300</width>
<height>411</height>
<height>347</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,13 +19,13 @@
<property name="minimumSize">
<size>
<width>300</width>
<height>411</height>
<height>347</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>411</height>
<height>347</height>
</size>
</property>
<property name="windowTitle">
@ -67,7 +67,7 @@
</attribute>
<layout class="QFormLayout" name="formLayout">
<property name="verticalSpacing">
<number>6</number>
<number>4</number>
</property>
<property name="leftMargin">
<number>6</number>
@ -79,7 +79,7 @@
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="EarlyClipCheckBox">
@ -324,13 +324,13 @@ in interactive mode for each mouse movement</string>
<property name="minimumSize">
<size>
<width>0</width>
<height>122</height>
<height>66</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>122</height>
<height>66</height>
</size>
</property>
<property name="focusPolicy">
@ -400,27 +400,17 @@ in interactive mode for each mouse movement</string>
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>24</number>
<number>22</number>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>24</number>
<number>22</number>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<row>
<property name="text">
<string>Width</string>
</property>
</row>
<row>
<property name="text">
<string>Height</string>
</property>
</row>
<row>
<property name="text">
<string>Temporal Samples</string>
@ -448,7 +438,7 @@ in interactive mode for each mouse movement</string>
</column>
<item row="0" column="0">
<property name="text">
<string>Width</string>
<string>Temporal Samples</string>
</property>
<property name="flags">
<set>ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
@ -461,7 +451,7 @@ in interactive mode for each mouse movement</string>
</item>
<item row="1" column="0">
<property name="text">
<string>Height</string>
<string>Quality</string>
</property>
<property name="flags">
<set>ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
@ -473,32 +463,6 @@ in interactive mode for each mouse movement</string>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>Temporal Samples</string>
</property>
<property name="flags">
<set>ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item row="2" column="1">
<property name="text">
<string>0</string>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>Quality</string>
</property>
<property name="flags">
<set>ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item row="3" column="1">
<property name="text">
<string>0</string>
</property>
</item>
<item row="4" column="0">
<property name="text">
<string>Supersample</string>
</property>
@ -506,7 +470,7 @@ in interactive mode for each mouse movement</string>
<set>ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item row="4" column="1">
<item row="2" column="1">
<property name="text">
<string>0</string>
</property>
@ -543,13 +507,13 @@ in interactive mode for each mouse movement</string>
<property name="minimumSize">
<size>
<width>120</width>
<height>74</height>
<height>66</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>74</height>
<height>66</height>
</size>
</property>
<property name="focusPolicy">
@ -619,13 +583,13 @@ in interactive mode for each mouse movement</string>
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>24</number>
<number>22</number>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>24</number>
<number>22</number>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>

View File

@ -4,7 +4,7 @@
#include "DoubleSpinBox.h"
/// <summary>
/// TwoButtonWidget and SpinnerButtonWidget classes.
/// TwoButtonComboWidget and SpinnerButtonWidget classes.
/// </summary>
/// <summary>
@ -12,7 +12,7 @@
/// Used for when a layout expects a single widget, but two need to go in its place.
/// The buttons are public so the caller can easily use them individually.
/// </summary>
class TwoButtonWidget : public QWidget
class TwoButtonComboWidget : public QWidget
{
Q_OBJECT
@ -27,12 +27,15 @@ public:
/// <param name="w2">The width of the second button</param>
/// <param name="h">The height of both buttons</param>
/// <param name="parent">The parent widget</param>
TwoButtonWidget(QString caption1, QString caption2, int w1, int w2, int h, QWidget* parent)
TwoButtonComboWidget(const QString& caption1, const QString& caption2, QStringList comboStrings, int w1, int w2, int h, QWidget* parent)
: QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
m_Button1 = new QPushButton(caption1, parent);
m_Button2 = new QPushButton(caption2, parent);
m_Combo = new QComboBox(parent);
m_Combo->addItems(comboStrings);
if (w1 != -1)
{
@ -50,7 +53,10 @@ public:
m_Button1->setMaximumHeight(h);
m_Button2->setMinimumHeight(h);
m_Button2->setMaximumHeight(h);
m_Combo->setMinimumHeight(h - 3);
m_Combo->setMaximumHeight(h - 3);
layout->addWidget(m_Combo);
layout->addWidget(m_Button1);
layout->addWidget(m_Button2);
layout->setAlignment(Qt::AlignLeft);
@ -62,6 +68,7 @@ public:
QPushButton* m_Button1;
QPushButton* m_Button2;
QComboBox* m_Combo;
};
/// <summary>

View File

@ -4,7 +4,7 @@
#include "DoubleSpinBox.h"
/// <summary>
/// TwoButtonWidget class.
/// VariationTreeWidgetItem class.
/// </summary>
/// <summary>