7 #ifndef CAFU_SCENEGRAPH_AUX_HPP_INCLUDED
8 #define CAFU_SCENEGRAPH_AUX_HPP_INCLUDED
10 #include "Math3D/Vector3.hpp"
11 #include "Templates/Array.hpp"
13 #if defined(_WIN32) && _MSC_VER<1600
31 int32_t ReadInt32(std::istream& InFile);
34 uint16_t ReadUInt16(std::istream& InFile);
37 uint32_t ReadUInt32(std::istream& InFile);
40 float ReadFloat(std::istream& InFile);
43 double ReadDouble(std::istream& InFile);
46 std::string ReadString(std::istream& InFile);
49 Vector3dT ReadVector3d(std::istream& InFile);
52 Vector3fT ReadVector3f(std::istream& InFile);
56 void Write(std::ostream& OutFile, int32_t i);
59 void Write(std::ostream& OutFile, uint16_t ui);
62 void Write(std::ostream& OutFile, uint32_t ui);
65 void Write(std::ostream& OutFile,
float f);
68 void Write(std::ostream& OutFile,
double d);
71 void Write(std::ostream& OutFile,
const std::string& Str);
85 template<
class T> int32_t cnc_i32(T i)
89 const int32_t i32=
static_cast<int32_t
>(i);
92 if (i32!=i)
throw std::overflow_error(
"The cast in aux::cnc_i32() caused a loss of data.");
98 template<
class T> uint32_t cnc_ui32(T ui)
100 assert(
sizeof(ui)>=4);
102 const uint32_t ui32=
static_cast<uint32_t
>(ui);
105 if (ui32!=ui)
throw std::overflow_error(
"The cast in aux::cnc_ui32() caused a loss of data.");
121 if (v1.
x < v2.
x)
return true;
122 if (v1.
x > v2.
x)
return false;
124 if (v1.
y < v2.
y)
return true;
125 if (v1.
y > v2.
y)
return false;
137 if (v1.
x < v2.
x)
return true;
138 if (v1.
x > v2.
x)
return false;
140 if (v1.
y < v2.
y)
return true;
141 if (v1.
y > v2.
y)
return false;
147 std::string ReadString(std::istream& InFile);
151 void Write(std::ostream& OutFile,
const std::string& s);
164 std::map<std::string, uint32_t > WriteStrings;
165 std::map<Vector3dT, uint32_t, LessVector3d> WriteVectors3d;
166 std::map<Vector3fT, uint32_t, LessVector3f> WriteVectors3f;
T y
The y-component of this vector.
Definition: Vector3.hpp:41
This class represents a polymorphic 3-dimensional vector.
Definition: Misc.hpp:11
T z
The z-component of this vector.
Definition: Vector3.hpp:42
T x
The x-component of this vector.
Definition: Vector3.hpp:40