• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PredatorCZ / HavokLib / 90

07 Nov 2025 09:36AM UTC coverage: 62.461% (-1.4%) from 63.837%
90

push

github

PredatorCZ
add support for scene data

556 of 1153 new or added lines in 22 files covered. (48.22%)

205 existing lines in 35 files now uncovered.

2777 of 4446 relevant lines covered (62.46%)

124997.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/source/xml/hkx_mesh.cpp
1
/*  Havok Format Library
2
    Copyright(C) 2016-2025 Lukas Cone
3

4
    This program is free software : you can redistribute it and / or modify
5
    it under the terms of the GNU General Public License as published by
6
    the Free Software Foundation, either version 3 of the License, or
7
    (at your option) any later version.
8

9
    This program is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
12
    GNU General Public License for more details.
13

14
    You should have received a copy of the GNU General Public License
15
    along with this program.If not, see <https://www.gnu.org/licenses/>.
16
*/
17

18
#include "internal/hkx_mesh.hpp"
19
#include "base.hpp"
20
#include <span>
21

22
static const char *INDEX_TYPE[]{
23
    "INDEX_TYPE_INVALID",
24
    "INDEX_TYPE_TRI_LIST",
25
    "INDEX_TYPE_TRI_STRIP",
26
    "INDEX_TYPE_TRI_FAN",
27
};
28

29
static const char *DATA_TYPE[]{
30
    /**/ //
31
    "HKX_DT_NONE",
32
    "HKX_DT_UINT8",
33
    "HKX_DT_INT16",
34
    "HKX_DT_UINT32",
35
    "HKX_DT_FLOAT",
36
    "HKX_DT_FLOAT2",
37
    "HKX_DT_FLOAT3",
38
    "HKX_DT_FLOAT4",
39
};
40

41
static const char *DATA_USAGE[]{
42
    /**/ //
43
    "HKX_DU_NONE",
44
    "HKX_DU_POSITION",
45
    "HKX_DU_COLOR",
46
    "HKX_DU_NORMAL",
47
    "HKX_DU_TANGENT",
48
    "HKX_DU_BINORMAL",
49
    "HKX_DU_TEXCOORD",
50
    "HKX_DU_BLENDWEIGHTS",
51
    "HKX_DU_BLENDINDICES",
52
    "HKX_DU_USERDATA",
53
};
54

NEW
55
void hkxVertexAnimationInternalInterface::ToXML(XMLHandle hdl) const {}
×
56

NEW
57
void hkxVertexDescriptionInternalInterface::ToXML(XMLHandle hdl) const {
×
58
  //::ToXML("stride", Stride(), *hdl.node);
NEW
59
  auto declsNode = ToXMLArray("decls", GetNumDecls(), *hdl.node);
×
60

NEW
61
  for (auto decl : Decls()) {
×
NEW
62
    auto obj = declsNode.append_child(_hkObject);
×
NEW
63
    ::ToXML("byteOffset", decl.byteOffset, obj);
×
NEW
64
    ::ToXML("type", DATA_TYPE[uint32(decl.type)], obj);
×
NEW
65
    ::ToXML("dataUsage", DATA_USAGE[uint32(std::log2(uint32(decl.usage)))],
×
66
            obj);
67
  }
68
}
69

NEW
70
void hkxIndexBufferInternalInterface::ToXML(XMLHandle hdl) const {
×
NEW
71
  ::ToXML("indexType", INDEX_TYPE[uint32(GetIndexType())], *hdl.node);
×
NEW
72
  uint32 numFaces = Length();
×
73

NEW
74
  if (Is32Bit()) {
×
NEW
75
    std::span<const uint32> data(reinterpret_cast<const uint32 *>(Indices()),
×
NEW
76
                                 numFaces);
×
NEW
77
    auto indices = ToXMLArray("indices32", numFaces, *hdl.node);
×
NEW
78
    ::ToXML(data, indices);
×
79
  } else {
NEW
80
    std::span<const uint16> data(reinterpret_cast<const uint16 *>(Indices()),
×
NEW
81
                                 numFaces);
×
NEW
82
    auto indices = ToXMLArray("indices16", numFaces, *hdl.node);
×
NEW
83
    ::ToXML(data, indices);
×
84
  }
85

NEW
86
  ::ToXML("vertexBaseOffset", VerrtexBaseOffset(), *hdl.node);
×
NEW
87
  ::ToXML("length", numFaces, *hdl.node);
×
88
}
89

NEW
90
void hkxVertexBufferInternalInterface::ToXML(XMLHandle hdl) const {
×
NEW
91
  auto vtxData = ToXMLArray("vertexData", NumVertices(), *hdl.node);
×
92
  // TODO dump homogenous classes
93

NEW
94
  ::ToXML("vertexDesc", VertexDesc(), *hdl.node);
×
95
}
96

NEW
97
void hkxMeshSectionInternalInterface::ToXML(XMLHandle hdl) const {
×
NEW
98
  ::ToXML("vertexBuffer", VertexBuffer(), *hdl.node);
×
NEW
99
  auto channels = ToXMLArray("userChannels", GetNumUserChannels(), *hdl.node);
×
NEW
100
  ::ToXML(IndexBuffers(), channels);
×
101
}
102

NEW
103
void hkxMeshInternalInterface::ToXML(XMLHandle hdl) const {
×
NEW
104
  auto sections = ToXMLArray("sections", GetNumSections(), *hdl.node);
×
NEW
105
  ::ToXML(Sections(), sections);
×
106

107
  auto userChanInfos =
NEW
108
      ToXMLArray("userChannelInfos", GetNumUserChannelInfos(), *hdl.node);
×
109
  // TODO ::ToXML(UserInfos(), userChanInfos);
110
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc