Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
OpenSceneGraph
Commits
c29e2e4f
Commit
c29e2e4f
authored
May 03, 2020
by
Robert Osfield
Browse files
Fixed handling of non Texture texture attributes.
parent
d40ab364
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/osg/StateSet
View file @
c29e2e4f
...
...
@@ -598,9 +598,15 @@ class OSG_EXPORT StateSet : public Object
void
setAttribute
(
AttributeList
&
attributeList
,
StateAttribute
*
attribute
,
StateAttribute
::
OverrideValue
value
=
StateAttribute
::
OFF
);
StateAttribute
*
getAttribute
(
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
);
const
StateAttribute
*
getAttribute
(
const
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
)
const
;
StateAttribute
*
getAttribute
(
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
,
unsigned
int
member
);
const
StateAttribute
*
getAttribute
(
const
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
,
unsigned
int
member
)
const
;
RefAttributePair
*
getAttributePair
(
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
);
const
RefAttributePair
*
getAttributePair
(
const
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
)
const
;
RefAttributePair
*
getAttributePair
(
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
,
unsigned
int
member
);
const
RefAttributePair
*
getAttributePair
(
const
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
,
unsigned
int
member
)
const
;
...
...
src/osg/StateSet.cpp
View file @
c29e2e4f
...
...
@@ -1565,27 +1565,27 @@ void StateSet::removeTextureAttribute(unsigned int unit, StateAttribute* attribu
StateAttribute
*
StateSet
::
getTextureAttribute
(
unsigned
int
unit
,
StateAttribute
::
Type
type
)
{
if
(
unit
>=
_textureAttributeList
.
size
())
return
0
;
return
getAttribute
(
_textureAttributeList
[
unit
],
type
,
unit
);
return
getAttribute
(
_textureAttributeList
[
unit
],
type
);
}
const
StateAttribute
*
StateSet
::
getTextureAttribute
(
unsigned
int
unit
,
StateAttribute
::
Type
type
)
const
{
if
(
unit
>=
_textureAttributeList
.
size
())
return
0
;
return
getAttribute
(
_textureAttributeList
[
unit
],
type
,
unit
);
return
getAttribute
(
_textureAttributeList
[
unit
],
type
);
}
StateSet
::
RefAttributePair
*
StateSet
::
getTextureAttributePair
(
unsigned
int
unit
,
StateAttribute
::
Type
type
)
{
if
(
unit
>=
_textureAttributeList
.
size
())
return
0
;
return
getAttributePair
(
_textureAttributeList
[
unit
],
type
,
unit
);
return
getAttributePair
(
_textureAttributeList
[
unit
],
type
);
}
const
StateSet
::
RefAttributePair
*
StateSet
::
getTextureAttributePair
(
unsigned
int
unit
,
StateAttribute
::
Type
type
)
const
{
if
(
unit
>=
_textureAttributeList
.
size
())
return
0
;
return
getAttributePair
(
_textureAttributeList
[
unit
],
type
,
unit
);
return
getAttributePair
(
_textureAttributeList
[
unit
],
type
);
}
bool
StateSet
::
checkValidityOfAssociatedModes
(
osg
::
State
&
state
)
const
...
...
@@ -1913,6 +1913,28 @@ void StateSet::setAttribute(AttributeList& attributeList,StateAttribute *attribu
}
StateAttribute
*
StateSet
::
getAttribute
(
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
)
{
for
(
AttributeList
::
iterator
itr
=
attributeList
.
begin
();
itr
!=
attributeList
.
end
();
++
itr
)
{
if
(
itr
->
first
.
first
==
type
)
return
itr
->
second
.
first
.
get
();
}
return
NULL
;
}
const
StateAttribute
*
StateSet
::
getAttribute
(
const
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
)
const
{
for
(
AttributeList
::
const_iterator
itr
=
attributeList
.
begin
();
itr
!=
attributeList
.
end
();
++
itr
)
{
if
(
itr
->
first
.
first
==
type
)
return
itr
->
second
.
first
.
get
();
}
return
NULL
;
}
StateAttribute
*
StateSet
::
getAttribute
(
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
,
unsigned
int
member
)
{
AttributeList
::
iterator
itr
=
attributeList
.
find
(
StateAttribute
::
TypeMemberPair
(
type
,
member
));
...
...
@@ -1935,6 +1957,28 @@ const StateAttribute* StateSet::getAttribute(const AttributeList& attributeList,
return
NULL
;
}
StateSet
::
RefAttributePair
*
StateSet
::
getAttributePair
(
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
)
{
for
(
AttributeList
::
iterator
itr
=
attributeList
.
begin
();
itr
!=
attributeList
.
end
();
++
itr
)
{
if
(
itr
->
first
.
first
==
type
)
return
&
(
itr
->
second
);
}
return
NULL
;
}
const
StateSet
::
RefAttributePair
*
StateSet
::
getAttributePair
(
const
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
)
const
{
for
(
AttributeList
::
const_iterator
itr
=
attributeList
.
begin
();
itr
!=
attributeList
.
end
();
++
itr
)
{
if
(
itr
->
first
.
first
==
type
)
return
&
(
itr
->
second
);
}
return
NULL
;
}
StateSet
::
RefAttributePair
*
StateSet
::
getAttributePair
(
AttributeList
&
attributeList
,
StateAttribute
::
Type
type
,
unsigned
int
member
)
{
AttributeList
::
iterator
itr
=
attributeList
.
find
(
StateAttribute
::
TypeMemberPair
(
type
,
member
));
...
...
@@ -1959,7 +2003,6 @@ const StateSet::RefAttributePair* StateSet::getAttributePair(const AttributeList
void
StateSet
::
setUpdateCallback
(
Callback
*
ac
)
{
//OSG_INFO<<"Setting StateSet callbacks"<<std::endl;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment