Beispiel #1
0
void Renderer::render(unsigned int w, unsigned int h, StringIdMap & stringMap, const std::map <StringId, std::map <StringId, std::vector <RenderModelExternal*> *> > & externalModels, std::ostream & errorOutput)
{
	for (std::vector <RenderPass>::iterator i = passes.begin(); i != passes.end(); i++)
	{
		// Extract the appropriate map and generate a drawlist.
		// A vector of pointers to vectors of RenderModelExternal pointers.
		std::vector <const std::vector <RenderModelExternal*>*> drawList;

		// Find the map appropriate to this pass.
		std::map <StringId, std::map <StringId, std::vector <RenderModelExternal*> *> >::const_iterator drawMapIter = externalModels.find(i->getNameId());
		if (drawMapIter != externalModels.end())
			// For each draw group that this pass uses, add its models to the draw list.
			for (std::set <StringId>::const_iterator dg = i->getDrawGroups().begin(); dg != i->getDrawGroups().end(); dg++)
			{
				std::map <StringId, std::vector <RenderModelExternal*> *>::const_iterator drawGroupIter = drawMapIter->second.find(*dg);
				if (drawGroupIter != drawMapIter->second.end())
					drawList.push_back(drawGroupIter->second);
			}

		if (i->render(gl, w, h, stringMap, drawList, sharedTextures, errorOutput))
		{
			// Render targets have been recreated due to display dimension change.
			// Call setGlobalTexture to update sharedTextures and let downstream passes know.
			const std::map <StringId, RenderTexture> & passRTs = passes.back().getRenderTargets();
			for (std::map <StringId, RenderTexture>::const_iterator rt = passRTs.begin(); rt != passRTs.end(); rt++)
				setGlobalTexture(rt->first, RenderTextureEntry(rt->first, rt->second.handle, rt->second.target));
		}
	}
}
Beispiel #2
0
void Renderer::render(unsigned int w, unsigned int h, StringIdMap & stringMap, const std::map <StringId, std::map <StringId, std::vector <RenderModelExt*> *> > & externalModels, std::ostream & errorOutput)
{
    for (auto & pass : passes)
    {
        // Extract the appropriate map and generate a drawlist.
        // A vector of pointers to vectors of RenderModelExternal pointers.
        std::vector <const std::vector <RenderModelExt*>*> drawList;

        // Find the map appropriate to this pass.
        auto drawMapIter = externalModels.find(pass.getNameId());
        if (drawMapIter != externalModels.end())
            // For each draw group that this pass uses, add its models to the draw list.
            for (auto dg : pass.getDrawGroups())
            {
                auto drawGroupIter = drawMapIter->second.find(dg);
                if (drawGroupIter != drawMapIter->second.end())
                    drawList.push_back(drawGroupIter->second);
            }

        if (pass.render(gl, w, h, stringMap, drawList, sharedTextures, errorOutput))
        {
            // Render targets have been recreated due to display dimension change.
            // Call setGlobalTexture to update sharedTextures and let downstream passes know.
            for (const auto & rt : passes.back().getRenderTargets())
                setGlobalTexture(rt.first, RenderTextureEntry(rt.first, rt.second.handle, rt.second.target));
        }
    }
}