本文整理汇总了C++中ManualObject类的典型用法代码示例。如果您正苦于以下问题:C++ ManualObject类的具体用法?C++ ManualObject怎么用?C++ ManualObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ManualObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createScene
//-------------------------------------------------------------------------------------
void HelloOGRE::createScene(void)
{
using namespace Ogre;
Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "7.mesh");
//Ogre::Entity* cube = mSceneMgr->createEntity("cube","abc.mesh");
Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("Head");
headNode->attachObject(ogreHead);
ManualObject * axis = mSceneMgr->createManualObject("Axis");
axis->begin("line",Ogre::RenderOperation::OperationType::OT_LINE_LIST);
axis->position(0.0f,0.0f,0.0f);
axis->position(20.0f,0.0f,0.0f);
axis->end();
headNode->attachObject(axis);
// Set ambient light
mSceneMgr->setAmbientLight(Ogre::ColourValue(1.0,0.5, 0.0));
mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
mSceneMgr->setSkyDome(true,"Examples/Rockwall");
//mSceneMgr->setSkyPlane(true,"Example/"
// Create a light
Ogre::Light* l = mSceneMgr->createLight("MainLight");
l->setDiffuseColour(0.0f,1.0f,0.0f);
l->setPosition(20,80,50);
l->setDirection(0.0,0.0,0.0);
}
示例2: buildManualObject
MeshPtr ShowNormalsGenerator::buildMesh(const std::string& name, const String& group) const
{
SceneManager* sceneMgr = Ogre::Root::getSingleton().getSceneManagerIterator().begin()->second;
ManualObject* mo = buildManualObject();
Ogre::MeshPtr mesh = mo->convertToMesh(name, group);
sceneMgr->destroyManualObject(mo);
return mesh;
}
示例3: oht_assert_threadmodel
void DebugDisplay::drawPoint( Vector3 p )
{
oht_assert_threadmodel(ThrMdl_Main);
ManualObject * pManObj = _pSceneManager->createManualObject();
rollbackTransforms(p);
pManObj->begin(getCurrentMaterial(), RenderOperation::OT_POINT_LIST);
pManObj->position(p);
pManObj->end();
_pScNode->attachObject(pManObj);
}
示例4: createCubeMesh
void OgreAppLogic::createScene(void)
{
// setup some basic lighting for our scene
mSceneMgr->setSkyDome(true, "Examples/CloudySky", 5, 8);
// make a cube to bounce around
Entity *ent1;
SceneNode *boxNode;
ManualObject *cmo = createCubeMesh("manual", "");
cmo->convertToMesh("cube");
ent1 = mSceneMgr->createEntity("Cube", "cube.mesh");
ent1->setCastShadows(true);
boxNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
boxNode->attachObject(ent1);
boxNode->setScale(Vector3(0.1,0.1,0.1)); // for some reason converttomesh multiplied dimensions by 10
mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3));
mSceneMgr->createLight()->setPosition(20, 80, 50);
// create a floor mesh resource
MeshManager::getSingleton().createPlane("floor", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Plane(Vector3::UNIT_Y, -30), 1000, 1000, 10, 10, true, 1, 8, 8, Vector3::UNIT_Z);
// create a floor entity, give it a material, and place it at the origin
Entity* floor = mSceneMgr->createEntity("Floor", "floor");
floor->setMaterialName("Examples/BumpyMetal");
mSceneMgr->getRootSceneNode()->attachObject(floor);
mSceneMgr->getRootSceneNode()->attachObject(mSceneMgr->createEntity("Head", "ogrehead.mesh"));
mSceneMgr->setSkyBox(true, "Examples/GridSkyBox");
Ogre::Entity* ent = mSceneMgr->createEntity("Sinbad.mesh"); //1x1_cube.mesh //Sinbad.mesh //axes.mesh
mObjectNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("cube");
mObjectNode->setOrientation(Quaternion(Degree(90.f), Vector3::UNIT_X));
Ogre::Real scale = 22;
mObjectNode->setPosition(10, 10, 10*scale);
mObjectNode->setScale(Ogre::Vector3::UNIT_SCALE*scale);
mObjectNode->attachObject(ent);
mObjectNode->setVisible(true);
// create swords and attach them to sinbad
Ogre::Entity* sword1 = mSceneMgr->createEntity("SinbadSword1", "Sword.mesh");
Ogre::Entity* sword2 = mSceneMgr->createEntity("SinbadSword2", "Sword.mesh");
ent->attachObjectToBone("Sheath.L", sword1);
ent->attachObjectToBone("Sheath.R", sword2);
mAnimState = ent->getAnimationState("Dance");
mAnimState->setLoop(true);
mAnimState->setEnabled(true);
}
示例5: setupScene
void setupScene()
{
mSceneMgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager");
Camera *cam = mSceneMgr->createCamera("Camera");
Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
Entity *ent;
mSceneMgr->setAmbientLight(ColourValue(0.25, 0.25, 0.25));
mSceneMgr->setShadowTechnique( SHADOWTYPE_STENCIL_ADDITIVE );
// EN:: make a cube to bounce around
// BR:: cria um cubo pra quicar
ManualObject *cmo = createCubeMesh("manual", "");
cmo->convertToMesh("cube");
ent = mSceneMgr->createEntity("Cube", "cube.mesh");
ent->setCastShadows(true);
boxNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
boxNode->attachObject(ent);
boxNode->setScale(Vector3(0.1,0.1,0.1));
// EN:: make a rock wall on the floor
// BR:: adiciona piso de pedra no chão
Plane plane(Vector3::UNIT_Y, 0);
MeshManager::getSingleton().createPlane("ground",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
1500,1500,20,20,true,1,5,5,Vector3::UNIT_Z);
ent = mSceneMgr->createEntity("GroundEntity", "ground");
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
ent->setMaterialName("Examples/Rockwall");
ent->setCastShadows(false);
// EN:: make a light to see stuff with
// BR:: adiciona uma iluminação
Light *light = mSceneMgr->createLight("Light1");
light->setType(Light::LT_POINT);
light->setPosition(Vector3(250, 150, 250));
light->setDiffuseColour(ColourValue::White);
light->setSpecularColour(ColourValue::White);
// EN:: Create the scene node
// BR:: cria o SceneNode (nó da cena)
SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode("CamNode1", Vector3(-200, 100, 200));
node->yaw(Degree(-45));
node->attachObject(cam);
}
示例6: createCubeMesh
void Application::createScene()
{
//mSceneMgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager"); In create cameras and viewports
//Camera *cam = mSceneMgr->createCamera("Camera");
//Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
//
Entity *ent;
mSceneMgr->setAmbientLight(ColourValue(0.25, 0.25, 0.25));
mSceneMgr->setShadowTechnique( SHADOWTYPE_STENCIL_ADDITIVE );
// make a cube to bounce around
ManualObject *cmo = createCubeMesh("manual", "");
cmo->convertToMesh("cube");
ent = mSceneMgr->createEntity("Cube", "cube.mesh");
ent->setCastShadows(true);
boxNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
boxNode->attachObject(ent);
boxNode->setScale(Vector3(0.1,0.1,0.1)); // for some reason converttomesh multiplied dimensions by 10
//
//
// make a rock wall on the floor
Plane plane(Vector3::UNIT_Y, 0);
MeshManager::getSingleton().createPlane("ground",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
1500,1500,20,20,true,1,5,5,Vector3::UNIT_Z);
ent = mSceneMgr->createEntity("GroundEntity", "ground");
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
ent->setMaterialName("Examples/Rockwall");
ent->setCastShadows(false);
//
// // make a light to see stuff with
Light *light = mSceneMgr->createLight("Light1");
light->setType(Light::LT_POINT);
light->setPosition(Vector3(250, 150, 250));
light->setDiffuseColour(ColourValue::White);
light->setSpecularColour(ColourValue::White);
//
// // Create the scene node
SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode("CamNode1", Vector3(-200, 100, 200));
node->yaw(Degree(-45));
//node->attachObject(cam);
//node->attachObject(mCamera);
}
示例7: getOctreeGrid
Entity* OctreeNode::getOctreeGrid(SceneManager *sceneManager)
{
if (!mOctreeGrid)
{
mGridPositionCount = 0;
mNodeI++;
ManualObject* manual = sceneManager->createManualObject();
manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST);
manual->colour((Real)1.0, (Real)0.0, (Real)0.0);
buildOctreeGridLines(manual);
manual->end();
StringUtil::StrStreamType meshName;
meshName << "VolumeOctreeGridMesh" << mNodeI;
manual->convertToMesh(meshName.str());
StringUtil::StrStreamType entityName;
entityName << "VolumeOctreeGrid" << mNodeI;
mOctreeGrid = sceneManager->createEntity(entityName.str(), meshName.str());
}
return mOctreeGrid;
}
示例8: CreateRacingLine
void App::CreateRacingLine()
{
//void ROADPATCH::AddRacinglineScenenode(SCENENODE * node, ROADPATCH * nextpatch,
ManualObject* m = mSceneMgr->createManualObject();
m->begin("track/Racingline", RenderOperation::OT_TRIANGLE_LIST);
int ii = 0;
const std::list <ROADSTRIP>& roads = pGame->track.GetRoadList();
for (std::list <ROADSTRIP>::const_iterator it = roads.begin(); it != roads.end(); ++it)
{
const std::list <ROADPATCH>& pats = (*it).GetPatchList();
for (std::list <ROADPATCH>::const_iterator i = pats.begin(); i != pats.end(); ++i)
{
const VERTEXARRAY* a = &((*i).racingline_vertexarray);
if (!a) continue;
int verts = a->vertices.size();
if (verts == 0) continue;
int faces = a->faces.size();
for (int v = 0; v < verts; v += 3)
m->position(a->vertices[v+0], a->vertices[v+2], -a->vertices[v+1]);
for (int f = 0; f < faces; ++f)
m->index(ii + a->faces[f]);
ii += verts/3;
}
}
m->setCastShadows(false);
m->end();
hud->ndLine = mSceneMgr->getRootSceneNode()->createChildSceneNode();
hud->ndLine->attachObject(m);
//ndLine->setVisible(pSet->racingline);
}
示例9: ManualObject
void MeshWithoutIndexDataTests::testCreateLineList()
{
ManualObject* lineList = OGRE_NEW ManualObject("line");
lineList->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST);
lineList->position(0, 50, 0);
lineList->position(50, 100, 0);
lineList->position(50, 50, 0);
lineList->position(100, 100, 0);
lineList->position(0, 50, 0);
lineList->position(50, 50, 0);
lineList->end();
String fileName = "lineList.mesh";
MeshPtr lineListMesh = lineList->convertToMesh(fileName);
OGRE_DELETE lineList;
CPPUNIT_ASSERT(lineListMesh->getNumSubMeshes() == 1);
CPPUNIT_ASSERT(lineListMesh->getSubMesh(0)->indexData->indexCount == 0);
RenderOperation rop;
lineListMesh->getSubMesh(0)->_getRenderOperation(rop);
CPPUNIT_ASSERT(rop.useIndexes == false);
CPPUNIT_ASSERT(lineListMesh->getSubMesh(0)->vertexData->vertexCount == 6);
MeshSerializer meshWriter;
meshWriter.exportMesh(lineListMesh.get(), fileName);
mMeshMgr->remove( fileName );
ResourceGroupManager::getSingleton().addResourceLocation(".", "FileSystem");
MeshPtr loadedLineList = mMeshMgr->load(fileName, "General");
remove(fileName.c_str());
CPPUNIT_ASSERT(loadedLineList->getNumSubMeshes() == 1);
CPPUNIT_ASSERT(loadedLineList->getSubMesh(0)->indexData->indexCount == 0);
loadedLineList->getSubMesh(0)->_getRenderOperation(rop);
CPPUNIT_ASSERT(rop.useIndexes == false);
CPPUNIT_ASSERT(loadedLineList->getSubMesh(0)->vertexData->vertexCount == 6);
mMeshMgr->remove( fileName );
}
示例10: if
// CreatePart mesh
//---------------------------------------------------
void CarModel::CreatePart(SceneNode* ndCar, Vector3 vPofs,
String sCar2, String sCarI, String sMesh, String sEnt,
bool ghost, uint32 visFlags,
AxisAlignedBox* bbox, String stMtr, VERTEXARRAY* var, bool bLogInfo)
{
if (FileExists(sCar2 + sMesh))
{
Entity* ent = mSceneMgr->createEntity(sCarI + sEnt, sDirname + sMesh, sCarI);
if (bbox) *bbox = ent->getBoundingBox();
if (ghost) { ent->setRenderQueueGroup(RQG_CarGhost); ent->setCastShadows(false); }
else if (visFlags == RV_CarGlass) ent->setRenderQueueGroup(RQG_CarGlass);
ndCar->attachObject(ent); ent->setVisibilityFlags(visFlags);
if (bLogInfo) LogMeshInfo(ent, sDirname + sMesh);
}
else
{ ManualObject* mo = pApp->CreateModel(mSceneMgr, stMtr, var, vPofs, false, false, sCarI+sEnt);
if (!mo) return;
if (bbox) *bbox = mo->getBoundingBox();
if (ghost) { mo->setRenderQueueGroup(RQG_CarGhost); mo->setCastShadows(false); }
else if (visFlags == RV_CarGlass) mo->setRenderQueueGroup(RQG_CarGlass);
ndCar->attachObject(mo); mo->setVisibilityFlags(visFlags);
/** /// save .mesh
MeshPtr mpCar = mInter->convertToMesh("Mesh" + sEnt);
MeshSerializer* msr = new MeshSerializer();
msr->exportMesh(mpCar.getPointer(), sDirname + sMesh);/**/
}
}
示例11:
ManualObject *Debugging::createPathgridLines(const ESM::Pathgrid *pathgrid)
{
ManualObject *result = mSceneMgr->createManualObject();
result->begin(PATHGRID_LINE_MATERIAL, RenderOperation::OT_LINE_LIST);
for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->mEdges.begin();
it != pathgrid->mEdges.end();
++it)
{
const ESM::Pathgrid::Edge &edge = *it;
const ESM::Pathgrid::Point &p1 = pathgrid->mPoints[edge.mV0], &p2 = pathgrid->mPoints[edge.mV1];
Vector3 direction = (Vector3(p2.mX, p2.mY, p2.mZ) - Vector3(p1.mX, p1.mY, p1.mZ));
Vector3 lineDisplacement = direction.crossProduct(Vector3::UNIT_Z).normalisedCopy();
lineDisplacement = lineDisplacement * POINT_MESH_BASE +
Vector3(0, 0, 10); // move lines up a little, so they will be less covered by meshes/landscape
result->position(Vector3(p1.mX, p1.mY, p1.mZ) + lineDisplacement);
result->position(Vector3(p2.mX, p2.mY, p2.mZ) + lineDisplacement);
}
result->end();
result->setVisibilityFlags (RV_Debug);
return result;
}
示例12: material_index
//---------------------------------------------------------------------
void
PFile::addGroup( const Group &group, ManualObject &mo
,const String &sub_name, const String &material_base_name
,const Ogre::Bone *bone ) const
{
size_t material_index( 0 );
if( group.has_texture )
{
material_index = group.texture_index + 1;
}
String material_name( material_base_name + "/" + Ogre::StringConverter::toString( material_index ) );
const uint16 bone_handle( bone->getHandle() );
const Ogre::Vector3 bone_position( getPosition( bone ) );
size_t index( 0 );
size_t vertex_count( group.num_polygons * 3 );
size_t index_count( vertex_count );
size_t polygon_end_index( group.polygon_start_index + group.num_polygons );
mo.begin( sub_name, material_name, vertex_count, index_count );
for( size_t p( group.polygon_start_index ); p < polygon_end_index; ++p )
{
const PolygonDefinition& polygon( m_polygon_definitions[p] );
for( int i(3); i--; )
{
uint32 v( group.vertex_start_index
+polygon.vertex[i] )
,n( 0 + polygon.normal[i] )
,t( group.texture_coordinate_start_index
+polygon.vertex[i] );
Ogre::Vector3 pos( m_vertices[ v ] );
mo.position((STATIC_ROTATION * (pos / HRCFile::kDownScaler)) + bone_position);
mo.colour( m_vertex_colors[ v ] );
mo.normal( STATIC_ROTATION * m_normals[ n ] );
if( group.has_texture )
{
mo.textureCoord(m_texture_coordinates[t]);
}
mo.bone( index, bone_handle );
mo.index( index++ );
}
}
mo.end();
}
示例13: createDebugNormals
ManualObject* SnowTerrain::createDebugNormals(Ogre::SceneManager* mSceneMgr)
{
ManualObject* manual = mSceneMgr->createManualObject("NormalsDebug");
float *heights = getTerrainHeightData();
Vector4 *normals = getTerrainNormalData();
manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST);
int terrainSize = getTerrain()->getSize();
int terrainWorldSize = getTerrain()->getWorldSize();
for(int z = 0; z < terrainSize; ++z)
{
for(int x = 0; x < terrainSize; ++x)
{
int i = ((terrainSize)*(terrainSize) ) - (z+1)*terrainSize + (x+1);
Vector3 n = Vector3(normals[i].x, normals[i].y, normals[i].z);
float h = heights[i];
Real factor = (Real)terrainSize - 1.0f;
Real invFactor = 1.0f / factor;
float mScale = terrainWorldSize / (Real)(terrainSize);
Real mBase = -terrainWorldSize * 0.5;
Vector3 mPos = Ogre::Vector3(terrainWorldSize * 0.5, 0, terrainWorldSize * 0.5);
Vector3 worldPos;
worldPos.x = x * mScale + mBase + mPos.x;
worldPos.y = h + mPos.y;
worldPos.z = z * mScale + mBase + mPos.z;
// convert back to "normal map" colors (0/1 float instead of -1/1 float, also rgb=>xzy)
manual->colour((n.x + 1)*0.5, (n.z + 1)*0.5, (n.y + 1)*0.5);
// draw line
manual->position(worldPos);
manual->position(worldPos + 3*n);
//manual->index(i);
//manual->index(1);
}
}
manual->end();
//OGRE_FREE(normals);
return manual;
}
示例14: createProceduralParticleSystem
ProceduralManualObject* createProceduralParticleSystem()
{
particleSystem = static_cast<ProceduralManualObject*>
(mSceneMgr->createMovableObject("ParticleGSEntity", ProceduralManualObjectFactory::FACTORY_TYPE_NAME));
particleSystem->setMaterial("Ogre/ParticleGS/Display");
//Generate the geometry that will seed the particle system
ManualObject* particleSystemSeed = mSceneMgr->createManualObject("ParticleSeed");
//This needs to be the initial launcher particle
particleSystemSeed->begin("Ogre/ParticleGS/Display", RenderOperation::OT_POINT_LIST);
particleSystemSeed->position(0,0,0); //Position
particleSystemSeed->textureCoord(1); //Timer
particleSystemSeed->textureCoord(0); //Type
particleSystemSeed->textureCoord(0,0,0); //Velocity
particleSystemSeed->end();
//Generate the RenderToBufferObject
RenderToVertexBufferSharedPtr r2vbObject =
HardwareBufferManager::getSingleton().createRenderToVertexBuffer();
r2vbObject->setRenderToBufferMaterialName("Ogre/ParticleGS/Generate");
//Apply the random texture
TexturePtr randomTexture = RandomTools::generateRandomVelocityTexture();
r2vbObject->getRenderToBufferMaterial()->getTechnique(0)->getPass(0)->
getTextureUnitState("RandomTexture")->setTextureName(
randomTexture->getName(), randomTexture->getTextureType());
r2vbObject->setOperationType(RenderOperation::OT_POINT_LIST);
r2vbObject->setMaxVertexCount(16000);
r2vbObject->setResetsEveryUpdate(false);
VertexDeclaration* vertexDecl = r2vbObject->getVertexDeclaration();
size_t offset = 0;
offset += vertexDecl->addElement(0, offset, VET_FLOAT3, VES_POSITION).getSize(); //Position
offset += vertexDecl->addElement(0, offset, VET_FLOAT1, VES_TEXTURE_COORDINATES, 0).getSize(); //Timer
offset += vertexDecl->addElement(0, offset, VET_FLOAT1, VES_TEXTURE_COORDINATES, 1).getSize(); //Type
offset += vertexDecl->addElement(0, offset, VET_FLOAT3, VES_TEXTURE_COORDINATES, 2).getSize(); //Velocity
//Bind the two together
particleSystem->setRenderToVertexBuffer(r2vbObject);
particleSystem->setManualObject(particleSystemSeed);
//Set bounds
AxisAlignedBox aabb;
aabb.setMinimum(-100,-100,-100);
aabb.setMaximum(100,100,100);
particleSystem->setBoundingBox(aabb);
return particleSystem;
}
示例15: to_string
void pathDrawerState::dibujaLinea(size_t idFrom, size_t idTo)
{
ManualObject* manual = _sceneMgr->createManualObject("line_" + to_string(idFrom));
manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST);
Vector3 aux(vMarcas[idFrom]._nodoMarca->getPosition());
aux.y = _planeRoadNode->getPosition().y + 1;
manual->position(aux); //start
aux = vMarcas[idTo]._nodoMarca->getPosition();
aux.y = _planeRoadNode->getPosition().y + 1;
manual->position(aux); //end
manual->end();
_sceneMgr->getRootSceneNode()->attachObject(manual);
cout << "nombre entity linea: " << manual->getName() << endl;
}