void CloudsVisualSystemPaintBrush::selfUpdate()
{
    
    for (map<int, Brush *>::iterator it = brushes.begin(); it != brushes.end(); it++) {
        Brush * brush = it->second;
        brush->update();
        
        if (brush->getVel().length() < particlesThreshold) {
            ofFloatColor color;
            
            if (bUseColorMap) {
                color = colorMap->getColor(mapX, mapY);
                if (bMapForward) {
                    ++mapX;
                    if (mapX >= colorMap->getWidth()) {
                        ++mapY;
                        if (mapY >= colorMap->getHeight()) {
                            // back to start
                            mapX = 0;
                            mapY = 0;
                            bMapForward = true;
                        }
                        else {
                            // next line, going backwards
                            mapX = colorMap->getWidth() - 1;
                            bMapForward = false;
                        }
                    }
                }
                else {
                    --mapX;
                    if (mapX < 0) {
                        ++mapY;
                        if (mapY >= colorMap->getHeight()) {
                            // back to start
                            mapX = 0;
                            mapY = 0;
                            bMapForward = true;
                        }
                        else {
                            // next line, going forward
                            mapX = 0;
                            bMapForward = true;
                        }
                    }
                }
            }
            else {
                color.set(1, 0, 0);
                color.setHue(colorHue);
            }

            brush->setColor(color, colorLerp, colorRandom);
        }
        
        if (brush->bDown) {
            brush->addParticles(particles, particlesThreshold, particlesAlpha);
        }
    }
    
	drawPaint();
	
	//cout << "Mouse pressed?" << GetCloudsInputPressed() << endl;
	
	//	ofPopStyle()
}