primitives_array.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 **    Harry Storbacka
00028 **    Mark Page
00029 **    Kenneth Gangstoe
00030 **
00031 */
00032 
00035 
00036 #pragma once
00037 
00038 #include "../api_display.h"
00039 #include "../../Core/System/sharedptr.h"
00040 #include "../../Core/Math/vec3.h"
00041 
00042 class CL_GraphicContext;
00043 class CL_Colorf;
00044 class CL_Colorf;
00045 class CL_GraphicContext;
00046 class CL_VertexArrayBuffer;
00047 class CL_PrimitivesArray_Impl;
00048 
00052 enum CL_VertexAttributeDataType
00053 {
00054         cl_type_unsigned_byte,
00055         cl_type_unsigned_short,
00056         cl_type_unsigned_int,
00057         cl_type_byte,
00058         cl_type_short,
00059         cl_type_int,
00060         cl_type_float
00061 };
00062 
00068 enum CL_StandardAttributeIndex
00069 {
00070         cl_attrib_position = 0,
00071         cl_attrib_color = 1,
00072         cl_attrib_texture_position = 2,
00073         cl_attrib_texture_index = 3,
00074         cl_attrib_normal = 4    // The normal vector (Currently only used by the GL1 target)
00075 };
00076 
00082 class CL_PrimitivesArray
00083 {
00086 public:
00088         CL_PrimitivesArray();
00089 
00093         CL_PrimitivesArray(CL_GraphicContext &gc);
00094 
00095         ~CL_PrimitivesArray();
00096 
00100 public:
00102         bool is_null() const { return !impl; }
00103 
00105         void throw_if_null() const;
00106 
00107 
00111 public:
00112 
00117         void set_attribute(int index, const CL_Vec1ub &value);
00118 
00123         void set_attribute(int index, const CL_Vec1b &value);
00124 
00129         void set_attribute(int index, const CL_Vec1us &value);
00130 
00135         void set_attribute(int index, const CL_Vec1s &value);
00136 
00141         void set_attribute(int index, const CL_Vec1ui &value);
00142 
00147         void set_attribute(int index, const CL_Vec1i &value);
00148 
00153         void set_attribute(int index, const CL_Vec1f &value);
00154 
00159         void set_attribute(int index, const CL_Vec2ub &value);
00160 
00165         void set_attribute(int index, const CL_Vec2b &value);
00166 
00171         void set_attribute(int index, const CL_Vec2us &value);
00172 
00177         void set_attribute(int index, const CL_Vec2s &value);
00178 
00183         void set_attribute(int index, const CL_Vec2ui &value);
00184 
00189         void set_attribute(int index, const CL_Vec2i &value);
00190 
00195         void set_attribute(int index, const CL_Vec2f &value);
00196 
00201         void set_attribute(int index, const CL_Vec3ub &value);
00202 
00207         void set_attribute(int index, const CL_Vec3b &value);
00208 
00213         void set_attribute(int index, const CL_Vec3us &value);
00214 
00219         void set_attribute(int index, const CL_Vec3s &value);
00220 
00225         void set_attribute(int index, const CL_Vec3ui &value);
00226 
00231         void set_attribute(int index, const CL_Vec3i &value);
00232 
00237         void set_attribute(int index, const CL_Vec3f &value);
00238 
00244         void set_attribute(int index, const CL_Vec4ub &value, bool normalize = false);
00245 
00251         void set_attribute(int index, const CL_Vec4b &value, bool normalize = false);
00252 
00258         void set_attribute(int index, const CL_Vec4us &value, bool normalize = false);
00259 
00265         void set_attribute(int index, const CL_Vec4s &value, bool normalize = false);
00266 
00272         void set_attribute(int index, const CL_Vec4ui &value, bool normalize = false);
00273 
00279         void set_attribute(int index, const CL_Vec4i &value, bool normalize = false);
00280 
00285         void set_attribute(int index, const CL_Vec4f &value);
00286 
00291         void set_attribute(int index, const CL_Colorf &value);
00292 
00302         void set_attributes(int index, CL_VertexArrayBuffer &buffer, int size, CL_VertexAttributeDataType type, void *offset = 0, int stride = 0, bool normalize = false);
00303 
00309         void set_attributes(int index, const CL_Vec1ub * const values, int stride = 0);
00310 
00316         void set_attributes(int index, const CL_Vec1b * const values, int stride = 0);
00317 
00323         void set_attributes(int index, const CL_Vec1us * const values, int stride = 0);
00324 
00330         void set_attributes(int index, const CL_Vec1s * const values, int stride = 0);
00331 
00337         void set_attributes(int index, const CL_Vec1ui * const values, int stride = 0);
00338 
00344         void set_attributes(int index, const CL_Vec1i * const values, int stride = 0);
00345 
00351         void set_attributes(int index, const CL_Vec1f * const values, int stride = 0);
00352 
00358         void set_attributes(int index, const CL_Vec2ub * const values, int stride = 0);
00359 
00365         void set_attributes(int index, const CL_Vec2b * const values, int stride = 0);
00366 
00372         void set_attributes(int index, const CL_Vec2us * const values, int stride = 0);
00373 
00379         void set_attributes(int index, const CL_Vec2s * const values, int stride = 0);
00380 
00386         void set_attributes(int index, const CL_Vec2ui * const values, int stride = 0);
00387 
00393         void set_attributes(int index, const CL_Vec2i * const values, int stride = 0);
00394 
00400         void set_attributes(int index, const CL_Vec2f * const values, int stride = 0);
00401 
00407         void set_attributes(int index, const CL_Vec3ub * const values, int stride = 0);
00408 
00414         void set_attributes(int index, const CL_Vec3b * const values, int stride = 0);
00415 
00421         void set_attributes(int index, const CL_Vec3us * const values, int stride = 0);
00422 
00428         void set_attributes(int index, const CL_Vec3s * const values, int stride = 0);
00429 
00435         void set_attributes(int index, const CL_Vec3ui * const values, int stride = 0);
00436 
00442         void set_attributes(int index, const CL_Vec3i * const values, int stride = 0);
00443 
00449         void set_attributes(int index, const CL_Vec3f * const values, int stride = 0);
00450 
00457         void set_attributes(int index, const CL_Vec4ub * const values, int stride = 0, bool normalize = false);
00458 
00465         void set_attributes(int index, const CL_Vec4b * const values, int stride = 0, bool normalize = false);
00466 
00473         void set_attributes(int index, const CL_Vec4us * const values, int stride = 0, bool normalize = false);
00474 
00481         void set_attributes(int index, const CL_Vec4s * const values, int stride = 0, bool normalize = false);
00482 
00489         void set_attributes(int index, const CL_Vec4ui * const values, int stride = 0, bool normalize = false);
00490 
00497         void set_attributes(int index, const CL_Vec4i * const values, int stride = 0, bool normalize = false);
00498 
00504         void set_attributes(int index, const CL_Vec4f * const values, int stride = 0);
00505 
00509 private:
00510         CL_SharedPtr<CL_PrimitivesArray_Impl> impl;
00511 
00512         friend class CL_GraphicContext;
00513         friend class CL_PrimitivesArrayBuilder;
00515 };
00516