Allow mesh data to be reuploaded without having to recreate the mesh.
Splits mjrfMeshData into config+data parts. PiperOrigin-RevId: 952042545 Change-Id: I19a572a0f591fa0d33bbc2c32b974efc075310f4
This commit is contained in:
committed by
Copybara-Service
parent
d3166cb630
commit
ba9a65031b
@@ -1452,12 +1452,22 @@ culling. Alternatively, the bounds can be computed at runtime (though there is a
|
||||
are provided (or calculated), then frustum culling will not be performed.
|
||||
|
||||
|
||||
.. _mjrfMeshConfig:
|
||||
|
||||
mjrfMeshConfig
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Parameters for creating a :ref:`mesh<mjrfMesh>`.
|
||||
|
||||
.. mujoco-include:: mjrfMeshConfig
|
||||
|
||||
|
||||
.. _mjrfMeshData:
|
||||
|
||||
mjrfMeshData
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Binary data used for creating a :ref:`mesh<mjrfMesh>`.
|
||||
Binary data for a :ref:`mesh<mjrfMesh>`.
|
||||
|
||||
.. mujoco-include:: mjrfMeshData
|
||||
|
||||
|
||||
@@ -3249,14 +3249,14 @@ Returns the height of the texture.
|
||||
Returns the sampler type (mjrSamplerType) used by the texture.
|
||||
[returns: mjrSamplerType]
|
||||
|
||||
.. _mjrf_defaultMeshData:
|
||||
.. _mjrf_defaultMeshConfig:
|
||||
|
||||
`mjrf_defaultMeshData <#mjrf_defaultMeshData>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
`mjrf_defaultMeshConfig <#mjrf_defaultMeshConfig>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mjrf_defaultMeshData
|
||||
.. mujoco-include:: mjrf_defaultMeshConfig
|
||||
|
||||
Initializes the mjrfMeshData to default values.
|
||||
Initializes the mjrfMeshConfig to default values.
|
||||
|
||||
.. _mjrf_createMesh:
|
||||
|
||||
@@ -3265,7 +3265,7 @@ Initializes the mjrfMeshData to default values.
|
||||
|
||||
.. mujoco-include:: mjrf_createMesh
|
||||
|
||||
Creates a mesh with the given data.
|
||||
Creates an empty mesh with the given config.
|
||||
|
||||
.. _mjrf_destroyMesh:
|
||||
|
||||
@@ -3276,6 +3276,24 @@ Creates a mesh with the given data.
|
||||
|
||||
Destroys the mesh.
|
||||
|
||||
.. _mjrf_defaultMeshData:
|
||||
|
||||
`mjrf_defaultMeshData <#mjrf_defaultMeshData>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mjrf_defaultMeshData
|
||||
|
||||
Initializes the mjrfMeshData to default values.
|
||||
|
||||
.. _mjrf_setMeshData:
|
||||
|
||||
`mjrf_setMeshData <#mjrf_setMeshData>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mjrf_setMeshData
|
||||
|
||||
Uploads the given mesh data to the mesh.
|
||||
|
||||
.. _mjrf_defaultSceneParams:
|
||||
|
||||
`mjrf_defaultSceneParams <#mjrf_defaultSceneParams>`__
|
||||
|
||||
@@ -66,6 +66,9 @@ Engine
|
||||
- :ref:`mju_round` now breaks ties away from zero rather than towards :math:`+\infty`. This only affects
|
||||
negative half-integers, e.g. ``mju_round(-2.5)`` now returns -3 rather than -2.
|
||||
- Removed unneeded `mjvScene` argument from :ref:`mjv_moveCamera`.
|
||||
- Split up :ref:`mjrfMeshData` into `mjrfMeshData` and `mjrfMeshConfig` to allow reuploading of mesh data without
|
||||
having to recreate the mesh object. Introduces :ref:`mjrfDefaultMeshConfig` and :ref:`mjrfSetMeshData` functions.
|
||||
- Removed `bytes` field from :ref:`mjrVertexAttribute`.
|
||||
|
||||
.. admonition:: Breaking ABI changes
|
||||
:class: caution
|
||||
|
||||
@@ -1425,7 +1425,6 @@ typedef struct mjrRendererInfo_ { // active renderer identity
|
||||
const char* backend; // graphics backend: opengl, vulkan; empty if uninitialized
|
||||
} mjrRendererInfo;
|
||||
typedef struct mjrVertexAttribute_ { // vertex attribute format specification
|
||||
const void* bytes; // vertex data
|
||||
int usage; // position, normal, etc [mjrVertexAttributeUsage]
|
||||
int type; // float3, ubyte4, etc. [mjrVertexAttributeType]
|
||||
} mjrVertexAttribute;
|
||||
@@ -1580,15 +1579,20 @@ typedef struct mjrfTextureData_ {
|
||||
mjrfCallback release; // callback when data has finished uploading
|
||||
void* user_data; // user data for release callback
|
||||
} mjrfTextureData;
|
||||
typedef struct mjrfMeshData_ {
|
||||
mjtSize num_vertices; // number of vertices; all vertex attributes share this size
|
||||
int num_attributes; // number of attributes defined
|
||||
typedef struct mjrfMeshConfig_ {
|
||||
mjtSize max_vertices; // maximum number of vertices
|
||||
mjtSize max_indices; // maximum number of indices
|
||||
int num_attributes; // number of defined attributes
|
||||
mjrVertexAttribute attributes[mjMAX_VERTEX_ATTRIBUTES]; // per-vertex attribute information
|
||||
mjtBool interleaved; // true if vertex attributes are interleaved
|
||||
mjtSize num_indices; // number of indices
|
||||
const void* indices; // indices data array
|
||||
int index_type; // index data format (e.g. UINT16 or UINT32) [mjrIndexType]
|
||||
int primitive_type; // index interpretation (e.g. TRIANGLES, etc.) [mjrMeshPrimitiveType]
|
||||
} mjrfMeshConfig;
|
||||
typedef struct mjrfMeshData_ {
|
||||
mjtSize num_vertices; // number of vertices
|
||||
const void* vertices[mjMAX_VERTEX_ATTRIBUTES]; // per-vertex attribute data arrays
|
||||
mjtSize num_indices; // number of indices
|
||||
const void* indices; // indices data array
|
||||
mjtBool compute_bounds; // if true, compute bounds from vertex positions
|
||||
float bounds_min[3]; // min/max bounds; assume unset if bounds_min == bounds_max
|
||||
float bounds_max[3];
|
||||
@@ -3422,9 +3426,11 @@ void mjrf_setTextureData(mjrfTexture* texture, const mjrfTextureData* data);
|
||||
int mjrf_getTextureWidth(const mjrfTexture* texture);
|
||||
int mjrf_getTextureHeight(const mjrfTexture* texture);
|
||||
int mjrf_getTextureSamplerType(const mjrfTexture* texture);
|
||||
void mjrf_defaultMeshData(mjrfMeshData* data);
|
||||
mjrfMesh* mjrf_createMesh(mjrfContext* ctx, const mjrfMeshData* data);
|
||||
void mjrf_defaultMeshConfig(mjrfMeshConfig* config);
|
||||
mjrfMesh* mjrf_createMesh(mjrfContext* ctx, const mjrfMeshConfig* config);
|
||||
void mjrf_destroyMesh(mjrfMesh* mesh);
|
||||
void mjrf_defaultMeshData(mjrfMeshData* data);
|
||||
void mjrf_setMeshData(mjrfMesh* mesh, const mjrfMeshData* data);
|
||||
void mjrf_defaultSceneParams(mjrfSceneParams* params);
|
||||
mjrfScene* mjrf_createScene(mjrfContext* ctx, const mjrfSceneParams* params);
|
||||
void mjrf_destroyScene(mjrfScene* scene);
|
||||
|
||||
Reference in New Issue
Block a user