diff --git a/CurveTools/include/CurveTools/CPU/BSplineGenerator.hpp b/CurveTools/include/CurveTools/CPU/BSplineGenerator.hpp index 719b9d9c2e637f29e8416295e609738651baf5c6..fe197b60b590f34e6c4f971a1bda36a59c9c7c4e 100644 --- a/CurveTools/include/CurveTools/CPU/BSplineGenerator.hpp +++ b/CurveTools/include/CurveTools/CPU/BSplineGenerator.hpp @@ -10,7 +10,11 @@ namespace ct CurveGenerator* m_generator; public: - BSplineGenerator(CurveGenerator* generator); + BSplineGenerator(CurveGenerator* generator, unsigned int degree); + + virtual inline double getParamterMax() const {return this->getDegree() / this->m_generator->getDegree();} + + inline CurveGenerator * getGenerator() const {return this->m_generator;} Point generate(const Curve& points, double u) const override; std::vector<Point> generate(const Curve& points, const std::vector<double>& us) const override; diff --git a/CurveTools/include/CurveTools/CPU/BezierGenerator.hpp b/CurveTools/include/CurveTools/CPU/BezierGenerator.hpp index 4abf74b28502161c763918fab6cf629ac0df7417..3ab26810f3b011a43a1133ecf52f930025fa1a26 100644 --- a/CurveTools/include/CurveTools/CPU/BezierGenerator.hpp +++ b/CurveTools/include/CurveTools/CPU/BezierGenerator.hpp @@ -7,7 +7,7 @@ namespace ct class CURVETOOLS_API BezierGenerator : public CurveGenerator { public: - BezierGenerator(unsigned int degree = 1); + BezierGenerator(unsigned int degree = 4); Point generate(const Curve& points, double t) const override; std::vector<Point> generate(const Curve& points, const std::vector<double>& ts) const override; diff --git a/CurveTools/include/CurveTools/CPU/CurveGenerator.hpp b/CurveTools/include/CurveTools/CPU/CurveGenerator.hpp index 502bde65144b0aa4d692cd74a543d64cceefc83d..3cfa48393b7bcfee71fe6ea1ebc0a40d74e9c4d0 100644 --- a/CurveTools/include/CurveTools/CPU/CurveGenerator.hpp +++ b/CurveTools/include/CurveTools/CPU/CurveGenerator.hpp @@ -15,6 +15,8 @@ namespace ct public: CurveGenerator(uint16_t degree); + virtual inline double getParamterMax() const {return 1.0;} + static Point lerp(const Point& a, const Point& b, double t); static Point smoothstep(const Point& a, const Point& b, double t); static Point smootherstep(const Point& a, const Point& b, double t); diff --git a/CurveTools/include/CurveTools/GPU/SplineGenerator.cuh b/CurveTools/include/CurveTools/GPU/SplineGenerator.cuh index 40a12958cf2092b6a679628eb3ced3167ff0391f..70d61377a14cf75000013ca5534cbae6bfea0607 100644 --- a/CurveTools/include/CurveTools/GPU/SplineGenerator.cuh +++ b/CurveTools/include/CurveTools/GPU/SplineGenerator.cuh @@ -7,6 +7,8 @@ #include "StreamedGenerator.cuh" +#include <iostream> + namespace ct::gpu { class SplineGenerator : public Generator<Point, float> { private: @@ -18,15 +20,17 @@ namespace ct::gpu { __host__ SplineGenerator(StreamedGenerator *, size_t = 4, size_t = 8); inline StreamedGenerator * generator() const {return this->_generator;} + virtual inline float getParamterMax() const {return static_cast<float>(this->getDegree() / this->_generator->getDegree());} __host__ Point generate(const thrust::universal_vector<Point> &, float) const; __host__ Curve generate(const thrust::universal_vector<Point> &, const std::vector<float> &) const; - virtual Point generate(const std::vector<Point> & pts, float u) const override final { - return this->generate(thrust::universal_vector<Point>(pts), u); + inline Point generate(const Curve& points, float p) const override final { + return this->generate(thrust::universal_vector<Point>(points), p); } - virtual std::vector<Point> generate(const std::vector<Point> & pts, const std::vector<float> & us) const override final { - return this->generate(thrust::universal_vector<Point>(pts), us); + + inline Curve generate(const Curve& points, const std::vector<float> & ps) const override final { + return this->generate(thrust::universal_vector<Point>(points), ps); } }; diff --git a/CurveTools/include/CurveTools/GPU/StreamedGenerator.cuh b/CurveTools/include/CurveTools/GPU/StreamedGenerator.cuh index 2a4c580d2ea39c392557d25f6c844111367c211b..13dc942db8b575f6723daf903204e134fc2353a8 100644 --- a/CurveTools/include/CurveTools/GPU/StreamedGenerator.cuh +++ b/CurveTools/include/CurveTools/GPU/StreamedGenerator.cuh @@ -14,6 +14,8 @@ namespace ct::gpu { __host__ virtual Point generate(const thrust::universal_vector<Point> &, const float) const = 0; __host__ virtual Curve generate(const thrust::universal_vector<Point> &, const std::vector<float> &, const cudaStream_t & = 0) const = 0; + virtual inline float getParamterMax() const {return 1.f;} + inline Point generate(const Curve& points, float p) const override final { return this->generate(thrust::universal_vector<Point>(points), p); } diff --git a/CurveTools/include/CurveTools/Generator.hpp b/CurveTools/include/CurveTools/Generator.hpp index ae8b671d63a0a4f643c5258eac0e09065703fdb2..d5f0ea49d6c89e8da4e8f4f109f91effc8cab2bf 100644 --- a/CurveTools/include/CurveTools/Generator.hpp +++ b/CurveTools/include/CurveTools/Generator.hpp @@ -13,6 +13,7 @@ namespace ct { inline Generator(uint16_t degree = 1) : _degree(degree) {} inline uint16_t getDegree() const {return this->_degree;} + virtual inline U getParamterMax() const = 0; virtual T generate(const std::vector<T> &, U) const = 0; virtual std::vector<T> generate(const std::vector<T> &, const std::vector<U> &) const = 0; diff --git a/CurveTools/src/CPU/BSplineGenerator.cpp b/CurveTools/src/CPU/BSplineGenerator.cpp index 96f35b38769c3e975b80b6b35eb92b6ee374d870..669700cb405e0d12602b6c054c4556bf92e16147 100644 --- a/CurveTools/src/CPU/BSplineGenerator.cpp +++ b/CurveTools/src/CPU/BSplineGenerator.cpp @@ -1,21 +1,33 @@ #include "CurveTools/CPU/BSplineGenerator.hpp" #include "CurveTools/CPU/CurveSampler.hpp" +#include <cmath> + namespace ct { - BSplineGenerator::BSplineGenerator(CurveGenerator* generator) - : CurveGenerator(0), m_generator(generator) {} + BSplineGenerator::BSplineGenerator(CurveGenerator* generator, unsigned int degree) + : CurveGenerator(degree), m_generator(generator) {} Point BSplineGenerator::generate(const Curve& points, double u) const { unsigned int degree = m_generator->getDegree(); - if (points.size() < degree) - { + if (u > this->getParamterMax()) { return Point(0.0); } unsigned int nbCurves = static_cast<unsigned int>(std::ceil((points.size() - degree + 1) / static_cast<double>(degree - 1))); - u = glm::clamp(u, 0.0, static_cast<double>(nbCurves)); + //u = glm::clamp(u, 0.0, static_cast<double>(nbCurves)); + + u = std::abs(u); + + if(nbCurves != 0) { + if(u > nbCurves) { + do { + u -= nbCurves; + } + while(u > nbCurves); + } + } double k = 0.0; double t = std::modf(u, &k); diff --git a/CurveTools/src/GPU/Core/BezierGenerator.cu b/CurveTools/src/GPU/Core/BezierGenerator.cu index 615ce5f2aa26fe2f8ace8429dae34cbc6cc9a668..e01568b0096ad0c2ab8e70e8bac807439438703b 100644 --- a/CurveTools/src/GPU/Core/BezierGenerator.cu +++ b/CurveTools/src/GPU/Core/BezierGenerator.cu @@ -38,6 +38,8 @@ namespace ct::gpu { unsigned int nbBlock = static_cast<unsigned int>(ceil(ts_size/1024)+1); unsigned int nbThread = static_cast<unsigned int>(ts_size - (floor(ts_size/1024) * 1024)); + //std::cout << nbBlock << "/" << nbThread << "/" << stream << std::endl; + kernel::Casteljau<<<nbBlock, nbThread, 0, stream>>>(pt_raw, pt_dev.size(), ts_dev, ts_size, r_dev); cudaMemcpyAsync(&result[0], r_dev, sizeof(Point) * ts_size, cudaMemcpyDeviceToHost, stream); diff --git a/CurveTools/src/GPU/Core/SplineGenerator.cu b/CurveTools/src/GPU/Core/SplineGenerator.cu index 17b6f5d8ec068db60e56c015e6d9b24cf72e9d74..ec9455520f36dad6cd77f6b87b8862ff66c2d29e 100644 --- a/CurveTools/src/GPU/Core/SplineGenerator.cu +++ b/CurveTools/src/GPU/Core/SplineGenerator.cu @@ -47,9 +47,10 @@ namespace ct::gpu { size_t currentPoint = 0; for(size_t i = 0; i < subCurveCount; i++) { - size_t currentStream = i%subCurveCount; - - thrust::universal_vector<Point> subPoints(degree); + size_t currentStream = i%this->_streamsCount; + + thrust::universal_vector<Point> subPoints; + subPoints.reserve(degree); thrust::copy(points.begin()+currentPoint, points.begin()+currentPoint+degree, subPoints.begin()); std::vector<float> ts; @@ -66,8 +67,10 @@ namespace ct::gpu { } } - Curve subResult = this->_generator->generate(subPoints, ts, streams[currentStream]); - memmove(&result[usCount == 0 ? 0 : usCount-1], subResult.data(), sizeof(Point) * subResult.size()); + if(!subPoints.empty() && !ts.empty()) { + Curve subResult = this->_generator->generate(subPoints, ts, streams[currentStream]); + memmove(&result[usCount == 0 ? 0 : usCount-1], subResult.data(), sizeof(Point) * subResult.size()); + } currentPoint += degree-1; } diff --git a/CurveTools/src/main.cu b/CurveTools/src/main.cu index 7f486028ab6ad310025f7bb3bf6d30edb6b286ec..b3a30d5a9f41c1b814a1d47e43ff0225c48fef3a 100644 --- a/CurveTools/src/main.cu +++ b/CurveTools/src/main.cu @@ -2,56 +2,508 @@ #include <vector> #include <chrono> +#include <fstream> -#include "CurveTools/GPU/BezierGenerator.cuh" -#include "CurveTools/GPU/LinearGenerator.cuh" -#include "CurveTools/GPU/SplineGenerator.cuh" -#include "CurveTools/GPU/CatmullRomGenerator.cuh" -#include "CurveTools/GPU/BezierGenerator.cuh" +#include "CurveTools/GPU/BezierGenerator.cuh" // x +#include "CurveTools/CPU/BezierGenerator.hpp" // x -#include "CurveTools/CPU/BezierGenerator.hpp" -#include "CurveTools/CPU/LinearGenerator.hpp" -#include "CurveTools/CPU/BSplineGenerator.hpp" -#include "CurveTools/CPU/CatmullRomGenerator.hpp" -#include "CurveTools/CPU/BezierGenerator.hpp" +#include "CurveTools/GPU/LinearGenerator.cuh" // x +#include "CurveTools/CPU/LinearGenerator.hpp" // x + +#include "CurveTools/GPU/SplineGenerator.cuh" // x +#include "CurveTools/CPU/BSplineGenerator.hpp" // x + +#include "CurveTools/GPU/CatmullRomGenerator.cuh" // x +#include "CurveTools/CPU/CatmullRomGenerator.hpp" // x + +#include "CurveTools/CPU/HermiteGenerator.hpp" +#include "CurveTools/GPU/HermiteGenerator.cuh" + +#include "CurveTools/GPU/SmoothstepGenerator.cuh" +#include "CurveTools/CPU/SmoothstepGenerator.hpp" + +#include "CurveTools/GPU/SmootherstepGenerator.cuh" +#include "CurveTools/CPU/SmootherstepGenerator.hpp" #include "CurveTools/CPU/CurveSampler.hpp" int main(int argc, const char * argv[]) { - std::cout << "CPU : " << std::endl; + // --- BSpline + + /*{ + std::cout << "CPU bSpline: " << std::endl; + + { + using namespace ct; + BezierGenerator CRG; + BSplineGenerator bs(&CRG, 7); + + std::ofstream file; + file.open("bspline_cpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<double> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = bs.generate({p1, p2, p3, p4, p5, p6, p7}, parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + + std::cout << "GPU bspline : " << std::endl; + + { + using namespace ct::gpu; + BezierGenerator CRG; + SplineGenerator Bs(&CRG, 3); + + std::ofstream file; + file.open("bspline_gpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<float> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005f); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = Bs.generate(std::vector<Point>({p1, p2, p3, p4, p5, p6, p7}), parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + //std::cout << "\r" << i; + std::cout << i << std::endl; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + } + + // --- CMR { - using namespace ct; + std::cout << "CPU Catmullrom : " << std::endl; + + { + using namespace ct; + CatmullRomGenerator CRG; + + std::ofstream file; + file.open("catmullrom_cpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<double> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate({p1, p2, p3, p4}, parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; - Point p1(-10.0, 0.0, 0.0); - Point p2(10.0, 1.0, 1.0); - BezierGenerator CRG(2); + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + + std::cout << "GPU catmullrom : " << std::endl; + + { + using namespace ct::gpu; + CatmullRomGenerator CRG; + + std::ofstream file; + file.open("catmullrom_gpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<float> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005f); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate(std::vector<Point>({p1, p2}), parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + } + + // --- L + + { - ct::Point result = CRG.operator()({p1, p2}, 0.01); + std::cout << "CPU Linear : " << std::endl; + + { + using namespace ct; + LinearGenerator CRG; + + std::ofstream file; + file.open("linear_cpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<double> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate({p1, p2}, parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + + std::cout << "GPU Linear : " << std::endl; + + { + using namespace ct::gpu; + LinearGenerator CRG; + + std::ofstream file; + file.open("linear_gpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<float> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005f); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate(std::vector<Point>({p1, p2}), parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; - - std::cout << result.x << "/" << result.y << "/" << result.z << std::endl; + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + } - std::cout << "GPU : " << std::endl; + // --- H + + { + + std::cout << "CPU Hermite : " << std::endl; + + { + using namespace ct; + HermiteGenerator CRG; + + std::ofstream file; + file.open("hermite_cpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<double> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; - { - using namespace ct::gpu; + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005); - Point p1(0.0, 0.0, 0.0); - Point p2(1.0, 1.0, 1.0); - Point p3(2.0, 2.0, 2.0); - Point p4(3.0, 3.0, 3.0); - BezierGenerator CRG; - Curve curve = CRG({p1, p2, p3, p4}, {0.25f, 0.5f, 0.75f}); + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate({p1, p2, p3, p4}, parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); - for(auto & result : curve) { - std::cout << result.x << "/" << result.y << "/" << result.z << std::endl; + std::cout << "\r" << i; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); } - } + std::cout << "GPU Hermite : " << std::endl; + + { + using namespace ct::gpu; + HermiteGenerator CRG; + + std::ofstream file; + file.open("hermite_gpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<float> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005f); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate(std::vector<Point>({p1, p2, p3, p4}), parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + } + + // --- S + + { + std::cout << "CPU Smoothstep : " << std::endl; + + { + using namespace ct; + SmoothstepGenerator CRG; + + std::ofstream file; + file.open("smoothstep_cpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<double> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate({p1, p2}, parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + + std::cout << "GPU Smoothstep : " << std::endl; + + { + using namespace ct::gpu; + SmoothstepGenerator CRG; + + std::ofstream file; + file.open("smoothstep_gpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<float> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005f); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate(std::vector<Point>({p1, p2}), parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + + } + + // --- Ser + + { + std::cout << "CPU Smootherstep : " << std::endl; + + { + using namespace ct; + SmootherstepGenerator CRG; + + std::ofstream file; + file.open("smootherstep_cpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<double> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate({p1, p2}, parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + + std::cout << "GPU Smoother : " << std::endl; + + { + using namespace ct::gpu; + SmootherstepGenerator CRG; + + std::ofstream file; + file.open("smootherstep_gpu.csv"); + + Point p1(0.0, 0.0, 0.0); + Point p2(0.25, 1.0, 0.0); + Point p3(0.75, 1.0, 0.0); + Point p4(1.0, 0.0, 0.0); + Point p5(1.0, -0.25, 0.0); + Point p6(1.25, -0.75, 0.0); + Point p7(1.5, -1.0, 0.0); + + std::vector<float> parameter = {}; + parameter.reserve(20000); + file << "x,y\n"; + + for(size_t i = 0; i < 20000; i++) { + parameter.push_back(0.00005f); + + std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + Curve result = CRG.generate(std::vector<Point>({p1, p2}), parameter); + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + std::cout << "\r" << i; + + file << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << ","; + file << i << "\n"; + } + + file.close(); + } + }*/ return EXIT_SUCCESS; } \ No newline at end of file diff --git a/ParticleGenerator/old/Mesh.cpp b/ParticleGenerator/old/Mesh.cpp deleted file mode 100644 index ccf2f55023e6caa78f50fc9dee08a0ce5baacb3f..0000000000000000000000000000000000000000 --- a/ParticleGenerator/old/Mesh.cpp +++ /dev/null @@ -1,212 +0,0 @@ -#include "Mesh.hpp" - -#include <glm/gtc/matrix_transform.hpp> - -namespace pg::scene -{ - Mesh::Mesh(ct::CurveGenerator * generator, const ct::Curve & ctrlpoint) - : _mesh(), - _material(), - _textureShader(), - _colorShader(), - _color(1.f, 1.f, 1.f, 1.f), - _rotation(0.f, 0.f, 0.f), - _scale(1.f, 1.f, 1.f), - _pathGenerator(generator, ctrlpoint), - _physicGenerator(), - _skybox("res/shaders/system/Skybox.vert", "res/shaders/system/Skybox.frag"), - _interface(this, &this->_pathGenerator, &this->_physicGenerator), - _useTexture(false), - _pathActive(false), - _physicActive(true), - _wireframe(false) { - - } - - void Mesh::initialize() - { - if (!this->_mesh.isGenerated()) { - Model gridModel("res/models/cube.obj"); - this->_mesh.generate(gridModel.getMeshGeometry().vertices, gridModel.getMeshGeometry().indices); - } - - if(!this->_textureShader.usable()) { - Source vertexShaderSource("res/shaders/scene/Phong-Fat.vert", Source::Categorie::VERTEX); - Source fragmentShaderSource("res/shaders/scene/Phong.frag", Source::Categorie::FRAGMENT); - - this->_textureShader << vertexShaderSource; - this->_textureShader << fragmentShaderSource; - - this->_textureShader.link(); - - vertexShaderSource.release(); - fragmentShaderSource.release(); - } - - if(!this->_colorShader.usable()) { - Source vertexShaderSource("res/shaders/scene/Color-Fat.vert", Source::Categorie::VERTEX); - Source fragmentShaderSource("res/shaders/scene/Color.frag", Source::Categorie::FRAGMENT); - - this->_colorShader << vertexShaderSource; - this->_colorShader << fragmentShaderSource; - - this->_colorShader.link(); - - vertexShaderSource.release(); - fragmentShaderSource.release(); - } - - if(this->_skybox.material().isValid()) { - this->_skybox.load( - { - "res/textures/skybox/snow/right.png", - "res/textures/skybox/snow/left.png", - "res/textures/skybox/snow/top.png", - "res/textures/skybox/snow/bottom.png", - "res/textures/skybox/snow/front.png", - "res/textures/skybox/snow/back.png", - }, - Texture::RGBA, - false - ); - } - - { - glCreateBuffers(1, &this->_ubo); - glBindBuffer(GL_UNIFORM_BUFFER, this->_ubo); - glBufferData(GL_UNIFORM_BUFFER, 1024 * sizeof(glm::mat4), nullptr, GL_DYNAMIC_DRAW); - - GLuint uniforme_index = glGetUniformBlockIndex(this->_colorShader.id(), "uModels_t"); - glBindBufferBase(GL_UNIFORM_BUFFER, uniforme_index, this->_ubo); - glBindBuffer(GL_UNIFORM_BUFFER, 0); - } - - pg::error::OpenGLError::check(); - - this->_pathGenerator.setPosition({0.f, 0.f, 0.f}); - this->_pathGenerator.setPositionVariation(0.5f); - this->_pathGenerator.setParameterIncrement(0.01f); - this->_pathGenerator.setParameterLifeLimitor(1.0f); - - this->_physicGenerator.setPosition({0.f, 0.f, 0.f}); - this->_physicGenerator.setPositionVariation(0.5); - this->_physicGenerator.setVelocity({0, 0.01, 0}); - this->_physicGenerator.setAcceleration({0.0, 0.0001, 0}); - } - - void Mesh::update(double current_time) { - static auto path_start = std::chrono::high_resolution_clock::now(); - static auto physic_start = std::chrono::high_resolution_clock::now(); - auto end = std::chrono::high_resolution_clock::now(); - - pg::Particle::purge(this->_particles, static_cast<size_t>(current_time), this->_interface.getLifeTime()); - - if(duration_cast<std::chrono::milliseconds>(end - path_start).count() >= this->_interface.getPathSpawnFrequence()) { - path_start = std::chrono::high_resolution_clock::now(); - if((this->_interface.getPathSpawnCount() + this->_particles.size()) <= this->_interface.getMaxParticle() && this->_pathActive) { - std::vector<std::unique_ptr<pg::Particle>> newParticles = this->_pathGenerator.generate(this->_interface.getPathSpawnCount(), static_cast<size_t>(current_time)); - this->_particles.insert(this->_particles.begin(), std::make_move_iterator(newParticles.begin()), std::make_move_iterator(newParticles.end())); - } - } - - if(duration_cast<std::chrono::milliseconds>(end - physic_start).count() >= this->_interface.getPhysicSpawnFrequence()) { - physic_start = std::chrono::high_resolution_clock::now(); - if(this->_interface.getPhysicSpawnCount() + this->_particles.size() <= this->_interface.getMaxParticle() && this->_physicActive) { - std::vector<std::unique_ptr<pg::Particle>> newParticles = this->_physicGenerator.generate(this->_interface.getPhysicSpawnCount(), static_cast<size_t>(current_time)); - this->_particles.insert(this->_particles.begin(), std::make_move_iterator(newParticles.begin()), std::make_move_iterator(newParticles.end())); - } - } - - if(duration_cast<std::chrono::milliseconds>(end - path_start).count() >= 10 || duration_cast<std::chrono::milliseconds>(end - physic_start).count() >= 10) { - for(auto& particle : this->_particles) { - particle->update(0.0); - } - } - } - - void Mesh::render(const Camera& camera, double) { - this->_skybox.material().bind(0); - this->_skybox.draw(camera); - - glEnable(GL_DEPTH_TEST); - this->_material.bind(0); - Program * program = this->_useTexture ? &this->_textureShader : &this->_colorShader; - - pg::error::OpenGLError::check(); - - std::vector<glm::mat4> models; - for(auto & particle : this->_particles) { - glm::mat4 model = glm::mat4(1.0); - model = glm::translate(model, glm::vec3(particle->getPosition())); - model = glm::rotate(model, glm::radians(this->_rotation.z), {0.f, 0.f, 1.f}); - model = glm::rotate(model, glm::radians(this->_rotation.y), {0.f, 1.f, 0.f}); - model = glm::rotate(model, glm::radians(this->_rotation.x), {1.f, 0.f, 0.f}); - model = glm::scale(model, this->_scale); - - models.push_back(model); - } - - pg::error::OpenGLError::check(); - - glBindBuffer(GL_UNIFORM_BUFFER, this->_ubo); - glBufferSubData(GL_UNIFORM_BUFFER, 0, models.size() * sizeof(glm::mat4), models.data()); - - pg::error::OpenGLError::check(); - - program->use(); - - program->setUniform("uView", camera.getViewMatrix()); - program->setUniform("uProj", camera.getViewFrustum().getProjectionMatrix()); - - - if(this->_useTexture) { - program->setUniform("uSlot", 0); - program->setUniform("uLightPosition", glm::vec3(0.f , 10.f, 0.f)); - program->setUniform("uViewPosition", camera.getPosition()); - program->setUniform("uColor", glm::vec3(this->_color)); - } - else { - program->setUniform("uColor", this->_color); - } - - if(this->_wireframe) { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - } - - if(this->_interface.isRenderEnable()) { - this->_mesh.draw(this->_particles.size()); - } - - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glDisable(GL_DEPTH_TEST); - } - - void Mesh::destroy() { - glDeleteBuffers(1, &this->_ubo); - } - - std::string Mesh::name() const { - return "Mesh Scene"; - } - - void Mesh::setMesh(const std::string & path) { - Model gridModel(path); - this->_mesh.generate(gridModel.getMeshGeometry().vertices, gridModel.getMeshGeometry().indices); - } - - void Mesh::setTexture(const std::string & path) { - this->_material.load(path); - } - - void Mesh::setTextureUse(bool state) { - this->_useTexture = state; - glDeleteBuffers(1, &this->_ubo); - glCreateBuffers(1, &this->_ubo); - glBindBuffer(GL_UNIFORM_BUFFER, this->_ubo); - glBufferData(GL_UNIFORM_BUFFER, 1024 * sizeof(glm::mat4), nullptr, GL_DYNAMIC_DRAW); - - GLuint uniforme_index = glGetUniformBlockIndex(this->_useTexture ? this->_textureShader.id() : this->_colorShader.id(), "uModels_t"); - glBindBufferBase(GL_UNIFORM_BUFFER, uniforme_index, this->_ubo); - glBindBuffer(GL_UNIFORM_BUFFER, 0); - } -} \ No newline at end of file diff --git a/ParticleGenerator/old/Mesh.hpp b/ParticleGenerator/old/Mesh.hpp deleted file mode 100644 index 586e5e8e77f9c843585fa4368e1ba77752f60fc8..0000000000000000000000000000000000000000 --- a/ParticleGenerator/old/Mesh.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once - -#include "Scene.hpp" -#include "../../Renderer/Renderer.hpp" - -#include "../../Mesh/Model.hpp" -#include "../../Mesh/Mesh.hpp" -#include "../../Renderer/Texture/Material.hpp" - -#include "../../Particle/generator/PathParticleGenerator.hpp" -#include "../../Particle/generator/PhysicsParticleGenerator.hpp" - -#include "../../Interface/Scene/MeshScene.hpp" - -#include "../../Mesh/Skybox.hpp" - -namespace pg::scene -{ - class Mesh : public Scene { - private: - pg::Mesh _mesh; - Material _material; - Program _textureShader; - Program _colorShader; - glm::vec4 _color; - glm::vec3 _rotation; - glm::vec3 _scale; - - PathParticleGenerator _pathGenerator; - PhysicsParticleGenerator _physicGenerator; - - std::vector<std::unique_ptr<Particle>> _particles; - SkyBox _skybox; - - interface::MeshScene _interface; - - GLuint _ubo; - - bool _useTexture; - bool _pathActive; - bool _physicActive; - bool _wireframe; - - public: - Mesh(ct::CurveGenerator *, const ct::Curve &); - virtual ~Mesh() = default; - - void initialize() override; - void update(double) override; - void render(const Camera&, double) override; - void destroy() override; - - std::string name() const override; - virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} - - void setMesh(const std::string &); - void setTexture(const std::string &); - void setTextureUse(bool); - - friend class pg::interface::MeshScene; - }; -} \ No newline at end of file diff --git a/ParticleGenerator/old/MeshScene.cpp b/ParticleGenerator/old/MeshScene.cpp deleted file mode 100644 index 41cffa668fc8d91397427bf7ad4da2763afb4f1c..0000000000000000000000000000000000000000 --- a/ParticleGenerator/old/MeshScene.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "MeshScene.hpp" - -#include <imgui.h> - -#include "../../Scene/Scenes/Mesh.hpp" -#include "../../tfd/tinyfiledialogs.h" - -namespace pg::interface { - MeshScene::MeshScene(scene::Mesh * scene, PathParticleGenerator * path, PhysicsParticleGenerator * physic) - : _scene(scene), - _current(nullptr), - _pathGenerator(path), - _physicGenerator(physic), - _max(1024), - _pathSpawnFrequence(500), - _pathSpawnCount(1), - _physicSpawnFrequence(500), - _physicSpawnCount(5), - _lifetime(5), - _enableRender(true) { - - } - - void MeshScene::render(double current_time) { - ImGui::Text("Particles Number : %i / %i.", this->_scene->_particles.size(), this->_max); - ImGui::SameLine(); - if(ImGui::Button("Clear")) { - this->_scene->_particles.clear(); - } - ImGui::Checkbox("Enable Rendering", &this->_enableRender); - - ImGui::InputInt("Lifetime (s)", &this->_lifetime, 1, 2); - - ImGui::SeparatorText("Model"); - - ImGui::SliderFloat3("Roation", &this->_scene->_rotation[0], 0.f, 359.f); - ImGui::DragFloat3("Scaling", &this->_scene->_scale[0], 0.01f, 0.1f, 0.0f); - - ImGui::ColorEdit4("Global Color", &this->_scene->_color[0]); - ImGui::Image((void*)(intptr_t)this->_scene->_material.identifier(), ImVec2(64, 64), ImVec2(0, 1), ImVec2(1, 0)); - ImGui::Text("Texture Path : %s", this->_scene->_material.ressource().string().c_str()); - - ImGui::PushID(0); - if(ImGui::Button(this->_scene->_useTexture ? "No Texture" : "Texture")) { - this->_scene->setTextureUse(!this->_scene->_useTexture); - } - - ImGui::SameLine(); - - ImGui::PushID(1); - if(ImGui::Button("Change Texture")) { - char const * imagePatterns[1] = {"*.png"}; - std::string path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); - this->_scene->setTexture(path); - } - - ImGui::SameLine(); - - ImGui::PushID(2); - if(ImGui::Button("Change Model")) { - char const * imagePatterns[1] = {"*.obj"}; - std::string path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); - this->_scene->setMesh(path); - } - - ImGui::SameLine(); - - ImGui::Checkbox("Wireframe", &this->_scene->_wireframe); - - ImGui::PopID(); - ImGui::PopID(); - ImGui::PopID(); - - ImGui::PushID(0); - ImGui::SeparatorText("Physic Generator"); - ImGui::Checkbox("Enable Spawning", &this->_scene->_physicActive); - ImGui::SliderInt("Spawning Number", &this->_physicSpawnCount, 1, 1024); - ImGui::InputInt("Spawn Frequence (ms)", &this->_physicSpawnFrequence, 25, 100); - if(ImGui::Button("Spawn")) { - std::vector<std::unique_ptr<pg::Particle>> newParticles = this->_scene->_physicGenerator.generate(1, static_cast<size_t>(current_time)); - this->_scene->_particles.insert(this->_scene->_particles.begin(), std::make_move_iterator(newParticles.begin()), std::make_move_iterator(newParticles.end())); - } - - ImGui::PushID(1); - ImGui::SeparatorText("Path Generator"); - ImGui::Checkbox("Enable Spawning", &this->_scene->_pathActive); - ImGui::SliderInt("Spawning Number", &this->_pathSpawnCount, 1, 1024); - ImGui::InputInt("Spawn Frequence (ms)", &this->_pathSpawnFrequence, 25, 100); - if(ImGui::Button("Spawn")) { - std::vector<std::unique_ptr<pg::Particle>> newParticles = this->_scene->_pathGenerator.generate(1, static_cast<size_t>(current_time)); - this->_scene->_particles.insert(this->_scene->_particles.begin(), std::make_move_iterator(newParticles.begin()), std::make_move_iterator(newParticles.end())); - } - - ImGui::PopID(); - ImGui::PopID(); - - ImGui::SeparatorText("Generators Settings"); - - if(ImGui::CollapsingHeader("Physic Generator")) { - this->_physicGenerator.render(current_time); - } - - ImGui::Separator(); - ImGui::Separator(); - - if(ImGui::CollapsingHeader("Path Generator")) { - this->_pathGenerator.render(current_time); - } - } -} \ No newline at end of file diff --git a/ParticleGenerator/old/MeshScene.hpp b/ParticleGenerator/old/MeshScene.hpp deleted file mode 100644 index 7725b1c9cb29b71e7e33804a79c10d4765fc2fd8..0000000000000000000000000000000000000000 --- a/ParticleGenerator/old/MeshScene.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include "../Interface.hpp" -#include "../Generator/PathGenerator.hpp" -#include "../Generator/PhysicGenerator.hpp" - -#include <glm/vec4.hpp> - -namespace pg::scene { - class Mesh; -} - -namespace pg::interface { - class MeshScene : public { - private: - scene::Mesh * _scene; - Interface * _current; - PathGenerator _pathGenerator; - PhysicGenerator _physicGenerator; - - int _max; - - int _pathSpawnFrequence; - int _pathSpawnCount; - - int _physicSpawnFrequence; - int _physicSpawnCount; - - int _lifetime; - bool _enableRender; - - public: - MeshScene(scene::Mesh *, PathParticleGenerator *, PhysicsParticleGenerator *); - - inline int getMaxParticle() const {return this->_max;} - - inline int getPathSpawnFrequence() const {return this->_pathSpawnFrequence;} - inline int getPathSpawnCount() const {return this->_pathSpawnCount;} - inline int getLifeTime() const {return this->_lifetime;} - inline int getPhysicSpawnFrequence() const {return this->_physicSpawnFrequence;} - inline int getPhysicSpawnCount() const {return this->_physicSpawnCount;} - - inline bool isRenderEnable() {return this->_enableRender;} - - virtual void render(double); - inline std::string title() const {return "Mesh Scene Interface";} - }; -} \ No newline at end of file diff --git a/ParticleGenerator/res/config/imgui.ini b/ParticleGenerator/res/config/imgui.ini index 7e72e91afe5705111fdc7f7cc4e6165224142fdb..e22a30d817f9c33bf5be96bfb9b8cda3a39ce544 100644 --- a/ParticleGenerator/res/config/imgui.ini +++ b/ParticleGenerator/res/config/imgui.ini @@ -4,5 +4,5 @@ Size=400,400 [Window][Particle Generator] Pos=60,60 -Size=576,611 +Size=557,755 diff --git a/ParticleGenerator/res/models/apples/DolApple.mtl b/ParticleGenerator/res/models/apples/DolApple.mtl new file mode 100644 index 0000000000000000000000000000000000000000..c3567610a3bc65d5c7434933647fe39f1713baaf --- /dev/null +++ b/ParticleGenerator/res/models/apples/DolApple.mtl @@ -0,0 +1,22 @@ +newmtl mat1 + Ns 10 + Ni 1.0 + d 1.0 + Tf 1 1 1 + illum 2 + Ka 0.5 0.5 0.5 + Kd 0.9 0.9 0.9 + Ks 0.0 0.0 0.0 + map_Kd ItmApple2.PNG + +newmtl mat2 + Ns 10 + Ni 1.0 + d 1.0 + Tf 1 1 1 + illum 2 + Ka 0.5 0.5 0.5 + Kd 0.9 0.9 0.9 + Ks 0.0 0.0 0.0 + map_Kd .PNG + diff --git a/ParticleGenerator/res/models/apples/DolApple.obj b/ParticleGenerator/res/models/apples/DolApple.obj new file mode 100644 index 0000000000000000000000000000000000000000..d415f730811dae7e73f4054f12c3fc7e58c49cb0 --- /dev/null +++ b/ParticleGenerator/res/models/apples/DolApple.obj @@ -0,0 +1,1004 @@ +mtllib DolApple.mtl + +v 0.339520 0.650309 -0.502912 +v -0.621048 0.805821 -0.264351 +v -0.204016 1.663061 -1.247820 +v -0.727385 0.929767 1.010234 +v 1.047514 0.642418 0.569431 +v 1.684818 1.202319 1.578832 +v 3.092771 1.769144 -0.304483 +v 3.658217 2.788958 0.297200 +v 3.303331 4.062990 -1.962265 +v 3.612907 5.261405 -1.344497 +v 1.620768 6.436515 -2.494966 +v 1.756579 7.137224 -1.555266 +v -0.389935 7.490622 -1.033529 +v 0.292593 7.264236 -0.059317 +v -0.494717 6.947274 0.993811 +v 0.948690 5.629726 0.807790 +v -0.311375 6.289081 2.161100 +v 0.735219 5.675217 2.758770 +v 0.948690 5.629726 0.807790 +v -1.375219 5.899803 2.588749 +v -1.687168 6.978065 0.682979 +v -2.362499 6.215838 0.164532 +v -0.854325 6.831855 -1.869907 +v -1.232595 5.657590 -2.495755 +v 1.277490 5.251216 -3.119144 +v 0.893266 4.043974 -3.460773 +v 2.764899 2.946196 -2.391956 +v 1.874172 1.977124 -2.469679 +v 2.125114 1.076247 -0.871996 +v 0.786904 1.372647 -2.147666 +v 0.922713 0.885095 -1.283006 +v -0.204016 1.663061 -1.247820 +v -0.948919 1.982873 -2.351824 +v 0.011648 1.827361 -2.590385 +v -0.204016 1.663061 -1.247820 +v 0.441686 2.817327 -3.287717 +v -1.333213 3.104676 -2.846914 +v -1.425750 4.419414 -2.884837 +v -2.833702 3.852588 -1.001522 +v -2.756552 5.044062 -0.457269 +v -2.401666 3.770030 1.802196 +v -2.020284 4.949319 2.416604 +v -0.028146 3.774209 3.567075 +v 0.363178 4.887465 3.567409 +v 2.509693 4.534066 3.045671 +v 2.031985 5.465275 2.436714 +v 2.819295 5.782237 1.383586 +v 0.948690 5.629726 0.807790 +v 2.635953 6.440430 0.216297 +v 1.589359 7.054294 -0.381373 +v 0.948690 5.629726 0.807790 +v 3.494976 6.124886 -0.576607 +v 3.806925 5.046624 1.329164 +v 3.955121 3.994886 0.907576 +v 2.446947 3.378869 2.942015 +v 2.134261 2.175431 2.335686 +v -0.375825 2.581804 2.959076 +v -0.634198 1.577759 2.154768 +v -2.505830 2.675536 1.085951 +v -2.159870 1.769970 0.192196 +v -2.410813 2.670847 -1.405487 +v -1.396303 1.260536 -0.707070 +v -1.532113 1.748087 -1.571730 +v -0.204016 1.663061 -1.247820 + +vt 0.773741 0.087229 +vt 0.498197 0.087020 +vt 0.623197 -0.000182 +vt 0.500000 0.168664 +vt 0.773438 0.168664 +vt 0.776560 0.273989 +vt 0.990811 0.269789 +vt 1.000000 0.415924 +vt 0.781738 0.417108 +vt 0.777471 0.558900 +vt 0.500000 0.560958 +vt 0.500000 0.656727 +vt 0.225153 0.654378 +vt 0.228874 0.749557 +vt 0.007314 0.733932 +vt 0.109375 0.993372 +vt 0.228874 0.749557 +vt 0.500000 0.749557 +vt 0.359375 0.993372 +vt 0.225153 0.654378 +vt 0.006028 0.656727 +vt 0.007572 0.560958 +vt 0.222529 0.558900 +vt 0.218262 0.417108 +vt 0.500000 0.415924 +vt 0.500000 0.269789 +vt 0.776560 0.273989 +vt 0.773438 0.168664 +vt 0.987624 0.168664 +vt 0.773741 0.087229 +vt 0.985754 0.087020 +vt 0.904447 -0.000182 +vt 0.221090 0.087229 +vt 0.498197 0.087020 +vt 0.357572 -0.000182 +vt 0.500000 0.168664 +vt 0.226563 0.168664 +vt 0.223440 0.273989 +vt 0.009189 0.269789 +vt 0.000000 0.415924 +vt 0.218262 0.417108 +vt 0.222529 0.558900 +vt 0.500000 0.560958 +vt 0.500000 0.656727 +vt 0.774847 0.654378 +vt 0.771126 0.749557 +vt 0.992686 0.733932 +vt 0.890625 0.993372 +vt 0.771126 0.749557 +vt 0.500000 0.749557 +vt 0.640625 0.993372 +vt 0.774847 0.654378 +vt 0.993972 0.656727 +vt 0.992428 0.560958 +vt 0.777471 0.558900 +vt 0.781738 0.417108 +vt 0.500000 0.415924 +vt 0.500000 0.269789 +vt 0.223440 0.273989 +vt 0.226563 0.168664 +vt 0.011382 0.168664 +vt 0.221090 0.087229 +vt 0.010640 0.087020 +vt 0.123197 -0.000182 + +vn -0.193360 -0.911130 -0.363942 +vn -0.275234 -0.897875 -0.343608 +vn -0.249830 -0.859708 -0.445519 +vn -0.281919 -0.902088 0.326741 +vn 0.232215 -0.960767 0.151667 +vn 0.363619 -0.803512 0.471327 +vn 0.768236 -0.635073 -0.080598 +vn 0.913875 -0.399435 0.072689 +vn 0.807345 -0.035732 -0.588997 +vn 0.873651 0.237521 -0.424638 +vn 0.299770 0.577887 -0.759068 +vn 0.384228 0.889362 -0.247799 +vn -0.105045 0.981997 -0.156996 +vn 0.259473 0.877388 0.403565 +vn 0.229460 0.880555 0.414694 +vn 0.249830 0.859708 0.445519 +vn 0.209296 0.872303 0.441908 +vn 0.212623 0.854733 0.473522 +vn 0.249830 0.859708 0.445519 +vn -0.395116 0.626758 0.671608 +vn -0.438725 0.871727 0.218203 +vn -0.860123 0.509874 -0.014731 +vn -0.424453 0.683719 -0.593606 +vn -0.513430 0.432743 -0.741028 +vn 0.215002 0.307275 -0.927015 +vn 0.116223 0.027150 -0.992852 +vn 0.665761 -0.291002 -0.687081 +vn 0.383450 -0.536570 -0.751704 +vn 0.507819 -0.809365 -0.295040 +vn -0.155228 -0.849562 -0.504132 +vn -0.143652 -0.891118 -0.430433 +vn -0.249830 -0.859708 -0.445519 +vn -0.379700 -0.742969 -0.551204 +vn -0.221306 -0.810805 -0.541866 +vn -0.249830 -0.859708 -0.445519 +vn -0.068040 -0.302182 -0.950819 +vn -0.582174 -0.243503 -0.775745 +vn -0.558465 0.133013 -0.818794 +vn -0.963082 -0.035426 -0.266869 +vn -0.955197 0.257239 -0.146378 +vn -0.853029 -0.121473 0.507530 +vn -0.757091 0.163582 0.632498 +vn -0.183086 -0.176358 0.967149 +vn -0.009392 0.400517 0.916241 +vn 0.478812 0.304199 0.823530 +vn 0.239646 0.840166 0.486508 +vn 0.269751 0.837314 0.475542 +vn 0.249830 0.859708 0.445519 +vn 0.289911 0.845553 0.448322 +vn 0.286488 0.862798 0.416539 +vn 0.249830 0.859708 0.445519 +vn 0.764530 0.644460 -0.012836 +vn 0.806993 0.395548 0.438525 +vn 0.968497 -0.136940 0.207994 +vn 0.533027 -0.310099 0.787224 +vn 0.470270 -0.581266 0.664061 +vn -0.262531 -0.470830 0.842257 +vn -0.311069 -0.697649 0.645385 +vn -0.860607 -0.379498 0.339614 +vn -0.733409 -0.667700 0.127626 +vn -0.825389 -0.414929 -0.382841 +vn -0.341312 -0.859118 -0.381343 +vn -0.352888 -0.817562 -0.455042 +vn -0.249830 -0.859708 -0.445519 + +g polygon0 +s 1 +usemtl mat1 +f 1/1/1 2/2/2 3/3/3 +f 1/1/1 4/4/4 2/2/2 +f 5/5/5 4/4/4 1/1/1 +f 5/5/5 6/6/6 4/4/4 +f 7/7/7 6/6/6 5/5/5 +f 7/7/7 8/8/8 6/6/6 +f 9/9/9 8/8/8 7/7/7 +f 9/9/9 10/10/10 8/8/8 +f 11/11/11 10/10/10 9/9/9 +f 11/11/11 12/12/12 10/10/10 +f 13/13/13 12/12/12 11/11/11 +f 13/13/13 14/14/14 12/12/12 +f 15/15/15 14/14/14 13/13/13 +f 15/15/15 16/16/16 14/14/14 +f 17/17/17 16/16/16 15/15/15 +f 17/17/17 18/18/18 19/19/19 +f 17/17/17 20/20/20 18/18/18 +f 21/21/21 20/20/20 17/17/17 +f 21/21/21 22/22/22 20/20/20 +f 23/23/23 22/22/22 21/21/21 +f 23/23/23 24/24/24 22/22/22 +f 25/25/25 24/24/24 23/23/23 +f 25/25/25 26/26/26 24/24/24 +f 27/27/27 26/26/26 25/25/25 +f 27/27/27 28/28/28 26/26/26 +f 29/29/29 28/28/28 27/27/27 +f 29/29/29 30/30/30 28/28/28 +f 31/31/31 30/30/30 29/29/29 +f 31/31/31 32/32/32 30/30/30 +f 1/1/1 32/32/32 31/31/31 +f 33/33/33 34/34/34 35/35/35 +f 33/33/33 36/36/36 34/34/34 +f 37/37/37 36/36/36 33/33/33 +f 37/37/37 38/38/38 36/36/36 +f 39/39/39 38/38/38 37/37/37 +f 39/39/39 40/40/40 38/38/38 +f 41/41/41 40/40/40 39/39/39 +f 41/41/41 42/42/42 40/40/40 +f 43/43/43 42/42/42 41/41/41 +f 43/43/43 44/44/44 42/42/42 +f 45/45/45 44/44/44 43/43/43 +f 45/45/45 46/46/46 44/44/44 +f 47/47/47 46/46/46 45/45/45 +f 47/47/47 48/48/48 46/46/46 +f 49/49/49 48/48/48 47/47/47 +f 49/49/49 50/50/50 51/51/51 +f 49/49/49 52/52/52 50/50/50 +f 53/53/53 52/52/52 49/49/49 +f 53/53/53 54/54/54 52/52/52 +f 55/55/55 54/54/54 53/53/53 +f 55/55/55 56/56/56 54/54/54 +f 57/57/57 56/56/56 55/55/55 +f 57/57/57 58/58/58 56/56/56 +f 59/59/59 58/58/58 57/57/57 +f 59/59/59 60/60/60 58/58/58 +f 61/61/61 60/60/60 59/59/59 +f 61/61/61 62/62/62 60/60/60 +f 63/63/63 62/62/62 61/61/61 +f 63/63/63 64/64/64 62/62/62 +f 33/33/33 64/64/64 63/63/63 +f 18/18/18 46/46/46 51/51/51 +f 18/18/18 44/44/44 46/46/46 +f 20/20/20 44/44/44 18/18/18 +f 20/20/20 42/42/42 44/44/44 +f 22/22/22 42/42/42 20/20/20 +f 22/22/22 40/40/40 42/42/42 +f 24/24/24 40/40/40 22/22/22 +f 24/24/24 38/38/38 40/40/40 +f 26/26/26 38/38/38 24/24/24 +f 26/26/26 36/36/36 38/38/38 +f 28/28/28 36/36/36 26/26/26 +f 28/28/28 34/34/34 36/36/36 +f 30/30/30 34/34/34 28/28/28 +f 30/30/30 3/3/3 34/34/34 +f 2/2/2 62/62/62 35/35/35 +f 2/2/2 60/60/60 62/62/62 +f 4/4/4 60/60/60 2/2/2 +f 4/4/4 58/58/58 60/60/60 +f 6/6/6 58/58/58 4/4/4 +f 6/6/6 56/56/56 58/58/58 +f 8/8/8 56/56/56 6/6/6 +f 8/8/8 54/54/54 56/56/56 +f 10/10/10 54/54/54 8/8/8 +f 10/10/10 52/52/52 54/54/54 +f 12/12/12 52/52/52 10/10/10 +f 12/12/12 50/50/50 52/52/52 +f 14/14/14 50/50/50 12/12/12 +f 14/14/14 19/19/19 50/50/50 +f 15/15/15 21/21/21 17/17/17 +f 15/15/15 13/13/13 21/21/21 +f 13/13/13 23/23/23 21/21/21 +f 13/13/13 11/11/11 23/23/23 +f 11/11/11 25/25/25 23/23/23 +f 11/11/11 9/9/9 25/25/25 +f 9/9/9 27/27/27 25/25/25 +f 9/9/9 7/7/7 27/27/27 +f 7/7/7 29/29/29 27/27/27 +f 7/7/7 5/5/5 29/29/29 +f 47/47/47 53/53/53 49/49/49 +f 47/47/47 45/45/45 53/53/53 +f 45/45/45 55/55/55 53/53/53 +f 45/45/45 43/43/43 55/55/55 +f 43/43/43 57/57/57 55/55/55 +f 43/43/43 41/41/41 57/57/57 +f 41/41/41 59/59/59 57/57/57 +f 41/41/41 39/39/39 59/59/59 +f 39/39/39 61/61/61 59/59/59 +f 39/39/39 37/37/37 61/61/61 +f 33/33/33 61/61/61 37/37/37 +f 33/33/33 63/63/63 61/61/61 +f 31/31/31 5/5/5 1/1/1 +f 31/31/31 29/29/29 5/5/5 + +v 1.170645 6.686692 1.127619 +v 1.422102 6.511863 1.323976 +v 0.484516 4.032421 -0.019967 +v 1.082726 6.544741 1.450842 + +vt 0.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 1.000000 + +vn -0.019955 0.953571 -0.300508 +vn 0.856805 0.343992 0.384128 +vn -0.249816 -0.859712 -0.445518 +vn -0.326501 0.458629 0.826473 + +g polygon1 +s 1 +usemtl mat2 +f 65/65/65 66/66/66 67/67/67 +f 65/65/65 68/68/68 66/66/66 +f 67/67/67 68/68/68 65/65/65 +f 67/67/67 66/66/66 68/68/68 + +v -3.862245 8.522907 4.475536 +v -4.387696 8.291571 3.894463 +v -3.331579 8.235417 3.535963 +v -5.133684 9.020067 3.792258 +v -4.162778 9.447525 4.865944 +v -4.264367 10.517704 4.856984 +v -2.331364 10.277443 5.164989 +v -2.071452 11.254965 4.816507 +v -0.485606 10.282673 3.769560 +v -0.291047 11.222863 3.177702 +v -0.133361 10.121591 1.389339 +v -0.376080 10.982222 1.034313 +v -1.541656 10.460976 -0.268200 +v -1.871878 11.236214 0.246192 +v -2.952790 11.370565 0.073959 +v -2.635201 11.410381 1.642226 +v -3.772073 11.872873 0.614836 +v -3.849802 12.448893 1.551983 +v -2.635201 11.410381 1.642226 +v -4.641540 11.499590 0.333188 +v -3.308468 10.675277 -0.558616 +v -3.578682 9.793226 -0.428121 +v -1.495143 9.529415 -0.104241 +v -1.708218 8.563184 0.437149 +v -0.335150 9.167701 1.955570 +v -0.727231 8.349062 2.521827 +v -0.866234 9.379162 4.197735 +v -1.561959 8.576122 4.361377 +v -2.683321 9.263637 5.101680 +v -2.454692 8.051308 4.202467 +v -3.061569 8.423389 4.603117 +v -3.331579 8.235417 3.535963 +v -2.922565 7.393289 2.927209 +v -2.397114 7.624627 3.508283 +v -3.331579 8.235417 3.535963 +v -1.455570 7.787718 3.078692 +v -2.426476 7.360260 2.005006 +v -1.995780 7.790562 1.118989 +v -3.928783 8.030824 0.810985 +v -3.800487 8.823241 0.103767 +v -5.386332 9.795534 1.150715 +v -5.163467 10.758486 0.607426 +v -5.321154 11.859756 2.395788 +v -4.759979 12.451044 1.884804 +v -3.594403 12.972290 3.187317 +v -3.140445 12.761200 2.336433 +v -2.059533 12.626848 2.508666 +v -2.635201 11.410381 1.642226 +v -1.240249 12.124540 1.967789 +v -1.162520 11.548521 1.030642 +v -2.635201 11.410381 1.642226 +v -0.494519 11.933676 2.585929 +v -1.827592 12.757989 3.477732 +v -1.875832 12.188123 4.213248 +v -3.959371 12.451933 3.889369 +v -4.163721 11.515022 4.483126 +v -5.536788 10.910506 2.964705 +v -5.532916 9.959204 3.454145 +v -5.393913 8.929104 1.778238 +v -5.027295 8.231663 2.509573 +v -3.905933 7.544148 1.769269 +v -4.330118 7.864889 3.200279 +v -3.723242 7.492808 2.799629 +v -3.331579 8.235417 3.535963 + +vt 0.773741 0.087229 +vt 0.498197 0.087020 +vt 0.623197 -0.000182 +vt 0.500000 0.168664 +vt 0.773438 0.168664 +vt 0.776560 0.273989 +vt 0.990811 0.269789 +vt 1.000000 0.415924 +vt 0.781738 0.417108 +vt 0.777471 0.558900 +vt 0.500000 0.560958 +vt 0.500000 0.656727 +vt 0.225153 0.654378 +vt 0.228874 0.749557 +vt 0.007314 0.733932 +vt 0.109375 0.993372 +vt 0.228874 0.749557 +vt 0.500000 0.749557 +vt 0.359375 0.993372 +vt 0.225153 0.654378 +vt 0.006028 0.656727 +vt 0.007572 0.560958 +vt 0.222529 0.558900 +vt 0.218262 0.417108 +vt 0.500000 0.415924 +vt 0.500000 0.269789 +vt 0.776560 0.273989 +vt 0.773438 0.168664 +vt 0.987624 0.168664 +vt 0.773741 0.087229 +vt 0.985754 0.087020 +vt 0.904447 -0.000182 +vt 0.221090 0.087229 +vt 0.498197 0.087020 +vt 0.357572 -0.000182 +vt 0.500000 0.168664 +vt 0.226563 0.168664 +vt 0.223440 0.273989 +vt 0.009189 0.269789 +vt 0.000000 0.415924 +vt 0.218262 0.417108 +vt 0.222529 0.558900 +vt 0.500000 0.560958 +vt 0.500000 0.656727 +vt 0.774847 0.654378 +vt 0.771126 0.749557 +vt 0.992686 0.733932 +vt 0.890625 0.993372 +vt 0.771126 0.749557 +vt 0.500000 0.749557 +vt 0.640625 0.993372 +vt 0.774847 0.654378 +vt 0.993972 0.656727 +vt 0.992428 0.560958 +vt 0.777471 0.558900 +vt 0.781738 0.417108 +vt 0.500000 0.415924 +vt 0.500000 0.269789 +vt 0.223440 0.273989 +vt 0.226563 0.168664 +vt 0.011382 0.168664 +vt 0.221090 0.087229 +vt 0.010640 0.087020 +vt 0.123197 -0.000182 + +vn -0.233077 -0.779673 0.581193 +vn -0.288008 -0.803857 0.520447 +vn -0.185116 -0.843988 0.503405 +vn -0.770740 -0.339056 0.539445 +vn -0.381726 -0.209144 0.900302 +vn -0.469219 0.158990 0.868652 +vn 0.222065 0.069346 0.972563 +vn 0.293998 0.364537 0.883560 +vn 0.858192 0.009566 0.513239 +vn 0.893466 0.286660 0.345752 +vn 0.952102 -0.103710 -0.287656 +vn 0.766713 0.444264 -0.463444 +vn 0.465957 0.284365 -0.837867 +vn 0.227843 0.827928 -0.512467 +vn 0.204379 0.820863 -0.533303 +vn 0.185115 0.843988 -0.503405 +vn 0.170196 0.825192 -0.538601 +vn 0.142167 0.841104 -0.521855 +vn 0.185115 0.843988 -0.503405 +vn -0.436494 0.544555 -0.716194 +vn -0.035157 0.315355 -0.948322 +vn -0.258556 -0.243822 -0.934719 +vn 0.471648 -0.332993 -0.816495 +vn 0.420945 -0.600292 -0.680041 +vn 0.910112 -0.392152 -0.133836 +vn 0.783553 -0.620945 0.021723 +vn 0.740981 -0.253713 0.621753 +vn 0.524907 -0.565622 0.636038 +vn 0.154948 -0.302990 0.940313 +vn -0.085930 -0.828974 0.552647 +vn -0.149373 -0.790076 0.594531 +vn -0.185116 -0.843988 0.503405 +vn -0.133775 -0.935115 0.328123 +vn -0.079911 -0.873580 0.480076 +vn -0.185116 -0.843988 0.503405 +vn 0.511432 -0.843193 0.165719 +vn 0.122418 -0.973106 -0.195138 +vn 0.324845 -0.817229 -0.476038 +vn -0.366439 -0.727586 -0.579949 +vn -0.324616 -0.504133 -0.800297 +vn -0.892042 -0.163896 -0.421188 +vn -0.807099 0.107109 -0.580619 +vn -0.865643 0.497897 0.052540 +vn -0.488972 0.822029 -0.291849 +vn -0.189008 0.978313 0.084731 +vn 0.141987 0.858220 -0.493253 +vn 0.165520 0.865594 -0.472600 +vn 0.185115 0.843988 -0.503405 +vn 0.199699 0.861252 -0.467295 +vn 0.227658 0.845020 -0.483852 +vn 0.185115 0.843988 -0.503405 +vn 0.710217 0.703419 -0.028173 +vn 0.308032 0.928747 0.206265 +vn 0.338858 0.609938 0.716346 +vn -0.391198 0.699781 0.597720 +vn -0.452925 0.454485 0.767009 +vn -0.945330 0.231588 0.229606 +vn -0.927928 -0.037295 0.370890 +vn -0.885355 -0.404526 -0.229140 +vn -0.784214 -0.616628 0.069126 +vn -0.366171 -0.908599 -0.200917 +vn -0.281989 -0.848462 0.447877 +vn -0.218545 -0.887360 0.405993 +vn -0.185116 -0.843988 0.503405 + +g polygon2 +s 1 +usemtl mat1 +f 69/69/69 70/70/70 71/71/71 +f 69/69/69 72/72/72 70/70/70 +f 73/73/73 72/72/72 69/69/69 +f 73/73/73 74/74/74 72/72/72 +f 75/75/75 74/74/74 73/73/73 +f 75/75/75 76/76/76 74/74/74 +f 77/77/77 76/76/76 75/75/75 +f 77/77/77 78/78/78 76/76/76 +f 79/79/79 78/78/78 77/77/77 +f 79/79/79 80/80/80 78/78/78 +f 81/81/81 80/80/80 79/79/79 +f 81/81/81 82/82/82 80/80/80 +f 83/83/83 82/82/82 81/81/81 +f 83/83/83 84/84/84 82/82/82 +f 85/85/85 84/84/84 83/83/83 +f 85/85/85 86/86/86 87/87/87 +f 85/85/85 88/88/88 86/86/86 +f 89/89/89 88/88/88 85/85/85 +f 89/89/89 90/90/90 88/88/88 +f 91/91/91 90/90/90 89/89/89 +f 91/91/91 92/92/92 90/90/90 +f 93/93/93 92/92/92 91/91/91 +f 93/93/93 94/94/94 92/92/92 +f 95/95/95 94/94/94 93/93/93 +f 95/95/95 96/96/96 94/94/94 +f 97/97/97 96/96/96 95/95/95 +f 97/97/97 98/98/98 96/96/96 +f 99/99/99 98/98/98 97/97/97 +f 99/99/99 100/100/100 98/98/98 +f 69/69/69 100/100/100 99/99/99 +f 101/101/101 102/102/102 103/103/103 +f 101/101/101 104/104/104 102/102/102 +f 105/105/105 104/104/104 101/101/101 +f 105/105/105 106/106/106 104/104/104 +f 107/107/107 106/106/106 105/105/105 +f 107/107/107 108/108/108 106/106/106 +f 109/109/109 108/108/108 107/107/107 +f 109/109/109 110/110/110 108/108/108 +f 111/111/111 110/110/110 109/109/109 +f 111/111/111 112/112/112 110/110/110 +f 113/113/113 112/112/112 111/111/111 +f 113/113/113 114/114/114 112/112/112 +f 115/115/115 114/114/114 113/113/113 +f 115/115/115 116/116/116 114/114/114 +f 117/117/117 116/116/116 115/115/115 +f 117/117/117 118/118/118 119/119/119 +f 117/117/117 120/120/120 118/118/118 +f 121/121/121 120/120/120 117/117/117 +f 121/121/121 122/122/122 120/120/120 +f 123/123/123 122/122/122 121/121/121 +f 123/123/123 124/124/124 122/122/122 +f 125/125/125 124/124/124 123/123/123 +f 125/125/125 126/126/126 124/124/124 +f 127/127/127 126/126/126 125/125/125 +f 127/127/127 128/128/128 126/126/126 +f 129/129/129 128/128/128 127/127/127 +f 129/129/129 130/130/130 128/128/128 +f 131/131/131 130/130/130 129/129/129 +f 131/131/131 132/132/132 130/130/130 +f 101/101/101 132/132/132 131/131/131 +f 86/86/86 114/114/114 119/119/119 +f 86/86/86 112/112/112 114/114/114 +f 88/88/88 112/112/112 86/86/86 +f 88/88/88 110/110/110 112/112/112 +f 90/90/90 110/110/110 88/88/88 +f 90/90/90 108/108/108 110/110/110 +f 92/92/92 108/108/108 90/90/90 +f 92/92/92 106/106/106 108/108/108 +f 94/94/94 106/106/106 92/92/92 +f 94/94/94 104/104/104 106/106/106 +f 96/96/96 104/104/104 94/94/94 +f 96/96/96 102/102/102 104/104/104 +f 98/98/98 102/102/102 96/96/96 +f 98/98/98 71/71/71 102/102/102 +f 70/70/70 130/130/130 103/103/103 +f 70/70/70 128/128/128 130/130/130 +f 72/72/72 128/128/128 70/70/70 +f 72/72/72 126/126/126 128/128/128 +f 74/74/74 126/126/126 72/72/72 +f 74/74/74 124/124/124 126/126/126 +f 76/76/76 124/124/124 74/74/74 +f 76/76/76 122/122/122 124/124/124 +f 78/78/78 122/122/122 76/76/76 +f 78/78/78 120/120/120 122/122/122 +f 80/80/80 120/120/120 78/78/78 +f 80/80/80 118/118/118 120/120/120 +f 82/82/82 118/118/118 80/80/80 +f 82/82/82 87/87/87 118/118/118 +f 83/83/83 89/89/89 85/85/85 +f 83/83/83 81/81/81 89/89/89 +f 81/81/81 91/91/91 89/89/89 +f 81/81/81 79/79/79 91/91/91 +f 79/79/79 93/93/93 91/91/91 +f 79/79/79 77/77/77 93/93/93 +f 77/77/77 95/95/95 93/93/93 +f 77/77/77 75/75/75 95/95/95 +f 75/75/75 97/97/97 95/95/95 +f 75/75/75 73/73/73 97/97/97 +f 115/115/115 121/121/121 117/117/117 +f 115/115/115 113/113/113 121/121/121 +f 113/113/113 123/123/123 121/121/121 +f 113/113/113 111/111/111 123/123/123 +f 111/111/111 125/125/125 123/123/123 +f 111/111/111 109/109/109 125/125/125 +f 109/109/109 127/127/127 125/125/125 +f 109/109/109 107/107/107 127/127/127 +f 107/107/107 129/129/129 127/127/127 +f 107/107/107 105/105/105 129/129/129 +f 101/101/101 129/129/129 105/105/105 +f 101/101/101 131/131/131 129/129/129 +f 99/99/99 73/73/73 69/69/69 +f 99/99/99 97/97/97 73/73/73 + +v -2.356419 12.088202 1.088852 +v -2.415096 12.246529 1.332717 +v -2.915620 10.131880 2.404800 +v -2.633027 12.180880 1.142514 + +vt 0.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 1.000000 + +vn 0.603998 0.216888 -0.766907 +vn 0.353066 0.893968 0.275981 +vn -0.185132 -0.843982 0.503408 +vn -0.578913 0.613221 -0.537420 + +g polygon3 +s 1 +usemtl mat2 +f 133/133/133 134/134/134 135/135/135 +f 133/133/133 136/136/136 134/134/134 +f 135/135/135 136/136/136 133/133/133 +f 135/135/135 134/134/134 136/136/136 + +v 3.975620 13.385630 -3.048216 +v 4.045515 13.252726 -2.269842 +v 3.071169 12.952566 -2.637273 +v 4.378600 14.097892 -1.813226 +v 4.249451 14.343469 -3.251474 +v 4.104929 15.375923 -3.290870 +v 2.941022 14.744098 -4.672460 +v 2.344433 15.593784 -4.667658 +v 0.745444 14.279331 -4.748514 +v 0.054168 15.095987 -4.517743 +v -0.939562 13.933583 -3.161658 +v -1.152702 14.781759 -2.834674 +v -1.004374 14.478645 -1.097078 +v -0.603206 15.307938 -1.360202 +v 0.047637 15.661246 -0.587634 +v 0.772687 15.706969 -1.960574 +v 0.873710 16.340322 -0.545862 +v 1.391111 16.947371 -1.259356 +v 0.772687 15.706969 -1.960574 +v 1.404994 16.162825 0.231396 +v 0.055059 15.050701 0.172929 +v 0.506274 14.282709 0.328215 +v -0.752294 13.596712 -1.154398 +v -0.073420 12.757000 -1.333449 +v -0.256063 13.104297 -3.367439 +v 0.538478 12.444112 -3.471214 +v 1.463749 13.529702 -4.747161 +v 2.227979 12.930431 -4.366071 +v 3.358635 13.859891 -4.308897 +v 2.881607 12.620901 -3.651432 +v 3.493514 13.123920 -3.620489 +v 3.071169 12.952566 -2.637273 +v 2.568242 12.038332 -2.344543 +v 2.498347 12.171236 -3.122917 +v 3.071169 12.952566 -2.637273 +v 1.519806 12.099557 -3.389504 +v 1.648955 11.853981 -1.951255 +v 0.707218 12.123252 -1.592053 +v 1.871126 12.755077 -0.210464 +v 1.186385 13.440883 0.161972 +v 2.785374 14.755335 0.242828 +v 2.098890 15.589729 0.417684 +v 3.092620 16.752132 -0.938400 +v 2.254659 17.163551 -0.955928 +v 2.106331 17.466663 -2.693524 +v 1.296754 17.126791 -2.310160 +v 0.645911 16.773483 -3.082728 +v 0.772687 15.706969 -1.960574 +v -0.180162 16.094406 -3.124500 +v -0.697563 15.487358 -2.411006 +v 0.772687 15.706969 -1.960574 +v -0.303037 15.782483 -4.021998 +v 1.046899 16.894608 -3.963532 +v 1.646784 16.403006 -4.428274 +v 2.905352 17.089003 -2.945660 +v 3.604237 16.277668 -3.172237 +v 3.786881 15.930370 -1.138246 +v 4.273670 15.055063 -1.411709 +v 3.348398 13.969473 -0.135763 +v 3.670427 13.267019 -0.836659 +v 2.539771 12.337559 -0.893832 +v 3.662254 12.803061 -1.741328 +v 3.050348 12.300042 -1.772269 +v 3.071169 12.952566 -2.637273 + +vt 0.773741 0.087229 +vt 0.498197 0.087020 +vt 0.623197 -0.000182 +vt 0.500000 0.168664 +vt 0.773438 0.168664 +vt 0.776560 0.273989 +vt 0.990811 0.269789 +vt 1.000000 0.415924 +vt 0.781738 0.417108 +vt 0.777471 0.558900 +vt 0.500000 0.560958 +vt 0.500000 0.656727 +vt 0.225153 0.654378 +vt 0.228874 0.749557 +vt 0.007314 0.733932 +vt 0.109375 0.993372 +vt 0.228874 0.749557 +vt 0.500000 0.749557 +vt 0.359375 0.993372 +vt 0.225153 0.654378 +vt 0.006028 0.656727 +vt 0.007572 0.560958 +vt 0.222529 0.558900 +vt 0.218262 0.417108 +vt 0.500000 0.415924 +vt 0.500000 0.269789 +vt 0.776560 0.273989 +vt 0.773438 0.168664 +vt 0.987624 0.168664 +vt 0.773741 0.087229 +vt 0.985754 0.087020 +vt 0.904447 -0.000182 +vt 0.221090 0.087229 +vt 0.498197 0.087020 +vt 0.357572 -0.000182 +vt 0.500000 0.168664 +vt 0.226563 0.168664 +vt 0.223440 0.273989 +vt 0.009189 0.269789 +vt 0.000000 0.415924 +vt 0.218262 0.417108 +vt 0.222529 0.558900 +vt 0.500000 0.560958 +vt 0.500000 0.656727 +vt 0.774847 0.654378 +vt 0.771126 0.749557 +vt 0.992686 0.733932 +vt 0.890625 0.993372 +vt 0.771126 0.749557 +vt 0.500000 0.749557 +vt 0.640625 0.993372 +vt 0.774847 0.654378 +vt 0.993972 0.656727 +vt 0.992428 0.560958 +vt 0.777471 0.558900 +vt 0.781738 0.417108 +vt 0.500000 0.415924 +vt 0.500000 0.269789 +vt 0.223440 0.273989 +vt 0.226563 0.168664 +vt 0.011382 0.168664 +vt 0.221090 0.087229 +vt 0.010640 0.087020 +vt 0.123197 -0.000182 + +vn 0.701472 -0.677205 -0.222105 +vn 0.709001 -0.691522 -0.138255 +vn 0.629598 -0.754485 -0.185361 +vn 0.986332 -0.130083 0.101127 +vn 0.897600 -0.072459 -0.434815 +vn 0.867533 0.303829 -0.393796 +vn 0.435435 0.067058 -0.897719 +vn 0.264959 0.333747 -0.904660 +vn -0.318015 -0.156841 -0.935023 +vn -0.507078 0.096465 -0.856485 +vn -0.871772 -0.328707 -0.363271 +vn -0.956771 0.237234 -0.168253 +vn -0.936389 0.129974 0.326009 +vn -0.663951 0.728827 0.167270 +vn -0.658169 0.726149 0.198799 +vn -0.629599 0.754484 0.185361 +vn -0.636883 0.737747 0.223851 +vn -0.608613 0.760359 0.226813 +vn -0.629599 0.754484 0.185361 +vn -0.238770 0.591452 0.770178 +vn -0.638432 0.266746 0.721978 +vn -0.348515 -0.226785 0.909454 +vn -0.800714 -0.471085 0.370048 +vn -0.621774 -0.712976 0.324133 +vn -0.684019 -0.592247 -0.425865 +vn -0.444228 -0.778707 -0.443032 +vn -0.107914 -0.381344 -0.918113 +vn 0.126338 -0.635816 -0.761431 +vn 0.541379 -0.281940 -0.792098 +vn 0.583620 -0.759585 -0.287086 +vn 0.649537 -0.705397 -0.283753 +vn 0.629598 -0.754485 -0.185361 +vn 0.498996 -0.863556 -0.072622 +vn 0.542334 -0.808025 -0.230152 +vn 0.629598 -0.754485 -0.185361 +vn -0.104397 -0.926790 -0.360779 +vn -0.015665 -0.984415 0.175163 +vn -0.376499 -0.892263 0.249230 +vn 0.055598 -0.655492 0.753153 +vn -0.160824 -0.458538 0.874001 +vn 0.433142 0.018877 0.901128 +vn 0.213334 0.255545 0.942966 +vn 0.577716 0.681090 0.449844 +vn 0.012141 0.894770 0.446362 +vn -0.005544 0.998798 -0.048694 +vn -0.593883 0.778508 0.203050 +vn -0.599895 0.781462 0.171589 +vn -0.629599 0.754484 0.185361 +vn -0.621173 0.769852 0.146533 +vn -0.649204 0.746955 0.143502 +vn -0.629599 0.754484 0.185361 +vn -0.692195 0.524176 -0.496091 +vn -0.289644 0.845421 -0.448743 +vn 0.075400 0.554075 -0.829045 +vn 0.527097 0.798977 -0.289492 +vn 0.730543 0.582632 -0.356156 +vn 0.803797 0.448711 0.390601 +vn 0.935262 0.190273 0.298466 +vn 0.598948 -0.207090 0.773547 +vn 0.755597 -0.421058 0.501780 +vn 0.332319 -0.812522 0.478929 +vn 0.667715 -0.739962 -0.081321 +vn 0.601798 -0.794149 -0.084655 +vn 0.629598 -0.754485 -0.185361 + +g polygon4 +s 1 +usemtl mat1 +f 137/137/137 138/138/138 139/139/139 +f 137/137/137 140/140/140 138/138/138 +f 141/141/141 140/140/140 137/137/137 +f 141/141/141 142/142/142 140/140/140 +f 143/143/143 142/142/142 141/141/141 +f 143/143/143 144/144/144 142/142/142 +f 145/145/145 144/144/144 143/143/143 +f 145/145/145 146/146/146 144/144/144 +f 147/147/147 146/146/146 145/145/145 +f 147/147/147 148/148/148 146/146/146 +f 149/149/149 148/148/148 147/147/147 +f 149/149/149 150/150/150 148/148/148 +f 151/151/151 150/150/150 149/149/149 +f 151/151/151 152/152/152 150/150/150 +f 153/153/153 152/152/152 151/151/151 +f 153/153/153 154/154/154 155/155/155 +f 153/153/153 156/156/156 154/154/154 +f 157/157/157 156/156/156 153/153/153 +f 157/157/157 158/158/158 156/156/156 +f 159/159/159 158/158/158 157/157/157 +f 159/159/159 160/160/160 158/158/158 +f 161/161/161 160/160/160 159/159/159 +f 161/161/161 162/162/162 160/160/160 +f 163/163/163 162/162/162 161/161/161 +f 163/163/163 164/164/164 162/162/162 +f 165/165/165 164/164/164 163/163/163 +f 165/165/165 166/166/166 164/164/164 +f 167/167/167 166/166/166 165/165/165 +f 167/167/167 168/168/168 166/166/166 +f 137/137/137 168/168/168 167/167/167 +f 169/169/169 170/170/170 171/171/171 +f 169/169/169 172/172/172 170/170/170 +f 173/173/173 172/172/172 169/169/169 +f 173/173/173 174/174/174 172/172/172 +f 175/175/175 174/174/174 173/173/173 +f 175/175/175 176/176/176 174/174/174 +f 177/177/177 176/176/176 175/175/175 +f 177/177/177 178/178/178 176/176/176 +f 179/179/179 178/178/178 177/177/177 +f 179/179/179 180/180/180 178/178/178 +f 181/181/181 180/180/180 179/179/179 +f 181/181/181 182/182/182 180/180/180 +f 183/183/183 182/182/182 181/181/181 +f 183/183/183 184/184/184 182/182/182 +f 185/185/185 184/184/184 183/183/183 +f 185/185/185 186/186/186 187/187/187 +f 185/185/185 188/188/188 186/186/186 +f 189/189/189 188/188/188 185/185/185 +f 189/189/189 190/190/190 188/188/188 +f 191/191/191 190/190/190 189/189/189 +f 191/191/191 192/192/192 190/190/190 +f 193/193/193 192/192/192 191/191/191 +f 193/193/193 194/194/194 192/192/192 +f 195/195/195 194/194/194 193/193/193 +f 195/195/195 196/196/196 194/194/194 +f 197/197/197 196/196/196 195/195/195 +f 197/197/197 198/198/198 196/196/196 +f 199/199/199 198/198/198 197/197/197 +f 199/199/199 200/200/200 198/198/198 +f 169/169/169 200/200/200 199/199/199 +f 154/154/154 182/182/182 187/187/187 +f 154/154/154 180/180/180 182/182/182 +f 156/156/156 180/180/180 154/154/154 +f 156/156/156 178/178/178 180/180/180 +f 158/158/158 178/178/178 156/156/156 +f 158/158/158 176/176/176 178/178/178 +f 160/160/160 176/176/176 158/158/158 +f 160/160/160 174/174/174 176/176/176 +f 162/162/162 174/174/174 160/160/160 +f 162/162/162 172/172/172 174/174/174 +f 164/164/164 172/172/172 162/162/162 +f 164/164/164 170/170/170 172/172/172 +f 166/166/166 170/170/170 164/164/164 +f 166/166/166 139/139/139 170/170/170 +f 138/138/138 198/198/198 171/171/171 +f 138/138/138 196/196/196 198/198/198 +f 140/140/140 196/196/196 138/138/138 +f 140/140/140 194/194/194 196/196/196 +f 142/142/142 194/194/194 140/140/140 +f 142/142/142 192/192/192 194/194/194 +f 144/144/144 192/192/192 142/142/142 +f 144/144/144 190/190/190 192/192/192 +f 146/146/146 190/190/190 144/144/144 +f 146/146/146 188/188/188 190/190/190 +f 148/148/148 188/188/188 146/146/146 +f 148/148/148 186/186/186 188/188/188 +f 150/150/150 186/186/186 148/148/148 +f 150/150/150 155/155/155 186/186/186 +f 151/151/151 157/157/157 153/153/153 +f 151/151/151 149/149/149 157/157/157 +f 149/149/149 159/159/159 157/157/157 +f 149/149/149 147/147/147 159/159/159 +f 147/147/147 161/161/161 159/159/159 +f 147/147/147 145/145/145 161/161/161 +f 145/145/145 163/163/163 161/161/161 +f 145/145/145 143/143/143 163/163/163 +f 143/143/143 165/165/165 163/163/163 +f 143/143/143 141/141/141 165/165/165 +f 183/183/183 189/189/189 185/185/185 +f 183/183/183 181/181/181 189/189/189 +f 181/181/181 191/191/191 189/189/189 +f 181/181/181 179/179/179 191/191/191 +f 179/179/179 193/193/193 191/191/191 +f 179/179/179 177/177/177 193/193/193 +f 177/177/177 195/195/195 193/193/193 +f 177/177/177 175/175/175 195/195/195 +f 175/175/175 197/197/197 195/195/195 +f 175/175/175 173/173/173 197/197/197 +f 169/169/169 197/197/197 173/173/173 +f 169/169/169 199/199/199 197/197/197 +f 167/167/167 141/141/141 137/137/137 +f 167/167/167 165/165/165 141/141/141 + +v 0.096141 16.259399 -1.783406 +v 0.256968 16.433687 -1.946552 +v 1.698244 14.597821 -2.233069 +v 0.311133 16.409683 -1.664864 + +vt 0.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 1.000000 + +vn -0.980750 0.036986 0.191733 +vn -0.272035 0.805017 -0.527205 +vn 0.629603 -0.754474 -0.185387 +vn -0.033348 0.699237 0.714112 + +g polygon5 +s 1 +usemtl mat2 +f 201/201/201 202/202/202 203/203/203 +f 201/201/201 204/204/204 202/202/202 +f 203/203/203 204/204/204 201/201/201 +f 203/203/203 202/202/202 204/204/204 + diff --git a/ParticleGenerator/res/models/apples/ItmApple2.png b/ParticleGenerator/res/models/apples/ItmApple2.png new file mode 100644 index 0000000000000000000000000000000000000000..66f0d9594af0973e3a5458f80509750a9f816628 Binary files /dev/null and b/ParticleGenerator/res/models/apples/ItmApple2.png differ diff --git a/ParticleGenerator/res/models/new_horse_head.mtl b/ParticleGenerator/res/models/new_horse_head.mtl deleted file mode 100644 index 6c4f6eab820878b43553b9e422fe58b33effedbb..0000000000000000000000000000000000000000 --- a/ParticleGenerator/res/models/new_horse_head.mtl +++ /dev/null @@ -1,2 +0,0 @@ -# Blender 4.1.1 MTL File: 'None' -# www.blender.org diff --git a/ParticleGenerator/res/textures/color/black.png b/ParticleGenerator/res/textures/color/black.png new file mode 100644 index 0000000000000000000000000000000000000000..b079b76b93a654e71f323da16ad706c68a0a7864 Binary files /dev/null and b/ParticleGenerator/res/textures/color/black.png differ diff --git a/ParticleGenerator/res/textures/color/blue.png b/ParticleGenerator/res/textures/color/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..820250c966ab8483eb26216856194924afe4d57d Binary files /dev/null and b/ParticleGenerator/res/textures/color/blue.png differ diff --git a/ParticleGenerator/res/textures/cyan.png b/ParticleGenerator/res/textures/color/cyan.png similarity index 100% rename from ParticleGenerator/res/textures/cyan.png rename to ParticleGenerator/res/textures/color/cyan.png diff --git a/ParticleGenerator/res/textures/gray.png b/ParticleGenerator/res/textures/color/gray.png similarity index 100% rename from ParticleGenerator/res/textures/gray.png rename to ParticleGenerator/res/textures/color/gray.png diff --git a/ParticleGenerator/res/textures/color/green.png b/ParticleGenerator/res/textures/color/green.png new file mode 100644 index 0000000000000000000000000000000000000000..505eb342837c98ec72abf8dcb056811dcd19d162 Binary files /dev/null and b/ParticleGenerator/res/textures/color/green.png differ diff --git a/ParticleGenerator/res/textures/orange.png b/ParticleGenerator/res/textures/color/orange.png similarity index 100% rename from ParticleGenerator/res/textures/orange.png rename to ParticleGenerator/res/textures/color/orange.png diff --git a/ParticleGenerator/res/textures/color/pink.png b/ParticleGenerator/res/textures/color/pink.png new file mode 100644 index 0000000000000000000000000000000000000000..d32b77afad174ab730fac2e25b9859f4867d90f9 Binary files /dev/null and b/ParticleGenerator/res/textures/color/pink.png differ diff --git a/ParticleGenerator/res/textures/color/purple.png b/ParticleGenerator/res/textures/color/purple.png new file mode 100644 index 0000000000000000000000000000000000000000..42a393a307a622996c52dde89371201360f66c1a Binary files /dev/null and b/ParticleGenerator/res/textures/color/purple.png differ diff --git a/ParticleGenerator/res/textures/red.png b/ParticleGenerator/res/textures/color/red.png similarity index 100% rename from ParticleGenerator/res/textures/red.png rename to ParticleGenerator/res/textures/color/red.png diff --git a/ParticleGenerator/res/textures/color/white.png b/ParticleGenerator/res/textures/color/white.png new file mode 100644 index 0000000000000000000000000000000000000000..f9024c215a33ac481282e0ce26c1ca6a02670c94 Binary files /dev/null and b/ParticleGenerator/res/textures/color/white.png differ diff --git a/ParticleGenerator/res/textures/color/yellow.png b/ParticleGenerator/res/textures/color/yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..d2ae00627a41519929e1f522ad5476c41d713095 Binary files /dev/null and b/ParticleGenerator/res/textures/color/yellow.png differ diff --git a/ParticleGenerator/res/textures/grid.png b/ParticleGenerator/res/textures/grid/grid.png similarity index 100% rename from ParticleGenerator/res/textures/grid.png rename to ParticleGenerator/res/textures/grid/grid.png diff --git a/ParticleGenerator/res/textures/A.png b/ParticleGenerator/res/textures/letter/A.png similarity index 100% rename from ParticleGenerator/res/textures/A.png rename to ParticleGenerator/res/textures/letter/A.png diff --git a/ParticleGenerator/res/textures/B.png b/ParticleGenerator/res/textures/letter/B.png similarity index 100% rename from ParticleGenerator/res/textures/B.png rename to ParticleGenerator/res/textures/letter/B.png diff --git a/ParticleGenerator/res/textures/C.png b/ParticleGenerator/res/textures/letter/C.png similarity index 100% rename from ParticleGenerator/res/textures/C.png rename to ParticleGenerator/res/textures/letter/C.png diff --git a/ParticleGenerator/res/textures/D.png b/ParticleGenerator/res/textures/letter/D.png similarity index 100% rename from ParticleGenerator/res/textures/D.png rename to ParticleGenerator/res/textures/letter/D.png diff --git a/ParticleGenerator/res/textures/E.png b/ParticleGenerator/res/textures/letter/E.png similarity index 100% rename from ParticleGenerator/res/textures/E.png rename to ParticleGenerator/res/textures/letter/E.png diff --git a/ParticleGenerator/res/textures/V.png b/ParticleGenerator/res/textures/letter/V.png similarity index 100% rename from ParticleGenerator/res/textures/V.png rename to ParticleGenerator/res/textures/letter/V.png diff --git a/ParticleGenerator/res/textures/Y.png b/ParticleGenerator/res/textures/letter/Y.png similarity index 100% rename from ParticleGenerator/res/textures/Y.png rename to ParticleGenerator/res/textures/letter/Y.png diff --git a/ParticleGenerator/res/textures/bubble.png b/ParticleGenerator/res/textures/particle/bubble.png similarity index 100% rename from ParticleGenerator/res/textures/bubble.png rename to ParticleGenerator/res/textures/particle/bubble.png diff --git a/ParticleGenerator/res/textures/cube.png b/ParticleGenerator/res/textures/particle/cube.png similarity index 100% rename from ParticleGenerator/res/textures/cube.png rename to ParticleGenerator/res/textures/particle/cube.png diff --git a/ParticleGenerator/res/textures/glow1.png b/ParticleGenerator/res/textures/particle/glow1.png similarity index 100% rename from ParticleGenerator/res/textures/glow1.png rename to ParticleGenerator/res/textures/particle/glow1.png diff --git a/ParticleGenerator/res/textures/glow2.png b/ParticleGenerator/res/textures/particle/glow2.png similarity index 100% rename from ParticleGenerator/res/textures/glow2.png rename to ParticleGenerator/res/textures/particle/glow2.png diff --git a/ParticleGenerator/res/textures/glow2bgb.png b/ParticleGenerator/res/textures/particle/glow2bgb.png similarity index 100% rename from ParticleGenerator/res/textures/glow2bgb.png rename to ParticleGenerator/res/textures/particle/glow2bgb.png diff --git a/ParticleGenerator/res/textures/smoke1.png b/ParticleGenerator/res/textures/particle/smoke1.png similarity index 100% rename from ParticleGenerator/res/textures/smoke1.png rename to ParticleGenerator/res/textures/particle/smoke1.png diff --git a/ParticleGenerator/res/textures/smoke2.png b/ParticleGenerator/res/textures/particle/smoke2.png similarity index 100% rename from ParticleGenerator/res/textures/smoke2.png rename to ParticleGenerator/res/textures/particle/smoke2.png diff --git a/ParticleGenerator/res/textures/sphere1.png b/ParticleGenerator/res/textures/particle/sphere1.png similarity index 100% rename from ParticleGenerator/res/textures/sphere1.png rename to ParticleGenerator/res/textures/particle/sphere1.png diff --git a/ParticleGenerator/res/textures/water1.png b/ParticleGenerator/res/textures/particle/water1.png similarity index 100% rename from ParticleGenerator/res/textures/water1.png rename to ParticleGenerator/res/textures/particle/water1.png diff --git a/ParticleGenerator/res/textures/water2.png b/ParticleGenerator/res/textures/particle/water2.png similarity index 100% rename from ParticleGenerator/res/textures/water2.png rename to ParticleGenerator/res/textures/particle/water2.png diff --git a/ParticleGenerator/res/textures/skybox/sea/back.png b/ParticleGenerator/res/textures/skybox/sea/back.png new file mode 100644 index 0000000000000000000000000000000000000000..f9c44c367afe4d9857b6560edc01aa46da86b6d4 Binary files /dev/null and b/ParticleGenerator/res/textures/skybox/sea/back.png differ diff --git a/ParticleGenerator/res/textures/skybox/sea/bottom.png b/ParticleGenerator/res/textures/skybox/sea/bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..653a96268abbb7b1440b2d0e3ab0c90eb47c3a6b Binary files /dev/null and b/ParticleGenerator/res/textures/skybox/sea/bottom.png differ diff --git a/ParticleGenerator/res/textures/skybox/sea/front.png b/ParticleGenerator/res/textures/skybox/sea/front.png new file mode 100644 index 0000000000000000000000000000000000000000..be2fde88da87de22bb73b58e33930692fa65f662 Binary files /dev/null and b/ParticleGenerator/res/textures/skybox/sea/front.png differ diff --git a/ParticleGenerator/res/textures/skybox/sea/left.png b/ParticleGenerator/res/textures/skybox/sea/left.png new file mode 100644 index 0000000000000000000000000000000000000000..5a2856e8c1ebec90448eeb82f8952f97157d19a8 Binary files /dev/null and b/ParticleGenerator/res/textures/skybox/sea/left.png differ diff --git a/ParticleGenerator/res/textures/skybox/sea/right.png b/ParticleGenerator/res/textures/skybox/sea/right.png new file mode 100644 index 0000000000000000000000000000000000000000..78ce9b3b42e2458323883ac9c8a17c48b1a55300 Binary files /dev/null and b/ParticleGenerator/res/textures/skybox/sea/right.png differ diff --git a/ParticleGenerator/res/textures/skybox/sea/top.png b/ParticleGenerator/res/textures/skybox/sea/top.png new file mode 100644 index 0000000000000000000000000000000000000000..d6b555a1417a96fe268f313872622106e27a20b4 Binary files /dev/null and b/ParticleGenerator/res/textures/skybox/sea/top.png differ diff --git a/ParticleGenerator/res/textures/spritesheet/Fire.png b/ParticleGenerator/res/textures/spritesheet/Fire.png new file mode 100644 index 0000000000000000000000000000000000000000..41bfea8c536898242537fe5924148211cf49a9af Binary files /dev/null and b/ParticleGenerator/res/textures/spritesheet/Fire.png differ diff --git a/ParticleGenerator/res/textures/SpriteParticleTest.png b/ParticleGenerator/res/textures/spritesheet/SpriteParticleTest.png similarity index 100% rename from ParticleGenerator/res/textures/SpriteParticleTest.png rename to ParticleGenerator/res/textures/spritesheet/SpriteParticleTest.png diff --git a/ParticleGenerator/res/textures/mastergig.png b/ParticleGenerator/res/textures/spritesheet/mastergig.png similarity index 100% rename from ParticleGenerator/res/textures/mastergig.png rename to ParticleGenerator/res/textures/spritesheet/mastergig.png diff --git a/ParticleGenerator/res/textures/spritesheet/smokeSpritesheet.png b/ParticleGenerator/res/textures/spritesheet/smokeSpritesheet.png new file mode 100644 index 0000000000000000000000000000000000000000..61152291d24b78ebae2832aac562972f24a98c8d Binary files /dev/null and b/ParticleGenerator/res/textures/spritesheet/smokeSpritesheet.png differ diff --git a/ParticleGenerator/src/Interface/Generator/PathGenerator.cpp b/ParticleGenerator/src/Interface/Generator/PathGenerator.cpp index 5cfe9135db426c0df3d6cce627c53948a93f4bfc..331db22035d9dad8a45f2a6d3a5fbbbab3abc22e 100644 --- a/ParticleGenerator/src/Interface/Generator/PathGenerator.cpp +++ b/ParticleGenerator/src/Interface/Generator/PathGenerator.cpp @@ -14,7 +14,7 @@ namespace pg::interface { _index(0) {} void PathGenerator::draw(double current_time) { - ImGui::Text("Physic generator at %f / %f / %f (x, y, z) - variation : %f.", this->parent()->m_position.x, this->parent()->m_position.y, this->parent()->m_position.z, this->parent()->m_positionVariation); + ImGui::Text("Path generator at %f / %f / %f (x, y, z) - variation : %f.", this->parent()->m_position.x, this->parent()->m_position.y, this->parent()->m_position.z, this->parent()->m_positionVariation); ImGui::Text("Default u : %f", this->parent()->m_u); ImGui::Text("u increment : %f", this->parent()->m_increment); ImGui::Text("Spacing : %f", this->parent()->m_spacing); @@ -46,12 +46,12 @@ namespace pg::interface { ImGui::TextColored(ImVec4(0.75f, 0.f, 0.f, 1.f), "Negative index !"); } else { - if(this->_index > this->parent()->getControlPoint().size()) { + if(this->_index >= this->parent()->getControlPoint().size()) { ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "Index out of range, new point will be at the back !"); } if(ImGui::Button("Push Point")) { - if(this->_index > this->parent()->getControlPoint().size()) { + if(this->_index >= this->parent()->getControlPoint().size()) { this->parent()->m_controlPoints.push_back(static_cast<ct::Point>(this->_next)); } else { @@ -66,7 +66,7 @@ namespace pg::interface { ImGui::SameLine(); if(ImGui::Button("Pop Point")) { - if(this->_index > this->parent()->getControlPoint().size()) { + if(this->_index >= this->parent()->getControlPoint().size()) { this->parent()->m_controlPoints.pop_back(); } else { diff --git a/ParticleGenerator/src/Interface/Generator/PathMultyGenerator.cpp b/ParticleGenerator/src/Interface/Generator/PathMultyGenerator.cpp index ecebe1762ba981b3a0ca1abca061f8b9ea133977..fb1c1bde37861f5b05442159a5af5e0f6757f189 100644 --- a/ParticleGenerator/src/Interface/Generator/PathMultyGenerator.cpp +++ b/ParticleGenerator/src/Interface/Generator/PathMultyGenerator.cpp @@ -14,7 +14,7 @@ namespace pg::interface { _index(0) {} void PathMultyGenerator::draw(double current_time) { - ImGui::Text("Physic generator at %f / %f / %f (x, y, z) - variation : %f.", this->parent()->m_position.x, this->parent()->m_position.y, this->parent()->m_position.z, this->parent()->m_positionVariation); + ImGui::Text("Path generator at %f / %f / %f (x, y, z) - variation : %f.", this->parent()->m_position.x, this->parent()->m_position.y, this->parent()->m_position.z, this->parent()->m_positionVariation); ImGui::Text("Default u : %f", this->parent()->m_u); ImGui::Text("u increment : %f", this->parent()->m_increment); ImGui::Text("Spacing : %f", this->parent()->m_spacing); @@ -46,12 +46,12 @@ namespace pg::interface { ImGui::TextColored(ImVec4(0.75f, 0.f, 0.f, 1.f), "Negative index !"); } else { - if(this->_index > this->parent()->getControlPoint().size()) { + if(this->_index >= this->parent()->getControlPoint().size()) { ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "Index out of range, new point will be at the back !"); } if(ImGui::Button("Push Point")) { - if(this->_index > this->parent()->getControlPoint().size()) { + if(this->_index >= this->parent()->getControlPoint().size()) { this->parent()->m_controlPoints.push_back(static_cast<ct::Point>(this->_next)); } else { @@ -66,7 +66,7 @@ namespace pg::interface { ImGui::SameLine(); if(ImGui::Button("Pop Point")) { - if(this->_index > this->parent()->getControlPoint().size()) { + if(this->_index >= this->parent()->getControlPoint().size()) { this->parent()->m_controlPoints.pop_back(); } else { diff --git a/ParticleGenerator/src/Interface/Manager.cpp b/ParticleGenerator/src/Interface/Manager.cpp index 565c62c8e0053b041ac7c38ca61ab977f57eedfc..9db33206160484d957db83f27665f1befc278afc 100644 --- a/ParticleGenerator/src/Interface/Manager.cpp +++ b/ParticleGenerator/src/Interface/Manager.cpp @@ -39,6 +39,11 @@ namespace pg::interface { if(ImGui::Begin(this->_title.c_str())) { ImGui::ColorEdit3("Background Color", &this->_manager.getSceneRenderer().getClearColor()[0]); + bool gridRender = this->_manager.getSceneRenderer().isGridRendering(); + if(ImGui::Checkbox("Render Grid", &gridRender)) { + this->_manager.getSceneRenderer().setGridRender(gridRender); + } + if(ImGui::CollapsingHeader("Performaces")) { this->_historical.draw(current_time); } diff --git a/ParticleGenerator/src/Interface/Scene/GravityMesh.cpp b/ParticleGenerator/src/Interface/Scene/GravityMesh.cpp new file mode 100644 index 0000000000000000000000000000000000000000..359ec84cab6c0787324de25e4a93721a2c88c377 --- /dev/null +++ b/ParticleGenerator/src/Interface/Scene/GravityMesh.cpp @@ -0,0 +1,127 @@ +#include "GravityMesh.hpp" + +#include <imgui.h> +#include "../../Scene/Scenes/GravityMesh.hpp" +#include "../../tfd/tinyfiledialogs.h" + +namespace pg::interface { + GravityMesh::GravityMesh(scene::GravityMesh * parent, particle::PhysicsGenerator * generator, scene::Trajectory * trajectory) + : Scene(parent), SceneParticle(parent), _interface(generator), _trajectory(trajectory), _next(0.f), _index(0) {} + + void GravityMesh::draw(double current_time) { + SceneParticle::draw(current_time); + + ImGui::SeparatorText("Head"); + + float degreeMax = static_cast<float>(this->parent()->_path->getDegree() / this->parent()->_curve->size()); + ImGui::DragFloat("u", &this->parent()->_u, 0.01f); + if(ImGui::Button("Change Model")) { + char const * imagePatterns[1] = {"*.obj"}; + char * path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); + if(path != NULL) { + this->parent()->changeMesh(path); + } + } + + ImGui::SeparatorText("Particle"); + + ImGui::PushID(1); + ImGui::ColorEdit4("Color : ", &this->parent()->_color[0]); + + ImGui::SeparatorText("Particles"); + ImGui::DragFloat3("Scaling", &this->parent()->_particleScale[0], 0.1f); + if(ImGui::Button("Change texture")) { + char const * imagePatterns[1] = {"*.png"}; + char * path = tinyfd_openFileDialog("Texture Browser", "", 1, imagePatterns, "Texture File", false); + if(path != NULL) { + this->parent()->changeParticleTexture(path); + } + } + + ImGui::SameLine(); + + if(ImGui::Button("Change Model")) { + char const * imagePatterns[1] = {"*.obj"}; + char * path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); + if(path != NULL) { + this->parent()->changeParticleModel(path); + } + } + + ImGui::SameLine(); + + ImGui::ColorEdit4("Color : ", &this->parent()->_color[0]); + ImGui::PopID(); + + ImGui::SeparatorText("Generator"); + + if(!this->parent()->_generators.empty()) { + std::string name = std::to_string(reinterpret_cast<intptr_t>(&this->parent()->_generators.front())); + if(this->_interface.parent() != nullptr) { + name = std::to_string(reinterpret_cast<intptr_t>(this->_interface.parent())); + } + + if(ImGui::BeginCombo("Current Generator", name.c_str())) { + for(auto & generator : this->parent()->_generators) { + bool is_selected = std::to_string(reinterpret_cast<intptr_t>(&generator)) == std::to_string(reinterpret_cast<intptr_t>(this->_interface.parent())); + if(ImGui::Selectable(std::to_string(reinterpret_cast<intptr_t>(&generator)).c_str(), is_selected)) { + this->_interface.setParent(&generator); + } + + if (is_selected) { + ImGui::SetItemDefaultFocus(); + } + } + ImGui::EndCombo(); + } + } + this->_interface.draw(current_time); + + if(ImGui::CollapsingHeader("Control Points")) { + for(size_t i = 0; i < this->parent()->_curve->size(); ++i) { + glm::vec3 current = static_cast<glm::vec3>(this->parent()->_curve->at(i)); + ImGui::Text("%i : %f / %f / %f.", i, current.x, current.y, current.z); + } + + ImGui::InputFloat3("", &this->_next[0]); + ImGui::InputInt("Index", &this->_index, 1, 2); + + if(this->_index < 0) { + ImGui::TextColored(ImVec4(0.75f, 0.f, 0.f, 1.f), "Negative index !"); + } + else { + if(this->_index >= this->parent()->_curve->size()) { + ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "Index out of range, new point will be at the back !"); + } + + if(ImGui::Button("Push Point")) { + if(this->_index >= this->parent()->_curve->size()) { + this->parent()->_curve->push_back(static_cast<ct::Point>(this->_next)); + } + else { + this->parent()->_curve->insert(this->parent()->_curve->begin() + this->_index, static_cast<ct::Point>(this->_next)); + } + + if(this->_trajectory != nullptr) { + this->_trajectory->update(current_time); + } + } + + ImGui::SameLine(); + + if(ImGui::Button("Pop Point")) { + if(this->_index >= this->parent()->_curve->size()) { + this->parent()->_curve->pop_back(); + } + else { + this->parent()->_curve->erase(this->parent()->_curve->begin() + this->_index); + } + + if(this->_trajectory != nullptr) { + this->_trajectory->update(current_time); + } + } + } + } + } +} \ No newline at end of file diff --git a/ParticleGenerator/src/Interface/Scene/GravityMesh.hpp b/ParticleGenerator/src/Interface/Scene/GravityMesh.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1f8db68627b580a29ccf0ccd0f3ffd257013dde6 --- /dev/null +++ b/ParticleGenerator/src/Interface/Scene/GravityMesh.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "../Interface.hpp" +#include "SceneParticle.hpp" + +#include "../Generator/PhysicGenerator.hpp" +#include "../../Particle/generator/PhysicsGenerator.hpp" +#include "../../Scene/Scenes/Trajectory.hpp" + +namespace pg::scene { + class GravityMesh; +} + +namespace pg::interface { + class GravityMesh : public Scene<scene::GravityMesh>, public SceneParticle { + private: + PhysicGenerator _interface; + scene::Trajectory * _trajectory; + + glm::vec3 _next; + int _index; + + public: + GravityMesh(scene::GravityMesh *, particle::PhysicsGenerator *, scene::Trajectory *); + virtual ~GravityMesh() = default; + + void draw(double = 0.0) override; + inline std::string title() const override final {return "Horse Head Generator Scene Interface";} + }; +} \ No newline at end of file diff --git a/ParticleGenerator/src/Interface/Scene/HorseHead.cpp b/ParticleGenerator/src/Interface/Scene/HorseHead.cpp deleted file mode 100644 index 105283ce718d4324b31f52c0aba85d1e8a4bc378..0000000000000000000000000000000000000000 --- a/ParticleGenerator/src/Interface/Scene/HorseHead.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "HorseHead.hpp" - -#include <imgui.h> -#include "../../Scene/Scenes/HorseHead.hpp" -#include "../../tfd/tinyfiledialogs.h" - -namespace pg::interface { - HorseHead::HorseHead(scene::HorseHead * parent) - : Scene(parent), SceneParticle(parent) {} - - void HorseHead::draw(double current_time) { - SceneParticle::draw(current_time); - - ImGui::SeparatorText("Horse Head"); - - float degreeMax = static_cast<float>(this->parent()->_path->getDegree()) / this->parent()->_curve->size(); - ImGui::DragFloat("u", &this->parent()->_u, 0.01); - } -} \ No newline at end of file diff --git a/ParticleGenerator/src/Interface/Scene/HorseHead.hpp b/ParticleGenerator/src/Interface/Scene/HorseHead.hpp deleted file mode 100644 index 4e563f19d9c4dd9c65dba828d9ede6e7364b03f4..0000000000000000000000000000000000000000 --- a/ParticleGenerator/src/Interface/Scene/HorseHead.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "../Interface.hpp" -#include "SceneParticle.hpp" - -#include "../Generator/PhysicGenerator.hpp" - -namespace pg::scene { - class HorseHead; -} - -namespace pg::interface { - class HorseHead : public Scene<scene::HorseHead>, public SceneParticle { - public: - HorseHead(scene::HorseHead *); - virtual ~HorseHead() = default; - - void draw(double = 0.0) override; - inline std::string title() const override final {return "Horse Head Generator Scene Interface";} - }; -} \ No newline at end of file diff --git a/ParticleGenerator/src/Interface/Scene/MeshGenerator.cpp b/ParticleGenerator/src/Interface/Scene/MeshGenerator.cpp index 1621f77edf0497a3340eec912b7f35bd5dc78a36..68bcbf827d22b61d1103611d651939f97df245a1 100644 --- a/ParticleGenerator/src/Interface/Scene/MeshGenerator.cpp +++ b/ParticleGenerator/src/Interface/Scene/MeshGenerator.cpp @@ -15,8 +15,10 @@ namespace pg::interface { ImGui::Checkbox("Mesh Render", &this->parent()->_meshEnable); if(ImGui::Button("Change Model")) { char const * imagePatterns[1] = {"*.obj"}; - std::string path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); - this->parent()->changeMesh(path); + char * path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); + if(path != NULL) { + this->parent()->changeMesh(path); + } } ImGui::SameLine(); @@ -26,11 +28,13 @@ namespace pg::interface { ImGui::PopID(); ImGui::SeparatorText("Particles"); - + ImGui::DragFloat3("Scaling", &this->parent()->_scaling[0], 0.1f); if(ImGui::Button("Change texture")) { char const * imagePatterns[1] = {"*.png"}; - std::string path = tinyfd_openFileDialog("Texture Browser", "", 1, imagePatterns, "Texture File", false); - this->parent()->changeTexture(path); + char * path = tinyfd_openFileDialog("Texture Browser", "", 1, imagePatterns, "Texture File", false); + if(path != NULL) { + this->parent()->changeTexture(path); + } } ImGui::SameLine(); diff --git a/ParticleGenerator/src/Interface/Scene/MeshGeneratorModel.cpp b/ParticleGenerator/src/Interface/Scene/MeshGeneratorModel.cpp index bfa6afba560f7a70a89ac4743b7a166658d215ae..494b5df346a007340c3977d57b3efd0a1a1a38cb 100644 --- a/ParticleGenerator/src/Interface/Scene/MeshGeneratorModel.cpp +++ b/ParticleGenerator/src/Interface/Scene/MeshGeneratorModel.cpp @@ -14,25 +14,31 @@ namespace pg::interface { ImGui::Checkbox("Render Mesh", &this->parent()->_enableMeshRender); if(ImGui::Button("Change Model")) { char const * imagePatterns[1] = {"*.obj"}; - std::string path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); - this->parent()->changeMesh(path); + char * path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); + if(path != NULL) { + this->parent()->changeMesh(path); + } } ImGui::SeparatorText("Particles"); - + ImGui::DragFloat3("Scaling", &this->parent()->_scaling[0], 0.1f); ImGui::PushID(1); if(ImGui::Button("Change Model")) { char const * imagePatterns[1] = {"*.obj"}; - std::string path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); - this->parent()->changeMeshParticle(path); + char * path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); + if(path != NULL) { + this->parent()->changeMeshParticle(path); + } } ImGui::SameLine(); if(ImGui::Button("Texture")) { char const * imagePatterns[1] = {"*.png"}; - std::string path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Image File", false); - this->parent()->changeTexture(path); + char * path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Image File", false); + if(path != NULL) { + this->parent()->changeTexture(path); + } } ImGui::SameLine(); diff --git a/ParticleGenerator/src/Interface/Scene/MultyPath.cpp b/ParticleGenerator/src/Interface/Scene/MultyPath.cpp index 13ec32108cab01ad815291aa13b654292a78f413..a514602071da865734f528f9521f22b462bb8eef 100644 --- a/ParticleGenerator/src/Interface/Scene/MultyPath.cpp +++ b/ParticleGenerator/src/Interface/Scene/MultyPath.cpp @@ -17,8 +17,10 @@ namespace pg::interface { ImGui::Image((void*)(intptr_t)this->parent()->getTexture().identifier(), ImVec2(128, 128), ImVec2(0, 1), ImVec2(1, 0)); if(ImGui::Button("Change Texture", ImVec2(128, 25))) { char const * imagePatterns[1] = {"*.png"}; - std::string path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); - this->parent()->changeParticletexture(path); + char * path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); + if(path != NULL) { + this->parent()->changeParticletexture(path); + } } ImGui::SameLine(); ImGui::ColorEdit4("Color", &this->parent()->_color[0]); diff --git a/ParticleGenerator/src/Interface/Scene/Path.cpp b/ParticleGenerator/src/Interface/Scene/Path.cpp index e6981583a59bec0c8e45ec35e6537b8397a547d9..084608fef719a2afb3fe8c40491259e1f31e5d6e 100644 --- a/ParticleGenerator/src/Interface/Scene/Path.cpp +++ b/ParticleGenerator/src/Interface/Scene/Path.cpp @@ -17,8 +17,10 @@ namespace pg::interface { ImGui::Image((void*)(intptr_t)this->parent()->getTexture().identifier(), ImVec2(128, 128), ImVec2(0, 1), ImVec2(1, 0)); if(ImGui::Button("Change Texture", ImVec2(128, 25))) { char const * imagePatterns[1] = {"*.png"}; - std::string path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); - this->parent()->changeParticletexture(path); + char * path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); + if(path != NULL) { + this->parent()->changeParticletexture(path); + } } ImGui::SameLine(); ImGui::ColorEdit4("Color", &this->parent()->_color[0]); diff --git a/ParticleGenerator/src/Interface/Scene/PathAnimated.cpp b/ParticleGenerator/src/Interface/Scene/PathAnimated.cpp index bd4e105481bc63315f5968db45154d468e38153f..a99c403ea78449b401944ca26c1b2b5b6c890318 100644 --- a/ParticleGenerator/src/Interface/Scene/PathAnimated.cpp +++ b/ParticleGenerator/src/Interface/Scene/PathAnimated.cpp @@ -21,15 +21,19 @@ namespace pg::interface { ImGui::Image((void*)(intptr_t)this->parent()->getTexture().identifier(), ImVec2(128, 128), ImVec2(0, 1), ImVec2(1, 0)); if(ImGui::Button("Change Texture", ImVec2(128, 25))) { char const * imagePatterns[1] = {"*.png"}; - std::string path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); - this->parent()->changeTexture(path); + char * path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); + if(path != NULL) { + this->parent()->changeTexture(path); + } } ImGui::SameLine(); if(ImGui::Button("Change Model", ImVec2(128, 25))) { char const * imagePatterns[1] = {"*.obj"}; - std::string path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); - this->parent()->changeMesh(path); + char * path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); + if(path != NULL) { + this->parent()->changeMesh(path); + } } ImGui::SameLine(); diff --git a/ParticleGenerator/src/Interface/Scene/Physic.cpp b/ParticleGenerator/src/Interface/Scene/Physic.cpp index 8f5e9756b029159ce69fcb11381693d2556affce..356d04439d70f92b0d89b89fca920beb11bfb3a4 100644 --- a/ParticleGenerator/src/Interface/Scene/Physic.cpp +++ b/ParticleGenerator/src/Interface/Scene/Physic.cpp @@ -19,8 +19,11 @@ namespace pg::interface { ImGui::Image((void*)(intptr_t)this->parent()->getTexture().identifier(), ImVec2(128, 128), ImVec2(0, 1), ImVec2(1, 0)); if(ImGui::Button("Change Texture", ImVec2(128, 25))) { char const * imagePatterns[1] = {"*.png"}; - std::string path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); - this->parent()->changeParticletexture(path); + char * path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); + + if(path != NULL) { + this->parent()->changeParticletexture(path); + } } ImGui::SameLine(); ImGui::ColorEdit4("Color", &this->parent()->_color[0]); diff --git a/ParticleGenerator/src/Interface/Scene/PhysicModel.cpp b/ParticleGenerator/src/Interface/Scene/PhysicModel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7d9c67c028a2652a590e985c1d24704595f9405a --- /dev/null +++ b/ParticleGenerator/src/Interface/Scene/PhysicModel.cpp @@ -0,0 +1,46 @@ +#include "PhysicModel.hpp" + +#include <imgui.h> +#include "../../tfd/tinyfiledialogs.h" + +#include "../../Scene/Scenes/PhysicModel.hpp" + +#include <iostream> + +namespace pg::interface { + PhysicModel::PhysicModel(scene::PhysicModel * parent, particle::PhysicsGenerator * generator) + : Scene(parent), SceneParticle(parent), _interface(generator) {} + + void PhysicModel::draw(double current_time) { + SceneParticle::draw(current_time); + + ImGui::SeparatorText("Model"); + + ImGui::Image((void*)(intptr_t)this->parent()->getTexture().identifier(), ImVec2(128, 128), ImVec2(0, 1), ImVec2(1, 0)); + if(ImGui::Button("Change Model", ImVec2(128, 25))) { + char const * imagePatterns[1] = {"*.obj"}; + char * path = tinyfd_openFileDialog("Model Browser", "", 1, imagePatterns, "Model File", false); + + if(path != NULL) { + this->parent()->changeModel(path); + } + } + + ImGui::SameLine(); + + if(ImGui::Button("Change Texture", ImVec2(128, 25))) { + char const * imagePatterns[1] = {"*.png"}; + char * path = tinyfd_openFileDialog("Image Browser", "", 1, imagePatterns, "Image File", false); + + if(path != NULL) { + this->parent()->changeTexture(path); + } + } + ImGui::SameLine(); + ImGui::ColorEdit4("Color", &this->parent()->_color[0]); + + ImGui::SeparatorText("Generator"); + + this->_interface.draw(current_time); + } +} \ No newline at end of file diff --git a/ParticleGenerator/src/Interface/Scene/PhysicModel.hpp b/ParticleGenerator/src/Interface/Scene/PhysicModel.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9e8eaa6d1cba7979b5ab85cf233c2924cacd1054 --- /dev/null +++ b/ParticleGenerator/src/Interface/Scene/PhysicModel.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "../Interface.hpp" +#include "SceneParticle.hpp" +#include "../Generator/PhysicGenerator.hpp" +#include "../../Particle/generator/PhysicsGenerator.hpp" + +#include <glm/vec4.hpp> + +namespace pg::scene { + class PhysicModel; +} + +namespace pg::interface { + class PhysicModel : public Scene<scene::PhysicModel>, public SceneParticle { + private: + PhysicGenerator _interface; + + public: + PhysicModel(scene::PhysicModel *, particle::PhysicsGenerator *); + virtual ~PhysicModel() = default; + + virtual void draw(double); + inline std::string title() const override final {return "Physic Scene Interface";} + }; +} \ No newline at end of file diff --git a/ParticleGenerator/src/Particle/generator/Generator.hpp b/ParticleGenerator/src/Particle/generator/Generator.hpp index 6416090cbb277853e4acfb16f09b4b3348615f69..93ded4b4db47990ebe6d934e0f0e642d3aeba74e 100644 --- a/ParticleGenerator/src/Particle/generator/Generator.hpp +++ b/ParticleGenerator/src/Particle/generator/Generator.hpp @@ -36,6 +36,7 @@ namespace pg::particle { this->m_model = glm::rotate(this->m_model, glm::radians(rotation.y), {0.f, 1.f, 0.f}); this->m_model = glm::rotate(this->m_model, glm::radians(rotation.x), {1.f, 0.f, 0.f}); } + inline void scale(const glm::vec3 & scale) {this->m_model = glm::scale(this->m_model, scale);} virtual std::vector<std::unique_ptr<T>> generate(size_t count, size_t birth = 0) const = 0; inline std::vector<std::unique_ptr<T>> operator()(size_t count, size_t birth = 0) const {return this->generate(count, birth);} diff --git a/ParticleGenerator/src/Particle/generator/PathGenerator.cpp b/ParticleGenerator/src/Particle/generator/PathGenerator.cpp index bdd41d4337f7bdab623ca6f494cdabb465e93c6a..6b41da4b8740aa2a1ea94e16d88baf3c170c8701 100644 --- a/ParticleGenerator/src/Particle/generator/PathGenerator.cpp +++ b/ParticleGenerator/src/Particle/generator/PathGenerator.cpp @@ -2,7 +2,7 @@ namespace pg::particle { PathGenerator::PathGenerator(const ct::Curve& controlPoints, const ct::Point& position, float positionVariation) - : Generator(position, positionVariation), m_controlPoints(), m_u(0.0), m_spacing(0.0), m_increment(0.0) { + : Generator(position, positionVariation), m_controlPoints(), m_u(0.0), m_spacing(0.0), m_increment(0.0), m_limitor(0.0) { for(auto & point : controlPoints) { this->m_controlPoints.push_back(this->m_position + glm::vec3(point)); } diff --git a/ParticleGenerator/src/Particle/generator/PathPregeneratedGenerator.cpp b/ParticleGenerator/src/Particle/generator/PathPregeneratedGenerator.cpp index 8206d419ee051fcf77a78cd386e13332b7c038aa..ca50d187921f248a5e85164f82b6598882b2a826 100644 --- a/ParticleGenerator/src/Particle/generator/PathPregeneratedGenerator.cpp +++ b/ParticleGenerator/src/Particle/generator/PathPregeneratedGenerator.cpp @@ -9,7 +9,7 @@ namespace pg::particle { PathPregeneratedGenerator::PathPregeneratedGenerator(ct::CurveGenerator * generator, const ct::Curve & ctrlPoints, double increment, double max, ct::Point position, float posVar) - : _generator(generator), _controlPoints(ctrlPoints), _path(), _u(0.f), _spacing(0.f), _increment(0.01f), _limitor(0.f) { + : m_generator(generator), m_controlPoints(ctrlPoints), m_path(), m_u(0.f), m_spacing(0.f), m_increment(0.01f), m_limitor(0.f) { this->update(increment, max); } @@ -19,8 +19,8 @@ namespace pg::particle { parameters.push_back(i); } - this->_path.clear(); - this->_path = this->_generator->generate(this->_controlPoints, parameters); + this->m_path.clear(); + this->m_path = this->m_generator->generate(this->m_controlPoints, parameters); } std::vector<std::unique_ptr<PathPregenerated>> PathPregeneratedGenerator::generate(size_t count, size_t birth) const { @@ -34,7 +34,7 @@ namespace pg::particle { particles.reserve(count); std::vector<ct::Point> realCtrlPoint; - for(auto & point : this->_controlPoints) { + for(auto & point : this->m_controlPoints) { glm::dvec3 glmPoint = point; glmPoint = glm::rotateZ<double>(glmPoint, glm::radians<double>(this->m_rotation.z)); @@ -53,7 +53,7 @@ namespace pg::particle { positionVariation.y = positionGenerator(randomEngine); positionVariation.z = positionGenerator(randomEngine); - PathPregenerated * particle = new PathPregenerated(birth, this->_path, this->_u + u_space, this->_increment, positionVariation, this->_limitor); + PathPregenerated * particle = new PathPregenerated(birth, this->m_path, this->m_u + u_space, this->m_increment, positionVariation, this->m_limitor); particle->setPositionVariation(positionVariation); particle->setParameterLifeLimitor(this->getParameterLifeLimitor()); diff --git a/ParticleGenerator/src/Particle/generator/PathPregeneratedGenerator.hpp b/ParticleGenerator/src/Particle/generator/PathPregeneratedGenerator.hpp index 48edcbde96c3d1040a31b7d8593c93e085bfa15e..f007cd36f8f4ee68037100c87f16dacd56577a45 100644 --- a/ParticleGenerator/src/Particle/generator/PathPregeneratedGenerator.hpp +++ b/ParticleGenerator/src/Particle/generator/PathPregeneratedGenerator.hpp @@ -6,26 +6,26 @@ namespace pg::particle { class PathPregeneratedGenerator : public Generator<PathPregenerated> { private: - ct::CurveGenerator * _generator; - ct::Curve _controlPoints; - ct::Curve _path; - float _u, _spacing, _increment, _limitor; + ct::CurveGenerator * m_generator; + ct::Curve m_controlPoints; + ct::Curve m_path; + float m_u, m_spacing, m_increment, m_limitor; public: PathPregeneratedGenerator(ct::CurveGenerator *, const ct::Curve &, double = 0.01, double = 1.00000001, ct::Point = ct::Point(), float = 0.f); - inline ct::CurveGenerator * getGenerator() const {return this->_generator;} - inline const ct::Curve & getControlPoint() const {return this->_controlPoints;} - inline const ct::Curve & getPath() const {return this->_path;} - inline float getParameter() const {return this->_u;} - inline float getSpacing() const {return this->_spacing;} - inline float getParameterIncrement() const {return this->_increment;} - inline float getParameterLifeLimitor() const {return this->_limitor;} + inline ct::CurveGenerator * getGenerator() const {return this->m_generator;} + inline const ct::Curve & getControlPoint() const {return this->m_controlPoints;} + inline const ct::Curve & getPath() const {return this->m_path;} + inline float getParameter() const {return this->m_u;} + inline float getSpacing() const {return this->m_spacing;} + inline float getParameterIncrement() const {return this->m_increment;} + inline float getParameterLifeLimitor() const {return this->m_limitor;} - inline void setGenerator(ct::CurveGenerator * generator) {this->_generator = generator;} - inline void setDefaultParameterValue(float u) {this->_u = u;} - inline void setParameterIncrement(float inc) {this->_increment = inc;} - inline void setParameterLifeLimitor(float limitor) {this->_limitor = limitor;} + inline void setGenerator(ct::CurveGenerator * generator) {this->m_generator = generator;} + inline void setDefaultParameterValue(float u) {this->m_u = u;} + inline void setParameterIncrement(float inc) {this->m_increment = inc;} + inline void setParameterLifeLimitor(float limitor) {this->m_limitor = limitor;} virtual void update(double, double); virtual std::vector<std::unique_ptr<PathPregenerated>> generate(size_t count, size_t birth = 0) const; diff --git a/ParticleGenerator/src/Scene/Renderer.cpp b/ParticleGenerator/src/Scene/Renderer.cpp index 7f7667649c90fc731ec0b9ef629423265003d9c4..4890622bfa80af50bca792a671f49d465552114e 100644 --- a/ParticleGenerator/src/Scene/Renderer.cpp +++ b/ParticleGenerator/src/Scene/Renderer.cpp @@ -12,7 +12,8 @@ namespace pg::scene { _chronometer(), _accumulator(0.f), _timestep(1.f / 60.f), - _clearColor(0.f) { + _clearColor(0.f), + _renderGrid(true) { this->_grid.initialize(); } @@ -38,7 +39,10 @@ namespace pg::scene { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - this->_grid.render(camera, current_time); + if(this->_renderGrid) { + this->_grid.render(camera, current_time); + } + if(scene.has_value()) { (*scene)->update(current_time); (*scene)->render(camera, current_time); diff --git a/ParticleGenerator/src/Scene/Renderer.hpp b/ParticleGenerator/src/Scene/Renderer.hpp index ab5408be40cb047b3c5edbc3b0469c1bd7bbe0f2..3ac164290d44c7d73fdb167a776d65a1c014745f 100644 --- a/ParticleGenerator/src/Scene/Renderer.hpp +++ b/ParticleGenerator/src/Scene/Renderer.hpp @@ -22,6 +22,7 @@ namespace pg::scene { Chronometer _chronometer; float _accumulator, _timestep; glm::vec3 _clearColor; + bool _renderGrid; public: Renderer(const Window &, Manager &); @@ -30,6 +31,9 @@ namespace pg::scene { inline const Window & getWindow() const {return this->_window;} inline const glm::vec3 & getClearColor() const {return this->_clearColor;} inline glm::vec3 & getClearColor() {return this->_clearColor;} + inline bool isGridRendering() const {return this->_renderGrid;} + + inline void setGridRender(bool state) {this->_renderGrid = state;} void update(Scene &, double); diff --git a/ParticleGenerator/src/Scene/Scenes/HorseHead.cpp b/ParticleGenerator/src/Scene/Scenes/GravityMesh.cpp similarity index 66% rename from ParticleGenerator/src/Scene/Scenes/HorseHead.cpp rename to ParticleGenerator/src/Scene/Scenes/GravityMesh.cpp index 2163eb661c663652c7784f5b48e550aab5d4f3db..2612ecd664b9a95866e3c6dbfb47a99142faf50a 100644 --- a/ParticleGenerator/src/Scene/Scenes/HorseHead.cpp +++ b/ParticleGenerator/src/Scene/Scenes/GravityMesh.cpp @@ -1,4 +1,4 @@ -#include "HorseHead.hpp" +#include "GravityMesh.hpp" #include "../../Mesh/Model.hpp" @@ -9,18 +9,19 @@ #include <mutex> namespace pg::scene { - HorseHead::HorseHead(ct::CurveGenerator * generator, ct::Curve & curve) + GravityMesh::GravityMesh(ct::CurveGenerator * generator, ct::Curve & curve) : SceneParticle(16384), _ubo(0), _color(0.75f), _trajectoryGenerator(generator, curve), - _trajectory(&this->_trajectoryGenerator), + _trajectory(&this->_trajectoryGenerator, 0.01), _path(generator), _curve(&curve), _u(0.0), - _interface(this) {} + _particleScale(1.f), + _interface(this, &this->_generator, &this->_trajectory) {} - void HorseHead::initialize() { + void GravityMesh::initialize() { if(!this->_headProgram.usable()) { Source vert("res/shaders/scene/Phong.vert", Source::Categorie::VERTEX); Source frag("res/shaders/scene/Phong-Color.frag", Source::Categorie::FRAGMENT); @@ -35,8 +36,8 @@ namespace pg::scene { } if(!this->_particleProgram.usable()) { - Source vert("res/shaders/scene/Billboard.vert", Source::Categorie::VERTEX); - Source frag("res/shaders/scene/Billboard.frag", Source::Categorie::FRAGMENT); + Source vert("res/shaders/scene/Phong-Fat.vert", Source::Categorie::VERTEX); + Source frag("res/shaders/scene/Phong.frag", Source::Categorie::FRAGMENT); this->_particleProgram << vert; this->_particleProgram << frag; @@ -46,54 +47,10 @@ namespace pg::scene { vert.release(); frag.release(); } - - if(!this->_head.isGenerated()) { - Model model("res/models/horse_head.obj"); - - MeshGeometry geometry = model.getMeshGeometry(); - this->_head.generate(geometry.vertices, geometry.indices); - - auto & vertices = geometry.vertices; - auto & indices = geometry.indices; - - for(size_t i = 0; i < geometry.indices.size(); i+= 3) { - particle::PhysicsGenerator generator; - glm::vec3 & p1 = vertices[indices[i]].position, p2 = vertices[indices[i+1]].position, p3 = vertices[indices[i+2]].position; - - glm::vec3 baricenter = (p1 + p2 + p3) / 3.f; - generator.setPosition(baricenter); - - glm::vec3 normal = glm::triangleNormal(p1, p2, p3); - glm::vec3 velocity = glm::normalize(normal) / 50.f; - - velocity.x = 0.2f; - velocity.z = -0.2f; - - generator.setVelocity(velocity); - generator.setGravity(0.001f); - - generator.setPositionVariation(0.005f); - this->_generators.push_back(generator); - } - } - - /*if(!this->_particlesMesh.isGenerated()) { - Model model("res/models/sphere.obj"); - MeshGeometry geometry = model.getMeshGeometry(); - this->_particlesMesh.generate(geometry.vertices, geometry.indices); - }*/ - - this->_particle.initialize(); - - this->_material.load("res/textures/water1.png"); - this->_skybox.load({ - "res/textures/skybox/snow/right.png", - "res/textures/skybox/snow/left.png", - "res/textures/skybox/snow/top.png", - "res/textures/skybox/snow/bottom.png", - "res/textures/skybox/snow/front.png", - "res/textures/skybox/snow/back.png" - }); + + this->changeParticleModel("res/models/sphere.obj"); + this->changeParticleTexture("res/textures/color/blue.png"); + this->changeMesh("res/models/cube.obj"); { glCreateBuffers(1, &this->_ubo); @@ -109,11 +66,11 @@ namespace pg::scene { this->_particles.reserve(16384); this->setSpawnCount(1); - this->setSpawnFrequence(500); + this->setSpawnFrequence(1500); this->setLifetime(1); } - void HorseHead::update(double current_time) { + void GravityMesh::update(double current_time) { static auto start = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now(); @@ -134,13 +91,12 @@ namespace pg::scene { } } - void HorseHead::render(const Camera & camera, double current_time) { + void GravityMesh::render(const Camera & camera, double current_time) { const glm::mat4 VIEW_MATRIX = camera.getViewMatrix(); const glm::mat4 PROJECTION_MATRIX = camera.getViewFrustum().getProjectionMatrix(); //? ---- - //this->_skybox.draw(camera); this->_trajectory.render(camera, current_time); //? ---- @@ -152,7 +108,6 @@ namespace pg::scene { if(this->_curve != nullptr && this->_path != nullptr) { this->_meshPosition = glm::vec3(this->_path->generate(*this->_curve, static_cast<double>(this->_u))); - //model = glm::rotate(model, glm::radians(45.f), {0.f, 1.f, 0.f}); model = glm::translate(model, this->_meshPosition); } @@ -177,7 +132,7 @@ namespace pg::scene { if(i + particle_accumulator < this->_particles.size()) { glm::mat4 model = this->_particles[particle_accumulator + i]->getModel(); - model = glm::scale(model, glm::vec3(0.5, 0.5, 0.5)); + model = glm::scale(model, this->_particleScale); models.push_back(model); } } @@ -195,6 +150,10 @@ namespace pg::scene { this->_particleProgram.setUniform("uSlot", 0); this->_particleProgram.setUniform("uColor", this->_color); + this->_headProgram.setUniform("uColor", this->_color); + this->_headProgram.setUniform("uViewPosition", camera.getPosition()); + this->_headProgram.setUniform("uLightPosition", camera.getPosition()); + pg::error::OpenGLError::check(); glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL); @@ -212,13 +171,13 @@ namespace pg::scene { glDisable(GL_DEPTH_TEST); } - void HorseHead::destroy() { + void GravityMesh::destroy() { glDeleteBuffers(1, &this->_ubo); this->_trajectory.destroy(); this->_particles.clear(); } - void HorseHead::spawn(int count, double current_time) { + void GravityMesh::spawn(int count, double current_time) { std::vector<std::thread> threads; std::mutex mutex; @@ -229,7 +188,6 @@ namespace pg::scene { for(size_t j = accumulator; j < accumulator + this->_generators.size() / 8; j++) { if(j < this->_generators.size()) { this->_generators.at(j).setModel(glm::mat4(1.f)); - //this->_generators.at(j).rotate({0.0, 45.f, 0.0}); this->_generators.at(j).translate(this->_generators.at(j).getPosition() + this->_meshPosition); if((count + this->_particles.size()) <= this->getMaxParticles()) { @@ -248,17 +206,47 @@ namespace pg::scene { for(auto & thread : threads) { thread.join(); } + } + + void GravityMesh::changeMesh(const std::string & path) { + Model model(path); + + MeshGeometry geometry = model.getMeshGeometry(); + this->_head.generate(geometry.vertices, geometry.indices); + + auto & vertices = geometry.vertices; + auto & indices = geometry.indices; + + this->_generators.clear(); + + for(size_t i = 0; i < geometry.indices.size(); i+= 3) { + particle::PhysicsGenerator generator; + glm::vec3 & p1 = vertices[indices[i]].position, p2 = vertices[indices[i+1]].position, p3 = vertices[indices[i+2]].position; + + glm::vec3 baricenter = (p1 + p2 + p3) / 3.f; + generator.setPosition(baricenter); + glm::vec3 normal = glm::triangleNormal(p1, p2, p3); + glm::vec3 velocity = glm::normalize(normal) / 50.f; - /*for(auto & generator : this->_generators) { - generator.setModel(glm::mat4(1.f)); - generator.rotate({0.0, 45.f, 0.0}); - generator.translate(generator.getPosition() + this->_meshPosition); + velocity.x = 0.01f; + velocity.z = -0.01f; + + generator.setVelocity(velocity); + generator.setGravity(0.001f); - if((count + this->_particles.size()) <= this->getMaxParticles()) { - std::vector<std::unique_ptr<particle::Physics>> newParticles = generator.generate(count, static_cast<size_t>(current_time)); - this->_particles.insert(this->_particles.begin(), std::make_move_iterator(newParticles.begin()), std::make_move_iterator(newParticles.end())); - } - }*/ + generator.setPositionVariation(0.005f); + this->_generators.push_back(generator); + } + } + + void GravityMesh::changeParticleTexture(const std::string & path) { + this->_material.load(path); + } + + void GravityMesh::changeParticleModel(const std::string & path) { + Model model(path); + MeshGeometry geometry = model.getMeshGeometry(); + this->_particle.generate(geometry.vertices, geometry.indices); } } \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/HorseHead.hpp b/ParticleGenerator/src/Scene/Scenes/GravityMesh.hpp similarity index 68% rename from ParticleGenerator/src/Scene/Scenes/HorseHead.hpp rename to ParticleGenerator/src/Scene/Scenes/GravityMesh.hpp index 101237bc981a327780f8d42225cf05b3e1e47a85..42fa67e4fc364000cf74a4ba960e4eba464402f3 100644 --- a/ParticleGenerator/src/Scene/Scenes/HorseHead.hpp +++ b/ParticleGenerator/src/Scene/Scenes/GravityMesh.hpp @@ -9,18 +9,17 @@ #include "../../Particle/generator/PhysicsGenerator.hpp" #include "Trajectory.hpp" -#include "../../Interface/Scene/HorseHead.hpp" +#include "../../Interface/Scene/GravityMesh.hpp" namespace pg::scene { - class HorseHead : public SceneParticle { + class GravityMesh : public SceneParticle { private: GLuint _ubo; Program _headProgram; Program _particleProgram; Mesh _head; - Billboard _particle; + Mesh _particle; Material _material; - SkyBox _skybox; particle::PhysicsGenerator _generator; std::vector<particle::PhysicsGenerator> _generators; @@ -33,11 +32,13 @@ namespace pg::scene { ct::Curve * _curve; float _u; - interface::HorseHead _interface; + glm::vec3 _particleScale; + + interface::GravityMesh _interface; public: - HorseHead(ct::CurveGenerator *, ct::Curve &); - virtual ~HorseHead() = default; + GravityMesh(ct::CurveGenerator *, ct::Curve &); + virtual ~GravityMesh() = default; virtual void initialize(); virtual void update(double); @@ -45,10 +46,14 @@ namespace pg::scene { virtual void destroy(); virtual void spawn(int, double); - virtual std::string name() const {return "Path HorseHead Generator";} + virtual std::string name() const {return "Mesh - Path Mesh Generator";} virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} - friend class interface::HorseHead; + void changeMesh(const std::string &); + void changeParticleTexture(const std::string &); + void changeParticleModel(const std::string &); + + friend class interface::GravityMesh; }; } \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/Grid.cpp b/ParticleGenerator/src/Scene/Scenes/Grid.cpp index 160db938c45d601e5aba7c958540c5f40cad69a5..5377d5f95eee5ba2dd225033576c5ee8b32a453f 100644 --- a/ParticleGenerator/src/Scene/Scenes/Grid.cpp +++ b/ParticleGenerator/src/Scene/Scenes/Grid.cpp @@ -6,7 +6,7 @@ namespace pg::scene { Grid::Grid() : _gridMesh(), - _gridMaterial("res/textures/grid.png"), + _gridMaterial("res/textures/grid/grid.png"), _shader() { @@ -57,8 +57,4 @@ namespace pg::scene { } - - std::string Grid::name() const { - return "Grid"; - } } \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/Grid.hpp b/ParticleGenerator/src/Scene/Scenes/Grid.hpp index 68c84d3018833ac4844d6f529e943c7a4a0b9ad6..9be25fac9dbcb903822be78a063dde5bfcfeb824 100644 --- a/ParticleGenerator/src/Scene/Scenes/Grid.hpp +++ b/ParticleGenerator/src/Scene/Scenes/Grid.hpp @@ -24,6 +24,6 @@ namespace pg::scene void render(const Camera&, double) override; void destroy() override; - std::string name() const override; + virtual std::string name() const {return "TEST - Grid";} }; } \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/MeshGenerator.cpp b/ParticleGenerator/src/Scene/Scenes/MeshGenerator.cpp index 0d0b819bab110d31676dba76a1c5c62353d6af7f..a15dd482c20c6a470756171d1debd750e0b92a63 100644 --- a/ParticleGenerator/src/Scene/Scenes/MeshGenerator.cpp +++ b/ParticleGenerator/src/Scene/Scenes/MeshGenerator.cpp @@ -21,6 +21,7 @@ namespace pg::scene { _ubo(0), _meshColor(1.f), _color(1.f), + _scaling(1.f), _meshEnable(true), _skyboxEnable(true), _interface(this) {} @@ -53,7 +54,7 @@ namespace pg::scene { } this->_billboard.initialize(); - this->_billboardTexture.load("res/textures/smoke1.png"); + this->_billboardTexture.load("res/textures/particle/smoke1.png"); if(!this->_billboardProgram.usable()) { Source vert("res/shaders/scene/Billboard.vert", Source::Categorie::VERTEX); @@ -150,7 +151,9 @@ namespace pg::scene { std::vector<glm::mat4> models; for(size_t i = 0; i < this->_particles.size() && i < 1024; i++) { if(i + particle_accumulator < this->_particles.size()) { - models.push_back(this->_particles[particle_accumulator + i]->getModel()); + glm::mat4 model = this->_particles[particle_accumulator + i]->getModel(); + model = glm::scale(model, this->_scaling); + models.push_back(model); } } diff --git a/ParticleGenerator/src/Scene/Scenes/MeshGenerator.hpp b/ParticleGenerator/src/Scene/Scenes/MeshGenerator.hpp index b5ffe90989370f0c085029fe36ee5e588db7ff0f..6a90726c0affddb383603360d0e1e05aa5f73417 100644 --- a/ParticleGenerator/src/Scene/Scenes/MeshGenerator.hpp +++ b/ParticleGenerator/src/Scene/Scenes/MeshGenerator.hpp @@ -29,6 +29,7 @@ namespace pg::scene { glm::vec4 _color; glm::vec4 _meshColor; + glm::vec3 _scaling; bool _meshEnable; bool _skyboxEnable; @@ -44,7 +45,7 @@ namespace pg::scene { virtual void render(const Camera &, double); virtual void destroy(); - virtual std::string name() const {return "Mesh Generate Billboard Generator";}; + virtual std::string name() const {return "Billboard - Mesh Model Generator";}; virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} void changeMesh(const std::string &); diff --git a/ParticleGenerator/src/Scene/Scenes/MeshGeneratorModel.cpp b/ParticleGenerator/src/Scene/Scenes/MeshGeneratorModel.cpp index a12913353cc4682b900334635ecb56c31560c2a9..cd0e0dedaf272df8d9add535456f4eddc826c78f 100644 --- a/ParticleGenerator/src/Scene/Scenes/MeshGeneratorModel.cpp +++ b/ParticleGenerator/src/Scene/Scenes/MeshGeneratorModel.cpp @@ -19,6 +19,7 @@ namespace pg::scene { _meshParticleProgram(), _ubo(0), _color(1.f), + _scaling(1.f), _interface(this) {} void MeshGeneratorModel::initialize() { @@ -52,7 +53,7 @@ namespace pg::scene { frag.release(); } - this->_meshParticleTexture.load("res/textures/gray.png"); + this->_meshParticleTexture.load("res/textures/color/gray.png"); if(!this->_meshParticleProgram.usable()) { Source vert("res/shaders/scene/Phong-Fat.vert", Source::Categorie::VERTEX); @@ -140,7 +141,9 @@ namespace pg::scene { std::vector<glm::mat4> models; for(size_t i = 0; i < this->_particles.size() && i < 1024; i++) { if(i + particle_accumulator < this->_particles.size()) { - models.push_back(this->_particles[particle_accumulator + i]->getModel()); + glm::mat4 model = this->_particles[particle_accumulator + i]->getModel(); + model = glm::scale(model, this->_scaling); + models.push_back(model); } } diff --git a/ParticleGenerator/src/Scene/Scenes/MeshGeneratorModel.hpp b/ParticleGenerator/src/Scene/Scenes/MeshGeneratorModel.hpp index a3dd726058880cc4f7ee01d21f5f22bf2f1f19f3..a2f30542645f72ca0248b8ff1c3cb64ac6eae9fb 100644 --- a/ParticleGenerator/src/Scene/Scenes/MeshGeneratorModel.hpp +++ b/ParticleGenerator/src/Scene/Scenes/MeshGeneratorModel.hpp @@ -32,6 +32,7 @@ namespace pg::scene { Program _meshParticleProgram; GLuint _ubo; glm::vec4 _color; + glm::vec3 _scaling; bool _enableMeshRender; @@ -46,7 +47,7 @@ namespace pg::scene { virtual void render(const Camera &, double); virtual void destroy(); - virtual std::string name() const {return "Mesh Generate Model Generator";} + virtual std::string name() const {return "Mesh - Mesh Model Generator";} virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} void changeMesh(const std::string &); diff --git a/ParticleGenerator/src/Scene/Scenes/MultyPath.cpp b/ParticleGenerator/src/Scene/Scenes/MultyPath.cpp index bd724d0ef4726578231ff6623715605f1df2299e..a165d9a4adca548d4757ef9111356f796edbb900 100644 --- a/ParticleGenerator/src/Scene/Scenes/MultyPath.cpp +++ b/ParticleGenerator/src/Scene/Scenes/MultyPath.cpp @@ -58,7 +58,7 @@ namespace pg::scene { pg::error::OpenGLError::check(); - this->_texture.load("res/textures/smoke1.png"); + this->_texture.load("res/textures/particle/smoke1.png"); pg::error::OpenGLError::check(); diff --git a/ParticleGenerator/src/Scene/Scenes/MultyPath.hpp b/ParticleGenerator/src/Scene/Scenes/MultyPath.hpp index c6a3dadfb1daf346e3eabe6ab44a6a02664509de..c7de82f0af297fcf86ff9552090f003da4d29f78 100644 --- a/ParticleGenerator/src/Scene/Scenes/MultyPath.hpp +++ b/ParticleGenerator/src/Scene/Scenes/MultyPath.hpp @@ -39,7 +39,7 @@ namespace pg::scene { void changeParticletexture(const std::string &); - virtual std::string name() const {return "MultiPath Billboard Generator";} + virtual std::string name() const {return "Billboard - MultiPath Generator";} virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} virtual void spawn(int, double); diff --git a/ParticleGenerator/src/Scene/Scenes/Path.cpp b/ParticleGenerator/src/Scene/Scenes/Path.cpp index 015c7f79d2dbafd36d65ea414a27ff99186b5e52..c0e6a1aae3ed57513ee1d9f1dfbfc7d055624811 100644 --- a/ParticleGenerator/src/Scene/Scenes/Path.cpp +++ b/ParticleGenerator/src/Scene/Scenes/Path.cpp @@ -41,14 +41,14 @@ namespace pg::scene { pg::error::OpenGLError::check(); - this->_texture.load("res/textures/smoke1.png"); + this->_texture.load("res/textures/particle/smoke1.png"); pg::error::OpenGLError::check(); this->_generator.setPosition({0.f, 0.f, 0.f}); this->_generator.setPositionVariation(0.5f); this->_generator.setParameterIncrement(0.01f); - this->_generator.setParameterLifeLimitor(1.0f); + this->_generator.setParameterLifeLimitor(this->_generator.getGenerator()->getParamterMax()); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -61,7 +61,7 @@ namespace pg::scene { if(!this->isFreezeEnable()) { pg::particle::Particle::purge(this->_particles, static_cast<size_t>(current_time), this->getLifetime()); - if(duration_cast<std::chrono::milliseconds>(end - start).count() >= 500) { + if(duration_cast<std::chrono::milliseconds>(end - start).count() >= this->getSpawnFrequence()) { start = std::chrono::high_resolution_clock::now(); if(this->isSpawnEnable()) { this->spawn(this->getSpawnCount(), current_time); @@ -127,12 +127,6 @@ namespace pg::scene { } void Path::spawn(int count, double current_time) { - //this->_generator._model = glm::mat4(1.f); - //this->_generator._model = glm::rotate(this->_generator._model, glm::radians(this->_generator.getRotation().z), {0.f, 0.f, 1.f}); - //this->_generator._model = glm::rotate(this->_generator._model, glm::radians(this->_generator.getRotation().y), {0.f, 1.f, 0.f}); - //this->_generator._model = glm::rotate(this->_generator._model, glm::radians(this->_generator.getRotation().x), {1.f, 0.f, 0.f}); - //this->_generator._model = glm::translate(this->_generator._model, this->_generator.getPosition()); - this->_generator.setModel(glm::mat4(1.f)); this->_generator.rotate(this->_generator.getRotation()); this->_generator.translate(this->_generator.getPosition()); diff --git a/ParticleGenerator/src/Scene/Scenes/Path.hpp b/ParticleGenerator/src/Scene/Scenes/Path.hpp index e62a566149017a38b844e7d8fe912381e58c5790..f0dc93d5c105c4bdecc9fd902bb94771ebe6c01d 100644 --- a/ParticleGenerator/src/Scene/Scenes/Path.hpp +++ b/ParticleGenerator/src/Scene/Scenes/Path.hpp @@ -38,7 +38,7 @@ namespace pg::scene { void changeParticletexture(const std::string &); - virtual std::string name() const {return "Path Billboard Generator";} + virtual std::string name() const {return "Billboard - Path Generator";} virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} virtual void spawn(int, double); diff --git a/ParticleGenerator/src/Scene/Scenes/PathAnimated.cpp b/ParticleGenerator/src/Scene/Scenes/PathAnimated.cpp index b9137f20e2886253cbcbd3395172a93a08aa42e1..da14570f05cd0ccd24377606ad41f4d23def027e 100644 --- a/ParticleGenerator/src/Scene/Scenes/PathAnimated.cpp +++ b/ParticleGenerator/src/Scene/Scenes/PathAnimated.cpp @@ -51,7 +51,7 @@ namespace pg::scene { pg::error::OpenGLError::check(); - this->_texture.load("res/textures/cyan.png"); + this->_texture.load("res/textures/color/cyan.png"); pg::error::OpenGLError::check(); @@ -71,7 +71,7 @@ namespace pg::scene { if(!this->isFreezeEnable()) { pg::particle::Particle::purge(this->_particles, static_cast<size_t>(current_time), this->getLifetime()); - if(duration_cast<std::chrono::milliseconds>(end - start).count() >= 500) { + if(duration_cast<std::chrono::milliseconds>(end - start).count() >= this->getSpawnFrequence()) { start = std::chrono::high_resolution_clock::now(); if(this->isSpawnEnable()) { this->spawn(this->getSpawnCount(), current_time); diff --git a/ParticleGenerator/src/Scene/Scenes/PathAnimated.hpp b/ParticleGenerator/src/Scene/Scenes/PathAnimated.hpp index 2afda1427ab90db003cffb5acc0b0f9e859977f0..da0e5e1334690d993fcc8c336097c2c55604272f 100644 --- a/ParticleGenerator/src/Scene/Scenes/PathAnimated.hpp +++ b/ParticleGenerator/src/Scene/Scenes/PathAnimated.hpp @@ -43,7 +43,7 @@ namespace pg::scene { void changeParticletexture(const std::string &); - virtual std::string name() const {return "Path Model Animated Generator";} + virtual std::string name() const {return "Mesh - Path Animated Generator";} virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} virtual void spawn(int, double); diff --git a/ParticleGenerator/src/Scene/Scenes/PathPregenerated.cpp b/ParticleGenerator/src/Scene/Scenes/PathPregenerated.cpp index e650136bf0fa9fb0b9b7b06f7fe4b0afc8815daf..6b061082e28e34d1ccd7e09777b6ad22365cbf21 100644 --- a/ParticleGenerator/src/Scene/Scenes/PathPregenerated.cpp +++ b/ParticleGenerator/src/Scene/Scenes/PathPregenerated.cpp @@ -10,7 +10,7 @@ namespace pg::scene { _program(), _texture(), _generator(generator, ctrlpoint), - _trajectory(&this->_generator), + _trajectory(&this->_generator, 0.1), _color(1.f) {} void PathPregenerated::initialize() { @@ -40,14 +40,12 @@ namespace pg::scene { pg::error::OpenGLError::check(); - this->_texture.load("res/textures/smoke1.png"); + this->_texture.load("res/textures/particle/smoke1.png"); pg::error::OpenGLError::check(); this->_generator.setPosition({0.f, 0.f, 0.f}); this->_generator.setPositionVariation(0.5f); - //this->_generator.setParameterIncrement(0.01f); - //this->_generator.setParameterLifeLimitor(1.0f); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -126,11 +124,6 @@ namespace pg::scene { } void PathPregenerated::spawn(int count, double current_time) { - //this->_generator._model = glm::mat4(1.f); - //this->_generator._model = glm::rotate(this->_generator._model, glm::radians(this->_generator.getRotation().z), {0.f, 0.f, 1.f}); - //this->_generator._model = glm::rotate(this->_generator._model, glm::radians(this->_generator.getRotation().y), {0.f, 1.f, 0.f}); - //this->_generator._model = glm::rotate(this->_generator._model, glm::radians(this->_generator.getRotation().x), {1.f, 0.f, 0.f}); - //this->_generator._model = glm::translate(this->_generator._model, this->_generator.getPosition()); this->_generator.setModel(glm::mat4(1.f)); this->_generator.rotate(this->_generator.getRotation()); diff --git a/ParticleGenerator/src/Scene/Scenes/PathPregenerated.hpp b/ParticleGenerator/src/Scene/Scenes/PathPregenerated.hpp index bc073ad008fcf9e72e9fdb7faca337c19b87015a..a21d631e52a2c6cd66ebcafd02911ffd886b5733 100644 --- a/ParticleGenerator/src/Scene/Scenes/PathPregenerated.hpp +++ b/ParticleGenerator/src/Scene/Scenes/PathPregenerated.hpp @@ -36,10 +36,11 @@ namespace pg::scene { void changeParticletexture(const std::string &); - virtual std::string name() const {return "Path Pregenerated Billboard Generator";} + virtual std::string name() const {return "Billboard - Path Pregenerated";} + //virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} virtual void spawn(int, double); - friend class pg::interface::Path; + //friend class pg::interface::PathPregenerated; }; } \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/Physic.cpp b/ParticleGenerator/src/Scene/Scenes/Physic.cpp index d48f2b92cf051375dd5e8fd2a93c936ece288043..3d3b105dc7ca4bc1ef27b229190513a5c114b2af 100644 --- a/ParticleGenerator/src/Scene/Scenes/Physic.cpp +++ b/ParticleGenerator/src/Scene/Scenes/Physic.cpp @@ -39,7 +39,7 @@ namespace pg::scene { pg::error::OpenGLError::check(); - this->_texture.load("res/textures/smoke1.png"); + this->_texture.load("res/textures/particle/smoke1.png"); pg::error::OpenGLError::check(); diff --git a/ParticleGenerator/src/Scene/Scenes/Physic.hpp b/ParticleGenerator/src/Scene/Scenes/Physic.hpp index 227f48d870a064723dae38bbec1be9135549fdc0..683cc47f2e2dd8c318db35a72e85b06b503fd512 100644 --- a/ParticleGenerator/src/Scene/Scenes/Physic.hpp +++ b/ParticleGenerator/src/Scene/Scenes/Physic.hpp @@ -31,7 +31,7 @@ namespace pg::scene { void changeParticletexture(const std::string &); - virtual std::string name() const {return "Physic Billboard Generator";} + virtual std::string name() const {return "Billboard - Physic Generator";} virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} virtual void initialize(); diff --git a/ParticleGenerator/src/Scene/Scenes/PhysicModel.cpp b/ParticleGenerator/src/Scene/Scenes/PhysicModel.cpp index c84d6572d6fcb997796390167bb337b02b3bdd03..b1e04156540948df3807fb6cf1ea457009d25fdf 100644 --- a/ParticleGenerator/src/Scene/Scenes/PhysicModel.cpp +++ b/ParticleGenerator/src/Scene/Scenes/PhysicModel.cpp @@ -12,11 +12,11 @@ namespace pg::scene { _program(), _texture(), _generator(), - _color(1.f) - /*_interface(this, &this->_generator)*/ {} + _color(0.75f, 0.75f, 0.75f, 0.5f), + _interface(this, &this->_generator) {} void PhysicModel::initialize() { - this->changeModel("res/models/cube.obj"); + this->changeModel("res/models/sphere.obj"); if(!this->_program.usable()) { pg::Source vertices("res/shaders/scene/Phong-Fat.vert", pg::Source::Categorie::VERTEX); pg::Source fragment("res/shaders/scene/Phong.frag", pg::Source::Categorie::FRAGMENT); @@ -41,7 +41,7 @@ namespace pg::scene { pg::error::OpenGLError::check(); - this->_texture.load("res/textures/red.png"); + this->_texture.load("res/textures/color/cyan.png"); pg::error::OpenGLError::check(); @@ -101,7 +101,7 @@ namespace pg::scene { this->_program.setUniform("uSlot", 0); this->_program.setUniform("uColor", this->_color); this->_program.setUniform("uViewPosition", camera.getPosition()); - this->_program.setUniform("uLightPosition", glm::vec3(1.f, 1.f, 1.f)); + this->_program.setUniform("uLightPosition", camera.getPosition()); this->_program.setUniform("uColor", this->_color); pg::error::OpenGLError::check(); diff --git a/ParticleGenerator/src/Scene/Scenes/PhysicModel.hpp b/ParticleGenerator/src/Scene/Scenes/PhysicModel.hpp index 98706945095143ddf2bb0ef8620d94afc1ade934..4019d2e7e07416ba63cc7bc491d0edb4dd9c4b31 100644 --- a/ParticleGenerator/src/Scene/Scenes/PhysicModel.hpp +++ b/ParticleGenerator/src/Scene/Scenes/PhysicModel.hpp @@ -8,6 +8,7 @@ #include "../../Mesh/Mesh.hpp" #include "../../System/Window.hpp" +#include "../../Interface/Scene/PhysicModel.hpp" namespace pg::scene { class PhysicModel : public SceneParticle { @@ -19,7 +20,7 @@ namespace pg::scene { particle::PhysicsGenerator _generator; glm::vec4 _color; - //interface::PhysicModel _interface; + interface::PhysicModel _interface; public: PhysicModel(); @@ -31,8 +32,8 @@ namespace pg::scene { void changeParticletexture(const std::string &); - virtual std::string name() const {return "Physic Model Generator";} - //virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} + virtual std::string name() const {return "Mesh - Physic Generator";} + virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} virtual void initialize(); virtual void render(const Camera &, double); @@ -44,6 +45,6 @@ namespace pg::scene { virtual void spawn(int, double); - //friend class pg::interface::PhysicModel; + friend class pg::interface::PhysicModel; }; } \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/PhysicSprite.cpp b/ParticleGenerator/src/Scene/Scenes/PhysicSprite.cpp index a7c5503aa54ac4c6e8191b226a48a06870e664fa..1d16578749a33e30d3a715566b9c2a4a4aeb306a 100644 --- a/ParticleGenerator/src/Scene/Scenes/PhysicSprite.cpp +++ b/ParticleGenerator/src/Scene/Scenes/PhysicSprite.cpp @@ -3,26 +3,38 @@ #include <chrono> #include <cmath> #include <glm/gtc/matrix_transform.hpp> +#include <random> namespace pg::scene { PhysicSprite::PhysicSprite() : SceneParticle(512), _ubo(0), - _program(), - _texture(), - _generator(), - _color(1.f) {} + _color(1.f), + _fireIndex(0) {} void PhysicSprite::initialize() { this->_billboards.initialize(); - if(!this->_program.usable()) { + if(!this->_programSmoke.usable()) { pg::Source vertices("res/shaders/scene/Billboard-Sprite.vert", pg::Source::Categorie::VERTEX); pg::Source fragment("res/shaders/scene/Billboard-Sprite.frag", pg::Source::Categorie::FRAGMENT); - this->_program << vertices; - this->_program << fragment; + this->_programSmoke << vertices; + this->_programSmoke << fragment; - this->_program.link(); + this->_programSmoke.link(); + + vertices.release(); + fragment.release(); + } + + if(!this->_programFire.usable()) { + pg::Source vertices("res/shaders/scene/Billboard-Sprite-Little.vert", pg::Source::Categorie::VERTEX); + pg::Source fragment("res/shaders/scene/Billboard-Sprite.frag", pg::Source::Categorie::FRAGMENT); + + this->_programFire << vertices; + this->_programFire << fragment; + + this->_programFire.link(); vertices.release(); fragment.release(); @@ -34,17 +46,54 @@ namespace pg::scene { glBindBuffer(GL_UNIFORM_BUFFER, this->_ubo); glBufferData(GL_UNIFORM_BUFFER, 512 * sizeof(glm::mat4) + 512 * sizeof(glm::vec4), nullptr, GL_DYNAMIC_DRAW); - GLuint uniforme_index = glGetUniformBlockIndex(this->_program.id(), "uParticle_t"); + GLuint uniforme_index = glGetUniformBlockIndex(this->_programSmoke.id(), "uParticle_t"); glBindBufferBase(GL_UNIFORM_BUFFER, uniforme_index, this->_ubo); pg::error::OpenGLError::check(); - this->_texture.load("res/textures/SpriteParticleTest.png"); - this->_frames.clear(); - this->_frames.push_back(glm::vec4(0, 32, 32, 32)); - this->_frames.push_back(glm::vec4(32, 32, 32, 32)); - this->_frames.push_back(glm::vec4(0, 0, 32, 32)); - this->_frames.push_back(glm::vec4(32, 0, 32, 32)); + this->_smoke.load("res/textures/spritesheet/smokeSpritesheet.png"); + this->_smokeFrames.clear(); + this->_smokeFrames.push_back(glm::vec4(0, 0, 256, 256)); + this->_smokeFrames.push_back(glm::vec4(256, 0, 256, 256)); + this->_smokeFrames.push_back(glm::vec4(512, 0, 256, 256)); + this->_smokeFrames.push_back(glm::vec4(768, 0, 256, 256)); + + this->_fire.load("res/textures/spritesheet/Fire.png"); + this->_fireFrames.clear(); + this->_fireFrames.push_back(glm::vec4(0, 384, 128, 128)); + this->_fireFrames.push_back(glm::vec4(128, 384, 128, 128)); + this->_fireFrames.push_back(glm::vec4(256, 384, 128, 128)); + this->_fireFrames.push_back(glm::vec4(384, 384, 128, 128)); + this->_fireFrames.push_back(glm::vec4(512, 384, 128, 128)); + this->_fireFrames.push_back(glm::vec4(640, 384, 128, 128)); + this->_fireFrames.push_back(glm::vec4(768, 384, 128, 128)); + this->_fireFrames.push_back(glm::vec4(896, 384, 128, 128)); + + this->_fireFrames.push_back(glm::vec4(0, 256, 128, 128)); + this->_fireFrames.push_back(glm::vec4(128, 256, 128, 128)); + this->_fireFrames.push_back(glm::vec4(256, 256, 128, 128)); + this->_fireFrames.push_back(glm::vec4(384, 256, 128, 128)); + this->_fireFrames.push_back(glm::vec4(512, 256, 128, 128)); + this->_fireFrames.push_back(glm::vec4(640, 256, 128, 128)); + this->_fireFrames.push_back(glm::vec4(768, 256, 128, 128)); + this->_fireFrames.push_back(glm::vec4(896, 256, 128, 128)); + + this->_fireFrames.push_back(glm::vec4(0, 128, 128, 128)); + this->_fireFrames.push_back(glm::vec4(128, 128, 128, 128)); + this->_fireFrames.push_back(glm::vec4(256, 128, 128, 128)); + this->_fireFrames.push_back(glm::vec4(384, 128, 128, 128)); + this->_fireFrames.push_back(glm::vec4(512, 128, 128, 128)); + this->_fireFrames.push_back(glm::vec4(640, 128, 128, 128)); + this->_fireFrames.push_back(glm::vec4(768, 128, 128, 128)); + this->_fireFrames.push_back(glm::vec4(896, 128, 128, 128)); + + this->_fireFrames.push_back(glm::vec4(0, 0, 128, 128)); + this->_fireFrames.push_back(glm::vec4(128, 0, 128, 128)); + this->_fireFrames.push_back(glm::vec4(256, 0, 128, 128)); + this->_fireFrames.push_back(glm::vec4(384, 0, 128, 128)); + this->_fireFrames.push_back(glm::vec4(512, 0, 128, 128)); + this->_fireFrames.push_back(glm::vec4(640, 0, 128, 128)); + pg::error::OpenGLError::check(); @@ -52,6 +101,7 @@ namespace pg::scene { this->_generator.setPositionVariation(0.5); this->_generator.setVelocity({0, 0.01, 0}); this->_generator.setAcceleration({0.0, 0.0001, 0}); + this->_generator.setPosition({0, 1.f, 0}); glClearColor(0.25f, 0.f, 0.15f, 1.0f); } @@ -61,18 +111,31 @@ namespace pg::scene { auto end = std::chrono::high_resolution_clock::now(); if(!this->isFreezeEnable()) { + if(duration_cast<std::chrono::milliseconds>(end - start).count() >= 100) { + ++this->_fireIndex; + } + pg::particle::Particle::purge(this->_particles, static_cast<size_t>(current_time), this->getLifetime()); if(duration_cast<std::chrono::milliseconds>(end - start).count() >= this->getSpawnFrequence()) { start = std::chrono::high_resolution_clock::now(); if(this->isSpawnEnable()) { this->spawn(this->getSpawnCount(), current_time); } + + std::default_random_engine generator; + std::uniform_int_distribution<size_t> distribution(0, this->_smokeFrames.size()-1); + std::uniform_int_distribution<int> change(0, 3); + + for(size_t i = 0; i < this->_particles.size(); i++) { + this->_smokeIndexs.push_back(distribution(generator)); + } } if(duration_cast<std::chrono::milliseconds>(end - start).count() >= 10) { for(auto& particle : this->_particles) { particle->update(0.0); } + } } } @@ -81,13 +144,36 @@ namespace pg::scene { const glm::mat4 VIEW_MATRIX = camera.getViewMatrix(); const glm::mat4 PROJECTION_MATRIX = camera.getViewFrustum().getProjectionMatrix(); + glm::mat4 model = glm::mat4(1.f); + model = glm::translate(model, {0.f, 1.f, 0.f}); + model = glm::scale(model, {2.f, 2.f, 2.f}); + + this->_fire.bind(0); + this->_programFire.use(); + + this->_programFire.setUniform("uView", VIEW_MATRIX); + this->_programFire.setUniform("uProj", PROJECTION_MATRIX); + this->_programFire.setUniform("uModels", {model}); + this->_programFire.setUniform("uFrames", this->_fireFrames.at(static_cast<int>(this->_fireIndex)%this->_fireFrames.size())); + + this->_programFire.setUniform("uSlot", 0); + this->_programFire.setUniform("uSize", glm::vec2(1024.f, 512.f)); + this->_programFire.setUniform("uColor", this->_color); + + glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL); + if(this->isRenderEnable()) { + this->_billboards.draw(); + } + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + std::vector<glm::mat4> models; std::vector<glm::vec4> slots; size_t i = 0; for(auto & particle : this->_particles) { models.push_back(particle->getModel()); - slots.push_back(this->_frames.at(static_cast<int>(current_time-particle->getBorn())%this->_frames.size())); + slots.push_back(this->_smokeFrames.at(static_cast<int>(this->_smokeIndexs.at(i)))); + ++i; } pg::error::OpenGLError::check(); @@ -98,15 +184,15 @@ namespace pg::scene { pg::error::OpenGLError::check(); - this->_texture.bind(0); - this->_program.use(); + this->_smoke.bind(0); + this->_programSmoke.use(); - this->_program.setUniform("uView", VIEW_MATRIX); - this->_program.setUniform("uProj", PROJECTION_MATRIX); + this->_programSmoke.setUniform("uView", VIEW_MATRIX); + this->_programSmoke.setUniform("uProj", PROJECTION_MATRIX); - this->_program.setUniform("uSlot", 0); - this->_program.setUniform("uSize", glm::vec2(64.f, 64.f)); - this->_program.setUniform("uColor", this->_color); + this->_programSmoke.setUniform("uSlot", 0); + this->_programSmoke.setUniform("uSize", glm::vec2(1024.f, 256.f)); + this->_programSmoke.setUniform("uColor", this->_color); pg::error::OpenGLError::check(); glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL); @@ -127,7 +213,7 @@ namespace pg::scene { } void PhysicSprite::changeParticletexture(const std::string & path) { - this->_texture.load(path); + this->_smoke.load(path); } void PhysicSprite::spawn(int count, double current_time) { diff --git a/ParticleGenerator/src/Scene/Scenes/PhysicSprite.hpp b/ParticleGenerator/src/Scene/Scenes/PhysicSprite.hpp index 59cbf508554b14b2952974421776d821de700754..ba90852e60229b0b0b838e46e01cd0b698c7eef1 100644 --- a/ParticleGenerator/src/Scene/Scenes/PhysicSprite.hpp +++ b/ParticleGenerator/src/Scene/Scenes/PhysicSprite.hpp @@ -13,24 +13,30 @@ namespace pg::scene { class PhysicSprite : public SceneParticle { private: GLuint _ubo; - Program _program; - Material _texture; + Program _programSmoke; + Program _programFire; + Material _smoke; + Material _fire; Billboard _billboards; - std::vector<glm::vec4> _frames; + std::vector<glm::vec4> _smokeFrames; + std::vector<glm::vec4> _fireFrames; + std::vector<size_t> _smokeIndexs; particle::PhysicsGenerator _generator; glm::vec4 _color; + size_t _fireIndex; + public: PhysicSprite(); virtual ~PhysicSprite() = default; - inline const Program & getProgram() const {return this->_program;} - inline const Material & getTexture() const {return this->_texture;} + inline const Material & getSmoke() const {return this->_smoke;} + inline const Material & getFire() const {return this->_fire;} inline const particle::PhysicsGenerator & getGenerator() const {return this->_generator;} void changeParticletexture(const std::string &); - virtual std::string name() const {return "Physic Sprite Billboard Generator";} + virtual std::string name() const {return "Billboard - Physic Sprite Generator";} virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>();} virtual void initialize(); diff --git a/ParticleGenerator/src/Scene/Scenes/Trajectory.cpp b/ParticleGenerator/src/Scene/Scenes/Trajectory.cpp index 5d174fc1c4378a0c64f79e88ffbae610e1781af7..5112c8520193a251a8044df5e82b1e41d467b420 100644 --- a/ParticleGenerator/src/Scene/Scenes/Trajectory.cpp +++ b/ParticleGenerator/src/Scene/Scenes/Trajectory.cpp @@ -46,7 +46,8 @@ namespace pg::scene { } std::vector<double> ps; - for(double i = 0.f; i < this->_generator->getGenerator()->getDegree(); i += this->_increment) { + + for(double i = 0.f; i < this->_generator->getGenerator()->getParamterMax(); i += this->_increment) { ps.push_back(i); } diff --git a/ParticleGenerator/src/Scene/Scenes/Trajectory.hpp b/ParticleGenerator/src/Scene/Scenes/Trajectory.hpp index fa846c89e1601090a7efac0b0b542689ba5ac941..0a8d049c1dfc62ef4c6ba445dcbcfa49eae41223 100644 --- a/ParticleGenerator/src/Scene/Scenes/Trajectory.hpp +++ b/ParticleGenerator/src/Scene/Scenes/Trajectory.hpp @@ -37,7 +37,7 @@ namespace pg::scene { void initialize(); void render(const Camera &, double); void update(double); - void destroy(); + void destroy(); virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} diff --git a/ParticleGenerator/src/Scene/Scenes/TrajectoryMulty.hpp b/ParticleGenerator/src/Scene/Scenes/TrajectoryMulty.hpp index 0c024703fe8994e795d7e6316df6b694cec53e13..b4064b5b64d4f4a5ed249a2b634871754390aadb 100644 --- a/ParticleGenerator/src/Scene/Scenes/TrajectoryMulty.hpp +++ b/ParticleGenerator/src/Scene/Scenes/TrajectoryMulty.hpp @@ -36,7 +36,8 @@ namespace pg::scene { void render(const Camera &, double); void update(double); void destroy(); - + + virtual std::string name() const {return "TEST - Multipath Trajectory";} virtual std::optional<interface::Interface *> interface() {return std::optional<interface::Interface *>(&this->_interface);} friend class interface::TrajectoryMulty; diff --git a/ParticleGenerator/src/Scene/Scenes/TrajectoryPregenerated.hpp b/ParticleGenerator/src/Scene/Scenes/TrajectoryPregenerated.hpp index 6f13d8a3f4e4f6269672b53107c8e4889318f484..342f038db1995870527b30ad5d4c78b9da189dc4 100644 --- a/ParticleGenerator/src/Scene/Scenes/TrajectoryPregenerated.hpp +++ b/ParticleGenerator/src/Scene/Scenes/TrajectoryPregenerated.hpp @@ -5,6 +5,10 @@ #include "../../Interface/Scene/Trajectory.hpp" #include "../Scene.hpp" +namespace pg::particle { + class PathPregeneratedGenerator; +} + namespace pg::scene { class TrajectoryPregenerated : public Scene { private: @@ -37,6 +41,10 @@ namespace pg::scene { void update(double); void destroy(); + virtual std::string name() const {return "TEST - Trajectory Pregenerated";} + friend class interface::Trajectory; + + }; } \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/BillboardTest.cpp b/ParticleGenerator/src/Scene/Scenes/test/BillboardTest.cpp similarity index 97% rename from ParticleGenerator/src/Scene/Scenes/BillboardTest.cpp rename to ParticleGenerator/src/Scene/Scenes/test/BillboardTest.cpp index 6130db5d3ab9ceabf733126cf8945ce39ea70be2..6324fc0e595b7748d944aa4e1f028d9c205e5cdc 100644 --- a/ParticleGenerator/src/Scene/Scenes/BillboardTest.cpp +++ b/ParticleGenerator/src/Scene/Scenes/test/BillboardTest.cpp @@ -20,7 +20,7 @@ namespace pg::scene { fragment.release(); } - this->_texture.load("res/textures/mastergig.png"); + this->_texture.load("res/textures/spritesheet/mastergig.png"); this->_frames.clear(); this->_frames.push_back(glm::vec4(0, 0, 16, 16)); this->_frames.push_back(glm::vec4(16, 0, 16, 16)); diff --git a/ParticleGenerator/src/Scene/Scenes/BillboardTest.hpp b/ParticleGenerator/src/Scene/Scenes/test/BillboardTest.hpp similarity index 72% rename from ParticleGenerator/src/Scene/Scenes/BillboardTest.hpp rename to ParticleGenerator/src/Scene/Scenes/test/BillboardTest.hpp index a1875a6d22384ea57ade30de0840f635db4616d1..d8b0a3587860a2c6c78b9f36824e977b27087c97 100644 --- a/ParticleGenerator/src/Scene/Scenes/BillboardTest.hpp +++ b/ParticleGenerator/src/Scene/Scenes/test/BillboardTest.hpp @@ -1,10 +1,10 @@ #pragma once -#include "../Scene.hpp" -#include "../../Mesh/Billboard.hpp" +#include "../../Scene.hpp" +#include "../../../Mesh/Billboard.hpp" namespace pg::scene { - class BillboardTest : public scene::SceneParticle { + class BillboardTest : public SceneParticle { private: Billboard _billboards; Material _texture; @@ -21,6 +21,6 @@ namespace pg::scene { virtual void destroy(); virtual void spawn(int, double); - virtual std::string name() const {return "Billboard Test";} + virtual std::string name() const {return "TEST - Billboard";} }; } \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/test/ModelTest.cpp b/ParticleGenerator/src/Scene/Scenes/test/ModelTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fa5b9b9c2270da52ecbd9dc029396fb0dbbf5bc7 --- /dev/null +++ b/ParticleGenerator/src/Scene/Scenes/test/ModelTest.cpp @@ -0,0 +1,71 @@ +#include "ModelTest.hpp" + +#include "../../../Mesh/Model.hpp" + +namespace pg::scene { + ModelTest::ModelTest() + : _color(1.f) {} + + ModelTest::~ModelTest() {} + + void ModelTest::initialize() { + this->changeMesh("res/models/apples/DolApple.obj"); + this->changeTexture("res/models/apples/itmApple2.png"); + + if(!this->_program.usable()) { + pg::Source vertices("res/shaders/scene/Phong.vert", pg::Source::Categorie::VERTEX); + pg::Source fragment("res/shaders/scene/Phong.frag", pg::Source::Categorie::FRAGMENT); + + this->_program << vertices; + this->_program << fragment; + + this->_program.link(); + + vertices.release(); + fragment.release(); + } + } + + void ModelTest::update(double) { + + } + + void ModelTest::render(const Camera & camera, double) { + glEnable(GL_DEPTH_TEST); + + const glm::mat4 VIEW_MATRIX = camera.getViewMatrix(); + const glm::mat4 PROJ_MATRIX = camera.getViewFrustum().getProjectionMatrix(); + + this->_texture.bind(); + + this->_program.use(); + + this->_program.setUniform("uView", VIEW_MATRIX); + this->_program.setUniform("uProj", PROJ_MATRIX); + this->_program.setUniform("uModel", glm::mat4(1.f)); + + this->_program.setUniform("uLightPosition", camera.getPosition()); + this->_program.setUniform("uViewPosition", camera.getPosition()); + this->_program.setUniform("uColor", this->_color); + + this->_program.setUniform("uSlot", 0); + + this->_mesh.draw(); + + glDisable(GL_DEPTH_TEST); + } + + void ModelTest::destroy() { + + } + + void ModelTest::changeMesh(const std::string & path) { + Model model(path); + MeshGeometry geometry = model.getMeshGeometry(); + this->_mesh.generate(geometry.vertices, geometry.indices); + } + + void ModelTest::changeTexture(const std::string & path) { + this->_texture.load(path, pg::Texture::AUTO, false); + } +} \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/test/ModelTest.hpp b/ParticleGenerator/src/Scene/Scenes/test/ModelTest.hpp new file mode 100644 index 0000000000000000000000000000000000000000..43ce5c5e9bada88c99c00d95ac65a3c0de3ffe7f --- /dev/null +++ b/ParticleGenerator/src/Scene/Scenes/test/ModelTest.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "../../Scene.hpp" +#include "../../../Renderer/Renderer.hpp" +#include "../../../Mesh/Mesh.hpp" + +namespace pg::scene { + class ModelTest : public Scene { + private: + Mesh _mesh; + Material _texture; + Program _program; + + glm::vec4 _color; + + public: + ModelTest(); + virtual ~ModelTest(); + + virtual void initialize(); + virtual void render(const Camera &, double); + virtual void update(double); + virtual void destroy(); + + virtual std::string name() const {return "TEST - Model";} + + void changeMesh(const std::string &); + void changeTexture(const std::string &); + }; +} \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/test/PhongTest.cpp b/ParticleGenerator/src/Scene/Scenes/test/PhongTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..66ce4a845ec37a509770d663b9e8fbae6c0f3633 --- /dev/null +++ b/ParticleGenerator/src/Scene/Scenes/test/PhongTest.cpp @@ -0,0 +1,71 @@ +#include "PhongTest.hpp" + +#include "../../../Mesh/Model.hpp" + +namespace pg::scene { + PhongTest::PhongTest() + : _color(1.f) {} + + PhongTest::~PhongTest() {} + + void PhongTest::initialize() { + this->changeMesh("res/models/sphere.obj"); + this->changeTexture("res/textures/color/purple.png"); + + if(!this->_program.usable()) { + pg::Source vertices("res/shaders/scene/Phong.vert", pg::Source::Categorie::VERTEX); + pg::Source fragment("res/shaders/scene/Phong.frag", pg::Source::Categorie::FRAGMENT); + + this->_program << vertices; + this->_program << fragment; + + this->_program.link(); + + vertices.release(); + fragment.release(); + } + } + + void PhongTest::update(double) { + + } + + void PhongTest::render(const Camera & camera, double) { + glEnable(GL_DEPTH_TEST); + + const glm::mat4 VIEW_MATRIX = camera.getViewMatrix(); + const glm::mat4 PROJ_MATRIX = camera.getViewFrustum().getProjectionMatrix(); + + this->_texture.bind(); + + this->_program.use(); + + this->_program.setUniform("uView", VIEW_MATRIX); + this->_program.setUniform("uProj", PROJ_MATRIX); + this->_program.setUniform("uModel", glm::mat4(1.f)); + + this->_program.setUniform("uLightPosition", camera.getPosition()); + this->_program.setUniform("uViewPosition", camera.getPosition()); + this->_program.setUniform("uColor", this->_color); + + this->_program.setUniform("uSlot", 0); + + this->_mesh.draw(); + + glDisable(GL_DEPTH_TEST); + } + + void PhongTest::destroy() { + + } + + void PhongTest::changeMesh(const std::string & path) { + Model model(path); + MeshGeometry geometry = model.getMeshGeometry(); + this->_mesh.generate(geometry.vertices, geometry.indices); + } + + void PhongTest::changeTexture(const std::string & path) { + this->_texture.load(path); + } +} \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/test/PhongTest.hpp b/ParticleGenerator/src/Scene/Scenes/test/PhongTest.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d7b7ff39d7cc51168579235a1a239e2b167b56e7 --- /dev/null +++ b/ParticleGenerator/src/Scene/Scenes/test/PhongTest.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "../../Scene.hpp" +#include "../../../Renderer/Renderer.hpp" +#include "../../../Mesh/Mesh.hpp" + +namespace pg::scene { + class PhongTest : public Scene { + private: + Mesh _mesh; + Material _texture; + Program _program; + + glm::vec4 _color; + + public: + PhongTest(); + virtual ~PhongTest(); + + virtual void initialize(); + virtual void render(const Camera &, double); + virtual void update(double); + virtual void destroy(); + + virtual std::string name() const {return "TEST - Phong";} + + void changeMesh(const std::string &); + void changeTexture(const std::string &); + }; +} \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/test/SkyboxTest.cpp b/ParticleGenerator/src/Scene/Scenes/test/SkyboxTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..23b408a741dceea012ae33a9d0780d15cdef7b17 --- /dev/null +++ b/ParticleGenerator/src/Scene/Scenes/test/SkyboxTest.cpp @@ -0,0 +1,28 @@ +#include "SkyboxTest.hpp" + +namespace pg::scene { + SkyboxTest::SkyboxTest() {} + + void SkyboxTest::initialize() { + this->_skybox.load({ + "res/textures/skybox/snow/right.png", + "res/textures/skybox/snow/left.png", + "res/textures/skybox/snow/top.png", + "res/textures/skybox/snow/bottom.png", + "res/textures/skybox/snow/front.png", + "res/textures/skybox/snow/back.png" + }); + } + + void SkyboxTest::update(double) { + + } + + void SkyboxTest::render(const Camera & camera, double) { + this->_skybox.draw(camera); + } + + void SkyboxTest::destroy() { + + } +} \ No newline at end of file diff --git a/ParticleGenerator/src/Scene/Scenes/test/SkyboxTest.hpp b/ParticleGenerator/src/Scene/Scenes/test/SkyboxTest.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9be4e5b7578013a7833fce00ee49f8b477e079ee --- /dev/null +++ b/ParticleGenerator/src/Scene/Scenes/test/SkyboxTest.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include "../../Scene.hpp" +#include "../../../Renderer/Renderer.hpp" +#include "../../../Mesh/Skybox.hpp" + +namespace pg::scene { + class SkyboxTest : public Scene { + private: + SkyBox _skybox; + + public: + SkyboxTest(); + virtual ~SkyboxTest() = default; + + virtual void initialize(); + virtual void render(const Camera &, double); + virtual void update(double); + virtual void destroy(); + + virtual std::string name() const {return "TEST - Skybox";} + }; +} \ No newline at end of file diff --git a/ParticleGenerator/src/main.cpp b/ParticleGenerator/src/main.cpp index fcdaeb6f5af5d6f706e4a1bfaa23ae64ec181a55..adf29fc18de3d9a9ad3e6ee0712ce020c37e2d34 100644 --- a/ParticleGenerator/src/main.cpp +++ b/ParticleGenerator/src/main.cpp @@ -17,9 +17,13 @@ #include "Scene/Scenes/MeshGeneratorModel.hpp" #include "Scene/Scenes/PathPregenerated.hpp" #include "Scene/Scenes/PathAnimated.hpp" -#include "Scene/Scenes/BillboardTest.hpp" #include "Scene/Scenes/PhysicModel.hpp" -#include "Scene/Scenes/HorseHead.hpp" +#include "Scene/Scenes/GravityMesh.hpp" + +#include "Scene/Scenes/test/BillboardTest.hpp" +#include "Scene/Scenes/test/PhongTest.hpp" +#include "Scene/Scenes/test/ModelTest.hpp" +#include "Scene/Scenes/test/SkyboxTest.hpp" #include "Interface/Manager.hpp" @@ -83,31 +87,83 @@ int main(int argc, const char * argv[]) { { 10.f, 10.f, 0.f} }; + ct::Curve ctrlPoints2 { + {-1.f, 0.00f, 1.f}, + { 1.f, 0.50f, 1.f}, + { 1.f, 1.00f, -1.f}, + {-1.f, 1.50f, -1.f}, + + {-2.f, 2.00f, -1.f}, + {-2.f, 2.50f, 2.f}, + { 2.f, 3.00f, 2.f}, + { 2.f, 3.50f, -2.f}, + + {-2.f, 4.00f, -2.f}, + {-4.f, 4.50f, 4.f}, + { 4.f, 5.00f, 4.f}, + { 4.f, 5.50f, -4.f}, + + { 4.f, 6.00f, -4.f}, + {-6.f, 6.50f, -6.f}, + {-6.f, 7.00f, 6.f}, + { 6.f, 7.50f, 6.f}, + + { 6.f, 8.00f, -6.f}, + {-6.f, 9.00f, -6.f}, + {-6.f, 8.50f, 6.f}, + { 6.f, 9.50f, 6.f}, + + { 6.f, 10.00f, -6.f}, + {-6.f, 10.50f, -6.f}, + {-6.f, 11.00f, 6.f}, + { 6.f, 11.50f, 6.f}, + + { 6.f, 12.00f, -6.f}, + {-6.f, 12.50f, -6.f}, + {-6.f, 13.00f, 6.f}, + { 6.f, 13.50f, 6.f}, + + { 6.f, 14.00f, -6.f}, + {-6.f, 14.50f, -6.f}, + {-6.f, 15.00f, 6.f}, + { 6.f, 15.50f, 6.f}, + + { 6.f, 16.00f, -6.f}, + {-6.f, 17.50f, -6.f}, + {-6.f, 18.00f, 6.f}, + { 6.f, 19.50f, 6.f}, + }; + ct::Curve horsePoints { - {0.0f, 6.5f, 0.f}, - {0.0f, 9.5f, 1.0}, - {0.0f, 7.3f, 2.0}, - {0.f, 6.9f, 3.0}, - {0.f, 7.4f, 4.0}, - {0.f, 8.5f, 5.0}, - {0.f, 7.4f, 6.0}, + { -3.45f, 12.55f, 0.00f}, + { -2.58f, 13.90f, 0.00f}, + { 1.79f, 14.31f, 0.00f}, + { 3.74f, 8.48f, 0.00f}, + { -1.91f, 6.55f, 0.00f}, + { -5.77f, 9.42f, 0.00f}, + { -3.43f, 12.63f, 0.00f}, }; ct::BezierGenerator bezier(static_cast<unsigned int>(ctrlPoints.size())); - ct::BezierGenerator bezier3(4); - ct::BSplineGenerator bspline(&bezier3); + ct::BezierGenerator bezier4(4); + ct::BSplineGenerator bspline(&bezier4, static_cast<unsigned int>(ctrlPoints2.size())); pg::scene::Physic physic; pg::scene::PhysicSprite physicSprite; - pg::scene::MeshGenerator meshGenerator; - pg::scene::Path path(&bezier, ctrlPoints); + pg::scene::Path path(&bspline, ctrlPoints2); pg::scene::MultyPath multyPath(ctrlPoints); - pg::scene::MeshGeneratorModel meshGeneratorModel; pg::scene::PathPregenerated pathPregenerated(&bezier, ctrlPoints); + pg::scene::MeshGenerator meshGenerator; + + pg::scene::GravityMesh gravityMesh(&bspline, horsePoints); + pg::scene::PhysicModel physicModel; + pg::scene::MeshGeneratorModel meshGeneratorModel; pg::scene::PathAnimated pathAnimated(&bezier); + pg::scene::BillboardTest billboardTest; - pg::scene::PhysicModel physicModel; - pg::scene::HorseHead horsehead(&bspline, horsePoints); + pg::scene::PhongTest phongTest; + pg::scene::ModelTest modelTest; + pg::scene::SkyboxTest skyboxTest; pg::Manager manager(window); pg::interface::Manager imanager(window, manager); @@ -125,8 +181,12 @@ int main(int argc, const char * argv[]) { manager.add(&meshGenerator); manager.add(&meshGeneratorModel); + manager.add(&gravityMesh); + manager.add(&billboardTest); - manager.add(&horsehead); + manager.add(&phongTest); + manager.add(&modelTest); + manager.add(&skyboxTest); while(window.isOpen()) { double current_time = glfwGetTime();