Flutter Engine
The Flutter Engine
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:
impeller::scene::importer::VerticesBuilder

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 ()
 
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
 

Additional Inherited Members

- Public Types inherited from impeller::scene::importer::VerticesBuilder
enum class  ComponentType {
  kSignedByte = 5120 , kUnsignedByte , kSignedShort , kUnsignedShort ,
  kSignedInt , kUnsignedInt , kFloat
}
 
enum class  AttributeType {
  kPosition , kNormal , kTangent , kTextureCoords ,
  kColor , kJoints , 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< VerticesBuilderMakeUnskinned ()
 
static std::unique_ptr< VerticesBuilderMakeSkinned ()
 
- 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 139 of file vertices_builder.h.

Constructor & Destructor Documentation

◆ SkinnedVerticesBuilder()

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

◆ ~SkinnedVerticesBuilder()

impeller::scene::importer::SkinnedVerticesBuilder::~SkinnedVerticesBuilder ( )
overridevirtualdefault

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 
)
overridevirtual

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

Definition at line 221 of file vertices_builder.cc.

226 {
227 if (attribute_count > vertices_.size()) {
228 vertices_.resize(attribute_count, Vertex());
229 }
230 WriteAttribute(vertices_.data(), // destination
231 sizeof(Vertex), // destination_stride_bytes
232 attribute, // attribute
233 component_type, // component_type
234 buffer_start, // source
235 attribute_stride_bytes, // attribute_stride_bytes
236 attribute_count); // attribute_count
237}
GrTriangulator::Vertex Vertex
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)

◆ WriteFBVertices()

void impeller::scene::importer::SkinnedVerticesBuilder::WriteFBVertices ( fb::MeshPrimitiveT &  primitive) const
overridevirtual

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

Definition at line 206 of file vertices_builder.cc.

207 {
208 auto vertex_buffer = fb::SkinnedVertexBufferT();
209 vertex_buffer.vertices.resize(0);
210 for (auto& v : vertices_) {
211 auto unskinned_attributes = fb::Vertex(
212 ToFBVec3(v.vertex.position), ToFBVec3(v.vertex.normal),
213 ToFBVec4(v.vertex.tangent), ToFBVec2(v.vertex.texture_coords),
214 ToFBColor(v.vertex.color));
215 vertex_buffer.vertices.push_back(fb::SkinnedVertex(
216 unskinned_attributes, ToFBVec4(v.joints), ToFBVec4(v.weights)));
217 }
218 primitive.vertices.Set(std::move(vertex_buffer));
219}
fb::Vec3 ToFBVec3(const Vector3 v)
Definition: conversions.cc:74
fb::Vec4 ToFBVec4(const Vector4 v)
Definition: conversions.cc:78
fb::Vec2 ToFBVec2(const Vector2 v)
Definition: conversions.cc:70
fb::Color ToFBColor(const Color c)
Definition: conversions.cc:82

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