Can you fellas look at how I'm trying to devine within the below call ...
if the manifold has been changed since my plugin poked its state info
into we's pst field ???
This seems to work. But I still get some display problems.
How do I remove my pst info once the we has been altered ????
You see I'm updating src_we ... but I'm not so sure that's the correct way.
Please advise.
I think I have a really nice selection plugin to show if I can get past these redraw issues.
if the manifold has been changed since my plugin poked its state info
into we's pst field ???
This seems to work. But I still get some display problems.
How do I remove my pst info once the we has been altered ????
You see I'm updating src_we ... but I'm not so sure that's the correct way.
Please advise.
I think I have a really nice selection plugin to show if I can get past these redraw issues.
update_dlist({es,_ },#dlo{plugins=Pdl,src_we=#we{vp=Vtab, es=Etab, pst=PluginState}=We}=D, _) ->
Key = ?MODULE,
%% Get Directed Edge lookup if a plugin has decided we need it !
%% -----------------------------------------------------------------
HasDirectedEdgeX = gb_trees:is_defined(wpc_directed_edge,PluginState),
HasDirectedEdge =
case HasDirectedEdgeX of
true ->
#de_rec{count_v=CV1, count_e=CE1, count_f=CF1, detab=DEtab } = gb_trees:get(?MODULE, PluginState),
#de_rec{count_v=CV0, count_e=CE0, count_f=CF0} = makeDERec(gb_trees:empty(), We),
case ( (CV1 /= CV0) or (CE1 /= CE0) or (CF1 /= CF0) ) of
true ->
false;
_ ->
gb_trees:size(DEtab) > 0
end;
_ ->
DEtab = gb_trees:empty()
end,
if
HasDirectedEdge ->
DEdgeDict = gb_trees:to_list(DEtab),
List = gl:genLists(1),
gl:newList(List,?GL_COMPILE),
gl:color4f(0.0, 0.0, 1.0,1.0),
gl:lineWidth(3.0),
lists:foreach(
fun({Edge, { dedge, Rf } }) ->
#edge{vs=Va,ve=Vb,rf=Rf1} = array:get(Edge, Etab),
gl:'begin'(?GL_LINES),
case Rf == Rf1 of
true ->
[ { _, _, _ } , { _, _, _ }, { Xc, Yc, Zc } | _T ] =
wings_face:vertex_positions(Rf, Edge, We),
{ Xa, Ya, Za } = array:get(Va, Vtab),
{ Xb, Yb, Zb } = array:get(Vb, Vtab),
gl:vertex3fv( { Xa, Ya, Za } ),
gl:vertex3fv( { Xb, Yb, Zb } ),
drawBarb({ Xa, Ya, Za }, { Xb, Yb, Zb }, { Xc, Yc, Zc });
_ ->
VList = wings_face:vertex_positions(Rf, Edge, We),
{ Xc, Yc, Zc } = lists:nth(3, VList),
{ Xa, Ya, Za } = array:get(Va, Vtab),
{ Xb, Yb, Zb } = array:get(Vb, Vtab),
gl:vertex3fv( { Xa, Ya, Za } ),
gl:vertex3fv( { Xb, Yb, Zb } ),
drawBarb({ Xb, Yb, Zb }, { Xa, Ya, Za },{ Xc, Yc, Zc } )
end,
gl:'end'()
end, DEdgeDict ), %% fun, foreach
gl:endList(),
D#dlo{plugins=[{Key,{es,List}}|Pdl]};
true ->
D#dlo{plugins=[{Key,none}|Pdl], src_we=We#we{pst=gb_trees:delete_any(?MODULE, PluginState)} }
end.
