32 #include "../gldrv/gl_globals.h"
42 # define M_PI_2 (1.57079632679489661923)
48 using namespace VSFileSystem;
56 VSSpriteCache::iterator it =
sprite_cache.find( hashName );
58 return std::pair< bool, VSSprite* > (
true, it->second );
60 return std::pair< bool, VSSprite* > (
false, (
VSSprite*)NULL );
66 sprite_cache.insert( std::pair< std::string, VSSprite* > ( hashName, spr ) );
69 VSSprite::VSSprite(
Texture *_surface,
float _xcenter,
float _ycenter,
float _width,
float _height,
float _s,
float _t,
bool _isAnimation ) :
73 , heighto2( _height/2 )
77 , isAnimation(_isAnimation)
86 surface = surface->
Clone();
92 xcenter = ycenter = 0;
93 widtho2 = heighto2 = 0;
101 std::pair< bool, VSSprite* >lkup =
cacheLookup( file );
104 *
this = *lkup.second;
106 surface = surface->
Clone();
118 char texture[127] = {0};
119 char texturea[127] = {0};
120 f.
Fscanf(
"%126s %126s", texture, texturea );
121 f.
Fscanf(
"%f %f", &widtho2, &heighto2 );
122 f.
Fscanf(
"%f %f", &xcenter, &ycenter );
123 texture[
sizeof (texture)-
sizeof (*texture)-1] = 0;
124 texturea[
sizeof (texturea)-
sizeof (*texturea)-1] = 0;
130 int len = strlen( texture );
131 if (len > 4 && texture[len-1] ==
'i' && texture[len-2] ==
'n' && texture[len-3] ==
'a' && texture[len-4] ==
'.') {
134 }
else if (texturea[0] ==
'0') {
138 surface =
new Texture( texture,
156 newspr->surface = NULL;
162 newspr->surface = this->surface->
Clone();
170 widtho2 = heighto2 = 0;
171 xcenter = ycenter = 0;
178 widtho2 = heighto2 = 0;
179 xcenter = ycenter = 0;
180 std::cerr<<
"VSSprite::ReadTexture error : VSFile not valid"<<std::endl;
214 const float cw = widtho2*
cos( rotation );
215 const float sw = widtho2*
sin( rotation );
216 const float ch = heighto2*
cos(
M_PI_2+rotation );
217 const float sh = heighto2*
sin(
M_PI_2+rotation );
218 const float wnew = cw+ch;
219 const float hnew = sw+sh;
220 ll =
Vector( xcenter-wnew, ycenter+hnew, 0.00
f );
221 lr =
Vector( xcenter+wnew, ycenter+hnew, 0.00
f );
222 ur =
Vector( xcenter+wnew, ycenter-hnew, 0.00
f );
223 ul =
Vector( xcenter-wnew, ycenter-hnew, 0.00
f );
225 ll =
Vector( xcenter-widtho2, ycenter+heighto2, 0.00
f );
226 lr =
Vector( xcenter+widtho2, ycenter+heighto2, 0.00
f );
227 ur =
Vector( xcenter+widtho2, ycenter-heighto2, 0.00
f );
228 ul =
Vector( xcenter-widtho2, ycenter-heighto2, 0.00
f );
238 bool multitex = (numlayers > 1);
249 for (
int pass = 0; pass < numpasses; pass++) {
250 if ( surface->
SetupPass( pass, 0, src, dst ) ) {
257 ms = (Ms-ms)*maxs+ms;
258 mt = (Mt-mt)*maxt+mt;
286 for (lyr = 0; lyr < numlayers; lyr++)
337 return SharedPtr<Audio::Source>();