diff --git a/gen/NodeGroup.h b/gen/NodeGroup.h index 5ed963d09e4d10d927a08e85a47edac116584008..ea55a26e25a8d2278727ecb00e88d33e90828bf9 100644 --- a/gen/NodeGroup.h +++ b/gen/NodeGroup.h @@ -5,12 +5,14 @@ All rights reserved. Please see niflib.h for licence. */ #define _NODEGROUP_H_ #include "../NIF_IO.h" -#include "../obj/NiNode.h" // Include structures #include "../Ref.h" namespace Niflib { +// Forward define of referenced blocks +class NiNode; + /*! * A group of NiNodes references. */ diff --git a/nif_math.cpp b/nif_math.cpp index 60a428120cadb99d38e1d05e9bf6eb3ffc0dbc48..2d059de310c0f5e6e9287074f6f5ba1b28a9b0a4 100644 --- a/nif_math.cpp +++ b/nif_math.cpp @@ -398,8 +398,8 @@ void Matrix44::Decompose( Vector3 & translate, Matrix33 & rotation, float & scal Matrix33 rotT; for ( int i = 0; i < 3; i++ ){ for ( int j = 0; j < 3; j++ ){ - rotation[j][i] = (*this)[i][j]; - rotT[i][j] = (*this)[i][j]; + rotation[i][j] = (*this)[i][j]; + rotT[j][i] = (*this)[i][j]; } } Matrix33 mtx = rotation * rotT; @@ -411,7 +411,7 @@ void Matrix44::Decompose( Vector3 & translate, Matrix33 & rotation, float & scal } //averate the scale since NIF doesn't support discreet scaling - scale = scale3[0] + scale3[1] + scale3[2] / 3.0f; + scale = (scale3[0] + scale3[1] + scale3[2]) / 3.0f; } /* * Quaternion Methods diff --git a/obj/NiAVObject.cpp b/obj/NiAVObject.cpp index a4e31db510b8361cb6911b37021058450dc963aa..ba3a931f8e1dbc760741647569fa1b5a60f11629 100644 --- a/obj/NiAVObject.cpp +++ b/obj/NiAVObject.cpp @@ -8,6 +8,13 @@ All rights reserved. Please see niflib.h for licence. */ #include "NiCollisionObject.h" using namespace Niflib; + +#define NIFLIB_GET_FLAG(value, shift, mask) \ + (( value >> shift ) & mask) + +#define NIFLIB_MASK_FLAG(flag, value, shift, mask) \ + ((flag ^ ~(mask << shift)) | ((value & mask) << shift)) + //Definition of TYPE constant const Type NiAVObject::TYPE("NiAVObject", &NI_A_V_OBJECT_PARENT::TypeConst() ); @@ -149,4 +156,24 @@ void NiAVObject::SetVelocity( const Vector3 & n ) { void NiAVObject::SetCollisionObject(Ref<NiCollisionObject> &obj) { collisionObject = obj; -} \ No newline at end of file +} + +NiAVObject::CollisionType NiAVObject::GetCollision() +{ + return (NiAVObject::CollisionType)NIFLIB_GET_FLAG(flags, 1, 0x03); +} + +void NiAVObject::SetCollsion(NiAVObject::CollisionType value) +{ + flags = NIFLIB_MASK_FLAG(flags, value, 1, 0x03); +} + +bool NiAVObject::GetHidden() +{ + return (bool)NIFLIB_GET_FLAG(flags, 0, 0x01); +} + +void NiAVObject::SetHidden(bool value) +{ + flags = NIFLIB_MASK_FLAG(flags, value, 0, 0x01); +} diff --git a/obj/NiAVObject.h b/obj/NiAVObject.h index 884406bd1bb590ae6b22a6f5ef6eb1019e4342ff..9078e0d6b3966d0a8f89c6b7b4da094b16238b59 100644 --- a/obj/NiAVObject.h +++ b/obj/NiAVObject.h @@ -84,6 +84,16 @@ public: void SetCollisionObject(Ref<NiCollisionObject> &); + typedef enum CollisionType + { + ctNone, ctTriangles, ctBoundingBox, ctContinue + } CollisionType; + CollisionType GetCollision(); + bool GetHidden(); + + void SetHidden(bool value); + void SetCollsion(CollisionType value); + protected: NiNode * parent; NI_A_V_OBJECT_MEMBERS diff --git a/obj/NiControllerSequence.cpp b/obj/NiControllerSequence.cpp index af01e0b77768717a3e5f80629f9d0ba20f450e7c..c5d333c5c8b017929bf8bbddd49e05ecee61cf35 100644 --- a/obj/NiControllerSequence.cpp +++ b/obj/NiControllerSequence.cpp @@ -146,3 +146,27 @@ Ref<NiTextKeyExtraData> NiControllerSequence::GetTextKeyExtraData() const { return textKeys; } + +float NiControllerSequence::GetFrequency() const { + return frequency; +} + +void NiControllerSequence::SetFrequency( float value ) { + frequency = value; +} + +float NiControllerSequence::GetStartTime() const { + return startTime; +} + +void NiControllerSequence::SetStartTime( float value ) { + startTime = value; +} + +float NiControllerSequence::GetStopTime() const { + return stopTime; +} + +void NiControllerSequence::SetStopTime( float value ) { + stopTime = value; +} diff --git a/obj/NiControllerSequence.h b/obj/NiControllerSequence.h index dfd1ce77e016b8627ad25da352176ae0d76af8a4..7c00491db977bbf1135487fe0e54147e1809a62c 100644 --- a/obj/NiControllerSequence.h +++ b/obj/NiControllerSequence.h @@ -76,6 +76,24 @@ public: Ref<NiTextKeyExtraData> GetTextKeyExtraData() const; + /*! + * The animation frequency. + */ + float GetFrequency() const; + void SetFrequency( float value ); + + /*! + * The controller sequence start time + */ + float GetStartTime() const; + void SetStartTime( float value ); + + /*! + * The controller sequence stop time + */ + float GetStopTime() const; + void SetStopTime( float value ); + protected: NiControllerManager * NiControllerSequence::Parent() const; NI_CONTROLLER_SEQUENCE_MEMBERS