| Flutter Impeller |

Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
impeller::scene::importer::VerticesBuilder Class Referenceabstract

`#include <vertices_builder.h>`

Inheritance diagram for impeller::scene::importer::VerticesBuilder:

## Classes
struct | AttributeProperties
struct | ComponentProperties

## Public Types
enum | ComponentType { ComponentType::kSignedByte = 5120, ComponentType::kUnsignedByte, ComponentType::kSignedShort, ComponentType::kUnsignedShort, ComponentType::kSignedInt, ComponentType::kUnsignedInt, ComponentType::kFloat }
enum | AttributeType { AttributeType::kPosition, AttributeType::kNormal, AttributeType::kTangent, AttributeType::kTextureCoords, AttributeType::kColor, AttributeType::kJoints, AttributeType::kWeights }
using | ComponentConverter = std::function< Scalar(const void *source, size_t byte_offset, bool normalized)>
using | AttributeWriter = std::function< void(Scalar *destination, const void *source, const ComponentProperties &component_props, const AttributeProperties &attribute_props)>

## Public Member Functions
| VerticesBuilder ()
virtual | ~VerticesBuilder ()
virtual void | WriteFBVertices (fb::MeshPrimitiveT &primitive) const =0
virtual void | SetAttributeFromBuffer (AttributeType attribute, ComponentType component_type, const void *buffer_start, size_t attribute_stride_bytes, size_t attribute_count)=0

## Static Public Member Functions
static std::unique_ptr< VerticesBuilder > | MakeUnskinned ()
static std::unique_ptr< VerticesBuilder > | MakeSkinned ()

## Static Protected Member Functions
static void | WriteAttribute (void *destination, size_t destination_stride_bytes, AttributeType attribute, ComponentType component_type, const void *source, size_t attribute_stride_bytes, size_t attribute_count)

## Detailed Description

VerticesBuilder

Definition at line 22 of file vertices_builder.h.

## Member Typedef Documentation

## ◆ AttributeWriter

using impeller::scene::importer::VerticesBuilder::AttributeWriter = std::function<void(Scalar* destination, const void* source, const ComponentProperties& component_props, const AttributeProperties& attribute_props)>

Definition at line 60 of file vertices_builder.h.

## ◆ ComponentConverter

using impeller::scene::importer::VerticesBuilder::ComponentConverter = std::function< Scalar(const void* source, size_t byte_offset, bool normalized)>

Definition at line 49 of file vertices_builder.h.

## Member Enumeration Documentation

## ◆ AttributeType

enum impeller::scene::importer::VerticesBuilder::AttributeType
| strong

Enumerator
kPosition |
kNormal |
kTangent |
kTextureCoords |
kColor |
kJoints |
kWeights |

Definition at line 38 of file vertices_builder.h.

38 {
39 kPosition,
40 kNormal,
41 kTangent,
42 kTextureCoords,
43 kColor,
44 kJoints,
45 kWeights,
46 };

## ◆ ComponentType

enum impeller::scene::importer::VerticesBuilder::ComponentType
| strong

Enumerator
kSignedByte |
kUnsignedByte |
kSignedShort |
kUnsignedShort |
kSignedInt |
kUnsignedInt |
kFloat |

Definition at line 28 of file vertices_builder.h.

28 {
29 kSignedByte = 5120,
30 kUnsignedByte,
31 kSignedShort,
32 kUnsignedShort,
33 kSignedInt,
34 kUnsignedInt,
35 kFloat,
36 };

## Constructor & Destructor Documentation

## ◆ VerticesBuilder()

impeller::scene::importer::VerticesBuilder::VerticesBuilder | ( |  | ) |
| default

## ◆ ~VerticesBuilder()

impeller::scene::importer::VerticesBuilder::~VerticesBuilder | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ MakeSkinned()

std::unique_ptr< VerticesBuilder > impeller::scene::importer::VerticesBuilder::MakeSkinned | ( |  | ) |
| static

Definition at line 28 of file vertices_builder.cc.

28 {
29 return std::make_unique<SkinnedVerticesBuilder>();
30 }

Referenced by impeller::scene::importer::ProcessMeshPrimitive().

## ◆ MakeUnskinned()

std::unique_ptr< VerticesBuilder > impeller::scene::importer::VerticesBuilder::MakeUnskinned | ( |  | ) |
| static

VerticesBuilder

Definition at line 24 of file vertices_builder.cc.

24 {
25 return std::make_unique<UnskinnedVerticesBuilder>();
26 }

Referenced by impeller::scene::importer::ProcessMeshPrimitive().

## ◆ SetAttributeFromBuffer()

virtual void impeller::scene::importer::VerticesBuilder::SetAttributeFromBuffer | ( | AttributeType | attribute,
|  | ComponentType | component_type,
|  | const void * | buffer_start,
|  | size_t | attribute_stride_bytes,
|  | size_t | attribute_count
| ) |  |
| pure virtual

Implemented in impeller::scene::importer::SkinnedVerticesBuilder, and impeller::scene::importer::UnskinnedVerticesBuilder.

## ◆ WriteAttribute()

void impeller::scene::importer::VerticesBuilder::WriteAttribute | ( | void * | destination,
|  | size_t | destination_stride_bytes,
|  | AttributeType | attribute,
|  | ComponentType | component_type,
|  | const void * | source,
|  | size_t | attribute_stride_bytes,
|  | size_t | attribute_count
| ) |  |
| static protected

Definition at line 139 of file vertices_builder.cc.

145 {
146 const ComponentProperties& component_props = kComponentTypes[component_type];
147 const AttributeProperties& attribute_props = kAttributeTypes[attribute];
148 for (size_t i = 0; i < attribute_count; i++) {
149 const uint8_t* src =
150 reinterpret_cast<const uint8_t*>(source) + attribute_stride_bytes * i;
151 uint8_t* dst = reinterpret_cast<uint8_t*>(destination) +
152 i * destination_stride_bytes + attribute_props.offset_bytes;
153
154 attribute_props.write_proc(reinterpret_cast<Scalar*>(dst), src,
155 component_props, attribute_props);
156 }
157 }

References impeller::scene::importer::kComponentTypes, impeller::scene::importer::VerticesBuilder::AttributeProperties::offset_bytes, and impeller::scene::importer::VerticesBuilder::AttributeProperties::write_proc.

Referenced by impeller::scene::importer::UnskinnedVerticesBuilder::SetAttributeFromBuffer(), and impeller::scene::importer::SkinnedVerticesBuilder::SetAttributeFromBuffer().

## ◆ WriteFBVertices()

virtual void impeller::scene::importer::VerticesBuilder::WriteFBVertices | ( | fb::MeshPrimitiveT & | primitive | ) | const
| pure virtual

Implemented in impeller::scene::importer::SkinnedVerticesBuilder, and impeller::scene::importer::UnskinnedVerticesBuilder.

The documentation for this class was generated from the following files:

- impeller/scene/importer/vertices_builder.h
- impeller/scene/importer/vertices_builder.cc

impeller::kFloat
@ kFloat
Definition: runtime_types.h:24
impeller::Scalar
float Scalar
Definition: scalar.h:15
impeller::kUnsignedShort
@ kUnsignedShort
Definition: runtime_types.h:18
impeller::kSignedByte
@ kSignedByte
Definition: runtime_types.h:15
impeller::kColor
@ kColor
Definition: geometry.h:27
impeller::scene::importer::kComponentTypes
static std::map< VerticesBuilder::ComponentType, VerticesBuilder::ComponentProperties > kComponentTypes
Definition: vertices_builder.cc:122
impeller::kSignedInt
@ kSignedInt
Definition: runtime_types.h:19
impeller::kUnsignedByte
@ kUnsignedByte
Definition: runtime_types.h:16
impeller::kUnsignedInt
@ kUnsignedInt
Definition: runtime_types.h:20
impeller::kSignedShort
@ kSignedShort
Definition: runtime_types.h:17
impeller::kPosition
@ kPosition
Definition: geometry.h:26