texture_cube.h
1 /*
2 ** UICore
3 ** Copyright (c) 1997-2015 The UICore Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries UICore may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 */
29 
30 #pragma once
31 
32 #include "texture.h"
33 
34 namespace uicore
35 {
38  {
45  };
46 
48  class TextureCube : public virtual Texture
49  {
50  public:
54  static std::shared_ptr<TextureCube> create(const GraphicContextPtr &context, int width, int height, TextureFormat texture_format = tf_rgba8, int levels = 1);
55  static std::shared_ptr<TextureCube> create(const GraphicContextPtr &context, const Size &size, TextureFormat texture_format = tf_rgba8, int levels = 1);
56 
58  virtual int width() const = 0;
59 
61  virtual int height() const = 0;
62 
64  Size size() const { return Size(width(), height()); }
65 
71  virtual void set_image(const GraphicContextPtr &context, TextureCubeDirection cube_direction, const PixelBufferPtr &image, int level = 0) = 0;
72 
78  virtual void set_subimage(const GraphicContextPtr &context, TextureCubeDirection cube_direction, int x, int y, const PixelBufferPtr &image, const Rect &src_rect, int level = 0) = 0;
79  void set_subimage(const GraphicContextPtr &context, TextureCubeDirection cube_direction, const Point &point, const PixelBufferPtr &image, const Rect &src_rect, int level = 0)
80  {
81  set_subimage(context, cube_direction, point.x, point.y, image, src_rect, level);
82  }
83  };
84 }
Texture object class.
Definition: texture.h:94
2D (width,height) size structure - Integer
Definition: size.h:167
Definition: texture_cube.h:42
Size size() const
Get the texture size.
Definition: texture_cube.h:64
Type x
Definition: vec2.h:75
Definition: texture_cube.h:39
TextureFormat
Texture format.
Definition: texture_format.h:35
Definition: texture_format.h:38
Definition: texture_cube.h:44
virtual void set_image(const GraphicContextPtr &context, TextureCubeDirection cube_direction, const PixelBufferPtr &image, int level=0)=0
Upload image to texture.
2D (x,y) point structure - Integer
Definition: point.h:58
Type y
Definition: vec2.h:76
static std::shared_ptr< TextureCube > create(const GraphicContextPtr &context, int width, int height, TextureFormat texture_format=tf_rgba8, int levels=1)
Constructs a cube texture.
void set_subimage(const GraphicContextPtr &context, TextureCubeDirection cube_direction, const Point &point, const PixelBufferPtr &image, const Rect &src_rect, int level=0)
Definition: texture_cube.h:79
virtual int width() const =0
Get the texture width.
2D (left,top,right,bottom) rectangle structure - Integer
Definition: rect.h:491
2D texture cube object class.
Definition: texture_cube.h:48
TextureCubeDirection
Texture cube directions.
Definition: texture_cube.h:37
std::shared_ptr< PixelBuffer > PixelBufferPtr
Definition: d3d_target.h:39
virtual int height() const =0
Get the texture height.
std::shared_ptr< GraphicContext > GraphicContextPtr
Definition: d3d_target.h:49
Definition: texture_cube.h:40
virtual void set_subimage(const GraphicContextPtr &context, TextureCubeDirection cube_direction, int x, int y, const PixelBufferPtr &image, const Rect &src_rect, int level=0)=0
Upload image to sub texture.
Definition: texture_cube.h:43
Definition: Application/application.h:35
Definition: texture_cube.h:41