bitRender.h

Engine/source/core/bitRender.h

More...

Classes:

class

Functions for rendering to 1bpp bitmaps.

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _BITRENDER_H_
25#define _BITRENDER_H_
26
27#ifndef _MMATH_H_
28#include "math/mMath.h"
29#endif
30
31/// Functions for rendering to 1bpp bitmaps.
32///
33/// Used primarily for fast shadow rendering.
34struct BitRender
35{
36   /// Render a triangle to a bitmap of 1-bit per pixel and size dim X dim.
37   static void render(const Point2I *, const Point2I *, const Point2I *, S32 dim, U32 * bits);
38
39   /// Render a number of triangle strips to 1-bit per pixel bmp of size dim by dim.
40   static void render_strips(const U8 * draw, S32 numDraw, S32 szDraw, const U16 * indices, const Point2I * points, S32 dim, U32 * bits);
41
42   /// Render a number of triangles to 1-bit per pixel bmp of size dim by dim.
43   static void render_tris(const U8 * draw, S32 numDraw, S32 szDraw, const U16 * indices, const Point2I * points, S32 dim, U32 * bits);
44
45   /// @name Render Bits
46   /// These are used to convert a 1bpp bitmap to an 8bpp bitmap.
47   ///
48   /// @see Shadow::endRenderToBitmap
49   /// @{
50
51   /// Render bits to the bitmap.
52   static void bitTo8Bit(U32 * bits, U32 * eightBits, S32 dim);
53
54   /// Render bits to the bitmap, with gaussian pass.
55   static void bitTo8Bit_3(U32 * bits, U32 * eightBits, S32 dim);
56   /// @}
57};
58
59#endif // _BIT_RENDER_H_
60
61