Panda3D
Loading...
Searching...
No Matches
panda
src
pgraph
texMatrixAttrib.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 texMatrixAttrib.I
10
* @author drose
11
* @date 2002-03-14
12
*/
13
14
/**
15
* Use TexMatrixAttrib::make() to construct a new TexMatrixAttrib object.
16
*/
17
INLINE TexMatrixAttrib::
18
TexMatrixAttrib() {
19
}
20
21
/**
22
* Use TexMatrixAttrib::make() to construct a new TexMatrixAttrib object.
23
*/
24
INLINE TexMatrixAttrib::
25
TexMatrixAttrib(
const
TexMatrixAttrib
©) :
26
_stages(copy._stages)
27
{
28
}
29
30
/**
31
* Returns the override value associated with the indicated stage.
32
*/
33
INLINE
int
TexMatrixAttrib::
34
get_override
(
TextureStage
*stage)
const
{
35
Stages::const_iterator si;
36
si = _stages.find(StageNode(stage));
37
if
(si != _stages.
end
()) {
38
return
(*si)._override;
39
}
40
nassert_raise(
"Specified TextureStage not included in attrib"
);
41
return
0;
42
}
43
44
/**
45
* Returns the union of the Geom::GeomRendering bits that will be required
46
* once this TexMatrixAttrib is applied to a geom which includes the indicated
47
* geom_rendering bits.
48
*/
49
INLINE
int
TexMatrixAttrib::
50
get_geom_rendering
(
int
geom_rendering)
const
{
51
if
((geom_rendering & Geom::GR_point_sprite) != 0) {
52
if
(!is_empty()) {
53
geom_rendering |= Geom::GR_point_sprite_tex_matrix;
54
}
55
}
56
57
return
geom_rendering;
58
}
59
60
/**
61
*
62
*/
63
INLINE TexMatrixAttrib::StageNode::
64
StageNode(
const
TextureStage
*stage) :
65
// Yeah, we cast away the constness here. Just too much trouble to deal
66
// with it properly.
67
_stage((
TextureStage
*)stage),
68
_override(0)
69
{
70
}
71
72
/**
73
* Compares the full attributes of StageNodes (as opposed to just the pointer
74
* compared by CompareTextureStagePointer, below).
75
*/
76
INLINE
bool
TexMatrixAttrib::StageNode::
77
operator < (
const
TexMatrixAttrib::StageNode &other)
const
{
78
if
(_stage != other._stage) {
79
return
_stage < other._stage;
80
}
81
if
(_transform != other._transform) {
82
return
_transform < other._transform;
83
}
84
return
_override < other._override;
85
}
86
87
/**
88
* This STL function object is used to sort a list of texture stages in order
89
* by pointer.
90
*/
91
INLINE
bool
TexMatrixAttrib::CompareTextureStagePointer::
92
operator () (
const
TexMatrixAttrib::StageNode &a,
93
const
TexMatrixAttrib::StageNode &b)
const
{
94
return
a._stage < b._stage;
95
}
TexMatrixAttrib
Applies a transform matrix to UV's before they are rendered.
Definition
texMatrixAttrib.h:30
TexMatrixAttrib::get_override
int get_override(TextureStage *stage) const
Returns the override value associated with the indicated stage.
Definition
texMatrixAttrib.I:34
TexMatrixAttrib::get_geom_rendering
int get_geom_rendering(int geom_rendering) const
Returns the union of the Geom::GeomRendering bits that will be required once this TexMatrixAttrib is ...
Definition
texMatrixAttrib.I:50
TextureStage
Defines the properties of a named stage of the multitexture pipeline.
Definition
textureStage.h:35
ordered_vector::end
iterator_0 end()
Returns the iterator that marks the end of the ordered vector.
Definition
ordered_vector.I:50
Generated on Mon Jan 8 2024 17:18:43 for Panda3D by
1.10.0