1namespace gli
2{
3	inline texture_cube_array::texture_cube_array()
4	{}
5
6	inline texture_cube_array::texture_cube_array(format_type Format, extent_type const& Extent, size_type Layers, swizzles_type const& Swizzles)
7		: texture(TARGET_CUBE_ARRAY, Format, texture::extent_type(Extent, 1), Layers, 6, gli::levels(Extent), Swizzles)
8	{}
9
10	inline texture_cube_array::texture_cube_array(format_type Format, extent_type const& Extent, size_type Layers, size_type Levels, swizzles_type const& Swizzles)
11		: texture(TARGET_CUBE_ARRAY, Format, texture::extent_type(Extent, 1), Layers, 6, Levels, Swizzles)
12	{}
13
14	inline texture_cube_array::texture_cube_array(texture const& Texture)
15		: texture(Texture, gli::TARGET_CUBE_ARRAY, Texture.format())
16	{}
17
18	inline texture_cube_array::texture_cube_array
19	(
20		texture const& Texture,
21		format_type Format,
22		size_type BaseLayer, size_type MaxLayer,
23		size_type BaseFace, size_type MaxFace,
24		size_type BaseLevel, size_type MaxLevel,
25		swizzles_type const& Swizzles
26	)
27		: texture(
28			Texture, TARGET_CUBE_ARRAY,
29			Format,
30			BaseLayer, MaxLayer,
31			BaseFace, MaxFace,
32			BaseLevel, MaxLevel,
33			Swizzles)
34	{}
35
36	inline texture_cube_array::texture_cube_array
37	(
38		texture_cube_array const& Texture,
39		size_type BaseLayer, size_type MaxLayer,
40		size_type BaseFace, size_type MaxFace,
41		size_type BaseLevel, size_type MaxLevel
42	)
43		: texture(
44			Texture, TARGET_CUBE_ARRAY, Texture.format(),
45			Texture.base_layer() + BaseLayer, Texture.base_layer() + MaxLayer,
46			Texture.base_face() + BaseFace, Texture.base_face() + MaxFace,
47			Texture.base_level() + BaseLevel, Texture.base_level() + MaxLevel)
48	{}
49
50	inline texture_cube texture_cube_array::operator[](size_type Layer) const
51	{
52		GLI_ASSERT(Layer < this->layers());
53
54		return texture_cube(
55			*this, this->format(),
56			this->base_layer() + Layer, this->base_layer() + Layer,
57			this->base_face(), this->max_face(),
58			this->base_level(), this->max_level());
59	}
60
61	inline texture_cube_array::extent_type texture_cube_array::extent(size_type Level) const
62	{
63		return extent_type(this->texture::extent(Level));
64	}
65
66	template <typename gen_type>
67	inline gen_type texture_cube_array::load(extent_type const& TexelCoord, size_type Layer, size_type Face, size_type Level) const
68	{
69		return this->texture::load<gen_type>(texture::extent_type(TexelCoord, 0), Layer, Face, Level);
70	}
71
72	template <typename gen_type>
73	inline void texture_cube_array::store(extent_type const& TexelCoord, size_type Layer, size_type Face, size_type Level, gen_type const& Texel)
74	{
75		this->texture::store<gen_type>(texture::extent_type(TexelCoord, 0), Layer, Face, Level, Texel);
76	}
77}//namespace gli
78