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(
|
||||
#define axisval(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"
|
||||
"(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(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 axisalias
|
||||
)
|
||||
, 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.z);
|
||||
v.y = -v.y;
|
||||
|
||||
// after load we have eMayaYUp
|
||||
}
|
||||
|
||||
void aim_vector4::load(const buffer &b, uint32_t flags)
|
||||
|
|
@ -149,21 +151,19 @@ static String print_float(double v)
|
|||
return buf;
|
||||
};
|
||||
|
||||
// input (AIM Coordinates) are in eMayaYUp
|
||||
template <class T>
|
||||
static aim_vector3<T> rotate(const aim_vector3<T> &in, AxisSystem rot_type)
|
||||
{
|
||||
// it is not so simple
|
||||
// we can change coords, but normals and other stuff require recalculation?
|
||||
return in;
|
||||
// input (AIM Coordinates) are in eMayaYUp
|
||||
|
||||
aim_vector3<T> v = in;
|
||||
switch (rot_type)
|
||||
{
|
||||
case AxisSystem::eMayaZUp:
|
||||
v.y = -v.y;
|
||||
case AxisSystem::eWindows3DViewer:
|
||||
v.y = in.z;
|
||||
v.z = in.y;
|
||||
v.y = -v.y;
|
||||
break;
|
||||
case AxisSystem::eDirectX:
|
||||
v.x = -v.x;
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ enum class AxisSystem
|
|||
eDirectX,
|
||||
eLightwave = eDirectX,
|
||||
|
||||
// UpVector = ZAxis, FrontVector = ParityOdd, CoordSystem = RightHanded
|
||||
eWindows3DViewer,
|
||||
|
||||
// special
|
||||
Default = 0,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue