cgv
Loading...
Searching...
No Matches
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
8namespace cgv {
9 namespace render {
10
13{
14public:
16 enum AlphaTestFunc { AT_ALWAYS, AT_LESS, AT_EQUAL, AT_GREATER };
17protected:
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;
24public:
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>
simple class to hold the material properties of a phong material
base class for all drawables, which is independent of the used rendering API.
Definition context.h:621
the texture class encapsulates all functionality independent of the rendering api.
Definition texture.h:15
class that extends obj_material with the management of textures
AlphaTestFunc
different test functions for alpha test
size_t get_nr_textures() const
virtual method to query number of textures
the cgv namespace
Definition print.h:11