本文整理汇总了C++中MeshEntity::GetKey方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshEntity::GetKey方法的具体用法?C++ MeshEntity::GetKey怎么用?C++ MeshEntity::GetKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshEntity
的用法示例。
在下文中一共展示了MeshEntity::GetKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToString
std::string CMeshPhysicsObject::ToString(DWORD nMethod)
{
#ifndef MAX_LINE
#define MAX_LINE 500
#endif
/** -- sample script generated:
asset = ParaAsset.LoadStaticMesh("", "sample/trees/tree1.x");
player = ParaScene.CreateMeshPhysicsObject("", asset, 1,1,1, true, "0.193295,0,0,0,0.187032,-0.0488078,0,0.0488078,0.187032,0,0,0");
player:SetPosition(148,120.156,95);player:SetFacing(0);sceneLoader:AddChild(player);
*/
string sScript;
char line[MAX_LINE+1];
MeshEntity * pModel = (m_pMeshObject)?m_pMeshObject->m_ppMesh.get():NULL;
if(pModel)
{
Matrix4 mat;
float fOBB_X, fOBB_Y, fOBB_Z, fFacing;
m_pMeshObject->GetLocalTransform(&mat);
// tricky: when saving mesh object, we will use the bounding box of its view clipping object if any.
if(pModel->GetPrimaryTechniqueHandle() > 0)
{
// the view clipping object is usually a sphere that best contains the transformed mesh object's obb.
GetViewClippingObject()->GetBoundingBox(&fOBB_X, &fOBB_Y, &fOBB_Z, &fFacing);
}
else
{
m_pMeshObject->GetBoundingBox(&fOBB_X, &fOBB_Y, &fOBB_Z, &fFacing);
}
fFacing = GetFacing();
//////////////////////////////////////////////////////////////////////////
// write creator
if( (nMethod&CBaseObject::NPL_DONOT_OUTPUT_ASSET) ==0)
{
My_snprinf(line, MAX_LINE, "asset=ParaAsset.LoadStaticMesh(\"\",[[%s]]);\n",
pModel->GetKey().c_str());
sScript.append(line);
}
bool bSaveName = false;
/// currently I only save name if it begins with "g_".
const string& sName = GetIdentifier();
if(sName.size()>2 && sName[1] == '_' && sName[0] == 'g')
bSaveName = true;
if(bSaveName)
{
My_snprinf(line, MAX_LINE, "player=cpmesh(\"%s\",asset,",sName.c_str());
sScript.append(line);
}
else
{
sScript.append("player=cpmesh(\"\", asset, ");
}
My_snprinf(line, MAX_LINE, "%f,%f,%f, %s, \
\"%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\");\n", fOBB_X, fOBB_Y, fOBB_Z, ((g_bForceExportMeshPhysics || IsPhysicsEnabled()) ? "true":"false"),
mat._11, mat._12, mat._13, mat._21, mat._22, mat._23,mat._31, mat._32, mat._33,mat._41, mat._42, mat._43);
sScript.append(line);
//////////////////////////////////////////////////////////////////////////
// write replaceable textures
int nNumReplaceableTextures = GetNumReplaceableTextures();
if(nNumReplaceableTextures>0)
{
for(int i=0;i<nNumReplaceableTextures;++i)
{
TextureEntity* pTex1 = GetReplaceableTexture(i);
if( pTex1)
{
TextureEntity* pTex2 = GetDefaultReplaceableTexture(i);
if(pTex2 && pTex2->IsValid() && pTex2!=pTex1)
{
// set the replaceable texture if it is different from the default one.
string sFileName = pTex1->GetKey();
if(CGlobals::GetGlobalTerrain()->GetEnablePathEncoding())
{
CPathReplaceables::GetSingleton().EncodePath(sFileName, sFileName, "WORLD");
}
My_snprinf(line, MAX_LINE, "player:SetReplaceableTexture(%d,ParaAsset.LoadTexture(\"\",\"%s\",1));\n", i, sFileName.c_str());
sScript.append(line);
}
}
}
}
// write if it is a big mesh
if(CheckAttribute(OBJ_BIG_STATIC_OBJECT))
{
My_snprinf(line, MAX_LINE, "player:SetAttribute(8192, true);\n");
sScript.append(line);
}
const char* sHomeZoneName = GetHomeZoneName();
if(sHomeZoneName && sHomeZoneName[0]!= '\0')
{
My_snprinf(line, MAX_LINE, "player:SetHomeZone(\"%s\");\n", sHomeZoneName);
sScript.append(line);
//.........这里部分代码省略.........