Panda3D
Loading...
Searching...
No Matches
paramTexture.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file paramTexture.I
10 * @author rdb
11 * @date 2014-12-11
12 */
13
14/**
15 * Creates a new ParamTextureSampler storing the given texture and sampler
16 * objects.
17 */
18INLINE ParamTextureSampler::
19ParamTextureSampler(Texture *tex, const SamplerState &sampler) :
20 _texture(tex),
21 _sampler(sampler)
22{
23}
24
25/**
26 * Returns Texture::get_class_type(), even though it technically stores more
27 * than just a Texture.
28 */
30get_value_type() const {
31 return Texture::get_class_type();
32}
33
34/**
35 * Retrieves the texture stored in the parameter.
36 */
38get_texture() const {
39 return _texture;
40}
41
42/**
43 * Retrieves the sampler state stored in the parameter.
44 */
46get_sampler() const {
47 return _sampler;
48}
49
50/**
51 * Creates a new ParamTextureImage storing the given texture and image binding
52 * parameters.
53 */
54INLINE ParamTextureImage::
55ParamTextureImage(Texture *tex, bool read, bool write, int z, int n) :
56 _texture(tex),
57 _access(0),
58 _bind_level((std::min)(n, 127)),
59 _bind_layer(z)
60{
61 if (read) {
62 _access |= A_read;
63 }
64 if (write) {
65 _access |= A_write;
66 }
67 if (z < 0) {
68 _bind_layer = 0;
69 _access |= A_layered;
70 }
71}
72
73/**
74 * Returns Texture::get_class_type(), even though it technically stores more
75 * than just a Texture.
76 */
78get_value_type() const {
79 return Texture::get_class_type();
80}
81
82/**
83 * Retrieves the texture stored in the parameter.
84 */
86get_texture() const {
87 return _texture;
88}
89
90/**
91 * Returns true if this image should be bound with read access enabled.
92 */
93INLINE bool ParamTextureImage::
94has_read_access() const {
95 return (_access & A_read) != 0;
96}
97
98/**
99 * Returns true if this image should be bound with write access enabled.
100 */
101INLINE bool ParamTextureImage::
102has_write_access() const {
103 return (_access & A_write) != 0;
104}
105
106/**
107 * Returns true if all layers of this image should be bound simultaneously.
108 */
109INLINE bool ParamTextureImage::
110get_bind_layered() const {
111 return (_access & A_layered) != 0;
112}
113
114/**
115 * Returns the image level that should be bound.
116 */
117INLINE int ParamTextureImage::
118get_bind_level() const {
119 return _bind_level;
120}
121
122/**
123 * Returns the image layer that should be bound. This is undefined if
124 * get_bind_layered() returns false.
125 */
126INLINE int ParamTextureImage::
127get_bind_layer() const {
128 return _bind_layer;
129}
get_texture
Retrieves the texture stored in the parameter.
virtual TypeHandle get_value_type() const
Returns Texture::get_class_type(), even though it technically stores more than just a Texture.
has_write_access
Returns true if this image should be bound with write access enabled.
has_read_access
Returns true if this image should be bound with read access enabled.
get_bind_level
Returns the image level that should be bound.
get_bind_layered
Returns true if all layers of this image should be bound simultaneously.
get_bind_layer
Returns the image layer that should be bound.
virtual TypeHandle get_value_type() const
Returns Texture::get_class_type(), even though it technically stores more than just a Texture.
get_texture
Retrieves the texture stored in the parameter.
get_sampler
Retrieves the sampler state stored in the parameter.
Represents a set of settings that indicate how a texture is sampled.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition texture.h:72
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
STL namespace.