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/libsvml.so
|
||||
/opt/intel/oneapi/compiler/2026.0/lib/libur_loader.so.0
|
||||
/tmp/icpx-0a1da134b6/main-6e9924.o
|
||||
/tmp/icpx-0a1da134b6/polypartiCL-c43ca4.o
|
||||
/tmp/icpx-0a1da134b6/polypartiCL-wrapper-5876b9.o
|
||||
/tmp/icpx-6e0c7c75f4/main-0db82a.o
|
||||
/tmp/icpx-6e0c7c75f4/polypartiCL-d70aea.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/crtendS.o
|
||||
/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/libsvml.so \
|
||||
/opt/intel/oneapi/compiler/2026.0/lib/libur_loader.so.0 \
|
||||
/tmp/icpx-0a1da134b6/main-6e9924.o \
|
||||
/tmp/icpx-0a1da134b6/polypartiCL-c43ca4.o \
|
||||
/tmp/icpx-0a1da134b6/polypartiCL-wrapper-5876b9.o \
|
||||
/tmp/icpx-6e0c7c75f4/main-0db82a.o \
|
||||
/tmp/icpx-6e0c7c75f4/polypartiCL-d70aea.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/crtendS.o \
|
||||
/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:
|
||||
|
||||
/tmp/icpx-6e0c7c75f4/main-0db82a.o:
|
||||
|
||||
/opt/intel/oneapi/compiler/2026.0/lib/libsvml.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:
|
||||
|
||||
/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/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:
|
||||
|
||||
/tmp/icpx-0a1da134b6/main-6e9924.o:
|
||||
|
||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/marray.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:
|
||||
|
||||
/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/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:
|
||||
|
||||
/tmp/icpx-6e0c7c75f4/polypartiCL-wrapper-7bf44e.o:
|
||||
|
||||
/usr/include/c++/15/bits/shared_ptr_base.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:
|
||||
|
||||
/tmp/icpx-0a1da134b6/polypartiCL-c43ca4.o:
|
||||
|
||||
/opt/intel/oneapi/compiler/2026.0/include/sycl/detail/builtins/relational_functions.inc:
|
||||
|
||||
/usr/include/c++/15/initializer_list:
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
s
|
||||
20000 0.5 0.33333333333 0 360 cyan 1 2
|
||||
20000 0.3555 0.783 0 360 magenta 1 2
|
||||
20000 0.6445 0.783 0 360 yellow 1 2
|
||||
20000 0.5 0.33333333333 0 360 cyan 0 2
|
||||
20000 0.3555 0.783 0 360 magenta 0 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);
|
||||
}
|
||||
+19
-21
@@ -51,6 +51,7 @@ int main(int argc, char* argv[]) {
|
||||
raylib::RenderTexture2D renderTarget(screenWidth, screenHeight);
|
||||
raylib::RenderTexture2D blur(screenWidth, screenHeight);
|
||||
raylib::Shader blurShader("", "shaders/blur2.fs");
|
||||
raylib::Shader noBlur("", "shaders/noblur.fs");
|
||||
raylib::Shader rotShader("", "shaders/rotate.fs");
|
||||
raylib::Vector2 mouse_i, mouse_f, mouse_d;
|
||||
raylib::Vector2 midpoint(screenWidth * 0.5, screenHeight * 0.5);
|
||||
@@ -59,6 +60,7 @@ int main(int argc, char* argv[]) {
|
||||
int dirXY = blurShader.GetLocation("direction");
|
||||
float resolution[2] = { float(screenWidth), float(screenHeight)};
|
||||
blurShader.SetValue(resXY, resolution, RL_SHADER_UNIFORM_VEC2);
|
||||
noBlur.SetValue(resXY, resolution, RL_SHADER_UNIFORM_VEC2);
|
||||
|
||||
while(!window.ShouldClose()) {
|
||||
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]});
|
||||
|
||||
if (useShader) {
|
||||
//if (useShader) {
|
||||
renderTarget.BeginMode();
|
||||
ClearBackground(BLACK);
|
||||
|
||||
if(drawLines) {
|
||||
for(int i = 0; i < (lines.size() - 1); i++)
|
||||
lines[i].DrawLine(lines[i+1], WHITE);
|
||||
for(int i = 0; i < (lines.size() - 1); i++) { lines[i].DrawLine(lines[i+1], WHITE); }
|
||||
}
|
||||
|
||||
for (int i = 0; i < sim.getFieldCount(); i++) {
|
||||
@@ -100,6 +101,7 @@ int main(int argc, char* argv[]) {
|
||||
float dirH[2] = {1.0f, 0.0f};
|
||||
float dirV[2] = {0.0f, 1.0f};
|
||||
|
||||
if (useShader) {
|
||||
blurShader.SetValue(dirXY, dirH, SHADER_UNIFORM_VEC2);
|
||||
|
||||
blur.BeginMode();
|
||||
@@ -111,7 +113,17 @@ int main(int argc, char* argv[]) {
|
||||
blur.EndMode();
|
||||
|
||||
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()) {
|
||||
window.ClearBackground(BLACK);
|
||||
|
||||
@@ -120,23 +132,9 @@ int main(int argc, char* argv[]) {
|
||||
DrawTextureRec(blur.texture, {0, 0, resolution[0], -resolution[1]}, {0,0}, WHITE);
|
||||
blurShader.EndMode();
|
||||
} else {
|
||||
if (drawLines) {
|
||||
for (int i = 0; i < (int)lines.size() - 1; i++) {
|
||||
lines[i].DrawLine(lines[i+1], WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
noBlur.BeginMode();
|
||||
DrawTextureRec(renderTarget.texture, {0, 0, resolution[0], -resolution[1]}, {0,0}, WHITE);
|
||||
noBlur.EndMode();
|
||||
}
|
||||
if(drawFPS) window.DrawFPS(10,10);
|
||||
}
|
||||
|
||||
+19
-10
@@ -12,8 +12,8 @@ using namespace sycl;
|
||||
|
||||
struct Polyparti::ParticleField::ColCode {
|
||||
std::vector<XYVector> positions, velocities;
|
||||
float t, fieldTime = 0, lifeTime = 0;
|
||||
int count, decay = 0;
|
||||
float t, lifeTime = 0, startTime = 0;
|
||||
int count, decay = 0, originCounter = 0;
|
||||
int color[4];
|
||||
//float decay = 1.0f;
|
||||
bool dies = false, dead = false;
|
||||
@@ -225,18 +225,25 @@ void Polyparti::ParticleField::deleteParticle(int index) {
|
||||
colcode->count--;
|
||||
}
|
||||
|
||||
void Polyparti::ParticleField::updateField(std::vector<XYVector> verticies) {
|
||||
colcode->checkCollisions(verticies);
|
||||
colcode->moveParticles();
|
||||
colcode->fieldTime += colcode->t;
|
||||
void Polyparti::ParticleField::updateField(std::vector<XYVector> verticies, double time) {
|
||||
if(colcode->t > 0) {
|
||||
++colcode->originCounter;
|
||||
} else if (colcode->t < 0) {
|
||||
--colcode->originCounter;
|
||||
}
|
||||
if (colcode->dies) {
|
||||
if (colcode->fieldTime >= colcode->lifeTime) {
|
||||
if (time >= colcode->lifeTime) {
|
||||
colcode->color[3] -= colcode->decay;
|
||||
}
|
||||
if (colcode->color[3] <= 0) {
|
||||
colcode->dead = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(colcode->originCounter >= 0) {
|
||||
colcode->checkCollisions(verticies);
|
||||
colcode->moveParticles();
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<XYVector>& Polyparti::ParticleField::getPositions() const {
|
||||
@@ -413,7 +420,7 @@ void Polyparti::Room::loadParticles(std::string name) {
|
||||
bool relativeScreen = false;
|
||||
bool relativeRoom = false;
|
||||
int count;
|
||||
float x, y, deg_start, deg_end, life, decay;
|
||||
float x, y, deg_start, deg_end, start, life, decay;
|
||||
std::string color;
|
||||
|
||||
char check = partfile.get();
|
||||
@@ -421,7 +428,8 @@ void Polyparti::Room::loadParticles(std::string name) {
|
||||
else if (check == 'r') { relativeRoom = true; }
|
||||
|
||||
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) {
|
||||
x *= screenWidth;
|
||||
y *= screenHeight;
|
||||
@@ -435,6 +443,7 @@ void Polyparti::Room::loadParticles(std::string name) {
|
||||
newEntry.deg_start = deg_start;
|
||||
newEntry.deg_end = deg_end;
|
||||
newEntry.color = color;
|
||||
newEntry.start = start;
|
||||
newEntry.life = life;
|
||||
newEntry.decayRate = decay;
|
||||
|
||||
@@ -486,7 +495,7 @@ void Polyparti::Room::addFields() { for (auto& i: info) initField(i);}
|
||||
|
||||
void Polyparti::Room::updateFields(double time) {
|
||||
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());
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ namespace Polyparti {
|
||||
|
||||
void addParticle(float x, float y, float vx, float vy);
|
||||
void deleteParticle(int index);
|
||||
void updateField(std::vector<XYVector> verticies);
|
||||
void updateField(std::vector<XYVector> verticies, double time);
|
||||
const std::vector<XYVector>& getPositions() const;
|
||||
int getSize();
|
||||
void setColor(std::string newColor);
|
||||
@@ -46,7 +46,7 @@ namespace Polyparti {
|
||||
std::unique_ptr<ImplRoom> implRoom;
|
||||
struct fieldInfo {
|
||||
int count;
|
||||
float x, y, deg_start, deg_end, life, decayRate;
|
||||
float x, y, deg_start, deg_end, start, life, decayRate;
|
||||
int screenWidth, screenHeight;
|
||||
std::string color;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user