Back to index

nux  3.0.0
RenderingPipe.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Inalogic® Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License, as
00006  * published by the  Free Software Foundation; either version 2.1 or 3.0
00007  * of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License along with this program. If not, see <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Jay Taoko <jaytaoko@inalogic.com>
00019  *
00020  */
00021 
00022 
00023 #ifndef RENDERINGPIPE_H
00024 #define RENDERINGPIPE_H
00025 
00026 #include "GLResource.h"
00027 
00028 namespace nux
00029 {
00030 
00032 
00037   typedef enum
00038   {
00039     TEXWRAP_UNKNOWN = 0,
00040     TEXWRAP_REPEAT,
00041     TEXWRAP_CLAMP,
00042     TEXWRAP_CLAMP_TO_EDGE,
00043     TEXWRAP_CLAMP_TO_BORDER,
00044     TEXWRAP_MIRRORED_REPEAT,
00045     TEXWRAP_MIRROR_CLAMP_EXT,
00046     TEXWRAP_MIRROR_CLAMP_TO_EDGE_EXT,
00047     TEXWRAP_MIRROR_CLAMP_TO_BORDER_EXT,
00048   } TexWrap;
00049 
00051 
00056   typedef enum
00057   {
00058     TEXFILTER_UNKNOWN = 0,
00059     TEXFILTER_LINEAR,
00060     TEXFILTER_NEAREST,
00061     TEXFILTER_NEAREST_MIPMAP_NEAREST,
00062     TEXFILTER_LINEAR_MIPMAP_NEAREST,
00063     TEXFILTER_NEAREST_MIPMAP_LINEAR,
00064     TEXFILTER_LINEAR_MIPMAP_LINEAR,
00065   } TexFilter;
00066 
00068 
00072   typedef enum
00073   {
00074     ROPBLEND_UNKNOWN = 0,
00075     ROPBLEND_ZERO,
00076     ROPBLEND_ONE,
00077     ROPBLEND_SRC_COLOR,
00078     ROPBLEND_ONE_MINUS_SRC_COLOR,
00079     ROPBLEND_DST_COLOR,
00080     ROPBLEND_ONE_MINUS_DST_COLOR,
00081     ROPBLEND_SRC_ALPHA,
00082     ROPBLEND_ONE_MINUS_SRC_ALPHA,
00083     ROPBLEND_DST_ALPHA,
00084     ROPBLEND_ONE_MINUS_DST_ALPHA,
00085     ROPBLEND_CONSTANT_COLOR,
00086     ROPBLEND_ONE_MINUS_CONSTANT_COLOR,
00087     ROPBLEND_CONSTANT_ALPHA,
00088     ROPBLEND_ONE_MINUS_CONSTANT_ALPHA,
00089     ROPBLEND_SRC_ALPHA_SATURATE,
00090   } RopBlend;
00091 
00093 
00096   class TexCoordXForm
00097   {
00098   public:
00100     typedef enum
00101     {
00102       OFFSET_SCALE_COORD, 
00103       OFFSET_COORD,       
00104       NORMALIZED_COORD,   
00105       UNNORMALIZED_COORD, 
00106       FIXED_COORD,        
00107     } TexCoordType;
00108 
00109     TexCoordXForm();
00110 
00111     void SetTexCoordType(TexCoordType tex_coord_type);
00112     void FlipUCoord(bool b);
00113     void FlipVCoord(bool b);
00114     void FlipUVCoord(bool flip_u, bool flip_v);
00115     void SetFilter(TexFilter min_fliter, TexFilter mag_filter);
00116     void SetWrap(TexWrap u_wrap, TexWrap v_wrap);
00117 
00119     float u0, v0, u1, v1;
00120     float uscale;
00121     float vscale;
00122     float uoffset;
00123     float voffset;
00124     TexWrap uwrap;
00125     TexWrap vwrap;
00126     TexFilter min_filter;
00127     TexFilter mag_filter;
00128     bool flip_u_coord;
00129     bool flip_v_coord;
00130     TexCoordType m_tex_coord_type;
00131   };
00132 
00134 
00140   void QRP_Compute_Texture_Coord(int quad_width, int quad_height, ObjectPtr<IOpenGLBaseTexture> tex, TexCoordXForm &texxform);
00141 
00142 }
00143 
00144 #endif // RENDERINGPIPE_H