Move texture block copy out of render context so it can be modified online via mjmodel

This commit is contained in:
Pedro Morais
2026-07-09 11:08:43 -04:00
parent bdeb7e7c4d
commit d43c3ed426
12 changed files with 54 additions and 95 deletions
+18 -24
View File
@@ -10140,6 +10140,16 @@ STRUCTS: Mapping[str, StructDecl] = dict([
type=ValueType(name='int'),
doc='material id; -1: no textured material',
),
StructFieldDecl(
name='texid',
type=ValueType(name='int'),
doc='texture id; -1: none',
),
StructFieldDecl(
name='texuniform',
type=ValueType(name='int'),
doc='uniform cube mapping',
),
StructFieldDecl(
name='texcoord',
type=ValueType(name='int'),
@@ -10202,6 +10212,14 @@ STRUCTS: Mapping[str, StructDecl] = dict([
type=ValueType(name='float'),
doc='reflectance coef',
),
StructFieldDecl(
name='texrepeat',
type=ArrayType(
inner_type=ValueType(name='float'),
extents=(2,),
),
doc='texture repetition for 2d mapping',
),
StructFieldDecl(
name='label',
type=ArrayType(
@@ -11178,30 +11196,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
),
doc='auxiliary color buffer for resolving',
),
StructFieldDecl(
name='mat_texid',
type=ArrayType(
inner_type=ValueType(name='int'),
extents=(10000,),
),
doc='material texture ids (-1: no texture)',
),
StructFieldDecl(
name='mat_texuniform',
type=ArrayType(
inner_type=ValueType(name='int'),
extents=(1000,),
),
doc='uniform cube mapping',
),
StructFieldDecl(
name='mat_texrepeat',
type=ArrayType(
inner_type=ValueType(name='float'),
extents=(2000,),
),
doc='texture repetition for 2d mapping',
),
StructFieldDecl(
name='ntexture',
type=ValueType(name='int'),
-12
View File
@@ -54,9 +54,6 @@ class MjWrapper<raw::MjrContext> : public WrapperBase<raw::MjrContext> {
X(auxFBO_r);
X(auxColor);
X(auxColor_r);
X(mat_texid);
X(mat_texuniform);
X(mat_texrepeat);
X(textureType);
X(texture);
X(skinvertVBO);
@@ -98,9 +95,6 @@ MjrContextWrapper::MjWrapper()
X(auxFBO_r),
X(auxColor),
X(auxColor_r),
X(mat_texid),
X(mat_texuniform),
X(mat_texrepeat),
X(textureType),
X(texture),
X_SKIN(skinvertVBO),
@@ -125,9 +119,6 @@ MjrContextWrapper::MjWrapper(const MjModelWrapper& model, int fontscale)
X(auxFBO_r),
X(auxColor),
X(auxColor_r),
X(mat_texid),
X(mat_texuniform),
X(mat_texrepeat),
X(textureType),
X(texture),
X_SKIN(skinvertVBO),
@@ -228,9 +219,6 @@ PYBIND11_MODULE(_render, pymodule, pybind11::mod_gil_not_used()) {
X(auxFBO_r);
X(auxColor);
X(auxColor_r);
X(mat_texid);
X(mat_texuniform);
X(mat_texrepeat);
X(textureType);
X(texture);
X(skinvertVBO);
+3
View File
@@ -1185,6 +1185,8 @@ This is useful for example when the MJB is not available as a file on disk.)"));
X(objid);
X(category);
X(matid);
X(texid);
X(texuniform);
X(texcoord);
X(segid);
X(emission);
@@ -1201,6 +1203,7 @@ This is useful for example when the MJB is not available as a file on disk.)"));
X(pos);
X(mat);
X(rgba);
X(texrepeat);
#undef X
DefinePyStr(mjvGeom, "label", &raw::MjvGeom::label);
+1
View File
@@ -832,6 +832,7 @@ class MjWrapper<raw::MjvGeom> : public WrapperBase<raw::MjvGeom> {
X(pos);
X(mat);
X(rgba);
X(texrepeat);
#undef X
};
+4 -2
View File
@@ -1193,7 +1193,8 @@ MjvGeomWrapper::MjWrapper()
static_assert(sizeof(ptr_->mat) == sizeof(ptr_->mat[0]) * 9);
return InitPyArray(std::array{3, 3}, ptr_->mat, owner_);
}()),
X(rgba) {
X(rgba),
X(texrepeat) {
mjv_initGeom(ptr_, mjGEOM_NONE, nullptr, nullptr, nullptr, nullptr);
}
@@ -1205,7 +1206,8 @@ MjvGeomWrapper::MjWrapper(raw::MjvGeom* ptr, py::handle owner)
static_assert(sizeof(ptr_->mat) == sizeof(ptr_->mat[0]) * 9);
return InitPyArray(std::array{3, 3}, ptr_->mat, owner_);
}()),
X(rgba) {}
X(rgba),
X(texrepeat) {}
#undef X
MjvGeomWrapper::MjWrapper(const MjvGeomWrapper& other) : MjvGeomWrapper() {