AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzPlatformRender.h
Go to the documentation of this file.
00001 // 
00002 //
00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine
00004 //
00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk
00006 //
00007 // For updates, tutorials and more details check out www.appeasymobile.com
00008 //
00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin.
00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support
00011 //
00012 //
00013 
00014 #if !defined(_CCZ_PLATFORM_RENDER_H_)
00015 #define _CCZ_PLATFORM_RENDER_H_
00016 
00017 #include "IzPlatformRender.h"
00018 #include "CzRender.h"
00019 
00020 
00021 
00022 class CzPlatformRender : public IzPlatformRender
00023 {
00024     // Properties
00025 protected:
00026     CzTexture               CurrentTexture;
00027     eCzAlphaMode            CurrentAlphaMode;
00028     bool                    CurrentFilter;
00029     int                     RedundantTextureCalls;
00030     CzRenderPrim**          Primitives;
00031     int                     NextPrimitive;
00032     int                     MaxPrimitives;
00033     CzRenderMaterial**      Materials;
00034     int*                    MaterialUsedCounts;
00035     int                     NextMaterial;
00036     int                     MaxMaterials;
00037     int*                    MaterialIndices;
00038     CzSVec2**               BatchVerts;
00039     CzSVec2**               BatchUVs;
00040     CzColour**              BatchColours;
00041     uint16**                BatchIndices;
00042 
00043     static bool             ClipRectModified;       // true if clipping rect has been modified
00044     static CzIRect          ScreenClipRect;         // Current transformed screen clipping rect
00045 public:
00046     // Properties end
00047 protected:
00048 
00049 public:
00050     // Init
00051     int             Init(int max_primitives = 1024, int max_materials = 100);
00052     void            Release();
00053 
00054     // Pre-post render
00055     void            Begin();
00056     void            End();
00057 
00058     // Primitive rendering
00059     void            DrawPrimitives(CzRenderPrim* prims, CzRenderMaterial* materials, int num_prims, bool single_material);
00060     void            DrawPrimitives(CzRenderPrim3* prims, CzRenderMaterial* materials, int num_prims, bool single_material);
00061     void            DrawText(CzFontPreparedText prepared_text, CzFont* font, CzMatrix3* transform, const CzColour& colour, CzVec4& skew, bool filter, eCzAlphaMode alpha_mode);
00062 
00063     // Batch rendering
00064     void            AddPrimtives(CzRenderPrim* prims, CzRenderMaterial* materials, int num_prims, bool single_material);
00065     int             AddMaterial(CzRenderMaterial* material);
00066     void            BatchDrawPrims(bool filter = true);
00067 
00068     // Global clipping
00069     void            SetClipRect(int x, int y, int w, int h);
00070     void            UpdateClipRect(int x, int y, int w, int h);
00071     CzIRect         GetClipRect() const                     { return ScreenClipRect; }
00072     void            ResetClipRect();
00073     bool            isFullyClipped(const CzIRect& rc) const;
00074     void            setClipRectModified(bool modified)      { ClipRectModified = modified; }
00075     bool            wasClipRectModified() const             { return ClipRectModified; }
00076 
00077     // Matrices and projection
00078     void            SetOrthoProjection(float left, float right, float bottom, float top, float nearz, float farz);
00079     void            SetPerspectiveMatrix(CzMatrix4* mat);
00080     void            SetModelMatrix(CzMatrix4* mat);
00081     void            SetViewMatrix(CzMatrix4* mat);
00082 };
00083 
00084 
00085 #endif  // _CCZ_PLATFORM_RENDER_H_