Adds color space to textures.
PiperOrigin-RevId: 761907261 Change-Id: Iec546d1d5907a15e57ef809ec31850640fc52915
This commit is contained in:
committed by
Copybara-Service
parent
62a9d5b98d
commit
3e9bc79b54
@@ -241,8 +241,8 @@ const char* MJCF[nMJCF][mjXATTRNUM] = {
|
||||
{"<"},
|
||||
{"bone", "*", "5", "body", "bindpos", "bindquat", "vertid", "vertweight"},
|
||||
{">"},
|
||||
{"texture", "*", "23", "name", "type", "content_type", "file", "gridsize", "gridlayout",
|
||||
"fileright", "fileleft", "fileup", "filedown", "filefront", "fileback",
|
||||
{"texture", "*", "24", "name", "type", "colorspace", "content_type", "file", "gridsize",
|
||||
"gridlayout", "fileright", "fileleft", "fileup", "filedown", "filefront", "fileback",
|
||||
"builtin", "rgb1", "rgb2", "mark", "markrgb", "random", "width", "height",
|
||||
"hflip", "vflip", "nchannel"},
|
||||
{"material", "*", "12", "name", "class", "texture", "texrepeat", "texuniform",
|
||||
@@ -650,6 +650,15 @@ const mjMap texture_map[texture_sz] = {
|
||||
};
|
||||
|
||||
|
||||
// colorspace for texture
|
||||
const int colorspace_sz = 3;
|
||||
const mjMap colorspace_map[colorspace_sz] = {
|
||||
{"auto", mjCOLORSPACE_AUTO},
|
||||
{"linear", mjCOLORSPACE_LINEAR},
|
||||
{"sRGB", mjCOLORSPACE_SRGB}
|
||||
};
|
||||
|
||||
|
||||
// builtin type for texture
|
||||
const int builtin_sz = 4;
|
||||
const mjMap builtin_map[builtin_sz] = {
|
||||
@@ -3194,6 +3203,9 @@ void mjXReader::Asset(XMLElement* section, const mjVFS* vfs) {
|
||||
if (MapValue(elem, "type", &n, texture_map, texture_sz)) {
|
||||
texture->type = (mjtTexture)n;
|
||||
}
|
||||
if (MapValue(elem, "colorspace", &n, colorspace_map, colorspace_sz)) {
|
||||
texture->colorspace = (mjtColorSpace)n;
|
||||
}
|
||||
if (ReadAttrTxt(elem, "name", texname)) {
|
||||
mjs_setString(texture->name, texname.c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user