本文整理汇总了C++中ManualObject::setDynamic方法的典型用法代码示例。如果您正苦于以下问题:C++ ManualObject::setDynamic方法的具体用法?C++ ManualObject::setDynamic怎么用?C++ ManualObject::setDynamic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManualObject
的用法示例。
在下文中一共展示了ManualObject::setDynamic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// util
//---------------------------------------------------------------------------------------------------------------
ManualObject* App::Create2D(const String& mat, Real s, bool dyn)
{
ManualObject* m = mSceneMgr->createManualObject();
m->setDynamic(dyn);
m->setUseIdentityProjection(true);
m->setUseIdentityView(true);
m->setCastShadows(false);
m->estimateVertexCount(4);
m->begin(mat, RenderOperation::OT_TRIANGLE_STRIP);
m->position(-s,-s*asp, 0); m->textureCoord(0, 1);
m->position( s,-s*asp, 0); m->textureCoord(1, 1);
m->position(-s, s*asp, 0); m->textureCoord(0, 0);
m->position( s, s*asp, 0); m->textureCoord(1, 0);
m->end();
//TODO:replace OT_TRIANGLE_FAN with a more friendly version for D3D11 as it is not supported
/*
m->estimateVertexCount(6);
m->begin(mat, RenderOperation::OT_TRIANGLE_LIST);
m->position(-s,-s*asp, 0); m->textureCoord(0, 1);
m->position( s,-s*asp, 0); m->textureCoord(1, 1);
m->position( s, s*asp, 0); m->textureCoord(1, 0);
m->position(-s, s*asp, 0); m->textureCoord(0, 0);
m->position(-s,-s*asp, 0); m->textureCoord(0, 1);
m->position( s, s*asp, 0); m->textureCoord(1, 0);
m->end();
*/
AxisAlignedBox aabInf; aabInf.setInfinite();
m->setBoundingBox(aabInf); // always visible
m->setRenderQueueGroup(RQG_Hud2);
return m;
}
示例2: if
ManualObject* CHud::Create2D(const String& mat, SceneManager* sceneMgr,
Real s, // scale pos
bool dyn, bool clr,
Real mul, Vector2 ofs,
uint32 vis, uint8 rndQue,
int cnt)
{
ManualObject* m = sceneMgr->createManualObject();
m->setDynamic(dyn);
m->setUseIdentityProjection(true);
m->setUseIdentityView(true);
m->setCastShadows(false);
m->estimateVertexCount(cnt * 4);
m->begin(mat, cnt > 1 ? RenderOperation::OT_TRIANGLE_LIST : RenderOperation::OT_TRIANGLE_STRIP);
const static Vector2 uv[4] = { Vector2(0.f,1.f),Vector2(1.f,1.f),Vector2(0.f,0.f),Vector2(1.f,0.f) };
for (int i=0; i < cnt; ++i)
{ m->position(-s,-s*asp, 0); m->textureCoord(uv[0]*mul + ofs); if (clr) m->colour(0,1,0);
m->position( s,-s*asp, 0); m->textureCoord(uv[1]*mul + ofs); if (clr) m->colour(0,0,0);
m->position(-s, s*asp, 0); m->textureCoord(uv[2]*mul + ofs); if (clr) m->colour(1,1,0);
m->position( s, s*asp, 0); m->textureCoord(uv[3]*mul + ofs); if (clr) m->colour(1,0,0);
}
if (cnt > 1)
for (int i=0; i < cnt; ++i)
{ int n = i*4;
m->quad(n,n+1,n+3,n+2);
}
m->end();
AxisAlignedBox aabInf; aabInf.setInfinite();
m->setBoundingBox(aabInf); // always visible
m->setVisibilityFlags(vis);
m->setRenderQueueGroup(rndQue); //RQG_Hud2
return m;
}
示例3: createTestMap
void createTestMap(SceneManager* mSceneMgr)
{
std::vector<QGears::MapFileSerializer::SBlock> blocks;
createReferenceFileInstance([&](Ogre::DataStreamPtr& stream, QGears::WorldMapFile& file)
{
QGears::MapFileSerializer s;
s.importMapFile( stream, file );
blocks = s.mBlocks;
});
if (blocks.empty())
{
// Load failed
return;
}
/*
// TODO: Get PSX textures working
QGears::TxzFileSerializer s;
createReferenceTextureFileInstance(s);
std::vector<std::vector<TxzFileSerializer::rgba>> data = s.GetWorldMapTexture(19);
test(data);
*/
LoadTextures();
int c = 0;
const auto kSpace = From16BitFixedPoint(8182);
size_t numBlocks = blocks.size();
int mapX = 0;
int mapY = 0;
for ( unsigned int k=0; k<numBlocks; k++ )
{
// 7x9 size
QGears::MapFileSerializer::SBlock& block = blocks[k];
int blockX = 0;
int blockY = 0;
for ( size_t i=0; i<block.mMeshes.size(); i++ )
{
QGears::MapFileSerializer::SBlockPart& part = block.mMeshes[i];
for ( size_t j=0; j<part.mTris.size(); j++)
{
QGears::MapFileSerializer::BlockTriangle& tri = part.mTris.at(j);
ManualObject* manual = nullptr;
auto it = gObjToTextureId.find(tri.TextureInfo);
if (it==gObjToTextureId.end())
{
manual = mSceneMgr->createManualObject(("zzz_manual" + std::to_string(c++)).c_str());
manual->begin(gTextures[tri.TextureInfo].mName, RenderOperation::OT_TRIANGLE_LIST);
manual->setDebugDisplayEnabled(true);
manual->setDynamic(false);
gObjToTextureId[tri.TextureInfo] = manual;
}
else
{
manual = it->second;
}
const float xPos = (blockX * kSpace) + (mapX * kSpace * 4);
const float yPos = (blockY * kSpace) + (mapY * kSpace * 4);
// v1
QGears::MapFileSerializer::Vertex v1 = part.mVertices.at(tri.Vertex2Index);
manual->position(From16BitFixedPoint(v1.X)+xPos, From16BitFixedPoint(v1.Y), From16BitFixedPoint(v1.Z)+yPos);
manual->textureCoord(ToTextureCoordU(tri.uVertex2, tri.TextureInfo), ToTextureCoordV(tri.vVertex2, tri.TextureInfo));
// v2
v1 = part.mVertices.at(tri.Vertex1Index);
manual->position(From16BitFixedPoint(v1.X)+xPos, From16BitFixedPoint(v1.Y), From16BitFixedPoint(v1.Z)+yPos);
manual->textureCoord(ToTextureCoordU(tri.uVertex1, tri.TextureInfo), ToTextureCoordV(tri.vVertex1, tri.TextureInfo));
// v3
v1 = part.mVertices.at(tri.Vertex0Index);
manual->position(From16BitFixedPoint(v1.X)+xPos, From16BitFixedPoint(v1.Y), From16BitFixedPoint(v1.Z)+yPos);
manual->textureCoord(ToTextureCoordU(tri.uVertex0, tri.TextureInfo), ToTextureCoordV(tri.vVertex0, tri.TextureInfo));
}
blockX++;
if (blockX >= 4 )
{
blockX = 0;
blockY++;
}
}
mapX++;
if (mapX >= 9 )
{
mapX = 0;
//.........这里部分代码省略.........