summaryrefslogtreecommitdiff
path: root/lasertext/src
diff options
context:
space:
mode:
Diffstat (limited to 'lasertext/src')
-rw-r--r--lasertext/src/ofApp.cpp85
-rw-r--r--lasertext/src/ofApp.h53
-rw-r--r--lasertext/src/vectortext.h13
3 files changed, 113 insertions, 38 deletions
diff --git a/lasertext/src/ofApp.cpp b/lasertext/src/ofApp.cpp
index 391aa37..e58e361 100644
--- a/lasertext/src/ofApp.cpp
+++ b/lasertext/src/ofApp.cpp
@@ -22,20 +22,15 @@ void ofApp::setup(){
ofLogNotice()<<"found "<<fonts.size()<<" fonts";
currentFont=0;
- banner.loadFont("fonts/EMSDecorousScript.svg"); // EMSPepita.svg"); //fonts.getPath(currentFont));
+ // EMSPepita.svg"); //fonts.getPath(currentFont));
+ //banner.loadFont("fonts/EMSDecorousScript.svg"); //2022
+ banner.loadFont("fonts/EMSQwandry.svg"); //2023
//banner.init("Everything Is Going To Be Alright");
banner.init("No Pleasure is Too Guilty");
-/*
- stars.allocate(1);
-
- for (int i=0;i<stars.size();i++){
- stars.init("stars "+ofToString(i+1),5,450);
- }
-
- */
- stars.init("stars "+ofToString(1),990,10);
+ stars1.init("stars 1",990,10);
+ stars2.init("stars 2",990,205);
textgui.setup("text","",5,650);
textgui.add(laser_scale.set("scale", 1.0f, 0.5f, 3.0f));
@@ -62,6 +57,8 @@ void ofApp::setup(){
cout << "unable to load settings.xml"<<std::endl;
}
+ //default_settings();
+
warpframe[0]=glm::vec2(
XML.getValue("WARP:p0:X", 0),
XML.getValue("WARP:p0:Y", 0)
@@ -89,12 +86,19 @@ void ofApp::setup(){
laser_blank_num=XML.getValue("laser:blankpoints",8);
laser_max_angle=XML.getValue("laser:maxangle",15.0f);
- stars.x=XML.getValue("stars:X",0.0f);
- stars.y=XML.getValue("stars:Y",0.0f);
- stars.rate=XML.getValue("stars:rate",1.0f);
- stars.radius=XML.getValue("stars:radius",100.0f);
- stars.speed=XML.getValue("stars:speed",5.0f);
- stars.lifespan=XML.getValue("stars:life",4.0f);
+ stars1.x=XML.getValue("stars1:X",0.0f);
+ stars1.y=XML.getValue("stars1:Y",0.0f);
+ stars1.rate=XML.getValue("stars1:rate",1.0f);
+ stars1.radius=XML.getValue("stars1:radius",100.0f);
+ stars1.speed=XML.getValue("stars1:speed",5.0f);
+ stars1.lifespan=XML.getValue("stars1:life",4.0f);
+
+ stars2.x=XML.getValue("stars2:X",0.0f);
+ stars2.y=XML.getValue("stars2:Y",0.0f);
+ stars2.rate=XML.getValue("stars2:rate",1.0f);
+ stars2.radius=XML.getValue("stars2:radius",100.0f);
+ stars2.speed=XML.getValue("stars2:speed",5.0f);
+ stars2.lifespan=XML.getValue("stars2:life",4.0f);
//stars.init(ofVec2f(2000.0f,2000.0f),100.0f,1.0,5.0,4.0,1.0);
@@ -108,7 +112,7 @@ void ofApp::default_settings(){
warpframe[2]=glm::vec2(outputWindowSize.x,outputWindowSize.y);
warpframe[3]=glm::vec2(0,outputWindowSize.y);
outputPosition=ofPoint(0,0);
- outputScale=1.0f;
+ outputScale=2.0f;
}
void ofApp::save_settings(){
@@ -132,12 +136,23 @@ void ofApp::save_settings(){
XML.setValue("laser:blankpoints",laser_blank_num);
XML.setValue("laser:maxangle",laser_max_angle);
- XML.setValue("stars:X",stars.x);
- XML.setValue("stars:Y",stars.y);
- XML.setValue("stars:rate",stars.rate);
- XML.setValue("stars:radius",stars.radius);
- XML.setValue("stars:speed",stars.speed);
- XML.setValue("stars:life",stars.lifespan);
+ XML.setValue("stars1:X",stars1.x);
+ XML.setValue("stars1:Y",stars1.y);
+ XML.setValue("stars1:rate",stars1.rate);
+ XML.setValue("stars1:radius",stars1.radius);
+ XML.setValue("stars1:speed",stars1.speed);
+ XML.setValue("stars1:life",stars1.lifespan);
+ XML.setValue("stars1:mixprob",stars1.mixprob);
+ XML.setValue("stars1:bRandomise",stars1.bRandomise);
+
+ XML.setValue("stars2:X",stars2.x);
+ XML.setValue("stars2:Y",stars2.y);
+ XML.setValue("stars2:rate",stars2.rate);
+ XML.setValue("stars2:radius",stars2.radius);
+ XML.setValue("stars2:speed",stars2.speed);
+ XML.setValue("stars2:life",stars2.lifespan);
+ XML.setValue("stars2:mixprob",stars2.mixprob);
+ XML.setValue("stars2:bRandomise",stars2.bRandomise);
XML.saveFile("settings.xml");
cout << "settings.xml saved!" <<std::endl;
@@ -145,7 +160,7 @@ void ofApp::save_settings(){
//--------------------------------------------------------------
void ofApp::update(){
- banner.update(text_speed);
+ banner.update(text_speed,true);
laser.set_pts(laser_points);
laser.set_subdivide(laser_subdivide);
@@ -154,7 +169,8 @@ void ofApp::update(){
laser.set_intensity(laser_intensity);
- stars.update();
+ stars1.update();
+ stars2.update();
}
//--------------------------------------------------------------
@@ -164,7 +180,9 @@ void ofApp::draw(){
textgui.draw();
lasergui.draw();
- stars.gui.draw();
+
+ stars1.gui.draw();
+ stars2.gui.draw();
lineTransformer::drawWarpFrame(warpframe);
@@ -218,15 +236,22 @@ void ofApp::draw(){
ofSetColor(255,255,255);
- vector<colourPolyline> laserstars=stars.getPoints();
+ vector<colourPolyline> laserstars;
+ int numstars=0;
+
+ laserstars=stars1.getPoints();
+ num+=laser.draw(laserstars);
+ numstars+=laserstars.size();
- num+=laser.draw(laserstars);
+ laserstars=stars2.getPoints();
+ num+=laser.draw(laserstars);
+ numstars+=laserstars.size();
if (num>0){
- ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser points: "+ofToString(num)+", stars: "+ofToString(laserstars.size()));
+ ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser points: "+ofToString(num)+", stars: "+ofToString(numstars));
}
else {
- ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser power off, stars: "+ofToString(laserstars.size()));
+ ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser power off, stars: "+ofToString(numstars));
}
diff --git a/lasertext/src/ofApp.h b/lasertext/src/ofApp.h
index bd92da1..38038e3 100644
--- a/lasertext/src/ofApp.h
+++ b/lasertext/src/ofApp.h
@@ -10,6 +10,25 @@
#include "colourPolyline.h"
#include "vectortext.h"
+/*
+priorities 2023
+
+1. make the starfields dynamic / colour
+
+- different modes:
+
+ gravity
+
+ parameters changing on a cycle ie life, speed
+
+ overall
+
+2. make the text display take an override sentence
+
+3. artnet receiver that makes (for instance) each letter of the text addreessable as if it was an LED
+
+*/
+
class scannableColourPolyline: public colourPolyline{
public:
bool operator < (const scannableColourPolyline& line) const {
@@ -47,6 +66,12 @@ public:
ofParameter<float> speed;
ofParameter<float> lifespan;
ofParameter<bool> bScan;
+ ofParameter<float> mixprob;
+ ofParameter<bool> bRandomise;
+
+ float this_rate;
+ float last_rate;
+
starSystem(){
}
void init(string name="",int _gx=5, int _gy=5, float _x=0, float _y=0, float _rad=100,float r=0.5,float s=5.0,float l=5.0,float v=1.0){
@@ -54,18 +79,34 @@ public:
agevar=v;
gui.setup(name,"",_gx,_gy);
- gui.add(x.set("x", _x, -2000.0f, 2000.0f));
- gui.add(y.set("y", _y, -2000.0f, 2000.0f));
+ gui.add(x.set("x", _x, -4000.0f, 4000.0f));
+ gui.add(y.set("y", _y, -4000.0f, 4000.0f));
gui.add(rate.set("rate", r, 0.01f, 3.0f));
gui.add(radius.set("radius", _rad, 10.0f, 500.0f));
gui.add(speed.set("speed", s, 0.0f, 10.0f));
gui.add(lifespan.set("life", l, 3.0f, 10.0f));
gui.add(bScan.set("scan", true));
+ gui.add(mixprob.set("mix probability", 0.001f, 0.0f, 0.01f));
+ gui.add(bRandomise.set("randomise", true));
+
+ this_rate=rate;
+ last_rate=rate;
}
void update(){
float now=ofGetElapsedTimef();
float segment=now-last;
last=now;
+
+ if (rate!=last_rate){
+ last_rate=rate;
+ this_rate=rate;
+ }
+
+ if (bRandomise&&(ofRandom(1.0f)<mixprob)){
+ stars.clear();
+ this_rate=ofRandom(rate);
+ }
+
for(auto it = stars.begin(); it != stars.end();)
{
if(now-it->birthday>it->lifespan){
@@ -78,7 +119,7 @@ public:
++it;
}
}
- if (ofRandom(rate)<segment){
+ if (ofRandom(this_rate)<segment){
float a=ofRandom(3.57f);
float r=ofRandom(radius);
ofVec2f offset=ofVec2f(cos(a)*r,sin(a)*r);
@@ -179,9 +220,9 @@ class ofApp : public ofBaseApp{
ofxXmlSettings XML;
- //vector<starSystem> stars;
-
- starSystem stars;
+ //vector<starSystem> stars //!!not easy
+ starSystem stars1;
+ starSystem stars2;
glm::vec2 warpframe[4];
int select_warpframe;
diff --git a/lasertext/src/vectortext.h b/lasertext/src/vectortext.h
index 088ee96..69ea98c 100644
--- a/lasertext/src/vectortext.h
+++ b/lasertext/src/vectortext.h
@@ -68,6 +68,11 @@ class glyphbanner{
ofColor::fromHex(0x102ADC),
ofColor::fromHex(0x9FA1AC)
};
+ vector<ofColor> als23={
+ ofColor::fromHex(0x00A8FF),
+ ofColor::fromHex(0xFFB700),
+ ofColor::fromHex(0xFF3082)
+ };
}palettes;
vector<string> split(string s) {
size_t pos_start = 0, pos_end;
@@ -85,10 +90,10 @@ class glyphbanner{
}
public:
glyphbanner(){
- palette=palettes.uneasy;
+ palette=palettes.als23;
};
void init(string message){
- createWords(message);
+ createWords(message,true);
lastUpdateTime=ofGetElapsedTimef();
playhead=0.0f;
}
@@ -214,6 +219,10 @@ public:
lastUpdateTime=ofGetElapsedTimef();
playhead+=delta*speed;
+ if (ofRandom(1.0f)<.001){
+ playhead=ofRandom(100);
+ }
+
int theword=0;
float segment=0.0f;
if (false){ //1 word per second