void Grid::PopulateCells(Entity* ent) { BoxCollider* box = ent->GetComponent<BoxCollider>(); if (box) { box->cell = cell; box->part.clear(); Vector3 min = box->GetMinCoord(); Vector3 max = box->GetMaxCoord(); min.x /= GridWidth; min.x *= NumberOfPartitionsX; max.x /= GridWidth; max.x *= NumberOfPartitionsX; min.y /= GridHeight; min.y *= NumberOfPartitionsY; max.y /= GridHeight; max.y *= NumberOfPartitionsY; for (int i = min.x; i <= max.x; ++i) for (int j = min.y; j <= max.y; ++j) { Partition* c = GetPartition(i, j); if (c) { c->Add(ent); box->part.push_back(c); } } } for (auto &child : ent->GetChildren()) { if (child->IsActive()) PopulateCells(child); } }
static void init_usd(ext2fs_st *st) { USD_PartitionInfo info; Type_Any any; IDCOffer_clp partition; USDTRC(printf("ext2fs: Creating USDCallbacks\n")); { IDCTransport_clp shmt; IDCOffer_clp offer; IDCService_clp service; L1_st *l1_st; /* Get a heap writable by the USD domain */ st->disk.heap = Gatekeeper$GetHeap(Pvs(gkpr), IDCOffer$PDID(st->disk.drive_offer), 0, SET_ELEM(Stretch_Right_Read) | SET_ELEM(Stretch_Right_Write), True); /* The L1 callback executes there */ l1_st = Heap$Malloc(st->disk.heap, sizeof(L1_st)); l1_st->ext2fs_st = st; /* our state is read-only in USD domain */ st->disk.l1_callback = &(l1_st->l1_callback); CLP_INIT(st->disk.l1_callback, &L1_ms, l1_st); /* Create an offer for the L2 Callback */ CL_INIT(st->disk.l2_callback, &L2_ms, st); ANY_INIT(&any,USDCallback_clp, &st->disk.l2_callback); shmt = NAME_FIND ("modules>ShmTransport", IDCTransport_clp); offer = IDCTransport$Offer (shmt, &any, NULL, Pvs(heap), Pvs(gkpr), Pvs(entry), &service); /* Put it in the L1 callback's state record */ l1_st->l2_offer = offer; } USDTRC(printf("ext2fs: Getting USDCtl offer\n")); if(!USDDrive$GetPartition(st->disk.usddrive, st->disk.partition, st->disk.l1_callback, &partition)) { return; } USDTRC(printf("ext2fs: Binding to USDCtl offer\n")); /* Bind to the USD. Do this explicitly rather than through the object table; we don't want anybody else getting hold of this one. */ st->disk.binding = IDCOffer$Bind(partition, Pvs(gkpr), &any); st->disk.usdctl = NARROW(&any, USDCtl_clp); /* Find out some information */ USDTRC(printf("ext2fs: fetching partition info\n")); if(!USDDrive$GetPartitionInfo(st->disk.usddrive, st->disk.partition, &info)) { return; } st->disk.phys_block_size = info.blocksize; st->disk.partition_size = info.size; DBO(printf("ext2fs: blocksize %d, partition size %d blocks,\n" " partition type %s\n", st->disk.phys_block_size, st->disk.partition_size, info.osname)); FREE(info.osname); return; }
void avtImagePartition::GetThisPartition(int &minW, int &maxW, int &minH, int &maxH) { GetPartition(thisPartition, minW, maxW, minH, maxH); }