Skip to content
Snippets Groups Projects
NiAVObject.h 10.98 KiB
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved.  Please see niflib.h for license. */

#ifndef _NIAVOBJECT_H_
#define _NIAVOBJECT_H_

// Includes
#include "../gen/BoundingBox.h"
#include "NiObjectNET.h"
namespace Niflib {

//#include "../gen/obj_defines.h"

// Forward define of referenced NIF objects
class NiProperty;
class NiCollisionData;
class NiCollisionObject;
class NiNode;


/*
 * 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 NI_A_V_OBJECT_PARENT {
public:
	NIFLIB_API NiAVObject();
	NIFLIB_API ~NiAVObject();
	//Run-Time Type Information
	NIFLIB_API static const Type TYPE;
	NIFLIB_API static NiObject * Create();
	NIFLIB_API virtual const Type & GetType() const;
	NIFLIB_HIDDEN virtual void Read( istream& in, list<unsigned int> & link_stack, const NifInfo & info );
	NIFLIB_HIDDEN virtual void Write( ostream& out, const map<NiObjectRef,unsigned int> & link_map, const NifInfo & info ) const;
	NIFLIB_API virtual string asString( bool verbose = false ) const;
	NIFLIB_HIDDEN virtual void FixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, const NifInfo & info );
	NIFLIB_HIDDEN virtual list<NiObjectRef> GetRefs() const;

	/*!
	 * Clears all embedded bounding box information.  Older NIF files can have a bounding box specified in them which will be used for collision detection instead of evaluating the triangles.
	 */
	NIFLIB_API void ClearBoundingBox();

	/*!
	 * Returns any embedded bounding box information.  NiAVObject::HasBoundingBox should be called first, as this function will throw an exception if there is no bounding box information in this object.  Older NIF files can have a bounding box specified in them which will be used for collision detection instead of evaluating the triangles.
	 * \return The embedded bounding box dimentions.
	 * \sa NiAVObject::HasBoundingBox
	 */
	NIFLIB_API BoundingBox GetBoundingBox() const;

	/*!
	 * Sets new embedded bounding box information.  Older NIF files can have a bounding box specified in them which will be used for collision detection instead of evaluating the triangles.
	 * \param[in] n The new bounding box dimentions.
	 */
	NIFLIB_API void SetBoundingBox( const BoundingBox & n );

	/*!
	 * Determines whether this object has embedded bounding box information.  Older NIF files can have a bounding box specified in them which will be used for collision detection instead of evaluating the triangles.
	 * \return True if this object has an embedded bounding box, false otherwise.
	 */
	NIFLIB_API bool HasBoundingBox() const;
	
	/*! 
	 * 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.
	 * \sa INode::GetWorldTransform
	 */