PVRAssets Functions#

pvr::assets::readGLTF#

Function Documentation#

::pvr::assets::Model pvr::assets::readGLTF(const ::pvr::Stream &stream, const IAssetProvider &assetProvider)#

pvr::assets::readGLTF#

Function Documentation#

void pvr::assets::readGLTF(const ::pvr::Stream &stream, const IAssetProvider &assetProvider, ::pvr::assets::Model &outModel)#

pvr::assets::getCameraHandle#

Function Documentation#

inline CameraHandle pvr::assets::getCameraHandle(ModelHandle model, uint32_t cameraId)#

Create a Reference Counted Handle to a Camera from a Model. The handle provided works as any other std::shared_ptr smart pointer, and uses the “shared ref count” feature that allows the created CameraHandle to use the Model’s reference count (e.g. if the Camera is copied, the Model’s reference count increases, and if all references to the Model are released, the Model will be kept alive by this reference.

Parameters:
  • model – The model to whom the Camera we will create the handle for belongs

  • cameraId – The ID of the Camera inside model

Returns:

A CameraHandle to the Camera. It shares the ref counting of model

pvr::assets::getNodeHandle#

Function Documentation#

inline NodeHandle pvr::assets::getNodeHandle(ModelHandle model, uint32_t nodeId)#

Create a Reference Counted Handle to a Node from a Model. The handle provided works as any other std::shared_ptr smart pointer, and uses the “shared ref count” feature that allows the created NodeHandle to use the Model’s reference count (e.g. if the Node is copied, the Model’s reference count increases, and if all references to the Model are released, the Model will be kept alive by this reference.

Parameters:
  • model – The model to whom the Node we will create the handle for belongs

  • nodeId – The ID of the Node inside model

Returns:

A Node Handle to the Node. It shares the ref counting of model

pvr::assets::loadModel#

Function Documentation#

pvr::assets::ModelHandle pvr::assets::loadModel(const IAssetProvider &app, const pvr::Stream &model)#

Load a model file using the provided scene file name.

Parameters:
  • app – An asset provider used to load the model file

  • modelFile

Returns:

Returns a successfully created pvr::assets::ModelHandle object otherwise will throw

pvr::assets::readPOD#

Function Documentation#

::pvr::assets::Model pvr::assets::readPOD(const ::pvr::Stream &stream)#

This class creates pvr::assets::Model object from Streams of POD Model data. Use the readAsset method to create Model objects from the data in your stream.

pvr::assets::getLightHandle#

Function Documentation#

inline LightHandle pvr::assets::getLightHandle(ModelHandle model, uint32_t lightId)#

Create a Reference Counted Handle to a Light from a Model. The handle provided works as any other std::shared_ptr smart pointer, and uses the “shared ref count” feature that allows the created LightHandle to use the Model’s reference count (e.g. if the Light is copied, the Model’s reference count increases, and if all references to the Model are released, the Model will be kept alive by this reference.

Parameters:
  • model – The model to whom the Light we will create the handle for belongs

  • lightId – The ID of the Light inside model

Returns:

A LightHandle to the Light. It shares the ref counting of model

pvr::assets::readPOD#

Function Documentation#

void pvr::assets::readPOD(const ::pvr::Stream &stream, ::pvr::assets::Model &model)#

This class creates pvr::assets::Model object from Streams of POD Model data. Use the readAsset method to create Model objects from the data in your stream.

pvr::assets::getMaterialHandle#

Function Documentation#

inline MaterialHandle pvr::assets::getMaterialHandle(ModelHandle model, uint32_t materialId)#

Create a Reference Counted Handle to a Material from a Model. The handle provided works as any other std::shared_ptr smart pointer, and uses the “shared ref count” feature that allows the created MaterialHandle to use the Model’s reference count (e.g. if the Material is copied, the Model’s reference count increases, and if all references to the Model are released, the Model will be kept alive by this reference.

Parameters:
  • model – The model to whom the material we will create the handle for belongs

  • materialId – The ID of the material inside model

Returns:

A MaterialHandle to the Material. It shares the ref counting of model </returns

pvr::assets::isPOD#

Function Documentation#

bool pvr::assets::isPOD(const ::pvr::Stream &stream)#

Check if this reader supports the particular assetStream.

Parameters:

assetStream – The stream to check

Returns:

True if this reader supports the particular assetStream

pvr::assets::loadModel#

Function Documentation#

pvr::assets::ModelHandle pvr::assets::loadModel(const IAssetProvider &app, const std::string &modelFile)#

Load a model file using the provided scene file name.

Parameters:
  • app – An asset provider used to load the model file

  • modelFile

Returns:

Returns a successfully created pvr::assets::ModelHandle object otherwise will throw

pvr::assets::getMeshHandle#

Function Documentation#

inline MeshHandle pvr::assets::getMeshHandle(ModelHandle model, uint32_t meshId)#

Create a Reference Counted Handle to a Mesh from a Model. The handle provided works as any other std::shared_ptr smart pointer, and uses the “shared ref count” feature that allows the created MeshHandle to use the Model’s reference count (e.g. if the Mesh is copied, the Model’s reference count increases, and if all references to the Model are released, the Model will be kept alive by this reference.

Parameters:
  • model – The model to whom the mesh we will create the handle for belongs

  • meshId – The ID of the meshId inside model

Returns:

A MeshHandle to the Mesh. It shares the ref counting of model </returns

pvr::assets::utils::getBoundingBox#

Function Documentation#

inline math::AxisAlignedBox pvr::assets::utils::getBoundingBox(const Mesh &mesh)#

Return bounding box of a mesh.

It will be assumed that Vertex Position is a vec3 and has the semantic “POSITION”.

Parameters:

mesh – A mesh from which to get the bounding box of

Returns:

Axis-aligned bounding box

pvr::assets::utils::getBoundingBox#

Function Documentation#

inline math::AxisAlignedBox pvr::assets::utils::getBoundingBox(const Model &model)#

Return bounding box of a model.

It will be assumed that Vertex Position is a vec3 and has the semantic “POSITION”.

Parameters:

model – A model from which to get the bounding box of. All meshes will be considered.

Returns:

Axis-aligned bounding box

pvr::assets::utils::getBoundingBox#

Function Documentation#

inline math::AxisAlignedBox pvr::assets::utils::getBoundingBox(const Mesh &mesh, const char *positionSemanticName)#

Return bounding box of a mesh.

It will be assumed that Vertex Position is a vec3.

Parameters:
  • mesh – A mesh from which to get the bounding box of

  • positionSemanticName – Position attribute semantic name

Returns:

Axis-aligned bounding box

pvr::assets::utils::getBoundingBox#

Function Documentation#

inline math::AxisAlignedBox pvr::assets::utils::getBoundingBox(const char *data, size_t stride_bytes, size_t offset_bytes, size_t size_bytes)#

Return bounding box from vertex data.

Parameters:
  • data – Vertex data

  • stride_bytes – Vertex stride in bytes

  • offset_bytes – Offset to the vertex data

  • size_bytes – Data size

Returns:

The Axis-aligned bounding box of the data

pvr::tool::createSkyBox#

Function Documentation#

inline void pvr::tool::createSkyBox(float scale, bool adjustUV, uint32_t textureSize, std::vector<glm::vec3> &outVertices, std::vector<glm::vec2> &outUVs)#

Create a Skybox vertices and UVs for a specified texture size.

Parameters:
  • scale – scale the vertices

  • adjustUV

  • textureSize – size of the texture

  • outVertices – array of generated vertices

  • outUVs – array of generated UVs

pvr::tool::impl::setUV#

Function Documentation#

static inline void pvr::tool::impl::setUV(glm::vec2 &uv, float u, float v)#

pvr::tool::impl::setVertex#

Function Documentation#

static inline void pvr::tool::impl::setVertex(glm::vec3 &vertex, float x, float y, float z)#

pvr::assets::helper::getTextureNameWithExtension#

Function Documentation#

void pvr::assets::helper::getTextureNameWithExtension(std::string &textureName, bool astcSupported)#

Change a texture name to have .astc or .pvr extension depending on whether .astc format is supported or not.

param name=”astcSupported”>flag to know whether astc is supported

Parameters:

textureName – Texture name to analyse

pvr::assets::helper::getModelFormatFromFilename#

Function Documentation#

pvr::assets::ModelFileFormat pvr::assets::helper::getModelFormatFromFilename(const std::string &modelFile)#

Retrieves the model definition type using the extension of the given filename.

Parameters:

modelFile – The name of the model file to use for determining its model file format

pvr::assets::helper::VertexIndexRead#

Function Documentation#

void pvr::assets::helper::VertexIndexRead(const uint8_t *data, const IndexType type, uint32_t *const out)#

Read vertex index data into uin32 buffer.

Parameters:
  • data – Data to read from

  • type – Index type to read

  • out – of index data read

pvr::assets::helper::VertexRead#

Function Documentation#

void pvr::assets::helper::VertexRead(const uint8_t *data, const DataType type, uint32_t count, float *out)#

Read vertex data into float buffer.

Parameters:
  • data – Data to read from

  • type – Data type of the vertex to read

  • count – Number of vertices to read

  • out – Array of vertex read