Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
c32aac62
Commit
c32aac62
authored
Aug 02, 2011
by
Maire Nicolas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rajout d'une méthode pour la normalisation de l'attenuation de couleurs.
parent
4f2f41b6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
5 deletions
+31
-5
Apps/Examples/clipping.cpp
Apps/Examples/clipping.cpp
+6
-3
Apps/Examples/clipping.ui
Apps/Examples/clipping.ui
+3
-0
include/Utils/clippingShader.h
include/Utils/clippingShader.h
+8
-1
src/Utils/clippingShader.cpp
src/Utils/clippingShader.cpp
+14
-1
No files found.
Apps/Examples/clipping.cpp
View file @
c32aac62
...
...
@@ -84,6 +84,7 @@ void Clipping::slot_pushButton_addPlane()
// Set params
m_shader
->
setClipPlaneParamsOrigin
(
newPlaneId
,
m_bb
.
center
());
pickable
->
translate
(
m_bb
.
center
());
pickable
->
scale
(
Geom
::
Vec3f
(
m_bb
.
maxSize
()
*
0.5
));
// Update shader sources edits
dock
.
vertexEdit
->
setPlainText
(
QString
(
m_shader
->
getVertexShaderSrc
()));
...
...
@@ -120,9 +121,9 @@ void Clipping::slot_pushButton_addSphere()
// Set params
m_shader
->
setClipSphereParamsCenter
(
newSphereId
,
m_bb
.
center
());
m_shader
->
setClipSphereParamsRadius
(
newSphereId
,
(
m_bb
.
maxSize
())
*
1.0
);
m_shader
->
setClipSphereParamsRadius
(
newSphereId
,
(
m_bb
.
maxSize
())
*
0.5
);
pickable
->
translate
(
m_bb
.
center
());
pickable
->
scale
(
Geom
::
Vec3f
(
m_bb
.
maxSize
()
*
1.0
));
pickable
->
scale
(
Geom
::
Vec3f
(
m_bb
.
maxSize
()
*
0.5
));
// Update shader sources edits
dock
.
vertexEdit
->
setPlainText
(
QString
(
m_shader
->
getVertexShaderSrc
()));
...
...
@@ -152,7 +153,7 @@ void Clipping::slot_pushButton_changeSpheresColor()
void
Clipping
::
slot_doubleSpinBox_ColorAttenuationFactor
(
double
c
)
{
m_shader
->
setClipColorAttenuationFactor
((
float
)
c
);
m_shader
->
setClipColorAttenuationFactor
Absolute
((
float
)
c
);
updateGL
();
}
...
...
@@ -374,6 +375,8 @@ void Clipping::importMesh(std::string& filename)
setParamObject
(
gWidthObj
,
gPosObj
.
data
())
;
updateGLMatrices
();
m_shader
->
setClipColorAttenuationFactorRelative
(
m_bb
.
maxSize
(),
5.0
);
}
/*******************************************************************************
...
...
Apps/Examples/clipping.ui
View file @
c32aac62
...
...
@@ -302,6 +302,9 @@
</item>
<item>
<widget
class=
"QDoubleSpinBox"
name=
"doubleSpinBox_ColorAttenuationFactor"
>
<property
name=
"decimals"
>
<number>
4
</number>
</property>
<property
name=
"singleStep"
>
<double>
1.000000000000000
</double>
</property>
...
...
include/Utils/clippingShader.h
View file @
c32aac62
...
...
@@ -272,7 +272,14 @@ public:
* sets the color attenuation factor
* @param colorAttenuationFactor color attenuation factor
*/
void
setClipColorAttenuationFactor
(
float
colorAttenuationFactor
);
void
setClipColorAttenuationFactorAbsolute
(
float
colorAttenuationFactor
);
/**
* sets the color attenuation factor according to an object size
* @param size size with which the color attenuation will be normalized
* @param factor attenuation factor
*/
void
setClipColorAttenuationFactorRelative
(
float
size
,
float
factor
);
/// gets the color attenuation factor
float
getClipColorAttenuationFactor
();
...
...
src/Utils/clippingShader.cpp
View file @
c32aac62
...
...
@@ -814,7 +814,7 @@ bool ClippingShader::insertClippingCode()
return
true
;
}
void
ClippingShader
::
setClipColorAttenuationFactor
(
float
colorAttenuationFactor
)
void
ClippingShader
::
setClipColorAttenuationFactor
Absolute
(
float
colorAttenuationFactor
)
{
// Check if it is worth updating values !
if
(
colorAttenuationFactor
==
m_clipColorAttenuationFactor
)
...
...
@@ -827,6 +827,19 @@ void ClippingShader::setClipColorAttenuationFactor(float colorAttenuationFactor)
sendClipColorAttenuationFactorUniform
();
}
void
ClippingShader
::
setClipColorAttenuationFactorRelative
(
float
size
,
float
factor
)
{
// Compute the relative color attenuation factor
float
colAttFact
;
if
(
size
!=
0.0
)
colAttFact
=
factor
/
size
;
else
colAttFact
=
factor
;
// Set the resulting factor in absolute
setClipColorAttenuationFactorAbsolute
(
colAttFact
);
}
float
ClippingShader
::
getClipColorAttenuationFactor
()
{
return
m_clipColorAttenuationFactor
;
...
...
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