Dev #1
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,4 +1,4 @@
|
||||
s
|
||||
20000 0.5 0.33333333333 0 360 cyan
|
||||
20000 0.3555 0.783 0 360 magenta
|
||||
20000 0.6445 0.783 0 360 yellow
|
||||
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
|
||||
|
||||
+8
-15
@@ -28,12 +28,14 @@ int main(int argc, char* argv[]) {
|
||||
if (argv[i] == "--rotate"s || argv[i] == "-r"s) {
|
||||
rotate = true;
|
||||
}
|
||||
if (argv[i] == "--nolines"s || argv[i] == "-l"s) {
|
||||
drawLines = false;
|
||||
}
|
||||
}
|
||||
|
||||
Polyparti::Room sim(screenWidth, screenHeight, fps);
|
||||
|
||||
vector<raylib::Vector2> lines;
|
||||
cout << "ok-1" << endl;
|
||||
|
||||
sim.loadRoom(roomName);
|
||||
sim.loadParticles(partName);
|
||||
@@ -66,19 +68,8 @@ int main(int argc, char* argv[]) {
|
||||
if (IsKeyPressed(KEY_B)) useShader = !useShader;
|
||||
if (IsKeyPressed(KEY_SPACE)) paused = !paused;
|
||||
if (IsKeyPressed(KEY_T)) sim.reverseInterval();
|
||||
//if (IsKeyPressed(KEY_UP)) sim.adjustInterval(d_interval_pct);
|
||||
//if (IsKeyPressed(KEY_DOWN)) sim.adjustInterval(-d_interval_pct);
|
||||
/*if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
|
||||
mouse_f = GetMousePosition();
|
||||
mouse_f -= midpoint;
|
||||
mouse_d = GetMouseDelta();
|
||||
mouse_i = mouse_f - mouse_d;
|
||||
angle = mouse_f.DotProduct(mouse_i);
|
||||
angle = angle / mouse_f.Length() * mouse_i.Length();
|
||||
angle = acos(angle);
|
||||
}*/
|
||||
if (!paused) {
|
||||
sim.updateFields();
|
||||
sim.updateFields(window.GetTime());
|
||||
if (rotate) sim.rotateRoom(angle);
|
||||
lines.clear();
|
||||
}
|
||||
@@ -129,8 +120,10 @@ int main(int argc, char* argv[]) {
|
||||
DrawTextureRec(blur.texture, {0, 0, resolution[0], -resolution[1]}, {0,0}, WHITE);
|
||||
blurShader.EndMode();
|
||||
} else {
|
||||
for (int i = 0; i < (int)lines.size() - 1; i++) {
|
||||
lines[i].DrawLine(lines[i+1], WHITE);
|
||||
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++) {
|
||||
|
||||
+8
-8
@@ -12,7 +12,7 @@ using namespace sycl;
|
||||
|
||||
struct Polyparti::ParticleField::ColCode {
|
||||
std::vector<XYVector> positions, velocities;
|
||||
float t, fieldTime, lifeTime;
|
||||
float t, fieldTime = 0, lifeTime = 0;
|
||||
int count, decay = 0;
|
||||
int color[4];
|
||||
//float decay = 1.0f;
|
||||
@@ -230,7 +230,7 @@ void Polyparti::ParticleField::updateField(std::vector<XYVector> verticies) {
|
||||
colcode->moveParticles();
|
||||
colcode->fieldTime += colcode->t;
|
||||
if (colcode->dies) {
|
||||
if (colcode->lifeTime >= colcode->fieldTime) {
|
||||
if (colcode->fieldTime >= colcode->lifeTime) {
|
||||
colcode->color[3] -= colcode->decay;
|
||||
}
|
||||
if (colcode->color[3] <= 0) {
|
||||
@@ -311,8 +311,8 @@ void Polyparti::ParticleField::setInterval(const float interval) {
|
||||
void Polyparti::ParticleField::setDecay(const float t, const float d) {
|
||||
if (t != 0) {
|
||||
colcode->dies = true;
|
||||
colcode->lifeTime = fabs(t);
|
||||
colcode->decay = static_cast<int>(fabs(d) * 255);
|
||||
colcode->lifeTime = t;
|
||||
colcode->decay = static_cast<int>(fabs(d));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ 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) {
|
||||
while (partfile >> count >> x >> y >> deg_start >> deg_end >> color >> life >> decay) {
|
||||
if (relativeScreen) {
|
||||
x *= screenWidth;
|
||||
y *= screenHeight;
|
||||
@@ -435,8 +435,8 @@ void Polyparti::Room::loadParticles(std::string name) {
|
||||
newEntry.deg_start = deg_start;
|
||||
newEntry.deg_end = deg_end;
|
||||
newEntry.color = color;
|
||||
//newEntry.life = life;
|
||||
//newEntry.decayRate = decay;
|
||||
newEntry.life = life;
|
||||
newEntry.decayRate = decay;
|
||||
|
||||
this->info.push_back(newEntry);
|
||||
}
|
||||
@@ -484,7 +484,7 @@ void Polyparti::Room::rotateRoom(float degrees) {
|
||||
|
||||
void Polyparti::Room::addFields() { for (auto& i: info) initField(i);}
|
||||
|
||||
void Polyparti::Room::updateFields() {
|
||||
void Polyparti::Room::updateFields(double time) {
|
||||
for (auto& f : field) {
|
||||
f.updateField(implRoom->corners);
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ namespace Polyparti {
|
||||
void rotateRoom(float degrees);
|
||||
void initField(fieldInfo info);
|
||||
void addFields();
|
||||
void updateFields();
|
||||
void updateFields(double time);
|
||||
ParticleField& getField(int index);
|
||||
void adjustInterval(const float pct);
|
||||
void reverseInterval();
|
||||
|
||||
Reference in New Issue
Block a user