texture_3d.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 {
37  class Texture3D : public virtual Texture
38  {
39  public:
48  static std::shared_ptr<Texture3D> create(const GraphicContextPtr &context, int width, int height, int depth, TextureFormat texture_format = tf_rgba8, int levels = 1);
49  static std::shared_ptr<Texture3D> create(const GraphicContextPtr &context, const Vec3i &size, TextureFormat texture_format = tf_rgba8, int levels = 1);
50 
52  virtual int width() const = 0;
53 
55  virtual int height() const = 0;
56 
58  virtual int depth() const = 0;
59 
61  Vec3i size() const { return Vec3i(width(), height(), depth()); }
62 
64  virtual TextureWrapMode wrap_mode_s() const = 0;
65 
67  virtual TextureWrapMode wrap_mode_t() const = 0;
68 
70  virtual TextureWrapMode wrap_mode_r() const = 0;
71 
77  virtual void set_image(const GraphicContextPtr &context, const PixelBufferPtr &image, int depth, int level = 0) = 0;
78 
84  virtual void set_subimage(const GraphicContextPtr &context, int x, int y, int z, const PixelBufferPtr &image, const Rect &src_rect, int level = 0) = 0;
85 
87  virtual void set_wrap_mode(TextureWrapMode wrap_s, TextureWrapMode wrap_t, TextureWrapMode wrap_r) = 0;
88  };
89 }
virtual void set_wrap_mode(TextureWrapMode wrap_s, TextureWrapMode wrap_t, TextureWrapMode wrap_r)=0
Set the texture wrapping mode.
Texture object class.
Definition: texture.h:94
static std::shared_ptr< Texture3D > create(const GraphicContextPtr &context, int width, int height, int depth, TextureFormat texture_format=tf_rgba8, int levels=1)
Constructs a 3D texture.
Vec3< int > Vec3i
Definition: vec3.h:409
virtual TextureWrapMode wrap_mode_r() const =0
Get the texture wrap mode for the r coordinate.
virtual TextureWrapMode wrap_mode_t() const =0
Get the texture wrap mode for the t coordinate.
virtual TextureWrapMode wrap_mode_s() const =0
Get the texture wrap mode for the s coordinate.
virtual int width() const =0
Get the texture width.
TextureFormat
Texture format.
Definition: texture_format.h:35
Definition: texture_format.h:38
3D texture object class.
Definition: texture_3d.h:37
virtual int depth() const =0
Get the texture depth.
2D (left,top,right,bottom) rectangle structure - Integer
Definition: rect.h:491
virtual void set_image(const GraphicContextPtr &context, const PixelBufferPtr &image, int depth, int level=0)=0
Upload image to texture.
std::shared_ptr< PixelBuffer > PixelBufferPtr
Definition: d3d_target.h:39
std::shared_ptr< GraphicContext > GraphicContextPtr
Definition: d3d_target.h:49
virtual void set_subimage(const GraphicContextPtr &context, int x, int y, int z, const PixelBufferPtr &image, const Rect &src_rect, int level=0)=0
Upload image to sub texture.
TextureWrapMode
Texture coordinate wrapping modes.
Definition: texture.h:56
virtual int height() const =0
Get the texture height.
Definition: Application/application.h:35
Vec3i size() const
Get the texture size.
Definition: texture_3d.h:61