示例#1
0
NodePtr SVG::createImageNode(const UTF8String& sElementID, const py::dict& nodeAttrs, 
        const glm::vec2& renderSize)
{
    BitmapPtr pBmp = renderElement(sElementID, renderSize);
    return createImageNodeFromBitmap(pBmp, nodeAttrs);
}
示例#2
0
NodePtr SVG::createImageNode(const UTF8String& sElementID, const py::dict& nodeAttrs, 
        float scale)
{
    BitmapPtr pBmp = renderElement(sElementID, scale);
    return createImageNodeFromBitmap(pBmp, nodeAttrs);
}
示例#3
0
BitmapPtr SVG::renderElement(const UTF8String& sElementID)
{
    return renderElement(sElementID, 1);
}
示例#4
0
  void render(date renderDate)
  {
    assert(trailElements != NULL);

    Shader::Program::unUse();
    Texture::Unit::unUse();
    VBO::Element::unUse();
    FBO::list[FBO::trails].use();

    GLenum buffers[] = {
      GL_COLOR_ATTACHMENT0_EXT,
      GL_COLOR_ATTACHMENT1_EXT
    };

    oglDrawBuffers(1, buffers);

#if DEBUG_TRAILS
    glClearColor(0.1f, 0.1f, 0.1f, 1.f);
#else
    glClearColor(0, 0, 0, 1.f);
#endif // DEBUG_TRAILS

    glClear(GL_COLOR_BUFFER_BIT);

    glDisable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    glDisable( GL_LIGHTING );
    glDisable(GL_DEPTH_TEST);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D(0., 1., 0., 1.);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    /*
    {
      int i = 0;
      while (i < trailElements->size)
	if ((*trailElements)[i].birth + 500 < renderDate)
	{
	  trailElements->remove(i);
	}
	else
	{
	  ++i;
	}
    }
    */

#if DEBUG_TRAILS

    // Fond pour debugger
    glColor4f(0.4f, 0.4f, 0.4f, 0.4f);

    glBegin(GL_QUADS);
    glVertex2f(0.05f, 0.05f);
    glVertex2f(0.05f, 0.95f);
    glVertex2f(0.95f, 0.95f);
    glVertex2f(0.95f, 0.05f);
    glEnd();

#endif // DEBUG_TRAILS

    glEnableClientState(GL_VERTEX_ARRAY);

    Array<trailDesc> & list = (*trailElements);
    for (int i = 0; i < list.size; ++i)
    {
      const trailDesc & element = list[i];
      if (element.birth + 500 >= renderDate &&
	  element.birth <= renderDate)
      {
	renderElement(element, 0.002f * (renderDate - element.birth));
      }
    }

    glDisableClientState(GL_VERTEX_ARRAY);
  }