Giter VIP home page Giter VIP logo

Comments (12)

hunar4321 avatar hunar4321 commented on May 19, 2024

Great job looking forward to it 👍 👍 💯

from particle-life.

KhadrasWellun avatar KhadrasWellun commented on May 19, 2024

It is not working for me

from particle-life.

ker2x avatar ker2x commented on May 19, 2024

It is not working for me

yes. I'll try to make something mergeable with the main project, and independent of oneAPI.

from particle-life.

ker2x avatar ker2x commented on May 19, 2024

it took me a while. the code is unfortunately much slower on MSVC than on intel compiler. But still faster than the previous version of course.

i also removed the dependency to intel TBB so no 200FPS (it can still be seen in commented code however)

from particle-life.

KhadrasWellun avatar KhadrasWellun commented on May 19, 2024

Hi! I want to set different particle sizes depending on their type. For example, red should be 1.0 pixels, green 1.2 pixels, blue 1.4 pixels, and so on. I saw in the code that a size is defined for all particles in ofApp.h. How could I condition this particle size with an "if"?
I'm referring to this piece of code:
void draw() const
{
ofSetColor(r, g, b, 100); //set particle color + some alpha
ofDrawCircle(x, y, 1.5F); //draws a point at x,y coordinates, the size of a 1.5 pixel circle
}
My colors are defined by generic names:
void ofApp::restart()
{
if (numberSliderα > 0) { alpha = CreatePoints(numberSliderα, 0, 0, ofRandom(64, 255)); }
if (numberSliderβ > 0) { betha = CreatePoints(numberSliderβ, 0, ofRandom(64, 255), 0); }
if (numberSliderγ > 0) { gamma = CreatePoints(numberSliderγ, ofRandom(64, 255), 0, 0); }
if (numberSliderδ > 0) { elta = CreatePoints(numberSliderδ, ofRandom(64, 255), ofRandom(64, 255), 0); }
if (numberSliderε > 0) { epsilon = CreatePoints(numberSliderε, ofRandom(64, 255), 0, ofRandom(64, 255)); }
if (numberSliderζ > 0) { zeta = CreatePoints(numberSliderζ, 0, ofRandom(64, 255), ofRandom(64, 255)); }
if (numberSliderη > 0) { eta = CreatePoints(numberSliderη, ofRandom(64, 255), ofRandom(64, 255), ofRandom(64, 255)); }
if (numberSliderθ > 0) { teta = CreatePoints(numberSliderθ, 0, 0, 0); }
}

I would like to define something like:
void draw() const
{
ofSetColor(r, g, b, 100); //set particle color + some alpha
if (numberSliderα > 0)
{
ofDrawCircle(x, y, 1.0F); //draw a point at x,y coordinates, the size of a 1.0 pixels
}
if (numberSliderβ > 0)
{
ofDrawCircle(x, y, 1.2F); //draw a point at x,y coordinates, the size of a 1.2 pixels
}
if (numberSliderγ > 0)
{
ofDrawCircle(x, y, 1.4F); //draw a point at x,y coordinates, the size of a 1.4 pixels
}
if (numberSliderδ > 0)
{
ofDrawCircle(x, y, 1.6F); //draw a point at x,y coordinates, the size of a 1.6 pixels
}
if (numberSliderε > 0)
{
ofDrawCircle(x, y, 1.8F); //draw a point at x,y coordinates, the size of a 1.8 pixels
}
if (numberSliderζ > 0)
{
ofDrawCircle(x, y, 2.0F); //draw a point at x,y coordinates, the size of a 2.0 pixels
}
if (numberSliderη > 0)
{
ofDrawCircle(x, y, 2.2F); //draw a point at x,y coordinates, the size of a 2.2 pixels
}
if (numberSliderθ > 0)
{
ofDrawCircle(x, y, 2.4F); //draw a point at x,y coordinates, the size of a 2.4 pixels
}
But Visual Studio gives me errors because these sliders are not defined here (they are defined in the GUI, class ofApp final : public ofBaseApp).
Please help me!

from particle-life.

ker2x avatar ker2x commented on May 19, 2024

i assume your are referring to old codebase. Can you post a link to your code ?

the easiest way to do this would be to add a radius property to the point struct. and then you would just ofDrawCircle(x, y, radius)

from particle-life.

KhadrasWellun avatar KhadrasWellun commented on May 19, 2024

Here is my last version of the code.
Manuel_src.zip

from particle-life.

KhadrasWellun avatar KhadrasWellun commented on May 19, 2024

i assume your are referring to old codebase. Can you post a link to your code ?

the easiest way to do this would be to add a radius property to the point struct. and then you would just ofDrawCircle(x, y, radius)

I tried the new code, but it works extremely hard. I couldn't get more than 8 fps at 8 colors of 1000 particles each. Then, another shortcoming of the new code is that the particles look extremely small, like little dots where you can't really distinguish the color shades. The structures formed don't look good at all because of this.

from particle-life.

KhadrasWellun avatar KhadrasWellun commented on May 19, 2024

I also tried to insert a fullscreen button but it didn't work. I used ofToggleFullscreen(), but the screen kept blinking without showing anything.
I'm also trying to figure out how to introduce the 3D vision function (with 3D glasses).
Also, I don't know how to save the color palette generated before saving the model. The particle colors are generated when pressing the buttons that trigger the restart. But when I save the model, the existing colour palette is not saved so that I can load it later. Do you have any idea how I could save this color palette?

from particle-life.

ker2x avatar ker2x commented on May 19, 2024

I'll take a look at your code, and also patch my code to allow drawing circle.
my code shouldn't be slower. this is weird. are you using openmp in your code ? I might have forgot to reenable it.

from particle-life.

ker2x avatar ker2x commented on May 19, 2024

I'll check the fullscreen problem as well.

from particle-life.

KhadrasWellun avatar KhadrasWellun commented on May 19, 2024

I'll take a look at your code, and also patch my code to allow drawing circle. my code shouldn't be slower. this is weird. are you using openmp in your code ? I might have forgot to reenable it.

I took your exact code and just added more colors and those extra buttons. And after compiling, the code worked extremely hard. I had to set a small number of particles (under 1000 of each color) to go at 10 fps.

Here is your code with my additions in it in old way, that works fine with 17313 big particles at 61 fps:
src 1.7.6.5.zip

Here is a proof screenshot:
202301060731

Here is your code with my additions in it but in new way, that works slow and particles are very very small (near dots) with 9600 particles at 4 fps:
src 1.8.5.zip

Here is a proof screenshot:
202301060705

from particle-life.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.