All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Luminous::MipMapGenerator Class Reference

Task that generates mipmaps to global imagecache for source image. More...

#include <Luminous/MipMapGenerator.hpp>

Inheritance diagram for Luminous::MipMapGenerator:
Radiant::Task Patterns::NotCopyable

Public Member Functions

virtual LUMINOUS_API void doTask ()
 Run the task. More...
 
LUMINOUS_API MipMapGenerator (const QString &src, const QString &target)
 Generates a new task for new image. More...
 
LUMINOUS_API MipMapGenerator (const QString &src, const QString &target, const PixelFormat &mipmapFormat)
 Generates a new task for new image with explicit mipmap pixelformat. More...
 
LUMINOUS_API void setListener (std::function< void(bool ok, const ImageInfo &)> func)
 Set a listener to this task. More...
 
- Public Member Functions inherited from Radiant::Task
bool isCanceled () const
 Returns whether a task has been canceled. More...
 
Priority priority () const
 Get the current priority of the task. More...
 
void runNow (bool finish)
 If the task isn't already finished, runs the task immediately in the calling thread. More...
 
void schedule (Radiant::TimeStamp ts)
 Schedule the next execution time for this task. More...
 
Radiant::TimeStamp scheduled () const
 Return a timestamp for the next execution of the task. More...
 
void scheduleFromNow (Radiant::TimeStamp wait)
 Schedule the next execution time for this task. More...
 
void scheduleFromNowSecs (double seconds)
 Schedule the next execution time for this task. More...
 
void setCanceled ()
 Marks the task as canceled, so it will be removed.
 
void setFinished ()
 Marks the task as finished, so it will be removed.
 
void setPriority (Priority priority)
 Sets priority for task. More...
 
State state () const
 Get the current state of the task. More...
 
 Task (Priority p=PRIORITY_NORMAL)
 Constructs a task with the given priority. More...
 
virtual ~Task ()
 Destructor.
 

Static Public Member Functions

static LUMINOUS_API PixelFormat chooseMipmapFormat (const Image &img)
 Chooses automatically the best pixel format for source image. More...
 
static LUMINOUS_API int defaultPriority ()
 

Additional Inherited Members

- Public Types inherited from Radiant::Task
enum  { PRIORITY_LOW = 1, PRIORITY_NORMAL = 500, PRIORITY_HIGH = 1000, PRIORITY_URGENT = 1500 }
 Standard priorities for tasks. More...
 
enum  State { WAITING, RUNNING, DONE }
 State of the task. More...
 
- Protected Member Functions inherited from Radiant::Task
virtual void canceled ()
 Cancel the task. More...
 
virtual void finished ()
 Finished the task. More...
 
virtual void initialize ()
 Initialize the task. Called by BGThread before the task is processed.
 
void setState (State s)
 Sets the task state. More...
 

Detailed Description

Task that generates mipmaps to global imagecache for source image.

Will only create DDS/DXT mipmaps. CPUMipmaps uses this class if compressed mipmaps are requested, there is usually no need to use this class directly.

Constructor & Destructor Documentation

LUMINOUS_API Luminous::MipMapGenerator::MipMapGenerator ( const QString &  src,
const QString &  target 
)

Generates a new task for new image.

Mipmaps will be saved with one of the DXT image formats, depending on the source image format.

Parameters
srcThe filename of the original image, for example a PNG file
targetThe filename of the target image
LUMINOUS_API Luminous::MipMapGenerator::MipMapGenerator ( const QString &  src,
const QString &  target,
const PixelFormat mipmapFormat 
)

Generates a new task for new image with explicit mipmap pixelformat.

Parameters
srcThe filename of the original image, for example a PNG file
targetThe filename of the target image
mipmapFormatThe mipmap output format. Only DXT compressed formats are supported.

Member Function Documentation

static LUMINOUS_API PixelFormat Luminous::MipMapGenerator::chooseMipmapFormat ( const Image img)
static

Chooses automatically the best pixel format for source image.

Parameters
imgThe image whose ideal mipmap format we are deducing.
Returns
ideal pixel format
virtual LUMINOUS_API void Luminous::MipMapGenerator::doTask ( )
virtual

Run the task.

Generate the mipmap file and inform the listener when the task is ready.

Implements Radiant::Task.

LUMINOUS_API void Luminous::MipMapGenerator::setListener ( std::function< void(bool ok, const ImageInfo &)>  func)

Set a listener to this task.

Listener is called when the mipmaps are ready.

Parameters
functhe listener