当前位置: 首页>>代码示例>>C++>>正文


C++ EntityKeyValues类代码示例

本文整理汇总了C++中EntityKeyValues的典型用法代码示例。如果您正苦于以下问题:C++ EntityKeyValues类的具体用法?C++ EntityKeyValues怎么用?C++ EntityKeyValues使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EntityKeyValues类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FailureException

scene::INodePtr Quake3MapReader::createEntity(const EntityKeyValues& keyValues)
{
    // Get the classname from the EntityKeyValues
    EntityKeyValues::const_iterator found = keyValues.find("classname");

    if (found == keyValues.end())
	{
		throw FailureException("Quake3MapReader::createEntity(): could not find classname.");
    }

    // Otherwise create the entity and add all of the properties
    std::string className = found->second;
	IEntityClassPtr classPtr = GlobalEntityClassManager().findClass(className);

	if (classPtr == NULL)
	{
		rError() << "[mapdoom3]: Could not find entity class: "
			<< className << std::endl;

		// greebo: EntityClass not found, insert a brush-based one
		classPtr = GlobalEntityClassManager().findOrInsert(className, true);
	}

	// Create the actual entity node
    IEntityNodePtr node(GlobalEntityCreator().createEntity(classPtr));

    for (EntityKeyValues::const_iterator i = keyValues.begin();
         i != keyValues.end();
         ++i)
    {
        node->getEntity().setKeyValue(i->first, i->second);
    }

    return node;
}
开发者ID:OpenTechEngine,项目名称:DarkRadiant,代码行数:35,代码来源:Quake3MapReader.cpp

示例2: while

void Quake3MapReader::parseEntity(parser::DefTokeniser& tok)
{
    // Map of keyvalues for this entity
    EntityKeyValues keyValues;

    // The actual entity. This is initially null, and will be created when
    // primitives start or the end of the entity is reached
    scene::INodePtr entity;

	// Start parsing, first token must be an open brace
	tok.assertNextToken("{");

	std::string token = tok.nextToken();

	// Reset the primitive counter, we're starting a new entity
	_primitiveCount = 0;

	while (true)
	{
	    // Token must be either a key, a "{" to indicate the start of a
	    // primitive, or a "}" to indicate the end of the entity

	    if (token == "{") // PRIMITIVE
		{ 
			// Create the entity right now, if not yet done
			if (entity == NULL)
			{
				entity = createEntity(keyValues);
			}

			// Parse the primitive block, and pass the parent entity
			parsePrimitive(tok, entity);
	    }
	    else if (token == "}") // END OF ENTITY
		{
            // Create the entity if necessary and return it
	        if (entity == NULL)
			{
	            entity = createEntity(keyValues);
	        }

			break;
	    }
	    else // KEY
		{ 
	        std::string value = tok.nextToken();

	        // Sanity check (invalid number of tokens will get us out of sync)
	        if (value == "{" || value == "}")
			{
				std::string text = (boost::format(_("Parsed invalid value '%s' for key '%s'")) % value % token).str();
	            throw FailureException(text);
	        }

	        // Otherwise add the keyvalue pair to our map
	        keyValues.insert(EntityKeyValues::value_type(token, value));
	    }

	    // Get the next token
	    token = tok.nextToken();
	}

	// Insert the entity
	_importFilter.addEntity(entity);
}
开发者ID:OpenTechEngine,项目名称:DarkRadiant,代码行数:65,代码来源:Quake3MapReader.cpp

示例3: instanceDetach

		void instanceDetach (const scene::Path& path)
		{
			if (--m_instanceCounter.m_count == 0) {
				m_entity.detach(m_keyObservers);
				m_entity.instanceDetach(path_find_mapfile(path.begin(), path.end()));
			}
		}
开发者ID:MyWifeRules,项目名称:ufoai-1,代码行数:7,代码来源:miscmodel.cpp

示例4: instanceAttach

		void instanceAttach (const scene::Path& path)
		{
			if (++m_instanceCounter.m_count == 1) {
				m_entity.instanceAttach(path_find_mapfile(path.begin(), path.end()));
				m_traverse.instanceAttach(path_find_mapfile(path.begin(), path.end()));
				m_entity.attach(m_keyObservers);
			}
		}
开发者ID:chrisglass,项目名称:ufoai,代码行数:8,代码来源:group.cpp

示例5: renderSolid

		void renderSolid (Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected) const
		{
			if (selected) {
				m_renderOrigin.render(renderer, volume, localToWorld);
			}

			ASSERT_NOTNULL(m_entity.getEntityClass().m_state_wire);
			renderer.SetState(m_entity.getEntityClass().m_state_wire, Renderer::eWireframeOnly);
		}
开发者ID:MyWifeRules,项目名称:ufoai-1,代码行数:9,代码来源:miscmodel.cpp

示例6: renderSolid

		void renderSolid (Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld) const
		{
			renderer.SetState(m_entity.getEntityClass().m_state_fill, Renderer::eFullMaterials);
			if (m_particle == NULL || !m_particle->getImage().empty())
				renderer.addRenderable(m_renderParticle, localToWorld);
			else
				renderer.addRenderable(m_renderAABBSolid, localToWorld);
		}
开发者ID:chrisglass,项目名称:ufoai,代码行数:8,代码来源:miscparticle.cpp

示例7: construct

		void construct ()
		{
			read_aabb(m_aabb_local, m_entity.getEntityClass());

			m_keyObservers.insert("targetname", NamedEntity::IdentifierChangedCaller(m_named));
			m_keyObservers.insert("origin", OriginKey::OriginChangedCaller(m_originKey));
			m_keyObservers.insert("particle", ParticleChangedCaller(*this));
		}
开发者ID:chrisglass,项目名称:ufoai,代码行数:8,代码来源:miscparticle.cpp

示例8: renderWireframe

		void renderWireframe (Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld) const
		{
			renderer.SetState(m_entity.getEntityClass().m_state_wire, Renderer::eWireframeOnly);
			renderer.addRenderable(m_renderAABBWire, localToWorld);
			renderArrow(renderer, volume, localToWorld);
			if (GlobalRegistry().get("user/ui/xyview/showEntityNames") == "1") {
				renderer.addRenderable(m_renderName, localToWorld);
			}
		}
开发者ID:MyWifeRules,项目名称:ufoai-1,代码行数:9,代码来源:miscsound.cpp

示例9: renderWireframe

 void renderWireframe(Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld) const
 {
   renderer.SetState(m_entity.getEntityClass().m_state_wire, Renderer::eWireframeOnly);
   renderer.addRenderable(m_aabb_wire, localToWorld);
   renderArrow(renderer, volume, localToWorld);
   if(g_showNames)
   {
     renderer.addRenderable(m_renderName, localToWorld);
   }
 }
开发者ID:clbr,项目名称:netradiant,代码行数:10,代码来源:generic.cpp

示例10: construct

  void construct()
  {
    read_aabb(m_aabb_local, m_entity.getEntityClass());

    m_keyObservers.insert("classname", ClassnameFilter::ClassnameChangedCaller(m_filter));
    m_keyObservers.insert(Static<KeyIsName>::instance().m_nameKey, NamedEntity::IdentifierChangedCaller(m_named));
    m_keyObservers.insert("angle", AnglesKey::AngleChangedCaller(m_anglesKey));
    m_keyObservers.insert("angles", AnglesKey::AnglesChangedCaller(m_anglesKey));
    m_keyObservers.insert("origin", OriginKey::OriginChangedCaller(m_originKey));
  }
开发者ID:clbr,项目名称:netradiant,代码行数:10,代码来源:generic.cpp

示例11: renderSolid

		void renderSolid (Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected) const
		{
			renderer.SetState(m_entity.getEntityClass().m_state_wire, Renderer::eWireframeOnly);
			renderer.SetState(m_colour.state(), Renderer::eFullMaterials);
			renderer.addRenderable(*this, localToWorld);

			if ((entity::EntitySettings::Instance().showAllLightRadii() || (selected
					&& entity::EntitySettings::Instance().showSelectedLightRadii()))
					&& m_entity.getKeyValue("target").empty()) {
				if (renderer.getStyle() == Renderer::eFullMaterials) {
					renderer.SetState(RenderLightRadiiFill::m_state, Renderer::eFullMaterials);
					renderer.Highlight(Renderer::ePrimitive, false);
					renderer.addRenderable(m_radii_fill, localToWorld);
				} else {
					renderer.addRenderable(m_radii_wire, localToWorld);
				}
			}

			renderer.SetState(m_entity.getEntityClass().m_state_wire, Renderer::eFullMaterials);
		}
开发者ID:MyWifeRules,项目名称:ufoai-1,代码行数:20,代码来源:light.cpp

示例12: instanceDetach

  void instanceDetach(const scene::Path& path)
  {
    if(--m_instanceCounter.m_count == 0)
    {
      m_funcStaticOrigin.disable();

      m_traverse.instanceDetach(path_find_mapfile(path.begin(), path.end()));
      m_entity.instanceDetach(path_find_mapfile(path.begin(), path.end()));
      m_filter.instanceDetach();
    }
  }
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:11,代码来源:doom3group.cpp

示例13: construct

		void construct ()
		{
			read_aabb(m_aabb_local, m_entity.getEntityClass());
			m_ray.origin = m_aabb_local.origin;
			m_ray.direction[0] = 1;
			m_ray.direction[1] = 0;
			m_ray.direction[2] = 0;

			m_keyObservers.insert("targetname", NamedEntity::IdentifierChangedCaller(m_named));
			m_keyObservers.insert("angle", AngleKey::AngleChangedCaller(m_angleKey));
			m_keyObservers.insert("origin", OriginKey::OriginChangedCaller(m_originKey));
		}
开发者ID:MyWifeRules,项目名称:ufoai-1,代码行数:12,代码来源:miscsound.cpp

示例14: destroy

  void destroy()
  {
    m_entity.detach(m_keyObservers);

    if(isModel())
    {
      detachModel();
    }
    else
    {
      detachTraverse();
    }

    m_traverseObservers.detach(m_funcStaticOrigin);
  }
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:15,代码来源:doom3group.cpp

示例15: renderWireframe

		void renderWireframe (Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld,
				const AABB& childBounds) const
		{
			renderSolid(renderer, volume, localToWorld);

			if (GlobalRegistry().get("user/ui/xyview/showEntityNames") == "1") {
				// don't draw the name for worldspawn
				if (m_entity.getEntityClass().name() == "worldspawn")
					return;

				// place name in the middle of the "children cloud"
				m_name_origin = childBounds.origin;

				renderer.addRenderable(m_renderName, localToWorld);
			}
		}
开发者ID:chrisglass,项目名称:ufoai,代码行数:16,代码来源:group.cpp


注:本文中的EntityKeyValues类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。