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

PredatorCZ / HavokLib / 91

07 Nov 2025 05:44PM UTC coverage: 62.489% (+0.03%) from 62.461%
91

push

github

PredatorCZ
add support for scene data

556 of 1151 new or added lines in 22 files covered. (48.31%)

21 existing lines in 5 files now uncovered.

2777 of 4444 relevant lines covered (62.49%)

125162.98 hits per line

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

0.0
/source/xml/hkx_material.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_material.hpp"
19
#include "base.hpp"
20

21
static const char *TEX_TYPES[]{
22
    /**/ //
23
    "TEX_UNKNOWN",
24
    "TEX_DIFFUSE",
25
    "TEX_REFLECTION",
26
    "TEX_BUMP",
27
    "TEX_NORMAL",
28
    "TEX_DISPLACEMENT",
29
    "TEX_SPECULAR",
30
    "TEX_SPECULARANDGLOSS",
31
    "TEX_OPACITY",
32
    "TEX_EMISSIVE",
33
    "TEX_REFRACTION",
34
    "TEX_GLOSS",
35
    "TEX_NOTEXPORTED",
36
};
37

NEW
38
void hkxMaterialInternalInterface::ToXML(XMLHandle hdl) const {
×
NEW
39
  hkxAttributeHolderInternalInterface::ToXML(hdl);
×
NEW
40
  ::ToXML(_hkName, Name(), *hdl.node);
×
41

NEW
42
  auto stages = ToXMLArray("stages", GetNumStages(), *hdl.node);
×
43

NEW
44
  for (hkxMaterialTextureStage s : Stages()) {
×
NEW
45
    auto obj = stages.append_child(_hkObject);
×
NEW
46
    ::ToXML("texture", s.texture, obj, hdl.toolset);
×
NEW
47
    ::ToXML("usageHint", TEX_TYPES[uint32(s.usageHint)], obj);
×
NEW
48
    ::ToXML("tcoordChannel", s.tcoordChannel, obj);
×
49
  }
50

NEW
51
  std::string buffer = std::to_string(DiffuseColor());
×
NEW
52
  ::ToXML("diffuseColor", buffer, *hdl.node);
×
NEW
53
  buffer = std::to_string(AmbientColor());
×
NEW
54
  ::ToXML("ambientColor", buffer, *hdl.node);
×
NEW
55
  buffer = std::to_string(SpecularColor());
×
NEW
56
  ::ToXML("specularColor", buffer, *hdl.node);
×
NEW
57
  buffer = std::to_string(EmissiveColor());
×
NEW
58
  ::ToXML("emissiveColor", buffer, *hdl.node);
×
59

NEW
60
  auto subMats = ToXMLArray("subMaterials", GetNumSubMaterials(), *hdl.node);
×
61
  buffer.clear();
62

NEW
63
  for (auto &&s : SubMaterials()) {
×
64
    std::string _buffer;
NEW
65
    PointerToString(s->GetPointer(), _buffer);
×
66
    buffer += _buffer;
NEW
67
    buffer.push_back(' ');
×
68
  }
69

70
  static const char *ident = "\n\t\t\t\t";
71

NEW
72
  if (buffer.size()) {
×
73
    buffer.pop_back();
NEW
74
    buffer += ident;
×
75
    buffer.pop_back();
NEW
76
    subMats.append_buffer(buffer.c_str(), buffer.size());
×
77
  }
78

79
  buffer.clear();
NEW
80
  PointerToString(ExtraData()->GetPointer(), buffer);
×
NEW
81
  ::ToXML("extraData", buffer, *hdl.node);
×
82
}
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

© 2025 Coveralls, Inc