Graphics v0.0.0
A simple abstraction layer for the modern graphics APIs.
载入中...
搜索中...
未找到
Texture类 参考abstract

纹理. 更多...

#include <Texture.h>

类 Texture 继承关系图:
GLTexture

Public 类型

enum class  Filter { Nearest , Bilinear , Trilinear }
 
enum class  Warp { Repeat , ClampToEdge , MirrorRepeat }
 
enum class  Type { _2D , _3D , Cube }
 

Public 成员函数

virtual void bind (uint32_t binding)=0
 
virtual void set_min_filter (Filter filter)=0
 设置缩小过滤方式. 更多...
 
virtual void set_mag_filter (Filter filter)=0
 设置放大过滤方式. 更多...
 
virtual void set_s_warp (Warp warp)=0
 设置 S 环绕方式. 更多...
 
virtual void set_t_warp (Warp warp)=0
 设置 T 环绕方式. 更多...
 
virtual void set_r_warp (Warp warp)=0
 设置 R 环绕方式. 更多...
 
Type get_type () const
 获取纹理类型.
 
Format get_format () const
 获取像素格式.
 

静态 Public 成员函数

static std::shared_ptr< Texturecreate (const std::filesystem::path &path, Format fmt=Format::Unknown, uint32_t mipmapLevel=-1, Type type=Type::_2D)
 从图像文件创建纹理. 更多...
 
static std::shared_ptr< Texturecreate (const Image &image, Format fmt=Format::Unknown, uint32_t mipmapLevel=-1, Type type=Type::_2D)
 从图像创建纹理. 更多...
 
static std::shared_ptr< Texturecreate (const std::vector< Image > &images)
 从图像创建立方体纹理. 更多...
 

Protected 成员函数

 Texture (Type type, Format fmt)
 

Protected 属性

Type type_
 
Format format_
 

静态 Protected 属性

static std::unordered_map< std::filesystem::path, std::shared_ptr< Texture > > cache_
 

详细描述

纹理.

成员枚举类型说明

◆ Filter

enum class Texture::Filter
strong
枚举值
Nearest 

最近点采样, 临近过滤.

Bilinear 

双线性过滤.

Trilinear 

三线性过滤.

◆ Warp

enum class Texture::Warp
strong
枚举值
Repeat 

重复.

ClampToEdge 

超出边界后重复边缘, 产生边缘被拉伸的效果.

MirrorRepeat 

镜像重复, 正像/镜像交替.

成员函数说明

◆ create() [1/3]

std::shared_ptr< Texture > Texture::create ( const Image image,
Format  fmt = Format::Unknown,
uint32_t  mipmapLevel = -1,
Type  type = Type::_2D 
)
static

从图像创建纹理.

参数
image图像.
fmt纹理格式.
mipmapLevel多级渐远纹理等级.
type纹理类型.

◆ create() [2/3]

static std::shared_ptr< Texture > Texture::create ( const std::filesystem::path &  path,
Format  fmt = Format::Unknown,
uint32_t  mipmapLevel = -1,
Type  type = Type::_2D 
)
static

从图像文件创建纹理.

参数
path图像文件路径.
fmt纹理格式.
mipmapLevel多级渐远纹理等级.
type纹理类型.

◆ create() [3/3]

std::shared_ptr< Texture > Texture::create ( const std::vector< Image > &  images)
static

从图像创建立方体纹理.

参数
images图像.
type纹理类型.

◆ set_mag_filter()

virtual void Texture::set_mag_filter ( Filter  filter)
pure virtual

设置放大过滤方式.

参数
filter过滤方式, 可选的值有 Nearest, Bilinear.

GLTexture 内被实现.

◆ set_min_filter()

virtual void Texture::set_min_filter ( Filter  filter)
pure virtual

设置缩小过滤方式.

参数
filter过滤方式, 可选的值有 Nearest, Bilinear, Trilinear.

GLTexture 内被实现.

◆ set_r_warp()

virtual void Texture::set_r_warp ( Warp  warp)
pure virtual

设置 R 环绕方式.

参数
warp环绕方式.

GLTexture 内被实现.

◆ set_s_warp()

virtual void Texture::set_s_warp ( Warp  warp)
pure virtual

设置 S 环绕方式.

参数
warp环绕方式.

GLTexture 内被实现.

◆ set_t_warp()

virtual void Texture::set_t_warp ( Warp  warp)
pure virtual

设置 T 环绕方式.

参数
warp环绕方式.

GLTexture 内被实现.

类成员变量说明

◆ cache_

std::unordered_map<std::filesystem::path, std::shared_ptr<Texture> > Texture::cache_
inlinestaticprotected

FIXME:

  1. 内存泄露.
  2. 数据相同的纹理其他属性(如寻址方式)可能不同.

该类的文档由以下文件生成: