void GBLStorageManagerStateTestBB::RetrieveStateTest( CKContext *ctx ) { XString outputStr; XString data; outputStr.Format( "Calling RetrieveState( %d, &<data>, %d, %d )", (int)testUserID, (int)testLAEID, componentID ); OutputTestText( ctx, outputStr ); StartTimeMeasure(); CGBLCOError res = pInterface->RetrieveState( testUserID, &data, testLAEID, componentID ); StopAndOutputTimeMeasure( ctx ); outputStr.Format( "RetrieveState result: %s", (const char*)res ); OutputTestText( ctx, outputStr ); if (res == CGBLCOError::EGBLCOErrorType::GBLCO_OK) { outputStr.Format( "State data retrieved: %s", data.Str() ); OutputTestText( ctx, outputStr ); if( testData == data ) OutputTestText( ctx, XString("TEST PASSED") ); else OutputTestText( ctx, XString("Retrieved data doesn't match saved data\r\nTEST FAILED") ); } else OutputTestText( ctx, XString("TEST FAILED") ); }
void CGBLStorageManagerTestBBBase::RunUnitTests( CKContext *ctx, TestCase *testCases, int numTests, XString &testRunTitle ) { XString outputString; // Initialise the test run timer totalExecutionTime = 0; // Generate the current time time_t seconds; seconds = time (NULL); struct tm * timeinfo; timeinfo = localtime ( &seconds ); // Output a formatted intro to the test run outputString = "############################################################################\r\n"; outputString << testRunTitle << "\r\n"; outputString << asctime (timeinfo) << "\r\n"; outputString << "############################################################################\r\n"; OutputTestText( ctx, outputString ); // Iterate over each test and execute it... for( int i = 0; i < numTests; i++ ) { XString testIntroText; // First, write some intro text to the output OutputTestText( ctx, XString("----------------------------------------------------------------------------") ); testIntroText.Format( "Test number %d\r\nExecuting unit test '%s'...", i+1, testCases[i].testName ); OutputTestText( ctx, testIntroText ); OutputTestText( ctx, XString("----------------------------------------------------------------------------\r\n") ); // Now execute the actual test case testCases[i].testFunction( ctx ); // Now append some end of test text testIntroText.Format( "End of test number %d", i+1 ); OutputTestText( ctx, testIntroText ); OutputTestText( ctx, XString("----------------------------------------------------------------------------\r\n") ); } outputString = ""; outputString << "############################################################################\r\n"; outputString << "Total execution time = " << totalExecutionTime << " seconds\r\n"; outputString << "############################################################################\r\n"; outputString << "######################## END OF TEST ###########################"; OutputTestText( ctx, outputString ); }
CKERROR LoadCallBack(CKUICallbackStruct& loaddata,void*) { if (GetPlayer().GetPAppStyle()->UseSplash() && GetPlayer().GetPAppStyle()->ShowLoadingProcess()) { if(loaddata.Reason == CKUIM_LOADSAVEPROGRESS ){ if (loaddata.NbObjetsLoaded % 10 == 0) { float progress = (static_cast<float>(loaddata.NbObjetsLoaded) / static_cast<float>(loaddata.NbObjetsToLoad)) ; progress *=100; int out = static_cast<int>(progress); XString percStr; percStr.Format("Load... %d %s",out,"%"); if (xSplash::GetSplash()) { GetPlayer().SetSplashText(percStr.Str()); if (progress > 99.9F) { GetPlayer().HideSplash(); //Sleep(3000); } } } } } return CK_OK; }
void PhysicManager::_checkObjectsByAttribute(CKScene *newScene) { CKAttributeManager* attman = m_Context->GetAttributeManager(); int sizeJFuncMap = ATT_FUNC_TABLE_SIZE;//(sizeof(*getRegistrationTable()) / sizeof((getRegistrationTable())[0])); for (int fIndex = 0 ; fIndex < sizeJFuncMap ; fIndex ++) { std::vector<int>attributeIdList; pFactory::Instance()->findAttributeIdentifiersByGuid(getRegistrationTable()[fIndex].guid,attributeIdList); int attCount = attributeIdList.size(); for (int i = 0 ; i < attCount ; i++ ) { int currentAttType = attributeIdList.at(i); const XObjectPointerArray& Array = attman->GetAttributeListPtr( attributeIdList.at(i) ); for (CKObject** it = Array.Begin(); it != Array.End(); ++it) { CK3dEntity *target = static_cast<CK3dEntity*>(*it); if (target) { XString error; error.Format("Registering :%s with %s",target->GetName(),attman->GetAttributeNameByType(currentAttType)); //if(!strcmp( target->GetName(),"smutan3-3" ) ) { // xLogger::xLog(XL_START,ELOGTRACE,E_LI_MANAGER,"problem case" ); } // CKScene *levelScene = GetContext()->GetCurrentLevel()->GetCurrentScene(); // we check as no scene is current in use if ( ( GetContext()->GetCurrentLevel()->GetLevelScene() == newScene && !isSceneObject2(target) ) || ( newScene && newScene->IsObjectHere(target) && newScene !=GetContext()->GetCurrentLevel()->GetLevelScene() ) || ( newScene && GetContext()->GetCurrentLevel()->GetCurrentScene() && GetContext()->GetCurrentLevel()->GetCurrentScene() == newScene && newScene !=GetContext()->GetCurrentLevel()->GetLevelScene() && newScene->IsObjectHere(target) ) || ( (physicFlags & PMF_DONT_DELETE_SCENES) ) ) { xLogger::xLog(XL_START,ELOGTRACE,E_LI_MANAGER,error.CStr() ); (*getRegistrationTable()[fIndex].rFunc)(target,currentAttType,true,false); GetPMan()->getCheckList().PushBack(target->GetID()); } } } } } }
void GBLStorageManagerStateTestBB::StoreExistingStateTest( CKContext *ctx ) { XString outputStr; testData = "StoreExistingStateTest test state data - updated after initial storage"; outputStr.Format( "Calling StoreState( %d, %s, %d, %d )", (int)testUserID, testData.Str(), (int)testLAEID, componentID ); OutputTestText( ctx, outputStr ); StartTimeMeasure(); CGBLCOError res = pInterface->StoreState( testUserID, testData, testLAEID, componentID ); StopAndOutputTimeMeasure( ctx ); outputStr.Format( "StoreState result: %s", (const char*)res ); OutputTestText( ctx, outputStr ); if (res == CGBLCOError::EGBLCOErrorType::GBLCO_OK) { OutputTestText( ctx, XString("TEST PASSED") ); } else OutputTestText( ctx, XString("TEST FAILED") ); }
void GBLStorageManagerStateTestBB::RetrieveStateTestInvalidParameters( CKContext *ctx ) { XString outputStr; XString data; CGBLUserID invalidUser; outputStr.Format( "Calling RetrieveState( %d, &<data>, %d, %d )", (int)invalidUser, (int)testLAEID, componentID ); OutputTestText( ctx, outputStr ); StartTimeMeasure(); CGBLCOError res = pInterface->RetrieveState( invalidUser, &data, testLAEID, componentID ); StopAndOutputTimeMeasure( ctx ); outputStr.Format( "RetrieveState result: %s", (const char*)res ); OutputTestText( ctx, outputStr ); if( res == CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL && (int)res == GBLSM_ERROR_GENERAL_INCORRECT_PARAM ) { OutputTestText( ctx, XString("TEST PASSED") ); } else OutputTestText( ctx, XString("TEST FAILED") ); }
void bodyDefaultFunctionMerged(CKParameter*in) { CKStructHelper sHelper(in); //if ( ==0 ) //happens when dev is being opened and loads a cmo with physic objects. XString msg; msg.Format("parameter members : %d",sHelper.GetMemberCount()); if(bodyCreateFuncOld!=0 ) { bodyCreateFuncOld(in); xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,msg.Str()); } return; // CKParameter //CKAttributeManager::SetAttributeDefaultValue() }
pRigidBody*pFactory::cloneRigidBody(CK3dEntity *src,CK3dEntity *dst,CKDependencies *deps,int copyFlags,int bodyFlags/* =0 */) { //src->Rest pRigidBody *result = GetPMan()->getBody(dst); pRigidBody *srcBody = GetPMan()->getBody(src); CK3dEntity *referenceObject = dst; XString errMsg; pObjectDescr oDescr; //---------------------------------------------------------------- // // sanity checks // #ifdef _DEBUG assert(src); assert(dst); #endif // _DEBUG if (!(copyFlags & PB_CF_PHYSICS)) { errMsg.Format("Nothing to copy, aborting"); xLogger::xLog(XL_START,ELOGWARNING,E_LI_MANAGER,errMsg.Str()); return NULL; } //iAssertW(!result,"","Object :%s already physicalized"); //---------------------------------------------------------------- // // fill object description // if (!result && IParameter::Instance()->copyTo(oDescr,src,copyFlags)) { pWorld *world = GetPMan()->getWorld(oDescr.worlReference) ? GetPMan()->getWorld(oDescr.worlReference) : GetPMan()->getDefaultWorld(); if(world) { if ( (copyFlags && PB_CF_OVRRIDE_BODY_FLAGS) ) oDescr.flags = (BodyFlags)bodyFlags; //now create the final rigid body : result = pFactory::Instance()->createRigidBody(dst,oDescr); } } if (!result){ xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,"cloning failed"); return NULL; } //---------------------------------------------------------------- // // clone joints // if ( (copyFlags & PB_CF_JOINTS) ) { pFactory::cloneJoints(src,dst,copyFlags); } //---------------------------------------------------------------- // // copy velocities // if ( (copyFlags & PB_CF_VELOCITIES) ) { NxActor *actorSrc = srcBody->getActor(); NxActor *actorDst = result->getActor(); actorDst->setLinearVelocity( actorSrc->getLinearVelocity() ); actorDst->setAngularVelocity( actorSrc->getAngularVelocity() ); } //---------------------------------------------------------------- // // copy forces // if ( (copyFlags & PB_CF_FORCE) ) { NxActor *actorSrc = srcBody->getActor(); NxActor *actorDst = result->getActor(); actorDst->setLinearMomentum( actorSrc->getLinearMomentum() ); actorDst->setAngularMomentum( actorSrc->getAngularMomentum() ); } //---------------------------------------------------------------- // // copy sub shapes if : // // "Copy Children In Dependencies" && // ( copyFlags::OverrideBodyFlags & hierarchy && newBodyFlags & hierarchy ) || // ( oldBodyFlags & hierarchy ) if ( ((*deps->At(CKCID_3DENTITY)) & CK_DEPENDENCIES_COPY_3DENTITY_CHILDREN) && ( (( copyFlags & PB_CF_OVRRIDE_BODY_FLAGS ) && (bodyFlags & BF_Hierarchy)) || ( oDescr.flags & BF_Hierarchy) ) ) { int dCount = dst->GetChildrenCount(); CK3dEntity* subEntity = NULL; while (subEntity= dst->HierarchyParser(subEntity) ) { if (subEntity==dst) continue; CK3dEntity *orginalObject = findSimilarInSourceObject(src,dst,subEntity); if (orginalObject) { iAssertW(cloneShape(orginalObject,subEntity,dst,copyFlags,bodyFlags),"","clone of sub shape failed"); } } } return NULL; }
//************************************ // Method: PBPhysicalizeEx // FullName: PBPhysicalizeEx // Access: public // Returns: int // Qualifier: // Parameter: const CKBehaviorContext& behcontext //************************************ int PBPhysicalizeEx(const CKBehaviorContext& behcontext) { using namespace vtTools::BehaviorTools; using namespace vtTools; using namespace vtTools::AttributeTools; using namespace vtTools::ParameterTools; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // // objects // CKBehavior* beh = behcontext.Behavior; CKContext* ctx = behcontext.Context; PhysicManager *pm = GetPMan(); pFactory *pf = pFactory::Instance(); //the object : CK3dEntity *target = (CK3dEntity *) beh->GetTarget(); if( !target ) bbErrorME("No Reference Object specified"); //the world reference, optional used CK3dEntity*worldRef = NULL; //the world object, only used when reference has been specified pWorld *world = NULL; //final object description pObjectDescr *oDesc = new pObjectDescr(); pRigidBody *body = NULL; XString errMesg; //---------------------------------------------------------------- // // sanity checks // // rigid body GetPMan()->getBody(target); if( body){ errMesg.Format("Object %s already registered.",target->GetName()); bbErrorME(errMesg.Str()); } //---------------------------------------------------------------- // // // if (!GetPMan()->isValid()) GetPMan()->performInitialization(); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // // Collecting data. Stores all settings in a pObjectDescr. // //get the parameter array BB_DECLARE_PIMAP; //---------------------------------------------------------------- // // generic settings // oDesc->hullType = (HullType)GetInputParameterValue<int>(beh,bbI_HullType); oDesc->flags = (BodyFlags)GetInputParameterValue<int>(beh,bbI_Flags); oDesc->density = GetInputParameterValue<float>(beh,bbI_Density); //---------------------------------------------------------------- // optional // world // BBSParameterM(bbI_World,BB_SSTART); if (sbbI_World) { worldRef = (CK3dEntity *) beh->GetInputParameterObject(BB_IP_INDEX(bbI_World)); if (worldRef) { world = GetPMan()->getWorld(worldRef,target); if (!world) { xLogger::xLog(ELOGERROR,E_LI_MANAGER,"World reference has been specified but no valid world object found. Switching to default world"); goto errorFound; } } } //---------------------------------------------------------------- // optional // Pivot // BBSParameterM(bbI_Pivot,BB_SSTART); if (sbbI_Pivot) { CKParameter*pivotParameter = beh->GetInputParameter(BB_IP_INDEX(bbI_Pivot))->GetRealSource(); if (pivotParameter) { IParameter::Instance()->copyTo(oDesc->pivot,pivotParameter); oDesc->mask |= OD_Pivot; } } //---------------------------------------------------------------- // optional // mass // BBSParameterM(bbI_Mass,BB_SSTART); if (sbbI_Mass) { CKParameter*massParameter = beh->GetInputParameter(BB_IP_INDEX(bbI_Mass))->GetRealSource(); if (massParameter) { IParameter::Instance()->copyTo(oDesc->mass,massParameter); oDesc->mask |= OD_Mass; } } //---------------------------------------------------------------- // optional // collision // BBSParameterM(bbI_Collision , BB_SSTART); if (sbbI_Collision) { CKParameter*par = beh->GetInputParameter(BB_IP_INDEX(bbI_Collision))->GetRealSource(); if (par) { oDesc->collisionGroup = GetValueFromParameterStruct<int>(par,PS_BC_GROUP,false); CKParameterOut* maskPar = GetParameterFromStruct(par,PS_BC_GROUPSMASK); if (maskPar) { oDesc->groupsMask.bits0 = GetValueFromParameterStruct<int>(maskPar,0); oDesc->groupsMask.bits1 = GetValueFromParameterStruct<int>(maskPar,1); oDesc->groupsMask.bits2 = GetValueFromParameterStruct<int>(maskPar,2); oDesc->groupsMask.bits3 = GetValueFromParameterStruct<int>(maskPar,3); } oDesc->skinWidth = GetValueFromParameterStruct<float>(par,PS_BC_SKINWITDH,false); IParameter::Instance()->copyTo(oDesc->collision,par); oDesc->mask |= OD_Collision; } } //---------------------------------------------------------------- // optional // collision : CCD // BBSParameterM(bbI_CCD, BB_SSTART); if (sbbI_CCD) { CKParameter*par = beh->GetInputParameter(BB_IP_INDEX(bbI_CCD))->GetRealSource(); if (par) { IParameter::Instance()->copyTo(oDesc->ccd,par); oDesc->mask |= OD_CCD; } } //---------------------------------------------------------------- // optional // optimization // BBSParameterM(bbI_Optimization, BB_SSTART); if (sbbI_Optimization) { CKParameter*par = beh->GetInputParameter(BB_IP_INDEX(bbI_Optimization))->GetRealSource(); if (par) { IParameter::Instance()->copyTo(oDesc->optimization,par); oDesc->mask |= OD_Optimization; } } //---------------------------------------------------------------- // optional // Material // BBSParameterM(bbI_Material, BB_SSTART); if (sbbI_Material) { CKParameter*par = beh->GetInputParameter(BB_IP_INDEX(bbI_Material))->GetRealSource(); if (par) { pFactory::Instance()->copyTo(oDesc->material,par); oDesc->mask |= OD_Material; } } //---------------------------------------------------------------- // optional // capsule // BBSParameterM(bbI_Capsule, BB_SSTART); if (sbbI_Capsule) { if (oDesc->hullType == HT_Capsule) { CKParameter*par = beh->GetInputParameter(BB_IP_INDEX(bbI_Capsule))->GetRealSource(); if (par) { IParameter::Instance()->copyTo(oDesc->capsule,par); oDesc->mask |= OD_Capsule; } }else{ errMesg.Format("You attached a capsule parameter but the hull type is not capsule"); bbWarning(errMesg.Str()); } } //---------------------------------------------------------------- // optional // convex cylinder // BBSParameterM(bbI_CCylinder, BB_SSTART); if (sbbI_CCylinder) { if (oDesc->hullType == HT_ConvexCylinder) { CKParameter*par = beh->GetInputParameter(BB_IP_INDEX(bbI_CCylinder))->GetRealSource(); if (par) { pFactory::Instance()->copyTo(oDesc->convexCylinder,par,true); oDesc->mask |= OD_ConvexCylinder; } }else{ errMesg.Format("You attached a convex cylinder parameter but the hull type is not a convex cylinder"); bbWarning(errMesg.Str()); } } oDesc->version = pObjectDescr::E_OD_VERSION::OD_DECR_V1; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // // body creation // if (!body) { if(! (oDesc->flags & BF_SubShape) ) { body = pFactory::Instance()->createRigidBody(target,*oDesc); } } if (!body) { SAFE_DELETE(oDesc); bbErrorME("No Reference Object specified"); } ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // // attribute creation, attach settings // if (oDesc->flags & BF_AddAttributes ) { //body->saveToAttributes(oDesc); GetPMan()->copyToAttributes(*oDesc,target); } //---------------------------------------------------------------- // // update input parameters // if (sbbI_Material) { CKParameterOut *par = (CKParameterOut*)beh->GetInputParameter(BB_IP_INDEX(bbI_Material))->GetRealSource(); if (par) { pFactory::Instance()->copyTo(par,oDesc->material); } } //---------------------------------------------------------------- // // cleanup // //SAFE_DELETE(oDesc); //---------------------------------------------------------------- // // error out // errorFound: { beh->ActivateOutput(0); return CKBR_GENERICERROR; } //---------------------------------------------------------------- // // All ok // allOk: { beh->ActivateOutput(0); return CKBR_OK; } return 0; }
pWheel *pFactory::createWheelSubShape(pRigidBody *body,CK3dEntity* subEntity,CKMesh *mesh,pObjectDescr *descr,VxVector localPos, VxQuaternion localRotation,NxShape*dstShape) { //################################################################ // // Sanity checks // #ifdef _DEBUG assert(body && subEntity && descr ); // Should never occur ! #endif // _DEBUG XString errorStr; //################################################################ // // Retrieve the wheel setting from attribute // int attTypeWheelSettings = GetPMan()->att_wheelDescr; int attTypeConvexCylinderSettings = GetPMan()->getAttributeTypeByGuid(VTS_PHYSIC_CONVEX_CYLDINDER_WHEEL_DESCR); if (!subEntity->HasAttribute(attTypeWheelSettings)) { errorStr.Format("Object %s has been set as wheel but there is no wheel attribute attached",subEntity->GetName()); xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,errorStr.CStr()); return NULL; } pWheelDescr *wDescr = new pWheelDescr(); CKParameterOut *par = subEntity->GetAttributeParameter(attTypeWheelSettings); if (par) { int err = copyTo(wDescr,par); if (!wDescr->isValid() ) { xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,"Wheel Description is invalid"); SAFE_DELETE(wDescr); return NULL; } } //################################################################ // // Construct the final wheel object basing on the type of the wheel // pWheel *result = NULL; //if(wDescr->wheelFlags & WF_UseWheelShape) { result = new pWheel2(body,wDescr,subEntity); /*else { //################################################################ // Wheel type 1 specified, check there is also a override for the convex cylinder if (!subEntity->HasAttribute(attTypeConvexCylinderSettings)) { errorStr.Format("Object %s has been created with default settings for convex cylinder shape",subEntity->GetName()); xLogger::xLog(XL_START,ELOGWARNING,E_LI_MANAGER,errorStr.CStr()); } result = new pWheel1(body,wDescr); }*/ //################################################################ // // Create the wheel shape // //if(wDescr->wheelFlags & WF_UseWheelShape){ dstShape=_createWheelShape2(body->getActor(),descr,wDescr,subEntity,mesh,localPos,localRotation); ((pWheel2*)result)->setWheelShape((NxWheelShape*)dstShape); // } /*else { dstShape=_createWheelShape1(body->getActor(),(pWheel1*)result,descr,wDescr,subEntity,mesh,localPos,localRotation); }*/ if (!dstShape) { errorStr.Format("Couldn't create wheel shape for object %s",subEntity->GetName()); xLogger::xLog(XL_START,ELOGWARNING,E_LI_MANAGER,errorStr.CStr()); SAFE_DELETE(wDescr); SAFE_DELETE(result); return NULL; } //################################################################ // // Finalize wheel setup // result->setEntID(subEntity->GetID()); return result; }
pJoint*PhysicManager::getJoint(CK3dEntity*referenceA,CK3dEntity*referenceB/* =NULL */,JType type/* =JT_Any */) { pJoint *result = NULL; pRigidBody *a = GetPMan()->getBody(referenceA); pRigidBody *b = GetPMan()->getBody(referenceB); pWorld *wA = a ? a->getWorld() : NULL; pWorld *wB = b ? b->getWorld() : NULL; pWorld *worldFinal = NULL; bool oneBodyJoint = false;// body with world frame ? CK3dEntity* oneBodyJointReference =NULL; //---------------------------------------------------------------- // // Sanity Checks // XString errorString; // Reference A physicalized at all ? if ( !referenceA && !referenceB ) { errorString.Format("No reference specified"); xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,errorString.Str()); return result; } // Reference A IS NOT Reference B ? if ( (referenceA!=NULL && referenceB!=NULL) && (a==b) ) { errorString.Format("Reference A (%s) is the same as Reference B (%s)",referenceA->GetName()); xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,errorString.Str()); return result; } // Reference A physicalized at all ? if (referenceA && !a){ errorString.Format("Reference A (%s) valid but not physicalized",referenceA->GetName()); xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,errorString.Str()); return result; } // Reference B physicalized at all ? if (referenceB && !b){ errorString.Format("Reference B (%s) valid but not physicalized",referenceB->GetName()); xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,errorString.Str()); return result; } // world of object a valid ? if (a && !wA){ errorString.Format("Reference A (%s) is physicalized but has no valid world object",referenceA->GetName()); xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,errorString.Str()); return result; } // world of object b valid ? if (b && !wB){ errorString.Format("Reference B (%s) is physicalized but has no valid world object",referenceB->GetName()); xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,errorString.Str()); return result; } // rigid bodies are in the same world if ( (wA!=NULL && wB!=NULL) && (wA!=wB) ) { errorString.Format("Reference A (%s) and B(%s) is physicalized but are not in the same world",referenceA->GetName(),referenceB->GetName()); xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,errorString.Str()); return result; } //---------------------------------------------------------------- // // Preparing lookup // if ( wA ) worldFinal = wA; if ( wB ) worldFinal = wB; // constraint is attached to world frame ? if ( (a && !b) || (b && !a) ) oneBodyJoint = true; // world frame constraint, track the reference if (oneBodyJoint) { if ( a ) oneBodyJointReference = referenceA; if ( b ) oneBodyJointReference = referenceB; } //---------------------------------------------------------------- // // Parse the scene joints // NxU32 jointCount = worldFinal->getScene()->getNbJoints(); if (jointCount) { NxArray< NxJoint * > joints; worldFinal->getScene()->resetJointIterator(); for (NxU32 i = 0; i < jointCount; ++i) { NxJoint *j = worldFinal->getScene()->getNextJoint(); pJoint *_cJoint = static_cast<pJoint*>( j->userData ); if (!_cJoint) continue; //---------------------------------------------------------------- // // Special case : has a joint at all, only for world frame constraints // if (type == JT_Any) { if ( oneBodyJoint && _cJoint->GetVTEntA() == oneBodyJointReference || _cJoint->GetVTEntB() == oneBodyJointReference ) return _cJoint; } //---------------------------------------------------------------- // // Specific joint type // if ( j->getType() == type) { //---------------------------------------------------------------- // // world constraint joint // if (oneBodyJoint && _cJoint->GetVTEntA() == oneBodyJointReference || _cJoint->GetVTEntB() == oneBodyJointReference ) return _cJoint; //---------------------------------------------------------------- // // Two references given // if ( _cJoint->GetVTEntA() == referenceA && _cJoint->GetVTEntB() == referenceB ) return _cJoint; if ( _cJoint->GetVTEntA() == referenceB && _cJoint->GetVTEntB() == referenceA ) return _cJoint; } } } return NULL; }
void CGBLStorageManagerTestBBBase::DescribeArray( CKDataArray *fieldValues, CKContext *ctx ) { int cols = fieldValues->GetColumnCount(); int rows = fieldValues->GetRowCount(); if (cols == 0) { OutputTestText( ctx, XString("Array contains no columns") ); return; } if (rows == 0) { OutputTestText( ctx, XString("Array contains no rows (no results were returned)") ); return; } XString opStr; opStr.Format( "Results (%d columns, %d rows):", cols, rows ); OutputTestText( ctx, opStr ); for (int row = 0; row < rows; row++) { for (int i=0; i<cols; i++) { XString str; str.Format( "%s (", fieldValues->GetColumnName(i) ); int type = fieldValues->GetColumnType(i); if (type == CKARRAYTYPE_PARAMETER) { str << ctx->GetParameterManager()->ParameterGuidToName(fieldValues->GetColumnParameterGuid(i)); } else { switch (fieldValues->GetColumnType(i)) { case CKARRAYTYPE_INT: str << "int"; break; case CKARRAYTYPE_FLOAT: str << "float"; break; case CKARRAYTYPE_STRING: str << "string"; break; case CKARRAYTYPE_OBJECT: str << "object"; break; default: str << "UNKNOWN TYPE"; break; } } str << ") : "; CKSTRING valueField = NULL; int labelLength = fieldValues->GetElementStringValue(row, i, NULL); valueField = new CKCHAR[labelLength]; fieldValues->GetElementStringValue(row, i, valueField); str << valueField; OutputTestText( ctx, str ); delete [] valueField; } //trace << endl; } }