/* Helper function to process two matrices that we need to interpolate between */ void ProcessInterpolateMatrix(Matrix4x4& aMatrix, const nsCSSValue::Array* aData, nsStyleContext* aContext, nsPresContext* aPresContext, RuleNodeCacheConditions& aConditions, TransformReferenceBox& aRefBox, bool* aContains3dTransform) { NS_PRECONDITION(aData->Count() == 4, "Invalid array!"); Matrix4x4 matrix1, matrix2; if (aData->Item(1).GetUnit() == eCSSUnit_List) { matrix1 = nsStyleTransformMatrix::ReadTransforms(aData->Item(1).GetListValue(), aContext, aPresContext, aConditions, aRefBox, nsPresContext::AppUnitsPerCSSPixel(), aContains3dTransform); } if (aData->Item(2).GetUnit() == eCSSUnit_List) { matrix2 = ReadTransforms(aData->Item(2).GetListValue(), aContext, aPresContext, aConditions, aRefBox, nsPresContext::AppUnitsPerCSSPixel(), aContains3dTransform); } double progress = aData->Item(3).GetPercentValue(); aMatrix = StyleAnimationValue::InterpolateTransformMatrix(matrix1, matrix2, progress) * aMatrix; }
/* Helper function to process two matrices that we need to interpolate between */ void ProcessInterpolateMatrix(gfx3DMatrix& aMatrix, const nsCSSValue::Array* aData, nsStyleContext* aContext, nsPresContext* aPresContext, bool& aCanStoreInRuleTree, nsRect& aBounds) { NS_PRECONDITION(aData->Count() == 4, "Invalid array!"); gfx3DMatrix matrix1, matrix2; if (aData->Item(1).GetUnit() == eCSSUnit_List) { matrix1 = nsStyleTransformMatrix::ReadTransforms(aData->Item(1).GetListValue(), aContext, aPresContext, aCanStoreInRuleTree, aBounds, nsPresContext::AppUnitsPerCSSPixel()); } if (aData->Item(2).GetUnit() == eCSSUnit_List) { matrix2 = ReadTransforms(aData->Item(2).GetListValue(), aContext, aPresContext, aCanStoreInRuleTree, aBounds, nsPresContext::AppUnitsPerCSSPixel()); } double progress = aData->Item(3).GetPercentValue(); aMatrix = StyleAnimationValue::InterpolateTransformMatrix(matrix1, matrix2, progress) * aMatrix; }
bool HesperisIO::ReadMeshes(HesperisFile * file, MObject &target) { MGlobal::displayInfo("opium read mesh"); HWorld grpWorld; ReadTransforms(&grpWorld, target); // ReadMeshes(&grpWorld, target); grpWorld.close(); return true; }
/*----------------------------------------------------------------------------- * ReadLevel * Read in the level file and set up the next list *-----------------------------------------------------------------------------*/ void ReadLevel(FILE* file, char* buf) { /* Read the level */ fgets(buf, BUF_SIZ, file); if(!feof(file)) { /* Create the levels */ ReadTransforms(buf, &tlLevel); CopyList( &tlLevel, &tlAvailableTransforms ); } else gameComplete = TRUE; }
/* Helper function to process two matrices that we need to interpolate between */ /* static */ gfx3DMatrix nsStyleTransformMatrix::ProcessInterpolateMatrix(const nsCSSValue::Array* aData, nsStyleContext* aContext, nsPresContext* aPresContext, PRBool& aCanStoreInRuleTree, nsRect& aBounds, float aAppUnitsPerMatrixUnit) { NS_PRECONDITION(aData->Count() == 5, "Invalid array!"); double coeff1 = aData->Item(1).GetPercentValue(); gfx3DMatrix matrix1 = ReadTransforms(aData->Item(2).GetListValue(), aContext, aPresContext, aCanStoreInRuleTree, aBounds, aAppUnitsPerMatrixUnit); double coeff2 = aData->Item(3).GetPercentValue(); gfx3DMatrix matrix2 = ReadTransforms(aData->Item(4).GetListValue(), aContext, aPresContext, aCanStoreInRuleTree, aBounds, aAppUnitsPerMatrixUnit); gfxMatrix matrix2d1, matrix2d2; #ifdef DEBUG PRBool is2d = #endif matrix1.Is2D(&matrix2d1); NS_ABORT_IF_FALSE(is2d, "Can't do animations with 3d transforms!"); #ifdef DEBUG is2d = #endif matrix2.Is2D(&matrix2d2); NS_ABORT_IF_FALSE(is2d, "Can't do animations with 3d transforms!"); return gfx3DMatrix::From2D( nsStyleAnimation::InterpolateTransformMatrix(matrix2d1, coeff1, matrix2d2, coeff2)); }
bool HesperisIO::ReadTransforms(HBase * parent, MObject &target) { std::vector<std::string > tmNames; parent->lsTypedChild<HTransform>(tmNames); std::vector<std::string>::const_iterator it = tmNames.begin(); for(;it!=tmNames.end();++it) { std::string nodeName = *it; SHelper::behead(nodeName, parent->pathToObject()); SHelper::behead(nodeName, "/"); HBase child(*it); MObject otm = MObject::kNullObj; if(!FindNamedChild(otm, nodeName, target)) { MFnTransform ftransform; otm = ftransform.create(target); SHelper::noColon(nodeName); ftransform.setName(nodeName.c_str()); } ReadTransforms(&child, otm); ReadCurves(&child, otm); child.close(); } return true; }