Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
b27653ef
Commit
b27653ef
authored
14 years ago
by
Ansgar Philippsen
Browse files
Options
Downloads
Patches
Plain Diff
fixed view update in gfx entity
parent
dae2c931
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/gfx/src/entity.cc
+35
-26
35 additions, 26 deletions
modules/gfx/src/entity.cc
modules/gfx/src/entity.hh
+7
-4
7 additions, 4 deletions
modules/gfx/src/entity.hh
with
42 additions
and
30 deletions
modules/gfx/src/entity.cc
+
35
−
26
View file @
b27653ef
...
...
@@ -222,31 +222,19 @@ void Entity::SetBlurFactors(float bf1,float bf2)
void
Entity
::
Rebuild
()
{
geom
::
Vec3
delta
=
GetTF
().
GetTrans
()
-
GetTF
().
GetCenter
();
do_update_view
();
// if necessary, update the views
this
->
ReapplyColorOps
();
// re-color everything
if
(
update_view_
)
{
EntityView
nv
=
this
->
GetView
();
trace_
.
ResetView
(
nv
);
for
(
RendererMap
::
iterator
i
=
renderer_
.
begin
(),
e
=
renderer_
.
end
();
i
!=
e
;
++
i
)
{
impl
::
EntityRenderer
*
r
=
i
->
second
;
if
(
r
->
IsEnabled
()
&&
r
->
HasDataToRender
())
{
i
->
second
->
ClearViews
();
i
->
second
->
AddView
(
nv
);
i
->
second
->
UpdateViews
();
i
->
second
->
PrepareRendering
();
}
}
}
FlagRebuild
();
// force renderer rebuilds in RenderGL call
Scene
::
Instance
().
RequestRedraw
();
this
->
ReapplyColorOps
();
FlagRebuild
();
// update center in transformation
geom
::
Vec3
center
=
this
->
GetCenter
();
Transform
tf
=
this
->
GetTF
();
tf
.
SetCenter
(
center
);
tf
.
SetTrans
(
center
+
delta
);
tf
.
SetTrans
(
center
+
GetTF
().
GetTrans
()
-
GetTF
().
GetCenter
()
);
this
->
SetTF
(
tf
);
Scene
::
Instance
().
RequestRedraw
();
}
void
Entity
::
UpdatePositions
()
...
...
@@ -256,6 +244,7 @@ void Entity::UpdatePositions()
impl
::
EntityRenderer
*
r
=
i
->
second
;
r
->
FlagPositionsDirty
();
}
// Rebuild() here causes an recursive loop...
FlagRebuild
();
Scene
::
Instance
().
RequestRedraw
();
}
...
...
@@ -845,10 +834,7 @@ void Entity::ColorBy(const String& prop,
mol
::
EntityView
Entity
::
GetView
()
const
{
if
(
update_view_
)
{
update_view_
=
false
;
cached_view_
=
qv_
.
GetEntityView
();
}
do_update_view
();
return
cached_view_
;
}
...
...
@@ -1018,11 +1004,12 @@ void Entity::ReapplyColorOps()
GfxObj
::
ReapplyColorOps
();
}
void
Entity
::
UpdateView
()
void
Entity
::
UpdateView
()
{
update_view_
=
true
;
update_view_
=
true
;
Rebuild
();
UpdatePositions
();
FlagRebuild
();
Scene
::
Instance
().
RequestRedraw
();
}
void
Entity
::
SetSeqHack
(
bool
b
)
...
...
@@ -1030,6 +1017,7 @@ void Entity::SetSeqHack(bool b)
if
(
b
!=
trace_
.
GetSeqHack
())
{
trace_
.
SetSeqHack
(
b
);
FlagRebuild
();
Scene
::
Instance
().
RequestRedraw
();
}
}
...
...
@@ -1038,4 +1026,25 @@ bool Entity::GetSeqHack() const
return
trace_
.
GetSeqHack
();
}
void
Entity
::
do_update_view
()
const
{
// also signals an update in positions
if
(
update_view_
)
{
update_view_
=
false
;
cached_view_
=
qv_
.
GetEntityView
();
trace_
.
ResetView
(
cached_view_
);
for
(
RendererMap
::
iterator
i
=
renderer_
.
begin
(),
e
=
renderer_
.
end
();
i
!=
e
;
++
i
)
{
impl
::
EntityRenderer
*
r
=
i
->
second
;
if
(
r
->
IsEnabled
()
&&
r
->
HasDataToRender
())
{
r
->
ClearViews
();
r
->
AddView
(
cached_view_
);
r
->
UpdateViews
();
r
->
FlagPositionsDirty
();
r
->
PrepareRendering
();
}
}
}
}
}}
// ns
This diff is collapsed.
Click to expand it.
modules/gfx/src/entity.hh
+
7
−
4
View file @
b27653ef
...
...
@@ -155,8 +155,12 @@ public:
void
Rebuild
();
/// \brief only grab updated positions, dont rebuild the whole thing
/// views won't be regenerated from stored queries
void
UpdatePositions
();
/// \brief forces all views to be regenerated from stored queries
void
UpdateView
();
/// \brief set color for selection
void
SetColor
(
const
Color
&
col
,
const
String
&
selection
=
String
(
""
));
...
...
@@ -276,8 +280,6 @@ public:
RenderOptionsPtr
&
render_options
);
bool
HasSelection
()
const
;
void
UpdateView
();
void
SetSeqHack
(
bool
b
);
bool
GetSeqHack
()
const
;
...
...
@@ -298,12 +300,13 @@ private:
mutable
geom
::
AlignedCuboid
bbox_
;
mol
::
EntityView
sel_
;
bool
sel_update_
;
impl
::
BackboneTrace
trace_
;
mutable
impl
::
BackboneTrace
trace_
;
void
init
(
RenderMode
::
Type
);
void
set_static_max_rad
();
void
do_update_view
()
const
;
typedef
boost
::
ptr_map
<
RenderMode
::
Type
,
impl
::
EntityRenderer
>
RendererMap
;
mutable
RendererMap
renderer_
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment