Example #1
0
/*
 * Get the orientation vectors
 */
void					CListenerAL::getOrientation( NLMISC::CVector& front, NLMISC::CVector& up ) const
{
	// Forward then up
	ALfloat v[6];
	alGetListenerfv( AL_ORIENTATION, v );
	alTestError();
	// Coordsys conversion
	front.set( v[0], -v[2], v[1] );
	up.set( v[3], -v[5], v[4] );
}
Example #2
0
/*
 * Get the velocity vector
 */
void				 	CListenerAL::getVelocity( NLMISC::CVector& vel ) const
{
#ifdef NL_OS_WINDOWS
	// Coordsys conversion
	float glposz;
	alGetListener3f( AL_VELOCITY, &vel.x, &vel.z, &glposz );
	vel.y = - glposz;
#else
	float velarray [3];
	alGetListenerfv( AL_VELOCITY, velarray );
	// Coordsys conversion
	vel.set( velarray[0], -velarray[2], velarray[1] );
#endif
	alTestError();
}
Example #3
0
// ***************************************************************************
void CExportNel::getNELBoneLocalScale(INode &node, TimeValue time, NLMISC::CVector &nelScale)
{
	// To get the correct local Scale, we use an other bone as reference (if present)
	INode	*referenceNode= getNELScaleReferenceNode(node);

	// get the Max local pos.
	Matrix3 localTM (TRUE);
	getLocalMatrix (localTM, node, time);
	NLMISC::CVector		maxScale;
	NLMISC::CQuat		maxRot;
	NLMISC::CVector		maxPos;
	decompMatrix (maxScale, maxRot, maxPos, localTM);


	// Biped node case, take the scale from ratio with the reference node.
	if(isBipedNode(node))
	{
		// Replace scale with ratio from reference value, if possible
		if (referenceNode)
		{
			ScaleValue	scaleValue;
			// get my Offset scale.
			CVector		myScale;
			scaleValue = node.GetObjOffsetScale();
			myScale.x= scaleValue.s.x;
			myScale.y= scaleValue.s.y;
			myScale.z= scaleValue.s.z;

			// get its Offset scale.
			CVector		refScale;
			scaleValue = referenceNode->GetObjOffsetScale();
			refScale.x= scaleValue.s.x;
			refScale.y= scaleValue.s.y;
			refScale.z= scaleValue.s.z;

			// Get The ratio as the result
			nelScale.x= myScale.x / refScale.x;
			nelScale.y= myScale.y / refScale.y;
			nelScale.z= myScale.z / refScale.z;
		}
		else
		{
			// Not present, suppose no scale.
			nelScale.set(1,1,1);
		}

	}
	// get the scale from std way.
	else
	{
		// We are a normal node here, not biped.

		/* If this node do not inherit scale (ie must unherit), then we must not take the localScale computed 
			with getLocalMatrix. In this case, the local Scale is simply the NodeTM scale.
		*/
		if( getNELUnHeritFatherScale(node) )
		{
			Matrix3	nodeTM;
			nodeTM = node.GetNodeTM (time);
			decompMatrix (maxScale, maxRot, maxPos, nodeTM);
			// Get the scale from worldMatrix.
			nelScale= maxScale;
		}
		else
		{
			// Get the scale from localMatrix.
			nelScale= maxScale;
		}
	}

}