本文整理汇总了C++中TLeafList类的典型用法代码示例。如果您正苦于以下问题:C++ TLeafList类的具体用法?C++ TLeafList怎么用?C++ TLeafList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TLeafList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PreviousCamera
void RenderServer::PreviousCamera()
{
TLeafList cameras;
mActiveScene->GetChildrenOfClass("Camera", cameras, true);
for (TLeafList::iterator iter = cameras.begin(); iter != cameras.end(); ++iter)
if (*iter == mCamera)
{
mCamera = iter != cameras.begin() ? static_pointer_cast<Camera>(*(--iter)) : static_pointer_cast<Camera>(cameras.back());
break;
}
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:11,代码来源:renderserver.cpp
示例2:
void
MaterialServer::ExportMaterial(boost::shared_ptr<Material> material)
{
TLeafList exporters;
ListChildrenSupportingClass<MaterialExporter>(exporters);
for (TLeafList::const_iterator bi = exporters.begin(); bi != exporters.end(); ++bi)
{
boost::shared_ptr<MaterialExporter> mb = static_pointer_cast<MaterialExporter>(*bi);
mb->RegisterMaterial(material);
}
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:12,代码来源:materialserver.cpp
示例3: NextCamera
void RenderServer::NextCamera()
{
TLeafList cameras;
mActiveScene->GetChildrenOfClass("Camera", cameras, true);
for (TLeafList::iterator iter = cameras.begin(); iter != cameras.end(); ++iter)
if (*iter == mCamera)
{
++iter;
mCamera = iter != cameras.end() ? shared_static_cast<Camera>(*iter) : shared_static_cast<Camera>(cameras.front());
break;
}
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:12,代码来源:renderserver.cpp
示例4: GetChildren
void Leaf::GetChildren(const std::string &name, TLeafList &baseList, bool /*recursive*/)
{
if (name.compare("..") == 0)
{
baseList.push_back(GetParent().lock());
}
if (name.compare(".") == 0)
{
baseList.push_back(static_pointer_cast<Leaf>(GetSelf().lock()));
}
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:12,代码来源:leaf.cpp
示例5: GetLog
void
MaterialServer::ExportAllMaterial()
{
GetLog()->Debug() << "(MaterialServer) ExportAllMaterial\n";
TLeafList materials;
ListChildrenSupportingClass<Material>(materials);
for (TLeafList::const_iterator mi = materials.begin(); mi != materials.end(); ++mi)
{
boost::shared_ptr<Material> m = static_pointer_cast<Material>(*mi);
ExportMaterial(m);
}
GetLog()->Debug() << "(MaterialServer) ExportAllMaterial done\n";
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:14,代码来源:materialserver.cpp
示例6: DescribeNode
void SparkMonitor::DescribeScene(stringstream& ss, boost::shared_ptr<BaseNode> node)
{
bool closeParen = DescribeNode(ss, node);
TLeafList baseNodes = node->GetBaseNodeChildren();
for (TLeafList::iterator i = baseNodes.begin(); i!= baseNodes.end(); ++i)
{
boost::shared_ptr<BaseNode> baseNode = dynamic_pointer_cast<BaseNode>(*i);
DescribeScene(ss,baseNode);
}
if (closeParen)
{
ss << ")";
}
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:16,代码来源:sparkmonitor.cpp
示例7:
void
RenderControl::RenderCustom()
{
// get list of registered CustomMonitor objects
TLeafList customList;
ListChildrenSupportingClass<CustomRender>(customList);
for (
TLeafList::iterator iter = customList.begin();
iter != customList.end();
++iter
)
{
shared_static_cast<CustomRender>((*iter))->Render();
}
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:16,代码来源:rendercontrol.cpp
示例8: ParseMonitorMessage
void SparkMonitor::ParseMonitorMessage(const std::string& data)
{
// pass the received string on to all installed CommandParsers
TLeafList items;
ListChildrenSupportingClass<MonitorCmdParser>(items);
for (
TLeafList::iterator iter = items.begin();
iter != items.end();
++iter
)
{
static_pointer_cast<MonitorCmdParser>(*iter)
->ParseMonitorMessage(data);
}
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:16,代码来源:sparkmonitor.cpp
示例9: GetLog
void
RestrictedVisionPerceptor::SetupLines(TLineList& visibleLines)
{
TLeafList lineList;
mActiveScene->GetChildrenOfClass("Line", lineList, true);
// determine position relative to the local reference frame
const Matrix& mat = mTransformParent->GetWorldTransform();
// get the transformation matrix describing the current orientation
Vector3f myPos = mat.Pos();
if (mAddNoise)
{
myPos -= mError;
}
for (TLeafList::iterator i = lineList.begin(); i != lineList.end(); ++i)
{
LineData ld;
ld.mLine = static_pointer_cast<Line > (*i);
if (ld.mLine.get() == 0)
{
GetLog()->Error() << "Error: (RestrictedVisionPerceptor) skipped line: "
<< (*i)->GetName() << "\n";
continue; // this should never happen
}
boost::shared_ptr<Transform> j = ld.mLine->GetTransformParent();
if (j.get() == 0)
{
GetLog()->Error() << "Error: (RestrictedVisionPerceptor) skipped line (2): "
<< (*i)->GetName() << "\n";
continue; // this should never happen
}
const salt::Matrix& t = j->GetWorldTransform();
ld.mBeginPoint.mRelPos = mat.InverseRotate( t * ld.mLine->BeginPoint() - myPos );
ld.mEndPoint.mRelPos = mat.InverseRotate( t * ld.mLine->EndPoint() - myPos );
visibleLines.push_back(ld);
}
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:46,代码来源:restrictedvisionperceptor.cpp
示例10: while
void SparkMonitorLogFileServer::ParseCustomPredicates(sexp_t* sexp)
{
// ( (name param1 param2 ...) (name param1 param2 ...) ... )
if (sexp == 0)
{
return;
}
// get list of registered CustomMonitor objects
TLeafList customList;
ListChildrenSupportingClass<CustomMonitor>(customList);
customList.push_back(GetCore()->Get("/sys/server/simulation/SparkMonitorClient/SoccerMonitor"));
if (customList.empty())
{
return;
}
// parse predicates
PredicateList pList;
sexp = sexp->list;
while (sexp != 0)
{
if (sexp->ty == SEXP_LIST)
{
sexp_t* sPred = sexp->list;
ParseCustomPredicates(sPred,pList);
}
sexp = sexp->next;
}
// pass predicates to all registered CustomMonitor objects
for (
TLeafList::iterator iter = customList.begin();
iter != customList.end();
++iter
)
{
static_pointer_cast<CustomMonitor>((*iter))
->ParseCustomPredicates(pList);
}
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:44,代码来源:sparkmonitorlogfileserver.cpp
示例11: while
void SparkMonitorClient::ParseCustomPredicates(sexp_t* sexp)
{
// ( (name param1 param2 ...) (name param1 param2 ...) ... )
if (sexp == 0)
{
return;
}
// get list of registered CustomMonitor objects
TLeafList customList;
ListChildrenSupportingClass<CustomMonitor>(customList);
if (customList.empty())
{
return;
}
// parse predicates
PredicateList pList;
sexp = sexp->list;
while (sexp != 0)
{
if (sexp->ty == SEXP_LIST)
{
sexp_t* sPred = sexp->list;
ParseCustomPredicates(sPred,pList);
}
sexp = sexp->next;
}
// pass predicates to all registered CustomMonitor objects
for (
TLeafList::iterator iter = customList.begin();
iter != customList.end();
++iter
)
{
shared_static_cast<CustomMonitor>((*iter))
->ParseCustomPredicates(pList);
}
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:43,代码来源:sparkmonitorclient.cpp
示例12: GetScene
void Space::DestroySpaceObjects()
{
boost::shared_ptr<Scene> scene = GetScene();
if (scene.get() == 0)
{
return;
}
TLeafList objects;
const bool recursive = true;
scene->ListChildrenSupportingClass<PhysicsObject>(objects, recursive);
bool globalSpace = IsGlobalSpace();
shared_ptr<Space> self = shared_static_cast<Space>(GetSelf().lock());
for (
TLeafList::iterator iter = objects.begin();
iter != objects.end();
++iter
)
{
shared_ptr<PhysicsObject> object = shared_static_cast<PhysicsObject>(*iter);
if (object == self)
{
continue;
}
// destroy objects registered to this space; the top level
// space object also destroy any other ODE object
const long parentSpace = object->GetParentSpaceID();
if (
(
(globalSpace) &&
(parentSpace == 0)
) ||
(parentSpace == mSpaceID)
)
{
object->DestroyPhysicsObject();
}
}
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:43,代码来源:space.cpp
示例13:
void
AgentAspect::UpdateEffectorMap()
{
// build list of effectors, searching recursively
TLeafList effectors;
ListChildrenSupportingClass<Effector>(effectors,true);
// build the effector map
mEffectorMap.clear();
for (
TLeafList::iterator iter = effectors.begin();
iter != effectors.end();
++iter
)
{
boost::shared_ptr<Effector> effector = static_pointer_cast<Effector>(*iter);
mEffectorMap[effector->GetPredicate()] = effector;
}
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:20,代码来源:agentaspect.cpp
示例14: GetLog
void
GeometryServer::RegisterMesh(boost::shared_ptr<TriMesh> mesh)
{
if (mesh.get() == 0)
{
GetLog()->Debug()
<< "(GeometryServer) RegisterMesh called with NULL mesh\n";
return;
}
std::string name = mesh->GetName();
if (name.empty())
{
GetLog()->Error()
<< "(GeometryServer) Cannot register a mesh without a name\n";
return;
}
TMeshMap::const_iterator iter = mMeshMap.find(name);
if (iter != mMeshMap.end())
{
GetLog()->Debug() << "(GeometryServer) replacing mesh " << name << "\n";
}
mMeshMap[name] = mesh;
GetLog()->Debug() << "(GeometryServer) mesh " << name << " registered\n";
TLeafList exporters;
ListChildrenSupportingClass<MeshExporter>(exporters);
for (TLeafList::const_iterator bi = exporters.begin(); bi != exporters.end(); ++bi)
{
GetLog()->Debug() << "(GeometryServer) additionally registered mesh "
<< name << " via MeshExporter '" << (*bi)->GetName() << "'\n";
boost::shared_ptr<MeshExporter> mb = static_pointer_cast<MeshExporter>(*bi);
mb->RegisterMesh(mesh);
}
}
开发者ID:unfabio,项目名称:furosimspark,代码行数:38,代码来源:geometryserver.cpp
示例15: predList
shared_ptr<PredicateList>
AgentAspect::QueryPerceptors()
{
mPerceptorCycle++;
// build list of perceptors, searching recursively
TLeafList perceptors;
ListChildrenSupportingClass<Perceptor>(perceptors,true);
shared_ptr<PredicateList> predList(new PredicateList());
// query the perceptors for new data
for (
TLeafList::iterator iter = perceptors.begin();
iter != perceptors.end();
++iter
)
{
shared_ptr<Perceptor> pct = shared_static_cast<Perceptor>(*iter);
if ( mPerceptorCycle % pct->GetInterval() == 0 )
pct->Percept(predList);
}
return predList;
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:24,代码来源:agentaspect.cpp
示例16:
void
Node::GetChildren(const std::string& name, TLeafList& baseList, bool recursive)
{
Leaf::GetChildren(name, baseList, recursive);
for (TLeafList::iterator i = mChildren.begin(); i != mChildren.end(); ++i)
{
// check if we have found a match and add it
if ((*i)->GetName().compare(name) == 0)
{
baseList.push_back(*i);
}
if (recursive)
(*i)->GetChildren(name, baseList, recursive);
}
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:17,代码来源:node.cpp
示例17: return
boost::shared_ptr<TriMesh>
GeometryServer::GetMesh(const string& name, const::ParameterList& parameter)
{
// try a direct match
string meshName = name;
TMeshMap::const_iterator meshIter = mMeshMap.find(meshName);
if (meshIter != mMeshMap.end())
{
return (*meshIter).second;
}
TLeafList importer;
ListChildrenSupportingClass<MeshImporter>(importer);
if (importer.size() == 0)
{
GetLog()->Error()
<< "(GeometryServer) Warning: no MeshImporter registered\n";
return boost::shared_ptr<TriMesh>();
}
// try to mangle the name
for (
TLeafList::iterator iter = importer.begin();
iter != importer.end();
++iter
)
{
boost::shared_ptr<MeshImporter> importer =
static_pointer_cast<MeshImporter>(*iter);
string str = importer->MangleName(name, parameter);
if (str != meshName)
{
meshName = str;
meshIter = mMeshMap.find(meshName);
if (meshIter != mMeshMap.end())
{
return (*meshIter).second;
}
}
}
// try to import the mesh
for (
TLeafList::iterator iter = importer.begin();
iter != importer.end();
++iter
)
{
boost::shared_ptr<MeshImporter> importer =
static_pointer_cast<MeshImporter>(*iter);
boost::shared_ptr<TriMesh> mesh = importer->ImportMesh(name,parameter);
if (mesh.get() == 0)
{
continue;
}
string meshName = mesh->GetName();
if (meshName.empty())
{
meshName = name;
mesh->SetName(name);
}
GetLog()->Debug() << "(GeometryServer) imported mesh '" << meshName
<< " with '" << importer->GetName() << "'\n";
if (mesh.get() == 0 || mesh->GetVertexCount() == 0)
{
continue;
}
RegisterMesh(mesh);
return mesh;
}
GetLog()->Error() << "(GeometryServer) ERROR: cannot import mesh '"
<< name << "'\n";
return boost::shared_ptr<TriMesh>();
}
开发者ID:unfabio,项目名称:furosimspark,代码行数:88,代码来源:geometryserver.cpp
示例18: GetLog
bool SceneServer::ImportScene(const string& fileName, boost::shared_ptr<BaseNode> root,
boost::shared_ptr<ParameterList> parameter)
{
string file;
if (! GetFile()->LocateResource(fileName, file))
{
GetLog()->Error() << "(SceneServer) ERROR: cannot locate file '"
<< fileName << "'\n";
return false;
}
if (root.get() == 0)
{
GetLog()->Error()
<< "(SceneServer) ERROR: NULL node given as ImportScene "
<< "root node, fileName was " << fileName << "\n";
}
GetLog()->Debug() << "(SceneServer) ImportScene fileName=" << fileName
<< " root=" << root->GetFullPath() << "\n";
TLeafList importer;
ListChildrenSupportingClass<SceneImporter>(importer);
if (importer.empty())
{
GetLog()->Error()
<< "(SceneServer) Warning: no SceneImporter registered\n";
}
// because the importer will create ODE objects,
// so we have to lock the ODE
boost::recursive_mutex::scoped_lock lock(mMutex);
for (
TLeafList::iterator iter = importer.begin();
iter != importer.end();
++iter
)
{
boost::shared_ptr<SceneImporter> importer =
shared_static_cast<SceneImporter>(*iter);
importer->SetSceneDict(&SceneDict::GetInstance());
GetLog()->Debug()
<< "(SceneServer) trying importer " << importer->GetName() << std::endl;
if (importer->ImportScene(file,root,parameter))
{
GetLog()->Debug()
<< "(SceneServer) imported scene file '"
<< file << " with '"
<< importer->GetName()
<< " at " << root->GetFullPath() << endl;
RemoveTransformPaths(root);
// mark the corresponding scene as modified
boost::shared_ptr<Scene> scene = root->GetScene();
if (scene.get() != 0)
{
scene->SetModified(true);
}
return true;
}
}
GetLog()->Error() << "(SceneServer) ERROR: cannot import scene file '"
<< file << "'\n";
return false;
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:75,代码来源:sceneserver.cpp
示例19: glGetError
void
RenderServer::Render(bool clean)
{
int err = glGetError();
if (err) GetLog()->Error() << "OpenGLError before picking preparation: " << err << std::endl;
PreparePicking();
err = glGetError();
if (err) GetLog()->Error() << "OpenGLError after picking preparation: " << err << std::endl;
if (! GetActiveScene())
{
return;
}
// if no camera is selected yet, select the first one
if (mCamera.get() == 0)
mCamera = static_pointer_cast<Camera>(mActiveScene->GetChildOfClass("Camera", true));
if (mCamera.get() == 0)
{
GetLog()->Error()
<< "(RenderServer) ERROR: found no camera node in the active scene\n";
return;
}
err = glGetError();
if (err) GetLog()->Error() << "OpenGLError before binding camera: " << err << std::endl;
// set the view transformation
BindCamera(mCamera);
err = glGetError();
if (err) GetLog()->Error() << "OpenGLError after binding camera: " << err << std::endl;
glClearColor(
mAmbientColor.r(),
mAmbientColor.g(),
mAmbientColor.b(),
mAmbientColor.a()
);
if (clean)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
else
{
glClear(GL_DEPTH_BUFFER_BIT);
}
glColor3f(1, 1, 1);
// actual rendering
// ambient pass
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glAlphaFunc(GL_GREATER, 0.1);
glEnable(GL_ALPHA_TEST);
TLeafList lights;
mActiveScene->ListChildrenSupportingClass<Light>(lights,true);
if (lights.size() == 0)
{
// no lights in the scene, disable lighting
glDisable(GL_LIGHTING);
}
else
{
glEnable(GL_LIGHTING);
glShadeModel (GL_SMOOTH);
// prepare all lights
for (
TLeafList::iterator iter = lights.begin();
iter != lights.end();
++iter
)
{
(static_pointer_cast<Light>(*iter))->Prepare();
}
}
err = glGetError();
if (err) GetLog()->Error() << "OpenGLError before render pass 0: " << err << std::endl;
// standard rendering
RenderScene(mActiveScene, 0);
err = glGetError();
if (err) GetLog()->Error() << "OpenGLError after render pass 0: " << err << std::endl;
RenderScene(mActiveScene, 1);
err = glGetError();
if (err) GetLog()->Error() << "OpenGLError after render pass 1: " << err << std::endl;
//.........这里部分代码省略.........
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:101,代码来源:renderserver.cpp
示例20: ProcessInput
void SoccerInput::ProcessInput(const Input& input)
{
// get list of registered SoccerMonitor objects
TLeafList soccerMonitorList;
mMonitorClient->ListChildrenSupportingClass<SoccerMonitor>(soccerMonitorList);
if (soccerMonitorList.empty())
{
GetLog()->Error()
<< "ERROR: (SoccerInput) Unable to get SoccerMonitor\n";
return;
}
shared_ptr<SoccerMonitor> soccerMonitor =
shared_static_cast<SoccerMonitor>(soccerMonitorList.front());
switch (input.mId)
{
default:
return;
case CmdKickOff:
if (input.GetKeyPress())
{
SendCommand("(kickOff Left)");
}
break;
case CmdKickOffRight:
if (input.GetKeyPress())
{
SendCommand("(kickOff Right)");
}
break;
case CmdMoveAgent:
if (input.GetKeyPress())
{
//SendCommand("(agent (team Left)(unum 1)(pos -2.0 1.0 3.5))");
}
break;
case CmdDropBall:
if (input.GetKeyPress())
{
SendCommand("(dropBall)");
}
break;
case CmdShootBall:
if (input.GetKeyPress())
{
//SendCommand("(ball (vel -4.0 0.0 2.0))");
}
break;
case CmdMoveBall:
if (input.GetKeyPress())
{
//SendCommand("(ball (pos -42.0 0.0 0.3))");
}
break;
case CmdCameraLeftGoal:
if (input.GetKeyPress())
{
salt::Vector2f fieldSize = soccerMonitor->GetFieldSize();
salt::Vector3f pos(-fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(90);
mFPS->SetVAngleDeg(35);
}
break;
case CmdCameraLeftCorner:
if (input.GetKeyPress())
{
salt::Vector2f fieldSize = soccerMonitor->GetFieldSize();
salt::Vector3f pos(-fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(50);
mFPS->SetVAngleDeg(30);
}
break;
case CmdCameraMiddleLeft:
if (input.GetKeyPress())
{
salt::Vector2f fieldSize = soccerMonitor->GetFieldSize();
salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(salt::gRadToDeg(-0.625));
mFPS->SetVAngleDeg(40);
}
break;
case CmdCameraMiddleRight:
if (input.GetKeyPress())
{
salt::Vector2f fieldSize = soccerMonitor->GetFieldSize();
salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(salt::gRadToDeg(0.625));
mFPS->SetVAngleDeg(40);
}
break;
case CmdCameraMiddle:
if (input.GetKeyPress())
//.........这里部分代码省略.........
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:101,代码来源:soccerinput.cpp
注:本文中的TLeafList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论