3#include <cgv/data/data_format.h>
4#include <cgv/data/data_view.h>
5#include <cgv/render/context.h>
17 mutable bool state_out_of_date;
19 bool complete_create(
const context& ctx,
bool created);
29 texture(
const std::string& description =
"uint8[R,G,B,A]",
60 void set_border_color(
float r,
float g,
float b,
float a = 1.0f);
65 void set_min_filter(
TextureFilter _min_filter,
float _anisotropy = 2.0f);
69 float get_anisotropy()
const;
75 void set_priority(
float _priority);
77 float get_priority()
const;
79 void set_compare_mode(
bool use_compare_function);
81 bool get_compare_mode()
const;
87 bool mipmaps_created()
const;
89 void set_nr_multi_samples(
unsigned _nr_samples);
95 void set_fixed_sample_locations(
bool use);
97 void ensure_state(
const context& ctx)
const;
99 bool is_enabled()
const;
101 int get_tex_unit()
const;
107 void find_best_format(
const context& ctx,
const std::vector<cgv::data::data_view>* palettes = 0);
112 bool create(
const context& ctx,
TextureType _tt = TT_UNDEF,
unsigned width=-1,
unsigned height=-1,
unsigned depth=-1);
122 bool create_from_image(
const context& ctx,
const std::string& file_name =
"",
123 int* image_width_ptr = 0,
int* image_height_ptr = 0,
124 unsigned char* clear_color_ptr = 0,
int level = -1,
int cube_side = -1);
129 unsigned char* clear_color_ptr = 0,
int level = -1,
int cube_side = -1);
133 static bool deduce_file_names(
const std::string& file_names, std::vector<std::string>& deduced_names);
152 bool create_from_images(
const context& ctx,
const std::string& file_names,
int level = -1);
154 bool write_to_file(
context& ctx,
const std::string& file_name,
unsigned int z_or_cube_side = -1,
float depth_map_gamma = 1.0f,
const std::string& options =
"")
const;
156 bool create_mipmaps(
const context& ctx);
159 bool generate_mipmaps(
const context& ctx);
165 bool create_from_buffer(
const context& ctx,
int x,
int y,
int width,
int height,
int level = -1);
178 bool create(
const context& ctx,
const cgv::data::const_data_view&
data,
int level = -1,
int cube_side = -1,
int num_array_layers = 0,
const std::vector<cgv::data::data_view>* palettes = 0);
193 bool replace_from_buffer(
const context& ctx,
int x,
int y,
int x_buffer,
194 int y_buffer,
int width,
int height,
int level = -1);
196 bool replace_from_buffer(
const context& ctx,
int x,
int y,
int z_or_cube_side,
int x_buffer,
197 int y_buffer,
int width,
int height,
int level);
199 bool replace_from_image(
const context& ctx,
const std::string& file_name,
int x,
int y,
int z_or_cube_side,
int level);
203 const std::string& file_name,
int x,
int y,
int z_or_cube_side,
int level);
208 bool destruct(
const context& ctx);
215 bool enable(
const context& ctx,
int tex_unit = -1);
217 bool disable(
const context& ctx);
227 bool bind_as_image(
const context& ctx,
int tex_unit,
int level = 0,
bool bind_array =
false,
int layer = 0,
AccessType access = AT_WRITE_ONLY);
234#include <cgv/config/lib_end.h>
The const_data_view has the functionality of the data_view but uses a const pointer and therefore doe...
the data view gives access to a data array of one, two, three or four dimensions.
base class for all drawables, which is independent of the used rendering API.
std::string last_error
a string that contains the last error
texture_base(TextureType _tt=TT_UNDEF)
initialize members
TextureWrap get_wrap_s() const
return the texture wrap behaviour in s direction
bool set_data_format(const std::string &description)
change the data format and clear internal format
TextureWrap get_wrap_r() const
return the texture wrap behaviour in r direction
bool use_fixed_sample_locations() const
whether multi sampling uses fixed sample locations
texture(const std::string &description="uint8[R,G,B,A]", TextureFilter _mag_filter=TF_LINEAR, TextureFilter _min_filter=TF_LINEAR, TextureWrap _wrap_s=TW_CLAMP_TO_EDGE, TextureWrap _wrap_t=TW_CLAMP_TO_EDGE, TextureWrap _wrap_r=TW_CLAMP_TO_EDGE)
construct from description string (which defaults to rgba format) and most commonly used texture para...
void set_wrap_t(TextureWrap _wrap_t)
set the texture wrap behaviour in t direction
void set_wrap_s(TextureWrap _wrap_s)
set the texture wrap behaviour in s direction
void set_component_format(const component_format &cf)
change component format and clear internal format
void set_border_color(const float *rgba)
set the border color
TextureWrap get_wrap_t() const
return the texture wrap behaviour in t direction
void set_wrap_r(TextureWrap _wrap_r)
set the texture wrap behaviour in r direction
unsigned get_nr_multi_samples() const
return number of multi samples for textures of type TT_MULTISAMPLE_2D and TT_MULTISAMPLE_2D_ARRAY
namespace for data management components
namespace for api independent GPU programming
AccessType
different access types
TextureFilter
different texture filter
TextureWrap
different texture wrap modes
TextureType
different texture types
CompareFunction
different comparison functions used for depth testing or texture comparisons
this header is dependency free
cgv::math::fvec< float, 4 > vec4
declare type of 4d single precision floating point vectors (used for homogeneous coordinates)
cgv::media::color< float, cgv::media::RGB, cgv::media::OPACITY > rgba
declare rgba color type with 32 bit components