Beispiel #1
0
//****************************************************************************
static void convert_collada_library_geometries(
    dae_COLLADA* collada,
    dae_library_geometries_type* daelibgeom,
    taa_scene* scene,
    objmap* geommap)
{
    dae_geometry_type** daegeomitr = daelibgeom->el_geometry.values;
    dae_geometry_type** daegeomend = daegeomitr+daelibgeom->el_geometry.size;
    while(daegeomitr != daegeomend)
    {
        dae_geometry_type* daegeom = *daegeomitr;
        convert_geometry(collada, daegeom, scene, geommap);
        ++daegeomitr;
    }
}
Beispiel #2
0
mapnik::geometry::geometry_collection<double> ogr_converter::convert_collection(OGRGeometryCollection* ogr_geom)
{
    mapnik::geometry::geometry_collection<double> geom;
    int num_geometries = ogr_geom->getNumGeometries();
    geom.reserve(num_geometries);
    for (int i = 0; i < num_geometries; ++i)
    {
        OGRGeometry* g = ogr_geom->getGeometryRef(i);
        if (g != nullptr)
        {
            geom.emplace_back(convert_geometry(g));
        }
    }
    return geom;
}
Beispiel #3
0
bool RenderChain::render(const void *data,
      unsigned width, unsigned height, unsigned pitch, unsigned rotation)
{
   start_render();

   unsigned current_width = width, current_height = height;
   unsigned out_width = 0, out_height = 0;
   convert_geometry(passes[0].info, out_width, out_height,
         current_width, current_height, final_viewport);

   blit_to_texture(data, width, height, pitch);

   // Grab back buffer.
   LPDIRECT3DSURFACE back_buffer;
   dev->GetRenderTarget(0, &back_buffer);

   // In-between render target passes.
   for (unsigned i = 0; i < passes.size() - 1; i++)
   {
      Pass &from_pass = passes[i];
      Pass &to_pass = passes[i + 1];

      LPDIRECT3DSURFACE target;
      to_pass.tex->GetSurfaceLevel(0, &target);
      dev->SetRenderTarget(0, target);

      convert_geometry(from_pass.info,
            out_width, out_height,
            current_width, current_height, final_viewport);

      // Clear out whole FBO.
      D3DVIEWPORT viewport = {0};
      viewport.Width = to_pass.info.tex_w;
      viewport.Height = to_pass.info.tex_h;
      viewport.MinZ = 0.0f;
      viewport.MaxZ = 1.0f;
      dev->SetViewport(&viewport);
      dev->Clear(0, 0, D3DCLEAR_TARGET, 0, 1, 0);
      
      viewport.Width = out_width;
      viewport.Height = out_height;
      set_viewport(viewport);

      set_vertices(from_pass,
            current_width, current_height,
            out_width, out_height,
            out_width, out_height, 0);

      render_pass(from_pass, i + 1);

      current_width = out_width;
      current_height = out_height;
      target->Release();
   }

   // Final pass
   dev->SetRenderTarget(0, back_buffer);
   Pass &last_pass = passes.back();

   convert_geometry(last_pass.info,
         out_width, out_height,
         current_width, current_height, final_viewport);
   set_viewport(final_viewport);
   set_vertices(last_pass,
            current_width, current_height,
            out_width, out_height,
            final_viewport.Width, final_viewport.Height,
            rotation);
   render_pass(last_pass, passes.size());

   frame_count++;

   back_buffer->Release();

   end_render();
   set_shaders(fStock, vStock);
   set_cg_mvp(vStock, final_viewport.Width, final_viewport.Height, 0);
   return true;
}