Add option to mjspec for creating a texture directly from a buffer.

PiperOrigin-RevId: 662186527
Change-Id: I469c876681d52964ac971c0bb2ec3517224d3a3d
This commit is contained in:
Alessio Quaglino
2024-08-12 12:26:39 -07:00
committed by Copybara-Service
parent 20cae556ee
commit 851bb6eef4
16 changed files with 267 additions and 95 deletions
+4 -1
View File
@@ -15,6 +15,7 @@
#ifndef MUJOCO_SRC_USER_USER_OBJECTS_H_
#define MUJOCO_SRC_USER_USER_OBJECTS_H_
#include <cstddef>
#include <cstdlib>
#include <functional>
#include <map>
@@ -1015,7 +1016,7 @@ class mjCHField : public mjCHField_, private mjsHField {
class mjCTexture_ : public mjCBase {
protected:
std::vector<mjtByte> data; // texture data (rgb, roughness, etc.)
std::vector<std::byte> data_; // texture data (rgb, roughness, etc.)
std::string file_;
std::string content_type_;
@@ -1066,6 +1067,8 @@ class mjCTexture : public mjCTexture_, private mjsTexture {
void LoadCustom(mjResource* resource,
std::vector<unsigned char>& image,
unsigned int& w, unsigned int& h);
bool clear_data_; // if true, data_ is empty and should be filled by Compile
};