Commit bbb9c5eb by Dirk Albrecht

[ADD] Added doc. Added some properties to change shader behaviour.

parent 6184f5bf
......@@ -32,11 +32,9 @@
#define VERTEXBIND 6
#include <string>
#include <vector>
#include <osg/Geode>
#include <osg/Switch>
#include <osg/ref_ptr>
#include <osg/Group>
#include "../../../dataHandler/datastructures/WFiberCluster.h"
#include "../../../dataHandler/WDataSetFibers.h"
......@@ -166,13 +164,6 @@ private:
WPropFilename m_saveFileName; //!< the filename for saving
WPropTrigger m_updateOC; //!< updates the output connector
WPropBool m_depthCueing;
WPropBool m_lightModel;
WPropBool m_usePointSprites;
WPropBool m_useQuadStripes;
WPropDouble m_lowDepthCueingFactor;
WPropDouble m_upperDepthCueingFactor;
WBoolFlag m_noData; //!< Flag indicating whether there is data to display.
WPropGroup m_cullBoxGroup; //!< property group for box culling
......@@ -180,7 +171,15 @@ private:
WPropBool m_showCullBox; //!< Enable/Disable showing of the cull box
WPropBool m_insideCullBox; //!< if true fibers inside the cull box are shown, outside if false
/**
WPropBool m_depthCueing; //!< Enable/Disable DepthCueing
WPropBool m_lightModel; //!< Change lightning model
WPropBool m_usePointSprites; //!< Enable/Disable PointSprites
WPropBool m_useQuadStripes; //!< Enable/Disable QuadStripes
WPropDouble m_lowDepthCueingFactor; //!< Set lower depth cueing factor
WPropDouble m_upperDepthCueingFactor; //!< Set upper depth cueing factor
WPropBool m_useProjection; //!< Enable/Disable projection
/**
* Input connector for a fiber dataset.
*/
boost::shared_ptr< WModuleInputData< const WDataSetFibers > > m_fiberInput;
......@@ -199,46 +198,89 @@ private:
* OSG node for this module. All other OSG nodes of this module should be
* placed as child to this node.
*/
osg::ref_ptr< osg::Group > m_osgNode;
osg::ref_ptr< osg::Switch > m_osgNode;
/**
* OSG geode for the osg drawable.
*/
osg::ref_ptr<osg::Geode> m_geodeTubeDrawable;
/**
* OSG geode for the osg drawable.
*/
osg::ref_ptr<osg::Geode> m_geodePointSprite;
/**
* OSG geode for the osg drawable.
*/
osg::ref_ptr< osg::Geode > m_geodeQuadStripes;
/**
* Array for vertices.
*/
osg::ref_ptr< osg::Vec3Array > m_tubeVerts;
/**
* Array for tangents.
*/
osg::ref_ptr< osg::Vec3Array > m_tubeTangents;
/**
* Array for texture coordinates.
*/
osg::ref_ptr< osg::Vec2Array > m_tubeTexCoords;
/**
* Array for colors.
*/
osg::ref_ptr< osg::Vec3Array > m_tubeColors;
/**
* Array for texture coordinates of the pointsprites.
*/
osg::ref_ptr< osg::Vec2Array > m_pointTexCoords;
/**
* OSG node for this module. All other OSG nodes of this module should be
* placed as child to this node.
*/
osg::ref_ptr< osg::Switch > m_osgSwitch;
/**
* Array for vertices of the pointsprites.
*/
osg::ref_ptr< osg::Vec3Array > m_pointVerts;
osg::ref_ptr< osg::Vec3Array > m_tubeVerts;
osg::ref_ptr< osg::Vec3Array > m_tubeTangents;
osg::ref_ptr< osg::Vec2Array > m_tubeTexCoords;
osg::ref_ptr< osg::Vec3Array > m_tubeColors;
osg::ref_ptr< osg::Vec2Array > m_pointTexCoords;
osg::ref_ptr< osg::Vec3Array > m_pointVerts;
osg::ref_ptr< osg::Vec3Array > m_pointTangents;
osg::ref_ptr< osg::Vec3Array > m_pointColors;
osg::ref_ptr< osg::VectorGLuint > m_fiberQuadStartIndexes;
osg::ref_ptr< osg::VectorGLuint > m_fiberPointStartIndexes;
/**
* Array for tangents of the pointsprites.
*/
osg::ref_ptr< osg::Vec3Array > m_pointTangents;
osg::ref_ptr< osg::Geode > m_geodeTubeDrawable;
osg::ref_ptr< osg::Geode > m_geodePointSprite;
osg::ref_ptr< osg::Geode > m_geodeQuadStripes;
/**
* Array for colors of the pointsprites.
*/
osg::ref_ptr< osg::Vec3Array > m_pointColors;
/**
* Vector for fiber start indices.
*/
boost::shared_ptr< std::vector< size_t > > m_fiberQuadStartIndexes;
/**
* Vector for fiber start indices.
*/
boost::shared_ptr< std::vector< size_t > > m_fiberPointStartIndexes;
/**
* stores pointer to the fiber drawer
*/
osg::ref_ptr< WTubeDrawable > m_tubeDrawable;
osg::ref_ptr< WTubeGeometry > m_tubeGeometryPointSprite;
/**
* stores pointer to the fiber drawer
*/
osg::ref_ptr< WTubeGeometry > m_tubeGeometryPointSprite;
/**
* stores pointer to the fiber drawer
*/
osg::ref_ptr< WTubeGeometry > m_tubeGeometryQuadStripes;
/**
* stores pointer to the fiber drawer
*/
osg::ref_ptr< WTubeGeometry > m_tubeGeometryQuadStripes;
/**
* stores pointer to the fiber drawer
*/
osg::ref_ptr< WTubeDrawable > m_tubeDrawable;
/**
/**
* lock to prevent concurrent threads trying to update the osg node
*/
boost::shared_mutex m_updateLock;
......@@ -247,8 +289,16 @@ private:
* the shader object for rendering tubes
*/
osg::ref_ptr< WShader >m_shaderTubes;
osg::ref_ptr< WShader >m_shaderTubesPS;
osg::ref_ptr< WShader >m_shaderTubesQS;
/**
* the shader object for rendering tubes
*/
osg::ref_ptr< WShader >m_shaderTubesPS;
/**
* the shader object for rendering tubes
*/
osg::ref_ptr< WShader >m_shaderTubesQS;
/**
......@@ -303,16 +353,19 @@ private:
osg::ref_ptr<osg::Uniform> m_uniformCullBoxUBY; //!< cull box upper bound
osg::ref_ptr<osg::Uniform> m_uniformCullBoxUBZ; //!< cull box upper bound
osg::ref_ptr<osg::Uniform> m_uniformViewportHeight;
osg::ref_ptr<osg::Uniform> m_uniformViewportWidth;
osg::ref_ptr<osg::Uniform> m_uniformViewportHeight; //!< viewport height
osg::ref_ptr<osg::Uniform> m_uniformViewportWidth; //!< viewport width
osg::ref_ptr<osg::Uniform> m_uniformDepthCueing;
osg::ref_ptr<osg::Uniform> m_uniformLightModel;
osg::ref_ptr<osg::Uniform> m_uniformUsePointSprites;
osg::ref_ptr<osg::Uniform> m_uniformUseQuadStripes;
osg::ref_ptr<osg::Uniform> m_uniformLowDepthCueingFactor;
osg::ref_ptr<osg::Uniform> m_uniformUpperDepthCueingFactor;
osg::ref_ptr<osg::Uniform> m_uniformDepthCueing; //!< notify shader that depth cueing is activated
osg::ref_ptr<osg::Uniform> m_uniformUseProjection; //!< notify shader that projection is activated
osg::ref_ptr<osg::Uniform> m_uniformLightModel; //!< notify shader that light model has changed
osg::ref_ptr<osg::Uniform> m_uniformUsePointSprites; //!< notify shader that pointsprites are activated
osg::ref_ptr<osg::Uniform> m_uniformUseQuadStripes; //!< notify shader that quadstripes are activated
osg::ref_ptr<osg::Uniform> m_uniformLowDepthCueingFactor; //!< lower clamp factor
osg::ref_ptr<osg::Uniform> m_uniformUpperDepthCueingFactor; //!< upper clamp factor
osg::ref_ptr<osg::Uniform> m_uniformNearPos; //!< near position of the bounding box
osg::ref_ptr<osg::Uniform> m_uniformFarPos; //!< far position of the bounding box
/**
* To avoid multiple instances of the fiber display.
*/
......@@ -347,27 +400,46 @@ private:
*/
void initCullBox();
/**
* Creates a texture to simmulate diffuse and specular lightning
* of a tube from aside
* \param rootState The uniforms will be applied to this state.
*/
void create1DTextureRectLightning( osg::StateSet* rootState ) const;
/**
* Creates a texture to simmulate diffuse and specular lightning
* of a tube from aside
*/
void create1DTextureRectLightning(osg::StateSet* rootState) const;
/**
* Creates a texture to simmulate diffuse and specular lightning
* of a tube from top or bottom
*/
void create2DTextureCycleLightning(osg::StateSet* rootState) const;
void create2DTexDiffuseLightning(osg::StateSet* rootState) const;
void create2DTexSpecularLightning(osg::StateSet* rootState) const;
/**
* Creates a texture to simmulate diffuse and specular lightning
* of a tube from top or bottom
* \param rootState The uniforms will be applied to this state.
*/
void create2DTextureCycleLightning( osg::StateSet* rootState ) const;
void createTextures(osg::StateSet* rootState) const;
void createTubeData();
/**
* Creates a texture to simmulate diffuse and specular lightning
* of a tube from top or bottom
* \param rootState The uniforms will be applied to this state.
*/
void create2DTexDiffuseLightning( osg::StateSet* rootState ) const;
/**
* Creates a texture to simmulate diffuse and specular lightning
* of a tube from top or bottom
* \param rootState The uniforms will be applied to this state.
*/
void create2DTexSpecularLightning( osg::StateSet* rootState ) const;
/**
* Creates a texture to simmulate diffuse and specular lightning
* of a tube from top or bottom
* \param rootState The uniforms will be applied to this state.
*/
void createTextures( osg::StateSet* rootState ) const;
/**
* Creates a texture to simmulate diffuse and specular lightning
* of a tube from top or bottom
*/
void createTubeData();
/**
* Wrapper class for userData to prevent cyclic destructor calls
......
......@@ -22,7 +22,10 @@
//
//---------------------------------------------------------------------------
#include <time.h>
#include <vector>
#include <cmath>
#include <iostream>
#include "../../../dataHandler/WDataSetFibers.h"
#include "../../../kernel/WKernel.h"
......@@ -36,10 +39,6 @@
#include <osg/AlphaFunc>
#include <osg/Timer>
#include <cmath>
#include <iostream>
#include <time.h>
// The constructor here does nothing. One thing that may be necessary is
// disabling display lists. This can be done by calling
// setSupportsDisplayList (false);
......@@ -53,8 +52,6 @@ WTubeDrawable::WTubeDrawable():
{
setSupportsDisplayList( false );
// This contructor intentionally left blank. Duh.
m_usePointSprite = false;
m_useQuadStrips = false;
}
// I can't say much about the methods below, but OSG seems to expect
......@@ -87,15 +84,9 @@ osg::Object* WTubeDrawable::clone( const osg::CopyOp& copyop ) const
// *Change the OpenGL state only if strictly necessary*.
void WTubeDrawable::drawImplementation( osg::RenderInfo& renderInfo ) const //NOLINT
{
if ( m_useTubes )
if ( m_useTubes )
{
// set current vieport height and width for the shaders
if(m_useQuadStrips)
{
m_rootState->getUniform("u_viewportHeight")->set( static_cast<int>( (*renderInfo.getCurrentCamera()->getViewport()).height() ) );
m_rootState->getUniform("u_viewportWidth")->set( static_cast<int>( (*renderInfo.getCurrentCamera()->getViewport()).width() ) );
} std::cout << "State /n";
drawTubes( renderInfo );
drawTubes( renderInfo );
}
else
{
......@@ -111,7 +102,6 @@ void WTubeDrawable::setDataset( boost::shared_ptr< const WDataSetFibers > datase
void WTubeDrawable::setUseTubes( bool flag )
{
m_useTubes = flag;
}
void WTubeDrawable::setColoringMode( bool globalColoring )
......@@ -129,6 +119,11 @@ void WTubeDrawable::setCustomColoring( bool custom )
m_customColoring = custom;
}
void WTubeDrawable::setBoundingBox( const osg::BoundingBox & bb )
{
setBound( bb );
}
void WTubeDrawable::drawFibers( osg::RenderInfo& renderInfo ) const //NOLINT
{
boost::shared_ptr< std::vector< size_t > > startIndexes = m_dataset->getLineStartIndexes();
......@@ -141,7 +136,7 @@ void WTubeDrawable::drawFibers( osg::RenderInfo& renderInfo ) const //NOLINT
{
colors = WKernel::getRunningKernel()->getRoiManager()->getCustomColors();
}
else
else
{
colors = ( m_globalColoring ? m_dataset->getGlobalColors() : m_dataset->getLocalColors() );
}
......@@ -166,99 +161,68 @@ void WTubeDrawable::drawFibers( osg::RenderInfo& renderInfo ) const //NOLINT
state.disableColorPointer();
}
void WTubeDrawable::setRootState(osg::StateSet* rootState)
{
m_rootState = rootState;
}
void WTubeDrawable::setActiveRenderingMode(bool usePointSprite, bool useQuadStrips)
{
m_usePointSprite = usePointSprite;
m_useQuadStrips = useQuadStrips;
}
void WTubeDrawable::drawTubes( osg::RenderInfo& renderInfo ) const
{
/*boost::shared_ptr< std::vector< size_t > > startIndexes = m_dataset->getLineStartIndexes();
boost::shared_ptr< std::vector< size_t > > pointsPerLine = m_dataset->getLineLengths();
boost::shared_ptr< std::vector< bool > > active = WKernel::getRunningKernel()->getRoiManager()->getBitField();
boost::shared_ptr< std::vector< float > > colors;
if ( m_customColoring )
{
colors = WKernel::getRunningKernel()->getRoiManager()->getCustomColors();
}
else
{
colors = ( m_globalColoring ? m_dataset->getGlobalColors() : m_dataset->getLocalColors() );
}
osg::State& state = *renderInfo.getState();
state.disableAllVertexArrays();
state.setVertexPointer( m_tubeVerts);
state.setColorPointer( m_tubeColors );
state.setNormalPointer(m_tubeTangents );
state.setTexCoordPointer(0, m_tubeTexCoords );
glEnable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
boost::shared_ptr< std::vector< size_t > > startIndexes = m_dataset->getLineStartIndexes();
boost::shared_ptr< std::vector< size_t > > pointsPerLine = m_dataset->getLineLengths();
boost::shared_ptr< std::vector< bool > > active = WKernel::getRunningKernel()->getRoiManager()->getBitField();
boost::shared_ptr< std::vector< float > > colors;
if ( m_customColoring )
{
colors = WKernel::getRunningKernel()->getRoiManager()->getCustomColors();
}
else
{
colors = ( m_globalColoring ? m_dataset->getGlobalColors() : m_dataset->getLocalColors() );
}
if(m_useQuadStrips)
{
for ( size_t i = 0; i < active->size(); ++i )
{
if ( (*active)[i] )
{
state.glDrawArraysInstanced( GL_QUAD_STRIP, m_tubeStartIndexes->at(i), 2 * (*pointsPerLine)[i], 1);
}
}
}
osg::State& state = *renderInfo.getState();
//osg::TexEnv* texEnvPS = new osg::TexEnv( osg::TexEnv::REPLACE);
//osg::AlphaFunc* alphaFunc = new osg::AlphaFunc(osg::AlphaFunc::NOTEQUAL,0.0f);
state.disableAllVertexArrays();
//state.setModeValidity(GL_VERTEX_PROGRAM_POINT_SIZE, osg::StateAttribute::ON);
//state.setModeValidity(GL_ALPHA_TEST, osg::StateAttribute::ON);
//state.setModeValidity(GL_POINT_SPRITE, osg::StateAttribute::ON);
//state.setVertexPointer( m_tubeVerts);
//state.setColorPointer( m_tubeColors );
//state.setNormalPointer(m_tubeTangents );
//state.setTexCoordPointer(0, m_tubeTexCoords );
//m_shaderTubes->setDefine("USE_POINTSPRITE");
glEnable( GL_DEPTH_TEST );
glDisable( GL_LIGHTING );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
//m_shaderTubesPS->apply(state);
//m_shaderTubesPS->applyDirect(state);
//if(m_useQuadStrips)
{
for ( size_t i = 0; i < active->size(); ++i )
{
if ( (*active)[i] )
{
//state.glDrawArraysInstanced( GL_QUAD_STRIP, m_tubeStartIndexes->at(i), 2 * (*pointsPerLine)[i], 1);
}
}
}
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
glEnable(GL_ALPHA_TEST);
glEnable(GL_POINT_SPRITE);
glEnable( GL_VERTEX_PROGRAM_POINT_SIZE );
glEnable( GL_ALPHA_TEST );
glEnable( GL_POINT_SPRITE );
glAlphaFunc(GL_NOTEQUAL, 0.0f);
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
glAlphaFunc( GL_NOTEQUAL, 0.0 );
glTexEnvi( GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE );
//state.setModeValidity(alphaFunc, osg::StateAttribute::ON);
//state.setModeValidity(texEnvPS, osg::StateAttribute::ON);
if(m_usePointSprite)
{
for ( size_t i = 0; i < active->size(); ++i )
{
if ( (*active)[i] )
{
state.glDrawArraysInstanced( GL_POINTS, m_tubeStartIndexes->at(i + active->size()), (*pointsPerLine)[i], 1);
}
}
}
// m_shaderTubesPS->deactivate(this);
//state.setModeValidity(GL_VERTEX_PROGRAM_POINT_SIZE, osg::StateAttribute::OFF);
//state.setModeValidity(GL_ALPHA_TEST, osg::StateAttribute::OFF);
//state.setModeValidity(GL_POINT_SPRITE, osg::StateAttribute::OFF);
//if(m_usePointSprite)
{
for ( size_t i = 0; i < active->size(); ++i )
{
if ( (*active)[i] )
{
//state.glDrawArraysInstanced( GL_POINTS, m_tubeStartIndexes->at(i + active->size()), (*pointsPerLine)[i], 1);
}
}
}
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
glDisable(GL_ALPHA_TEST);
glDisable(GL_POINT_SPRITE);
glDisable( GL_VERTEX_PROGRAM_POINT_SIZE );
glDisable( GL_ALPHA_TEST );
glDisable( GL_POINT_SPRITE );
state.disableVertexPointer();
state.disableColorPointer();*/
state.disableVertexPointer();
state.disableColorPointer();
}
......@@ -126,12 +126,16 @@ public:
*/
bool getColoringMode() const;
void setRootState(osg::StateSet* m_rootState);
/**
* Set the bounding box of all fibers.
* \param bb The new bounding box.
*/
void setBoundingBox( const osg::BoundingBox & bb );
void setActiveRenderingMode(bool usePointSprite, bool useQuadStrips);
protected:
private:
/**
/**
* Draw fibers as ordinary lines.
*
* \param renderInfo
......@@ -139,13 +143,9 @@ private:
void drawFibers( osg::RenderInfo& renderInfo ) const; //NOLINT
/**
* Draw fibers as fake tubes.
*/
void drawTubes( osg::RenderInfo& renderInfo ) const;
osg::StateSet* m_rootState;
bool m_usePointSprite;
bool m_useQuadStrips;
* \param renderInfo
*/
void drawTubes( osg::RenderInfo& renderInfo ) const;
boost::shared_ptr< const WDataSetFibers > m_dataset; //!< stores pointer to dataset
......
varying vec3 tangentR3; // Tangent vector in world space
varying float s_param; // s parameter of texture [-1..1]
varying float tangent_dot_view;
uniform bool globalColor;
uniform sampler1D texture;
uniform sampler2D texturePS;
varying float usePointSprite;
varying vec2 imageTangent;
varying vec4 tubeColor;
varying vec3 view;
......@@ -13,61 +11,71 @@ varying float NdotL;
varying vec3 normal;
varying vec3 halfVector;
varying float endPoint;
uniform gl_DepthRangeParameters gl_DepthRange;
varying float z;
varying float zNear;
varying float zFar;
uniform bool useDepthCueing;
uniform bool useLightModel;
uniform bool usePointSprites;
uniform bool useQuadStripes;
uniform bool useProjection;
void main()
{
vec3 L, V, T, N, halfV;
vec3 specular = 0.0;
float NdotL,NdotHV;
float alpha, beta, lt;
T = normalize(tangentR3);
V = normalize(view);
L = normalize(lightDir);
N = normalize(normal);
float depthCueingFactor = 1.0;
NdotL = max(dot(N,L),0.0);
vec4 color;
vec2 newTexCoords;
if ( useLightModel )
{
// koordinaten für illuminated lines texturen
alpha = dot(L,N) / sqrt(1 - pow( dot(L,T),2));
beta = dot(halfVector,N) / sqrt( 1 - pow( dot(halfVector, T), 2));
lt = dot(L, T);
}
else
{
//compute rotation in imageplane for pointsprite
vec2 imageTangentNorm = normalize(imageTangent);
newTexCoords.x = (imageTangentNorm.y * (gl_PointCoord.y - 0.5) + imageTangentNorm.x * (gl_PointCoord.x - 0.5)) + 0.5;
newTexCoords.y = (imageTangentNorm.y * (gl_PointCoord.x - 0.5) - imageTangentNorm.x * (gl_PointCoord.y - 0.5)) + 0.5;
}
vec3 L, V, T, N, halfV;
vec3 specular = 0.0;
float NdotL,NdotHV;
float alpha, beta, lt;
T = normalize(tangentR3);
V = normalize(view);
L = normalize(lightDir);
N = normalize(normal);
NdotL = max(dot(N,L),0.0);
vec4 color;
// koordinaten für illuminated lines texturen
alpha = dot(L,N) / sqrt(1 - pow( dot(L,T),2));
beta = dot(halfVector,N) / sqrt( 1 - pow( dot(halfVector, T), 2));
lt = dot(L, T);
//compute rotation in imageplane for pointsprite
vec2 imageTangentNorm = normalize(imageTangent);
vec2 newTexCoords;
newTexCoords.x = (imageTangentNorm.y * (gl_PointCoord.y - 0.5) + imageTangentNorm.x * (gl_PointCoord.x - 0.5)) + 0.5;
newTexCoords.y = (imageTangentNorm.y * (gl_PointCoord.x - 0.5) - imageTangentNorm.x * (gl_PointCoord.y - 0.5)) + 0.5;
if(endPoint == 0.0)
{
color = texture2D(texturePS, gl_PointCoord.xy );
color = texture2D(texturePS, newTexCoords.xy);
color.x = 1.0;
}
else
{
color = texture2D(texturePS, newTexCoords.xy);
}
gl_FragColor.a = color.z;
/* compute the specular term if NdotL is larger than zero */
if (NdotL > 0.0) {
if(endPoint == 0.0)
{
color = texture2D(texturePS, newTexCoords.xy);
color.x = 1.0;
}
else
{
color = texture2D(texturePS, newTexCoords.xy);
}
gl_FragColor.a = color.z;
// normalize the half-vector, and then compute the
// cosine (dot product) with the normal
halfV = normalize(halfVector);
/* compute the specular term if NdotL is larger than zero */
if (NdotL > 0.0)
{
// normalize the half-vector, and then compute the
// cosine (dot product) with the normal
halfV = normalize(halfVector);
NdotHV = max(dot(normal, halfV),0.0);
specular = pow(NdotHV,16) * color.y;
}
NdotHV = max(dot(normal, halfV),0.0);
specular = pow(NdotHV,16) * color.y;
}
float depthCueingFactor = (1 - (z+zNear)/(zNear+zFar));
gl_FragColor.rgb = tubeColor.rgb * ((color.x) + specular) * depthCueingFactor * depthCueingFactor;
if ( useDepthCueing )
{
depthCueingFactor = clamp((1 - (z+zNear)/(zNear+zFar)),0.5,0.8);
}
gl_FragColor.rgb = tubeColor.rgb * ((color.x) + specular) * depthCueingFactor * depthCueingFactor;
}
varying float tangent_dot_view;
varying vec3 tangentR3;
varying float s_param;
varying vec4 tubeColor;
uniform float u_thickness;
uniform int u_viewportHeight;
uniform int u_viewportWidth;
varying vec2 imageTangent;
varying float usePointSprite;
varying vec3 view;
varying vec3 lightDir;
varying float NdotL;
varying vec3 normal;
varying vec3 halfVector;
varying float endPoint;
uniform gl_DepthRangeParameters gl_DepthRange;
varying float z;
uniform vec3 nearPos;
uniform vec3 farPos;
varying float zNear;
varying float zFar;
void main()
{
float thickness;
vec4 pos;
vec3 lightPosition = vec3(0., 0., -1.);
usePointSprite = 1.0;
tangentR3 = gl_Normal;
endPoint = 1.0;
pos = gl_ModelViewProjectionMatrix * gl_Vertex;
z = pos.z;
zNear =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(nearPos,1.00)).z );
zFar =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(farPos,1.0)).z );
float tmp2 = zNear;
zNear = min( zNear, zFar );
zFar = max( zFar, tmp2 );
view = - pos.xyz;
attribute vec2 psTexCoords;
lightDir = normalize( lightPosition - pos.xyz);
vec3 cameraPosition = vec3(gl_ModelViewMatrixInverse * vec4(0,0,0,1.0));
vec3 cameraVector = cameraPosition - gl_Vertex.xyz;
vec3 referencePosition = vec3(gl_ModelViewProjectionMatrix * vec4(1.0, 1.0, 1.0, 0.0));
uniform float u_thickness;
uniform int u_viewportHeight;