| 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 29 of file vertices_builder.cc.

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

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

## ◆ MakeUnskinned()

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

VerticesBuilder

Definition at line 25 of file vertices_builder.cc.

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

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 140 of file vertices_builder.cc.

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

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:23
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::ShaderType::kSignedByte
@ kSignedByte
impeller::ShaderType::kUnsignedShort
@ kUnsignedShort
impeller::ShaderType::kUnsignedByte
@ kUnsignedByte
impeller::scene::importer::kComponentTypes
static std::map< VerticesBuilder::ComponentType, VerticesBuilder::ComponentProperties > kComponentTypes
Definition: vertices_builder.cc:123
impeller::BlendSelectValues::kColor
@ kColor
impeller::ShaderType::kUnsignedInt
@ kUnsignedInt
impeller::ShaderType::kSignedShort
@ kSignedShort
impeller::ShaderType::kSignedInt
@ kSignedInt