| Flutter Impeller |

Classes | Public Member Functions | List of all members
impeller::scene::importer::SkinnedVerticesBuilder Class Referencefinal

`#include <vertices_builder.h>`

Inheritance diagram for impeller::scene::importer::SkinnedVerticesBuilder:

## Classes
struct | Vertex

## Public Member Functions
| SkinnedVerticesBuilder ()
virtual | ~SkinnedVerticesBuilder () override
void | WriteFBVertices (fb::MeshPrimitiveT &primitive) const override
void | SetAttributeFromBuffer (AttributeType attribute, ComponentType component_type, const void *buffer_start, size_t attribute_stride_bytes, size_t attribute_count) override
Public Member Functions inherited from impeller::scene::importer::VerticesBuilder
| VerticesBuilder ()
virtual | ~VerticesBuilder ()

## Additional Inherited Members
Public Types inherited from impeller::scene::importer::VerticesBuilder
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)>
Static Public Member Functions inherited from impeller::scene::importer::VerticesBuilder
static std::unique_ptr< VerticesBuilder > | MakeUnskinned ()
static std::unique_ptr< VerticesBuilder > | MakeSkinned ()
Static Protected Member Functions inherited from impeller::scene::importer::VerticesBuilder
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

SkinnedVerticesBuilder

Definition at line 135 of file vertices_builder.h.

## Constructor & Destructor Documentation

## ◆ SkinnedVerticesBuilder()

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

SkinnedVerticesBuilder

## ◆ ~SkinnedVerticesBuilder()

impeller::scene::importer::SkinnedVerticesBuilder::~SkinnedVerticesBuilder | ( |  | ) |
| override virtual default

## Member Function Documentation

## ◆ SetAttributeFromBuffer()

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

Implements impeller::scene::importer::VerticesBuilder.

Definition at line 220 of file vertices_builder.cc.

225 {
226 if (attribute_count > vertices_.size()) {
227 vertices_.resize(attribute_count, Vertex());
228 }
229 WriteAttribute(vertices_.data(), // destination
230 sizeof(Vertex), // destination_stride_bytes
231 attribute, // attribute
232 component_type, // component_type
233 buffer_start, // source
234 attribute_stride_bytes, // attribute_stride_bytes
235 attribute_count); // attribute_count
236 }

References impeller::scene::importer::VerticesBuilder::WriteAttribute().

## ◆ WriteFBVertices()

void impeller::scene::importer::SkinnedVerticesBuilder::WriteFBVertices | ( | fb::MeshPrimitiveT & | primitive | ) | const
| override virtual

Implements impeller::scene::importer::VerticesBuilder.

Definition at line 205 of file vertices_builder.cc.

206 {
207 auto vertex_buffer = fb::SkinnedVertexBufferT();
208 vertex_buffer.vertices.resize(0);
209 for (auto& v : vertices_) {
210 auto unskinned_attributes = fb::Vertex(
211 ToFBVec3(v.vertex.position), ToFBVec3(v.vertex.normal),
212 ToFBVec4(v.vertex.tangent), ToFBVec2(v.vertex.texture_coords),
213 ToFBColor(v.vertex.color));
214 vertex_buffer.vertices.push_back(fb::SkinnedVertex(
215 unskinned_attributes, ToFBVec4(v.joints), ToFBVec4(v.weights)));
216 }
217 primitive.vertices.Set(std::move(vertex_buffer));
218 }

References impeller::scene::importer::ToFBColor(), impeller::scene::importer::ToFBVec2(), impeller::scene::importer::ToFBVec3(), and impeller::scene::importer::ToFBVec4().

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

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

impeller::scene::importer::ToFBVec2
fb::Vec2 ToFBVec2(const Vector2 v)
Definition: conversions.cc:70
impeller::scene::importer::ToFBVec3
fb::Vec3 ToFBVec3(const Vector3 v)
Definition: conversions.cc:74
impeller::scene::importer::ToFBColor
fb::Color ToFBColor(const Color c)
Definition: conversions.cc:82
impeller::scene::importer::VerticesBuilder::WriteAttribute
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)
Definition: vertices_builder.cc:139
impeller::scene::importer::ToFBVec4
fb::Vec4 ToFBVec4(const Vector4 v)
Definition: conversions.cc:78