本文整理汇总了C++中PODVector::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ PODVector::Size方法的具体用法?C++ PODVector::Size怎么用?C++ PODVector::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PODVector
的用法示例。
在下文中一共展示了PODVector::Size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetBuffer
void JSONValue::SetBuffer(const String& name, const PODVector<unsigned char>& value)
{
if (!value.Size())
SetString(name, String::EMPTY);
else
SetBuffer(name, &value[0], value.Size());
}
示例2: SetVertexBuffers
bool Model::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer> >& buffers, const PODVector<unsigned>& morphRangeStarts,
const PODVector<unsigned>& morphRangeCounts)
{
for (unsigned i = 0; i < buffers.Size(); ++i)
{
if (!buffers[i])
{
URHO3D_LOGERROR("Null model vertex buffers specified");
return false;
}
if (!buffers[i]->IsShadowed())
{
URHO3D_LOGERROR("Model vertex buffers must be shadowed");
return false;
}
}
vertexBuffers_ = buffers;
morphRangeStarts_.Resize(buffers.Size());
morphRangeCounts_.Resize(buffers.Size());
// If morph ranges are not specified for buffers, assume to be zero
for (unsigned i = 0; i < buffers.Size(); ++i)
{
morphRangeStarts_[i] = i < morphRangeStarts.Size() ? morphRangeStarts[i] : 0;
morphRangeCounts_[i] = i < morphRangeCounts.Size() ? morphRangeCounts[i] : 0;
}
return true;
}
示例3: SetBuffer
bool XMLElement::SetBuffer(const String& name, const PODVector<unsigned char>& value)
{
if (!value.Size())
return SetAttribute(name, String::EMPTY);
else
return SetBuffer(name, &value[0], value.Size());
}
示例4: BuildHull
void ConvexData::BuildHull(const PODVector<Vector3>& vertices)
{
if (vertices.Size())
{
// Build the convex hull from the raw geometry
StanHull::HullDesc desc;
desc.SetHullFlag(StanHull::QF_TRIANGLES);
desc.mVcount = vertices.Size();
desc.mVertices = vertices[0].Data();
desc.mVertexStride = 3 * sizeof(float);
desc.mSkinWidth = 0.0f;
StanHull::HullLibrary lib;
StanHull::HullResult result;
lib.CreateConvexHull(desc, result);
vertexCount_ = result.mNumOutputVertices;
vertexData_ = new Vector3[vertexCount_];
indexCount_ = result.mNumIndices;
indexData_ = new unsigned[indexCount_];
// Copy vertex data & index data
memcpy(vertexData_.Get(), result.mOutputVertices, vertexCount_ * sizeof(Vector3));
memcpy(indexData_.Get(), result.mIndices, indexCount_ * sizeof(unsigned));
lib.ReleaseResult(result);
}
else
{
vertexCount_ = 0;
indexCount_ = 0;
}
}
示例5: AddBuffer
void JSONValue::AddBuffer(const PODVector<unsigned char>& value)
{
if (!value.Size())
AddString(String::EMPTY);
else
AddBuffer(&value[0], value.Size());
}
示例6: SetCrowdTarget
void CrowdManager::SetCrowdTarget(const Vector3& position, Node* node)
{
if (!crowd_)
return;
PODVector<CrowdAgent*> agents = GetAgents(node, false); // Get all crowd agent components
Vector3 moveTarget(position);
for (unsigned i = 0; i < agents.Size(); ++i)
{
// Give application a chance to determine the desired crowd formation when they reach the target position
CrowdAgent* agent = agents[i];
using namespace CrowdAgentFormation;
VariantMap& map = GetEventDataMap();
map[P_NODE] = agent->GetNode();
map[P_CROWD_AGENT] = agent;
map[P_INDEX] = i;
map[P_SIZE] = agents.Size();
map[P_POSITION] = moveTarget; // Expect the event handler will modify this position accordingly
SendEvent(E_CROWD_AGENT_FORMATION, map);
moveTarget = map[P_POSITION].GetVector3();
agent->SetTargetPosition(moveTarget);
}
}
示例7: h
DllExport unsigned char *
urho_map_get_buffer (VariantMap &map, int hash, unsigned *size)
{
StringHash h (hash);
PODVector<unsigned char> p (map [h].GetBuffer ());
*size = p.Size();
unsigned char * result = new unsigned char[p.Size()];
for (int i = 0; i < p.Size(); i++) {
result[i] = p[i];
}
return result;
}
示例8: CollectGeometries
void NavigationMesh::CollectGeometries(Vector<NavigationGeometryInfo>& geometryList)
{
ATOMIC_PROFILE(CollectNavigationGeometry);
// Get Navigable components from child nodes, not from whole scene. This makes it possible to partition
// the scene into several navigation meshes
PODVector<Navigable*> navigables;
node_->GetComponents<Navigable>(navigables, true);
HashSet<Node*> processedNodes;
for (unsigned i = 0; i < navigables.Size(); ++i)
{
if (navigables[i]->IsEnabledEffective())
CollectGeometries(geometryList, navigables[i]->GetNode(), processedNodes, navigables[i]->IsRecursive());
}
// Get offmesh connections
Matrix3x4 inverse = node_->GetWorldTransform().Inverse();
PODVector<OffMeshConnection*> connections;
node_->GetComponents<OffMeshConnection>(connections, true);
for (unsigned i = 0; i < connections.Size(); ++i)
{
OffMeshConnection* connection = connections[i];
if (connection->IsEnabledEffective() && connection->GetEndPoint())
{
const Matrix3x4& transform = connection->GetNode()->GetWorldTransform();
NavigationGeometryInfo info;
info.component_ = connection;
info.boundingBox_ = BoundingBox(Sphere(transform.Translation(), connection->GetRadius())).Transformed(inverse);
geometryList.Push(info);
}
}
// Get nav area volumes
PODVector<NavArea*> navAreas;
node_->GetComponents<NavArea>(navAreas, true);
areas_.Clear();
for (unsigned i = 0; i < navAreas.Size(); ++i)
{
NavArea* area = navAreas[i];
if (area->IsEnabledEffective())
{
NavigationGeometryInfo info;
info.component_ = area;
info.boundingBox_ = area->GetWorldBoundingBox();
geometryList.Push(info);
areas_.Push(WeakPtr<NavArea>(area));
}
}
}
示例9: Create
VertexDeclaration::VertexDeclaration(Graphics* graphics, const PODVector<VertexBuffer*>& buffers) :
declaration_(nullptr)
{
PODVector<VertexDeclarationElement> elements;
unsigned prevBufferElements = 0;
for (unsigned i = 0; i < buffers.Size(); ++i)
{
if (!buffers[i])
continue;
const PODVector<VertexElement>& srcElements = buffers[i]->GetElements();
bool isExisting = false;
for (unsigned j = 0; j < srcElements.Size(); ++j)
{
const VertexElement& srcElement = srcElements[j];
if (srcElement.semantic_ == SEM_OBJECTINDEX)
{
URHO3D_LOGWARNING("Object index attribute is not supported on Direct3D9 and will be ignored");
continue;
}
// Override existing element if necessary
for (unsigned k = 0; k < prevBufferElements; ++k)
{
if (elements[k].semantic_ == srcElement.semantic_ && elements[k].index_ == srcElement.index_)
{
isExisting = true;
elements[k].streamIndex_ = i;
elements[k].offset_ = srcElement.offset_;
break;
}
}
if (isExisting)
continue;
VertexDeclarationElement element;
element.semantic_ = srcElement.semantic_;
element.type_ = srcElement.type_;
element.index_ = srcElement.index_;
element.streamIndex_ = i;
element.offset_ = srcElement.offset_;
elements.Push(element);
}
prevBufferElements = elements.Size();
}
Create(graphics, elements);
}
示例10: Sort
void Renderer2D::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)
{
unsigned resultSize = results.Size();
for (unsigned i = 0; i < drawables_.Size(); ++i)
{
if (drawables_[i]->GetViewMask() & query.viewMask_)
drawables_[i]->ProcessRayQuery(query, results);
}
if (results.Size() != resultSize)
Sort(results.Begin() + resultSize, results.End(), CompareRayQueryResults);
}
示例11: GetBatches
void Cursor::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor)
{
unsigned initialSize = vertexData.Size();
const IntVector2& offset = shapeInfos_[shape_].hotSpot_;
Vector2 floatOffset(-(float)offset.x_, -(float)offset.y_);
BorderImage::GetBatches(batches, vertexData, currentScissor);
for (unsigned i = initialSize; i < vertexData.Size(); i += 6)
{
vertexData[i] += floatOffset.x_;
vertexData[i + 1] += floatOffset.y_;
}
}
示例12: StringHash
//
// returns: null on no matches
// otherwise, a pointer that should be released with free() that
// contains a first element (pointer sized) with the number of elements
// followed by the number of pointers
//
DllExport
void *urho_node_get_components (Node *node, int code, int recursive, int *count)
{
PODVector<Node*> dest;
node->GetChildrenWithComponent (dest, StringHash(code), recursive);
if (dest.Size () == 0)
return NULL;
*count = dest.Size ();
void **t = (void **) malloc (sizeof(Node*)*dest.Size());
for (int i = 0; i < dest.Size (); i++){
t [i] = dest [i];
}
return t;
}
示例13:
DllExport Interop::Vector3 *
urho_navigationmesh_findpath(NavigationMesh * navMesh, const class Urho3D::Vector3 & start, const class Urho3D::Vector3 & end, int *count)
{
PODVector<Vector3> dest;
navMesh->FindPath(dest, start, end);
if (dest.Size() == 0)
return NULL;
*count = dest.Size();
Interop::Vector3 * results = new Interop::Vector3[dest.Size()];
for (int i = 0; i < dest.Size(); i++) {
auto vector = *((Interop::Vector3 *) &(dest[i]));
results[i] = vector;
}
return results;
}
示例14: ReleaseShaders
void Technique::ReleaseShaders()
{
PODVector<SharedPtr<Pass>*> allPasses = passes_.Values();
for (unsigned i = 0; i < allPasses.Size(); ++i)
allPasses[i]->Get()->ReleaseShaders();
}
示例15: FillPortalsWorldWithVisibleObstaclesFrom
void World::FillPortalsWorldWithVisibleObstaclesFrom(World& w)
{
ResourceCache* cache = context->GetSubsystem<ResourceCache>();
Material* black = cache->GetResource<Material>("Materials/Black.xml"); // notexture unlit black mat (for override white portals on screen)
if (black)
if (w.scene)
{
PODVector<Node*> nodes;
w.scene->GetChildrenWithComponent<StaticModel>(nodes, true);
for (int i = 0; i < nodes.Size(); i++)
{
Node* n = nodes[i];
if (n)
{
StaticModel* model = n->GetComponent<StaticModel>();
if (model)
{
Node* newNode = scene->CreateChild(n->GetName(), LOCAL);
StaticModel* newModel = newNode->CreateComponent<StaticModel>();
newModel->SetModel(model->GetModel());
newModel->SetMaterial(black);
newNode->SetWorldPosition(n->GetWorldPosition());
newNode->SetWorldRotation(n->GetWorldRotation());
newNode->SetWorldScale(n->GetWorldScale());
}
}
}
}
}