texture_unit.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #include "api_gl1.h"
00035 #include "../Core/System/sharedptr.h"
00036 
00037 class CL_TextureUnit_GL1_Impl;
00038 class CL_Colorf;
00039 
00043 enum CL_TextureUnitMode
00044 {
00045         cl_unitmode_replace,
00046         cl_unitmode_modulate,
00047         cl_unitmode_decal,
00048         cl_unitmode_blend,
00049         cl_unitmode_add,
00050         cl_unitmode_combine
00051 };
00052 
00056 enum CL_TextureUnitRGBMode
00057 {
00058         cl_combinemode_rgb_replace,
00059         cl_combinemode_rgb_modulate,
00060         cl_combinemode_rgb_add,
00061         cl_combinemode_rgb_add_signed,
00062         cl_combinemode_rgb_interpolate,
00063         cl_combinemode_rgb_subtract,
00064         cl_combinemode_rgb_dot3_rgb,
00065         cl_combinemode_rgb_dot3_rgba
00066 };
00067 
00071 enum CL_TextureUnitAlphaMode
00072 {
00073         cl_combinemode_alpha_replace,
00074         cl_combinemode_alpha_modulate,
00075         cl_combinemode_alpha_add,
00076         cl_combinemode_alpha_add_signed,
00077         cl_combinemode_alpha_interpolate,
00078         cl_combinemode_alpha_subtract
00079 };
00080 
00084 enum CL_TextureUnitSource
00085 {
00086         cl_source_texture,
00087         cl_source_texture0,
00088         cl_source_texture1,
00089         cl_source_texture2,
00090         cl_source_texture3,
00091         cl_source_texture4,
00092         cl_source_texture5,
00093         cl_source_texture6,
00094         cl_source_texture7,
00095         cl_source_texture8,
00096         cl_source_texture9,
00097         cl_source_texture10,
00098         cl_source_texture11,
00099         cl_source_texture12,
00100         cl_source_texture13,
00101         cl_source_texture14,
00102         cl_source_texture15,
00103         cl_source_constant,
00104         cl_source_primary_color,
00105         cl_source_previous
00106 };
00107 
00111 enum CL_TextureUnitRGBOperand
00112 {
00113         cl_rgb_operand_src_color,
00114         cl_rgb_operand_one_minus_src_color,
00115         cl_rgb_operand_src_alpha,
00116         cl_rgb_operand_one_minus_src_alpha
00117 };
00118 
00122 enum CL_TextureUnitAlphaOperand
00123 {
00124         cl_alpha_operand_src_alpha,
00125         cl_alpha_operand_one_minus_src_alpha
00126 };
00127 
00128 class CL_Color;
00129 
00133 class CL_API_GL1 CL_TextureUnit_GL1
00134 {
00136 public:
00138         CL_TextureUnit_GL1();
00139 
00140         ~CL_TextureUnit_GL1();
00141 
00143 public:
00145         double get_lod_bias() const;
00146 
00148         CL_Colorf get_color() const;
00149 
00151         CL_TextureUnitMode get_mode() const;
00152 
00155         CL_TextureUnitRGBMode get_combine_rgb_mode() const;
00156 
00159         CL_TextureUnitAlphaMode get_combine_alpha_mode() const;
00160 
00162         CL_TextureUnitSource get_combine_arg_src_rgb(int arg) const;
00163 
00165         CL_TextureUnitRGBOperand get_combine_arg_operand_rgb(int arg) const;
00166 
00168         CL_TextureUnitSource get_combine_arg_src_alpha(int arg) const;
00169 
00171         CL_TextureUnitAlphaOperand get_combine_arg_operand_alpha(int arg) const;
00172 
00174         bool get_point_coord_replace() const;
00175 
00177 public:
00179         void set_lod_bias(double bias);
00180 
00182         void set_color(const CL_Colorf &color);
00183 
00185         void set_mode(CL_TextureUnitMode mode);
00186 
00189         void set_combine_mode(CL_TextureUnitRGBMode rgb_mode, CL_TextureUnitAlphaMode alpha_mode);
00190 
00192         void set_combine_arg(
00193                 int arg,
00194                 CL_TextureUnitSource src_rgb,
00195                 CL_TextureUnitRGBOperand operand_rgb,
00196                 CL_TextureUnitSource src_alpha,
00197                 CL_TextureUnitAlphaOperand operand_alpha);
00198 
00200         void set_combine_rgb_arg(int arg, CL_TextureUnitSource src_rgb, CL_TextureUnitRGBOperand operand_rgb);
00201 
00203         void set_combine_alpha_arg(int arg, CL_TextureUnitSource src_alpha, CL_TextureUnitAlphaOperand operand_alpha);
00204 
00206         void set_point_coord_replace(bool enable);
00207 
00209 private:
00210         CL_SharedPtr<CL_TextureUnit_GL1_Impl> impl;
00211 };
00212