cgv
textured_material.h
1 #pragma once
2 
3 #include <cgv/media/illum/textured_surface_material.h>
4 #include "texture.h"
5 
6 #include "lib_begin.h"
7 
8 namespace cgv {
9  namespace render {
10 
13 {
14 public:
16  enum AlphaTestFunc { AT_ALWAYS, AT_LESS, AT_EQUAL, AT_GREATER };
17 protected:
18  std::vector<texture*> textures;
19  // store context pointer to destruct textures
20  context* ctx_ptr;
21 
22  float alpha_threshold;
23  AlphaTestFunc alpha_test_func;
24 public:
28  virtual ~textured_material();
32  void set_alpha_test(AlphaTestFunc _alpha_test_func = AT_GREATER, float _alpha_threshold = 0.0f);
34  AlphaTestFunc get_alpha_test_func() const;
36  float get_alpha_threshold() const;
38  AlphaTestFunc& ref_alpha_test_func();
40  float& ref_alpha_threshold();
42  bool ensure_textures(context& ctx);
44 
46  int add_texture_reference(cgv::render::texture& tex);
48  size_t get_nr_textures() const { return textures.size(); }
49 
51  texture* get_texture(int texture_index) const;
53  void enable_textures(context& ctx);
55  void disable_textures(context& ctx);
57  void destruct_textures(context& ctx);
58 };
59 
60  }
61 }
62 
63 #include <cgv/config/lib_end.h>
cgv::render::texture
Definition: texture.h:15
cgv::render::textured_material
class that extends obj_material with the management of textures
Definition: textured_material.h:13
cgv::render::textured_material::AlphaTestFunc
AlphaTestFunc
different test functions for alpha test
Definition: textured_material.h:16
cgv::render::textured_material::get_nr_textures
size_t get_nr_textures() const
virtual method to query number of textures
Definition: textured_material.h:48
cgv::media::illum::textured_surface_material
simple class to hold the material properties of a phong material
Definition: textured_surface_material.h:15
cgv
the cgv namespace
Definition: vr_calib.cxx:9
cgv::render::context
Definition: context.h:525