From 4ec68b6b733ad058ba84f59d4e18d3632816a567 Mon Sep 17 00:00:00 2001 From: Shon Ferguson <shonferg@users.sourceforge.net> Date: Fri, 25 May 2007 05:35:13 +0000 Subject: [PATCH] Restoring some missing function implementations. --- include/obj/NiBoneLODController.h | 47 ++++++++++++++++++++++ src/obj/NiBoneLODController.cpp | 65 +++++++++++++++++++++++++++++++ src/obj/NiLight.cpp | 33 ++++++++++++++++ 3 files changed, 145 insertions(+) diff --git a/include/obj/NiBoneLODController.h b/include/obj/NiBoneLODController.h index 5c4dcfb2..45b5d423 100644 --- a/include/obj/NiBoneLODController.h +++ b/include/obj/NiBoneLODController.h @@ -64,6 +64,53 @@ public: NIFLIB_API virtual const Type & GetType() const; //--BEGIN MISC CUSTOM CODE--// + + /*! + * Returns the number of node groups (each group a sequence of bones). + * \return The number of node groups. + */ + NIFLIB_API int GetNodeGroupCount() const; + + /*! + * Returns a specific node group (each group a sequence of bones). + * \param[in] index The index of the node group to return the data for. This must be >= 0 and < the result of ABoneLODController::GetNodeGroupCount. + * \return The specified node group. + */ + NIFLIB_API vector<Ref<NiNode> > GetNodeGroup( int index ) const; + + /*! + * Adds a single node to the specified group. The group list will expand if necessary. + * \param[in] index The index of the node group to add a node to. This must be >= 0 and < the result of ABoneLODController::GetNodeGroupCount. + * \param[in] node The node to add to the group. + */ + NIFLIB_API void AddNodeToGroup( int index, NiNode * node ); + + /*! + * Remove a single node from the specified node group. + * \param[in] index The index of the node group to remove a node from. This must be >= 0 and < the result of ABoneLODController::GetNodeGroupCount. + * \param[in] node The node remove from the group. + */ + NIFLIB_API void RemoveNodeFromGroup( int index, NiNode * node ); + + /*! + * Assigns an entire node group, replacing any nodes that were in the group before. + * \param[in] index The index of the node group to assign a list of nodes to. This must be >= 0 and < the result of ABoneLODController::GetNodeGroupCount. + * \param[in] group The list of nodes to assign to the specified node group. + */ + NIFLIB_API void SetNodeGroup( int index, const vector<Ref<NiNode> > & group ); + + + /*! + * Removes an entire node group. This will cause the indices of any subsequent node groups to shift. + * \param[in] index The index of the node group to remove. This must be >= 0 and < the result of ABoneLODController::GetNodeGroupCount. + */ + NIFLIB_API void RemoveNodeGroup( int index ); + + /*! + * Clears all node groups. + */ + NIFLIB_API void ClearNodeGroups(); + //--END CUSTOM CODE--// protected: /*! diff --git a/src/obj/NiBoneLODController.cpp b/src/obj/NiBoneLODController.cpp index 7255a755..5e1683a7 100644 --- a/src/obj/NiBoneLODController.cpp +++ b/src/obj/NiBoneLODController.cpp @@ -8,6 +8,7 @@ All rights reserved. Please see niflib.h for license. */ //-----------------------------------NOTICE----------------------------------// //--BEGIN FILE HEAD CUSTOM CODE--// +#include <algorithm> //--END CUSTOM CODE--// #include "../../include/FixLink.h" @@ -277,4 +278,68 @@ std::list<NiObjectRef> NiBoneLODController::GetRefs() const { } //--BEGIN MISC CUSTOM CODE--// + +/*! + * A list of node groups (each group a sequence of bones?). + */ +int NiBoneLODController::GetNodeGroupCount() const { + return int(nodeGroups.size()); +} + +vector<Ref<NiNode> > NiBoneLODController::GetNodeGroup( int index ) const { + if (index < 0 || index >= int(nodeGroups.size()) ) { + throw runtime_error("Invalid index referenced."); + } + vector<NiNodeRef> value; + const vector<NiNode*>& nodes = nodeGroups[index].nodes; + for (vector<NiNode*>::const_iterator itr = nodes.begin(); itr != nodes.end(); ++itr) + value.push_back(*itr); + return value; +} + +void NiBoneLODController::AddNodeToGroup( int index, NiNode * node ) { + while (index >= int(nodeGroups.size())) + nodeGroups.insert(nodeGroups.end(), NodeGroup() ); + numNodeGroups2 = nodeGroups.size(); + + vector<NiNode*>& nodes = nodeGroups[index].nodes; + vector<NiNode*>::iterator itr = std::find(nodes.begin(), nodes.end(), node); + if (itr == nodes.end()) + nodes.push_back(node); +} + +void NiBoneLODController::RemoveNodeFromGroup( int index, NiNode * node ) { + if (index < 0 || index >= int(nodeGroups.size()) ) { + throw runtime_error("Invalid index referenced."); + } + vector<NiNode*>& nodes = nodeGroups[index].nodes; + vector<NiNode*>::iterator itr = std::find(nodes.begin(), nodes.end(), node); + if (itr == nodes.end()) + return; + nodes.erase(itr); +} + +void NiBoneLODController::SetNodeGroup( int index, const vector<Ref<NiNode> >& group ) { + while (index >= int(nodeGroups.size())) + nodeGroups.insert(nodeGroups.end(), NodeGroup() ); + numNodeGroups2 = nodeGroups.size(); + nodeGroups[index].nodes.assign(group.begin(), group.end()); +} + +void NiBoneLODController::RemoveNodeGroup( int index ) { + if (index < 0 || index >= int(nodeGroups.size()) ) { + throw runtime_error("Invalid index referenced."); + } + vector<NodeGroup>::iterator itr = nodeGroups.begin(); + std::advance(itr, index); + nodeGroups.erase(itr); + numNodeGroups2 = nodeGroups.size(); +} + +void NiBoneLODController::ClearNodeGroups() { + nodeGroups.clear(); + numNodeGroups2 = nodeGroups.size(); +} + + //--END CUSTOM CODE--// diff --git a/src/obj/NiLight.cpp b/src/obj/NiLight.cpp index a8ecca20..a80428da 100644 --- a/src/obj/NiLight.cpp +++ b/src/obj/NiLight.cpp @@ -118,4 +118,37 @@ std::list<NiObjectRef> NiLight::GetRefs() const { } //--BEGIN MISC CUSTOM CODE--// + +float NiLight::GetDimmer() const { + return dimmer; +} + +void NiLight::SetDimmer( float value ) { + dimmer = value; +} + +Color3 NiLight::GetAmbientColor() const { + return ambientColor; +} + +void NiLight::SetAmbientColor( Color3 value ) { + ambientColor = value; +} + +Color3 NiLight::GetDiffuseColor() const { + return diffuseColor; +} + +void NiLight::SetDiffuseColor( Color3 value ) { + diffuseColor = value; +} + +Color3 NiLight::GetSpecularColor() const { + return specularColor; +} + +void NiLight::SetSpecularColor( Color3 value ) { + specularColor = value; +} + //--END CUSTOM CODE--// -- GitLab