Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 42e869b6 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

distance attenuation color in svg rendering

parent b4b3e7c8
...@@ -86,6 +86,8 @@ protected: ...@@ -86,6 +86,8 @@ protected:
Geom::Vec3f m_globalColor; Geom::Vec3f m_globalColor;
Geom::Vec4f m_clipPlane;
/** /**
* explode volume factor * explode volume factor
*/ */
...@@ -200,8 +202,9 @@ public: ...@@ -200,8 +202,9 @@ public:
* @param filename name of svg file * @param filename name of svg file
* @param model modelview matrix * @param model modelview matrix
* @param proj projection matrix * @param proj projection matrix
* @param af attenuation factor 0.0:none 1.0 color->with, more fastest attenuation (^af)
*/ */
void svgoutEdges(const std::string& filename, const glm::mat4& model, const glm::mat4& proj); void svgoutEdges(const std::string& filename, const glm::mat4& model, const glm::mat4& proj,float af=0.0f);
/** /**
* @brief toSVG * @brief toSVG
......
...@@ -642,6 +642,7 @@ inline void ExplodeVolumeRender::setExplodeFaces(float explode) ...@@ -642,6 +642,7 @@ inline void ExplodeVolumeRender::setExplodeFaces(float explode)
inline void ExplodeVolumeRender::setClippingPlane(const Geom::Vec4f& p) inline void ExplodeVolumeRender::setClippingPlane(const Geom::Vec4f& p)
{ {
m_clipPlane = p;
if (m_smooth) if (m_smooth)
m_shaderS->setClippingPlane(p); m_shaderS->setClippingPlane(p);
else else
...@@ -651,12 +652,12 @@ inline void ExplodeVolumeRender::setClippingPlane(const Geom::Vec4f& p) ...@@ -651,12 +652,12 @@ inline void ExplodeVolumeRender::setClippingPlane(const Geom::Vec4f& p)
inline void ExplodeVolumeRender::setNoClippingPlane() inline void ExplodeVolumeRender::setNoClippingPlane()
{ {
Geom::Vec4f p(1.0f,1.0f,1.0f,-99999999.9f); m_clipPlane = Geom::Vec4f(1.0f,1.0f,1.0f,-99999999.9f);
if (m_smooth) if (m_smooth)
m_shaderS->setClippingPlane(p); m_shaderS->setClippingPlane(m_clipPlane);
else else
m_shader->setClippingPlane(p); m_shader->setClippingPlane(m_clipPlane);
m_shaderL->setClippingPlane(p); m_shaderL->setClippingPlane(m_clipPlane);
} }
inline void ExplodeVolumeRender::setAmbiant(const Geom::Vec4f& ambiant) inline void ExplodeVolumeRender::setAmbiant(const Geom::Vec4f& ambiant)
...@@ -698,9 +699,10 @@ inline Utils::GLSLShader* ExplodeVolumeRender::shaderLines() ...@@ -698,9 +699,10 @@ inline Utils::GLSLShader* ExplodeVolumeRender::shaderLines()
return m_shaderL; return m_shaderL;
} }
inline void ExplodeVolumeRender::svgoutEdges(const std::string& filename, const glm::mat4& model, const glm::mat4& proj) inline void ExplodeVolumeRender::svgoutEdges(const std::string& filename, const glm::mat4& model, const glm::mat4& proj,float af)
{ {
Utils::SVG::SVGOut svg(filename,model,proj); Utils::SVG::SVGOut svg(filename,model,proj);
svg.setAttenuationFactor(af);
toSVG(svg); toSVG(svg);
svg.write(); svg.write();
} }
...@@ -721,9 +723,13 @@ inline void ExplodeVolumeRender::toSVG(Utils::SVG::SVGOut& svg) ...@@ -721,9 +723,13 @@ inline void ExplodeVolumeRender::toSVG(Utils::SVG::SVGOut& svg)
for (unsigned int i=0; i<m_nbLines; ++i) for (unsigned int i=0; i<m_nbLines; ++i)
{ {
Geom::Vec3f C = ptr[3*i]; Geom::Vec3f C = ptr[3*i];
Geom::Vec3f P = XexplV*C + m_explodeV*ptr[3*i+1]; Geom::Vec4f C4 = Geom::Vec4f(C[0],C[1],C[2],1.0f);
Geom::Vec3f Q = XexplV*C + m_explodeV*ptr[3*i+2]; if (m_clipPlane*C4 <=0.0f)
svg2->addLine(P, Q, col3); {
Geom::Vec3f P = XexplV*C + m_explodeV*ptr[3*i+1];
Geom::Vec3f Q = XexplV*C + m_explodeV*ptr[3*i+2];
svg2->addLine(P, Q, col3);
}
} }
svg2->endLines(); svg2->endLines();
m_vboPosLine->releasePtr(); m_vboPosLine->releasePtr();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment