本文整理汇总了C++中ogre::ManualObject类的典型用法代码示例。如果您正苦于以下问题:C++ ManualObject类的具体用法?C++ ManualObject怎么用?C++ ManualObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ManualObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
示例2: createAxes
void MoveDemoApplication::createAxes()
{
Ogre::ManualObject* pManualObject = mSceneMgr-> createManualObject( "ManualGridObj ");
if (pManualObject)
{
int nLength = 160 ;
pManualObject-> begin( "", Ogre::RenderOperation::OT_LINE_LIST);
pManualObject-> position(0, 0, 0);
pManualObject-> colour(Ogre::ColourValue::Red);
pManualObject-> position(nLength*4, 0, 0);
pManualObject-> position(0, 0, 0);
pManualObject-> colour(Ogre::ColourValue::Green);
pManualObject-> position(0, nLength, 0);
pManualObject-> position(0, 0, 0);
pManualObject-> colour(Ogre::ColourValue::Blue);
pManualObject-> position(0, 0, nLength);
pManualObject-> end();
pManualObject->getSection(0)->getTechnique()->getPass(0)->setLightingEnabled(false);
Ogre::SceneNode*pSceneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "ManualGridNode ");
if(pSceneNode)
pSceneNode-> attachObject(pManualObject);
}
}
示例3: createPath
void MoveDemoApplication::createPath()
{
Ogre::ManualObject* pManualObject = mSceneMgr-> createManualObject( "PathObj");
if (pManualObject)
{
pManualObject-> begin( "", Ogre::RenderOperation::OT_LINE_LIST);
pManualObject-> colour(Ogre::ColourValue(1.0 , 1.0 , 0 ));
pManualObject-> position(Vector3( 0.0f, 1.0f, 25.0f ));
pManualObject-> position(Vector3( 550.0f, 1.0f, 50.0f ));
pManualObject-> position(Vector3( 550.0f, 1.0f, 50.0f ));
pManualObject-> position(Vector3(-100.0f, 1.0f, -200.0f ) );
pManualObject-> position(Vector3(-100.0f, 1.0f, -200.0f ) );
pManualObject-> position(Vector3( 0.0f, 1.0f, 25.0f ));
pManualObject-> end();
pManualObject->getSection(0)->getTechnique()->getPass(0)->setLightingEnabled(false);
Ogre::SceneNode*pSceneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "PathNode ");
if(pSceneNode)
pSceneNode-> attachObject(pManualObject);
}
}
示例4: 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();
}
示例5: createCubeMesh
//-------------------------------------------------------------------------------------
void BasicTutorial2::createScene(void)
{
mSceneMgr->setAmbientLight(Ogre::ColourValue(0, 0, 0));
//mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
//Create cube
//Create a basic green color texture
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("grassTexture.png");
//tex->setNumMipmaps(4);
tex->setTextureAnisotropy(1);
tex->setTextureFiltering(Ogre::FO_POINT, Ogre::FO_POINT, Ogre::FO_POINT);
//Create the one box and the supporting class objects
Ogre::ManualObject* testBox = createCubeMesh("TestBox1", "BoxColor");
Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
Ogre::MeshPtr Mesh = testBox->convertToMesh("TestBox2");
Ogre::StaticGeometry* pGeom = new Ogre::StaticGeometry (mSceneMgr, "Boxes");
Ogre::Entity* pEnt = mSceneMgr->createEntity("TestBox2");
//testBox->triangle
pGeom->setRegionDimensions(Ogre::Vector3(300, 300, 300));
World::Instance();
pGeom->build ();
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
Ogre::Light* l = mSceneMgr->createLight("MainLight");
l->setPosition(20,80,50);
//Create Cube
/* Ogre::Entity* entNinja = mSceneMgr->createEntity("Ninja", "ninja.mesh");
entNinja->setCastShadows(true);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entNinja);*/
Ogre::Light* directionalLight = mSceneMgr->createLight("directionalLight");
directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
directionalLight->setDiffuseColour(Ogre::ColourValue(.25, .25, 0));
directionalLight->setSpecularColour(Ogre::ColourValue(.25, .25, 0));
directionalLight->setDirection(Ogre::Vector3( 0, -1, 1 ));
}
示例6: realizeMesh
Ogre::MeshPtr MultiShape::realizeMesh(const std::string& name)
{
Ogre::ManualObject * manual = Root::getInstance()->sceneManager->createManualObject(name);
for (std::vector<Shape>::iterator it = shapes.begin(); it!=shapes.end(); it++)
{
manual->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_STRIP);
it->_appendToManualObject(manual);
manual->end();
}
Ogre::MeshPtr mesh = manual->convertToMesh(name);
return mesh;
}
示例7: BuildBuildings
Ogre::String GameBuildingSystem::BuildBuildings( Ogre::SceneManager *sceneMan, GameRoadGraphAreaTreeNode *roadRoot )
{
Ogre::ManualObject *manObject = NULL;
Ogre::String manObjectName = "Buildings";
manObject = sceneMan->createManualObject( manObjectName );
manObject->setDynamic( false );
BuildToArea( roadRoot, manObject );
manObject->setCastShadows( true );
sceneMan->getRootSceneNode()->createChildSceneNode()->attachObject( manObject );
return manObjectName;
}
示例8: 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);
}
示例9: loadObject
Ogre::ManualObject* OBJImp::loadObject(std::string fileName){
Ogre::ManualObject* mObj = video.ogreSceneMgr->createManualObject(fileName);
mObj->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_STRIP);
std::cout << "Opening .obj file: " << fileName.c_str() << std::endl;
std::ifstream file(fileName);
if(!file){
std::cout << "Opening file failed!\n";
return NULL;
} else {
std::cout << "OBJ File loaded successfully!\n";
}
std::string line;
int totalLines = 0;
int currentLine = 0;
//obj content storage
std::string type;
std::string tmp;
double v1, v2, v3;
Ogre::Vector3 tmpVec3;
while(std::getline(file,line)){
std::stringstream iss(line);
std::getline(iss, type, ' ');
std::getline(iss, tmp, ' ');
if(tmp.find("#") != std::string::npos){
break;
}
v1 = std::stod(tmp.c_str());
std::getline(iss, tmp, ' ');
if(tmp.find("#") != std::string::npos){
break;
}
v2 = std::stod(tmp.c_str());
std::getline(iss, tmp, ' ');
if(tmp.find("#") != std::string::npos){
break;
}
v3 = std::stod(tmp.c_str());
tmpVec3.x = v1;
tmpVec3.y = v2;
tmpVec3.z = v3;
tmpVerts.push_back(tmpVec3);
mObj->position(tmpVec3);
}
mObj->end();
return mObj;
}
示例10:
void
Player::createHitBox(std::string name)
{
Ogre::ManualObject* myManualObject = mSceneManager->createManualObject(name);
myManualObject->setDynamic(true);
Ogre::SceneNode* myManualObjectNode = mSceneManager->getRootSceneNode()->createChildSceneNode(name + "_node");
Ogre::MaterialPtr myManualObjectMaterial = Ogre::MaterialManager::getSingleton().create(name + "Material","General");
myManualObjectMaterial->setReceiveShadows(false);
myManualObjectMaterial->getTechnique(0)->setLightingEnabled(true);
myManualObjectMaterial->getTechnique(0)->getPass(0)->setDiffuse(1,0,0,0);
myManualObjectMaterial->getTechnique(0)->getPass(0)->setAmbient(1,0,0);
myManualObjectMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(1,0,0);
myManualObjectNode->attachObject(myManualObject);
}
示例11: 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);
}
示例12: _exportPolygonMeshToEntity
Ogre::ManualObject* RecastInterface::_exportPolygonMeshToEntity(unsigned short* vertices,
int numVertices,
unsigned short* polygons,
int numPolys,
int maxPolys,
int numVertsPerPoly,
const Ogre::Vector3& origin)
{
if(_polyMesh == nullptr || _detailMesh == nullptr)
{
return NULL;
}
int nIndex = 0;
Ogre::ManualObject* manObj = _scene->createManualObject("recastTempMO");
manObj->begin("arena_locker/blue",Ogre::RenderOperation::OT_TRIANGLE_LIST);
for( int i = 0; i < numPolys; ++i)
{
const unsigned short* p = &polygons[i * numVertsPerPoly * 2];
unsigned short vi[3];
for(int j = 2; j < numVertsPerPoly; ++j)
{
if(p[j] == RC_MESH_NULL_IDX) break;
vi[0] = p[0];
vi[1] = p[j-1];
vi[2] = p[j];
for(int k = 0; k < 3; ++k)
{
const unsigned short* v = &vertices[vi[k]*3];
const float x = origin[0] + v[0] * _recastParams.getCellSize();
const float y = origin[1] + v[1] * _recastParams.getCellHeight();
const float z = origin[2] + v[2] * _recastParams.getCellSize();
manObj->position(x,y,z);
}
manObj->triangle(nIndex,nIndex+1,nIndex+2);
nIndex += 3;
}
}
manObj->end();
return manObj;
}
示例13: 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" );
}
示例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: setShow
void NavigationMesh::setShow( bool show )
{
Ogre::Root *root = Ogre::Root::getSingletonPtr();
Ogre::SceneManager* mgr = root->getSceneManager( "SceneManagerInstance" );
Ogre::ManualObject* debug;
Ogre::SceneNode* debugNode;
mShow = show;
if( mgr->hasSceneNode( "debugDrawNode2" ) )
{
debugNode = mgr->getSceneNode( "debugDrawNode2" );
}
else
{
debugNode = mgr->getRootSceneNode()->createChildSceneNode( "debugDrawNode2" );
debugNode->translate( 0, 1, 0 ); // Move up slightly to see lines better.
}
if( mgr->hasManualObject( "debugDraw2" ) )
debug = mgr->getManualObject( "debugDraw2" );
else
{
debug = mgr->createManualObject( "debugDraw2" );
debugNode->attachObject( debug );
debug->setQueryFlags( 0 );
debug->setRenderQueueGroup( Ogre::RENDER_QUEUE_OVERLAY );
}
if( !mShow )
{
mgr->destroyManualObject( debug );
return;
}
for( CellVector::iterator i = mCells.begin(); i != mCells.end(); i++ )
{
i->debugDrawCell( debug, "debug/yellow", "debug/blue" );
}
return;
}