Migrate mjModel size fields from int to mjtSize.
This change updates all size-related members within the `mjModel` struct from `int` to `mjtSize`. This allows MuJoCo to handle models with a larger number of elements. Corresponding changes were made to macros, function signatures, and I/O routines to accommodate the new `mjtSize` type. PiperOrigin-RevId: 860144595 Change-Id: I701c6d607715d240766b6210a9773cd9e4258c59
This commit is contained in:
committed by
Copybara-Service
parent
4a64017a5f
commit
30b903b6c0
@@ -4825,7 +4825,7 @@ void mjCTexture::BuiltinCube(void) {
|
||||
if (w > std::numeric_limits<int>::max() / w) {
|
||||
throw mjCError(this, "Cube texture width is too large.");
|
||||
}
|
||||
int ww = width*width;
|
||||
mjtSize ww = width*width;
|
||||
|
||||
// convert fixed colors
|
||||
for (int j = 0; j < 3; j++) {
|
||||
@@ -4838,7 +4838,7 @@ void mjCTexture::BuiltinCube(void) {
|
||||
|
||||
// gradient
|
||||
if (builtin == mjBUILTIN_GRADIENT) {
|
||||
if (ww > std::numeric_limits<int>::max() / 18) {
|
||||
if (ww > std::numeric_limits<std::int64_t>::max() / 18) {
|
||||
throw mjCError(this, "Gradient texture width is too large.");
|
||||
}
|
||||
for (int r = 0; r < w; r++) {
|
||||
@@ -5176,7 +5176,7 @@ void mjCTexture::LoadCubeSingle(std::string filename, const mjVFS* vfs) {
|
||||
|
||||
// allocate data
|
||||
std::int64_t size = static_cast<std::int64_t>(width)*height;
|
||||
if (size >= std::numeric_limits<int>::max() / 3 || size <= 0) {
|
||||
if (size >= std::numeric_limits<std::int64_t>::max() / 3 || size <= 0) {
|
||||
throw mjCError(this, "Cube texture too large");
|
||||
}
|
||||
try {
|
||||
@@ -5293,7 +5293,7 @@ void mjCTexture::LoadCubeSeparate(const mjVFS* vfs) {
|
||||
}
|
||||
height = 6*width;
|
||||
std::int64_t size = static_cast<std::int64_t>(width)*height;
|
||||
if (size >= std::numeric_limits<int>::max() / 3 || size <= 0) {
|
||||
if (size >= std::numeric_limits<mjtSize>::max() / 3 || size <= 0) {
|
||||
throw mjCError(this, "PNG texture too large");
|
||||
}
|
||||
try {
|
||||
@@ -5378,7 +5378,7 @@ void mjCTexture::Compile(const mjVFS* vfs) {
|
||||
}
|
||||
|
||||
std::int64_t size = static_cast<std::int64_t>(width)*height;
|
||||
if (size >= std::numeric_limits<int>::max() / nchannel || size <= 0) {
|
||||
if (size >= std::numeric_limits<int64_t>::max() / nchannel || size <= 0) {
|
||||
throw mjCError(this, "Builtin texture too large");
|
||||
}
|
||||
// allocate data
|
||||
|
||||
Reference in New Issue
Block a user