From 4921536db8e7dfd622f6a8fe8ef25903bd03c613 Mon Sep 17 00:00:00 2001 From: Alecu100 <lui_alecu@yahoo.co.uk> Date: Sat, 4 Feb 2012 03:36:04 +0400 Subject: [PATCH] started adding support for BSDismemberSkinInstance.h in the complex shape. so far nothing is functional but at first glance it seems pretty straightforward enough --- include/ComplexShape.h | 14 ++++++++++++++ include/obj/BSDismemberSkinInstance.h | 4 ++-- include/obj/NiTriBasedGeom.h | 7 +++++++ src/ComplexShape.cpp | 7 +++++++ src/obj/NiTriBasedGeom.cpp | 6 ++++++ 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/include/ComplexShape.h b/include/ComplexShape.h index 3dfaeb4d..8252bf0e 100644 --- a/include/ComplexShape.h +++ b/include/ComplexShape.h @@ -7,6 +7,7 @@ All rights reserved. Please see niflib.h for license. */ #include "Ref.h" #include "nif_math.h" #include "nif_basic_types.h" +#include "gen/BodyPartList.h" #include <vector> namespace Niflib { @@ -292,7 +293,20 @@ public: */ NIFLIB_API vector< Ref<NiNode> > GetSkinInfluences() const; + /* + * Gets the dismember groups from the ComplexShape. These groups split the mesh into submeshes and in games like Fallout3 are responsibile for how a body ca be "dismembered" + * \return The dismember groups + */ + NIFLIB_API vector<pair<BodyPartList, vector<int>>> GetDismemberGroups() const; + + /* + * Sets the dismember groups from the ComplexShape. These groups split the mesh into submeshes and in games like Fallout3 are responsibile for how a body ca be "dismembered" + * \param[in] The new dismember groups + */ + NIFLIB_API void SetDismemberGroups( vector< pair< BodyPartList, vector<int> > > value ); + private: + vector<pair<BodyPartList, vector<int>>> dismemberGroups; vector<WeightedVertex> vertices; vector<Color4> colors; vector<Vector3> normals; diff --git a/include/obj/BSDismemberSkinInstance.h b/include/obj/BSDismemberSkinInstance.h index 4e6f8b2c..c0763fe8 100644 --- a/include/obj/BSDismemberSkinInstance.h +++ b/include/obj/BSDismemberSkinInstance.h @@ -60,11 +60,11 @@ public: // Get list of dismemberment partitions // \return The current value. - vector<BodyPartList > GetPartitions() const; + NIFLIB_API vector<BodyPartList > GetPartitions() const; // Assign the dismemberment partition list // \param[in] value The new value. - void SetPartitions( const vector<BodyPartList >& value ); + NIFLIB_API void SetPartitions( const vector<BodyPartList >& value ); //--END CUSTOM CODE--// protected: diff --git a/include/obj/NiTriBasedGeom.h b/include/obj/NiTriBasedGeom.h index cf5ce165..420ec6f0 100644 --- a/include/obj/NiTriBasedGeom.h +++ b/include/obj/NiTriBasedGeom.h @@ -11,6 +11,7 @@ All rights reserved. Please see niflib.h for license. */ #define _NITRIBASEDGEOM_H_ //--BEGIN FILE HEAD CUSTOM CODE--// +#include "BodyPartList.h" //--END CUSTOM CODE--// #include "NiGeometry.h" @@ -61,6 +62,12 @@ public: */ NIFLIB_API void GenHardwareSkinInfo( int max_bones_per_partition = 4, int max_bones_per_vertex = 4, bool bStrippify = true, int* face2PartMap = NULL ); + /*! + * This generates dismember skin data for hardware acceleration. Specifically, it creates a NiDismemberSkinPartition object based on the current skin weights. This splits up the mesh into smaller parts that are affected by fewer bones so that they can be processed by 3D accelerator hardware. + * \param[in] dismember_groups A collection of pairs of body part list - face indexes that splits the mesh into submeshes that corresponds to various body parts + */ + NIFLIB_API void GenHardwareDismemberSkinInfo( vector< pair <BodyPartList, vector < int> > > dismember_groups); + /*! * This clears any hardware acceleration skin data that was previously created. */ diff --git a/src/ComplexShape.cpp b/src/ComplexShape.cpp index a119e791..089af530 100644 --- a/src/ComplexShape.cpp +++ b/src/ComplexShape.cpp @@ -137,6 +137,13 @@ void ComplexShape::SetSkinInfluences( const vector< Ref<NiNode> > & n ) { skinInfluences = n; } +vector<pair<BodyPartList, vector<int>>> ComplexShape::GetDismemberGroups() const { + return dismemberGroups; +} + +void ComplexShape::SetDismemberGroups( vector< pair< BodyPartList, vector<int> > > value ) { + dismemberGroups = value; +} string ComplexShape::GetName() const { return name; diff --git a/src/obj/NiTriBasedGeom.cpp b/src/obj/NiTriBasedGeom.cpp index cfd3b7b2..707b25e4 100644 --- a/src/obj/NiTriBasedGeom.cpp +++ b/src/obj/NiTriBasedGeom.cpp @@ -131,6 +131,10 @@ void NiTriBasedGeom::GenHardwareSkinInfo( int max_bones_per_partition /*= 4*/, i } } +void NiTriBasedGeom::GenHardwareDismemberSkinInfo( vector< pair <BodyPartList, vector < int> > > dismember_groups ) { + +} + void NiTriBasedGeom::UpdateTangentSpace(int method) { NiTriBasedGeomDataRef niTriGeomData = DynamicCast<NiTriBasedGeomData>(this->data); @@ -332,3 +336,5 @@ void NiTriBasedGeom::UpdateTangentSpace(int method) { } //--END CUSTOM CODE--// + + -- GitLab