本文整理汇总了C++中ogre::ManualObject::position方法的典型用法代码示例。如果您正苦于以下问题:C++ ManualObject::position方法的具体用法?C++ ManualObject::position怎么用?C++ ManualObject::position使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::ManualObject
的用法示例。
在下文中一共展示了ManualObject::position方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _drawGridPlane
void _drawGridPlane(void)
{
Ogre::ManualObject* gridPlane = mSceneMgr->createManualObject("GridPlane");
Ogre::SceneNode* gridPlaneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("GridPlaneNode");
Ogre::MaterialPtr gridPlaneMaterial = Ogre::MaterialManager::getSingleton().create("GridPlanMaterial", "General");
gridPlaneMaterial->setReceiveShadows(false);
gridPlaneMaterial->getTechnique(0)->setLightingEnabled(true);
gridPlaneMaterial->getTechnique(0)->getPass(0)->setDiffuse(1, 1, 1, 0);
gridPlaneMaterial->getTechnique(0)->getPass(0)->setAmbient(1, 1, 1);
gridPlaneMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(1, 1, 1);
gridPlane->begin("GridPlaneMaterial", Ogre::RenderOperation::OT_LINE_LIST);
for (int i = 0; i < 21; i++)
{
gridPlane->position(-500.0f, 0.0f, 500.0f - i * 50);
gridPlane->position(500.0f, 0.0f, 500.0f - i * 50);
gridPlane->position(-500.f + i * 50, 0.f, 500.0f);
gridPlane->position(-500.f + i * 50, 0.f, -500.f);
}
gridPlane->end();
gridPlaneNode->attachObject(gridPlane);
}
示例2: RenderLineSegments
void RenderSystem::RenderLineSegments(std::string lsName, std::string materialName, const std::vector<MagicMath::Vector3>& startPos, const std::vector<MagicMath::Vector3>& endPos)
{
Ogre::ManualObject* pMObj = NULL;
if (mpSceneMgr->hasManualObject(lsName))
{
pMObj = mpSceneMgr->getManualObject(lsName);
pMObj->clear();
}
else
{
pMObj = mpSceneMgr->createManualObject(lsName);
if (mpSceneMgr->hasSceneNode("ModelNode"))
{
mpSceneMgr->getSceneNode("ModelNode")->attachObject(pMObj);
}
else
{
mpSceneMgr->getRootSceneNode()->createChildSceneNode("ModelNode")->attachObject(pMObj);
}
}
pMObj->begin(materialName, Ogre::RenderOperation::OT_LINE_LIST);
int lineNum = startPos.size();
for (int i = 0; i < lineNum; i++)
{
MagicMath::Vector3 start = startPos.at(i);
MagicMath::Vector3 end = endPos.at(i);
pMObj->position(start[0], start[1], start[2]);
pMObj->position(end[0], end[1], end[2]);
}
pMObj->end();
}
示例3: drawRaycast
// Dibujado de raycast para depurar
void CShootRaycast::drawRaycast(const Ray& raycast) {
Graphics::CScene *scene = Graphics::CServer::getSingletonPtr()->getActiveScene();
Ogre::SceneManager *mSceneMgr = scene->getSceneMgr();
std::stringstream aux;
aux << "laser" << _nameWeapon << _temporal;
++_temporal;
std::string laser = aux.str();
Ogre::ManualObject* myManualObject = mSceneMgr->createManualObject(laser);
Ogre::SceneNode* myManualObjectNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(laser+"_node");
myManualObject->begin("laser", Ogre::RenderOperation::OT_LINE_STRIP);
Vector3 v = raycast.getOrigin();
myManualObject->position(v.x,v.y,v.z);
for(int i=0; i < _distance;++i){
Vector3 v = raycast.getPoint(i);
myManualObject->position(v.x,v.y,v.z);
// etc
}
myManualObject->end();
myManualObjectNode->attachObject(myManualObject);
}// drawRaycast
示例4: debugDrawClassification
void NavigationCell::debugDrawClassification( Ogre::Vector3 start, Ogre::Vector3 end )
{
Ogre::Root *root = Ogre::Root::getSingletonPtr();
Ogre::SceneManager* mgr = root->getSceneManager( "SceneManagerInstance" );
Ogre::ManualObject* debug;
Ogre::SceneNode* node;
if( mgr->hasManualObject( "debugDrawClassification" ) )
debug = mgr->getManualObject( "debugDrawClassification" );
else
{
debug = mgr->createManualObject( "debugDrawClassification" );
node = mgr->getRootSceneNode()->createChildSceneNode();
node->attachObject( debug );
node->translate( 0, 1, 0 );
debug->setQueryFlags( 0 );
debug->setRenderQueueGroup( Ogre::RENDER_QUEUE_OVERLAY );
}
debug->begin( "debug/blue", Ogre::RenderOperation::OT_LINE_LIST );
debug->position( start );
debug->position( end );
debug->end();
// debugDrawCell( debug, "debug/yellow", "debug/blue" );
}
示例5:
void RenderSystem::RenderPoint3DSet(std::string psName, std::string psMaterialName, const MagicDGP::Point3DSet* pPS)
{
Ogre::ManualObject* pMObj = NULL;
if (mpSceneMgr->hasManualObject(psName))
{
pMObj = mpSceneMgr->getManualObject(psName);
pMObj->clear();
}
else
{
pMObj = mpSceneMgr->createManualObject(psName);
if (mpSceneMgr->hasSceneNode("ModelNode"))
{
mpSceneMgr->getSceneNode("ModelNode")->attachObject(pMObj);
}
else
{
mpSceneMgr->getRootSceneNode()->createChildSceneNode("ModelNode")->attachObject(pMObj);
}
}
if (pPS->HasNormal())
{
int pointNum = pPS->GetPointNumber();
pMObj->begin(psMaterialName, Ogre::RenderOperation::OT_POINT_LIST);
for (int i = 0; i < pointNum; i++)
{
const MagicDGP::Point3D* pPoint = pPS->GetPoint(i);
if (pPoint->IsValid() == false)
{
continue;
}
MagicMath::Vector3 pos = pPoint->GetPosition();
MagicMath::Vector3 nor = pPoint->GetNormal();
MagicMath::Vector3 color = pPoint->GetColor();
pMObj->position(pos[0], pos[1], pos[2]);
pMObj->normal(nor[0], nor[1], nor[2]);
pMObj->colour(color[0], color[1], color[2]);
}
pMObj->end();
}
else
{
int pointNum = pPS->GetPointNumber();
pMObj->begin(psMaterialName, Ogre::RenderOperation::OT_POINT_LIST);
for (int i = 0; i < pointNum; i++)
{
const MagicDGP::Point3D* pPoint = pPS->GetPoint(i);
if (pPoint->IsValid() == false)
{
continue;
}
MagicMath::Vector3 pos = pPoint->GetPosition();
MagicMath::Vector3 color = pPoint->GetColor();
pMObj->position(pos[0], pos[1], pos[2]);
pMObj->colour(color[0], color[1], color[2]);
}
pMObj->end();
}
}
示例6: cos
void BasicTutorial3::createCursor( float radius )
{
radius *= VOXEL_SCALE;
// Assuming scene_mgr is your SceneManager.
Ogre::ManualObject * circle = mSceneMgr->createManualObject("debugCursor");
// accuracy is the count of points (and lines).
// Higher values make the circle smoother, but may slowdown the performance.
// The performance also is related to the count of circles.
float const accuracy = 35;
circle->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_STRIP);
unsigned point_index = 0;
for(float theta = 0; theta <= 2 * M_PI; theta += M_PI / accuracy) {
circle->position(radius * cos(theta), 0, radius * sin(theta));
circle->index(point_index++);
}
for(float theta = 0; theta <= 2 * M_PI; theta += M_PI / accuracy) {
circle->position(radius * cos(theta), radius * sin(theta), 0);
circle->index(point_index++);
}
circle->index(0); // Rejoins the last point to the first.
circle->end();
mCursor = mSceneMgr->getRootSceneNode()->createChildSceneNode("debugCursor");
mCursor->attachObject(circle);
}
示例7: CreateRegion
//-------------------------------------------------------
Ogre::MeshPtr Ground::CreateRegion(size_t id, const std::string & material, const Ogre::Box & roi, const Ogre::Vector3 & offset, const Ogre::Vector3 & steps, const Ogre::Vector2 & texOffset)
{
assert(mSceneManager != nullptr);
Ogre::ManualObject* object = mSceneManager->createManualObject();
object->begin(material, Ogre::RenderOperation::OT_TRIANGLE_LIST);
{
size_t lastIdx = 0;
for (size_t y = 0; y < REGION_SIZE; ++y)
{
size_t texY = static_cast<size_t>(static_cast<float>(y) / REGION_SIZE * (roi.getHeight() - 1));
size_t texYn = static_cast<size_t>(static_cast<float>(y + 1) / REGION_SIZE * (roi.getHeight() - 1));
//Flip texture vertically
texY = roi.getHeight() - 1 - texY;
texYn = roi.getHeight() - 1 - texYn;
float texCrdT = texOffset[1] + static_cast<float>(texY) / (mImage->getHeight() - 1);
float texCrdTn = texOffset[1] + static_cast<float>(texYn) / (mImage->getHeight() - 1);
for (size_t x = 0; x < REGION_SIZE; ++x)
{
size_t texX = static_cast<size_t>(static_cast<float>(x) / REGION_SIZE * (roi.getWidth() - 1));
size_t texXn = static_cast<size_t>(static_cast<float>(x + 1) / REGION_SIZE * (roi.getWidth() - 1));
float texCrdS = texOffset[0] + static_cast<float>(texX) / (mImage->getWidth() - 1);
float texCrdSn = texOffset[0] + static_cast<float>(texXn) / (mImage->getWidth() - 1);
float h00 = mImage->getColourAt(roi.left + texX, roi.top + texY, 0)[0];
float h10 = mImage->getColourAt(roi.left + texXn, roi.top + texY, 0)[0];
float h01 = mImage->getColourAt(roi.left + texX, roi.top + texYn, 0)[0];
float h11 = mImage->getColourAt(roi.left + texXn, roi.top + texYn, 0)[0];
object->position(x * steps[0] + offset[0], y * steps[1] + offset[1], h00 * steps[2]);
object->textureCoord(texCrdS, texCrdT);
object->colour(h00, h00, h00);
object->position((x + 1) * steps[0] + offset[0], y * steps[1] + offset[1], h10 * steps[2]);
object->textureCoord(texCrdSn, texCrdT);
object->colour(h10, h10, h10);
object->position(x * steps[0] + offset[0], (y + 1) * steps[1] + offset[1], h01 * steps[2]);
object->textureCoord(texCrdS, texCrdTn);
object->colour(h01, h01, h01);
object->position((x + 1) * steps[0] + offset[0], (y + 1) * steps[1] + offset[1], h11 * steps[2]);
object->textureCoord(texCrdSn, texCrdTn);
object->colour(h11, h11, h11);
object->triangle(lastIdx + 1, lastIdx + 2, lastIdx);
object->triangle(lastIdx + 3, lastIdx + 2, lastIdx + 1);
lastIdx += 4;
}
}
}
object->end();
return object->convertToMesh("Mesh/" + CLASS_NAME + "/" + mName + "/" + std::to_string(id));
}
示例8: addLine
void addLine(
Ogre::Vector3 i_start,
Ogre::Vector3 i_end,
const Ogre::String& i_material,
Ogre::ManualObject& io_object)
{
io_object.begin(i_material, Ogre::RenderOperation::OT_LINE_LIST);
io_object.position(i_start.x, i_start.y, i_start.z);
io_object.position(i_end.x, i_end.y, i_end.z);
io_object.end();
}
示例9: toMesh
Ogre::MeshPtr STLLoader::toMesh(const std::string& name)
{
Ogre::ManualObject* object = new Ogre::ManualObject( "the one and only" );
object->begin( "BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST );
unsigned int vertexCount = 0;
V_Triangle::const_iterator it = triangles_.begin();
V_Triangle::const_iterator end = triangles_.end();
for (; it != end; ++it )
{
if( vertexCount >= 2004 )
{
// Subdivide large meshes into submeshes with at most 2004
// vertices to prevent problems on some graphics cards.
object->end();
object->begin( "BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST );
vertexCount = 0;
}
const STLLoader::Triangle& tri = *it;
float u, v;
u = v = 0.0f;
object->position( tri.vertices_[0] );
object->normal( tri.normal_);
calculateUV( tri.vertices_[0], u, v );
object->textureCoord( u, v );
object->position( tri.vertices_[1] );
object->normal( tri.normal_);
calculateUV( tri.vertices_[1], u, v );
object->textureCoord( u, v );
object->position( tri.vertices_[2] );
object->normal( tri.normal_);
calculateUV( tri.vertices_[2], u, v );
object->textureCoord( u, v );
object->triangle( vertexCount + 0, vertexCount + 1, vertexCount + 2 );
vertexCount += 3;
}
object->end();
Ogre::MeshPtr mesh = object->convertToMesh( name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
mesh->buildEdgeList();
delete object;
return mesh;
}
示例10: createBeamGun
Entity* EntityFactory::createBeamGun(const BeamGunConfig& config)
{
EntityManager* entityMgr = engine_->entityMgr_;
Entity* entity = entityMgr->create();
float y = 0.1f;
b2BodyDef bd;
bd.type = b2_dynamicBody;
bd.position.Set(config.posX_, config.posY_);
b2Body* body = engine_->sysPhysics_->getWorld()->CreateBody(&bd);
b2PolygonShape shape;
b2Vec2 vertices[4];
vertices[0].Set(0, y);
vertices[1].Set(0, -y);
vertices[2].Set(config.beamRange_, -y);
vertices[3].Set(config.beamRange_, y);
shape.Set(vertices, 4);
b2FixtureDef sd;
sd.shape = &shape;
sd.density = 0;
sd.filter.categoryBits = ComPhysics::CATEG_PlayerBeam;
sd.filter.maskBits = ComPhysics::MASK_PlayerBeam;
body->CreateFixture(&sd);
ComPhysics* comPhysics = entityMgr->assignComponent<ComPhysics>(entity);
comPhysics->setMainBody(body, entity);
Ogre::SceneManager* sceneMgr = engine_->sysGraphics_->getSceneManager();
Ogre::ManualObject* manual = sceneMgr->createManualObject();
manual->begin("beam", Ogre::RenderOperation::OT_LINE_STRIP);
manual->position(0, y, 0);
manual->position(0, -y, 0);
manual->position(config.beamRange_, -y, 0);
manual->position(config.beamRange_, y, 0);
manual->position(0, y, 0);
manual->end();
Ogre::SceneNode* node = engine_->sysGraphics_->getSceneRoot()->createChildSceneNode(
Ogre::Vector3(config.posX_, config.posY_, 0));
node->attachObject(manual);
ComGraphics* comGraphics = entityMgr->assignComponent<ComGraphics>(entity);
comGraphics->sceneNode_ = node;
return entity;
}
示例11: debugDrawCellAndNeigbours
void NavigationCell::debugDrawCellAndNeigbours()
{
Ogre::Root *root = Ogre::Root::getSingletonPtr();
Ogre::SceneManager* mgr = root->getSceneManager( "SceneManagerInstance" );
Ogre::ManualObject* debug;
Ogre::SceneNode* debugNode;
if( mgr->hasSceneNode( "debugDrawNode" ) )
{
debugNode = mgr->getSceneNode( "debugDrawNode" );
}
else
{
debugNode = mgr->getRootSceneNode()->createChildSceneNode( "debugDrawNode" );
debugNode->translate( 0, 1, 0 ); // Move up slightly to see lines better.
}
if( mgr->hasManualObject( "debugDraw" ) )
debug = mgr->getManualObject( "debugDraw" );
else
{
debug = mgr->createManualObject( "debugDraw" );
debugNode->attachObject( debug );
debug->setQueryFlags( 0 );
debug->setRenderQueueGroup( Ogre::RENDER_QUEUE_OVERLAY );
}
for( int i = 0; i < 3; i++ )
{
if( mLinks[i] )
{
debug->begin( "debug/blue", Ogre::RenderOperation::OT_LINE_STRIP );
debug->position( mLinks[i]->mVertices[0] );
debug->position( mLinks[i]->mVertices[1] );
debug->position( mLinks[i]->mVertices[2] );
debug->position( mLinks[i]->mVertices[0] );
debug->end();
}
}
debug->begin( "debug/yellow", Ogre::RenderOperation::OT_LINE_STRIP );
debug->position( mVertices[0].x, mVertices[0].y+1, mVertices[0].z );
debug->position( mVertices[1].x, mVertices[1].y+1, mVertices[1].z );
debug->position( mVertices[2].x, mVertices[2].y+1, mVertices[2].z );
debug->position( mVertices[0].x, mVertices[0].y+1, mVertices[0].z );
debug->end();
}
示例12: indicator
void Chart::indicator(const Ogre::Real chartX, const Ogre::Real chartY)
{
const std::string chartXString = Ogre::StringConverter::toString(chartX).substr(0, std::min(Ogre::StringConverter::toString(chartX).size(), (std::string::size_type)4));
const std::string chartYString = Ogre::StringConverter::toString(chartY).substr(0, std::min(Ogre::StringConverter::toString(chartY).size(), (std::string::size_type)3));
const Ogre::Vector3 x = chartToScreen( Ogre::Vector2(chartX, mMin.y) );
const Ogre::Vector3 y = chartToScreen( Ogre::Vector2(mMin.x, chartY) );
const Ogre::ColourValue magenta(1,0,1);
// indicator
Ogre::ManualObject *chartIndicator = mSceneMgr->createManualObject();
chartIndicator->setUseIdentityProjection(true);
chartIndicator->setUseIdentityView(true);
chartIndicator->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY);
chartIndicator->setBoundingBox(Ogre::AxisAlignedBox::BOX_INFINITE);
chartIndicator->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_STRIP);
chartIndicator->position( x );
chartIndicator->colour( magenta );
chartIndicator->position( chartToScreen( Ogre::Vector2(chartX, chartY) ) );
chartIndicator->colour( magenta );
chartIndicator->position( y );
chartIndicator->colour( magenta );
chartIndicator->end();
// text of values on the sides of the axes
if(first)
{
TextRenderer::getSingleton().addTextBox("txt6" + rndIDString, chartXString, x.x - 0.01 * chartXString.size(), x.y - 0.035, 20, 20, magenta);
TextRenderer::getSingleton().addTextBox("txt7" + rndIDString, chartYString, y.x - 0.035 - 0.01 * chartYString.size(), y.y - 0.0025, 20, 20, magenta);
first = false;
}
else
{
TextRenderer::getSingleton().removeTextBox("txt6" + rndIDString);
TextRenderer::getSingleton().removeTextBox("txt7" + rndIDString);
TextRenderer::getSingleton().addTextBox("txt6" + rndIDString, chartXString, x.x - 0.01 * chartXString.size(), x.y - 0.035, 20, 20, magenta);
TextRenderer::getSingleton().addTextBox("txt7" + rndIDString, chartYString, y.x - 0.035 - 0.01 * chartYString.size(), y.y - 0.0025, 20, 20, magenta);
}
if (mChartIndicator)
{
mChartSceneNode->detachObject(mChartIndicator);
mSceneMgr->destroyManualObject(mChartIndicator);
}
mChartIndicator = chartIndicator;
mChartSceneNode->attachObject(mChartIndicator);
mChartSceneNode->needUpdate();
}
示例13: drawTriangle
void LevelManager::drawTriangle(const Triangle *t)
{
Ogre::ManualObject* manual = GLOBAL_SCN_MNGR->createManualObject();
manual->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_STRIP);
Ogre::Real height = 5.0f;
manual->position(t->v1->x, height, t->v1->y); // start position
manual->position(t->v2->x, height, t->v2->y); // start position
manual->position(t->v3->x, height, t->v3->y); // start position
manual->position(t->v1->x, height, t->v1->y); // start position
manual->end();
Ogre::SceneNode *node = GLOBAL_SCN_MNGR->getRootSceneNode()->createChildSceneNode();
node->attachObject(manual);
}
示例14: createSceneNode
Ogre::SceneNode* SideVerifier::createSceneNode(Ogre::SceneNode* parent, std::string name,
Ogre::Vector3 defaultTranslate)
{
Ogre::SceneNode* node = parent->createChildSceneNode(name);
node->translate(defaultTranslate);
Ogre::ManualObject* myManualObject = new Ogre::ManualObject("manual1" + name);
myManualObject->begin("manual1Material", Ogre::RenderOperation::OT_LINE_LIST);
myManualObject->position(0, 0, 0);
myManualObject->position(0, 0, -1);
myManualObject->end();
//DEBUG
// node->attachObject(myManualObject);
return node;
}
示例15: realizeMesh
Ogre::MeshPtr Path::realizeMesh(const std::string& name)
{
Ogre::SceneManager *smgr = Ogre::Root::getSingleton().getSceneManagerIterator().begin()->second;
Ogre::ManualObject * manual = smgr->createManualObject();
manual->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_STRIP);
for (std::vector<Ogre::Vector3>::iterator itPos = mPoints.begin(); itPos != mPoints.end(); itPos++)
manual->position(*itPos);
if (mClosed)
manual->position(*(mPoints.begin()));
manual->end();
Ogre::MeshPtr mesh;
if (name=="")
mesh = manual->convertToMesh(Utils::getName());
else
mesh = manual->convertToMesh(name);
return mesh;
}