Exemple #1
0
/** Draw the 3D scene with the specified drawing visitor. */
void CC3Layer::drawSceneWithVisitor( CC3NodeDrawingVisitor* visitor )
{
	// Ensure the visitor uses the surface manager of this layer
	visitor->setSurfaceManager( getSurfaceManager() );
	
	if (m_shouldAlwaysUpdateViewport) 
		updateViewport();
	
	getCC3Scene()->drawSceneWithVisitor( visitor );
}
void VoxelView::init()
{
  VOXELHEIGHT=h;
  int x,y;
  Color c;

  calcShadow();

  for(x=0;x<w;x++)
    for(y=0;y<h;y++)
      {
        Pos2D p2(x,y);
        c=trace(p2);
        if(c.a>=0)
          {
            sge_PutPixel(s,x,y,c.toColor(s));

          }
      }
  mSurface=getSurfaceManager()->fromSDL(s);
  mTexture=new AGTexture(getTextureManager()->makeTexture(mSurface));
  return;
}
void FastVoxelView::init()
{
  //  VOXELHEIGHT=w;

  std::map<Pos2D,std::pair<int,Voxel*> >::iterator i=viewSpace.mViewSpace.begin();

  Color c;
  Pos2D p(0,0);
  for(;i!=viewSpace.mViewSpace.end();i++)
    {
      p=i->first;
      c=viewSpace.get(p);
      p.x*=mZoom;
      p.y*=mZoom;
      if(mZoom==1)
        sge_PutPixel(s,(int)p.x,(int)p.y,c.toColor(s));
      else
        sge_FilledRect(s,(int)p.x,(int)p.y,(int)(p.x+mZoom),(int)(p.y+mZoom),c.toColor(s));
    }
  //  SDL_SaveBMP(s,"myfile.bmp");

  mSurface=getSurfaceManager()->fromSDL(s);
  return;
}