| 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 23 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 61 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 50 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 39 of file vertices_builder.h.

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

## ◆ ComponentType

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

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

Definition at line 29 of file vertices_builder.h.

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

## 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::kColor
@ kColor
Definition: geometry.h:51
impeller::scene::importer::kComponentTypes
static std::map< VerticesBuilder::ComponentType, VerticesBuilder::ComponentProperties > kComponentTypes
Definition: vertices_builder.cc:123
impeller::ShaderType::kUnsignedInt
@ kUnsignedInt
impeller::ShaderType::kSignedShort
@ kSignedShort
impeller::ShaderType::kSignedInt
@ kSignedInt
impeller::kPosition
@ kPosition
Definition: geometry.h:50