@@ -2527,38 +2527,39 @@ void mjv_updateActiveFlex(const mjModel* m, mjData* d, mjvScene* scn, const mjvO
2527
2527
if (dim == 2 || m -> flex_elemlayer [m -> flex_elemadr [f ]+ e ] == opt -> flex_layer ) {
2528
2528
// get element data
2529
2529
const int * edata = m -> flex_elem + m -> flex_elemdataadr [f ] + e * (dim + 1 );
2530
+ const int * tdata = m -> flex_elemtexcoord + m -> flex_elemdataadr [f ] + e * (dim + 1 );
2530
2531
2531
2532
// triangles: two faces per element
2532
2533
if (dim == 2 ) {
2533
2534
makeFace (face , normal , radius , vertxpos , nface , edata [0 ], edata [1 ], edata [2 ]);
2534
- copyTex (texdst , texsrc , nface , edata [0 ], edata [1 ], edata [2 ]);
2535
+ copyTex (texdst , texsrc , nface , tdata [0 ], tdata [1 ], tdata [2 ]);
2535
2536
nface ++ ;
2536
2537
2537
2538
makeFace (face , normal , radius , vertxpos , nface , edata [0 ], edata [2 ], edata [1 ]);
2538
- copyTex (texdst , texsrc , nface , edata [0 ], edata [2 ], edata [1 ]);
2539
+ copyTex (texdst , texsrc , nface , tdata [0 ], tdata [2 ], tdata [1 ]);
2539
2540
nface ++ ;
2540
2541
}
2541
2542
2542
2543
// tetrahedra: four faces per element
2543
2544
else {
2544
2545
makeFace (face , normal , radius , vertxpos ,
2545
2546
nface , edata [0 ], edata [1 ], edata [2 ]);
2546
- copyTex (texdst , texsrc , nface , edata [0 ], edata [1 ], edata [2 ]);
2547
+ copyTex (texdst , texsrc , nface , tdata [0 ], tdata [1 ], tdata [2 ]);
2547
2548
nface ++ ;
2548
2549
2549
2550
makeFace (face , normal , radius , vertxpos ,
2550
2551
nface , edata [0 ], edata [2 ], edata [3 ]);
2551
- copyTex (texdst , texsrc , nface , edata [0 ], edata [2 ], edata [3 ]);
2552
+ copyTex (texdst , texsrc , nface , tdata [0 ], tdata [2 ], tdata [3 ]);
2552
2553
nface ++ ;
2553
2554
2554
2555
makeFace (face , normal , radius , vertxpos ,
2555
2556
nface , edata [0 ], edata [3 ], edata [1 ]);
2556
- copyTex (texdst , texsrc , nface , edata [0 ], edata [3 ], edata [1 ]);
2557
+ copyTex (texdst , texsrc , nface , tdata [0 ], tdata [3 ], tdata [1 ]);
2557
2558
nface ++ ;
2558
2559
2559
2560
makeFace (face , normal , radius , vertxpos ,
2560
2561
nface , edata [1 ], edata [3 ], edata [2 ]);
2561
- copyTex (texdst , texsrc , nface , edata [1 ], edata [3 ], edata [2 ]);
2562
+ copyTex (texdst , texsrc , nface , tdata [1 ], tdata [3 ], tdata [2 ]);
2562
2563
nface ++ ;
2563
2564
}
2564
2565
}
@@ -2598,13 +2599,14 @@ void mjv_updateActiveFlex(const mjModel* m, mjData* d, mjvScene* scn, const mjvO
2598
2599
if (dim == 2 ) {
2599
2600
for (int e = 0 ; e < m -> flex_elemnum [f ]; e ++ ) {
2600
2601
const int * edata = m -> flex_elem + m -> flex_elemdataadr [f ] + e * (dim + 1 );
2602
+ const int * tdata = m -> flex_elemtexcoord + m -> flex_elemdataadr [f ] + e * (dim + 1 );
2601
2603
makeSmooth (face , normal , radius , flg_flat , vertnorm , vertxpos ,
2602
2604
nface , edata [0 ], edata [1 ], edata [2 ]);
2603
- copyTex (texdst , texsrc , nface , edata [0 ], edata [1 ], edata [2 ]);
2605
+ copyTex (texdst , texsrc , nface , tdata [0 ], tdata [1 ], tdata [2 ]);
2604
2606
nface ++ ;
2605
2607
makeSmooth (face , normal , - radius , flg_flat , vertnorm , vertxpos ,
2606
2608
nface , edata [0 ], edata [2 ], edata [1 ]);
2607
- copyTex (texdst , texsrc , nface , edata [0 ], edata [2 ], edata [1 ]);
2609
+ copyTex (texdst , texsrc , nface , tdata [0 ], tdata [2 ], tdata [1 ]);
2608
2610
nface ++ ;
2609
2611
}
2610
2612
} else {
0 commit comments