本文整理汇总了C++中ArrayT::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayT::Size方法的具体用法?C++ ArrayT::Size怎么用?C++ ArrayT::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayT
的用法示例。
在下文中一共展示了ArrayT::Size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DetermineAdjacencyGraph
// This function determines the adjacency cell graph of the 'SuperLeaves'.
// It is filled-in and stored in the 'Neighbours' members/components of the 'SuperLeaves'.
// After this function was called, all components of all 'SuperLeaves' are completely filled-in.
void DetermineAdjacencyGraph()
{
for (unsigned long SL1Nr=0; SL1Nr<SuperLeaves.Size(); SL1Nr++)
for (unsigned long SL2Nr=0; SL2Nr<SuperLeaves.Size(); SL2Nr++)
{
if (SL1Nr==SL2Nr || !SuperLeaves[SL1Nr].BB.GetEpsilonBox(MapT::RoundEpsilon).Intersects(SuperLeaves[SL2Nr].BB)) continue;
// Jedes Portal des ersten Leafs gegen jedes Portal des zweiten Leafs
// prüfen und testen, ob sie sich schneiden (dann sind sie durchlässig).
// BEACHTE: SuperLeaves haben *alle* Portale von *allen* ihrer Leaves!
// D.h. es können sich nicht nur Portale auf ihrer konvexen Hülle befinden, sondern auch "innen drin".
// Wegen der Konvexität der SuperLeaves dürfte das aber keine Rolle spielen und folgendes müßte trotzdem korrekt funktionieren.
for (unsigned long Portal1Nr=0; Portal1Nr<SuperLeaves[SL1Nr].Portals.Size(); Portal1Nr++)
for (unsigned long Portal2Nr=0; Portal2Nr<SuperLeaves[SL2Nr].Portals.Size(); Portal2Nr++)
{
if (!SuperLeaves[SL1Nr].Portals[Portal1Nr].Overlaps(SuperLeaves[SL2Nr].Portals[Portal2Nr], false, MapT::RoundEpsilon)) continue;
// Folgender Check ist zwar redundant, aber zumindest sinnvoll.
// Da diese Funktion sowieso schnell genug ist, lasse ihn nicht weg!
if (SuperLeaves[SL1Nr].Portals[Portal1Nr].WhatSide(SuperLeaves[SL2Nr].Portals[Portal2Nr].Plane, MapT::RoundEpsilon)!=Polygon3T<double>::InMirrored) continue;
ArrayT< Polygon3T<double> > NewPortals;
SuperLeaves[SL1Nr].Portals[Portal1Nr].GetChoppedUpAlong(SuperLeaves[SL2Nr].Portals[Portal2Nr], MapT::RoundEpsilon, NewPortals);
SuperLeaves[SL1Nr].Neighbours.PushBackEmpty();
SuperLeaves[SL1Nr].Neighbours[SuperLeaves[SL1Nr].Neighbours.Size()-1].SuperLeafNr=SL2Nr;
SuperLeaves[SL1Nr].Neighbours[SuperLeaves[SL1Nr].Neighbours.Size()-1].SubPortal =NewPortals[NewPortals.Size()-1];
}
}
printf("SLs Adjacency Graph : done\n");
}
示例2: CommandT
CommandSelectT::CommandSelectT(GuiDocumentT* GuiDocument, const ArrayT< IntrusivePtrT<cf::GuiSys::WindowT> >& OldSelection, const ArrayT< IntrusivePtrT<cf::GuiSys::WindowT> >& NewSelection)
: CommandT(abs(int(OldSelection.Size())-int(NewSelection.Size()))>3, false), // Only show selection command in the undo/redo history if selection difference is greater 3.
m_GuiDocument(GuiDocument),
m_OldSelection(OldSelection),
m_NewSelection(NewSelection)
{
}
示例3: QuickSortFacesIntoTexNameOrder
void BspTreeBuilderT::QuickSortFacesIntoTexNameOrder()
{
while (ToDoRanges.Size()>=2)
{
const unsigned long LastIndex =ToDoRanges[ToDoRanges.Size()-1]; ToDoRanges.DeleteBack();
const unsigned long FirstIndex=ToDoRanges[ToDoRanges.Size()-1]; ToDoRanges.DeleteBack();
if (FirstIndex<LastIndex)
{
const char* x=FaceChildren[LastIndex]->Material->Name.c_str();
unsigned long i=FirstIndex-1;
for (unsigned long j=FirstIndex; j<=LastIndex-1; j++)
if (_stricmp(FaceChildren[j]->Material->Name.c_str(), x)<0)
{
i++;
std::swap(FaceChildren[i], FaceChildren[j]);
std::swap(FaceNrs[i], FaceNrs[j]);
}
std::swap(FaceChildren[i+1], FaceChildren[LastIndex]);
std::swap(FaceNrs[i+1], FaceNrs[LastIndex]);
i++;
ToDoRanges.PushBack(i+1); ToDoRanges.PushBack(LastIndex);
if (i>0) { ToDoRanges.PushBack(FirstIndex); ToDoRanges.PushBack(i-1); }
}
}
}
示例4: Repredict
bool EngineEntityT::Repredict(const ArrayT<PlayerCommandT>& PlayerCommands, unsigned long RemoteLastIncomingSequenceNr, unsigned long LastOutgoingSequenceNr)
{
if (!UsePrediction.GetValueBool())
return false;
if (LastOutgoingSequenceNr-RemoteLastIncomingSequenceNr>PlayerCommands.Size())
{
EnqueueString("WARNING - Prediction impossible: Last ack'ed PlayerCommand is too old (%u, %u)!\n", RemoteLastIncomingSequenceNr, LastOutgoingSequenceNr);
return false;
}
/*
* This assumes that this method is immediately called after ParseServerDeltaUpdateMessage(),
* where the state of this entity has been set to the state of the latest server frame,
* and that every in-game packet from the server contains a delta update message for our local client!
*/
// Unseren Entity über alle relevanten (d.h. noch nicht bestätigten) PlayerCommands unterrichten.
// Wenn wir auf dem selben Host laufen wie der Server (z.B. Single-Player Spiel oder lokaler Client bei non-dedicated-Server Spiel),
// werden die Netzwerk-Nachrichten in Nullzeit (im Idealfall über Memory-Buffer) versandt.
// Falls dann auch noch der Server mit full-speed läuft, sollte daher immer RemoteLastIncomingSequenceNr==LastOutgoingSequenceNr sein,
// was impliziert, daß dann keine Prediction stattfindet (da nicht notwendig!).
for (unsigned long SequenceNr=RemoteLastIncomingSequenceNr+1; SequenceNr<=LastOutgoingSequenceNr; SequenceNr++)
Entity->ProcessConfigString(&PlayerCommands[SequenceNr & (PlayerCommands.Size()-1)], "PlayerCommand");
Entity->Think(-2.0, 0);
return true;
}
示例5: GetBestPage
int InspectorDialogT::GetBestPage(const ArrayT<MapElementT*>& Selection) const
{
if (Selection.Size()==0)
{
// Nothing is selected, so just show the scene graph.
return 0;
}
else if (Selection.Size()==1)
{
MapElementT* MapElement=Selection[0];
return (MapElement->GetType()==&MapEntityT::TypeInfo) ? 1 : 2;
}
else
{
// Multiple map elements are selected.
// If we have only map primitives, open the Primitive Properties tab
// (even though it doesn't make much sense - primitive properties can be edited for a single item only).
// One or more entities in the selection cause us to open the Entitiy Properties tab.
bool HaveEntities=false;
for (unsigned long SelNr=0; SelNr<Selection.Size(); SelNr++)
{
MapElementT* MapElement=Selection[SelNr];
if (MapElement->GetType()==&MapEntityT::TypeInfo)
{
HaveEntities=true;
break;
}
}
return HaveEntities ? 1 : 2;
}
}
示例6: while
/*static*/ bool StateT::IsDeltaMessageEmpty(const ArrayT<uint8_t>& DeltaMessage)
{
if (DeltaMessage[0] == 1)
{
// Check the RLE-compressed delta message.
unsigned int i = 1;
while (i < DeltaMessage.Size())
{
const unsigned int N = DeltaMessage[i];
i++;
if (N < MAX_VERBATIM)
{
for (unsigned int Stop = i+N+1; i < Stop; i++)
if (DeltaMessage[i]) return false;
}
else
{
if (DeltaMessage[i]) return false;
i++;
}
}
}
else
{
// Check the uncompressed delta message.
for (unsigned int i = 1; i < DeltaMessage.Size(); i++)
if (DeltaMessage[i])
return false;
}
return true;
}
示例7: CreateLeafPortals
void BspTreeBuilderT::CreateLeafPortals(unsigned long LeafNr, const ArrayT< Plane3T<double> >& NodeList)
{
ArrayT<cf::SceneGraph::BspTreeNodeT::LeafT>& Leaves=BspTree->Leaves;
Console->Print(cf::va("%5.1f%%\r", (double)LeafNr/Leaves.Size()*100.0));
// fflush(stdout); // The stdout console auto-flushes the output.
const BoundingBox3T<double> LeafBB=Leaves[LeafNr].BB.GetEpsilonBox(MapT::RoundEpsilon);
ArrayT< Polygon3T<double> > NewPortals;
for (unsigned long Nr=0; Nr<NodeList.Size(); Nr++)
if (LeafBB.WhatSide(NodeList[Nr])==BoundingBox3T<double>::Both)
{
NewPortals.PushBackEmpty();
NewPortals[NewPortals.Size()-1].Plane=NodeList[Nr];
}
// Hier ist auch denkbar, daß Portals mit 0 Vertices zurückkommen (outer leaves)!
// (Auch ganz normale gültige Portale in outer leaves sind denkbar!)
Polygon3T<double>::Complete(NewPortals, MapT::RoundEpsilon);
for (unsigned long PortalNr=0; PortalNr<NewPortals.Size(); PortalNr++)
{
const Polygon3T<double>& Portal=NewPortals[PortalNr];
// In degenerierten Grenzfällen (in Gegenwart von Splittern) können auch andere ungültige Polygone entstehen
// (z.B. mehrere Vertices quasi auf einer Edge), sodaß wir explizit die Gültigkeit prüfen.
// if (Portal.Vertices.Size()<3) continue; // Ist in .IsValid() enthalten!
if (!Portal.IsValid(MapT::RoundEpsilon, MapT::MinVertexDist)) continue;
// Another very serious problem is the fact that we sometimes self-create leaks,
// because nearly all operations in this program suffer from rounding errors.
// I have *NO* idea how to best combat them (except the introduction of exact arithmetic, which I'm seriously considering).
// But for now, lets try something simpler - enforce a "minimum area" for portals.
// Portals that are smaller than this minimum are considered degenerate, despite they were classified as valid above.
// Note that the same is enforced below, where portals are split along the leafs faces.
// UPDATE: As the new Polygon3T<double>::IsValid() method now enforces the MapT::MinVertexDist,
// I believe the problem is solved the the polygon area check not longer required.
if (Portal.GetArea()<=100.0 /* 1 cm^2 */) continue;
// Note that rejecting portals here (i.e. adding additional test criteria) is a dangerous idea,
// because any omitted portal might stop the subsequent flood-fill early.
// This in turn might easily tear big holes into the world.
// Consider my Tech-Archive notes from 2005-11-15 for a sketch that shows a problematic (but valid!) leaf
// whose entry portal must not be omitted so that it can be entered during the flood-fill,
// or else the left wall will be erroneously removed by the fill.
// Okay, the portal seems to be good, so add it to the leaf.
Leaves[LeafNr].Portals.PushBack(Portal.GetMirror());
}
}
示例8: GetAverageVisibility
// Returns how many other SuperLeaves each SuperLeaf can see in average.
// The lower bound is 1.0 (each SuperLeaf can only see itself).
// The upper bound is the number of SuperLeaves (each SuperLeaf can see all other SuperLeaves, including itself).
double GetAverageVisibility()
{
unsigned long VisCount=0;
for (unsigned long SL1=0; SL1<SuperLeaves.Size(); SL1++)
for (unsigned long SL2=0; SL2<SuperLeaves.Size(); SL2++)
if (IsVisible(SL1, SL2))
VisCount++;
return double(VisCount)/SuperLeaves.Size();
}
示例9:
bool ToolEditSurfaceT::OnLMouseDown3D(ViewWindow3DT& ViewWindow, wxMouseEvent& ME)
{
const ArrayT<ViewWindow3DT::HitInfoT> Hits=ViewWindow.GetElementsAt(ME.GetPosition());
// Having this statement here means that the user absolutely cannot entirely clear the
// surfaces selection (in 3D views, it works in 2D views), but that is just fine - why would he?
if (Hits.Size()==0) return true;
MapElementT* Object =Hits[0].Object;
unsigned long FaceIndex=Hits[0].FaceNr;
if (m_EyeDropperActive)
{
ViewWindow.GetChildFrame()->GetSurfacePropsDialog()->EyeDropperClick(Object, FaceIndex);
return true;
}
if (!ME.ControlDown())
ViewWindow.GetChildFrame()->GetSurfacePropsDialog()->ClearSelection();
ViewWindow.GetChildFrame()->GetSurfacePropsDialog()->ToggleClick(Object, ME.ShiftDown() ? EditSurfacePropsDialogT::ALL_FACES : FaceIndex);
// When something is newly selected (Control is not down), its surface properties are also picked up.
if (!ME.ControlDown())
ViewWindow.GetChildFrame()->GetSurfacePropsDialog()->EyeDropperClick(Object, FaceIndex);
return true;
}
示例10: Do
bool CommandGroupSetPropT::Do()
{
wxASSERT(!m_Done);
if (m_Done) return false;
// Set the new property
// and notify all observers that our groups inventory changed.
switch (m_Prop)
{
case PROP_NAME: m_Group->Name=m_NewName; break;
case PROP_COLOR: m_Group->Color=m_NewColor; break;
case PROP_CANSELECT: m_Group->CanSelect=m_NewFlag; break;
case PROP_SELECTASGROUP: m_Group->SelectAsGroup=m_NewFlag; break;
}
m_MapDoc.UpdateAllObservers_GroupsChanged();
// If the elements in the group have changed color, update all observers accordingly.
if (m_Prop==PROP_COLOR)
{
const ArrayT<MapElementT*> GroupElems=m_Group->GetMembers(m_MapDoc);
if (GroupElems.Size()>0)
m_MapDoc.UpdateAllObservers_Modified(GroupElems, MEMD_GENERIC /*MEMD_VISIBILITY*/);
}
m_Done=true;
return true;
}
示例11: TraceRay
void ClipWorldT::TraceRay(const Vector3dT& Start, const Vector3dT& Ray,
unsigned long ClipMask, const ClipModelT* Ignore, TraceResultT& Result, ClipModelT** HitClipModel) const
{
// Violation of this requirement is usually, but not necessarily, an error.
// If you ever get false-positives here, just remove the test entirely.
assert(Result.Fraction==1.0 && !Result.StartSolid);
if (HitClipModel) *HitClipModel=NULL;
// Try the trace against the WorldCollMdl first.
WorldCollMdl->TraceRay(Start, Ray, ClipMask, Result);
// if (Result.Fraction<OldFrac && HitClipModel) *HitClipModel=WorldCollMdl; // FIXME: WorldCollMdl is of type CollisionModelT...
if (Result.Fraction==0.0) return;
// Now try all the entity models.
ArrayT<ClipModelT*> ClipModels;
const BoundingBox3dT OverallBB(Start, Start+Ray*Result.Fraction);
GetClipModelsFromBB(ClipModels, ClipMask, OverallBB);
for (unsigned long ModelNr=0; ModelNr<ClipModels.Size(); ModelNr++)
{
ClipModelT* ClipModel =ClipModels[ModelNr];
const double OldFraction=Result.Fraction;
if (ClipModel==Ignore) continue;
ClipModel->TraceRay(Start, Ray, ClipMask, Result);
if (Result.Fraction<OldFraction && HitClipModel) *HitClipModel=ClipModel;
if (Result.Fraction==0.0) break;
}
}
示例12: NotifySubjectChanged_Selection
void InspDlgEntityPropsT::NotifySubjectChanged_Selection(SubjectT* Subject, const ArrayT<MapElementT*>& OldSelection, const ArrayT<MapElementT*>& NewSelection)
{
// Part 1: Determine the list of selected entities.
SelectedEntities.Clear();
// Loop over the map selection in order to determine the list of selected entities.
for (unsigned long i=0; i<NewSelection.Size(); i++)
{
MapEntityBaseT* Ent=dynamic_cast<MapEntityBaseT*>(NewSelection[i]);
if (Ent)
{
if (SelectedEntities.Find(Ent)==-1) SelectedEntities.PushBack(Ent);
continue;
}
MapPrimitiveT* Prim=dynamic_cast<MapPrimitiveT*>(NewSelection[i]);
if (Prim)
{
MapEntityBaseT* Ent=Prim->GetParent();
if (SelectedEntities.Find(Ent)==-1) SelectedEntities.PushBack(Ent);
continue;
}
}
UpdatePropertyGrid();
}
示例13: LuaCI_LineCompletion
static int LuaCI_LineCompletion(lua_State* LuaState)
{
ArrayT<std::string> Completions;
std::string CommonPrefix=ConsoleInterpreter->LineCompletion(luaL_checkstring(LuaState, 1), Completions);
lua_pushstring(LuaState, CommonPrefix.c_str());
lua_createtable(LuaState, Completions.Size(), 0);
for (unsigned long CompletionNr=0; CompletionNr<Completions.Size(); CompletionNr++)
{
lua_pushstring(LuaState, Completions[CompletionNr].c_str());
lua_rawseti(LuaState, -2, CompletionNr+1);
}
return 2;
}
示例14: FlagVisible
// Records in 'SuperLeavesPVS' that we can see from 'FromSL' to 'ToSL'.
inline void FlagVisible(unsigned long FromSL, unsigned long ToSL)
{
const unsigned long PVSTotalBitNr=FromSL*SuperLeaves.Size()+ToSL;
const unsigned long PVS_W32_Nr =PVSTotalBitNr >> 5;
const unsigned long PVSBitMask =1 << (PVSTotalBitNr & 31);
SuperLeavesPVS[PVS_W32_Nr]|=PVSBitMask;
}
示例15: UnpackBits
StateT::StateT(const StateT& Other, const ArrayT<uint8_t>& DeltaMessage)
{
if (DeltaMessage[0] == 1)
{
// Run the RLE-decompression.
UnpackBits(m_Data, &DeltaMessage[1], DeltaMessage.Size()-1);
}
else
{
m_Data.PushBackEmptyExact(DeltaMessage.Size()-1);
for (unsigned int i = 0; i < m_Data.Size(); i++)
m_Data[i] = DeltaMessage[i+1];
}
// Run the delta-decompression.
for (unsigned int i = 0; i < m_Data.Size(); i++)
m_Data[i] ^= i < Other.m_Data.Size() ? Other.m_Data[i] : 0;
}