OK, the BigImage/BigSprite are somewhat functional.
Test demo download link: (http://nitram.cero.googlepages.com/BigImageBigSpriteTest.rar)(VC++2008 Express project included)
EDIT:
Update: Code tide up and better doxygen like in-code documentation.
Update: Bug-fix
Notes:
It
must be built static (for now) because it needs references from internal ImageLoader.cpp and GraphicsContext.cpp
and in DLL mode they are not exported.
Sorry if the project can't be compiled "out of the box", some dependencies in Linker could need to be changed.
Sub Width and Sub HeightBigImage::LoadFromFile differs from the sf::Image version because it has two extra parameters that define the image sub-width and sub-height.
Let me expand a little on that:
If you pass BigImage::DefaultDimension, it uses the maximum allowed by the Graphics card.
In some cases you might want to use lower values for vertex culling and such.
If the one selected is no valid, it's made valid (power of 2 and not higher than the card's max).
i.e.: If you choose 500x500 but the card supports max of 256x256 (as really old Voodoo3's did), it will use 256.
With a Radeon 9800 that supports 2048x2048, but only power-of-two textures, then the it would use 512x512.
Pixel caching in system memory:Caching of pixels (because of the nature of BIG images) is disabled by default.
This means you can't use SetPixel.
but...If you use SetCachePixels(true) BEFORE calling LoadFromFile(), then the buffers are not freed, so you can SetPixel all you want because it will be re-applied to the texture.
Use it with caution as big images are usually heavy. The example image in the demo is 4000x2200 pixels (not
that big) and it uses 34MB of memory! :shock:
The Demo:In the demo it takes a while to load because it slices the 34MB (uncompressed) picture into smaller buffers.
And then loads it to textures.
Move: Arrows
Rotate: Numpad "+","-"
Scale: "," and "." (Comma and Period next to the shift key)
For the curious: The picture was taken in Capilla del Monte, Córdoba, Argentina.
Conclusion:The classes need more work and functionality, but it's quite what I need right now for my game, so it's the best I can offer.
I tried my best to make it at transparent as possible to the interface of sf::Sprite and sf::Image
Maybe I'll work on it some more, adding functions to them to better approximate to the sf::Image/sf::Sprite classes.
But that'll have to wait 'til March.
I hope this is useful to someone
Thanks for reading and tolerating my endless feature-request nagging :lol:
-Martín