viewport_sprite_sorter.h

Go to the documentation of this file.
00001 /* $Id: viewport_sprite_sorter.h 26205 2014-01-02 16:48:16Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #include "stdafx.h"
00013 #include "core/smallvec_type.hpp"
00014 #include "gfx_type.h"
00015 
00016 #ifndef VIEWPORT_SPRITE_SORTER_H
00017 #define VIEWPORT_SPRITE_SORTER_H
00018 
00020 struct ParentSpriteToDraw {
00021   /* Block of 16B loadable in xmm register */
00022   int32 xmin;                     
00023   int32 ymin;                     
00024   int32 zmin;                     
00025   int32 x;                        
00026 
00027   /* Second block of 16B loadable in xmm register */
00028   int32 xmax;                     
00029   int32 ymax;                     
00030   int32 zmax;                     
00031   int32 y;                        
00032 
00033   SpriteID image;                 
00034   PaletteID pal;                  
00035   const SubSprite *sub;           
00036 
00037   int32 left;                     
00038   int32 top;                      
00039 
00040   int first_child;                
00041   bool comparison_done;           
00042 };
00043 
00044 typedef SmallVector<ParentSpriteToDraw*, 64> ParentSpriteToSortVector;
00045 
00047 typedef bool (*VpSorterChecker)();
00049 typedef void (*VpSpriteSorter)(ParentSpriteToSortVector *psd);
00050 
00051 #ifdef WITH_SSE
00052 bool ViewportSortParentSpritesSSE41Checker();
00053 void ViewportSortParentSpritesSSE41(ParentSpriteToSortVector *psdv);
00054 #endif
00055 
00056 void InitializeSpriteSorter();
00057 
00058 #endif /* VIEWPORT_SPRITE_SORTER_H */