本文整理汇总了C++中ManualObject::quad方法的典型用法代码示例。如果您正苦于以下问题:C++ ManualObject::quad方法的具体用法?C++ ManualObject::quad怎么用?C++ ManualObject::quad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManualObject
的用法示例。
在下文中一共展示了ManualObject::quad方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createVoxelMesh
//this makes the cube mesh used to represent a voxel.
void OgreDisplay::createVoxelMesh()
{
ManualObject* manual = sceneMgr->createManualObject("voxel");
manual->begin("BaseWhite", RenderOperation::OT_TRIANGLE_LIST);
manual->position(-0.5, -0.5, -0.5); //0
manual->position(-0.5, -0.5, 0.5); //1
manual->position(0.5, -0.5, 0.5); //2
manual->position(0.5, -0.5, -0.5); //3
manual->position(-0.5, 0.5, -0.5); //4
manual->position(-0.5, 0.5, 0.5); //5
manual->position(0.5, 0.5, 0.5); //6
manual->position(0.5, 0.5, -0.5); //7
manual->quad(0,1,2,3);
manual->quad(4,5,6,7);
manual->quad(0,1,4,5);
manual->quad(2,3,6,7);
manual->quad(1,2,5,6);
manual->quad(0,3,4,7);
manual->end();
manual->convertToMesh("voxel");
}
示例2: drawBox
void BoxPrimitive::drawBox()
{
ManualObject* manualObject = getManualObject();
manualObject->clear();
std::vector<Vector3> corners;
corners.reserve(8);
Vector3 vmin = mSize.getMinimum();
Vector3 vmax = mSize.getMaximum();
manualObject->begin(mMaterialName);
manualObject->position(vmin); // 0
manualObject->position(Vector3(vmax.x, vmin.y, vmin.z)); // 1
manualObject->position(Vector3(vmax.x, vmax.y, vmin.z)); // 2
manualObject->position(Vector3(vmin.x, vmax.y, vmin.z)); // 3
manualObject->position(Vector3(vmax.x, vmin.y, vmax.z)); // 4
manualObject->position(Vector3(vmin.x, vmin.y, vmax.z)); // 5
manualObject->position(Vector3(vmin.x, vmax.y, vmax.z)); // 6
manualObject->position(vmax); // 7
manualObject->quad(0, 3, 2, 1);
manualObject->quad(0, 5, 6, 3);
manualObject->quad(0, 1, 4, 5);
manualObject->quad(7, 2, 3, 6);
manualObject->quad(7, 4, 1, 2);
manualObject->quad(7, 6, 5, 4);
manualObject->end();
}
示例3: 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;
}
示例4: create
void UniversePlanet::create() {
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("BoxColor", "General", true);
Ogre::Technique* tech = mat->getTechnique(0);
Ogre::Pass* pass = tech->getPass(0);
Ogre::TextureUnitState* tex = pass->createTextureUnitState();
tex->setTextureName("materials/textures/grass.png");
tex->setNumMipmaps(4);
tex->setTextureAnisotropy(1);
tex->setTextureFiltering(Ogre::FO_POINT, Ogre::FO_POINT, Ogre::FO_POINT);
ManualObject *meshChunk = new ManualObject("meshChunk_" + getName());
int iVertex = 0;
block_t currentBlock;
block_t nextBlock;
Ogre::Vector3 v;
meshChunk->begin("BoxColor");
for(int w = 0; w < 6; ++w)
for(int z = 0; z < mWorldHeight; ++z)
for(int y = 0; y < mWorldSize; ++y)
for(int x = 0; x < mWorldSize; ++x) {
currentBlock = getBlock(w, x, y, z);
if(currentBlock == 0) continue;
//x-1
nextBlock = 0;
nextBlock = getBlock(w, x - 1, y, z);
if(nextBlock == 0) {
meshChunk->position(map(w, x, y, z + 1));
meshChunk->textureCoord(0, 1);
meshChunk->position(map(w, x, y + 1, z + 1));
meshChunk->textureCoord(1, 1);
meshChunk->position(map(w, x, y + 1, z));
meshChunk->textureCoord(1, 0);
meshChunk->position(map(w, x, y, z));
meshChunk->textureCoord(0, 0);
if(w == 0 || w == 3 || w == 5) meshChunk->quad(iVertex + 3, iVertex + 2, iVertex + 1, iVertex);
else meshChunk->quad(iVertex, iVertex + 1, iVertex + 2, iVertex + 3);
iVertex += 4;
}
//x+1
nextBlock = 0;
nextBlock = getBlock(w, x + 1, y, z);
if(nextBlock == 0) {
meshChunk->position(map(w, x + 1, y, z));
meshChunk->textureCoord(0, 1);
meshChunk->position(map(w, x + 1, y + 1, z));
meshChunk->textureCoord(1, 1);
meshChunk->position(map(w, x + 1, y + 1, z + 1));
meshChunk->textureCoord(1, 0);
meshChunk->position(map(w, x + 1, y, z + 1));
meshChunk->textureCoord(0, 0);
if(w == 0 || w == 3 || w == 5) meshChunk->quad(iVertex + 3, iVertex + 2, iVertex + 1, iVertex);
else meshChunk->quad(iVertex, iVertex + 1, iVertex + 2, iVertex + 3);
iVertex += 4;
}
//y-1
nextBlock = 0;
nextBlock = getBlock(w, x, y - 1, z);
if(nextBlock == 0) {
meshChunk->position(map(w, x, y, z));
meshChunk->textureCoord(0, 1);
meshChunk->position(map(w, x + 1, y, z));
meshChunk->textureCoord(1, 1);
meshChunk->position(map(w, x + 1, y, z + 1));
meshChunk->textureCoord(1, 0);
meshChunk->position(map(w, x, y, z + 1));
meshChunk->textureCoord(0, 0);
if(w == 0 || w == 3 || w == 5) meshChunk->quad(iVertex + 3, iVertex + 2, iVertex + 1, iVertex);
else meshChunk->quad(iVertex, iVertex + 1, iVertex + 2, iVertex + 3);
iVertex += 4;
}
//y+1
nextBlock = 0;
nextBlock = getBlock(w, x, y + 1, z);
if(nextBlock == 0) {
meshChunk->position(map(w, x, y + 1, z + 1));
meshChunk->textureCoord(0, 1);
meshChunk->position(map(w, x + 1, y + 1, z + 1));
meshChunk->textureCoord(1, 1);
meshChunk->position(map(w, x + 1, y + 1, z));
meshChunk->textureCoord(1, 0);
meshChunk->position(map(w, x, y + 1, z));
meshChunk->textureCoord(0, 0);
//.........这里部分代码省略.........
示例5: createCubeMesh
void OgreDisplay::createCubeMesh(std::string name, std::string material)
{
//make a cube mesh
ManualObject* cubeMesh = sceneMgr->createManualObject("cube");
cubeMesh->begin(material, RenderOperation::OT_TRIANGLE_LIST);
cubeMesh->position(-0.5, -0.5, -0.5); //0
cubeMesh->normal(0,-1,0);
cubeMesh->textureCoord(0,0);
cubeMesh->position(-0.5, -0.5, 0.5); //1
cubeMesh->normal(0,-1,0);
cubeMesh->textureCoord(0,1);
cubeMesh->position(0.5, -0.5, 0.5); //2
cubeMesh->normal(0,-1,0);
cubeMesh->textureCoord(1,1);
cubeMesh->position(0.5, -0.5, -0.5); //3
cubeMesh->normal(0,-1,0);
cubeMesh->textureCoord(1,0);
cubeMesh->position(-0.5, 0.5, -0.5); //4
cubeMesh->normal(0,1,0);
cubeMesh->textureCoord(0,0);
cubeMesh->position(-0.5, 0.5, 0.5); //5
cubeMesh->normal(0,1,0);
cubeMesh->textureCoord(0,1);
cubeMesh->position(0.5, 0.5, 0.5); //6
cubeMesh->normal(0,1,0);
cubeMesh->textureCoord(1,1);
cubeMesh->position(0.5, 0.5, -0.5); //7
cubeMesh->normal(0,1,0);
cubeMesh->textureCoord(1,0);
cubeMesh->position(-0.5, -0.5, -0.5); //8
cubeMesh->normal(0,0,-1);
cubeMesh->textureCoord(0,0);
cubeMesh->position(-0.5, -0.5, 0.5); //9
cubeMesh->normal(0,0,1);
cubeMesh->textureCoord(0,0);
cubeMesh->position(0.5, -0.5, 0.5); //10
cubeMesh->normal(0,0,1);
cubeMesh->textureCoord(1,0);
cubeMesh->position(0.5, -0.5, -0.5); //11
cubeMesh->normal(0,0,-1);
cubeMesh->textureCoord(1,0);
cubeMesh->position(-0.5, 0.5, -0.5); //12
cubeMesh->normal(0,0,-1);
cubeMesh->textureCoord(0,1);
cubeMesh->position(-0.5, 0.5, 0.5); //13
cubeMesh->normal(0,0,1);
cubeMesh->textureCoord(0,1);
cubeMesh->position(0.5, 0.5, 0.5); //14
cubeMesh->normal(0,0,1);
cubeMesh->textureCoord(1,1);
cubeMesh->position(0.5, 0.5, -0.5); //15
cubeMesh->normal(0,0,-1);
cubeMesh->textureCoord(1,1);
cubeMesh->position(-0.5, -0.5, -0.5); //16
cubeMesh->normal(-1,0,0);
cubeMesh->textureCoord(0,0);
cubeMesh->position(-0.5, -0.5, 0.5); //17
cubeMesh->normal(-1,0,0);
cubeMesh->textureCoord(0,1);
cubeMesh->position(0.5, -0.5, 0.5); //18
cubeMesh->normal(1,0,0);
cubeMesh->textureCoord(0,1);
cubeMesh->position(0.5, -0.5, -0.5); //19
cubeMesh->normal(1,0,0);
cubeMesh->textureCoord(0,0);
cubeMesh->position(-0.5, 0.5, -0.5); //20
cubeMesh->normal(-1,0,0);
cubeMesh->textureCoord(1,0);
cubeMesh->position(-0.5, 0.5, 0.5); //21
cubeMesh->normal(-1,0,0);
cubeMesh->textureCoord(1,1);
cubeMesh->position(0.5, 0.5, 0.5); //22
cubeMesh->normal(1,0,0);
cubeMesh->textureCoord(1,1);
cubeMesh->position(0.5, 0.5, -0.5); //23
cubeMesh->normal(1,0,0);
cubeMesh->textureCoord(1,0);
//bottom
cubeMesh->quad(3,2,1,0);
//top
cubeMesh->quad(4,5,6,7);
//front
cubeMesh->quad(10,14,13,9);
//back
cubeMesh->quad(8,12,15,11);
//left
cubeMesh->quad(16,17,21,20);
//right
cubeMesh->quad(23,22,18,19);
cubeMesh->end();
cubeMesh->convertToMesh(name);
}