本文整理汇总了C++中NormsIndexesTableType::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ NormsIndexesTableType::clear方法的具体用法?C++ NormsIndexesTableType::clear怎么用?C++ NormsIndexesTableType::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NormsIndexesTableType
的用法示例。
在下文中一共展示了NormsIndexesTableType::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyGLTransformation
void ccGenericMesh::applyGLTransformation(const ccGLMatrix& trans)
{
//vertices should be handled another way!
//we must take care of the triangle normals!
if (m_triNormals && (!getParent() || !getParent()->isKindOf(CC_MESH)))
{
bool recoded = false;
//if there is more triangle normals than the size of the compressed
//normals array, we recompress the array instead of recompressing each normal
unsigned i,numTriNormals = m_triNormals->currentSize();
if (numTriNormals>ccNormalVectors::GetNumberOfVectors())
{
NormsIndexesTableType* newNorms = new NormsIndexesTableType;
if (newNorms->reserve(ccNormalVectors::GetNumberOfVectors()))
{
for (i=0; i<ccNormalVectors::GetNumberOfVectors(); i++)
{
CCVector3 new_n(ccNormalVectors::GetNormal(i));
trans.applyRotation(new_n);
normsType newNormIndex = ccNormalVectors::GetNormIndex(new_n.u);
newNorms->addElement(newNormIndex);
}
m_triNormals->placeIteratorAtBegining();
for (i=0; i<numTriNormals; i++)
{
m_triNormals->setValue(i,newNorms->getValue(m_triNormals->getCurrentValue()));
m_triNormals->forwardIterator();
}
recoded=true;
}
newNorms->clear();
newNorms->release();
newNorms=0;
}
//if there is less triangle normals than the compressed normals array size
//(or if there is not enough memory to instantiate the temporary array),
//we recompress each normal ...
if (!recoded)
{
//on recode direct chaque normale
m_triNormals->placeIteratorAtBegining();
for (i=0; i<numTriNormals; i++)
{
normsType* _theNormIndex = m_triNormals->getCurrentValuePtr();
CCVector3 new_n(ccNormalVectors::GetNormal(*_theNormIndex));
trans.applyRotation(new_n.u);
*_theNormIndex = ccNormalVectors::GetNormIndex(new_n.u);
m_triNormals->forwardIterator();
}
}
}
else
{
//TODO: process failed!
}
}