Пример #1
0
/*!
	@function	TranslationV1ToObject
	
	@abstract	Attempt to convert a VRML 1 Translation node to a Quesa object.
	
	@param		ioNode		Node to convert.
	@param		inReader	The reader object.
	
	@result		An object reference, or NULL on failure.
*/
CQ3ObjectRef	TranslationV1ToObject( PolyValue& ioNode, CVRMLReader& inReader )
{
#pragma unused( inReader )
	CQ3ObjectRef	theTransform;
	
	PolyValue::Dictionary&	theDict( ioNode.GetDictionary() );

	if (IsKeyPresent( theDict, "translation" ))
	{
		PolyValue&	transValue( theDict["translation"] );
		if (transValue.IsNumberVec())
		{
			PolyValue::FloatVec& transVec( transValue.GetFloatVec() );
			if (transVec.size() == 3)
			{
				TQ3Vector3D	translate = {
					transVec[0], transVec[1], transVec[2]
				};
				theTransform = CQ3ObjectRef( Q3TranslateTransform_New( &translate ) );
				
				if (theTransform.isvalid())
				{
					SetCachedObject( ioNode, theTransform );
				}
			}
		}
	}
	
	return theTransform;
}
Пример #2
0
static TQ3GroupPosition MyAddTransformedObjectToGroup( TQ3GroupObject theGroup, TQ3Object theObject, TQ3Vector3D *translation )
{
	TQ3TransformObject	transform;

	transform = Q3TranslateTransform_New(translation);
	Q3Group_AddObject(theGroup, transform);	
	Q3Object_Dispose(transform);
	return Q3Group_AddObject(theGroup, theObject);	
}