本文整理汇总了C++中OgreAssert函数的典型用法代码示例。如果您正苦于以下问题:C++ OgreAssert函数的具体用法?C++ OgreAssert怎么用?C++ OgreAssert使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OgreAssert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OgreAssert
//-----------------------------------------------------------------------
void ConvexBody::storeEdgesOfPolygon(size_t poly, Polygon::EdgeMap *edgeMap ) const
{
OgreAssert(poly <= getPolygonCount(), "Search position out of range" );
OgreAssert( edgeMap != NULL, "TEdgeMap ptr is NULL" );
mPolygons[poly]->storeEdges(edgeMap);
}
示例2: ushort
void LodOutputProviderBuffer::inject()
{
unsigned short submeshCount = ushort(mBuffer.submesh.size());
OgreAssert(mMesh->getNumSubMeshes() == submeshCount, "");
mMesh->removeLodLevels();
for (unsigned short i = 0; i < submeshCount; i++) {
SubMesh::LODFaceList& lods = mMesh->getSubMesh(i)->mLodFaceList;
typedef vector<LodIndexBuffer>::type GenBuffers;
GenBuffers& buffers = mBuffer.submesh[i].genIndexBuffers;
size_t buffCount = buffers.size();
for (size_t n=0; n<buffCount;n++) {
LodIndexBuffer& buff = buffers[n];
size_t indexCount = (buff.indexBufferSize ? buff.indexBufferSize : buff.indexCount);
OgreAssert((int)buff.indexCount >= 0, "");
lods.push_back(OGRE_NEW IndexData());
lods.back()->indexStart = buff.indexStart;
lods.back()->indexCount = buff.indexCount;
if(indexCount != 0) {
if(n > 0 && buffers[n-1].indexBuffer == buff.indexBuffer){
lods.back()->indexBuffer = (*(++lods.rbegin()))->indexBuffer;
} else {
lods.back()->indexBuffer = HardwareBufferManager::getSingleton().createIndexBuffer(
buff.indexSize == 2 ?
HardwareIndexBuffer::IT_16BIT : HardwareIndexBuffer::IT_32BIT,
indexCount, mMesh->getIndexBufferUsage(), mMesh->isIndexBufferShadowed());
size_t sizeInBytes = lods.back()->indexBuffer->getSizeInBytes();
void* pOutBuff = lods.back()->indexBuffer->lock(0, sizeInBytes, HardwareBuffer::HBL_DISCARD);
memcpy(pOutBuff, buff.indexBuffer.get(), sizeInBytes);
lods.back()->indexBuffer->unlock();
}
}
}
}
}
示例3: OgreAssert
//-------------------------------------------------------
float Ground::GetHeightAt(float s, float t) const
{
OgreAssert(0.0f <= s && s <= 1.0f && 0.0f <= t && t <= 1.0f, "S and T should be from [0, 1]");
OgreAssert(nullptr != mImage.get(), "Ground[GetHeightAt]: Not initialized");
size_t x = static_cast<size_t>(s * (mImage->getWidth() - 1));
size_t y = static_cast<size_t>(t * (mImage->getHeight() - 1));
return mImage->getColourAt(x, y, 0)[0];
}
示例4: while
//-----------------------------------------------------------------------
void RenderSystem::setDepthBufferFor( RenderTarget *renderTarget )
{
uint16 poolId = renderTarget->getDepthBufferPool();
if( poolId == DepthBuffer::POOL_NO_DEPTH )
return; //RenderTarget explicitly requested no depth buffer
//Find a depth buffer in the pool
DepthBufferVec::const_iterator itor = mDepthBufferPool[poolId].begin();
DepthBufferVec::const_iterator end = mDepthBufferPool[poolId].end();
bool bAttached = false;
while( itor != end && !bAttached )
bAttached = renderTarget->attachDepthBuffer( *itor++ );
//Not found yet? Create a new one!
if( !bAttached )
{
DepthBuffer *newDepthBuffer = _createDepthBufferFor( renderTarget );
if( newDepthBuffer )
{
newDepthBuffer->_setPoolId( poolId );
mDepthBufferPool[poolId].push_back( newDepthBuffer );
bAttached = renderTarget->attachDepthBuffer( newDepthBuffer );
OgreAssert( bAttached ,"A new DepthBuffer for a RenderTarget was created, but after creation"
" it says it's incompatible with that RT" );
}
else
LogManager::getSingleton().logMessage( "WARNING: Couldn't create a suited DepthBuffer"
"for RT: " + renderTarget->getName() , LML_CRITICAL);
}
}
示例5: OgreAssert
std::pair< DynamicRenderable::MeshData::VertexData *, DynamicRenderable::MeshData::Index * >
DynamicRenderable::getMeshData( const int nLOD, const size_t nStitchFlags )
{
OgreAssert(_pvMeshData[nLOD] != NULL, "Resolution doesn't exist");
return std::pair< DynamicRenderable::MeshData::VertexData *, DynamicRenderable::MeshData::Index * >
(& _pvMeshData[nLOD] ->vertices, & _pvMeshData[nLOD] ->indices[nStitchFlags]);
}
示例6: switch
void MeshLodGenerator::calcLodVertexCount(const LodLevel& lodLevel,
size_t uniqueVertexCount,
size_t& outVertexCountLimit,
Real& outCollapseCostLimit)
{
switch(lodLevel.reductionMethod) {
case LodLevel::VRM_PROPORTIONAL:
outCollapseCostLimit = LodData::NEVER_COLLAPSE_COST;
outVertexCountLimit = uniqueVertexCount - (size_t) ((Real) uniqueVertexCount * lodLevel.reductionValue);
break;
case LodLevel::VRM_CONSTANT:
outCollapseCostLimit = LodData::NEVER_COLLAPSE_COST;
outVertexCountLimit = (size_t) lodLevel.reductionValue;
if(outVertexCountLimit < uniqueVertexCount) {
outVertexCountLimit = uniqueVertexCount - outVertexCountLimit;
} else {
outVertexCountLimit = 0;
}
break;
case LodLevel::VRM_COLLAPSE_COST:
outCollapseCostLimit = lodLevel.reductionValue;
outVertexCountLimit = 0;
break;
default:
OgreAssert(0, "");
outCollapseCostLimit = LodData::NEVER_COLLAPSE_COST;
outVertexCountLimit = uniqueVertexCount;
break;
}
}
示例7: OgreAssert
//-----------------------------------------------------------------------
void Polygon::updateNormal( void ) const
{
OgreAssert( getVertexCount() >= 3, "Insufficient vertex count!" );
if (mIsNormalSet)
return;
// vertex order is ccw
const Vector3& a = getVertex( 0 );
const Vector3& b = getVertex( 1 );
const Vector3& c = getVertex( 2 );
// used method: Newell
mNormal.x = 0.5f * ( (a.y - b.y) * (a.z + b.z) +
(b.y - c.y) * (b.z + c.z) +
(c.y - a.y) * (c.z + a.z));
mNormal.y = 0.5f * ( (a.z - b.z) * (a.x + b.x) +
(b.z - c.z) * (b.x + c.x) +
(c.z - a.z) * (c.x + a.x));
mNormal.z = 0.5f * ( (a.x - b.x) * (a.y + b.y) +
(b.x - c.x) * (b.y + c.y) +
(c.x - a.x) * (c.y + a.y));
mNormal.normalise();
mIsNormalSet = true;
}
示例8: OgreAssert
//-----------------------------------------------------------------------
void TextureUnitState::setNumMipmaps(int numMipmaps)
{
OgreAssert(mFramePtrs[0], "frame must not be blank");
for (auto& frame : mFramePtrs)
frame->setNumMipmaps(numMipmaps == MIP_DEFAULT
? TextureManager::getSingleton().getDefaultNumMipmaps()
: numMipmaps);
}
示例9: OgreAssert
//---------------------------------------------------------------------
String Serializer::readString(DataStreamPtr& stream, size_t numChars)
{
OgreAssert(numChars <= 255, "");
char str[255];
stream->read(str, numChars);
str[numChars] = '\0';
return str;
}
示例10: TransformationBase
DebugDisplay::CoordinateSystem::CoordinateSystem(
const String & sFile, const size_t nLine,
const OverhangTerrainManager * pManager,
const OverhangCoordinateSpace enocsFrom,
const OverhangCoordinateSpace enocsTo
) : TransformationBase(sFile, nLine), _pManager(pManager), _from(enocsFrom), _to(enocsTo)
{
OgreAssert(pManager != NULL, "Manager is NULL");
}
示例11: OgreAssert
unsigned int LodData::Triangle::getVertexID(const LodData::Vertex* v) const
{
for (int i = 0; i < 3; i++) {
if (vertex[i] == v) {
return vertexID[i];
}
}
OgreAssert(0, "");
return 0;
}
示例12: lock
void ThreadingModelManager::registerMainThread()
{
{ boost::mutex::scoped_lock lock(mutex);
if (mMainThreadSet)
OHT_LOG_FATAL("Main thread already registered");
OgreAssert(!mMainThreadSet, "Main thread already registered");
mMainThread = boost::this_thread::get_id();
mMainThreadSet = true;
}
}
示例13: OgreAssert
void LodCollapseCostOutside::initCollapseCosts( LodData* data )
{
OgreAssert(mOutsideWeight != 0.0, "");
delete mOutsideMarker;
mOutsideMarker = new LodOutsideMarker(data->mVertexList, data->mMeshBoundingSphereRadius, mOutsideWalkAngle);
mOutsideMarker->markOutside();
mCostCalculator->initCollapseCosts(data);
}
示例14: OgreAssert
//-----------------------------------------------------------------------
void Polygon::storeEdges( Polygon::EdgeMap *edgeMap ) const
{
OgreAssert( edgeMap != NULL, "EdgeMap ptr is NULL" );
size_t vertexCount = getVertexCount();
for ( size_t i = 0; i < vertexCount; ++i )
{
edgeMap->insert( Edge( getVertex( i ), getVertex( ( i + 1 ) % vertexCount ) ) );
}
}
示例15: OgreAssert
void CameraMan::setYawPitchDist(Ogre::Radian yaw, Ogre::Radian pitch, Ogre::Real dist)
{
OgreAssert(mTarget, "no target set");
mOffset = Ogre::Vector3::ZERO;
mCamera->setPosition(mTarget->_getDerivedPosition());
mCamera->setOrientation(mTarget->_getDerivedOrientation());
mCamera->yaw(yaw);
mCamera->pitch(-pitch);
mCamera->translate(Ogre::Vector3(0, 0, dist), Ogre::Node::TS_LOCAL);
}