Skip to content
Snippets Groups Projects
Commit 232a3fed authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Fix convention issues.

parent 934470cb
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,14 @@ namespace graphics {
osgVector3 position;
osgQuat quat;
Configuration() {}
explicit Configuration(const float* a) : position(a[0],a[1],a[2]), quat(a[3],a[4],a[5],a[6]) {}
/// \param XYZW when false, the 4 last parameters are a quaternion (w,x,y,z)
/// otherwise, a quaternion (x,y,z,w)
explicit Configuration(const float* a, bool XYZW)
: position(a[0],a[1],a[2])
, quat(a[(XYZW ? 3 : 4)],
a[(XYZW ? 4 : 5)],
a[(XYZW ? 5 : 6)],
a[(XYZW ? 6 : 3)]) {}
Configuration(const osgVector3& p, const osgQuat& q) : position(p), quat(q) {}
};
struct NodeConfiguration : Configuration {
......
......@@ -55,12 +55,14 @@ namespace graphics {
typedef const GraphicalInterface::Transform In_t;
typedef Configuration Out_t;
typedef Transform_slice* Ret_t;
static Out_t op (In_t in) { return Out_t(in); }
static Out_t op (In_t in) { return Out_t(in, false); /* false means (w,x,y,z) -> (x,y,z,w) */ }
static Ret_t ret (const Out_t& in) {
Ret_t ret = new GraphicalInterface::Transform();
// dofArray->length(7);
for(int i=0; i<3; i++) ret[(ULong)i] = in.position[i];
for(int i=0; i<4; i++) ret[(ULong)i+3] = (float)in.quat[i];
// for(int i=0; i<3; i++) ret[(ULong)i+3] = (float)in.quat[i];
ret[(ULong)3] = (float)in.quat[3]; // W
for(int i=0; i<3; i++) ret[(ULong)i+4] = (float)in.quat[i]; // XYZ
return ret;
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment