mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 21:20:07 -05:00
018ba26b5f
-Add support for multiple GPU devices. --These options are present in the command line and in Fractorium. -Change scheme of specifying devices from platform,device to just total device index. --Single number on the command line. --Change from combo boxes for device selection to a table of all devices in Fractorium. -Temporal samples defaults to 100 instead of 1000 which was needless overkill. --Bug fixes -EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority. -VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation. -FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull(). --Code changes -Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion(). -EmberMotion.h: Call base constructor. -EmberPch.h: #pragma once only on Windows. -EmberToXml.h: --Handle different types of exceptions. --Add default cases to ToString(). -Isaac.h: Remove unused variable in constructor. -Point.h: Call base constructor in Color(). -Renderer.h/cpp: --Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU. --Make CoordMap() return a const ref, not a pointer. -SheepTools.h: --Use 64-bit types like the rest of the code already does. --Fix some comment misspellings. -Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions. -Utils.h: --Add new functions Equal() and Split(). --Handle more exception types in ReadFile(). --Get rid of most legacy blending of C and C++ argument parsing. -XmlToEmber.h: --Get rid of most legacy blending of C and C++ code from flam3. --Remove some unused variables. -EmberAnimate: --Support multi-GPU processing that alternates full frames between devices. --Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option. --Remove bucketT template parameter, and hard code float in its place. --If a render fails, exit since there is no point in continuing an animation with a missing frame. --Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before. --Remove some unused variables. -EmberGenome, EmberRender: --Support multi-GPU processing that alternates full frames between devices. --Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option. --Remove bucketT template parameter, and hard code float in its place. -EmberRender: --Support multi-GPU processing that alternates full frames between devices. --Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option. --Remove bucketT template parameter, and hard code float in its place. --Only print values when not rendering with OpenCL, since they're always 0 in that case. -EmberCLPch.h: --#pragma once only on Windows. --#include <atomic>. -IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU. -OpenCLWrapper.h: --Move all OpenCL info related code into its own class OpenCLInfo. --Add members to cache the values of global memory size and max allocation size. -RendererCL.h/cpp: --Redesign to accomodate multi-GPU. --Constructor now takes a vector of devices. --Remove DumpErrorReport() function, it's handled in the base. --ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter. --MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit. --Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing. --m_Calls member removed, as it's now per-device. --OpenCLWrapper removed. --m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device. --Added member m_Devices, a vector of unique_ptr of RendererCLDevice. -EmberCommon.h --Added Devices() function to convert from a vector of device indices to a vector of platform,device indices. --Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices. --Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device. --Add more comments to some existing functions. -EmberCommonPch.h: #pragma once only on Windows. -EmberOptions.h: --Remove --platform option, it's just sequential device number now with the --device option. --Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image. --Add Devices() function to parse comma separated --device option string and return a vector of device indices. --Make int and uint types be 64-bit, so intmax_t and size_t. --Make better use of macros. -JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref. -All project files: Turn off buffer security check option in Visual Studio (/Gs-) -deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems. -Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link. -EmberCL.pro: Add new files for multi-GPU support. -build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake} -shared_settings.pri: -Add version string. -Remove old DESTDIR definitions. -Add the following lines or else nothing would build: CONFIG(release, debug|release) { CONFIG += warn_off DESTDIR = ../../../Bin/release } CONFIG(debug, debug|release) { DESTDIR = ../../../Bin/debug } QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t)) LIBS += -L/usr/lib -lpthread -AboutDialog.ui: Another futile attempt to make it look correct on Linux. -FinalRenderDialog.h/cpp: --Add support for multi-GPU. --Change from combo boxes for device selection to a table of all devices. --Ensure device selection makes sense. --Remove "FinalRender" prefix of various function names, it's implied given the context. -FinalRenderEmberController.h/cpp: --Add support for multi-GPU. --Change m_FinishedImageCount to be atomic. --Move CancelRender() from the base to FinalRenderEmberController<T>. --Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread. --Consolidate setting various renderer fields into SyncGuiToRenderer(). -Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table. -FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system. -FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed. -FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used. -FractoriumSettings.h/cpp: --Temporal samples defaults to 100 instead of 1000 which was needless overkill. --Add multi-GPU support, remove old device,platform pair. -FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system. -FractoriumOptionsDialog.h/cpp: --Add support for multi-GPU. --Consolidate more assignments in DataToGui(). --Enable/disable CPU/OpenCL items in response to OpenCL checkbox event. -Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
538 lines
18 KiB
C++
538 lines
18 KiB
C++
#pragma once
|
|
|
|
#include "Variations01.h"
|
|
#include "Variations02.h"
|
|
#include "Variations03.h"
|
|
#include "Variations04.h"
|
|
#include "Variations05.h"
|
|
#include "VariationsDC.h"
|
|
|
|
/// <summary>
|
|
/// VariationList class.
|
|
/// </summary>
|
|
|
|
namespace EmberNs
|
|
{
|
|
/// <summary>
|
|
/// Since the list of variations is numerous, it's convenient to be able to make copies
|
|
/// of specific ones. This class holds a list of pointers to variation objects for every
|
|
/// variation available. Similar to the PaletteList class, a caller can look up a variation
|
|
/// by name or ID and retrieve a copy of it.
|
|
/// All variations are deleted upon destruction.
|
|
/// Template argument expected to be float or double.
|
|
/// </summary>
|
|
template <typename T>
|
|
class EMBER_API VariationList
|
|
{
|
|
#define ADDPREPOSTREGVAR(varName) \
|
|
m_Variations.push_back(new varName##Variation<T>()); \
|
|
m_Variations.push_back(new Pre##varName##Variation<T>()); \
|
|
m_Variations.push_back(new Post##varName##Variation<T>());
|
|
|
|
public:
|
|
/// <summary>
|
|
/// Constructor which initializes all of the variation objects and stores them in the list.
|
|
/// </summary>
|
|
VariationList()
|
|
{
|
|
m_Variations.reserve(900);//Change this as the list grows.
|
|
ADDPREPOSTREGVAR(Linear)
|
|
ADDPREPOSTREGVAR(Sinusoidal)
|
|
ADDPREPOSTREGVAR(Spherical)
|
|
ADDPREPOSTREGVAR(Swirl)
|
|
ADDPREPOSTREGVAR(Horseshoe)
|
|
ADDPREPOSTREGVAR(Polar)
|
|
ADDPREPOSTREGVAR(Handkerchief)
|
|
ADDPREPOSTREGVAR(Heart)
|
|
ADDPREPOSTREGVAR(Disc)
|
|
ADDPREPOSTREGVAR(Spiral)
|
|
ADDPREPOSTREGVAR(Hyperbolic)
|
|
ADDPREPOSTREGVAR(Diamond)
|
|
ADDPREPOSTREGVAR(Ex)
|
|
ADDPREPOSTREGVAR(Julia)
|
|
ADDPREPOSTREGVAR(Bent)
|
|
ADDPREPOSTREGVAR(Waves)
|
|
ADDPREPOSTREGVAR(Fisheye)
|
|
ADDPREPOSTREGVAR(Popcorn)
|
|
ADDPREPOSTREGVAR(Exponential)
|
|
ADDPREPOSTREGVAR(Power)
|
|
ADDPREPOSTREGVAR(Cosine)
|
|
ADDPREPOSTREGVAR(Rings)
|
|
ADDPREPOSTREGVAR(Fan)
|
|
ADDPREPOSTREGVAR(Blob)
|
|
ADDPREPOSTREGVAR(Pdj)
|
|
ADDPREPOSTREGVAR(Fan2)
|
|
ADDPREPOSTREGVAR(Rings2)
|
|
ADDPREPOSTREGVAR(Eyefish)
|
|
ADDPREPOSTREGVAR(Bubble)
|
|
ADDPREPOSTREGVAR(Cylinder)
|
|
ADDPREPOSTREGVAR(Perspective)
|
|
ADDPREPOSTREGVAR(Noise)
|
|
ADDPREPOSTREGVAR(JuliaNGeneric)
|
|
ADDPREPOSTREGVAR(JuliaScope)
|
|
ADDPREPOSTREGVAR(Blur)
|
|
ADDPREPOSTREGVAR(GaussianBlur)
|
|
ADDPREPOSTREGVAR(RadialBlur)
|
|
ADDPREPOSTREGVAR(Pie)
|
|
ADDPREPOSTREGVAR(Ngon)
|
|
ADDPREPOSTREGVAR(Curl)
|
|
ADDPREPOSTREGVAR(Rectangles)
|
|
ADDPREPOSTREGVAR(Arch)
|
|
ADDPREPOSTREGVAR(Tangent)
|
|
ADDPREPOSTREGVAR(Square)
|
|
ADDPREPOSTREGVAR(Rays)
|
|
ADDPREPOSTREGVAR(Blade)
|
|
ADDPREPOSTREGVAR(Secant2)
|
|
ADDPREPOSTREGVAR(TwinTrian)
|
|
ADDPREPOSTREGVAR(Cross)
|
|
ADDPREPOSTREGVAR(Disc2)
|
|
ADDPREPOSTREGVAR(SuperShape)
|
|
ADDPREPOSTREGVAR(Flower)
|
|
ADDPREPOSTREGVAR(Conic)
|
|
ADDPREPOSTREGVAR(Parabola)
|
|
ADDPREPOSTREGVAR(Bent2)
|
|
ADDPREPOSTREGVAR(Bipolar)
|
|
ADDPREPOSTREGVAR(Boarders)
|
|
ADDPREPOSTREGVAR(Butterfly)
|
|
ADDPREPOSTREGVAR(Cell)
|
|
ADDPREPOSTREGVAR(Cpow)
|
|
ADDPREPOSTREGVAR(Curve)
|
|
ADDPREPOSTREGVAR(Edisc)
|
|
ADDPREPOSTREGVAR(Elliptic)
|
|
ADDPREPOSTREGVAR(Escher)
|
|
ADDPREPOSTREGVAR(Foci)
|
|
ADDPREPOSTREGVAR(LazySusan)
|
|
ADDPREPOSTREGVAR(Loonie)
|
|
ADDPREPOSTREGVAR(Modulus)
|
|
ADDPREPOSTREGVAR(Oscilloscope)
|
|
ADDPREPOSTREGVAR(Polar2)
|
|
ADDPREPOSTREGVAR(Popcorn2)
|
|
ADDPREPOSTREGVAR(Scry)
|
|
ADDPREPOSTREGVAR(Separation)
|
|
ADDPREPOSTREGVAR(Split)
|
|
ADDPREPOSTREGVAR(Splits)
|
|
ADDPREPOSTREGVAR(Stripes)
|
|
ADDPREPOSTREGVAR(Wedge)
|
|
ADDPREPOSTREGVAR(WedgeJulia)
|
|
ADDPREPOSTREGVAR(WedgeSph)
|
|
ADDPREPOSTREGVAR(Whorl)
|
|
ADDPREPOSTREGVAR(Waves2)
|
|
ADDPREPOSTREGVAR(Exp)
|
|
ADDPREPOSTREGVAR(Log)
|
|
ADDPREPOSTREGVAR(Sin)
|
|
ADDPREPOSTREGVAR(Cos)
|
|
ADDPREPOSTREGVAR(Tan)
|
|
ADDPREPOSTREGVAR(Sec)
|
|
ADDPREPOSTREGVAR(Csc)
|
|
ADDPREPOSTREGVAR(Cot)
|
|
ADDPREPOSTREGVAR(Sinh)
|
|
ADDPREPOSTREGVAR(Cosh)
|
|
ADDPREPOSTREGVAR(Tanh)
|
|
ADDPREPOSTREGVAR(Sech)
|
|
ADDPREPOSTREGVAR(Csch)
|
|
ADDPREPOSTREGVAR(Coth)
|
|
ADDPREPOSTREGVAR(Auger)
|
|
ADDPREPOSTREGVAR(Flux)
|
|
ADDPREPOSTREGVAR(Hemisphere)
|
|
ADDPREPOSTREGVAR(Epispiral)
|
|
ADDPREPOSTREGVAR(Bwraps)
|
|
ADDPREPOSTREGVAR(BlurCircle)
|
|
ADDPREPOSTREGVAR(BlurZoom)
|
|
ADDPREPOSTREGVAR(BlurPixelize)
|
|
ADDPREPOSTREGVAR(Crop)
|
|
ADDPREPOSTREGVAR(BCircle)
|
|
ADDPREPOSTREGVAR(BlurLinear)
|
|
ADDPREPOSTREGVAR(BlurSquare)
|
|
ADDPREPOSTREGVAR(Boarders2)
|
|
ADDPREPOSTREGVAR(Cardioid)
|
|
ADDPREPOSTREGVAR(Checks)
|
|
ADDPREPOSTREGVAR(Circlize)
|
|
ADDPREPOSTREGVAR(Circlize2)
|
|
ADDPREPOSTREGVAR(CosWrap)
|
|
ADDPREPOSTREGVAR(DeltaA)
|
|
ADDPREPOSTREGVAR(Expo)
|
|
ADDPREPOSTREGVAR(Extrude)
|
|
ADDPREPOSTREGVAR(FDisc)
|
|
ADDPREPOSTREGVAR(Fibonacci)
|
|
ADDPREPOSTREGVAR(Fibonacci2)
|
|
ADDPREPOSTREGVAR(Glynnia)
|
|
ADDPREPOSTREGVAR(GridOut)
|
|
ADDPREPOSTREGVAR(Hole)
|
|
ADDPREPOSTREGVAR(Hypertile)
|
|
ADDPREPOSTREGVAR(Hypertile1)
|
|
ADDPREPOSTREGVAR(Hypertile2)
|
|
ADDPREPOSTREGVAR(Hypertile3D)
|
|
ADDPREPOSTREGVAR(Hypertile3D1)
|
|
ADDPREPOSTREGVAR(Hypertile3D2)
|
|
ADDPREPOSTREGVAR(IDisc)
|
|
ADDPREPOSTREGVAR(Julian2)
|
|
ADDPREPOSTREGVAR(JuliaQ)
|
|
ADDPREPOSTREGVAR(Murl)
|
|
ADDPREPOSTREGVAR(Murl2)
|
|
ADDPREPOSTREGVAR(NPolar)
|
|
ADDPREPOSTREGVAR(Ortho)
|
|
ADDPREPOSTREGVAR(Poincare)
|
|
ADDPREPOSTREGVAR(Poincare3D)
|
|
ADDPREPOSTREGVAR(Polynomial)
|
|
ADDPREPOSTREGVAR(PSphere)
|
|
ADDPREPOSTREGVAR(Rational3)
|
|
ADDPREPOSTREGVAR(Ripple)
|
|
ADDPREPOSTREGVAR(Sigmoid)
|
|
ADDPREPOSTREGVAR(SinusGrid)
|
|
ADDPREPOSTREGVAR(Stwin)
|
|
ADDPREPOSTREGVAR(TwoFace)
|
|
ADDPREPOSTREGVAR(Unpolar)
|
|
ADDPREPOSTREGVAR(WavesN)
|
|
ADDPREPOSTREGVAR(XHeart)
|
|
ADDPREPOSTREGVAR(Barycentroid)
|
|
ADDPREPOSTREGVAR(BiSplit)
|
|
ADDPREPOSTREGVAR(Crescents)
|
|
ADDPREPOSTREGVAR(Mask)
|
|
ADDPREPOSTREGVAR(Cpow2)
|
|
ADDPREPOSTREGVAR(Curl3D)
|
|
ADDPREPOSTREGVAR(Disc3D)
|
|
ADDPREPOSTREGVAR(Funnel)
|
|
ADDPREPOSTREGVAR(Linear3D)
|
|
ADDPREPOSTREGVAR(PowBlock)
|
|
ADDPREPOSTREGVAR(Squirrel)
|
|
ADDPREPOSTREGVAR(Ennepers)
|
|
ADDPREPOSTREGVAR(SphericalN)
|
|
ADDPREPOSTREGVAR(Kaleidoscope)
|
|
ADDPREPOSTREGVAR(GlynnSim1)
|
|
ADDPREPOSTREGVAR(GlynnSim2)
|
|
ADDPREPOSTREGVAR(GlynnSim3)
|
|
ADDPREPOSTREGVAR(Starblur)
|
|
ADDPREPOSTREGVAR(Sineblur)
|
|
ADDPREPOSTREGVAR(Circleblur)
|
|
ADDPREPOSTREGVAR(CropN)
|
|
ADDPREPOSTREGVAR(ShredRad)
|
|
ADDPREPOSTREGVAR(Blob2)
|
|
ADDPREPOSTREGVAR(Julia3D)
|
|
ADDPREPOSTREGVAR(Julia3Dz)
|
|
ADDPREPOSTREGVAR(LinearT)
|
|
ADDPREPOSTREGVAR(LinearT3D)
|
|
ADDPREPOSTREGVAR(Ovoid)
|
|
ADDPREPOSTREGVAR(Ovoid3D)
|
|
ADDPREPOSTREGVAR(Spirograph)
|
|
ADDPREPOSTREGVAR(Petal)
|
|
ADDPREPOSTREGVAR(RoundSpher)
|
|
ADDPREPOSTREGVAR(RoundSpher3D)
|
|
ADDPREPOSTREGVAR(SpiralWing)
|
|
ADDPREPOSTREGVAR(Squarize)
|
|
ADDPREPOSTREGVAR(Sschecks)
|
|
ADDPREPOSTREGVAR(PhoenixJulia)
|
|
ADDPREPOSTREGVAR(Mobius)
|
|
ADDPREPOSTREGVAR(MobiusN)
|
|
ADDPREPOSTREGVAR(MobiusStrip)
|
|
ADDPREPOSTREGVAR(Lissajous)
|
|
ADDPREPOSTREGVAR(Svf)
|
|
ADDPREPOSTREGVAR(Target)
|
|
ADDPREPOSTREGVAR(Taurus)
|
|
ADDPREPOSTREGVAR(Collideoscope)
|
|
ADDPREPOSTREGVAR(BMod)
|
|
ADDPREPOSTREGVAR(BSwirl)
|
|
ADDPREPOSTREGVAR(BTransform)
|
|
ADDPREPOSTREGVAR(BCollide)
|
|
ADDPREPOSTREGVAR(Eclipse)
|
|
ADDPREPOSTREGVAR(FlipCircle)
|
|
ADDPREPOSTREGVAR(FlipY)
|
|
ADDPREPOSTREGVAR(ECollide)
|
|
ADDPREPOSTREGVAR(EJulia)
|
|
ADDPREPOSTREGVAR(EMod)
|
|
ADDPREPOSTREGVAR(EMotion)
|
|
ADDPREPOSTREGVAR(EPush)
|
|
ADDPREPOSTREGVAR(ERotate)
|
|
ADDPREPOSTREGVAR(EScale)
|
|
ADDPREPOSTREGVAR(ESwirl)
|
|
ADDPREPOSTREGVAR(LazyTravis)
|
|
ADDPREPOSTREGVAR(Squish)
|
|
ADDPREPOSTREGVAR(Circus)
|
|
ADDPREPOSTREGVAR(Tancos)
|
|
ADDPREPOSTREGVAR(Rippled)
|
|
ADDPREPOSTREGVAR(RotateX)
|
|
ADDPREPOSTREGVAR(RotateY)
|
|
ADDPREPOSTREGVAR(RotateZ)
|
|
ADDPREPOSTREGVAR(Flatten)
|
|
ADDPREPOSTREGVAR(Zblur)
|
|
ADDPREPOSTREGVAR(Blur3D)
|
|
ADDPREPOSTREGVAR(ZScale)
|
|
ADDPREPOSTREGVAR(ZTranslate)
|
|
ADDPREPOSTREGVAR(ZCone)
|
|
ADDPREPOSTREGVAR(MirrorX)
|
|
ADDPREPOSTREGVAR(MirrorY)
|
|
ADDPREPOSTREGVAR(MirrorZ)
|
|
ADDPREPOSTREGVAR(Depth)
|
|
ADDPREPOSTREGVAR(Spherical3D)
|
|
ADDPREPOSTREGVAR(RBlur)
|
|
ADDPREPOSTREGVAR(JuliaNab)
|
|
ADDPREPOSTREGVAR(Sintrange)
|
|
ADDPREPOSTREGVAR(Voron)
|
|
ADDPREPOSTREGVAR(Waffle)
|
|
ADDPREPOSTREGVAR(Square3D)
|
|
ADDPREPOSTREGVAR(SuperShape3D)
|
|
ADDPREPOSTREGVAR(Sphyp3D)
|
|
ADDPREPOSTREGVAR(Circlecrop)
|
|
ADDPREPOSTREGVAR(Julian3Dx)
|
|
ADDPREPOSTREGVAR(Fourth)
|
|
ADDPREPOSTREGVAR(Mobiq)
|
|
ADDPREPOSTREGVAR(Spherivoid)
|
|
ADDPREPOSTREGVAR(Farblur)
|
|
ADDPREPOSTREGVAR(CurlSP)
|
|
ADDPREPOSTREGVAR(Heat)
|
|
ADDPREPOSTREGVAR(Interference2)
|
|
ADDPREPOSTREGVAR(Sinq)
|
|
ADDPREPOSTREGVAR(Sinhq)
|
|
ADDPREPOSTREGVAR(Secq)
|
|
ADDPREPOSTREGVAR(Sechq)
|
|
ADDPREPOSTREGVAR(Tanq)
|
|
ADDPREPOSTREGVAR(Tanhq)
|
|
ADDPREPOSTREGVAR(Cosq)
|
|
ADDPREPOSTREGVAR(Coshq)
|
|
ADDPREPOSTREGVAR(Cotq)
|
|
ADDPREPOSTREGVAR(Cothq)
|
|
ADDPREPOSTREGVAR(Cscq)
|
|
ADDPREPOSTREGVAR(Cschq)
|
|
ADDPREPOSTREGVAR(Estiq)
|
|
ADDPREPOSTREGVAR(Loq)
|
|
ADDPREPOSTREGVAR(Curvature)
|
|
ADDPREPOSTREGVAR(Qode)
|
|
ADDPREPOSTREGVAR(BlurHeart)
|
|
ADDPREPOSTREGVAR(Truchet)
|
|
ADDPREPOSTREGVAR(Gdoffs)
|
|
ADDPREPOSTREGVAR(Octagon)
|
|
ADDPREPOSTREGVAR(Trade)
|
|
ADDPREPOSTREGVAR(Juliac)
|
|
ADDPREPOSTREGVAR(Blade3D)
|
|
ADDPREPOSTREGVAR(Blob3D)
|
|
ADDPREPOSTREGVAR(Blocky)
|
|
ADDPREPOSTREGVAR(Bubble2)
|
|
ADDPREPOSTREGVAR(CircleLinear)
|
|
ADDPREPOSTREGVAR(CircleRand)
|
|
ADDPREPOSTREGVAR(CircleTrans1)
|
|
ADDPREPOSTREGVAR(Cubic3D)
|
|
ADDPREPOSTREGVAR(CubicLattice3D)
|
|
ADDPREPOSTREGVAR(Foci3D)
|
|
ADDPREPOSTREGVAR(Ho)
|
|
ADDPREPOSTREGVAR(Julia3Dq)
|
|
ADDPREPOSTREGVAR(Line)
|
|
ADDPREPOSTREGVAR(Loonie3D)
|
|
ADDPREPOSTREGVAR(Mcarpet)
|
|
ADDPREPOSTREGVAR(Waves23D)
|
|
ADDPREPOSTREGVAR(Pie3D)
|
|
ADDPREPOSTREGVAR(Popcorn23D)
|
|
ADDPREPOSTREGVAR(Sinusoidal3D)
|
|
ADDPREPOSTREGVAR(Scry3D)
|
|
ADDPREPOSTREGVAR(Shredlin)
|
|
ADDPREPOSTREGVAR(SplitBrdr)
|
|
ADDPREPOSTREGVAR(Wdisc)
|
|
ADDPREPOSTREGVAR(Falloff)
|
|
ADDPREPOSTREGVAR(Falloff2)
|
|
ADDPREPOSTREGVAR(Falloff3)
|
|
ADDPREPOSTREGVAR(Xtrb)
|
|
//ADDPREPOSTREGVAR(LinearXZ)
|
|
//ADDPREPOSTREGVAR(LinearYZ)
|
|
|
|
//DC are special.
|
|
m_Variations.push_back(new DCBubbleVariation<T>());
|
|
ADDPREPOSTREGVAR(DCCarpet)
|
|
ADDPREPOSTREGVAR(DCCube)
|
|
m_Variations.push_back(new DCCylinderVariation<T>());
|
|
ADDPREPOSTREGVAR(DCGridOut)
|
|
m_Variations.push_back(new DCLinearVariation<T>());
|
|
ADDPREPOSTREGVAR(DCTriangle)
|
|
ADDPREPOSTREGVAR(DCZTransl)
|
|
|
|
for (auto var : m_Variations) var->Precalc();
|
|
std::sort(m_Variations.begin(), m_Variations.end(), [&](const Variation<T>* var1, const Variation<T>* var2) { return var1->VariationId() < var2->VariationId(); });
|
|
|
|
m_RegVariations.reserve(m_Variations.size() / 3);
|
|
m_PreVariations.reserve(m_Variations.size() / 3);
|
|
m_PostVariations.reserve(m_Variations.size() / 3);
|
|
|
|
for (auto var : m_Variations) if (var->VarType() == VARTYPE_REG) m_RegVariations.push_back(var);
|
|
for (auto var : m_Variations) if (var->VarType() == VARTYPE_PRE) m_PreVariations.push_back(var);
|
|
for (auto var : m_Variations) if (var->VarType() == VARTYPE_POST) m_PostVariations.push_back(var);
|
|
|
|
//Keep a list of which variations derive from ParametricVariation.
|
|
//Note that these are not new copies, rather just pointers to the original instances in m_Variations.
|
|
for (size_t i = 0; i < m_Variations.size(); i++)
|
|
{
|
|
if (ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(m_Variations[i]))
|
|
m_ParametricVariations.push_back(parVar);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Delete each element of the list.
|
|
/// </summary>
|
|
~VariationList()
|
|
{
|
|
ClearVec(m_Variations);//No need to delete parametric because they point to the entries in original vector.
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get a pointer to the variation at the specified index.
|
|
/// </summary>
|
|
/// <param name="index">The index in the list to retrieve</param>
|
|
/// <returns>A pointer to the variation at the index if in range, else nullptr.</returns>
|
|
const Variation<T>* GetVariation(size_t index) const { return index < m_Variations.size() ? m_Variations[index] : nullptr; }
|
|
|
|
/// <summary>
|
|
/// Get a pointer to the variation of a specified type at the specified index.
|
|
/// </summary>
|
|
/// <param name="index">The index in the list to retrieve</param>
|
|
/// <param name="varType">The type of variation to retrieve</param>
|
|
/// <returns>A pointer to the variation of the specified type at the index if in range, else nullptr.</returns>
|
|
const Variation<T>* GetVariation(size_t index, eVariationType varType) const
|
|
{
|
|
if (varType == VARTYPE_REG)
|
|
return index < m_RegVariations.size() ? m_RegVariations[index] : nullptr;
|
|
else if (varType == VARTYPE_PRE)
|
|
return index < m_PreVariations.size() ? m_PreVariations[index] : nullptr;
|
|
else if (varType == VARTYPE_POST)
|
|
return index < m_PostVariations.size() ? m_PostVariations[index] : nullptr;
|
|
else
|
|
return nullptr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets a pointer to a copy of the variation at the specified index.
|
|
/// Optionally specify a weight to assign the new copy.
|
|
/// </summary>
|
|
/// <param name="index">The index 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 at the index if in range, else nullptr.</returns>
|
|
Variation<T>* GetVariationCopy(size_t index, T weight = 1) const { return MakeCopyWithWeight(GetVariation(index), weight); }
|
|
Variation<T>* GetVariationCopy(size_t index, eVariationType varType, T weight = 1) const { return MakeCopyWithWeight(GetVariation(index, varType), weight); }
|
|
|
|
/// <summary>
|
|
/// Get a pointer to the variation with the specified ID.
|
|
/// </summary>
|
|
/// <param name="id">The ID to search for</param>
|
|
/// <returns>A pointer to the variation if found, else nullptr.</returns>
|
|
const Variation<T>* GetVariation(eVariationId id) const
|
|
{
|
|
for (size_t i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
|
if (id == m_Variations[i]->VariationId())
|
|
return m_Variations[i];
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets a pointer to a copy of the variation with the specified ID.
|
|
/// Optionally specify a weight to assign the new copy.
|
|
/// </summary>
|
|
/// <param name="id">The id 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 ID, else nullptr.</returns>
|
|
Variation<T>* GetVariationCopy(eVariationId id, T weight = 1) const { return MakeCopyWithWeight(GetVariation(id), weight); }
|
|
|
|
/// <summary>
|
|
/// Get a pointer to the variation with the specified name.
|
|
/// </summary>
|
|
/// <param name="name">The name to search for</param>
|
|
/// <returns>A pointer to the variation if found, else nullptr.</returns>
|
|
const Variation<T>* GetVariation(const string& name) const
|
|
{
|
|
for (size_t i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
|
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
|
|
return m_Variations[i];
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets a pointer to a copy of the variation with the specified name.
|
|
/// Optionally specify a weight to assign the new copy.
|
|
/// </summary>
|
|
/// <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(const string& name, T weight = 1) const { return MakeCopyWithWeight(GetVariation(name), weight); }
|
|
|
|
/// <summary>
|
|
/// Get a parametric variation at the specified index.
|
|
/// Note this is the index in the parametric variations list, not in the master list.
|
|
/// </summary>
|
|
/// <param name="index">The index in the parametric variations list to retrieve</param>
|
|
/// <returns>The parametric variation at the index specified if in range, else nullptr.</returns>
|
|
const ParametricVariation<T>* GetParametricVariation(size_t index) const { return index < m_ParametricVariations.size() ? m_ParametricVariations[index] : nullptr; }
|
|
|
|
/// <summary>
|
|
/// Get a parametric variation with the specified name.
|
|
/// </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>
|
|
const ParametricVariation<T>* GetParametricVariation(const string& name) const
|
|
{
|
|
for (size_t i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != nullptr; i++)
|
|
if (!_stricmp(name.c_str(), m_ParametricVariations[i]->Name().c_str()))
|
|
return m_ParametricVariations[i];
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the index of the variation with the specified name.
|
|
/// </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(const string& name)
|
|
{
|
|
for (size_t i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
|
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
|
|
return int(i);
|
|
|
|
return -1;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Accessors.
|
|
/// </summary>
|
|
size_t Size() const { return m_Variations.size(); }
|
|
size_t RegSize() const { return m_RegVariations.size(); }
|
|
size_t PreSize() const { return m_PreVariations.size(); }
|
|
size_t PostSize() const { return m_PostVariations.size(); }
|
|
size_t ParametricSize() const { return m_ParametricVariations.size(); }
|
|
|
|
private:
|
|
/// <summary>
|
|
/// Make a dyncamically allocated copy of a variation and assign it a specified weight.
|
|
/// Return a pointer to the new copy.
|
|
/// </summary>
|
|
/// <param name="var">The variation to copy</param>
|
|
/// <param name="weight">The weight to assign it</param>
|
|
/// <returns>A pointer to the new variation copy if success, else nullptr.</returns>
|
|
Variation<T>* MakeCopyWithWeight(const Variation<T>* var, T weight) const
|
|
{
|
|
if (var)
|
|
{
|
|
Variation<T>* var2 = var->Copy();
|
|
|
|
var2->m_Weight = weight;
|
|
return var2;
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Assignment operator which does nothing since these are non-copyable.
|
|
/// Do not provide a copy constructor and ensure the assignment operator does nothing.
|
|
/// </summary>
|
|
/// <param name="varList">The VariationList object which won't be copied</param>
|
|
/// <returns>Reference to unchanged self</returns>
|
|
VariationList<T>& operator = (const VariationList<T>& varList)
|
|
{
|
|
return *this;
|
|
}
|
|
|
|
vector<Variation<T>*> m_Variations;//A list of pointers to dynamically allocated variation objects.
|
|
vector<Variation<T>*> m_RegVariations;
|
|
vector<Variation<T>*> m_PreVariations;
|
|
vector<Variation<T>*> m_PostVariations;
|
|
vector<ParametricVariation<T>*> m_ParametricVariations;//A list of pointers to elements in m_Variations which are derived from ParametricVariation.
|
|
};
|
|
}
|