updating blur shading, broken
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1033,9 +1033,9 @@ polypartiCL
|
|||||||
/opt/intel/oneapi/compiler/2026.0/lib/libirng.so
|
/opt/intel/oneapi/compiler/2026.0/lib/libirng.so
|
||||||
/opt/intel/oneapi/compiler/2026.0/lib/libsvml.so
|
/opt/intel/oneapi/compiler/2026.0/lib/libsvml.so
|
||||||
/opt/intel/oneapi/compiler/2026.0/lib/libur_loader.so.0
|
/opt/intel/oneapi/compiler/2026.0/lib/libur_loader.so.0
|
||||||
/tmp/icpx-0a1da134b6/main-6e9924.o
|
/tmp/icpx-6e0c7c75f4/main-0db82a.o
|
||||||
/tmp/icpx-0a1da134b6/polypartiCL-c43ca4.o
|
/tmp/icpx-6e0c7c75f4/polypartiCL-d70aea.o
|
||||||
/tmp/icpx-0a1da134b6/polypartiCL-wrapper-5876b9.o
|
/tmp/icpx-6e0c7c75f4/polypartiCL-wrapper-7bf44e.o
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o
|
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/15/crtendS.o
|
/usr/lib/gcc/x86_64-linux-gnu/15/crtendS.o
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a
|
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a
|
||||||
|
|||||||
@@ -1030,9 +1030,9 @@ polypartiCL: /lib/x86_64-linux-gnu/Scrt1.o \
|
|||||||
/opt/intel/oneapi/compiler/2026.0/lib/libirng.so \
|
/opt/intel/oneapi/compiler/2026.0/lib/libirng.so \
|
||||||
/opt/intel/oneapi/compiler/2026.0/lib/libsvml.so \
|
/opt/intel/oneapi/compiler/2026.0/lib/libsvml.so \
|
||||||
/opt/intel/oneapi/compiler/2026.0/lib/libur_loader.so.0 \
|
/opt/intel/oneapi/compiler/2026.0/lib/libur_loader.so.0 \
|
||||||
/tmp/icpx-0a1da134b6/main-6e9924.o \
|
/tmp/icpx-6e0c7c75f4/main-0db82a.o \
|
||||||
/tmp/icpx-0a1da134b6/polypartiCL-c43ca4.o \
|
/tmp/icpx-6e0c7c75f4/polypartiCL-d70aea.o \
|
||||||
/tmp/icpx-0a1da134b6/polypartiCL-wrapper-5876b9.o \
|
/tmp/icpx-6e0c7c75f4/polypartiCL-wrapper-7bf44e.o \
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o \
|
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o \
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/15/crtendS.o \
|
/usr/lib/gcc/x86_64-linux-gnu/15/crtendS.o \
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a \
|
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a \
|
||||||
@@ -1074,6 +1074,8 @@ polypartiCL: /lib/x86_64-linux-gnu/Scrt1.o \
|
|||||||
|
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o:
|
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o:
|
||||||
|
|
||||||
|
/tmp/icpx-6e0c7c75f4/main-0db82a.o:
|
||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/lib/libsvml.so:
|
/opt/intel/oneapi/compiler/2026.0/lib/libsvml.so:
|
||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/lib/libimf.so:
|
/opt/intel/oneapi/compiler/2026.0/lib/libimf.so:
|
||||||
@@ -1208,8 +1210,6 @@ polypartiCL: /lib/x86_64-linux-gnu/Scrt1.o \
|
|||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/unified-runtime/ur_api_funcs.def:
|
/opt/intel/oneapi/compiler/2026.0/include/unified-runtime/ur_api_funcs.def:
|
||||||
|
|
||||||
/tmp/icpx-0a1da134b6/polypartiCL-wrapper-5876b9.o:
|
|
||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/version.hpp:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/version.hpp:
|
||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/usm/usm_allocator.hpp:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/usm/usm_allocator.hpp:
|
||||||
@@ -1258,8 +1258,6 @@ polypartiCL: /lib/x86_64-linux-gnu/Scrt1.o \
|
|||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/memory_enums.hpp:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/memory_enums.hpp:
|
||||||
|
|
||||||
/tmp/icpx-0a1da134b6/main-6e9924.o:
|
|
||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/marray.hpp:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/marray.hpp:
|
||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/known_identity.hpp:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/known_identity.hpp:
|
||||||
@@ -1282,6 +1280,8 @@ polypartiCL: /lib/x86_64-linux-gnu/Scrt1.o \
|
|||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/item.hpp:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/item.hpp:
|
||||||
|
|
||||||
|
/tmp/icpx-6e0c7c75f4/polypartiCL-d70aea.o:
|
||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/info/platform_traits.def:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/info/platform_traits.def:
|
||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/info/kernel_traits.def:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/info/kernel_traits.def:
|
||||||
@@ -1332,6 +1332,8 @@ polypartiCL: /lib/x86_64-linux-gnu/Scrt1.o \
|
|||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/detail/tuple.hpp:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/detail/tuple.hpp:
|
||||||
|
|
||||||
|
/tmp/icpx-6e0c7c75f4/polypartiCL-wrapper-7bf44e.o:
|
||||||
|
|
||||||
/usr/include/c++/15/bits/shared_ptr_base.h:
|
/usr/include/c++/15/bits/shared_ptr_base.h:
|
||||||
|
|
||||||
/usr/include/c++/15/bits/hashtable.h:
|
/usr/include/c++/15/bits/hashtable.h:
|
||||||
@@ -2106,8 +2108,6 @@ polypartiCL: /lib/x86_64-linux-gnu/Scrt1.o \
|
|||||||
|
|
||||||
/usr/include/c++/15/ext/type_traits.h:
|
/usr/include/c++/15/ext/type_traits.h:
|
||||||
|
|
||||||
/tmp/icpx-0a1da134b6/polypartiCL-c43ca4.o:
|
|
||||||
|
|
||||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/detail/builtins/relational_functions.inc:
|
/opt/intel/oneapi/compiler/2026.0/include/sycl/detail/builtins/relational_functions.inc:
|
||||||
|
|
||||||
/usr/include/c++/15/initializer_list:
|
/usr/include/c++/15/initializer_list:
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
s
|
s
|
||||||
20000 0.5 0.33333333333 0 360 cyan 1 2
|
20000 0.5 0.33333333333 0 360 cyan 0 2
|
||||||
20000 0.3555 0.783 0 360 magenta 1 2
|
20000 0.3555 0.783 0 360 magenta 0 2
|
||||||
20000 0.6445 0.783 0 360 yellow 1 2
|
20000 0.6445 0.783 0 360 yellow 0 2
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
uniform vec2 resolution;
|
||||||
|
uniform vec2 direction; // (1,0) for horizontal pass, (0,1) for vertical pass
|
||||||
|
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
//vec2 texel = direction / resolution;
|
||||||
|
|
||||||
|
// 9-tap Gaussian, weights from Pascal's-triangle-style approximation
|
||||||
|
//const float weight[5] = float[](
|
||||||
|
// 0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216
|
||||||
|
//);
|
||||||
|
|
||||||
|
//vec4 color = texture(texture0, fragTexCoord) * weight[0];
|
||||||
|
|
||||||
|
//for (int i = 1; i < 4; i++) {
|
||||||
|
// vec2 offset = texel * float(i);
|
||||||
|
// color += texture(texture0, fragTexCoord + offset) * weight[i];
|
||||||
|
// color += texture(texture0, fragTexCoord - offset) * weight[i];
|
||||||
|
//}
|
||||||
|
|
||||||
|
finalColor = texture(texture0, fragTexCoord);
|
||||||
|
}
|
||||||
+35
-37
@@ -51,6 +51,7 @@ int main(int argc, char* argv[]) {
|
|||||||
raylib::RenderTexture2D renderTarget(screenWidth, screenHeight);
|
raylib::RenderTexture2D renderTarget(screenWidth, screenHeight);
|
||||||
raylib::RenderTexture2D blur(screenWidth, screenHeight);
|
raylib::RenderTexture2D blur(screenWidth, screenHeight);
|
||||||
raylib::Shader blurShader("", "shaders/blur2.fs");
|
raylib::Shader blurShader("", "shaders/blur2.fs");
|
||||||
|
raylib::Shader noBlur("", "shaders/noblur.fs");
|
||||||
raylib::Shader rotShader("", "shaders/rotate.fs");
|
raylib::Shader rotShader("", "shaders/rotate.fs");
|
||||||
raylib::Vector2 mouse_i, mouse_f, mouse_d;
|
raylib::Vector2 mouse_i, mouse_f, mouse_d;
|
||||||
raylib::Vector2 midpoint(screenWidth * 0.5, screenHeight * 0.5);
|
raylib::Vector2 midpoint(screenWidth * 0.5, screenHeight * 0.5);
|
||||||
@@ -59,6 +60,7 @@ int main(int argc, char* argv[]) {
|
|||||||
int dirXY = blurShader.GetLocation("direction");
|
int dirXY = blurShader.GetLocation("direction");
|
||||||
float resolution[2] = { float(screenWidth), float(screenHeight)};
|
float resolution[2] = { float(screenWidth), float(screenHeight)};
|
||||||
blurShader.SetValue(resXY, resolution, RL_SHADER_UNIFORM_VEC2);
|
blurShader.SetValue(resXY, resolution, RL_SHADER_UNIFORM_VEC2);
|
||||||
|
noBlur.SetValue(resXY, resolution, RL_SHADER_UNIFORM_VEC2);
|
||||||
|
|
||||||
while(!window.ShouldClose()) {
|
while(!window.ShouldClose()) {
|
||||||
if (IsKeyPressed(KEY_R)) rotate = !rotate;
|
if (IsKeyPressed(KEY_R)) rotate = !rotate;
|
||||||
@@ -75,13 +77,12 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
for(const auto& item : sim.getCorners()) lines.push_back({item[0], item[1]});
|
for(const auto& item : sim.getCorners()) lines.push_back({item[0], item[1]});
|
||||||
|
|
||||||
if (useShader) {
|
//if (useShader) {
|
||||||
renderTarget.BeginMode();
|
renderTarget.BeginMode();
|
||||||
ClearBackground(BLACK);
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
if(drawLines) {
|
if(drawLines) {
|
||||||
for(int i = 0; i < (lines.size() - 1); i++)
|
for(int i = 0; i < (lines.size() - 1); i++) { lines[i].DrawLine(lines[i+1], WHITE); }
|
||||||
lines[i].DrawLine(lines[i+1], WHITE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < sim.getFieldCount(); i++) {
|
for (int i = 0; i < sim.getFieldCount(); i++) {
|
||||||
@@ -95,48 +96,45 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
rlEnd();
|
rlEnd();
|
||||||
}
|
}
|
||||||
renderTarget.EndMode();
|
renderTarget.EndMode();
|
||||||
|
|
||||||
float dirH[2] = {1.0f, 0.0f};
|
float dirH[2] = {1.0f, 0.0f};
|
||||||
float dirV[2] = {0.0f, 1.0f};
|
float dirV[2] = {0.0f, 1.0f};
|
||||||
|
|
||||||
blurShader.SetValue(dirXY, dirH, SHADER_UNIFORM_VEC2);
|
if (useShader) {
|
||||||
|
blurShader.SetValue(dirXY, dirH, SHADER_UNIFORM_VEC2);
|
||||||
|
|
||||||
blur.BeginMode();
|
blur.BeginMode();
|
||||||
ClearBackground(BLACK);
|
ClearBackground(BLACK);
|
||||||
blurShader.BeginMode();
|
blurShader.BeginMode();
|
||||||
DrawTextureRec(renderTarget.texture, {0, 0, resolution[0], -resolution[1]},
|
DrawTextureRec(renderTarget.texture, {0, 0, resolution[0], -resolution[1]},
|
||||||
{0, 0}, WHITE);
|
{0, 0}, WHITE);
|
||||||
blurShader.EndMode();
|
blurShader.EndMode();
|
||||||
blur.EndMode();
|
blur.EndMode();
|
||||||
|
|
||||||
blurShader.SetValue(dirXY, dirV, SHADER_UNIFORM_VEC2);
|
blurShader.SetValue(dirXY, dirV, SHADER_UNIFORM_VEC2);
|
||||||
}
|
} /*else {
|
||||||
|
noBlur.SetValue(dirXY, dirH, SHADER_UNIFORM_VEC2);
|
||||||
|
|
||||||
|
blur.BeginMode();
|
||||||
|
ClearBackground(BLACK);
|
||||||
|
noBlur.BeginMode();
|
||||||
|
DrawTextureRec(renderTarget.texture, {0, 0, resolution[0], -resolution[1]}, {0,0}, WHITE);
|
||||||
|
noBlur.EndMode();
|
||||||
|
blur.EndMode();
|
||||||
|
|
||||||
|
}*/
|
||||||
while(window.Drawing()) {
|
while(window.Drawing()) {
|
||||||
window.ClearBackground(BLACK);
|
window.ClearBackground(BLACK);
|
||||||
|
|
||||||
if (useShader) {
|
if (useShader) {
|
||||||
blurShader.BeginMode();
|
blurShader.BeginMode();
|
||||||
DrawTextureRec(blur.texture, {0, 0, resolution[0], -resolution[1]}, {0,0}, WHITE);
|
DrawTextureRec(blur.texture, {0, 0, resolution[0], -resolution[1]}, {0,0}, WHITE);
|
||||||
blurShader.EndMode();
|
blurShader.EndMode();
|
||||||
} else {
|
} else {
|
||||||
if (drawLines) {
|
noBlur.BeginMode();
|
||||||
for (int i = 0; i < (int)lines.size() - 1; i++) {
|
DrawTextureRec(renderTarget.texture, {0, 0, resolution[0], -resolution[1]}, {0,0}, WHITE);
|
||||||
lines[i].DrawLine(lines[i+1], WHITE);
|
noBlur.EndMode();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < sim.getFieldCount(); i++) {
|
|
||||||
auto& field = sim.getField(i);
|
|
||||||
int *color = field.getColor();
|
|
||||||
rlBegin(RL_LINES);
|
|
||||||
rlColor4ub(color[0], color[1], color[2], color[3]);
|
|
||||||
for (const auto& p : field.getPositions()) {
|
|
||||||
rlVertex2f(p[0],p[1]);
|
|
||||||
rlVertex2f(p[0]+1.0f,p[1]+1.0f);
|
|
||||||
}
|
|
||||||
rlEnd();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(drawFPS) window.DrawFPS(10,10);
|
if(drawFPS) window.DrawFPS(10,10);
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-10
@@ -12,8 +12,8 @@ using namespace sycl;
|
|||||||
|
|
||||||
struct Polyparti::ParticleField::ColCode {
|
struct Polyparti::ParticleField::ColCode {
|
||||||
std::vector<XYVector> positions, velocities;
|
std::vector<XYVector> positions, velocities;
|
||||||
float t, fieldTime = 0, lifeTime = 0;
|
float t, lifeTime = 0, startTime = 0;
|
||||||
int count, decay = 0;
|
int count, decay = 0, originCounter = 0;
|
||||||
int color[4];
|
int color[4];
|
||||||
//float decay = 1.0f;
|
//float decay = 1.0f;
|
||||||
bool dies = false, dead = false;
|
bool dies = false, dead = false;
|
||||||
@@ -225,18 +225,25 @@ void Polyparti::ParticleField::deleteParticle(int index) {
|
|||||||
colcode->count--;
|
colcode->count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Polyparti::ParticleField::updateField(std::vector<XYVector> verticies) {
|
void Polyparti::ParticleField::updateField(std::vector<XYVector> verticies, double time) {
|
||||||
colcode->checkCollisions(verticies);
|
if(colcode->t > 0) {
|
||||||
colcode->moveParticles();
|
++colcode->originCounter;
|
||||||
colcode->fieldTime += colcode->t;
|
} else if (colcode->t < 0) {
|
||||||
|
--colcode->originCounter;
|
||||||
|
}
|
||||||
if (colcode->dies) {
|
if (colcode->dies) {
|
||||||
if (colcode->fieldTime >= colcode->lifeTime) {
|
if (time >= colcode->lifeTime) {
|
||||||
colcode->color[3] -= colcode->decay;
|
colcode->color[3] -= colcode->decay;
|
||||||
}
|
}
|
||||||
if (colcode->color[3] <= 0) {
|
if (colcode->color[3] <= 0) {
|
||||||
colcode->dead = true;
|
colcode->dead = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(colcode->originCounter >= 0) {
|
||||||
|
colcode->checkCollisions(verticies);
|
||||||
|
colcode->moveParticles();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<XYVector>& Polyparti::ParticleField::getPositions() const {
|
const std::vector<XYVector>& Polyparti::ParticleField::getPositions() const {
|
||||||
@@ -413,7 +420,7 @@ void Polyparti::Room::loadParticles(std::string name) {
|
|||||||
bool relativeScreen = false;
|
bool relativeScreen = false;
|
||||||
bool relativeRoom = false;
|
bool relativeRoom = false;
|
||||||
int count;
|
int count;
|
||||||
float x, y, deg_start, deg_end, life, decay;
|
float x, y, deg_start, deg_end, start, life, decay;
|
||||||
std::string color;
|
std::string color;
|
||||||
|
|
||||||
char check = partfile.get();
|
char check = partfile.get();
|
||||||
@@ -421,7 +428,8 @@ void Polyparti::Room::loadParticles(std::string name) {
|
|||||||
else if (check == 'r') { relativeRoom = true; }
|
else if (check == 'r') { relativeRoom = true; }
|
||||||
|
|
||||||
if (partfile.is_open()) {
|
if (partfile.is_open()) {
|
||||||
while (partfile >> count >> x >> y >> deg_start >> deg_end >> color >> life >> decay) {
|
while (partfile >> count >> x >> y >> deg_start >> deg_end >> color >> start
|
||||||
|
>> life >> decay) {
|
||||||
if (relativeScreen) {
|
if (relativeScreen) {
|
||||||
x *= screenWidth;
|
x *= screenWidth;
|
||||||
y *= screenHeight;
|
y *= screenHeight;
|
||||||
@@ -435,6 +443,7 @@ void Polyparti::Room::loadParticles(std::string name) {
|
|||||||
newEntry.deg_start = deg_start;
|
newEntry.deg_start = deg_start;
|
||||||
newEntry.deg_end = deg_end;
|
newEntry.deg_end = deg_end;
|
||||||
newEntry.color = color;
|
newEntry.color = color;
|
||||||
|
newEntry.start = start;
|
||||||
newEntry.life = life;
|
newEntry.life = life;
|
||||||
newEntry.decayRate = decay;
|
newEntry.decayRate = decay;
|
||||||
|
|
||||||
@@ -486,7 +495,7 @@ void Polyparti::Room::addFields() { for (auto& i: info) initField(i);}
|
|||||||
|
|
||||||
void Polyparti::Room::updateFields(double time) {
|
void Polyparti::Room::updateFields(double time) {
|
||||||
for (auto& f : field) {
|
for (auto& f : field) {
|
||||||
f.updateField(implRoom->corners);
|
f.updateField(implRoom->corners, time);
|
||||||
}
|
}
|
||||||
field.erase(std::remove_if(field.begin(), field.end(), [](auto& f) { return f.isDead();}), field.end());
|
field.erase(std::remove_if(field.begin(), field.end(), [](auto& f) { return f.isDead();}), field.end());
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -24,7 +24,7 @@ namespace Polyparti {
|
|||||||
|
|
||||||
void addParticle(float x, float y, float vx, float vy);
|
void addParticle(float x, float y, float vx, float vy);
|
||||||
void deleteParticle(int index);
|
void deleteParticle(int index);
|
||||||
void updateField(std::vector<XYVector> verticies);
|
void updateField(std::vector<XYVector> verticies, double time);
|
||||||
const std::vector<XYVector>& getPositions() const;
|
const std::vector<XYVector>& getPositions() const;
|
||||||
int getSize();
|
int getSize();
|
||||||
void setColor(std::string newColor);
|
void setColor(std::string newColor);
|
||||||
@@ -46,7 +46,7 @@ namespace Polyparti {
|
|||||||
std::unique_ptr<ImplRoom> implRoom;
|
std::unique_ptr<ImplRoom> implRoom;
|
||||||
struct fieldInfo {
|
struct fieldInfo {
|
||||||
int count;
|
int count;
|
||||||
float x, y, deg_start, deg_end, life, decayRate;
|
float x, y, deg_start, deg_end, start, life, decayRate;
|
||||||
int screenWidth, screenHeight;
|
int screenWidth, screenHeight;
|
||||||
std::string color;
|
std::string color;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user