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 */
29INLINE TypeHandle ParamTextureSampler::
30 get_value_type() const {
31 return Texture::get_class_type();
32}
33
34/**
35 * Retrieves the texture stored in the parameter.
36 */
37INLINE Texture *ParamTextureSampler::
38 get_texture() const {
39 return _texture;
40}
41
42/**
43 * Retrieves the sampler state stored in the parameter.
44 */
45INLINE const SamplerState &ParamTextureSampler::
46 get_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 */
77INLINE TypeHandle ParamTextureImage::
78 get_value_type() const {
79 return Texture::get_class_type();
80}
81
82/**
83 * Retrieves the texture stored in the parameter.
84 */
85INLINE Texture *ParamTextureImage::
86 get_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::
94 has_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::
102 has_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::
110 get_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::
118 get_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::
127 get_bind_layer() const {
128 return _bind_layer;
129}
ParamTextureImage::get_texture
get_texture
Retrieves the texture stored in the parameter.
Definition paramTexture.h:103
ParamTextureImage::get_value_type
virtual TypeHandle get_value_type() const
Returns Texture::get_class_type(), even though it technically stores more than just a Texture.
Definition paramTexture.I:78
ParamTextureImage::has_write_access
has_write_access
Returns true if this image should be bound with write access enabled.
Definition paramTexture.h:105
ParamTextureImage::has_read_access
has_read_access
Returns true if this image should be bound with read access enabled.
Definition paramTexture.h:104
ParamTextureImage::get_bind_level
get_bind_level
Returns the image level that should be bound.
Definition paramTexture.h:106
ParamTextureImage::get_bind_layered
get_bind_layered
Returns true if all layers of this image should be bound simultaneously.
Definition paramTexture.h:107
ParamTextureImage::get_bind_layer
get_bind_layer
Returns the image layer that should be bound.
Definition paramTexture.h:107
ParamTextureSampler::get_value_type
virtual TypeHandle get_value_type() const
Returns Texture::get_class_type(), even though it technically stores more than just a Texture.
Definition paramTexture.I:30
ParamTextureSampler::get_texture
get_texture
Retrieves the texture stored in the parameter.
Definition paramTexture.h:37
ParamTextureSampler::get_sampler
get_sampler
Retrieves the sampler state stored in the parameter.
Definition paramTexture.h:38
SamplerState
Represents a set of settings that indicate how a texture is sampled.
Definition samplerState.h:36
Texture
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
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
std
STL namespace.