本文整理汇总了C++中NGL_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ NGL_ASSERT函数的具体用法?C++ NGL_ASSERT怎么用?C++ NGL_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NGL_ASSERT函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mName
nuiUniformDesc::nuiUniformDesc(const nglString& rName, GLenum Type, int count, GLuint Location, nuiShaderProgram* pProgram)
: mName(rName), mType(Type), mCount(count), mLocation(Location), mChanged(false)
{
switch (mType)
{
case GL_FLOAT: mValues.mpFloats = new float[1 * count]; break;
case GL_FLOAT_VEC2: mValues.mpFloats = new float[2 * count]; break;
case GL_FLOAT_VEC3: mValues.mpFloats = new float[3 * count]; break;
case GL_FLOAT_VEC4: mValues.mpFloats = new float[4 * count]; break;
case GL_INT: mValues.mpInts = new int32[1 * count]; break;
case GL_INT_VEC2: mValues.mpInts = new int32[2 * count]; break;
case GL_INT_VEC3: mValues.mpInts = new int32[3 * count]; break;
case GL_INT_VEC4: mValues.mpInts = new int32[4 * count]; break;
case GL_UNSIGNED_INT: mValues.mpInts = new int32[1 * count]; break;
case GL_FLOAT_MAT2: mValues.mpFloats = new float[2 * 2 * count]; break;
case GL_FLOAT_MAT3: mValues.mpFloats = new float[3 * 3 * count]; break;
case GL_FLOAT_MAT4: mValues.mpFloats = new float[4 * 4 * count]; break;
case GL_SAMPLER_2D: mValues.mpInts = new int32[1 * count]; break;
case GL_SAMPLER_CUBE: mValues.mpInts = new int32[1 * count]; break;
default:
NGL_ASSERT(0);
}
if (pProgram)
{
switch (mType)
{
case GL_FLOAT:
case GL_FLOAT_VEC2:
case GL_FLOAT_VEC3:
case GL_FLOAT_VEC4:
case GL_FLOAT_MAT2:
case GL_FLOAT_MAT3:
case GL_FLOAT_MAT4:
glGetUniformfv(pProgram->GetProgram(), mLocation, mValues.mpFloats);
break;
case GL_INT:
case GL_INT_VEC2:
case GL_INT_VEC3:
case GL_INT_VEC4:
case GL_UNSIGNED_INT:
case GL_SAMPLER_2D:
case GL_SAMPLER_CUBE:
glGetUniformiv(pProgram->GetProgram(), mLocation, mValues.mpInts);
break;
default:
NGL_ASSERT(0);
}
}
}
示例2: NGL_ASSERT
void nuiComboBox::ReparentTree(nuiTreeNode* pTree)
{
NGL_ASSERT(pTree);
nuiWidgetPtr pWidget = pTree->GetElement();
NGL_ASSERT(pWidget);
pWidget->SetLayout(nuiRect(0.f,0.f, GetRect().GetWidth()-mHandleWidth, GetRect().GetHeight()));
if (pWidget->GetParent() != this)
{
AddChild(pWidget);
pWidget->InvalidateLayout();
}
if (GetSelectedWidget() == pWidget)
{
if (!pWidget->IsVisible())
pWidget->SetVisible(true);
}
else
{
if (pWidget->IsVisible())
pWidget->SetVisible(false);
}
uint32 count = pTree->GetChildrenCount();
for (uint32 i = 0; i < count; i++)
{
nuiTreeNode* pNode = dynamic_cast<nuiTreeNode*>(pTree->GetChild(i));
NGL_ASSERT(pNode);
ReparentTree(pNode);
}
}
示例3: while
void nuiSpriteDef::Uninit()
{
std::map<nglString, nuiSpriteDef*>::iterator it = mSpriteMap.begin();
std::map<nglString, nuiSpriteDef*>::iterator end = mSpriteMap.end();
std::vector<nuiSpriteDef*> temp;
while (it != end)
{
nuiSpriteDef* pDef = it->second;
pDef->CheckValid();
//pDef->Release();
temp.push_back(pDef);
++it;
}
for (int32 i = 0; i < temp.size(); i++)
{
nuiSpriteDef* pDef = temp[i];
pDef->Release();
}
NGL_ASSERT(mSpriteMap.empty());
NGL_ASSERT(!nuiSprite::mSpriteCounter);
}
示例4: NGL_ASSERT
//**************************************************************************************************************
//
// nuiComboBox
//
void nuiDefaultDecoration::ComboBox(nuiWidget* pWidget)
{
nuiStateDecoration* pDeco = (nuiStateDecoration*)nuiDecoration::Get(_T("nuiDefaultDecorationComboBox"));
if (pDeco)
{
pWidget->SetDecoration(pDeco, eDecorationBorder);
return;
}
nuiTexture* pTex = nuiTexture::GetTexture("ComboUp");
NGL_ASSERT(pTex);
nuiFrame* pFrame = new nuiFrame(_T("nuiDefaultDecorationComboBoxUp"), pTex, nuiRect(12,4,2,10));
pFrame->EnableBorder(false);
pTex = nuiTexture::GetTexture("ComboDown");
NGL_ASSERT(pTex);
pFrame = new nuiFrame(_T("nuiDefaultDecorationComboBoxDown"), pTex, nuiRect(12,4,2,10));
pFrame->EnableBorder(false);
nuiStateDecoration* pState = new nuiStateDecoration(_T("nuiDefaultDecorationComboBox"));
pState->SetState(nuiStateEnabled | nuiStateReleased, nuiDecoration::Get(_T("nuiDefaultDecorationComboBoxUp")));
pState->SetState(nuiStateEnabled | nuiStateSelected, nuiDecoration::Get(_T("nuiDefaultDecorationComboBoxDown")));
pWidget->SetDecoration(pState, eDecorationBorder);
pWidget->SetUserHeight(18);
pWidget->SetColor(eSelectedTextFg, nuiColor(32,32,32));
}
示例5: attr
void nuiLayout::SetProperty(const nglString& rName, const nglString& rValue)
{
nuiAttribBase attr(GetAttribute(rName));
if (attr.IsValid())
{
attr.FromString(rValue);
return;
}
if (rName.CompareLeft("VAnchors_", true) == 0 || rName.CompareLeft("HAnchors_", true) == 0)
{
// Create an attribute for this anchor, unless it exists already
AddAttribute(new LayoutAnchorValue(rName, this));
{
nuiAttribBase attr(GetAttribute(rName));
NGL_ASSERT(attr.IsValid());
attr.FromString(rValue);
}
}
else if (rName.CompareLeft("VAnchorsType_", true) == 0 || rName.CompareLeft("HAnchorsType_", true) == 0)
{
// Create an attribute for this anchor, unless it exists already
AddAttribute(new nuiAttribute<nuiAnchorType>(rName, this));
{
nuiAttribBase attr(GetAttribute(rName));
NGL_ASSERT(attr.IsValid());
attr.FromString(rValue);
}
}
else
{
nuiObject::SetProperty(rName, rValue);
}
}
示例6: NGL_ASSERT
double nuiRange::GetUnitValue() const
{
NGL_ASSERT(IsValid());
const double v = ConvertToUnit(GetValue());
NGL_ASSERT(finite(v));
return v;
}
示例7: switch
void nuiDrawContext::DrawArray(nuiRenderArray* pArray)
{
uint32 size = pArray->GetSize();
if (!size)
{
pArray->Release();
return;
}
#ifdef _DEBUG_
{
// Error checking:
if (!pArray->GetIndexArrayCount())
{
switch (pArray->GetMode())
{
case GL_POINTS:
NGL_ASSERT(size);
break;
case GL_LINES:
NGL_ASSERT(!(size & 1));
break;
case GL_LINE_LOOP:
NGL_ASSERT(size > 1);
break;
case GL_LINE_STRIP:
NGL_ASSERT(size > 1);
break;
case GL_TRIANGLES:
NGL_ASSERT(size > 2 && !(size % 3));
break;
case GL_TRIANGLE_STRIP:
NGL_ASSERT(size > 2);
break;
case GL_TRIANGLE_FAN:
NGL_ASSERT(size > 2);
break;
#ifndef _OPENGL_ES_
case GL_QUADS:
NGL_ASSERT(size > 3 && !(size % 4));
break;
case GL_QUAD_STRIP:
NGL_ASSERT(size > 3);
break;
case GL_POLYGON:
NGL_ASSERT(size > 3);
break;
#endif
}
}
}
#endif
if (mStateChanges)
mpPainter->SetState(mCurrentState);
mStateChanges = 0;
mpPainter->DrawArray(pArray);
}
示例8: NGL_ASSERT
bool PreferencesBase::GetBool(const nglString& rKey, const nglString& rName, PreferencesTarget target) const
{
nuiXMLNode* pNode = mXml[target]->GetChild(rKey);
NGL_ASSERT(pNode);
NGL_ASSERT(pNode->HasAttribute(rName));
return pNode->GetAttribute(rName).Compare(_T("false"));
}
示例9: NGL_LOG
void nuiAudioDevice_DS_ProcessingTh::Process(uint pos)
{
NGL_LOG(_T("nuiAudioDevice_DS_ProcessingTh"), NGL_LOG_DEBUG, _T("Process Thread received Event %d\n"), pos);
int16* pBuf1=NULL;
int16* pBuf2=NULL;
DWORD size1=0;
DWORD size2=0;
DWORD bufferBytes = mBufferSize * mInputNbChannels * sizeof(int16);
if (!mpRingBuffer->GetWritable())
return;
//
// lock the input buffer if any,
// and read data from it to the local buffer
//
if ( mpDSInputBuffer
&& mpDSInputBuffer->Lock(pos * bufferBytes /* offset */, bufferBytes /*size*/, (LPVOID*)&pBuf1, &size1, (LPVOID*)&pBuf2, &size2, 0)
)
{
if (!pBuf1 || !size1)
{
//NGL_LOG(_T("nuiAudioDevice_DS_ProcessingTh"), NGL_LOG_ERROR, _T("Process error : could not lock any part of the input buffer\n"));
NGL_ASSERT(0);
return;
}
// check that we got the right size
NGL_ASSERT((size1+size2) == bufferBytes);
// copy input data into local buffer
memcpy(mpLocalBuf, pBuf1, size1);
if (pBuf2)
memcpy(mpLocalBuf+size1, pBuf2, size2);
// convert int16 buffer to float buffer
for (uint32 ch=0; ch < mInputNbChannels; ch++)
{
nuiAudioConvert_INint16ToDEfloat(mpLocalBuf, const_cast<float*>(mFloatInputBuf[ch]), ch, mInputNbChannels, mBufferSize);
}
}
// call user audio process function
mpProcessFunction(mFloatInputBuf, mFloatOutputBuf, mBufferSize);
// copy output buffer contents to ringbuffer
uint32 nbWrite = WriteToRingBuf(mFloatOutputBuf, mBufferSize, mOutputNbChannels);
// release DS input buffer
if (mpDSInputBuffer)
mpDSInputBuffer->Unlock(pBuf1, size1, pBuf2, size2);
}
示例10: _T
void nuiDefaultDecoration::TabView_Contents(nuiTabView* pView, nuiWidget* pContents)
{
nglString decoName = _T("nuiDefaultDecorationTabTopContents");
nuiRect frameRect;
const char* deco = "TabTopContents";
switch (pView->GetTabPosition())
{
case nuiTop:
decoName = _T("nuiDefaultDecorationTabTopContents");
deco = "TabTopContents";
frameRect = nuiRect(4,5,2,4);
break;
case nuiLeft:
decoName = _T("nuiDefaultDecorationTabLeftContents");
deco = "TabLeftContents";
frameRect = nuiRect(5,4,4,2);
break;
case nuiRight:
decoName = _T("nuiDefaultDecorationTabRightContents");
deco = "TabRightContents";
frameRect = nuiRect(5,4,4,2);
break;
case nuiBottom:
decoName = _T("nuiDefaultDecorationTabBottomContents");
deco = "TabBottomContents";
frameRect = nuiRect(4,5,2,4);
break;
default:
NGL_ASSERT(0);
break;
}
nuiFrame* pDeco = (nuiFrame*)nuiDecoration::Get(decoName);
if (pDeco)
{
pContents->SetDecoration(pDeco, eDecorationBorder);
return;
}
nuiTexture* pTex = nuiTexture::GetTexture(deco);
NGL_ASSERT(pTex);
pDeco = new nuiFrame(decoName, pTex, frameRect);
pContents->SetDecoration(pDeco, eDecorationBorder);
}
示例11: switch
void nuiUniformDesc::Set(const int32* pV, int32 count, bool apply)
{
switch (mType)
{
case GL_INT: NGL_ASSERT(count <= (int32)mCount * 1); break;
case GL_INT_VEC2: NGL_ASSERT(count <= (int32)mCount * 2); break;
case GL_INT_VEC3: NGL_ASSERT(count <= (int32)mCount * 3); break;
case GL_INT_VEC4: NGL_ASSERT(count <= (int32)mCount * 4); break;
case GL_UNSIGNED_INT: NGL_ASSERT(count <= (int32)mCount * 4); break;
case GL_SAMPLER_2D: NGL_ASSERT(count <= (int32)mCount * 4); break;
case GL_SAMPLER_CUBE: NGL_ASSERT(count <= (int32)mCount * 4); break;
default:
NGL_ASSERT(0);
}
bool same = true;
for (int32 i = 0; i < count; i++)
{
const GLint v1 = mValues.mpInts[i];
const GLint v2 = pV[i];
mValues.mpInts[i] = v2;
same = same && (v1 == v2);
}
mChanged = mChanged || !same;
if (apply)
Apply();
}
示例12: NGL_ASSERT
void nglTimer::Stop()
{
if (mRunning)
{
NGL_ASSERT(mpCFRunLoopTimer);
CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
NGL_ASSERT(mpCFRunLoop == currentRunLoop);
CFRunLoopRemoveTimer(currentRunLoop, mpCFRunLoopTimer, kCFRunLoopCommonModes);
if (mpCFRunLoopTimer)
CFRelease(mpCFRunLoopTimer);
mpCFRunLoopTimer = NULL;
}
mRunning = false;
}