Comments (12)
Great job looking forward to it 👍 👍 💯
from particle-life.
It is not working for me
from particle-life.
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.
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.
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.
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.
Here is my last version of the code.
Manuel_src.zip
from particle-life.
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.
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.
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.
I'll check the fullscreen problem as well.
from particle-life.
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 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
from particle-life.
Related Issues (20)
- [Feature request] Distance-based force HOT 8
- Option to import/export different models HOT 2
- [Feature request] Spawn or destroy pixels based off rules HOT 1
- Particle Weights HOT 3
- Lua port HOT 4
- I've seen your video and I had to try myself :) HOT 1
- webgl version HOT 1
- [Feature request] Apply physics interaction
- Question: is this based on rule-set ? HOT 3
- another Go port HOT 1
- release binary version doesn't seems to use openMP HOT 1
- Mac M1 binary release HOT 1
- A random idea HOT 11
- migrating to openGL 4.3 and other various breaking change HOT 5
- QB64-PE port HOT 1
- [Feature Request] A) Import/Export Weights/Params - and B) Time-dependent functions as a parameter HOT 3
- Superfluid HOT 10
- Simultaneous attractive and repulsive forces in the same particle HOT 23
- WTF HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from particle-life.