This commit is contained in:
Yggdrasil75
2025-12-05 16:01:03 -05:00
4 changed files with 13 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
#define GRID3_HPP #define GRID3_HPP
#include <unordered_map> #include <unordered_map>
#include "../vectorlogic/Vec3.hpp" #include "../vectorlogic/vec3.hpp"
#include "../vectorlogic/vec4.hpp" #include "../vectorlogic/vec4.hpp"
#include "../timing_decorator.hpp" #include "../timing_decorator.hpp"
#include "../output/frame.hpp" #include "../output/frame.hpp"
@@ -350,13 +350,16 @@ public:
<< " max: " << maxChance << " gen colors: " << color << std::endl; << " max: " << maxChance << " gen colors: " << color << std::endl;
std::vector<Vec3f> poses; std::vector<Vec3f> poses;
std::vector<Vec4ui8> colors; std::vector<Vec4ui8> colors;
#pragma omp parallel for
for (int x = min.x; x < max.x; x++) { for (int x = min.x; x < max.x; x++) {
#pragma omp parallel for
for (int y = min.y; y < max.y; y++) { for (int y = min.y; y < max.y; y++) {
#pragma omp parallel for
for (int z = min.z; z < max.z; z++) { for (int z = min.z; z < max.z; z++) {
float nx = (x+noisemod)/(max.x+EPSILON)/0.1; float nx = (x+noisemod)/(max.x+EPSILON)/0.1;
float ny = (y+noisemod)/(max.y+EPSILON)/0.1; float ny = (y+noisemod)/(max.y+EPSILON)/0.1;
float nz = (z+noisemod)/(max.z+EPSILON)/0.1; float nz = (z+noisemod)/(max.z+EPSILON)/0.1;
Vec3f pos = Vec3f(nx,ny,nz); Vec3 pos = Vec3f(nx,ny,nz);
float alpha = noisegen.permute(pos); float alpha = noisegen.permute(pos);
if (alpha > minChance && alpha < maxChance) { if (alpha > minChance && alpha < maxChance) {
if (color) { if (color) {
@@ -364,11 +367,15 @@ public:
float green = noisegen.permute(Vec3f(nx, ny, nz)*0.6); float green = noisegen.permute(Vec3f(nx, ny, nz)*0.6);
float blue = noisegen.permute(Vec3f(nx, ny, nz)*0.9); float blue = noisegen.permute(Vec3f(nx, ny, nz)*0.9);
Vec4 newc = Vec4ui8(red,green,blue,1.0); Vec4 newc = Vec4ui8(red,green,blue,1.0);
#pragma omp critical
colors.push_back(newc); colors.push_back(newc);
#pragma omp critical
poses.push_back(Vec3f(x,y,z)); poses.push_back(Vec3f(x,y,z));
} else { } else {
Vec4 newc = Vec4ui8(alpha,alpha,alpha,1.0); Vec4 newc = Vec4ui8(alpha,alpha,alpha,1.0);
#pragma omp critical
colors.push_back(newc); colors.push_back(newc);
#pragma omp critical
poses.push_back(Vec3f(x,y,z)); poses.push_back(Vec3f(x,y,z));
} }
} }

View File

@@ -7,7 +7,7 @@
#include <functional> #include <functional>
#include <random> #include <random>
#include "../vectorlogic/vec2.hpp" #include "../vectorlogic/vec2.hpp"
#include "../vectorlogic/Vec3.hpp" #include "../vectorlogic/vec3.hpp"
#include "../timing_decorator.hpp" #include "../timing_decorator.hpp"
class PNoise2 { class PNoise2 {

View File

@@ -7,7 +7,7 @@
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include <filesystem> #include <filesystem>
#include "../vectorlogic/Vec3.hpp" #include "../vectorlogic/vec3.hpp"
#include "frame.hpp" #include "frame.hpp"
class BMPWriter { class BMPWriter {

View File

@@ -1,7 +1,7 @@
#ifndef RAY3_HPP #ifndef RAY3_HPP
#define RAY3_HPP #define RAY3_HPP
#include "vectorlogic/Vec3.hpp" #include "vectorlogic/vec3.hpp"
template<typename T> template<typename T>
class Ray3 { class Ray3 {