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


C++ Renderable类代码示例

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


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

示例1:

RenderableIterator& RenderableIterator::erase( RenderableIterator& item_to_remove )
{
	Renderable* pValueToErase = *item_to_remove;

	RenderLayers::iterator layerElements = theWorld.GetLayers().find( pValueToErase->GetLayer() );
	if (layerElements != theWorld.GetLayers().end())
	{
		RenderList::iterator element = (*layerElements).second.begin();

		while ( element != (*layerElements).second.end() )
		{
			if ( *element == pValueToErase)
			{					
				_myIterator = (*layerElements).second.erase(element);

				// Have to force to next layer.
				// Let our ++ operator do it's magic.
				if ( _myIterator == (*layerElements).second.end() )
				{
					++item_to_remove;
				}
				else
				{
					_ptr = *_myIterator;
				}

				return *this;
			}
			++element;
		}
	}
	return *this;
}
开发者ID:Gi133,项目名称:NetworkingCoursework,代码行数:33,代码来源:RenderableIterator.cpp

示例2: Renderable

Renderable* Renderable::Lines(const std::vector<Vec3f> &verts, Material *material) {
    Renderable *renderable;
    float *vertexBuffer;
    unsigned int *indexBuffer;
    unsigned int size;
    unsigned int i;

    size = (unsigned int)verts.size();

    renderable = new Renderable();

    vertexBuffer = new float[size * 3];
    indexBuffer = new unsigned int[size];

    for(i=0; i < size; i++) {
        vertexBuffer[3*i  ] = verts[i].x;
        vertexBuffer[3*i+1] = verts[i].y;
        vertexBuffer[3*i+2] = verts[i].z;

        indexBuffer[i] = i;
    }
    
    renderable->setMaterial(material);
    renderable->setAttribBuffer("position", size, GL_FLOAT, 3, &vertexBuffer[0]);
    renderable->setIndexBuffer(size, &indexBuffer[0]);
    renderable->setDrawMode(GL_LINE_STRIP);

    delete vertexBuffer;
    delete indexBuffer;

    return renderable;
}
开发者ID:datalurkur,项目名称:Ghastly,代码行数:32,代码来源:Renderable.cpp

示例3: LOGME_CALL

void Level::loadExit(MvUint tileX, MvUint tileY)
{
    LOGME_CALL("Level::loadExit");
    LOGME_DEBUG("Exit at %d, %d", tileX, tileY);

    auto e = mEcsContext.e();
    auto c = mEcsContext.c();
    EngineContext& ctx = mEngineContext;

    MvAnimation::Ptr aSpawn(new MvAnimation(RepeatMode::Loop));

    for (int i = 0; i < 3; ++i) {
        StaticDrawable::Ptr ptr(new StaticDrawable(ctx, Tex::Blob, BlueSpawn[i]));
        aSpawn->addDrawable(std::move(ptr));
        aSpawn->addFrame(i, sf::milliseconds(240));
    }

    Entity eSpawn = createEntity();
    CrawlComponents& cSpawn = c->attach<Transform, Renderable, Sensor>(eSpawn);

    Renderable* cRenderable = cSpawn.get<Renderable>();
    Sensor*     cSensor     = cSpawn.get<Sensor>();
    Transform*  cTransform  = cSpawn.get<Transform>();

    cRenderable->setLayer(def::layer::BackgroundNear);
    cRenderable->setDrawable(std::move(aSpawn));
    cTransform->setPosition(tileX * TW, tileY * TH);
    cSensor->setShapeCircle(2.f, sf::Vector2f(tileX * TW, tileY * TH));
    cSensor->setCollisionCategory(Collision::World);
    cSensor->setCollisionWith(Collision::Player);
    cSensor->setCategory(Category::ExitSensor);

    mEcsContext.s()->get<PhysicsSystem>()->initialize(eSpawn);
}
开发者ID:silentlamb,项目名称:ld33-entry,代码行数:34,代码来源:Level.cpp

示例4: renderImpl

bool PointCloudRenderer::renderImpl(SoSeparator *ivRoot, Renderable &renderable)
{
    //Being here without a point cloud is a bug.
    assert(renderable.has_pointcloud() || renderable.has_pointcloud2());

    //Create the node subtree of the renderable if necessary.
    if(!ivRoot->getNumChildren())
    {
        createNodes(ivRoot, renderable);
    }
    setScale(ivRoot, renderable);
    //Get the nodes to insert the point data into.
    SoMaterial * mat = static_cast<SoMaterial *>(ivRoot->getChild(3));
    SoCoordinate3 * coord =
            static_cast<SoCoordinate3 *>(ivRoot->getChild(2));

    //Read the point data into Inventor structures.
    std::vector<SbVec3f> points;
    std::vector<SbColor> colors;
    int point_size = fillPointList(renderable, points,colors);
    //If points were parsed or the input meant to send no points,
    //set the new point cloud points and colors.
    if(points.size() || !point_size)
    {
        //Insert the inventor structures in to the
        coord->point.setValues(0,points.size(), &points[0]);
        mat->diffuseColor.setValues(0,colors.size(), &colors[0]);
    }
    return points.size() > 0;
}
开发者ID:CURG,项目名称:graspit_bci,代码行数:30,代码来源:RenderableProtoDrawer.cpp

示例5: setTarget

void RenderablePlaneProjection::setTarget(std::string body) {

	if (body == "")
		return;

	std::vector<SceneGraphNode*> nodes = OsEng.renderEngine().scene()->allSceneGraphNodes();
	Renderable* possibleTarget;
	bool hasBody, found = false;
	std::string targetBody;

	for (auto node : nodes)
	{
		possibleTarget = node->renderable();
		if (possibleTarget != nullptr) {
			hasBody = possibleTarget->hasBody();
			if (hasBody && possibleTarget->getBody(targetBody) && (targetBody == body)) {
				_target.node = node->name(); // get name from propertyOwner
				found = true;
				break;
			}
		}
	}
	if (found) {
		_target.body = body;
		_target.frame = openspace::SpiceManager::ref().frameFromBody(body);
	}
}
开发者ID:EricMyers47,项目名称:OpenSpace,代码行数:27,代码来源:renderableplaneprojection.cpp

示例6: ss

void Level::ReadTee(char* tee)
{
  std::stringstream ss(tee);
  
  glm::vec3 pos;
  unsigned int tileid;

  ss >> tileid >> pos.x >> pos.y >> pos.z;

  _tee = new Tee;
  _tee->Initialize();
  _tee->SetTile(tileid - 1);

  // Load Renderable for circle
  // Scale appropriately
  // Position according to the stringstream
  Renderable *r = new Renderable;
  r->Initialize();
  Renderable::Color(glm::vec4(0.f, 0.f, 1.f, 1.f));
  r->LoadFromFile("Models/circle.obj");
  r->PostLoad();
  _tee->SetRenderable(r);
  
  _tee->GetMatrix()->Position(pos + glm::vec3(0.f, .01f, 0.f));
  _tee->GetMatrix()->Scale(0.075f);
}
开发者ID:kehnneh,项目名称:MiniGolf,代码行数:26,代码来源:Level.cpp

示例7: auxPicking

std::vector<Object*> Scene::picking(const Vec2& point) const
{
    //var dec
    std::vector<Object*> pickedList;
    std::function<void(Object* obj)> auxPicking = nullptr;
    //aux fun
    auxPicking=[&](Object* obj)
    {
        //pick
        Renderable* renderable = nullptr;
        if ((renderable = obj->getComponent<Renderable>()))
        {
            if (renderable->isVisible())
            {
                const AABox2& box = renderable->getBaseBox();
                const AABox2& wbox = renderable->canTransform() ? box.applay(obj->getGlobalMatrix()) : box;
                if (wbox.isIntersection(point)) pickedList.push_back(obj);
            }
        }
        //rec
        if (!renderable || renderable->isVisible()) 
        for (Object* childs : *obj)
        {
            auxPicking(childs);
        };
    };
    //call aux
    for (Object* obj : objects) auxPicking(obj);
    //return
    return pickedList;
}
开发者ID:Gabriele91,项目名称:Easy2D,代码行数:31,代码来源:Scene.cpp

示例8: update

void RenderManager::update()
{
	Renderable *r = m_rendlist;
	while (r != NULL) {
		r->update();
		r = r->m_next;
	}
}
开发者ID:ChadyG,项目名称:MUGE,代码行数:8,代码来源:RenderManager.cpp

示例9: setY

GLint setY(lua_State* L)
{
    if(lua_isstring(L,-2))
    {
        Renderable* auxrender = (Core::getInstance())->getRenderable(lua_tostring(L,-2));
        auxrender->move(auxrender->getX(), lua_tonumber(L,-1));
    }
}
开发者ID:beto0607,项目名称:kaikai,代码行数:8,代码来源:Renderablelua.cpp

示例10: it

void GLSceneNode::draw()
{
    QListIterator<Renderable*> it(this->objects);
    while(it.hasNext()) {
        Renderable *r = it.next();
        r->render();
    }
}
开发者ID:themasch,项目名称:maschcraft,代码行数:8,代码来源:GLSceneNode.cpp

示例11: PositionChanged

void ClientPage::PositionChanged(const Renderable& r)
{
    Packet p;
    p.write(PacketType::set_entity_position);
    p.write(r.getID());
    p.write(r.getPosition());
    sendUdpPacket(p);
}
开发者ID:oli-obk,项目名称:lightshifters,代码行数:8,代码来源:client_page.cpp

示例12: RenderableActivate

		static void RenderableActivate(unsigned int aId)
		{
			const RenderableTemplate &renderabletemplate = Database::renderabletemplate.Get(aId);
			Renderable *renderable = new Renderable(renderabletemplate, aId);
			Database::renderable.Put(aId, renderable);
			renderable->SetAction(RenderDrawlist);
			renderable->Show();
		}
开发者ID:Fissuras,项目名称:videoventure,代码行数:8,代码来源:Renderable.cpp

示例13: getProtoScale

float PointCloudRenderer::getProtoScale(Renderable & renderable)
{
    float factor = 1.0;
    if(renderable.pointcloud().has_units())
    {
        factor = 1000.0/renderable.pointcloud().units();
    }
    return factor;
}
开发者ID:CURG,项目名称:graspit_bci,代码行数:9,代码来源:RenderableProtoDrawer.cpp

示例14: glPushAttrib

void UiRenderPass::render(Renderer* client, const DrawContext& context)
{
	sLock.lock();
	myDrawTimeStat->startTiming();

	if(context.task == DrawContext::SceneDrawTask)
	{
		client->getRenderer()->beginDraw3D(context);
		glPushAttrib(GL_ALL_ATTRIB_BITS);

		// This is a bit of a hack. DIsable depth testing for ui stuff. We will take care of ordering.
		// This may lead to depth inconsistencies wrt the background scene when drawing 3d menus, but we want te
		// menus to always be visible and unoccluded by geometry.
		glDisable(GL_DEPTH_TEST);

		ui::Container* ui = myUiRoot;
		Renderable* uiRenderable = ui->getRenderable(client);
		if(uiRenderable != NULL)
		{
			uiRenderable->draw(context);
		}

		glPopAttrib();
		client->getRenderer()->endDraw();
	}
	else if(context.task == DrawContext::OverlayDrawTask)
	{
		Vector2i displaySize;
		// check if the tile is part of a canvas (a multi-tile grid). If it is,
		// get the canvas resolution. Otherwise simply use the tile resolution.
		if(context.tile->isInGrid)
		{
			DisplaySystem* ds = SystemManager::instance()->getDisplaySystem();
			displaySize = ds->getCanvasSize();
		}
		else
		{
			displaySize = context.tile->pixelSize;
		}

		client->getRenderer()->beginDraw2D(context);
		glPushAttrib(GL_ALL_ATTRIB_BITS);

		Renderable* uiRenderable = myUiRoot->getRenderable(client);
		if(uiRenderable != NULL)
		{
			uiRenderable->draw(context);
		}

		glPopAttrib();
		client->getRenderer()->endDraw();
	}

	myDrawTimeStat->stopTiming();
	sLock.unlock();
}
开发者ID:MacTop,项目名称:omegalib,代码行数:56,代码来源:UiRenderPass.cpp

示例15: check

void ClosestHud::check(const Renderable& r, Vector pos)
{
    double dist = (pos - r.getPosition()).magnitudeSquared();
    if (m_dDistSquared > dist || !m_bValid) {
        m_dDistSquared = dist;
        m_bValid = true;
        m_vecPos = r.getPosition();
        m_ID = r.getID();
    }
}
开发者ID:oli-obk,项目名称:lightshifters,代码行数:10,代码来源:space_page.cpp


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