<commit_before>//
// NodeOSG.h
//
// Encapsulate behavior for OSG scene graph nodes.
//
// Copyright (c) 2001-2004 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#ifndef VTOSG_NODEH
#define VTOSG_NODEH

namespace osg
{
	class Node;
	class Referenced;
	class Matrixf;
	class Fog;
}

/** \addtogroup sg */
/*@{*/

/**
 * Represents a Node in the vtlib Scene Graph.
 */
class vtNode : public vtNodeBase, public osg::Referenced
{
public:
	virtual void Release();

	// implement vtNodeBase methods
	void SetEnabled(bool bOn);
	bool GetEnabled() const;

	/** Set the name of the node. */
	void SetName2(const char *str);
	/** Get the name of the node. */
	const char *GetName2() const;

	/** Get the Bounding Box of the node, in world coordinates */
	void GetBoundBox(FBox3 &box);

	/** Get the Bounding Sphere of the node, in world coordinates */
	void GetBoundSphere(FSphere &sphere, bool bGlobal = false);

	vtNode *GetParent(int iParent = 0);

	int GetTriCount() { return 0; }

	void SetFog(bool bOn, float start = 0, float end = 10000, const RGBf &color = s_white, int iType = GL_LINEAR);

	// implementation data
	void SetOsgNode(osg::Node *n);
	osg::Node *GetOsgNode() { return m_pNode.get(); }
	vtNodeBase *Clone() { return NULL; }

	static vtNode *LoadModel(const char *filename, bool bDisableMipmaps = false);
	static bool s_bDisableMipmaps;	// set to disable ALL mipmaps

protected:
	osg::ref_ptr<osg::Node> m_pNode;
	osg::ref_ptr<osg::StateSet> m_pFogStateSet;
	osg::ref_ptr<osg::Fog> m_pFog;

	// Constructor is protected because vtNode is an abstract base class,
	//  not to be instantiated directly.
	vtNode();

	// Destructor is protected so that people will use Release() instead,
	//  to ensure that reference counting is respected.
	virtual ~vtNode();
};

/**
 * Represents a Group (a node that can have children) in the vtlib Scene Graph.
 */
class vtGroup : public vtNode, public vtGroupBase
{
public:
	vtGroup(bool suppress = false);
	vtNodeBase *Clone();
	void CopyFrom(const vtGroup *rhs);
	virtual void Release();

	// implement vtGroupBase methods

	/** Add a node as a child of this Group. */
	void AddChild(vtNodeBase *pChild);

	/** Remove a node as a child of this Group.  If the indicated node is not
	 a child, then this method has no effect. */
	void RemoveChild(vtNodeBase *pChild);

	/** Return a child node, by index. */
	vtNode *GetChild(int num) const;

	/** Return the number of child nodes */
	int GetNumChildren() const;

	/** Looks for a descendent node with a given name.  If not found, NULL
	 is returned. */
	const vtNodeBase *FindDescendantByName(const char *name) const;

	/** Return true if the given node is a child of this group. */
	bool ContainsChild(vtNodeBase *pNode) const;

	// OSG-specific Implementation
	osg::Group *GetOsgGroup() { return m_pGroup.get(); }
	const osg::Group *GetOsgGroup() const { return m_pGroup.get(); }

protected:
	void SetOsgGroup(osg::Group *g);
	virtual ~vtGroup();

	osg::ref_ptr<osg::Group> m_pGroup;
};

#ifndef DOXYGEN_SHOULD_SKIP_THIS

class CustomTransform : public osg::MatrixTransform
{
public:
	inline osg::Matrix& getMatrix() { return _matrix; }
	inline const osg::Matrix& getMatrix() const { return _matrix; }
};

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

/**
 * A Transform node allows you to apply a transform (scale, rotate, translate)
 * to all its child nodes.
 */
class vtTransform : public vtGroup, public vtTransformBase
{
public:
	vtTransform();
	vtNodeBase *Clone();
	void CopyFrom(const vtTransform *rhs);
	void Release();

	// implement vtTransformBase methods

	/** Set this transform to identity (no scale, rotation, or translation). */
	void Identity();

	/** Set the translation component of the transform */
	void SetTrans(const FPoint3 &pos);

	/** Get the translation component of the transform */
	FPoint3 GetTrans();

	/** Apply a relative offset (translation) to the transform, in the frame
		of its parent. */
	void Translate1(const FPoint3 &pos);

	/** Apply a relative offset (translation) to the transform, in its own
		frame of reference. */
	void TranslateLocal(const FPoint3 &pos);

	void Rotate2(const FPoint3 &axis, double angle);
	void RotateLocal(const FPoint3 &axis, double angle);
	void RotateParent(const FPoint3 &axis, double angle);
	FPoint3 GetDirection() const;

	void Scale3(float x, float y, float z);

	void SetTransform1(const FMatrix4 &mat);
	void GetTransform1(FMatrix4 &mat);
	void PointTowards(const FPoint3 &point);

	// OSG-specific Implementation
public:
	osg::ref_ptr<CustomTransform> m_pTransform;
	FPoint3			m_Scale;

protected:
	virtual ~vtTransform();
};

/**<commit_msg>removed unused field from vtTransform<commit_after>//
// NodeOSG.h
//
// Encapsulate behavior for OSG scene graph nodes.
//
// Copyright (c) 2001-2004 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#ifndef VTOSG_NODEH
#define VTOSG_NODEH

namespace osg
{
	class Node;
	class Referenced;
	class Matrixf;
	class Fog;
}

/** \addtogroup sg */
/*@{*/

/**
 * Represents a Node in the vtlib Scene Graph.
 */
class vtNode : public vtNodeBase, public osg::Referenced
{
public:
	virtual void Release();

	// implement vtNodeBase methods
	void SetEnabled(bool bOn);
	bool GetEnabled() const;

	/** Set the name of the node. */
	void SetName2(const char *str);
	/** Get the name of the node. */
	const char *GetName2() const;

	/** Get the Bounding Box of the node, in world coordinates */
	void GetBoundBox(FBox3 &box);

	/** Get the Bounding Sphere of the node, in world coordinates */
	void GetBoundSphere(FSphere &sphere, bool bGlobal = false);

	vtNode *GetParent(int iParent = 0);

	int GetTriCount() { return 0; }

	void SetFog(bool bOn, float start = 0, float end = 10000, const RGBf &color = s_white, int iType = GL_LINEAR);

	// implementation data
	void SetOsgNode(osg::Node *n);
	osg::Node *GetOsgNode() { return m_pNode.get(); }
	vtNodeBase *Clone() { return NULL; }

	static vtNode *LoadModel(const char *filename, bool bDisableMipmaps = false);
	static bool s_bDisableMipmaps;	// set to disable ALL mipmaps

protected:
	osg::ref_ptr<osg::Node> m_pNode;
	osg::ref_ptr<osg::StateSet> m_pFogStateSet;
	osg::ref_ptr<osg::Fog> m_pFog;

	// Constructor is protected because vtNode is an abstract base class,
	//  not to be instantiated directly.
	vtNode();

	// Destructor is protected so that people will use Release() instead,
	//  to ensure that reference counting is respected.
	virtual ~vtNode();
};

/**
 * Represents a Group (a node that can have children) in the vtlib Scene Graph.
 */
class vtGroup : public vtNode, public vtGroupBase
{
public:
	vtGroup(bool suppress = false);
	vtNodeBase *Clone();
	void CopyFrom(const vtGroup *rhs);
	virtual void Release();

	// implement vtGroupBase methods

	/** Add a node as a child of this Group. */
	void AddChild(vtNodeBase *pChild);

	/** Remove a node as a child of this Group.  If the indicated node is not
	 a child, then this method has no effect. */
	void RemoveChild(vtNodeBase *pChild);

	/** Return a child node, by index. */
	vtNode *GetChild(int num) const;

	/** Return the number of child nodes */
	int GetNumChildren() const;

	/** Looks for a descendent node with a given name.  If not found, NULL
	 is returned. */
	const vtNodeBase *FindDescendantByName(const char *name) const;

	/** Return true if the given node is a child of this group. */
	bool ContainsChild(vtNodeBase *pNode) const;

	// OSG-specific Implementation
	osg::Group *GetOsgGroup() { return m_pGroup.get(); }
	const osg::Group *GetOsgGroup() const { return m_pGroup.get(); }

protected:
	void SetOsgGroup(osg::Group *g);
	virtual ~vtGroup();

	osg::ref_ptr<osg::Group> m_pGroup;
};

#ifndef DOXYGEN_SHOULD_SKIP_THIS

class CustomTransform : public osg::MatrixTransform
{
public:
	inline osg::Matrix& getMatrix() { return _matrix; }
	inline const osg::Matrix& getMatrix() const { return _matrix; }
};

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

/**
 * A Transform node allows you to apply a transform (scale, rotate, translate)
 * to all its child nodes.
 */
class vtTransform : public vtGroup, public vtTransformBase
{
public:
	vtTransform();
	vtNodeBase *Clone();
	void CopyFrom(const vtTransform *rhs);
	void Release();

	// implement vtTransformBase methods

	/** Set this transform to identity (no scale, rotation, or translation). */
	void Identity();

	/** Set the translation component of the transform */
	void SetTrans(const FPoint3 &pos);

	/** Get the translation component of the transform */
	FPoint3 GetTrans();

	/** Apply a relative offset (translation) to the transform, in the frame
		of its parent. */
	void Translate1(const FPoint3 &pos);

	/** Apply a relative offset (translation) to the transform, in its own
		frame of reference. */
	void TranslateLocal(const FPoint3 &pos);

	void Rotate2(const FPoint3 &axis, double angle);
	void RotateLocal(const FPoint3 &axis, double angle);
	void RotateParent(const FPoint3 &axis, double angle);
	FPoint3 GetDirection() const;

	void Scale3(float x, float y, float z);

	void SetTransform1(const FMatrix4 &mat);
	void GetTransform1(FMatrix4 &mat);
	void PointTowards(const FPoint3 &point);

	// OSG-specific Implementation
public:
	osg::ref_ptr<CustomTransform> m_pTransform;

protected:
	virtual ~vtTransform();
};

/**
{'fraction_non_alphanumeric': 0.11310804993542832, 'fraction_numerical': 0.007640981489453293, 'mean_word_length': 4.209080717488789, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6792674', 'n_tokens_mistral': 3133, 'n_tokens_neox': 3008, 'n_words': 1070}