void ofxLayerMask::drawLayer(int layerId, int x, int y, int _width, int _height, bool masked) { if(masked) { maskShader.begin(); maskShader.setUniformTexture("maskTex", masks.at(layerId).getTextureReference(), 1); layers.at(layerId).draw(x, y, validWidth(_width), validHeight(_height)); maskShader.end(); } else { layers.at(layerId).draw(x, y, validWidth(_width), validHeight(_height)); } }
unsigned int CompositeCutter::height_to_index(double h) const { for (unsigned int n=0; n<cutter.size(); ++n) { if ( validHeight(n,h) ) return n; } // return the last cutter if we get here... return cutter.size()-1; std::cout << " Error, height= " << h << " has no index \n"; assert(0); return 0; }
void ofxLayerMask::drawMask(int maskId, int x, int y, int _width, int _height) { masks.at(maskId).draw(x, y, validWidth(_width), validHeight(_height)); }
void ofxLayerMask::drawLayers(int fromId, int throughId, int x, int y, int _width, int _height, bool masked) { for(int i = fromId; i <= throughId; i++) { drawLayer(i, x, y, validWidth(_width), validHeight(_height), masked); } }
void ofxLayerMask::draw(int x, int y, int _width, int _height) { ofSetColor(ofColor::white); for(int i = 0; i < layers.size(); i++) { drawLayer(i, x, y, validWidth(_width), validHeight(_height)); } }