Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CGoGN
CGoGN
Commits
44d02608
Commit
44d02608
authored
Feb 18, 2013
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin renderExplod v0.01
parent
3908de25
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
210 additions
and
169 deletions
+210
-169
SCHNApps/Plugins/renderExplod/forms/renderExplod.ui
SCHNApps/Plugins/renderExplod/forms/renderExplod.ui
+2
-2
SCHNApps/Plugins/renderExplod/include/renderExplod.h
SCHNApps/Plugins/renderExplod/include/renderExplod.h
+23
-16
SCHNApps/Plugins/renderExplod/include/renderExplodDockTab.h
SCHNApps/Plugins/renderExplod/include/renderExplodDockTab.h
+6
-4
SCHNApps/Plugins/renderExplod/src/renderExplod.cpp
SCHNApps/Plugins/renderExplod/src/renderExplod.cpp
+134
-90
SCHNApps/Plugins/renderExplod/src/renderExplodDockTab.cpp
SCHNApps/Plugins/renderExplod/src/renderExplodDockTab.cpp
+31
-26
SCHNApps/bin/init.py
SCHNApps/bin/init.py
+12
-12
SCHNApps/include/mapHandler.hpp
SCHNApps/include/mapHandler.hpp
+1
-1
include/Algo/Modelisation/subdivision3.hpp
include/Algo/Modelisation/subdivision3.hpp
+1
-18
No files found.
SCHNApps/Plugins/renderExplod/forms/renderExplod.ui
View file @
44d02608
...
...
@@ -37,7 +37,7 @@
</widget>
</item>
<item
row=
"1"
column=
"1"
colspan=
"2"
>
<widget
class=
"QComboBox"
name=
"combo_color
VBO
"
>
<widget
class=
"QComboBox"
name=
"combo_color
Attribute
"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
...
...
@@ -47,7 +47,7 @@
</widget>
</item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QComboBox"
name=
"combo_position
VBO
"
>
<widget
class=
"QComboBox"
name=
"combo_position
Attribute
"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
...
...
SCHNApps/Plugins/renderExplod/include/renderExplod.h
View file @
44d02608
...
...
@@ -12,25 +12,28 @@ namespace CGoGN
namespace
SCHNApps
{
enum
FaceShadingStyle
{
FLAT
=
0
,
SMOOTH
=
1
};
struct
PerMapParameterSet
{
PerMapParameterSet
()
:
positionVBO
(
NULL
),
colorVBO
(
NULL
),
facesScaleFactor
(
1.0
f
),
volumesScaleFactor
(
1.0
f
),
renderEdges
(
false
),
renderFaces
(
true
)
{}
PerMapParameterSet
(
MapHandlerGen
*
mh
);
~
PerMapParameterSet
();
PerMapParameterSet
(
MapHa
nd
l
er
Gen
*
map
);
void
updateRe
nder
(
);
Utils
::
VBO
*
positionVBO
;
Utils
::
VBO
*
colorVBO
;
Algo
::
Render
::
GL2
::
ExplodeVolumeRender
*
m_renderExplod
;
MapHandlerGen
*
mh
;
VertexAttribute
<
PFP3
::
VEC3
>
positionAttribute
;
VolumeAttribute
<
PFP3
::
VEC3
>
colorAttribute
;
float
facesScaleFactor
;
float
volumesScaleFactor
;
bool
renderEdges
;
bool
renderFaces
;
FaceShadingStyle
faceStyle
;
};
struct
ParameterSet
...
...
@@ -38,7 +41,7 @@ struct ParameterSet
ParameterSet
()
:
selectedMap
(
NULL
)
{}
QHash
<
QString
,
PerMapParameterSet
>
perMap
;
QHash
<
QString
,
PerMapParameterSet
*
>
perMap
;
MapHandlerGen
*
selectedMap
;
};
...
...
@@ -81,16 +84,20 @@ public slots:
void
mapLinked
(
MapHandlerGen
*
m
);
void
mapUnlinked
(
MapHandlerGen
*
m
);
void
vboAdded
(
Utils
::
VBO
*
vbo
);
void
vboRemoved
(
Utils
::
VBO
*
vbo
);
//void addAttributeToList(unsigned int orbit, const QString& nameAttr);
void
changeSelectedMap
(
View
*
view
,
MapHandlerGen
*
map
,
bool
fromUI
=
false
);
void
changePositionVBO
(
View
*
view
,
MapHandlerGen
*
map
,
Utils
::
VBO
*
vbo
,
bool
fromUI
=
false
);
void
changeColorVBO
(
View
*
view
,
MapHandlerGen
*
map
,
Utils
::
VBO
*
vbo
,
bool
fromUI
=
false
);
void
changePositionAttribute
(
View
*
view
,
MapHandlerGen
*
map
,
VertexAttribute
<
PFP3
::
VEC3
>
attribute
,
bool
fromUI
=
false
);
void
changeColorAttribute
(
View
*
view
,
MapHandlerGen
*
map
,
VertexAttribute
<
PFP3
::
VEC3
>
attribute
,
bool
fromUI
=
false
);
void
changeRenderEdges
(
View
*
view
,
MapHandlerGen
*
map
,
bool
b
,
bool
fromUI
=
false
);
void
changeRenderFaces
(
View
*
view
,
MapHandlerGen
*
map
,
bool
b
,
bool
fromUI
=
false
);
void
changeFacesScaleFactor
(
View
*
view
,
MapHandlerGen
*
map
,
int
i
,
bool
fromUI
=
false
);
void
changeVolumesScaleFactor
(
View
*
view
,
MapHandlerGen
*
map
,
int
i
,
bool
fromUI
=
false
);
void
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
);
void
connectivityModified
();
};
}
// namespace SCHNApps
...
...
SCHNApps/Plugins/renderExplod/include/renderExplodDockTab.h
View file @
44d02608
#ifndef _RENDEREXPLOD_DOCK_TAB_H_
#define _RENDEREXPLOD_DOCK_TAB_H_
#ifndef _RENDER
_
EXPLOD_DOCK_TAB_H_
#define _RENDER
_
EXPLOD_DOCK_TAB_H_
#include "ui_renderExplod.h"
...
...
@@ -30,12 +30,14 @@ public slots:
void
refreshUI
(
ParameterSet
*
params
);
void
selectedMapChanged
();
void
position
VBO
Changed
(
int
index
);
void
color
VBO
Changed
(
int
index
);
void
position
Attribute
Changed
(
int
index
);
void
color
Attribute
Changed
(
int
index
);
void
renderEdgesChanged
(
bool
b
);
void
renderFacesChanged
(
bool
b
);
void
facesScaleFactorChanged
(
int
i
);
void
volumesScaleFactorChanged
(
int
i
);
void
addAttributeToList
(
unsigned
int
orbit
,
const
QString
&
nameAttr
);
};
}
// namespace SCHNApps
...
...
SCHNApps/Plugins/renderExplod/src/renderExplod.cpp
View file @
44d02608
...
...
@@ -8,72 +8,74 @@ namespace CGoGN
namespace
SCHNApps
{
PerMapParameterSet
::
PerMapParameterSet
(
MapHandlerGen
*
map
)
:
positionVBO
(
NULL
),
colorVBO
(
NULL
),
PerMapParameterSet
::
PerMapParameterSet
(
MapHandlerGen
*
m
)
:
mh
(
m
),
facesScaleFactor
(
1.0
f
),
volumesScaleFactor
(
1.0
f
),
renderEdges
(
false
),
renderFaces
(
true
)
renderFaces
(
true
),
faceStyle
(
FLAT
)
{
bool
positionFound
=
false
;
bool
colorFound
=
false
;
QList
<
Utils
::
VBO
*>
vbos
=
map
->
getVBOList
();
for
(
int
i
=
0
;
i
<
vbos
.
count
();
++
i
)
m_renderExplod
=
new
Algo
::
Render
::
GL2
::
ExplodeVolumeRender
(
false
,
false
,
false
);
m_renderExplod
->
setNoClippingPlane
();
m_renderExplod
->
setExplodeVolumes
(
1.0
f
);
m_renderExplod
->
setExplodeFaces
(
1.0
f
);
QString
positionName
;
QString
vec3TypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP3
::
VEC3
()));
const
AttributeHash
&
attribs
=
mh
->
getAttributesList
(
VERTEX
);
for
(
AttributeHash
::
const_iterator
i
=
attribs
.
constBegin
();
i
!=
attribs
.
constEnd
();
++
i
)
{
if
(
vbos
[
i
]
->
dataSize
()
==
3
)
if
(
i
.
value
()
==
vec3TypeName
)
{
if
(
!
positionFound
)
positionVBO
=
vbos
[
i
];
if
(
vbos
[
i
]
->
name
()
==
"position"
)
// try to select a VBO named "position"
{
positionVBO
=
vbos
[
i
];
positionFound
=
true
;
}
if
(
!
colorFound
)
colorVBO
=
vbos
[
i
];
if
(
vbos
[
i
]
->
name
()
==
"color"
)
// try to select a VBO named "color"
{
colorVBO
=
vbos
[
i
];
colorFound
=
true
;
}
if
(
positionName
!=
"position"
)
// try to select an attribute named "position"
positionName
=
i
.
key
();
// or anything else if not found
}
}
positionAttribute
=
mh
->
getAttribute
<
PFP3
::
VEC3
,
VERTEX
>
(
positionName
);
colorAttribute
=
mh
->
getAttribute
<
PFP3
::
VEC3
,
VOLUME
>
(
"color"
);
updateRender
();
}
PerMapParameterSet
::~
PerMapParameterSet
()
{
delete
m_renderExplod
;
}
void
PerMapParameterSet
::
updateRender
()
{
MapHandler
<
PFP3
>*
mh3
=
static_cast
<
MapHandler
<
PFP3
>*>
(
mh
);
if
(
mh3
==
NULL
)
return
;
PFP3
::
MAP
*
m
=
mh3
->
getMap
();
//if(!color.isValid())
m_renderExplod
->
updateData
<
PFP3
>
(
*
m
,
positionAttribute
);
}
bool
RenderExplodPlugin
::
enable
()
{
m_dockTab
=
new
RenderExplodDockTab
(
m_window
,
this
);
addTabInDock
(
m_dockTab
,
"RenderExplod"
);
// m_renderExplod = new Algo::Render::GL2::ExplodeVolumeRender(true);
//
// m_renderExplod->setNoClippingPlane();
// m_renderExplod->setExplodeVolumes(0.9f);
// m_renderExplod->setExplodeFaces(1.0f);
//
// //m_renderExplod->setAmbiant(Geom::Vec4f(0.1f,0.1f,0.1f,0.0f));
// //m_renderExplod->setBackColor(Geom::Vec4f(0.1f,1.0f,0.1f,0.0f));
// //m_renderExplod->setColorLine(Geom::Vec4f(0.1f,0.1f,0.1f,0.0f));
// //m_renderExplod->setAmbiant(Geom::Vec4f(0.9f, 0.5f, 0.0f, 0.0f));
// m_renderExplod->setBackColor(Geom::Vec4f(0.9f, 0.5f, 0.0f, 0.0f));
// //m_renderExplod->setColorLine(Geom::Vec4f(0.9f, 0.5f, 0.0f, 0.0f));
// m_renderExplod->setColorLine(Geom::Vec4f(0.0f, 0.0f, 0.0f, 0.0f));
//
// registerShader(m_renderExplod->shaderFaces());
// registerShader(m_renderExplod->shaderLines());
connect
(
m_window
,
SIGNAL
(
viewAndPluginLinked
(
View
*
,
Plugin
*
)),
this
,
SLOT
(
viewLinked
(
View
*
,
Plugin
*
)));
connect
(
m_window
,
SIGNAL
(
viewAndPluginUnlinked
(
View
*
,
Plugin
*
)),
this
,
SLOT
(
viewUnlinked
(
View
*
,
Plugin
*
)));
connect
(
m_window
,
SIGNAL
(
currentViewChanged
(
View
*
)),
this
,
SLOT
(
currentViewChanged
(
View
*
)));
return
true
;
}
void
RenderExplodPlugin
::
disable
()
{
//delete m_renderExplod;
}
void
RenderExplodPlugin
::
redraw
(
View
*
view
)
...
...
@@ -83,22 +85,23 @@ void RenderExplodPlugin::redraw(View* view)
const
QList
<
MapHandlerGen
*>&
maps
=
view
->
getLinkedMaps
();
foreach
(
MapHandlerGen
*
m
,
maps
)
{
const
PerMapParameterSet
&
p
=
params
->
perMap
[
m
->
getName
()];
if
(
p
.
positionVBO
!=
NULL
)
PerMapParameterSet
*
p
=
params
->
perMap
[
m
->
getName
()];
p
->
m_renderExplod
->
setExplodeFaces
(
p
->
facesScaleFactor
);
p
->
m_renderExplod
->
setExplodeVolumes
(
p
->
volumesScaleFactor
);
if
(
p
->
renderEdges
)
{
if
(
p
.
renderEdges
)
{
// m_renderExplod->drawEdges();
}
if
(
p
.
renderFaces
)
{
// glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// glEnable(GL_LIGHTING);
// glEnable(GL_POLYGON_OFFSET_FILL);
// glPolygonOffset(1.0f, 1.0f) ;
// m_renderExplod->drawFaces();
// glDisable(GL_POLYGON_OFFSET_FILL);
}
p
->
m_renderExplod
->
drawEdges
();
}
if
(
p
->
renderFaces
)
{
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glEnable
(
GL_LIGHTING
);
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
)
;
p
->
m_renderExplod
->
drawFaces
();
glDisable
(
GL_POLYGON_OFFSET_FILL
);
}
}
}
...
...
@@ -110,10 +113,12 @@ void RenderExplodPlugin::viewLinked(View* view, Plugin* plugin)
ParameterSet
*
params
=
new
ParameterSet
();
h_viewParams
.
insert
(
view
,
params
);
const
QList
<
MapHandlerGen
*>&
maps
=
view
->
getLinkedMaps
();
foreach
(
MapHandlerGen
*
m
ap
,
maps
)
foreach
(
MapHandlerGen
*
m
h
,
maps
)
{
PerMapParameterSet
p
(
map
);
params
->
perMap
.
insert
(
map
->
getName
(),
p
);
PerMapParameterSet
*
p
=
new
PerMapParameterSet
(
mh
);
registerShader
(
p
->
m_renderExplod
->
shaderFaces
());
registerShader
(
p
->
m_renderExplod
->
shaderLines
());
params
->
perMap
.
insert
(
mh
->
getName
(),
p
);
}
if
(
!
maps
.
empty
())
changeSelectedMap
(
view
,
maps
[
0
]);
...
...
@@ -140,7 +145,11 @@ void RenderExplodPlugin::viewUnlinked(View* view, Plugin* plugin)
void
RenderExplodPlugin
::
currentViewChanged
(
View
*
view
)
{
if
(
isLinkedToView
(
view
))
{
ParameterSet
*
params
=
h_viewParams
[
view
];
changeSelectedMap
(
view
,
params
->
selectedMap
);
m_dockTab
->
refreshUI
(
h_viewParams
[
view
]);
}
}
void
RenderExplodPlugin
::
mapLinked
(
MapHandlerGen
*
m
)
...
...
@@ -148,9 +157,17 @@ void RenderExplodPlugin::mapLinked(MapHandlerGen* m)
View
*
view
=
static_cast
<
View
*>
(
QObject
::
sender
());
assert
(
isLinkedToView
(
view
));
connect
(
m
,
SIGNAL
(
attributeModified
(
unsigned
int
,
QString
)),
this
,
SLOT
(
attributeModified
(
unsigned
int
,
QString
)));
connect
(
m
,
SIGNAL
(
connectivityModified
()),
this
,
SLOT
(
connectivityModified
()));
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
p
(
m
);
PerMapParameterSet
*
p
=
new
PerMapParameterSet
(
m
);
registerShader
(
p
->
m_renderExplod
->
shaderFaces
());
registerShader
(
p
->
m_renderExplod
->
shaderLines
());
params
->
perMap
.
insert
(
m
->
getName
(),
p
);
if
(
params
->
selectedMap
==
NULL
||
params
->
perMap
.
count
()
==
1
)
changeSelectedMap
(
view
,
m
);
else
...
...
@@ -162,6 +179,10 @@ void RenderExplodPlugin::mapUnlinked(MapHandlerGen* m)
View
*
view
=
static_cast
<
View
*>
(
QObject
::
sender
());
assert
(
isLinkedToView
(
view
));
disconnect
(
m
,
SIGNAL
(
attributeModified
(
unsigned
int
,
QString
)),
this
,
SLOT
(
attributeModified
(
unsigned
int
,
QString
)));
disconnect
(
m
,
SIGNAL
(
connectivityModified
()),
this
,
SLOT
(
connectivityModified
()));
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
.
remove
(
m
->
getName
());
...
...
@@ -176,24 +197,6 @@ void RenderExplodPlugin::mapUnlinked(MapHandlerGen* m)
m_dockTab
->
refreshUI
(
params
);
}
void
RenderExplodPlugin
::
vboAdded
(
Utils
::
VBO
*
vbo
)
{
m_dockTab
->
refreshUI
(
h_viewParams
[
m_window
->
getCurrentView
()]);
}
void
RenderExplodPlugin
::
vboRemoved
(
Utils
::
VBO
*
vbo
)
{
MapHandlerGen
*
map
=
static_cast
<
MapHandlerGen
*>
(
QObject
::
sender
());
View
*
view
=
m_window
->
getCurrentView
();
ParameterSet
*
params
=
h_viewParams
[
view
];
if
(
params
->
perMap
[
map
->
getName
()].
positionVBO
==
vbo
)
changePositionVBO
(
view
,
map
,
NULL
);
if
(
params
->
perMap
[
map
->
getName
()].
colorVBO
==
vbo
)
changeColorVBO
(
view
,
map
,
NULL
);
m_dockTab
->
refreshUI
(
h_viewParams
[
view
]);
}
void
RenderExplodPlugin
::
changeSelectedMap
(
View
*
view
,
MapHandlerGen
*
map
,
bool
fromUI
)
{
...
...
@@ -204,21 +207,18 @@ void RenderExplodPlugin::changeSelectedMap(View* view, MapHandlerGen* map, bool
if
(
view
->
isCurrentView
())
{
if
(
prev
)
disconnect
(
prev
,
SIGNAL
(
vboAdded
(
Utils
::
VBO
*
)),
this
,
SLOT
(
vboAdded
(
Utils
::
VBO
*
)));
if
(
map
)
connect
(
map
,
SIGNAL
(
vboAdded
(
Utils
::
VBO
*
)),
this
,
SLOT
(
vboAdded
(
Utils
::
VBO
*
)));
if
(
!
fromUI
)
m_dockTab
->
refreshUI
(
params
);
view
->
updateGL
();
}
}
void
RenderExplodPlugin
::
changePosition
VBO
(
View
*
view
,
MapHandlerGen
*
map
,
Utils
::
VBO
*
vbo
,
bool
fromUI
)
void
RenderExplodPlugin
::
changePosition
Attribute
(
View
*
view
,
MapHandlerGen
*
map
,
VertexAttribute
<
PFP3
::
VEC3
>
attribute
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
[
map
->
getName
()].
positionVBO
=
vbo
;
PerMapParameterSet
*
perMap
=
params
->
perMap
[
map
->
getName
()];
perMap
->
positionAttribute
=
attribute
;
perMap
->
updateRender
();
if
(
view
->
isCurrentView
())
{
...
...
@@ -228,10 +228,11 @@ void RenderExplodPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils
}
}
void
RenderExplodPlugin
::
changeColor
VBO
(
View
*
view
,
MapHandlerGen
*
map
,
Utils
::
VBO
*
vbo
,
bool
fromUI
)
void
RenderExplodPlugin
::
changeColor
Attribute
(
View
*
view
,
MapHandlerGen
*
map
,
VertexAttribute
<
PFP3
::
VEC3
>
attribute
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
[
map
->
getName
()].
colorVBO
=
vbo
;
// params->perMap[map->getName()].colorAttribute = attribute;
//perMap->colorAttribute = attribute;
if
(
view
->
isCurrentView
())
{
...
...
@@ -244,7 +245,7 @@ void RenderExplodPlugin::changeColorVBO(View* view, MapHandlerGen* map, Utils::V
void
RenderExplodPlugin
::
changeRenderEdges
(
View
*
view
,
MapHandlerGen
*
map
,
bool
b
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
[
map
->
getName
()]
.
renderEdges
=
b
;
params
->
perMap
[
map
->
getName
()]
->
renderEdges
=
b
;
if
(
view
->
isCurrentView
())
{
...
...
@@ -257,7 +258,7 @@ void RenderExplodPlugin::changeRenderEdges(View* view, MapHandlerGen* map, bool
void
RenderExplodPlugin
::
changeRenderFaces
(
View
*
view
,
MapHandlerGen
*
map
,
bool
b
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
[
map
->
getName
()]
.
renderFaces
=
b
;
params
->
perMap
[
map
->
getName
()]
->
renderFaces
=
b
;
if
(
view
->
isCurrentView
())
{
...
...
@@ -270,7 +271,7 @@ void RenderExplodPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool
void
RenderExplodPlugin
::
changeFacesScaleFactor
(
View
*
view
,
MapHandlerGen
*
map
,
int
i
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
[
map
->
getName
()]
.
facesScaleFactor
=
i
/
50.0
;
params
->
perMap
[
map
->
getName
()]
->
facesScaleFactor
=
i
/
50.0
;
if
(
view
->
isCurrentView
())
{
...
...
@@ -283,7 +284,7 @@ void RenderExplodPlugin::changeFacesScaleFactor(View* view, MapHandlerGen* map,
void
RenderExplodPlugin
::
changeVolumesScaleFactor
(
View
*
view
,
MapHandlerGen
*
map
,
int
i
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
[
map
->
getName
()]
.
volumesScaleFactor
=
i
/
50.0
;
params
->
perMap
[
map
->
getName
()]
->
volumesScaleFactor
=
i
/
50.0
;
if
(
view
->
isCurrentView
())
{
...
...
@@ -293,6 +294,49 @@ void RenderExplodPlugin::changeVolumesScaleFactor(View* view, MapHandlerGen* map
}
}
void
RenderExplodPlugin
::
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
)
{
// if(orbit == VERTEX)
// {
//
// MapHandler<PFP3>* mh = static_cast<MapHandler<PFP3>*>(QObject::sender());
// if(mh == NULL)
// return;
//
// VertexAttribute<PFP2::VEC3> position = mh->getAttribute<PFP3::VEC3, VERTEX>(nameAttr);
// if(!position.isValid())
// return;
//
// PFP3::MAP* map = mh->getMap();
//
// m_renderExplod->updateData<PFP3>(*map,position);
//
//// if(computeNormalLastParameters.contains(map->getName()))
//// {
//// ComputeNormalParameters& params = computeNormalLastParameters[map->getName()];
//// if(params.positionName == nameAttr && params.autoUpdate)
//// computeNormal(map->getName(), params.positionName, params.normalName);
//// }
// }
}
void
RenderExplodPlugin
::
connectivityModified
()
{
// MapHandler<PFP3>* mh = static_cast<MapHandler<PFP3>*>(QObject::sender());
// if(mh == NULL)
// return;
//
// VertexAttribute<PFP2::VEC3> position = mh->getAttribute<PFP3::VEC3, VERTEX>("position");
// if(!position.isValid())
// return;
//
// PFP3::MAP* map = mh->getMap();
//
// m_renderExplod->updateData<PFP3>(*map,position);
}
#ifndef DEBUG
Q_EXPORT_PLUGIN2
(
RenderExplodPlugin
,
RenderExplodPlugin
)
#else
...
...
SCHNApps/Plugins/renderExplod/src/renderExplodDockTab.cpp
View file @
44d02608
...
...
@@ -18,10 +18,13 @@ RenderExplodDockTab::RenderExplodDockTab(Window* w, RenderExplodPlugin* p) :
setupUi
(
this
);
connect
(
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
selectedMapChanged
()));
connect
(
combo_positionVBO
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
positionVBOChanged
(
int
)));
connect
(
combo_colorVBO
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
colorVBOChanged
(
int
)));
connect
(
combo_positionAttribute
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
positionAttributeChanged
(
int
)));
connect
(
combo_colorAttribute
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
colorAttributeChanged
(
int
)));
connect
(
check_renderEdges
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
renderEdgesChanged
(
bool
)));
connect
(
check_renderFaces
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
renderFacesChanged
(
bool
)));
connect
(
slider_facesScaleFactor
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
facesScaleFactorChanged
(
int
)));
connect
(
slider_volumesScaleFactor
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
volumesScaleFactorChanged
(
int
)));
}
...
...
@@ -33,44 +36,46 @@ void RenderExplodDockTab::refreshUI(ParameterSet* params)
b_refreshingUI
=
true
;
mapList
->
clear
();
combo_position
VBO
->
clear
();
combo_color
VBO
->
clear
();
combo_position
Attribute
->
clear
();
combo_color
Attribute
->
clear
();
MapHandlerGen
*
m
ap
=
params
->
selectedMap
;
MapHandlerGen
*
m
h
=
params
->
selectedMap
;
QHash
<
QString
,
PerMapParameterSet
>::
const_iterator
i
=
params
->
perMap
.
constBegin
();
QHash
<
QString
,
PerMapParameterSet
*
>::
const_iterator
i
=
params
->
perMap
.
constBegin
();
while
(
i
!=
params
->
perMap
.
constEnd
())
{
mapList
->
addItem
(
i
.
key
());
if
(
m
ap
!=
NULL
&&
i
.
key
()
==
m
ap
->
getName
())
if
(
m
h
!=
NULL
&&
i
.
key
()
==
m
h
->
getName
())
{
QList
<
QListWidgetItem
*>
item
=
mapList
->
findItems
(
m
ap
->
getName
(),
Qt
::
MatchExactly
);
QList
<
QListWidgetItem
*>
item
=
mapList
->
findItems
(
m
h
->
getName
(),
Qt
::
MatchExactly
);
item
[
0
]
->
setSelected
(
true
);
PerMapParameterSet
&
p
=
params
->
perMap
[
map
->
getName
()];
PerMapParameterSet
*
p
=
params
->
perMap
[
mh
->
getName
()];
QString
vec3TypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP2
::
VEC3
()));
QList
<
Utils
::
VBO
*>
vbos
=
map
->
getVBOList
();
unsigned
int
j
=
0
;
for
(
int
i
=
0
;
i
<
vbos
.
count
();
++
i
)
const
AttributeHash
&
attribs
=
mh
->
getAttributesList
(
VERTEX
);
for
(
AttributeHash
::
const_iterator
i
=
attribs
.
constBegin
();
i
!=
attribs
.
constEnd
();
++
i
)
{
if
(
vbos
[
i
]
->
dataSize
()
==
3
)
if
(
i
.
value
()
==
vec3TypeName
)
{
combo_position
VBO
->
addItem
(
QString
::
fromStdString
(
vbos
[
i
]
->
name
()
));
if
(
vbos
[
i
]
==
p
.
positionVBO
)
combo_position
VBO
->
setCurrentIndex
(
j
);
combo_position
Attribute
->
addItem
(
i
.
key
(
));
if
(
i
.
key
()
==
QString
::
fromStdString
(
p
->
positionAttribute
.
name
())
)
combo_position
Attribute
->
setCurrentIndex
(
j
);
combo_color
VBO
->
addItem
(
QString
::
fromStdString
(
vbos
[
i
]
->
name
()
));
if
(
vbos
[
i
]
==
p
.
colorVBO
)
combo_color
VBO
->
setCurrentIndex
(
j
);
//
combo_color
Attribute
->addItem(
i.key(
));
//
if(
i.key() == QString::fromStdString(p.colorAttribute.name())
)
//
combo_color
Attribute
->setCurrentIndex(j);
++
j
;
}
}
check_renderEdges
->
setChecked
(
p
.
renderEdges
);
check_renderFaces
->
setChecked
(
p
.
renderFaces
);
slider_facesScaleFactor
->
setSliderPosition
(
p
.
facesScaleFactor
*
50.0
);
slider_volumesScaleFactor
->
setSliderPosition
(
p
.
volumesScaleFactor
*
50.0
);
check_renderEdges
->
setChecked
(
p
->
renderEdges
);
check_renderFaces
->
setChecked
(
p
->
renderFaces
);
slider_facesScaleFactor
->
setSliderPosition
(
p
->
facesScaleFactor
*
50.0
);
slider_volumesScaleFactor
->
setSliderPosition
(
p
->
volumesScaleFactor
*
50.0
);
}
++
i
;
}
...
...
@@ -88,23 +93,23 @@ void RenderExplodDockTab::selectedMapChanged()
}
}
void
RenderExplodDockTab
::
position
VBO
Changed
(
int
index
)
void
RenderExplodDockTab
::
position
Attribute
Changed
(
int
index
)
{
if
(
!
b_refreshingUI
)
{
View
*
view
=
m_window
->
getCurrentView
();
MapHandlerGen
*
map
=
m_currentParams
->
selectedMap
;
m_plugin
->
changePosition
VBO
(
view
,
map
,
map
->
get
VBO
(
combo_position
VBO
->
currentText
()),
true
);
m_plugin
->
changePosition
Attribute
(
view
,
map
,
map
->
get
Attribute
<
PFP2
::
VEC3
,
VERTEX
>
(
combo_position
Attribute
->
currentText
()),
true
);
}
}
void
RenderExplodDockTab
::
color
VBO
Changed
(
int
index
)
void
RenderExplodDockTab
::
color
Attribute
Changed
(
int
index
)
{
if
(
!
b_refreshingUI
)
{
View
*
view
=
m_window
->
getCurrentView
();
MapHandlerGen
*
map
=
m_currentParams
->
selectedMap
;
m_plugin
->
changeColor
VBO
(
view
,
map
,
map
->
get
VBO
(
combo_color
VBO
->
currentText
()),
true
);
m_plugin
->
changeColor
Attribute
(
view
,
map
,
map
->
get
Attribute
<
PFP2
::
VEC3
,
VERTEX
>
(
combo_color
Attribute
->
currentText
()),
true
);
}
}
...
...
SCHNApps/bin/init.py
View file @
44d02608
importPlugin
=
schnapps
.
loadPlugin
(
"ImportSurface"
);
renderPlugin
=
schnapps
.
loadPlugin
(
"RenderD"
);
renderVectorPlugin
=
schnapps
.
loadPlugin
(
"RenderVectorD"
);
differentialPropertiesPlugin
=
schnapps
.
loadPlugin
(
"DifferentialProperties"
);
subdivisionPlugin
=
schnapps
.
loadPlugin
(
"SubdivideSurface"
);