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
Joseph Mirabel
gepetto-viewer
Commits
3bea0460
Commit
3bea0460
authored
May 06, 2020
by
Joseph Mirabel
Browse files
Fix compilation with old OSG version.
parent
44555898
Pipeline
#9473
failed with stage
in 4 minutes and 55 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
include/gepetto/viewer/properties.h
View file @
3bea0460
...
...
@@ -16,17 +16,17 @@ namespace viewer {
class
BackfaceDrawingProperty
:
public
Property
{
public:
typedef
osg
::
NodeRefPtr
Node
RefPtr
;
typedef
osg
::
StateSetRefPtr
StateSet
RefPtr
;
bool
hasReadAccess
()
const
{
return
static_cast
<
bool
>
(
node
_
);
}
bool
hasWriteAccess
()
const
{
return
static_cast
<
bool
>
(
node
_
);
}
bool
hasReadAccess
()
const
{
return
static_cast
<
bool
>
(
stateSet
_
);
}
bool
hasWriteAccess
()
const
{
return
static_cast
<
bool
>
(
stateSet
_
);
}
std
::
string
type
()
{
return
details
::
property_type
<
bool
>::
to_string
();
}
BackfaceDrawingProperty
()
:
Property
(
"BackfaceDrawing"
)
{}
void
node
(
const
NodeRefPtr
&
node
)
{
node_
=
node
;
}
NodeRefPtr
node
()
const
{
return
node
_
;
}
void
stateSet
(
const
StateSetRefPtr
&
stateSet
)
{
stateSet_
=
stateSet
;
}
StateSetRefPtr
stateSet
()
const
{
return
stateSet
_
;
}
virtual
QWidget
*
guiEditor
()
{
...
...
@@ -38,7 +38,7 @@ class BackfaceDrawingProperty : public Property
bool
impl_get
(
bool
&
value
);
private:
NodeRefPtr
node
_
;
osg
::
StateSetRefPtr
stateSet
_
;
};
}
/* namespace viewer */
...
...
src/gui/point-intersector.cc
View file @
3bea0460
...
...
@@ -71,7 +71,12 @@ osgUtil::Intersector* PointIntersector::clone( osgUtil::IntersectionVisitor& iv
void
PointIntersector
::
intersect
(
osgUtil
::
IntersectionVisitor
&
iv
,
osg
::
Drawable
*
drawable
)
{
osg
::
BoundingBox
bb
=
drawable
->
getBoundingBox
();
osg
::
BoundingBox
bb
=
#if OSG_VERSION_LESS_THAN(3,3,3)
drawable
->
getBound
();
#else
drawable
->
getBoundingBox
();
#endif
bb
.
xMin
()
-=
_pickBias
;
bb
.
xMax
()
+=
_pickBias
;
bb
.
yMin
()
-=
_pickBias
;
bb
.
yMax
()
+=
_pickBias
;
bb
.
zMin
()
-=
_pickBias
;
bb
.
zMax
()
+=
_pickBias
;
...
...
src/leaf-node-collada.cpp
View file @
3bea0460
...
...
@@ -169,7 +169,7 @@ namespace viewer {
collada_ptr_
->
setDataVariance
(
osg
::
Object
::
STATIC
);
}
collada_ptr_
->
setName
(
"meshfile"
);
backfaceDrawing_
.
node
(
collada_ptr_
);
backfaceDrawing_
.
stateSet
(
collada_ptr_
->
getOrCreateStateSet
()
);
backfaceDrawing_
.
set
(
false
);
/* Create PositionAttitudeTransform */
...
...
src/leaf-node-line.cpp
View file @
3bea0460
...
...
@@ -42,7 +42,7 @@ namespace viewer {
{
/* Init the beam as a Geometry */
beam_ptr_
=
new
::
osg
::
Geometry
();
backfaceDrawing_
.
node
(
beam_ptr_
);
backfaceDrawing_
.
stateSet
(
beam_ptr_
->
getOrCreateStateSet
()
);
backfaceDrawing_
.
set
(
false
);
/* Define points of the beam */
...
...
@@ -72,10 +72,10 @@ namespace viewer {
/* Set a default line width */
osg
::
LineWidth
*
linewidth
=
new
osg
::
LineWidth
();
linewidth
->
setWidth
(
1.0
f
);
beam_ptr_
->
get
OrCreate
StateSet
()
->
setAttributeAndModes
(
linewidth
,
osg
::
StateAttribute
::
ON
);
beam_ptr_
->
getStateSet
()
->
setAttributeAndModes
(
linewidth
,
osg
::
StateAttribute
::
ON
);
osg
::
Point
*
point
=
new
osg
::
Point
(
3.
f
);
beam_ptr_
->
get
OrCreate
StateSet
()
->
setAttribute
(
point
,
osg
::
StateAttribute
::
ON
);
beam_ptr_
->
getStateSet
()
->
setAttribute
(
point
,
osg
::
StateAttribute
::
ON
);
addProperty
(
FloatProperty
::
create
(
"PointSize"
,
FloatProperty
::
getterFromMemberFunction
(
point
,
&
osg
::
Point
::
getSize
),
...
...
src/properties.cpp
View file @
3bea0460
...
...
@@ -11,8 +11,8 @@ namespace viewer {
bool
BackfaceDrawingProperty
::
impl_get
(
bool
&
value
)
{
if
(
!
hasReadAccess
())
{
invalidGet
();
return
false
;
}
value
=
static_cast
<
bool
>
(
node_
->
getOrCreateStateSet
(
)
->
getMode
(
GL_CULL_FACE
)
&
osg
::
StateAttribute
::
ON
);
value
=
static_cast
<
bool
>
(
stateSet_
->
getMode
(
GL_CULL_FACE
)
&
osg
::
StateAttribute
::
ON
);
return
true
;
}
...
...
@@ -20,19 +20,17 @@ bool BackfaceDrawingProperty::impl_set (const bool& on)
{
if
(
!
hasWriteAccess
())
{
invalidSet
();
return
false
;
}
osg
::
StateSet
*
ss
=
node_
->
getOrCreateStateSet
();
ss
->
setMode
(
GL_CULL_FACE
,
stateSet_
->
setMode
(
GL_CULL_FACE
,
(
on
?
osg
::
StateAttribute
::
ON
:
osg
::
StateAttribute
::
OFF
));
if
(
on
)
{
osg
::
LightModel
*
ltModel
=
new
osg
::
LightModel
;
ltModel
->
setTwoSided
(
on
);
s
s
->
setAttribute
(
ltModel
);
s
s
->
setMode
(
GL_CULL_FACE
,
osg
::
StateAttribute
::
OFF
);
s
tateSet_
->
setAttribute
(
ltModel
);
s
tateSet_
->
setMode
(
GL_CULL_FACE
,
osg
::
StateAttribute
::
OFF
);
}
else
{
s
s
->
removeAttribute
(
osg
::
StateAttribute
::
LIGHTMODEL
);
s
s
->
setMode
(
GL_CULL_FACE
,
osg
::
StateAttribute
::
ON
);
s
tateSet_
->
removeAttribute
(
osg
::
StateAttribute
::
LIGHTMODEL
);
s
tateSet_
->
setMode
(
GL_CULL_FACE
,
osg
::
StateAttribute
::
ON
);
}
return
true
;
}
...
...
Write
Preview
Supports
Markdown
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