06-09-2014, 06:05 AM
Possibly. The main problem I see is that one of the main goals of my library design is to chain functions so that they can be compiled to a single kernel or executed in a single loop. If your library doesn't follow the monadic template pattern then it will cause problems. Also your 2D and 3D array classes sound like they might lead to duplication as I've come round to the idea that my library needs them as well. Maybe I should post my code (though Ive only got some of the C++ and SSE backends done.) as well as my plans.
So with the monadic patten the pesudocode would look like:
An Important thing to note is the computation is encoded in the type so partial values are effectively immutable.
So with the monadic patten the pesudocode would look like:
Code:
auto PerlinNoise = GeneratePerlin<4, 4, 17, 17>(...);
auto Multiplier = GeneratePerlin<4, 4, 17, 17>(...);
auto Multiplied = Multiply(Values, Multiplier);
auto Values = AddConstant(MultiplyByConstant(Clamp(Multiplied,0,1),80),40).Calculate();
// Values are calculated in a 4x smaller version first (5*5 numbers),
// and the final results are then linearly upscaled to the full dimension (17*17 numbers)
An Important thing to note is the computation is encoded in the type so partial values are effectively immutable.