Skip to content

Commit

Permalink
updated openfbx
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Sep 6, 2023
1 parent 6fa5ece commit f440783
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions external/openfbx/ofbx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ static int codeIndex(int idx, bool last)
return last ? (-idx - 1) : idx;
}

template <typename T>
static T& emplace_back(std::vector<T>& vec) {
vec.emplace_back();
return vec.back();
}

struct Allocator {
struct Page {
struct {
Expand Down Expand Up @@ -432,7 +438,7 @@ struct ParseDataJob {
};

template <typename T> [[nodiscard]] bool pushJob(std::vector<ParseDataJob>& jobs, Property& prop, std::vector<T>& data) {
ParseDataJob& job = jobs.emplace_back();
ParseDataJob& job = emplace_back(jobs);
job.property = &prop;
job.data = (void*)&data;
job.f = [](Property* prop, void* data){ return parseVecData(*prop, (std::vector<T>*)data); };
Expand Down Expand Up @@ -1207,7 +1213,7 @@ struct GeometryDataImpl : GeometryData {

bool postprocess() {
if (materials.empty()) {
GeometryPartitionImpl& partition = partitions.emplace_back();
GeometryPartitionImpl& partition = emplace_back(partitions);
int polygon_count = 0;
for (int i : positions.indices) {
if (i < 0) ++polygon_count;
Expand Down

0 comments on commit f440783

Please sign in to comment.