Nokia N97 SDK
Example Applications Guide

Slideshowrenderers.h

00001 /*
00002  * ==============================================================================
00003  *  Name        : Slideshowrenderers.h
00004  *  Part of     : OpenGLEx / Slideshow
00005  *
00006  *  Copyright (c) 2005-2006 Nokia Corporation.
00007  *  This material, including documentation and any related
00008  *  computer programs, is protected by copyright controlled by
00009  *  Nokia Corporation.
00010  * ==============================================================================
00011  */
00012 
00013 #ifndef __SLIDESHOWRENDERERSH__
00014 #define __SLIDESHOWRENDERERSH__
00015 
00016 //  INCLUDES
00017 #include <GLES/gl.h>
00018 #include "Textureutils.h"
00019 
00020 /**
00021  *  Static background renderer.
00022  *
00023  *  This class draws a textured polygon that covers the entire screen.
00024  */
00025 class CStaticRenderer
00026     {
00027     public:
00028     /**
00029      *  Draw a textured polygon that fills the entire screen.
00030      *  @param texture The texture for the polygon.
00031      *  @param filter  Enable bilinear filtering to improve image quality
00032      */
00033     void Render(const TTexture& texture, TBool filter);
00034     };
00035 
00036 /**
00037  *  Transition renderer interface.
00038  *
00039  *  A transition renderer draws the effect of one picture gradually
00040  *  changing into another. The actual effect depends on the particular
00041  *  implementation of the interface.
00042  */
00043 class MTransitionRenderer
00044     {
00045     public:
00046     /**
00047         *  Draw a gradually appearing picture. The previous picture
00048         *  is assumed to already be on the screen. @see CStaticRenderer.
00049         *  @param texture The picture that should appear.
00050         *  @param ratio Picture visibility in the range 0..1. A ratio of 0
00051         *               means that the picture is not visible at all, while
00052         *               1 means the new picture fully covers the screen just
00053         *               as if it was drawn with CStaticRenderer.
00054         */
00055     virtual void Render(const TTexture& texture, GLfloat ratio) = 0;
00056     };
00057 
00058 /**
00059  *  A mask transition effect.
00060  *
00061  *  This transition effect uses a mask texture to fade in a picture. It uses
00062  *  OpenGL ES texture environment combiners to modulate the picture with the
00063  *  mask.
00064  */
00065 class CMaskTransition: public MTransitionRenderer
00066     {
00067     public:
00068         /**
00069          *  Different mask sweeping styles supported by the effect.
00070          */
00071         enum TSweepStyle
00072             {
00073             ESweepHorizontal,
00074             ESweepVertical,
00075             ESweepCurved,
00076             ESweepCurved2,
00077             };
00078 
00079         /**
00080          *  Constructor.
00081          *  @param mask Mask texture. The texture should be in RGBA format,
00082          *              opaque white at the top and fully transparent at
00083          *              the bottom.
00084          *  @param sweepStyle Sweep style to use for moving the mask.
00085          */
00086         CMaskTransition(const TTexture& mask, TSweepStyle sweepStyle);
00087         virtual void Render(const TTexture& texture, GLfloat ratio);
00088     private:
00089         /** Selected sweep style for this instance */
00090         TSweepStyle iSweepStyle;
00091         /** Mask texture */
00092         const TTexture& iMask;
00093     };
00094 
00095 /**
00096  *  A whisk transition.
00097  *
00098  *  This transition introduces a new image by rapidly moving it on-screen
00099  *  from the left or right.
00100  */
00101 class CWhiskTransition: public MTransitionRenderer
00102     {
00103     public:
00104         /**
00105          *  Direction to move the new picture to.
00106          */
00107         enum TDirection
00108             {
00109             ELeft,
00110             ERight
00111             };
00112 
00113         /**
00114          *  Constructor.
00115          *  @param dir Chooses whether the picture should come in from
00116          *             the left or right.
00117          */
00118         CWhiskTransition(TDirection dir);
00119         virtual void Render(const TTexture& texture, GLfloat ratio);
00120     private:
00121         /** Picture entry direction */
00122         TDirection iDir;
00123     };
00124 
00125 /**
00126  *  A curtain transition.
00127  *
00128  *  This transition brings in a new picture as if it was drawn on a
00129  *  hanging curtain.
00130  */
00131 class CCurtainTransition: public MTransitionRenderer
00132     {
00133     public:
00134         /**
00135          *  The side of the screen the curtain enters from.
00136          */
00137         enum TDirection
00138             {
00139             ELeft,
00140             ERight
00141             };
00142 
00143         /**
00144          *  Constructor.
00145          *  @param dir Chooses whether the curtain enters from
00146          *             the left or right side of the screen.
00147          */
00148         CCurtainTransition(TDirection dir);
00149         virtual void Render(const TTexture& texture, GLfloat ratio);
00150     private:
00151         /** Curtain entry direction */
00152         TDirection iDir;
00153     };
00154 
00155 #endif
00156 
00157 // End of File
00158 

© Nokia 2009

Back to top