mask tool/gui rework, plugin_cuda CUDA_PATH fix, raise filebox/tool guis on open...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / playback3d.C
index 9b4aea7352d2f1299bc4b344655248667357a404..e9b087fb16636af0075899302e9ace701f002720 100644 (file)
@@ -38,6 +38,7 @@
 #include "pluginclient.h"
 #include "pluginvclient.h"
 #include "edlsession.h"
+#include "track.h"
 #include "transportque.inc"
 #include "vframe.h"
 
@@ -1224,10 +1225,12 @@ static void combineData(GLdouble coords[3],
        vertex[1] = coords[1];
        vertex[2] = coords[2];
        for( int i=3; i<6; ++i ) {
-               vertex[i] = weight[0] * vertex_data[0][i] +
-                       weight[1] * vertex_data[1][i] +
-                       weight[2] * vertex_data[2][i] +
-                       weight[3] * vertex_data[3][i];
+               GLdouble v = 0;
+               for( int k=0; k<4; ++k ) {
+                       if( !weight[k] || !vertex_data[k] ) continue;
+                       v += weight[k] * vertex_data[k][i];
+               }
+               vertex[i] = v;
        }
        *outData = vertex;
 }
@@ -1292,9 +1295,11 @@ void Playback3D::do_mask_sync(Playback3DCommand *command)
                glClearColor(bg, bg, bg, bg);
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
+               int show_mask = command->keyframe_set->track->masks;
                for(int k = 0; k < total_submasks; k++) {
                        MaskPointSet &points = point_set[k];
                        MaskEdge &edge = *edges.append(new MaskEdge());
+                       if( !((show_mask>>k) & 1) ) continue;
                        int first_point = 0;
 // Need to tabulate every vertex in persistent memory because
 // gluTessVertex doesn't copy them.