From 516409d16ee84952000ff69abd555ea9ec1eedb6 Mon Sep 17 00:00:00 2001 From: Tazpn <tazpn@users.sourceforge.net> Date: Mon, 18 Jun 2007 01:01:53 +0000 Subject: [PATCH] Bug fix with Matrix44 Transpose which didn't do anything. Add helper methods to transform shape and fix some typos. --- include/obj/bhkBoxShape.h | 8 +++---- include/obj/bhkTransformShape.h | 37 +++++++++++++++++++++++++++++++++ src/nif_math.cpp | 8 +++---- src/obj/bhkTransformShape.cpp | 25 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/include/obj/bhkBoxShape.h b/include/obj/bhkBoxShape.h index 283814ac..afa20930 100644 --- a/include/obj/bhkBoxShape.h +++ b/include/obj/bhkBoxShape.h @@ -55,14 +55,14 @@ public: //--BEGIN MISC CUSTOM CODE--// /*! - * Gets the dimentions of the box. - * \return The dimentions of the bounding box. + * Gets the dimensions of the box. + * \return The dimensions of the bounding box. */ NIFLIB_API Vector3 GetDimensions() const; /*! - * Sets the dimentions of the box. - * \param value The new dimentions for the bounding box. + * Sets the dimensions of the box. + * \param value The new dimensions for the bounding box. */ NIFLIB_API void SetDimensions( const Vector3 & value ); diff --git a/include/obj/bhkTransformShape.h b/include/obj/bhkTransformShape.h index 27d7b46e..6cf08300 100644 --- a/include/obj/bhkTransformShape.h +++ b/include/obj/bhkTransformShape.h @@ -58,6 +58,43 @@ public: NIFLIB_API virtual const Type & GetType() const; //--BEGIN MISC CUSTOM CODE--// + + /*! + * Get the shape's material. This determines the type of noises the object makes as it collides in Oblivion. + * \return The Oblivion material used by this collision shape. + */ + NIFLIB_API HavokMaterial GetMaterial() const; + + /*! + * Sets the shape's material. This determines the type of noises the object makes as it collides in Oblivion. + * \param[in] value The new material for this shape to use. + */ + NIFLIB_API void SetMaterial( HavokMaterial value ); + + /*! + * Retrieves the shape object that this body is using. + * \return The shape object being used by this body. + */ + NIFLIB_API Ref<bhkShape > GetShape() const; + + /*! + * Sets the shape object that this body will use. + * \param[in] value The new shape object for this body to use. + */ + NIFLIB_API void SetShape( bhkShape * value ); + + /* This is a conveniance function that allows you to retrieve the full 4x4 matrix transform of a node. It accesses the "Rotation," "Translation," and "Scale" attributes and builds a complete 4x4 transformation matrix from them. + * \return A 4x4 transformation matrix built from the node's transform attributes. + */ + NIFLIB_API virtual Matrix44 GetTransform() const; + + /*! + * This is a conveniance function that allows you to set the rotation, scale, and translation of an AV object with a 4x4 matrix transform. + * \n A 4x4 transformation matrix to set the AVObject's transform attributes with. + */ + NIFLIB_API virtual void SetTransform( const Matrix44 & value ); + + //--END CUSTOM CODE--// protected: /*! The shape that this object transforms. */ diff --git a/src/nif_math.cpp b/src/nif_math.cpp index 7e015ddd..5a34c2e3 100644 --- a/src/nif_math.cpp +++ b/src/nif_math.cpp @@ -388,10 +388,10 @@ bool Matrix44::operator!=( const Matrix44 & rh ) const { Matrix44 Matrix44::Transpose() const { const Matrix44 & t = *this; - return Matrix44( t[0][0], t[0][1], t[0][2], t[0][3], - t[1][0], t[1][1], t[1][2], t[1][3], - t[2][0], t[2][1], t[2][2], t[2][3], - t[3][0], t[3][1], t[3][2], t[3][3] ); + return Matrix44( t[0][0], t[1][0], t[2][0], t[3][0], + t[0][1], t[1][1], t[2][1], t[3][1], + t[0][2], t[1][2], t[2][2], t[3][2], + t[0][3], t[1][3], t[2][3], t[3][3] ); } Matrix33 Matrix44::Submatrix( int skip_r, int skip_c ) const { diff --git a/src/obj/bhkTransformShape.cpp b/src/obj/bhkTransformShape.cpp index b1bfbe7f..f98afa07 100644 --- a/src/obj/bhkTransformShape.cpp +++ b/src/obj/bhkTransformShape.cpp @@ -131,4 +131,29 @@ std::list<NiObjectRef> bhkTransformShape::GetRefs() const { } //--BEGIN MISC CUSTOM CODE--// + +Ref<bhkShape > bhkTransformShape::GetShape() const { + return shape; +} + +void bhkTransformShape::SetShape( bhkShape * value ) { + shape = value; +} + +HavokMaterial bhkTransformShape::GetMaterial() const { + return material; +} + +void bhkTransformShape::SetMaterial( HavokMaterial value ) { + material = value; +} + +Matrix44 bhkTransformShape::GetTransform() const { + return transform; +} + +void bhkTransformShape::SetTransform(const Matrix44 & value ) { + transform = value; +} + //--END CUSTOM CODE--// -- GitLab