Camera draw size adjustable by percent of window

This commit is contained in:
James Alliban 2014-01-11 04:13:22 +00:00
parent 73081efcd2
commit 1b1e884555
6 changed files with 27 additions and 6 deletions

View File

@ -1,12 +1,22 @@
<Widget> <Widget>
<Kind>2</Kind> <Kind>2</Kind>
<Name>Toggle Video Visibility</Name> <Name>Toggle Video Visibility</Name>
<Value>0</Value> <Value>1</Value>
</Widget> </Widget>
<Widget> <Widget>
<Kind>2</Kind> <Kind>2</Kind>
<Name>Toggle Image Visibility</Name> <Name>Toggle Image Visibility</Name>
<Value>1</Value> <Value>0</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Video/Image Width Percent</Name>
<Value>0.875000000</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Video/Image Height Percent</Name>
<Value>1.000000000</Value>
</Widget> </Widget>
<Widget> <Widget>
<Kind>4</Kind> <Kind>4</Kind>

View File

@ -146,6 +146,10 @@ void GUI::addBackgroundGUI()
gui->addToggle("Toggle Video Visibility", &app->scene.isVideoVisible, toggleDim, toggleDim); gui->addToggle("Toggle Video Visibility", &app->scene.isVideoVisible, toggleDim, toggleDim);
gui->addToggle("Toggle Image Visibility", &app->scene.isImageVisible, toggleDim, toggleDim); gui->addToggle("Toggle Image Visibility", &app->scene.isImageVisible, toggleDim, toggleDim);
gui->addSlider("Video/Image Width Percent", 0, 2, &app->scene.videoWidthPercentage, length, dim);
gui->addSlider("Video/Image Height Percent", 0, 2, &app->scene.videoHeightPercentage, length, dim);
gui->addLabel("VIDEO IMAGE SETTINGS"); gui->addLabel("VIDEO IMAGE SETTINGS");
gui->addSlider("Brightness", 0, 2, &app->scene.brightness, length, dim); gui->addSlider("Brightness", 0, 2, &app->scene.brightness, length, dim);

View File

@ -2,7 +2,6 @@
// TODO // TODO
// ==== // ====
// - Make HUD BG hole size a percentage rather than pixels
// - Add option to resize video draw size (rather than making it fullscreen) and init size // - Add option to resize video draw size (rather than making it fullscreen) and init size
// - Make system to slow down data - The screen should show 15-20 minutes worth of data // - Make system to slow down data - The screen should show 15-20 minutes worth of data
// - Make 3rd graph - separate fade // - Make 3rd graph - separate fade

View File

@ -56,10 +56,16 @@ void Scene::drawVideo()
rgbShader.setUniform1f("blue", blue); rgbShader.setUniform1f("blue", blue);
rgbShader.setUniform1f("alpha", alpha); rgbShader.setUniform1f("alpha", alpha);
float vidW = ofGetWidth() * videoWidthPercentage;
float vidH = ofGetHeight() * videoHeightPercentage;
ofPushMatrix();
ofTranslate((ofGetWidth() - vidW) * 0.5, (ofGetHeight() - vidH) * 0.5);
if (isVideoVisible) if (isVideoVisible)
vidGrabber.draw(0, 0, ofGetWidth(), ofGetHeight()); vidGrabber.draw(0, 0, vidW, vidH);
if (isImageVisible) if (isImageVisible)
bgImg.draw(0, 0, ofGetWidth(), ofGetHeight()); bgImg.draw(0, 0, vidW, vidH);
ofPopMatrix();
rgbShader.end(); rgbShader.end();
} }

View File

@ -49,6 +49,8 @@ public:
float green; float green;
float blue; float blue;
float alpha; float alpha;
float videoWidthPercentage;
float videoHeightPercentage;
bool isVideoVisible; bool isVideoVisible;
bool isImageVisible; bool isImageVisible;