Bifrost SDK
Bifrost SDK documentation
Mesh functions

Functions

Amino::Ptr< Bifrost::Object > BIFROST_GEOMETRY_DECL Bifrost::Geometry::getMeshPrototype ()
 Returns the prototypical mesh object. More...
 
void BIFROST_GEOMETRY_DECL Bifrost::Geometry::populateMesh (Bifrost::Object &object)
 Populate an object with the required properties to conform to the Mesh geometry schema. More...
 
bool BIFROST_GEOMETRY_DECL Bifrost::Geometry::populateMesh (Amino::Ptr< Amino::Array< Bifrost::Math::float3 > > positions, Amino::Ptr< Amino::Array< Bifrost::Geometry::Index > > face_vertices, Amino::Ptr< Amino::Array< Bifrost::Geometry::Index > > face_offsets, Bifrost::Object &object)
 Populate an object with the required properties to conform to the Mesh geometry schema. More...
 
void BIFROST_GEOMETRY_DECL Bifrost::Geometry::populateCubeMesh (float width, Bifrost::Object &object)
 Populate an object with the properties and values required to define a six-sided cube mesh. More...
 
void BIFROST_GEOMETRY_DECL Bifrost::Geometry::populateSphereMesh (float radius, Bifrost::Object &object)
 Populate an object with the properties of a mesh sphere. More...
 
void BIFROST_GEOMETRY_DECL Bifrost::Geometry::populatePlaneMesh (float width, unsigned subdivisions, Bifrost::Object &object)
 Populate an object with the properties and values required to define a unit plane with the requested subdivisions on the X and Z axes. More...
 

Detailed Description

Functions for creating Mesh geometry objects.

Function Documentation

◆ getMeshPrototype()

Amino::Ptr< Bifrost::Object > BIFROST_GEOMETRY_DECL Bifrost::Geometry::getMeshPrototype ( )

Returns the prototypical mesh object.

The returned pointer may be used in conjunction with Bifrost::Object::isA to determine if an object conforms to the mesh schema. The returned object may not be modified.

Amino::Ptr< Bifrost::Object > obj = getSomeObject();
if( Bifrost::Object::isA(obj.get(), mesh.get()) ) {
std::cout << "I have a mesh object";
}
Amino::Ptr<Bifrost::Object> emptyMesh = mesh.toMutable();
// emptyMesh is new, empty mesh that is non-const, i.e. writeable
Amino::Ptr< Bifrost::Object > BIFROST_GEOMETRY_DECL getMeshPrototype()
Returns the prototypical mesh object.
element_type const * get() const noexcept
Accessor.
Definition: Ptr.h:1282
static bool isA(Object const &object, Object const &prototype)
Check if a given object contains all of the properties of the specified prototype.
Returns
The mesh prototype

◆ populateCubeMesh()

void BIFROST_GEOMETRY_DECL Bifrost::Geometry::populateCubeMesh ( float  width,
Bifrost::Object object 
)

Populate an object with the properties and values required to define a six-sided cube mesh.

Parameters
[in]widthWidth of the cube.
[in,out]objectMesh geometry object to be populated.

◆ populateMesh() [1/2]

bool BIFROST_GEOMETRY_DECL Bifrost::Geometry::populateMesh ( Amino::Ptr< Amino::Array< Bifrost::Math::float3 > >  positions,
Amino::Ptr< Amino::Array< Bifrost::Geometry::Index > >  face_vertices,
Amino::Ptr< Amino::Array< Bifrost::Geometry::Index > >  face_offsets,
Bifrost::Object object 
)

Populate an object with the required properties to conform to the Mesh geometry schema.

The mesh is initialized with the specified data arrays.

For example, to define a mesh that contains two triangles covering the unit square:

Amino::newClassPtr<Amino::Array<Bifrost::Math::float>>();
// Four vertices that correspond to the points of the unit square
*pos = { {0f,0f,0f}, {1f,0f,0f}, {1f,1f,0f}, {0f,1f,0f} };
Amino::newClassPtr<Amino::Array<Bifrost::Geometry::Index>>();
// Six face vertices, three for each face. Face 0 uses vertices 0, 1, 2 and
// face 1 uses vertices 0, 2, 3.
*faceVert = { 0, 1, 2, 0, 2, 3 };
Amino::newClassPtr<Amino::Array<Bifrost::Geometry::Index>>();
// There are two faces in the mesh so the faceOffset array contains 2
elements plus
// one extra pointing to one past the last element in the faceVert array.
*faceOffset = { 0, 3, 6 };
populateMesh( pos, faceVert, faceOffset, obj.get() );
void BIFROST_GEOMETRY_DECL populateMesh(Bifrost::Object &object)
Populate an object with the required properties to conform to the Mesh geometry schema.
Amino::MutablePtr< Object > createObject()
Construct a new Object.
Parameters
[in]positionsThe vertex positions of the new mesh.
[in]face_verticesThe face vertices of the new mesh.
[in]face_offsetsThe face offsets of the new mesh.
[in,out]objectMesh geometry object to be populated.
Returns
true if the object successfully initialized with the specified data arrays, false if errors were encountered. If false, object is left in an undefined state.

◆ populateMesh() [2/2]

void BIFROST_GEOMETRY_DECL Bifrost::Geometry::populateMesh ( Bifrost::Object object)

Populate an object with the required properties to conform to the Mesh geometry schema.

The mesh is initially empty.

Parameters
[in,out]objectMesh geometry object to be populated.

◆ populatePlaneMesh()

void BIFROST_GEOMETRY_DECL Bifrost::Geometry::populatePlaneMesh ( float  width,
unsigned  subdivisions,
Bifrost::Object object 
)

Populate an object with the properties and values required to define a unit plane with the requested subdivisions on the X and Z axes.

Parameters
[in]widthWidth of the plane.
[in]subdivisionsNumber of X and Z subdivisions. Minimum is one.
[in,out]objectMesh geometry object to be populated.

◆ populateSphereMesh()

void BIFROST_GEOMETRY_DECL Bifrost::Geometry::populateSphereMesh ( float  radius,
Bifrost::Object object 
)

Populate an object with the properties of a mesh sphere.

Parameters
[in]radiusRadius of the sphere.
[in,out]objectMesh geometry object to be populated.