From 0d2e7baf84a23919df626c7fb81261715be7a95e Mon Sep 17 00:00:00 2001 From: Shon Ferguson <shonferg@users.sourceforge.net> Date: Sat, 27 May 2006 20:33:06 +0000 Subject: [PATCH] Incorporated defines into the h and cpp files I'd already made for NiNode, NiObjectNET, and NiAVObject. --- obj/NiAVObject.cpp | 24 +++++++++++++++++++++++- obj/NiAVObject.h | 23 +++++++++++------------ obj/NiNode.cpp | 23 ++++++++++++++++++++++- obj/NiNode.h | 16 +++++++++++----- obj/NiObjectNET.cpp | 24 +++++++++++++++++++++++- obj/NiObjectNET.h | 27 ++++++++++++--------------- 6 files changed, 102 insertions(+), 35 deletions(-) diff --git a/obj/NiAVObject.cpp b/obj/NiAVObject.cpp index 02eb016a..3dfad973 100644 --- a/obj/NiAVObject.cpp +++ b/obj/NiAVObject.cpp @@ -2,6 +2,28 @@ All rights reserved. Please see niflib.h for licence. */ #include "NiAVObject.h" +#include "NiProperty.h" +#include "NiCollisionData.h" //Definition of TYPE constant -const Type NiAVObject::TYPE("NiAVObject", &NiObjectNET::TYPE ); \ No newline at end of file +const Type NiAVObject::TYPE("NiAVObject", &NI_A_V_OBJECT_PARENT::TYPE ); + +NiAVObject::NiAVObject() NI_A_V_OBJECT_CONSTRUCT {} + +NiAVObject::~NiAVObject() {} + +void NiAVObject::Read( istream& in, list<uint> link_stack, unsigned int version ) { + NI_A_V_OBJECT_READ +} + +void NiAVObject::Write( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version ) const { + NI_A_V_OBJECT_WRITE +} + +string NiAVObject::asString( bool verbose ) const { + NI_A_V_OBJECT_STRING +} + +void NiAVObject::FixLinks( const vector<NiObjectRef> & objects, list<uint> link_stack, unsigned int version ) { + NI_A_V_OBJECT_FIXLINKS +} \ No newline at end of file diff --git a/obj/NiAVObject.h b/obj/NiAVObject.h index 87028c77..ff7c3e67 100644 --- a/obj/NiAVObject.h +++ b/obj/NiAVObject.h @@ -5,28 +5,26 @@ All rights reserved. Please see niflib.h for licence. */ #define _NIAVOBJECT_H_ #include "xml_extract.h" -#include "NiObjectNET.h" +#include NI_A_V_OBJECT_INCLUDE /* * NiAVObject - An audio/video object? Part of the scene graph and has a position in 3D. */ class NiAVObject; - typedef Ref<NiAVObject> NiAVObjectRef; -class NiAVObject : public NiObjectNET { +class NiAVObject : public NI_A_V_OBJECT_PARENT { public: - NiAVObject() {} - ~NiAVObject() {} + NiAVObject(); + ~NiAVObject(); //Run-Time Type Information static const Type TYPE; + virtual void Read( istream& in, list<uint> link_stack, unsigned int version ); + virtual void Write( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version ) const; + virtual string asString( bool verbose = false ) const; + virtual void FixLinks( const vector<NiObjectRef> & objects, list<uint> link_stack, unsigned int version ); - short flags; - Vector3 localTranslate; - Matrix33 localRotate; - float localScale; - Vector3 localVelocity; //TODO: list of NiProperty pointers. Need functions to add/remove. //TODO: Bounding Box. What to do with newer files that have a link? Wrap this in a function and translate? @@ -69,11 +67,12 @@ public: } NiAVObjectRef GetParent() { return parent; } -protected: +private: + NI_A_V_OBJECT_MEMBERS + NiAVObject * parent; void ResetSkinnedFlag(); Matrix44 bindPosition; - }; #endif \ No newline at end of file diff --git a/obj/NiNode.cpp b/obj/NiNode.cpp index 5def7d79..28da8f94 100644 --- a/obj/NiNode.cpp +++ b/obj/NiNode.cpp @@ -2,6 +2,27 @@ All rights reserved. Please see niflib.h for licence. */ #include "NiNode.h" +#include "NiDynamicEffect.h" //Definition of TYPE constant -const Type NiNode::TYPE("NiNode", &NiAVObject::TYPE ); \ No newline at end of file +const Type NiNode::TYPE("NiNode", &NI_NODE_PARENT::TYPE ); + +NiNode::NiNode() NI_NODE_CONSTRUCT {} + +NiNode::~NiNode() {} + +void NiNode::Read( istream& in, list<uint> link_stack, unsigned int version ) { + NI_NODE_READ +} + +void NiNode::Write( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version ) const { + NI_NODE_WRITE +} + +string NiNode::asString( bool verbose ) const { + NI_NODE_STRING +} + +void NiNode::FixLinks( const vector<NiObjectRef> & objects, list<uint> link_stack, unsigned int version ) { + NI_NODE_FIXLINKS +} diff --git a/obj/NiNode.h b/obj/NiNode.h index 3d6e43c4..5584cf62 100644 --- a/obj/NiNode.h +++ b/obj/NiNode.h @@ -4,24 +4,30 @@ All rights reserved. Please see niflib.h for licence. */ #ifndef _NINODE_H_ #define _NINODE_H_ -#include "NiAVObject.h" +#include "xml_extract.h" +#include NI_NODE_INCLUDE /* * NiNode - A basic scene graph node. Can have children. */ class NiNode; - typedef Ref<NiNode> NiNodeRef; -class NiNode : public NiAVObject { +class NiNode : public NI_NODE_PARENT { public: - NiNode() {} - ~NiNode() {} + NiNode(); + ~NiNode(); //Run-Time Type Information static const Type TYPE; + virtual void Read( istream& in, list<uint> link_stack, unsigned int version ); + virtual void Write( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version ) const; + virtual string asString( bool verbose = false ) const; + virtual void FixLinks( const vector<NiObjectRef> & objects, list<uint> link_stack, unsigned int version ); //TODO: Add functions to get and set children and store a list of NiObjectNET references +private: + NI_NODE_MEMBERS }; #endif \ No newline at end of file diff --git a/obj/NiObjectNET.cpp b/obj/NiObjectNET.cpp index 5c89651b..d5e20ad4 100644 --- a/obj/NiObjectNET.cpp +++ b/obj/NiObjectNET.cpp @@ -2,6 +2,28 @@ All rights reserved. Please see niflib.h for licence. */ #include "NiObjectNET.h" +#include "NiExtraData.h" +#include "NiTimeController.h" //Definition of TYPE constant -const Type NiObjectNET::TYPE("NiObjectNET", &NiObject::TYPE ); \ No newline at end of file +const Type NiObjectNET::TYPE("NiObjectNET", &NI_OBJECT_N_E_T_PARENT::TYPE ); + +NiObjectNET::NiObjectNET() NI_OBJECT_N_E_T_CONSTRUCT {} + +NiObjectNET::~NiObjectNET() {} + +void NiObjectNET::Read( istream& in, list<uint> link_stack, unsigned int version ) { + NI_OBJECT_N_E_T_READ +} + +void NiObjectNET::Write( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version ) const { + NI_OBJECT_N_E_T_WRITE +} + +string NiObjectNET::asString( bool verbose ) const { + NI_OBJECT_N_E_T_STRING +} + +void NiObjectNET::FixLinks( const vector<NiObjectRef> & objects, list<uint> link_stack, unsigned int version ) { + NI_OBJECT_N_E_T_FIXLINKS +} diff --git a/obj/NiObjectNET.h b/obj/NiObjectNET.h index 43bf9f91..fa214213 100644 --- a/obj/NiObjectNET.h +++ b/obj/NiObjectNET.h @@ -4,32 +4,29 @@ All rights reserved. Please see niflib.h for licence. */ #ifndef _NIOBJECTNET_H_ #define _NIOBJECTNET_H_ -#include "NiObject.h" +#include "xml_extract.h" +#include NI_OBJECT_N_E_T_INCLUDE /* * NiObjectNET - An object that has a name. Can have extra data and controllers attatched. */ class NiObjectNET; - typedef Ref<NiObjectNET> NiObjectNETRef; -class NiObjectNET : public NiObject /*NI_OBJECT_N_E_T_PARENTS*/ { +class NiObjectNET : public NI_OBJECT_N_E_T_PARENT { public: - NiObjectNET() /*NI_OBJECT_N_E_T_CONSTRUCT*/ {} - ~NiObjectNET() {} + NiObjectNET(); + ~NiObjectNET(); //Run-Time Type Information static const Type TYPE; - string name; - virtual void Read( istream& in, list<uint> link_stack, unsigned int version ) { /*NI_OBJECT_N_E_T_READ*/ } - virtual void Write( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version ) const { /*NI_OBJECT_N_E_T_WRITE*/ } - virtual string asString( bool verbose = false ) const { /*NI_OBJECT_N_E_T_STRING*/ } - virtual void FixLinks( const vector<NiObjectRef> & objects, list<uint> link_stack, unsigned int version ) { /*NI_OBJECT_N_E_T_FIXLINKS*/ } - -private: - /*NI_OBJECT_N_E_T_MEMBERS*/ + virtual void Read( istream& in, list<uint> link_stack, unsigned int version ); + virtual void Write( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version ) const; + virtual string asString( bool verbose = false ) const; + virtual void FixLinks( const vector<NiObjectRef> & objects, list<uint> link_stack, unsigned int version ); //TODO: pointer to extra data type... find out what that is. AExtraData right now. Need functions to add/remove. //TODO: pointer to first NiTimeController type. Need functions to add/remove. +private: + NI_OBJECT_N_E_T_MEMBERS }; - -#endif \ No newline at end of file +#endif -- GitLab