mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-15 01:43:25 +00:00
Allow to rotate data for .obj files. Add eWindows3DViewer axis system.
This commit is contained in:
parent
4eb4e232a2
commit
e8edda1ccf
3 changed files with 21 additions and 6 deletions
|
|
@ -52,13 +52,25 @@ cl::opt<AxisSystem> AS(cl::desc("Choose axis system (.fbx only):"),
|
||||||
cl::values(
|
cl::values(
|
||||||
#define axisval(x, y) \
|
#define axisval(x, y) \
|
||||||
cl::OptionEnumValue{ #x, (int)AxisSystem::x, y }
|
cl::OptionEnumValue{ #x, (int)AxisSystem::x, y }
|
||||||
|
#define axisalias(x, a) \
|
||||||
|
cl::OptionEnumValue{ #x, (int)AxisSystem::a, "Same as " #a }
|
||||||
|
|
||||||
axisval(eMayaZUp, "UpVector = ZAxis, FrontVector = -ParityOdd, CoordSystem = RightHanded ( also 3dsMax, Blender)\n"
|
axisval(eMayaZUp, "UpVector = ZAxis, FrontVector = -ParityOdd, CoordSystem = RightHanded ( also 3dsMax, Blender)\n"
|
||||||
"(Blender: when importing, disable 'Use Pre/Post Rotation')"),
|
"(Blender: when importing, disable 'Use Pre/Post Rotation')"),
|
||||||
|
axisalias(eMax, eMayaZUp),
|
||||||
|
axisalias(eBlender, eMayaZUp),
|
||||||
|
|
||||||
axisval(eMayaYUp, "UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = RightHanded (default, also MotionBuilder, OpenGL)"),
|
axisval(eMayaYUp, "UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = RightHanded (default, also MotionBuilder, OpenGL)"),
|
||||||
axisval(eDirectX, "UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = LeftHanded ( also Lightwave)")
|
axisalias(eMotionbuilder, eMayaYUp),
|
||||||
|
axisalias(eOpenGL, eMayaYUp),
|
||||||
|
|
||||||
|
axisval(eDirectX, "UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = LeftHanded ( also Lightwave)"),
|
||||||
|
axisalias(eLightwave, eDirectX),
|
||||||
|
|
||||||
|
axisval(eWindows3DViewer, "UpVector = ZAxis, FrontVector = ParityOdd, CoordSystem = RightHanded ( also Lightwave)")
|
||||||
|
|
||||||
#undef axisval
|
#undef axisval
|
||||||
|
#undef axisalias
|
||||||
)
|
)
|
||||||
, cl::init(AxisSystem::Default)
|
, cl::init(AxisSystem::Default)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,8 @@ static void load_translated(aim_vector3<float> &v, const buffer &b)
|
||||||
READ(b, v.x);
|
READ(b, v.x);
|
||||||
READ(b, v.z);
|
READ(b, v.z);
|
||||||
v.y = -v.y;
|
v.y = -v.y;
|
||||||
|
|
||||||
|
// after load we have eMayaYUp
|
||||||
}
|
}
|
||||||
|
|
||||||
void aim_vector4::load(const buffer &b, uint32_t flags)
|
void aim_vector4::load(const buffer &b, uint32_t flags)
|
||||||
|
|
@ -149,21 +151,19 @@ static String print_float(double v)
|
||||||
return buf;
|
return buf;
|
||||||
};
|
};
|
||||||
|
|
||||||
// input (AIM Coordinates) are in eMayaYUp
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static aim_vector3<T> rotate(const aim_vector3<T> &in, AxisSystem rot_type)
|
static aim_vector3<T> rotate(const aim_vector3<T> &in, AxisSystem rot_type)
|
||||||
{
|
{
|
||||||
// it is not so simple
|
// input (AIM Coordinates) are in eMayaYUp
|
||||||
// we can change coords, but normals and other stuff require recalculation?
|
|
||||||
return in;
|
|
||||||
|
|
||||||
aim_vector3<T> v = in;
|
aim_vector3<T> v = in;
|
||||||
switch (rot_type)
|
switch (rot_type)
|
||||||
{
|
{
|
||||||
case AxisSystem::eMayaZUp:
|
case AxisSystem::eMayaZUp:
|
||||||
|
v.y = -v.y;
|
||||||
|
case AxisSystem::eWindows3DViewer:
|
||||||
v.y = in.z;
|
v.y = in.z;
|
||||||
v.z = in.y;
|
v.z = in.y;
|
||||||
v.y = -v.y;
|
|
||||||
break;
|
break;
|
||||||
case AxisSystem::eDirectX:
|
case AxisSystem::eDirectX:
|
||||||
v.x = -v.x;
|
v.x = -v.x;
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,9 @@ enum class AxisSystem
|
||||||
eDirectX,
|
eDirectX,
|
||||||
eLightwave = eDirectX,
|
eLightwave = eDirectX,
|
||||||
|
|
||||||
|
// UpVector = ZAxis, FrontVector = ParityOdd, CoordSystem = RightHanded
|
||||||
|
eWindows3DViewer,
|
||||||
|
|
||||||
// special
|
// special
|
||||||
Default = 0,
|
Default = 0,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue