Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
foray::scene::Primitive Struct Reference

"An object binding indexed or non-indexed geometry with a material." according to the glTF spec. It's a subset of a mesh and has its own set of vertices/indices as well as its own material. All mesh data is contained in one big buffer, so "First" is used to get the correct offset into the buffer. More...

#include <foray_mesh.hpp>

Public Types

enum class  EType { Vertex , Index }
 

Public Member Functions

 Primitive ()
 
 Primitive (EType type, uint32_t first, uint32_t count, int32_t materialIndex, int32_t highestRef, std::vector< foray::scene::Vertex > &vertices, std::vector< uint32_t > indices)
 
bool IsValid () const
 
void CmdDraw (VkCommandBuffer commandBuffer)
 
void CmdDrawInstanced (VkCommandBuffer commandBuffer, uint32_t instanceCount)
 

Public Attributes

EType Type = {}
 
uint32_t First = 0
 Index to the first index/vertex in a buffer.
 
uint32_t VertexOrIndexCount = 0
 Number of indices/vertices used for this primitive.
 
int32_t MaterialIndex = 0
 Index into the material buffer. Negative will cause use of fallback material.
 
uint32_t HighestReferencedIndex = 0
 The highest index into the vertex buffer referenced by this primitive. Used in Blas creation.
 
std::vector< foray::scene::VertexVertices
 
std::vector< uint32_t > Indices
 

Detailed Description

"An object binding indexed or non-indexed geometry with a material." according to the glTF spec. It's a subset of a mesh and has its own set of vertices/indices as well as its own material. All mesh data is contained in one big buffer, so "First" is used to get the correct offset into the buffer.

Member Enumeration Documentation

◆ EType

enum class foray::scene::Primitive::EType
strong
Enumerator
Vertex 
Index 

Constructor & Destructor Documentation

◆ Primitive() [1/2]

foray::scene::Primitive::Primitive ( )
inline

◆ Primitive() [2/2]

foray::scene::Primitive::Primitive ( EType  type,
uint32_t  first,
uint32_t  count,
int32_t  materialIndex,
int32_t  highestRef,
std::vector< foray::scene::Vertex > &  vertices,
std::vector< uint32_t >  indices 
)
inline

Member Function Documentation

◆ CmdDraw()

void foray::scene::Primitive::CmdDraw ( VkCommandBuffer  commandBuffer)

◆ CmdDrawInstanced()

void foray::scene::Primitive::CmdDrawInstanced ( VkCommandBuffer  commandBuffer,
uint32_t  instanceCount 
)

◆ IsValid()

bool foray::scene::Primitive::IsValid ( ) const
inline

Member Data Documentation

◆ First

uint32_t foray::scene::Primitive::First = 0

Index to the first index/vertex in a buffer.

◆ HighestReferencedIndex

uint32_t foray::scene::Primitive::HighestReferencedIndex = 0

The highest index into the vertex buffer referenced by this primitive. Used in Blas creation.

◆ Indices

std::vector<uint32_t> foray::scene::Primitive::Indices

◆ MaterialIndex

int32_t foray::scene::Primitive::MaterialIndex = 0

Index into the material buffer. Negative will cause use of fallback material.

◆ Type

EType foray::scene::Primitive::Type = {}

◆ VertexOrIndexCount

uint32_t foray::scene::Primitive::VertexOrIndexCount = 0

Number of indices/vertices used for this primitive.

◆ Vertices

std::vector<foray::scene::Vertex> foray::scene::Primitive::Vertices

The documentation for this struct was generated from the following file: