diff --git a/RayTracer/RayTracer/RayTracer.cpp b/RayTracer/RayTracer/RayTracer.cpp index 3875d1b..135c458 100644 --- a/RayTracer/RayTracer/RayTracer.cpp +++ b/RayTracer/RayTracer/RayTracer.cpp @@ -42,10 +42,15 @@ class RayTracerEngine : public olc::PixelGameEngine { float totalTime = 0; void drawingThread(int start, int end, int32_t width, int32_t height, olc::Pixel* tela) { - for (int i = start; i < end && icenter.x = 10 + 8 *cos(1 * totalTime) + 2 * sin(3*totalTime); @@ -60,9 +65,13 @@ class RayTracerEngine : public olc::PixelGameEngine { olc::Pixel *tela = new olc::Pixel[width * height]; std::thread threads[nThreads]; - for (int i = 0; i < nThreads; i++) { + /*for (int i = 0; i < nThreads; i++) { threads[i] = std::thread(&RayTracerEngine::drawingThread, this, i * width * height / nThreads, (i + 1) * width * height / nThreads, width, height, tela); + }*/ + for (int i = 0; i < nThreads; i++) { + threads[i] = std::thread(&RayTracerEngine::drawingThread2, this, i, width, height, tela); } + for (int i = 0; i < nThreads; i++) { threads[i].join(); }