本文整理汇总了C++中CArray::Buffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::Buffer方法的具体用法?C++ CArray::Buffer怎么用?C++ CArray::Buffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArray
的用法示例。
在下文中一共展示了CArray::Buffer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StopTriggeredSounds
static void StopTriggeredSounds (CArray<CTrigger>& triggers)
{
CTrigger *trigP = triggers.Buffer ();
for (int i = triggers.Length (); i > 0; i--, trigP++)
trigP->m_info.nChannel = -1;
}
示例2: StoreExcerptPriorityTerms
// This creates the list of excerpt terms that are later stored in the ab_tree.
// @param doc_id - this is the doc id of the excerpt
void StoreExcerptPriorityTerms(_int64 &doc_id) {
uChar size = (uChar)m_tok_queue.Size();
int ovf_size = sizeof(S5Byte) + sizeof(uLong) + sizeof(uChar);
ovf_size += (sizeof(S5Byte) + sizeof(uChar)) * m_tok_queue.Size();
m_excerpt_file.AskBufferOverflow(ovf_size);
m_excerpt_file.WriteCompObject5Byte(doc_id);
m_excerpt_file.WriteCompObject(size);
m_tok_queue.CopyNodesToBuffer(m_sorted_tok_set);
CSort<STokenPtr> sort(m_sorted_tok_set.Size(), CompareTermPosition);
sort.HybridSort(m_sorted_tok_set.Buffer());
for(int i=0; i<m_sorted_tok_set.Size(); i++) {
SToken &ptr = *m_sorted_tok_set[i].ptr;
int id = m_duplicate_term.FindWord((char *)&ptr.word_id, sizeof(S5Byte));
ptr.assoc_num <= 3;
ptr.assoc_num |= m_term_occurr[id];
m_excerpt_file.WriteCompObject(ptr.word_id);
m_excerpt_file.WriteCompObject(ptr.occur);
m_excerpt_file.WriteCompObject(ptr.term_weight);
m_excerpt_file.WriteCompObject(ptr.assoc_num);
}
}
示例3: StartTriggeredSounds
static void StartTriggeredSounds (CArray<CTrigger>& triggers)
{
CTrigger *trigP = triggers.Buffer ();
for (int i = triggers.Length (); i > 0; i--, trigP++)
if ((trigP->m_info.nType == TT_SOUND) && (trigP->m_info.flags & TF_PLAYING_SOUND) && (trigP->m_info.nChannel < 0))
trigP->DoPlaySound (-1);
}
示例4: FilterVertices
short CModel::FilterVertices (CArray<CFloatVector3>& vertices, short nVertices)
{
CFloatVector3 *pi, *pj;
for (pi = vertices.Buffer (), pj = pi + 1, --nVertices; nVertices; nVertices--, pj++)
if (CmpVerts (pi, pj))
*++pi = *pj;
return (short) (pi - vertices) + 1;
}
示例5: Radius
fix CModel::Radius (CObject *objP)
{
CSubModel* psm;
CFace* pmf;
CVertex* pmv;
CArray<CFloatVector3> vertices;
CFloatVector3 vCenter, vOffset, v, vMin, vMax;
float fRad = 0, r;
short h, i, j, k;
tModelSphere *sP = gameData.models.spheres + m_nModel;
if (m_nType >= 0) {
if ((m_nSubModels == sP->nSubModels) && (m_nFaces == sP->nFaces) && (m_nFaceVerts == sP->nFaceVerts)) {
gameData.models.offsets [m_nModel] = sP->vOffsets [m_nType];
return sP->xRads [m_nType];
}
}
//first get the biggest distance between any two model vertices
if (vertices.Create (m_nFaceVerts)) {
CFloatVector3 *pv, *pvi, *pvj;
for (i = 0, h = m_nSubModels, psm = m_subModels.Buffer (), pv = vertices.Buffer (); i < h; i++, psm++) {
if (psm->m_nHitbox > 0) {
vOffset.Assign (gameData.models.hitboxes [m_nModel].hitboxes [psm->m_nHitbox].vOffset);
for (j = psm->m_nFaces, pmf = psm->m_faces; j; j--, pmf++) {
for (k = pmf->m_nVerts, pmv = m_faceVerts + pmf->m_nIndex; k; k--, pmv++, pv++)
*pv = pmv->m_vertex + vOffset;
}
}
}
h = (short) (pv - vertices.Buffer ()) - 1;
CQuickSort<CFloatVector3> qs;
qs.SortAscending (vertices.Buffer (), 0, h, &RenderModel::CModel::CmpVerts);
//G3SortModelVerts (vertices, 0, h);
h = FilterVertices (vertices, h);
for (i = 0, pvi = vertices.Buffer (); i < h - 1; i++, pvi++)
for (j = i + 1, pvj = vertices + j; j < h; j++, pvj++)
if (fRad < (r = CFloatVector3::Dist (*pvi, *pvj))) {
fRad = r;
vMin = *pvi;
vMax = *pvj;
}
fRad /= 2;
// then move the tentatively computed model center around so that all vertices are enclosed in the sphere
// around the center with the radius computed above
vCenter.Assign (gameData.models.offsets [m_nModel]);
for (i = h, pv = vertices.Buffer (); i; i--, pv++) {
v = *pv - vCenter;
r = v.Mag();
if (fRad < r)
vCenter += v * ((r - fRad) / r);
}
for (i = h, pv = vertices.Buffer (); i; i--, pv++)
if (fRad < (r = CFloatVector3::Dist (*pv, vCenter)))
fRad = r;
vertices.Destroy ();
gameData.models.offsets [m_nModel].Assign (vCenter);
if (m_nType >= 0) {
sP->nSubModels = m_nSubModels;
sP->nFaces = m_nFaces;
sP->nFaceVerts = m_nFaceVerts;
sP->vOffsets [m_nType] = gameData.models.offsets [m_nModel];
sP->xRads [m_nType] = F2X (fRad);
}
}
else {
// then move the tentatively computed model center around so that all vertices are enclosed in the sphere
// around the center with the radius computed above
vCenter.Assign (gameData.models.offsets [m_nModel]);
for (i = 0, h = m_nSubModels, psm = m_subModels.Buffer (); i < h; i++, psm++) {
if (psm->m_nHitbox > 0) {
vOffset.Assign (gameData.models.hitboxes [m_nModel].hitboxes [psm->m_nHitbox].vOffset);
for (j = psm->m_nFaces, pmf = psm->m_faces; j; j--, pmf++) {
for (k = pmf->m_nVerts, pmv = m_faceVerts + pmf->m_nIndex; k; k--, pmv++) {
v = pmv->m_vertex + vOffset;
if (fRad < (r = CFloatVector3::Dist (v, vCenter)))
fRad = r;
}
}
}
}
gameData.models.offsets [m_nModel].Assign (vCenter);
}
return F2X (fRad);
}