@@ -87,39 +87,40 @@ void DataToTexture::setupObjectContent(shared_ptr<ofAppGLFWWindow> &mainWindow){
8787
8888// --------------------------------------------------------------
8989void DataToTexture::updateObjectContent (map<int ,shared_ptr<PatchObject>> &patchObjects){
90+ unusedArgs (patchObjects);
9091
9192 if (needReset){
9293 needReset = false ;
9394 resetResolution ();
9495 }
9596
9697 if (static_cast <ofTexture *>(_outletParams[0 ])->isAllocated ()){
97- if (this ->inletsConnected [0 ] || this ->inletsConnected [1 ] || this ->inletsConnected [2 ]){
98- for (int s=0 ;s<pix->size ();s++){
98+ if (( this ->inletsConnected [0 ] || this ->inletsConnected [1 ] || this ->inletsConnected [2 ]) && (! static_cast <vector< float > *>(_inletParams[ 0 ])-> empty () || ! static_cast <vector< float > *>(_inletParams[ 1 ])-> empty () || ! static_cast <vector< float > *>(_inletParams[ 2 ])-> empty ()) ){
99+ for (size_t s=0 ;s<pix->size ();s++){
99100 int posR = 0 ;
100101 int sampleR = 0 ;
101102 int posG = 0 ;
102103 int sampleG = 0 ;
103104 int posB = 0 ;
104105 int sampleB = 0 ;
105106 // RED
106- if (this ->inletsConnected [0 ] && static_cast <int >( static_cast < vector<float > *>(_inletParams[0 ])->size ()) > 0 ){
107+ if (this ->inletsConnected [0 ] && ! static_cast <vector<float > *>(_inletParams[0 ])->empty () ){
107108 posR = static_cast <int >(floor (ofMap (s,0 ,pix->size (),0 ,static_cast <int >(static_cast <vector<float > *>(_inletParams[0 ])->size ()))));
108109 sampleR = static_cast <int >(floor (ofMap (static_cast <vector<float > *>(_inletParams[0 ])->at (posR), -0 .5f , 0 .5f , 0 , 255 )));
109110 }
110111 // GREEN
111- if (this ->inletsConnected [1 ] && static_cast <int >( static_cast < vector<float > *>(_inletParams[1 ])->size ()) > 0 ){
112+ if (this ->inletsConnected [1 ] && ! static_cast <vector<float > *>(_inletParams[1 ])->empty () ){
112113 posG = static_cast <int >(floor (ofMap (s,0 ,pix->size (),0 ,static_cast <int >(static_cast <vector<float > *>(_inletParams[1 ])->size ()))));
113114 sampleG = static_cast <int >(floor (ofMap (static_cast <vector<float > *>(_inletParams[1 ])->at (posG), -0 .5f , 0 .5f , 0 , 255 )));
114115 }
115116 // BLUE
116- if (this ->inletsConnected [2 ] && static_cast <int >( static_cast < vector<float > *>(_inletParams[2 ])->size ()) > 0 ){
117+ if (this ->inletsConnected [2 ] && ! static_cast <vector<float > *>(_inletParams[2 ])->empty () ){
117118 posB = static_cast <int >(floor (ofMap (s,0 ,pix->size (),0 ,static_cast <int >(static_cast <vector<float > *>(_inletParams[2 ])->size ()))));
118119 sampleB = static_cast <int >(floor (ofMap (static_cast <vector<float > *>(_inletParams[2 ])->at (posB), -0 .5f , 0 .5f , 0 , 255 )));
119120 }
120121 ofColor c (sampleR,sampleG,sampleB);
121- int x = s % pix->getWidth ();
122- int y = static_cast <int >(ceil (s / pix->getWidth ()));
122+ size_t x = s % pix->getWidth ();
123+ size_t y = static_cast <size_t >(ceil (s / pix->getWidth ()));
123124 if (x >= 0 && x <= pix->getWidth () && y >= 0 && y <= pix->getHeight ()){
124125 pix->setColor (x,y,c);
125126 }
@@ -146,7 +147,9 @@ void DataToTexture::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchO
146147
147148// --------------------------------------------------------------
148149void DataToTexture::drawObjectContent (ofTrueTypeFont *font, shared_ptr<ofBaseGLRenderer>& glRenderer){
149- if (this ->inletsConnected [0 ] || this ->inletsConnected [1 ] || this ->inletsConnected [2 ]){
150+ unusedArgs (font,glRenderer);
151+
152+ if ((this ->inletsConnected [0 ] || this ->inletsConnected [1 ] || this ->inletsConnected [2 ]) && (!static_cast <vector<float > *>(_inletParams[0 ])->empty () || !static_cast <vector<float > *>(_inletParams[1 ])->empty () || !static_cast <vector<float > *>(_inletParams[2 ])->empty ())){
150153 // draw node texture preview with OF
151154 if (scaledObjW*canvasZoom > 90 .0f ){
152155 drawNodeOFTexture (*static_cast <ofTexture *>(_outletParams[0 ]), posX, posY, drawW, drawH, objOriginX, objOriginY, scaledObjW, scaledObjH, canvasZoom, this ->scaleFactor );
0 commit comments