From cde8fab86a40be5d3c99bfd2d97605638647179f Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 20 Sep 2023 23:35:53 +0100 Subject: mostly works --- futuregael/src/ofApp.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'futuregael/src/ofApp.cpp') diff --git a/futuregael/src/ofApp.cpp b/futuregael/src/ofApp.cpp index 676b480..3fb103b 100644 --- a/futuregael/src/ofApp.cpp +++ b/futuregael/src/ofApp.cpp @@ -9,11 +9,32 @@ void ofApp::setup(){ show.load("show.csv"); } + textgui.setup("text","",5,10); + textgui.add(laser_scale.set("scale", 1.0f, 0.5f, 3.0f)); + textgui.add(laser_pos_x.set("x", 0.0f, -1000.0f, 1000.0f)); + textgui.add(laser_pos_y.set("y", 0.0f, -1000.0f, 1000.0f)); + textgui.add(text_speed.set("speed", 1.0f, 0.0f, 2.0f)); + + lasergui.setup("laser","",5,110); + lasergui.add(laser_power.set("power", true)); + lasergui.add(laser_intensity.set("intensity", 30, 0, 255)); + lasergui.add(laser_points.set("points", 30000, 0, 40000)); + lasergui.add(laser_subdivide.set("subdivide", 15, 1, 100)); + lasergui.add(laser_blank_num.set("blank points", 8, 0, 32)); + lasergui.add(laser_max_angle.set("max angle", 15.0f, 1.0f, 90.0f)); + } //-------------------------------------------------------------- void ofApp::update(){ + laser.set_pts(laser_points); + laser.set_subdivide(laser_subdivide); + laser.set_blanknum(laser_blank_num); + laser.set_maxangle(laser_max_angle); + + laser.set_intensity(laser_intensity); + show.update(); } @@ -22,11 +43,28 @@ void ofApp::update(){ void ofApp::draw(){ ofBackground(0); + textgui.draw(); + lasergui.draw(); if (show.isPlaying()){ vector& outlines=show.getOutlines(); + ofMatrix4x4 rm = ofMatrix4x4::newIdentityMatrix(); + rm.translate(laser_pos_x,laser_pos_y,0); + rm.scale(laser_scale,laser_scale,laser_scale); + rm.translate(ofGetWidth()/2,ofGetHeight()/2,0); + + vector scaledOutput; + + for (auto s:outlines){ + scaledOutput.push_back(lineTransformer::polyLineTransform(rm,s)); + } + + int num = 0; + + if (laser_power) num=laser.draw(scaledOutput); + ofPushMatrix(); ofTranslate(ofGetWidth()/2,ofGetHeight()/2); for (auto o:outlines){ @@ -34,14 +72,12 @@ void ofApp::draw(){ } ofPopMatrix(); - ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+"fps, shapes: "+ofToString(outlines.size())); + ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+"fps, laser points: "+ofToString(num)); } else { ofSetWindowTitle("idle"); } - - } -- cgit v1.2.3