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
@@ -14,8 +14,10 @@
|
||||
|
||||
#include "user/user_api.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <map>
|
||||
#include <new>
|
||||
#include <string>
|
||||
@@ -877,6 +879,16 @@ mjsMaterial* mjs_asMaterial(mjsElement* element) {
|
||||
|
||||
|
||||
|
||||
// copy buffer to destination buffer
|
||||
void mjs_setBuffer(mjBuffer* dest, const void* array, int size) {
|
||||
const std::byte* buffer = static_cast<const std::byte*>(array);
|
||||
dest->clear();
|
||||
dest->reserve(size);
|
||||
std::copy_n(buffer, size, std::back_inserter(*dest));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// set string
|
||||
void mjs_setString(mjString* dest, const char* text) {
|
||||
std::string* str = static_cast<std::string*>(dest);
|
||||
|
||||
Reference in New Issue
Block a user