Skip to content

Commit

Permalink
fix(Mesh): update to new polygon API
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Jun 7, 2024
1 parent f075664 commit da59f57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/zenkit-capi/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ ZKC_API ZkVec3f ZkLightMap_getNormal(ZkLightMap const* slf, ZkSize i);

ZKC_API uint32_t ZkPolygon_getMaterialIndex(ZkPolygon const* slf);
ZKC_API int32_t ZkPolygon_getLightMapIndex(ZkPolygon const* slf);
ZKC_API uint32_t const* ZkPolygon_getPositionIndices(ZkPolygon const* slf, ZkSize* count);
ZKC_API uint32_t const* ZkPolygon_getFeatureIndices(ZkPolygon const* slf, ZkSize* count);
ZKC_API uint32_t const* ZkPolygon_getPositionIndices(ZkPolygon const* slf, ZkMesh const* msh, ZkSize* count);
ZKC_API uint32_t const* ZkPolygon_getFeatureIndices(ZkPolygon const* slf, ZkMesh const* msh, ZkSize* count);
ZKC_API ZkBool ZkPolygon_getIsPortal(ZkPolygon const* slf);
ZKC_API ZkBool ZkPolygon_getIsOccluder(ZkPolygon const* slf);
ZKC_API ZkBool ZkPolygon_getIsSector(ZkPolygon const* slf);
Expand Down
2 changes: 2 additions & 0 deletions src/Internal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <zenkit/Archive.hh>
#include "zenkit-capi/Archive.h"

#include <algorithm>

#define ZKC_LOADER(cls) \
cls* cls##_load(ZkRead* buf) { \
if (buf == nullptr) { \
Expand Down
12 changes: 6 additions & 6 deletions src/Mesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,20 @@ int32_t ZkPolygon_getLightMapIndex(ZkPolygon const* slf) {
return slf->lightmap;
}

uint32_t const* ZkPolygon_getPositionIndices(ZkPolygon const* slf, ZkSize* count) {
uint32_t const* ZkPolygon_getPositionIndices(ZkPolygon const* slf, ZkMesh const* msh, ZkSize* count) {
ZKC_TRACE_FN();
ZKC_CHECK_NULL(slf, count);

*count = slf->vertices.size();
return slf->vertices.data();
*count = slf->index_count;
return &msh->polygon_vertex_indices[slf->index_offset];
}

uint32_t const* ZkPolygon_getFeatureIndices(ZkPolygon const* slf, ZkSize* count) {
uint32_t const* ZkPolygon_getFeatureIndices(ZkPolygon const* slf, ZkMesh const* msh, ZkSize* count) {
ZKC_TRACE_FN();
ZKC_CHECK_NULL(slf, count);

*count = slf->features.size();
return slf->features.data();
*count = slf->index_count;
return &msh->polygon_feature_indices[slf->index_offset];
}

ZkBool ZkPolygon_getIsPortal(ZkPolygon const* slf) {
Expand Down

0 comments on commit da59f57

Please sign in to comment.