void GrowingCircleTransition::draw(const DrawParameter& param) { if(getSourceTexture() != nullptr) param.getTarget().draw(m_sourceSprite); if(getTargetTexture() != nullptr) param.getTarget().draw(m_targetSprites); }
void VerticalStripesTransition::draw(const DrawParameter& param) { if(getSourceTexture() != nullptr) param.getTarget().draw(m_sourceSprite); if(getTargetTexture() != nullptr) for(auto it = m_targetSprites.begin(); it != m_targetSprites.end(); ++it) param.getTarget().draw(**it); }
bool Pipeline::loadSetup(TiXmlElement *xml) { // Load textures for (TiXmlElement *element = xml->FirstChildElement("Texture"); element != 0; element = element->NextSiblingElement("Texture")) { // Get texture name const char *name = element->Attribute("name"); if (!name) { getManager()->getLog()->error("%s: Texture name missing.", getName().c_str()); continue; } // Get texture format const char *formatstr = element->Attribute("format"); TextureFormat::List format = TextureFormat::RGBA8; if (formatstr) { format = TextureFormat::fromString(formatstr); if (format == TextureFormat::Invalid) { getManager()->getLog()->error("%s: Invalid texture format \"%s\".", getName().c_str(), formatstr); continue; } } TargetTextureInfo texture; texture.name = name; parseSize(element, texture.relsize, texture.abssize); // Create texture resource unsigned int texturesize[2]; texturesize[0] = (unsigned int)(texture.relsize[0] * targetsize[0]) + texture.abssize[0]; texturesize[1] = (unsigned int)(texture.relsize[1] * targetsize[1]) + texture.abssize[1]; Texture::Ptr texres = getManager()->createResource<Texture>("Texture"); texres->set2D(texturesize[0], texturesize[1], format); texres->setMipmapsEnabled(false); // TODO: Configurable filtering texres->setFiltering(TextureFiltering::Nearest); texture.texture = texres; // Add the texture to the texture list targettextures.push_back(texture); } // Load frame buffer resources for (TiXmlElement *element = xml->FirstChildElement("FrameBuffer"); element != 0; element = element->NextSiblingElement("FrameBuffer")) { // Get texture name const char *name = element->Attribute("name"); if (!name) { getManager()->getLog()->error("%s: Texture name missing.", getName().c_str()); continue; } FrameBufferInfo fb; fb.name = name; parseSize(element, fb.relsize, fb.abssize); // Get depthbuffer bool depthbuffer = false; const char *depthbufferstr = element->Attribute("depthbuffer"); if (depthbufferstr && !strcmp(depthbufferstr, "true")) { depthbuffer = true; } // Create framebuffer fb.fb = getManager()->createResource<FrameBuffer>("FrameBuffer"); unsigned int fbsize[2]; fbsize[0] = (unsigned int)(fb.relsize[0] * targetsize[0]) + fb.abssize[0]; fbsize[1] = (unsigned int)(fb.relsize[1] * targetsize[1]) + fb.abssize[1]; fb.fb->setSize(fbsize[0], fbsize[1], depthbuffer); framebuffers.push_back(fb); } // Load render targets for (TiXmlElement *element = xml->FirstChildElement("RenderTarget"); element != 0; element = element->NextSiblingElement("RenderTarget")) { // Get target name const char *name = element->Attribute("name"); if (!name) { getManager()->getLog()->error("%s: RenderTarget name missing.", getName().c_str()); continue; } // Get framebuffer const char *fbname = element->Attribute("framebuffer"); if (!fbname) { getManager()->getLog()->error("%s: RenderTarget framebuffer name missing.", getName().c_str()); continue; } FrameBuffer::Ptr fb = getFrameBuffer(fbname); if (!fb) { getManager()->getLog()->error("%s: RenderTarget framebuffer not found.", getName().c_str()); continue; } // Create render target RenderTargetInfo target; target.target = getManager()->createResource<RenderTarget>("RenderTarget"); target.name = name; target.target->setFrameBuffer(fb); // Depth buffer TiXmlElement *depthbufferelem = element->FirstChildElement("DepthBuffer"); if (depthbufferelem) { const char *texname = depthbufferelem->Attribute("texture"); if (!texname) { getManager()->getLog()->error("%s: DepthBuffer texture missing.", getName().c_str()); continue; } Texture::Ptr texture = getTargetTexture(texname); if (!texture) { getManager()->getLog()->error("%s: DepthBuffer texture not found.", getName().c_str()); continue; } target.target->setDepthBuffer(texture); } // Color buffers for (TiXmlElement *colorbufferelem = element->FirstChildElement("ColorBuffer"); colorbufferelem != 0; colorbufferelem = colorbufferelem->NextSiblingElement("ColorBuffer")) { const char *texname = colorbufferelem->Attribute("texture"); if (!texname) { getManager()->getLog()->error("%s: ColorBuffer texture missing.", getName().c_str()); continue; } Texture::Ptr texture = getTargetTexture(texname); if (!texture) { getManager()->getLog()->error("%s: ColorBuffer texture not found.", getName().c_str()); continue; } target.target->addColorBuffer(texture); } rendertargets.push_back(target); } return true; }