7#pragma warning(disable:4127 4804)
8#elif defined ( __clang__ )
9#pragma clang diagnostic push
10#pragma clang diagnostic ignored "-Wignored-qualifiers"
11#pragma clang diagnostic ignored "-Wdeprecated-this-capture"
12#pragma clang diagnostic ignored "-Wignored-qualifiers"
14#include "draco/mesh/mesh.h"
17#elif defined ( __clang__ )
18#pragma clang diagnostic pop
21#include "Serialization/JsonParser.h"
22#include "Foundation/Memory/MemoryBuffer.h"
32 void initAttributes(
const GltfLoader::Object& properties);
34 const GltfLoader::Object& attributeObject,
bool skipNormals);
36 void processVertexColors(draco::Mesh* dmesh, std::vector<Cogs::Core::GltfLoader::VertexStream>& vertexStreams,
GltfLoader::VertexStreamsState& streamsState);
37 void processTextureCoords(draco::Mesh* dmesh, std::vector<Cogs::Core::GltfLoader::VertexStream>& vertexStreams,
GltfLoader::VertexStreamsState& streamsState);
42 void getAttributeData(
const draco::Mesh* dmesh,
const draco::PointAttribute* attr,
GltfLoader::VertexStream& targetVertexStream)
44 assert(attr->IsValid() &&
"Internal error");
46 const uint32_t numComponents = attr->num_components();
47 const uint32_t numPoints = dmesh->num_points();
48 const uint32_t numValues = numPoints * numComponents;
49 const uint32_t stride =
static_cast<uint32_t
>(attr->byte_stride());
51 std::vector<T> vectors;
52 vectors.reserve(numValues);
53 std::vector<T> value(numComponents, -2);
55 for (draco::PointIndex i(0); i < numPoints; ++i) {
56 const draco::AttributeValueIndex val_index = attr->mapped_index(i);
57 if (!attr->ConvertValue<T>(val_index, &value[0])) {
58 assert(
false &&
"Internal error. Could not convert Draco attribute value.");
61 for (uint32_t j = 0; j < numComponents; ++j) {
62 vectors.emplace_back(value[j]);
67 uint8_t* buf =
reinterpret_cast<uint8_t*
>(this->decompressedAttributes.back().data());
68 memcpy(buf, &vectors[0], numValues *
sizeof(T));
71 targetVertexStream.formatSize = stride;
72 targetVertexStream.offset = 0;
75 int bufferViewIdx = -1;
76 int attrPositionIdx = -1;
77 int attrNormalIdx = -1;
78 int attrTangentIdx = -1;
79 std::vector<int> attrTexCoordIndices;
80 std::vector<int> attrColorIndices;
85 std::vector<Memory::MemoryBuffer> decompressedAttributes;
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....