MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / writeVariableIndex

Function writeVariableIndex

radiantcore/model/export/Lwo2Exporter.cpp:17–31  ·  view source on GitHub ↗

Write a Variable Index (VX) data type to the given stream

Source from the content-addressed store, hash-verified

15
16// Write a Variable Index (VX) data type to the given stream
17void writeVariableIndex(std::ostream& stream, std::size_t index)
18{
19 // LWO2 defines the variable index VX data type which is
20 // 32 bit as soon as the index value is greater than 0xFF00, otherwise 16 bit
21 if (index < 0xFF00)
22 {
23 writeBigEndian<uint16_t>(stream, static_cast<uint16_t>(index));
24 }
25 else
26 {
27 // According to the specs, for values greater than 0xFF00:
28 // "the index is written as an unsigned four byte integer with bits 24-31 set"
29 writeBigEndian<uint32_t>(stream, static_cast<uint32_t>(index) | 0xFF000000);
30 }
31}
32
33// Writes an S0 datatype to the given stream
34void writeString(std::ostream& stream, const std::string& str)

Callers 1

exportToStreamMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected