From d63937d54f41aa94236be6d7da3eede9b07196c7 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 19 Feb 2014 13:03:32 +0000 Subject: preparing mip maps --- offsetProject/src/ofApp.cpp | 48 +++++++++++++++++++++++---------------------- offsetProject/src/ofApp.h | 2 +- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/offsetProject/src/ofApp.cpp b/offsetProject/src/ofApp.cpp index 1c61832..3399aca 100644 --- a/offsetProject/src/ofApp.cpp +++ b/offsetProject/src/ofApp.cpp @@ -36,7 +36,6 @@ void ofApp::setup() { angle = 0; kinect.setCameraTiltAngle(angle); - //how to draw a pyramid mosaic //start with the largest size square //get the depth, if below a certain size, subdivide and repeat @@ -45,23 +44,29 @@ void ofApp::setup() { //1 - create a pyramid of mip maps of depth //2 - work upwards - int min_w=ceil(kinect.width/(MAX_TILE_SIZE*2))*2; - int min_h=ceil(kinect.height/(MAX_TILE_SIZE*2))*2; + //a find layout of largest tiles + //b extend captured frame to this ratio + //c mip map this down into prepared containers + + int tiles_w=ceil(kinect.width/(MAX_TILE_SIZE*2))*2; + int tiles_h=ceil(kinect.height/(MAX_TILE_SIZE*2))*2; + extend_w=(tiles_w)*MAX_TILE_SIZE; + extend_h=(tiles_h)*MAX_TILE_SIZE; //get number of levels int levels=0; - for (int i=MIN_TILE_SIZE;i>=MAX_TILE_SIZE;i*=2) { + for (int i=MIN_TILE_SIZE;i<=MAX_TILE_SIZE;i*=2) { levels++; - int w=ceil(kinect.width/(i*2))*2; - int h=ceil(kinect.height/(i*2))*2; - numTiles.push_back(make_pair(w,h)); - cerr<<"level "<=MAX_TILE_SIZE;i*=2,l++){ - colourTiles[l].allocate(numTiles[l].first,numTiles[l].second); - colourTiles[l].scaleIntoMe(*prevCol); - depthTiles[l].allocate(numTiles[l].first,numTiles[l].second); - depthTiles[l].scaleIntoMe(*prevDepth); - //extend borders to a whole number of tiles of the next size - if (l