本文整理汇总了C++中IActor::VInit方法的典型用法代码示例。如果您正苦于以下问题:C++ IActor::VInit方法的具体用法?C++ IActor::VInit怎么用?C++ IActor::VInit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActor
的用法示例。
在下文中一共展示了IActor::VInit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CBox
//.........这里部分代码省略.........
g_pSolidBoxModelRenderer->VAddMesh(iMesh, iMesh);
}
if (!g_pWireSphereModelRenderer)
{
g_pWireSphereModelRenderer = CDistributedObjectCreator::GetInstance()->CreateModelRenderer();
g_pWireSphereModelRenderer->SetRenderMethod(E_RENDERMETHOD::WIREFRAMED);
g_pWireSphereModelRenderer->SetRigidBodyFlag(E_RIGID_BODY_FLAG::DYNAMIC);
CRawModel RawModel;
RawModel.m_eRidigBodyFlag = E_RIGID_BODY_FLAG::DYNAMIC;
RawModel.m_vScale = XMFLOAT3(fBoxSize, fBoxSize, fBoxSize);
ContructSphereVertexBuffer(&RawModel);
for (auto iMesh : RawModel.m_RawMeshes)
g_pWireSphereModelRenderer->VAddMesh(iMesh, iMesh);
}
if (!g_pSolidSphereModelRenderer)
{
g_pSolidSphereModelRenderer = CDistributedObjectCreator::GetInstance()->CreateModelRenderer();
g_pSolidSphereModelRenderer->SetRenderMethod(E_RENDERMETHOD::SOLID);
g_pSolidSphereModelRenderer->SetRigidBodyFlag(E_RIGID_BODY_FLAG::DYNAMIC);
CRawModel RawModel;
RawModel.m_eRidigBodyFlag = E_RIGID_BODY_FLAG::DYNAMIC;
RawModel.m_vScale = XMFLOAT3(fBoxSize, fBoxSize, fBoxSize);
ContructSphereVertexBuffer(&RawModel);
for (auto iMesh : RawModel.m_RawMeshes)
g_pSolidSphereModelRenderer->VAddMesh(iMesh, iMesh);
}
if (!g_pWirePlaneModelRenderer)
{
g_pWirePlaneModelRenderer = CDistributedObjectCreator::GetInstance()->CreateModelRenderer();
g_pWirePlaneModelRenderer->SetRenderMethod(E_RENDERMETHOD::WIREFRAMED);
CRawModel RawModel;
RawModel.m_vScale = XMFLOAT3(500.0f, 500.0f, 500.0f);
ContructRegularGrid(XMINT2(5, 5), &RawModel);
for (auto iMesh : RawModel.m_RawMeshes)
g_pWirePlaneModelRenderer->VAddMesh(iMesh, iMesh);
}
if (!g_pSolidPlaneModelRenderer)
{
g_pSolidPlaneModelRenderer = CDistributedObjectCreator::GetInstance()->CreateModelRenderer();
g_pSolidPlaneModelRenderer->SetRenderMethod(E_RENDERMETHOD::SOLID);
CRawModel RawModel;
RawModel.m_vScale = XMFLOAT3(500.0f, 500.0f, 500.0f);
ContructRegularGrid(XMINT2(5, 5), &RawModel);
for (auto iMesh : RawModel.m_RawMeshes)
g_pSolidPlaneModelRenderer->VAddMesh(iMesh, iMesh);
}
IActor *pActor = nullptr;
//CObject *pObject;
switch (eActorType)
{
case E_ACTOR_TYPE::CUBE:
{
// g_pWireBoxModelRenderer g_pSolidBoxModelRenderer
pActor = new CBox(xvPos - XMVectorReplicate(fBoxSize / 2), xvPos + XMVectorReplicate(fBoxSize / 2),
g_pWireBoxModelRenderer);
}
break;
case E_ACTOR_TYPE::SPHERE:
{
XMFLOAT3 vPos;
XMStoreFloat3(&vPos, xvPos);
pActor = new CSphere(vPos, 1.0f, g_pWireSphereModelRenderer);
}
break;
case E_ACTOR_TYPE::PLANE:
pActor = new CPlane(g_pSolidPlaneModelRenderer);
((CPlane *)pActor)->GetPlane().x = XMVectorGetX(xvPos);
((CPlane *)pActor)->GetPlane().y = XMVectorGetY(xvPos);
((CPlane *)pActor)->GetPlane().z = XMVectorGetZ(xvPos);
((CPlane *)pActor)->GetPlane().w = XMVectorGetW(xvPos);
break;
}
pActor->VInit();
for (auto iObject : pActor->GetObjects())
{
iObject->SetColor(Color);
}
return pActor;
}