@@ -135,6 +135,7 @@ struct SContext
135
135
136
136
core::vector<hlsl::float32_t3> vertices;
137
137
core::vector<hlsl::float32_t3> normals;
138
+ core::vector<uint32_t > colors;
138
139
core::vector<uint32_t > indices;
139
140
};
140
141
@@ -243,7 +244,7 @@ SAssetBundle CSTLMeshFileLoader::loadAsset(system::IFile* _file, const IAssetLoa
243
244
uint32_t newIdx = static_cast <uint32_t >(context.vertices .size ());
244
245
vertexMap[p] = newIdx;
245
246
context.indices .push_back (newIdx);
246
- context.vertices .push_back (p );
247
+ context.vertices .emplace_back ( std::move (p) );
247
248
}
248
249
else
249
250
{
@@ -271,7 +272,7 @@ SAssetBundle CSTLMeshFileLoader::loadAsset(system::IFile* _file, const IAssetLoa
271
272
const void * srcColor[1 ]{ &attrib };
272
273
uint32_t color{};
273
274
convertColor<EF_A1R5G5B5_UNORM_PACK16, EF_B8G8R8A8_UNORM>(srcColor, &color, 0u , 0u );
274
- colors.push_back (color);
275
+ context. colors .push_back (color);
275
276
}
276
277
else
277
278
{
@@ -290,7 +291,12 @@ SAssetBundle CSTLMeshFileLoader::loadAsset(system::IFile* _file, const IAssetLoa
290
291
geometry->setPositionView (createView (E_FORMAT::EF_R32G32B32_SFLOAT, context.vertices .size (), context.vertices .data ()));
291
292
geometry->setNormalView (createView (E_FORMAT::EF_R32G32B32_SFLOAT, context.normals .size (), context.normals .data ()));
292
293
293
- // TODO: Vertex colors
294
+ if (!context.colors .empty ())
295
+ {
296
+ // I'm still not sure if this works, probably not
297
+ auto colorsView = createView (EF_A1R5G5B5_UNORM_PACK16, context.colors .size (), context.colors .data ());
298
+ geometry->getAuxAttributeViews ()->push_back (colorsView);
299
+ }
294
300
295
301
CPolygonGeometryManipulator::recomputeContentHashes (geometry.get ());
296
302
CPolygonGeometryManipulator::recomputeRanges (geometry.get ());
0 commit comments