Add option to mjspec for creating a texture directly from a buffer.
PiperOrigin-RevId: 662186527 Change-Id: I469c876681d52964ac971c0bb2ec3517224d3a3d
This commit is contained in:
committed by
Copybara-Service
parent
20cae556ee
commit
851bb6eef4
@@ -22,6 +22,7 @@
|
||||
|
||||
// this is a C-API
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -32,6 +33,7 @@ extern "C" {
|
||||
|
||||
#ifdef __cplusplus
|
||||
// C++: defined to be compatible with corresponding std types
|
||||
using mjBuffer = std::vector<std::byte>;
|
||||
using mjString = std::string;
|
||||
using mjStringVec = std::vector<std::string>;
|
||||
using mjIntVec = std::vector<int>;
|
||||
@@ -41,6 +43,7 @@ extern "C" {
|
||||
using mjDoubleVec = std::vector<double>;
|
||||
#else
|
||||
// C: opaque types
|
||||
typedef void mjBuffer;
|
||||
typedef void mjString;
|
||||
typedef void mjStringVec;
|
||||
typedef void mjIntVec;
|
||||
@@ -511,6 +514,9 @@ typedef struct mjsTexture_ { // texture specification
|
||||
// method 3: separate files
|
||||
mjStringVec* cubefiles; // different file for each side of the cube
|
||||
|
||||
// method 4: from buffer read by user
|
||||
mjBuffer* data; // texture data
|
||||
|
||||
// flip options
|
||||
mjtByte hflip; // horizontal flip
|
||||
mjtByte vflip; // vertical flip
|
||||
|
||||
@@ -1629,6 +1629,9 @@ MJAPI mjsMaterial* mjs_asMaterial(mjsElement* element);
|
||||
|
||||
//---------------------------------- Attribute setters ---------------------------------------------
|
||||
|
||||
// Copy buffer.
|
||||
MJAPI void mjs_setBuffer(mjBuffer* dest, const void* array, int size);
|
||||
|
||||
// Copy text to string.
|
||||
MJAPI void mjs_setString(mjString* dest, const char* text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user