Add mjmodel support for textures with different number of channels.

PiperOrigin-RevId: 653974959
Change-Id: Ia280e0bdb21027646249f104f21bedee792ba7e5
This commit is contained in:
Tom Erez
2024-07-19 05:21:16 -07:00
committed by Copybara-Service
parent 70ac76bb4b
commit e92af73cbf
11 changed files with 43 additions and 24 deletions
+2 -1
View File
@@ -2505,9 +2505,10 @@ void mjCModel::CopyObjects(mjModel* m) {
m->tex_height[i] = ptex->height;
m->tex_width[i] = ptex->width;
m->tex_adr[i] = data_adr;
m->tex_nchannel[i] = 3;
// copy rgb data
memcpy(m->tex_rgb + data_adr, ptex->rgb.data(), 3*ptex->width*ptex->height);
memcpy(m->tex_data + data_adr, ptex->rgb.data(), 3*ptex->width*ptex->height);
// advance counter
data_adr += 3*ptex->width*ptex->height;