本文整理匯總了C++中DVASSERT函數的典型用法代碼示例。如果您正苦於以下問題:C++ DVASSERT函數的具體用法?C++ DVASSERT怎麽用?C++ DVASSERT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DVASSERT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: ColorDetailControl
//************* ColorSelectorControl *************
ColorSelectorControl::ColorSelectorControl(const Rect &rect)
: ColorDetailControl(rect)
{
RenderManager::Instance()->SetRenderTarget(colorMap);
RenderManager::Instance()->SetColor(Color(0.f, 0.f, 0.f, 1.f));
RenderHelper::Instance()->FillRect(Rect(0,0, rect.dx, rect.dy));
SetInitialColors();
float32 sectionHeight = rect.dy / (float32)SECTIONS_COUNT;
DVASSERT((0 != sectionHeight) && "Wrong control size");
float32 colorDelta = 1.0f / (sectionHeight);
for(int32 dy = 0; dy < (int32)sectionHeight; ++dy)
{
for(int32 iSection = 0; iSection < SECTIONS_COUNT; ++iSection)
{
RenderManager::Instance()->SetColor(sections[iSection]);
RenderHelper::Instance()->DrawLine(Vector2(0, iSection*sectionHeight + dy),
Vector2(rect.dx, iSection*sectionHeight + dy));
}
sections[0].b += colorDelta;
sections[1].r -= colorDelta;
sections[2].g += colorDelta;
sections[3].b -= colorDelta;
sections[4].r += colorDelta;
sections[5].g -= colorDelta;
}
RenderManager::Instance()->ResetColor();
RenderManager::Instance()->RestoreRenderTarget();
SetInitialColors();
markerPoint.dx = rect.dx / 2;
}
示例2: DVASSERT
void GameObjectManager::RealAddObject(GameObject * _object)
{
if (!_object)return;
if (_object->dead) // if object is dead we mark that it should be added on deletion from prev. manager
{
_object->nextManager = this;
return;
}else
{
DVASSERT(_object->GetManager() == 0);
}
_object->Retain();
//int objectsCount = objects.size();
List<GameObject*>::iterator currentPos = objects.begin();
//Logger::FrameworkDebug("myp: %d\n", _object->GetPriority());
int pos = 0;
for (; currentPos != objects.end(); ++currentPos)
{
GameObject * curObject = *currentPos;
if ( curObject->GetPriority() > _object->GetPriority())
{
//Logger::FrameworkDebug("op: %d\n", curObject->GetPriority());
break;
}
pos++;
}
//Logger::FrameworkDebug("added to pos: %d\n", pos);
objects.insert(currentPos, _object);
_object->SetManager(this);
RecalcObjectHierarchy(_object);
}
示例3: SafeRelease
void Scene::SetGlobalMaterial(NMaterial *globalMaterial)
{
SafeRelease(sceneGlobalMaterial);
if(NULL != globalMaterial)
{
DVASSERT(globalMaterial->GetMaterialType() == NMaterial::MATERIALTYPE_GLOBAL);
isDefaultGlobalMaterial = false;
sceneGlobalMaterial = SafeRetain(globalMaterial);
}
else
{
isDefaultGlobalMaterial = true;
sceneGlobalMaterial = NMaterial::CreateGlobalMaterial(FastName("Scene_Global_Material"));
}
InitGlobalMaterial();
renderSystem->SetGlobalMaterial(sceneGlobalMaterial);
particleEffectSystem->SetGlobalMaterial(sceneGlobalMaterial);
ImportShadowColor(this);
}
示例4: DVASSERT
void NMaterial::PrepareRenderState(PolygonGroup * polygonGroup, NMaterialInstance * instance)
{
// if (1)
{
// shaderArray[0]->Dump();
}
Shader * activeShader = shaderArray[instance->GetLightCount()];
DVASSERT(activeShader != 0)
instance->renderState.SetShader(activeShader);
instance->PrepareInstanceForShader(activeShader);
// Bind shader & global uniforms
RenderManager::Instance()->FlushState(&instance->renderState);
// Here bind local uniforms of material
instance->UpdateUniforms();
instance->BindUniforms();
RenderManager::Instance()->SetRenderData(polygonGroup->renderDataObject);
RenderManager::Instance()->AttachRenderData();
};
示例5: DVASSERT
void HierarchyTreeControlNode::AddControlToParent()
{
if (!parent)
return;
DVASSERT(uiObject);
HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(parent);
if (screenNode)
{
screenNode->GetScreen()->AddControl(this->uiObject);
}
else
{
//HierarchyTreeControlNode* controlNode = GetControlNode();
HierarchyTreeControlNode* controlNode = dynamic_cast<HierarchyTreeControlNode*>(parent);
if (controlNode)
{
UIControl* control = controlNode->GetUIObject();
if (control)
control->AddControl(this->uiObject);
}
}
}
示例6: switch
void Image::FlipVertical()
{
switch(format)
{
case FORMAT_A8:
FlipVertical((uint8 *)data, width, height);
break;
case FORMAT_A16:
case FORMAT_RGBA5551:
case FORMAT_RGBA4444:
case FORMAT_RGB565:
FlipVertical((uint16 *)data, width, height);
break;
case FORMAT_RGBA8888:
FlipVertical((uint32 *)data, width, height);
break;
default:
DVASSERT(false && "Not implemented");
break;
}
}
示例7: DVASSERT
void DistanceSlider::SetDistance(int layer, double value)
{
if(!locked)
{
DVASSERT(0 <= layer && layer < DAVA::LodComponent::MAX_LOD_LAYERS);
stretchSize[layer] = value;
int scaleSize = GetScaleSize();
QList<int> sizes;
for(int i = 1; i < layersCount; ++i)
{
sizes.push_back((stretchSize[i] - stretchSize[i-1]) * splitter->geometry().width() / scaleSize);
}
if(layersCount)
sizes.push_back((scaleSize - stretchSize[layer]) * splitter->geometry().width() / scaleSize);
bool wasBlocked = splitter->blockSignals(true);
splitter->setSizes(sizes);
splitter->blockSignals(wasBlocked);
}
}
示例8: UIWebView
void TransparentWebViewTest::LoadResources()
{
webView1 = new UIWebView(Rect(5, 5, 700, 500));
webView1->SetVisible(true);
webView1->OpenURL("http://ru.wikipedia.org/");
AddControl(webView1);
FilePath srcDir("~res:/TestData/TransparentWebViewTest/");
FilePath cpyDir = FileSystem::Instance()->GetCurrentDocumentsDirectory() + "TransparentWebViewTest/";
FileSystem::Instance()->DeleteDirectory(cpyDir);
FileSystem::Instance()->CreateDirectory(cpyDir);
FilePath srcFile = srcDir + "test.html";
FilePath cpyFile = cpyDir + "test.html";
FileSystem::Instance()->CopyFile(srcFile, cpyFile);
String url = "file:///" + cpyFile.GetAbsolutePathname();
webView2 = new UIWebView(Rect(710, 5, 300, 250));
webView2->SetVisible(true);
webView2->SetBackgroundTransparency(true);
webView2->OpenURL(url);
AddControl(webView2);
Font *font = FTFont::Create("~res:/Fonts/korinna.ttf");
DVASSERT(font);
font->SetSize(20);
testButton = new UIButton(Rect(0, 510, 300, 30));
testButton->SetStateFont(0xFF, font);
testButton->SetStateText(0xFF, L"Finish Test");
testButton->SetStateFontColor(0xFF, Color::White);
testButton->SetDebugDraw(true);
testButton->AddEvent(UIControl::EVENT_TOUCH_UP_INSIDE, Message(this, &TransparentWebViewTest::ButtonPressed));
AddControl(testButton);
SafeRelease(font);
}
示例9: BuildPropertiesGridList
void PropertyGridContainerWidget::OnPropertiesGridUpdated()
{
if (PropertiesGridController::Instance()->GetActiveTreeNodesList().empty() == false)
{
// List of UI Controls is selected.
BuildPropertiesGridList();
return;
}
// Build the Properties Grid based on the active control.
const HierarchyTreeNode* activeTreeNode = PropertiesGridController::Instance()->GetActiveTreeNode();
DVASSERT(activeTreeNode);
// This code is executed when Screen/Platform are selected.
UIControl* activeControl = NULL;
const HierarchyTreeControlNode* activeTreeControlNode = dynamic_cast<const HierarchyTreeControlNode*>(activeTreeNode);
if (activeTreeControlNode)
{
activeControl = activeTreeControlNode->GetUIObject();
}
BaseMetadata* metaData = GetActiveMetadata(activeTreeNode);
BuildPropertiesGrid(activeControl, metaData, activeTreeNode->GetId());
}
示例10: DVASSERT
LodSystem::LodMerger::LodMerger(SceneNode * _toEntity)
{
DVASSERT(_toEntity);
toEntity = _toEntity;
}
示例11: GetSwitchComponent
bool SwitchToRenerObjectConverter::MergeSwitch(Entity * entity)
{
Vector<Entity*> entitiesToRemove;
SwitchComponent * sw = GetSwitchComponent(entity);
if(sw)
{
RenderComponent * rc = GetRenderComponent(entity);
RenderObject * ro = 0;
if(!rc)
{
ro = new Mesh();
rc = new RenderComponent(ro);
ro->Release();
ro->SetAABBox(AABBox3(Vector3(0, 0, 0), Vector3(0, 0, 0)));
entity->AddComponent(rc);
}
else
{
ro = rc->GetRenderObject();
}
DVASSERT(ro);
int32 size = entity->GetChildrenCount();
for(int32 i = 0; i < size; ++i)
{
Entity * sourceEntity = entity->GetChild(i);
RenderObject * sourceRenderObject = GetRenderObject(sourceEntity);
//workaround for custom properties for crashed model
if(1 == i) // crash model
{
KeyedArchive *childProps = GetCustomPropertiesArchieve(sourceEntity);
if(childProps && childProps->IsKeyExists("CollisionType"))
{
KeyedArchive *entityProps = GetOrCreateCustomProperties(entity)->GetArchive();
entityProps->SetInt32("CollisionTypeCrashed", childProps->GetInt32("CollisionType", 0));
}
}
//end of custom properties
Vector<std::pair<Entity*, RenderObject*> > renderPairs;
if(sourceRenderObject)
{
renderPairs.push_back(std::make_pair(sourceEntity, sourceRenderObject));
}
else
{
FindRenderObjectsRecursive(sourceEntity, renderPairs);
DVASSERT(renderPairs.size() == 1);
sourceRenderObject = renderPairs[0].second;
}
if(sourceRenderObject)
{
TransformComponent * sourceTransform = GetTransformComponent(sourceEntity);
if (sourceTransform->GetLocalTransform() != Matrix4::IDENTITY)
{
PolygonGroup * pg = sourceRenderObject->GetRenderBatchCount() > 0 ? sourceRenderObject->GetRenderBatch(0)->GetPolygonGroup() : 0;
if(pg && bakedPolygonGroups.end() == bakedPolygonGroups.find(pg))
{
sourceRenderObject->BakeGeometry(sourceTransform->GetLocalTransform());
bakedPolygonGroups.insert(pg);
}
}
uint32 sourceSize = sourceRenderObject->GetRenderBatchCount();
while(sourceSize)
{
int32 lodIndex, switchIndex;
RenderBatch * sourceRenderBatch = sourceRenderObject->GetRenderBatch(0, lodIndex, switchIndex);
sourceRenderBatch->Retain();
sourceRenderObject->RemoveRenderBatch(sourceRenderBatch);
ro->AddRenderBatch(sourceRenderBatch, lodIndex, i);
sourceRenderBatch->Release();
sourceSize--;
}
}
renderPairs[0].first->RemoveComponent(Component::RENDER_COMPONENT);
LodComponent * lc = GetLodComponent(sourceEntity);
if((0 != lc) && (0 == GetLodComponent(entity)))
{
LodComponent * newLod = (LodComponent*)lc->Clone(entity);
entity->AddComponent(newLod);
}
renderPairs[0].first->RemoveComponent(Component::LOD_COMPONENT);
if(sourceEntity->GetChildrenCount() == 0)
{
entitiesToRemove.push_back(sourceEntity);
}
}
}
uint32 entitiesToRemoveCount = entitiesToRemove.size();
//.........這裏部分代碼省略.........
示例12: DVASSERT
bool FileList::IsDirectory(int32 index)
{
DVASSERT((index >= 0) && (index < (int32)fileList.size()));
return fileList[index].isDirectory;
}
示例13: DVASSERT
void ImposterNode::UpdateState()
{
if(GetChildrenCount() > 0)
{
DVASSERT(GetChildrenCount() == 1);
AABBox3 bbox = GetChild(0)->GetWTMaximumBoundingBoxSlow();
Vector3 bboxCenter = bbox.GetCenter();
float32 distanceSquare = (scene->GetCurrentCamera()->GetPosition() - bboxCenter).SquareLength();
distanceSquare *= scene->GetCurrentCamera()->GetZoomFactor() * scene->GetCurrentCamera()->GetZoomFactor();
Vector3 newDirection = scene->GetCurrentCamera()->GetPosition()-center;
newDirection.Normalize();
float32 dotProduct = newDirection.DotProduct(direction);
switch(state)
{
case STATE_3D:
{
if(distanceSquare > TOGGLE_SQUARE_DISTANCE)
{
UpdatePriority(distanceSquare, 0);
AskForRedraw();
}
else
{
isReady = false;
}
}
break;
case STATE_QUEUED:
{
if(IsAngleOrRangeChangedEnough(distanceSquare, dotProduct))
{
UpdatePriority(distanceSquare, dotProduct);
manager->UpdateQueue(this);
}
}
break;
case STATE_IMPOSTER:
{
if(distanceSquare < TOGGLE_SQUARE_DISTANCE)
{
isReady = false;
state = STATE_3D;
manager->RemoveFromQueue(this);
break;
}
if(IsAngleOrRangeChangedEnough(distanceSquare, dotProduct))
{
UpdatePriority(distanceSquare, dotProduct);
AskForRedraw();
}
}
break;
case STATE_REDRAW_APPROVED:
{
}
break;
}
}
}
示例14: Camera
void ImposterNode::UpdateImposter()
{
Camera * camera = scene->GetCurrentCamera();
Camera * imposterCamera = new Camera();
Vector3 cameraPos = camera->GetPosition();
Entity * child = GetChild(0);
AABBox3 bbox = child->GetWTMaximumBoundingBoxSlow();
Vector3 bboxCenter = bbox.GetCenter();
imposterCamera->Setup(camera->GetFOV(), camera->GetAspect(), camera->GetZNear(), camera->GetZFar());
imposterCamera->SetTarget(bbox.GetCenter());
imposterCamera->SetPosition(cameraPos);
imposterCamera->SetUp(camera->GetUp());
imposterCamera->SetLeft(camera->GetLeft());
Rect viewport = RenderManager::Instance()->GetViewport();
const Matrix4 & mvp = imposterCamera->GetUniformProjModelMatrix();
AABBox3 screenBounds;
GetOOBBoxScreenCoords(child, mvp, screenBounds);
Vector4 pv(bboxCenter);
pv = pv*mvp;
pv.z = (pv.z/pv.w + 1.f) * 0.5f;
float32 bboxCenterZ = pv.z;
Vector2 screenSize = Vector2(screenBounds.max.x-screenBounds.min.x, screenBounds.max.y-screenBounds.min.y);
Vector3 screenBillboardVertices[4];
screenBillboardVertices[0] = Vector3(screenBounds.min.x, screenBounds.min.y, screenBounds.min.z);
screenBillboardVertices[1] = Vector3(screenBounds.max.x, screenBounds.min.y, screenBounds.min.z);
screenBillboardVertices[2] = Vector3(screenBounds.min.x, screenBounds.max.y, screenBounds.min.z);
screenBillboardVertices[3] = Vector3(screenBounds.max.x, screenBounds.max.y, screenBounds.min.z);
center = Vector3();
Matrix4 invMvp = mvp;
invMvp.Inverse();
for(int32 i = 0; i < 4; ++i)
{
//unproject
Vector4 out;
out.x = 2.f*(screenBillboardVertices[i].x-viewport.x)/viewport.dx-1.f;
out.y = 2.f*(screenBillboardVertices[i].y-viewport.y)/viewport.dy-1.f;
out.z = 2.f*screenBillboardVertices[i].z-1.f;
out.w = 1.f;
out = out*invMvp;
DVASSERT(out.w != 0.f);
out.x /= out.w;
out.y /= out.w;
out.z /= out.w;
imposterVertices[i] = Vector3(out.x, out.y, out.z);
center += imposterVertices[i];
}
center /= 4.f;
//draw
RecreateFbo(screenSize);
//Logger::Info("%f, %f", screenSize.x, screenSize.y);
if(!block)
{
return;
}
direction = camera->GetPosition()-center;
direction.Normalize();
distanceSquaredToCamera = (center-cameraPos).SquareLength();
float32 nearPlane = sqrtf(distanceSquaredToCamera);
//float32 farPlane = nearPlane + (bbox.max.z-bbox.min.z);
float32 w = (imposterVertices[1]-imposterVertices[0]).Length();
float32 h = (imposterVertices[2]-imposterVertices[0]).Length();
//TODO: calculate instead of +50
imposterCamera->Setup(-w/2.f, w/2.f, -h/2.f, h/2.f, nearPlane, nearPlane+50.f);
Rect oldViewport = RenderManager::Instance()->GetViewport();
//Texture * target = fbo->GetTexture();
RenderManager::Instance()->AppendState(RenderState::STATE_SCISSOR_TEST);
RenderManager::Instance()->State()->SetScissorRect(Rect(block->offset.x, block->offset.y, block->size.dx, block->size.dy));
RenderManager::Instance()->FlushState();
//TODO: use one "clear" function instead of two
//if(block->size.x == 512.f)
//{
// RenderManager::Instance()->ClearWithColor(0.f, .8f, 0.f, 1.f);
//}
//else if(block->size.x == 256.f)
//{
// RenderManager::Instance()->ClearWithColor(0.f, .3f, 0.f, 1.f);
//}
//else if(block->size.x == 128.f)
//.........這裏部分代碼省略.........
示例15: DVASSERT
Texture *RenderManager::GetTexture(uint32 textureLevel)
{
DVASSERT(textureLevel < RenderState::MAX_TEXTURE_LEVELS);
return currentState.currentTexture[textureLevel];
}