Commit c8631f4c authored by Jan Möbius's avatar Jan Möbius

Tobias Selection for splat clouds

Selection Plugin is still in trunk

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13291 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 222344d2
......@@ -123,6 +123,28 @@ SplatCloudNode *splatCloudNode( BaseObjectData *_object )
//----------------------------------------------------------------
SplatCloud *splatCloud( BaseObjectData *_object )
{
if( !_object->dataType( DATA_SPLATCLOUD ) )
return 0;
SplatCloudObject *object = dynamic_cast<SplatCloudObject *>( _object );
if ( object == 0 )
return 0;
SplatCloudNode *node = object->splatCloudNode();
if( node == 0 )
return 0;
return node->splatCloud();
}
//----------------------------------------------------------------
SplatCloudObject *splatCloudObject( BaseObjectData *_object )
{
if( !_object->dataType( DATA_SPLATCLOUD ) )
......
......@@ -100,6 +100,15 @@ DLLEXPORT
SplatCloudNode *splatCloudNode( BaseObjectData *_object );
/** \brief Get a SplatCloud from an object.
*
* @param _object The object should be of type BaseDataObject. If the content is a SplatCloud, a
* SplatCloud will be returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
SplatCloud *splatCloud( BaseObjectData *_object );
/** \brief Cast an BaseObject to a SplatCloudObject if possible
*
* @param _object The object should be of type BaseDataObject. If the content is a SplatCloud, a
......
......@@ -56,10 +56,195 @@
//== IMPLEMENTATION ==============================================
unsigned int SplatCloud::countSelected() const
{
unsigned int numSelected = 0;
SelectionVector::const_iterator selectionIter;
for( selectionIter = selections_.begin(); selectionIter != selections_.end(); ++selectionIter )
{
if( *selectionIter )
++numSelected;
}
return numSelected;
}
//----------------------------------------------------------------
void SplatCloud::setSelections( const Selection &_selection )
{
// select all entries...
SelectionVector::iterator selectionIter;
for( selectionIter = selections_.begin(); selectionIter != selections_.end(); ++selectionIter )
(*selectionIter) = _selection;
}
//----------------------------------------------------------------
void SplatCloud::setSphereSelections( const Point &_center, float _sqRadius, const Selection &_selection )
{
// set all selections within given radius from center
PointVector::const_iterator pointIter = points_.begin();
SelectionVector::iterator selectionIter = selections_.begin();
for( ; pointIter != points_.end(); ++pointIter, ++selectionIter )
{
const Point &point = *pointIter;
float dx = point[0] - _center[0];
float dy = point[1] - _center[1];
float dz = point[2] - _center[2];
if( (dx*dx + dy*dy + dz*dz) <= _sqRadius )
*selectionIter = _selection;
}
}
//----------------------------------------------------------------
void SplatCloud::invertSelections()
{
// invert all entries...
SelectionVector::iterator selectionIter;
for( selectionIter = selections_.begin(); selectionIter != selections_.end(); ++selectionIter )
(*selectionIter) = !(*selectionIter);
}
//----------------------------------------------------------------
bool SplatCloud::deleteSelected()
{
// count number of selected points
unsigned int numSelected = countSelected();
// if no point selected, abort
if( numSelected == 0 )
return false; // nothing has been modified
unsigned int newSize = numPoints() - numSelected;
bool hasNrm = hasNormals();
bool hasPS = hasPointsizes();
bool hasCol = hasColors();
bool hasSel = hasSelections();
// create new (empty) data vectors
PointVector newPoints;
NormalVector newNormals;
PointsizeVector newPointsizes;
ColorVector newColors;
SelectionVector newSelections;
// reserve memory/space if data vector(s) in use
/* */ newPoints.reserve ( newSize );
if( hasNrm ) newNormals.reserve ( newSize );
if( hasPS ) newPointsizes.reserve( newSize );
if( hasCol ) newColors.reserve ( newSize );
if( hasSel ) newSelections.reserve( newSize );
PointVector::const_iterator pointIter = points_.begin();
NormalVector::const_iterator normalIter = normals_.begin();
PointsizeVector::const_iterator pointsizeIter = pointsizes_.begin();
ColorVector::const_iterator colorIter = colors_.begin();
SelectionVector::const_iterator selectionIter = selections_.begin();
// add old data entry to new data vector if point is *not* selected
while( pointIter != points_.end() )
{
bool unselected = !(*selectionIter);
{
if( unselected )
newPoints.push_back ( *pointIter );
++pointIter;
}
if( hasNrm )
{
if( unselected )
newNormals.push_back ( *normalIter );
++normalIter;
}
if( hasPS )
{
if( unselected )
newPointsizes.push_back( *pointsizeIter );
++pointsizeIter;
}
if( hasCol )
{
if( unselected )
newColors.push_back ( *colorIter );
++colorIter;
}
if( hasSel )
{
if( unselected )
newSelections.push_back( *selectionIter );
++selectionIter;
}
}
// replace old data vectors by new ones (even when data vector was *not* in use, so new vector has the right size)
points_ = newPoints;
normals_ = newNormals;
pointsizes_ = newPointsizes;
colors_ = newColors;
selections_ = newSelections;
return true; // data has been modified
}
//----------------------------------------------------------------
bool SplatCloud::colorizeSelected( const Color &_color )
{
// if colors_ vector is *not* of the right size, resize
if( numColors() != numPoints() )
colors_.resize( numPoints(), Color(255,255,255) ); // initialize with white color
bool modified = false;
ColorVector::iterator colorIter = colors_.begin();
SelectionVector::iterator selectionIter = selections_.begin();
// delete all selected entries (from selections_ vector and as well from points_, normals_, pointsizes_ and colors_ vectors)
while( selectionIter != selections_.end() )
{
if( *selectionIter )
{
(*colorIter) = _color;
modified = true;
}
++colorIter;
++selectionIter;
}
return modified;
}
//----------------------------------------------------------------
void SplatCloud::normalizeSize()
{
// check if there is nothing to do
if( points_.size() == 0 )
if( !hasPoints() )
return;
// calculate center-of-gravety
......@@ -76,7 +261,7 @@ void SplatCloud::normalizeSize()
cogZ += p[2];
}
float rcp_count = 1.0f / (float) points_.size();
float rcp_count = 1.0f / (float) numPoints();
cogX *= rcp_count;
cogY *= rcp_count;
cogZ *= rcp_count;
......@@ -128,7 +313,7 @@ void SplatCloud::translate( const Point &_t )
void SplatCloud::scale( float _s )
{
// scale points (and pointsizes as well)
if( pointsizes_.size() == points_.size() )
if( hasPointsizes() )
{
PointsizeVector::iterator pointsizeIter = pointsizes_.begin();
......
......@@ -56,12 +56,12 @@
//== INCLUDES ====================================================
#include <OpenFlipper/common/GlobalDefines.hh>
#include <ACG/Math/VectorT.hh>
#include <vector>
#include <OpenFlipper/common/GlobalDefines.hh>
//== CLASS DEFINITION ============================================
......@@ -82,11 +82,13 @@ public:
typedef ACG::Vec3f Normal;
typedef float Pointsize;
typedef ACG::Vec3uc Color;
typedef bool Selection;
typedef std::vector<Point> PointVector;
typedef std::vector<Normal> NormalVector;
typedef std::vector<Pointsize> PointsizeVector;
typedef std::vector<Color> ColorVector;
typedef std::vector<Selection> SelectionVector;
//----------------------------------------------------------------
......@@ -99,41 +101,63 @@ public:
normals_ ( _splatCloud.normals_ ),
pointsizes_ ( _splatCloud.pointsizes_ ),
colors_ ( _splatCloud.colors_ ),
selections_ ( _splatCloud.selections_ ),
translation_( _splatCloud.translation_ ),
scaleFactor_( _splatCloud.scaleFactor_ )
{ }
// ---- data vectors ----
inline void clearPoints() { points_.clear(); }
inline void clearNormals() { normals_.clear(); }
inline void clearPointsizes() { pointsizes_.clear(); }
inline void clearColors() { colors_.clear(); }
inline void clearPoints() { points_ = PointVector(); }
inline void clearNormals() { normals_ = NormalVector(); }
inline void clearPointsizes() { pointsizes_ = PointsizeVector(); }
inline void clearColors() { colors_ = ColorVector(); }
inline void clearSelections() { selections_ = SelectionVector(); }
inline void clear() { clearPoints(); clearNormals(); clearPointsizes(); clearColors(); }
inline void clear() { clearPoints(); clearNormals(); clearPointsizes(); clearColors(); clearSelections(); }
inline void addPoint ( const Point &_point ) { points_.push_back ( _point ); }
inline void addNormal ( const Normal &_normal ) { normals_.push_back ( _normal ); }
inline void addPointsize( const Pointsize &_pointsize ) { pointsizes_.push_back( _pointsize ); }
inline void addColor ( const Color &_color ) { colors_.push_back ( _color ); }
inline void addSelection( const Selection &_selection ) { selections_.push_back( _selection ); }
inline unsigned int numPoints() const { return points_.size(); }
inline unsigned int numNormals() const { return normals_.size(); }
inline unsigned int numPointsizes() const { return pointsizes_.size(); }
inline unsigned int numColors() const { return colors_.size(); }
inline unsigned int numSelections() const { return selections_.size(); } /// *not* numSelected() ! use countSelected() for this
inline bool hasPoints() const { return numPoints() > 0; }
inline bool hasNormals() const { return hasPoints() && (numNormals() == numPoints()); }
inline bool hasPointsizes() const { return hasPoints() && (numPointsizes() == numPoints()); }
inline bool hasColors() const { return hasPoints() && (numColors() == numPoints()); }
inline bool hasSelections() const { return hasPoints() && (numSelections() == numPoints()); }
inline bool hasNormals() const { return normals_.size() == points_.size(); }
inline bool hasPointsizes() const { return pointsizes_.size() == points_.size(); }
inline bool hasColors() const { return colors_.size() == points_.size(); }
inline void initNormals() { if( !hasNormals() ) normals_ = NormalVector ( numPoints(), Normal(0.0f,0.0f,0.0f) ); }
inline void initPointsizes() { if( !hasPointsizes() ) pointsizes_ = PointsizeVector( numPoints(), Pointsize(0.0f) ); }
inline void initColors() { if( !hasColors() ) colors_ = ColorVector ( numPoints(), Color(0,0,0) ); }
inline void initSelections() { if( !hasSelections() ) selections_ = SelectionVector( numPoints(), Selection(false) ); }
inline PointVector &points() { return points_; }
inline NormalVector &normals() { return normals_; }
inline PointsizeVector &pointsizes() { return pointsizes_; }
inline ColorVector &colors() { return colors_; }
inline SelectionVector &selections() { return selections_; }
inline const PointVector &points() const { return points_; }
inline const NormalVector &normals() const { return normals_; }
inline const PointsizeVector &pointsizes() const { return pointsizes_; }
inline const ColorVector &colors() const { return colors_; }
inline const SelectionVector &selections() const { return selections_; }
unsigned int countSelected() const;
void setSelections( const Selection &_selection );
void setSphereSelections( const Point &_center, float _sqRadius, const Selection &_selection );
void invertSelections();
bool deleteSelected();
bool colorizeSelected( const Color &_color );
// ---- translation and scale ----
......@@ -152,6 +176,7 @@ private:
NormalVector normals_;
PointsizeVector pointsizes_;
ColorVector colors_;
SelectionVector selections_;
// ---- translation and scale ----
Point translation_;
......
This diff is collapsed.
......@@ -94,6 +94,7 @@ private:
typedef SplatCloud::Normal Normal;
typedef SplatCloud::Pointsize Pointsize;
typedef SplatCloud::Color Color;
typedef SplatCloud::Selection Selection;
//----------------------------------------------------------------
......@@ -108,9 +109,7 @@ public:
ACG_CLASSNAME( SplatCloudNode );
/// return available draw modes
inline DrawModes::DrawMode availableDrawModes() const {
return splatsDrawMode_ | dotsDrawMode_ | pointsDrawMode_;
}
inline DrawModes::DrawMode availableDrawModes() const { return splatsDrawMode_ | dotsDrawMode_ | pointsDrawMode_; }
/// update bounding box
void boundingBox( ACG::Vec3d &_bbMin, ACG::Vec3d &_bbMax );
......@@ -129,56 +128,102 @@ public:
inline SplatCloud *splatCloud() { return splatCloud_; }
inline const SplatCloud *splatCloud() const { return splatCloud_; }
inline void modifiedPoints() { pointsModified_ = true; }
inline void modifiedNormals() { normalsModified_ = true; }
inline void modifiedPointsizes() { pointsizesModified_ = true; }
inline void modifiedColors() { colorsModified_ = true; }
inline void modifiedSelections() { selectionsModified_ = true; }
inline void modifiedPickColors() { pickColorsModified_ = true; }
inline void modifiedAll() { modifiedPoints(); modifiedNormals(); modifiedPointsizes(); modifiedColors(); modifiedSelections(); modifiedPickColors(); }
// ---- default values ----
// if an array is not present, changing the default value for this array will make the VBO invalid and trigger a rebuild()
inline void setDefaultNormal ( const Normal &_normal ) { defaultNormal_ = _normal; if( splatCloud_ && !splatCloud_->hasNormals() ) vboValid_ = false; }
inline void setDefaultPointsize( const Pointsize &_pointsize ) { defaultPointsize_ = _pointsize; if( splatCloud_ && !splatCloud_->hasPointsizes() ) vboValid_ = false; }
inline void setDefaultColor ( const Color &_color ) { defaultColor_ = _color; if( splatCloud_ && !splatCloud_->hasColors() ) vboValid_ = false; }
inline void setDefaultNormal ( const Normal &_normal ) { defaultNormal_ = _normal; }
inline void setDefaultPointsize( const Pointsize &_pointsize ) { defaultPointsize_ = _pointsize; }
inline void setDefaultColor ( const Color &_color ) { defaultColor_ = _color; }
inline const Normal &defaultNormal() const { return defaultNormal_; }
inline const Pointsize &defaultPointsize() const { return defaultPointsize_; }
inline const Color &defaultColor() const { return defaultColor_; }
// if the point, normal, pointsize or color with the given _index exists it is returned, otherwise the default value is returned (check for splatCloud_ != 0 first)
inline Point getPoint ( unsigned int _index ) const { return splatCloud_->points() [ _index ] ; }
inline Normal getNormal ( unsigned int _index ) const { return splatCloud_->hasNormals() ? splatCloud_->normals() [ _index ] : defaultNormal_ ; }
inline Pointsize getPointsize( unsigned int _index ) const { return splatCloud_->hasPointsizes() ? splatCloud_->pointsizes()[ _index ] : defaultPointsize_; }
inline Color getColor ( unsigned int _index ) const { return splatCloud_->hasColors() ? splatCloud_->colors() [ _index ] : defaultColor_ ; }
// ---- vertex buffer object ----
/// make vertex-buffer-object invalid so it will be rebuilt the next time drawn (or picked)
inline void invalidateVBO() { vboValid_ = false; }
/// if the data array exists, the entry with the given _index is returned, otherwise the default value is returned (check for splatCloud_ != 0 first)
inline Point getPoint ( unsigned int _index ) const { return splatCloud_->hasPoints() ? splatCloud_->points() [ _index ] : Point(0.0f,0.0f,0.0f); }
inline Normal getNormal ( unsigned int _index ) const { return splatCloud_->hasNormals() ? splatCloud_->normals() [ _index ] : defaultNormal_ ; }
inline Pointsize getPointsize( unsigned int _index ) const { return splatCloud_->hasPointsizes() ? splatCloud_->pointsizes()[ _index ] : defaultPointsize_ ; }
inline Color getColor ( unsigned int _index ) const { return splatCloud_->hasColors() ? splatCloud_->colors() [ _index ] : defaultColor_ ; }
inline Selection getSelection( unsigned int _index ) const { return splatCloud_->hasSelections() ? splatCloud_->selections()[ _index ] : false ; }
//----------------------------------------------------------------
private:
// ---- splat cloud ----
/// pointer to class containing all the data
SplatCloud *splatCloud_;
/// marks if parts of the data has been modified
bool pointsModified_;
bool normalsModified_;
bool pointsizesModified_;
bool colorsModified_;
bool selectionsModified_;
bool pickColorsModified_;
/// return true iff any of the data values in the VBO has to be changed
inline bool vboModified() const { return pointsModified_ || normalsModified_ || pointsizesModified_ || colorsModified_ || selectionsModified_ || pickColorsModified_; }
// ---- default values ----
/// the default values will be used when the specific array is not present
Normal defaultNormal_;
Pointsize defaultPointsize_;
Color defaultColor_;
// ---- draw modes ----
DrawModes::DrawMode splatsDrawMode_;
DrawModes::DrawMode dotsDrawMode_;
DrawModes::DrawMode pointsDrawMode_;
// ---- picking base index ----
unsigned int pickingBaseIndex_;
// ---- vertex buffer object ----
GLuint vboGlId_;
bool vboValid_;
GLuint vboGlId_;
unsigned int vboNumPoints_;
unsigned char *vboData_;
/// offsets relative to vboData_ or -1 if *not* present in VBO
int vboPointsOffset_;
int vboNormalsOffset_;
int vboPointsizesOffset_;
int vboColorsOffset_;
int vboSelectionsOffset_;
int vboPickColorsOffset_;
/// returns true iff the internal block structure of the VBO has to be changed (check for splatCloud_ != 0 first)
inline bool vboStructureModified() const { return
vboNumPoints_ != splatCloud_->numPoints() ||
(vboPointsOffset_ != -1) != splatCloud_->hasPoints() ||
(vboNormalsOffset_ != -1) != splatCloud_->hasNormals() ||
(vboPointsizesOffset_ != -1) != splatCloud_->hasPointsizes() ||
(vboColorsOffset_ != -1) != splatCloud_->hasColors() ||
(vboSelectionsOffset_ != -1) != splatCloud_->hasSelections(); }
void createVBO();
void destroyVBO();
void rebuildVBO( GLState &_state );
void rebuildVBOPoints();
void rebuildVBONormals();
void rebuildVBOPointsizes();
void rebuildVBOColors();
void rebuildVBOSelections();
void rebuildVBOPickColors( GLState &_state );
};
......
......@@ -580,8 +580,8 @@ void SplatCloudRenderingControlPlugin::slotToolboxRebuildVBOsButtonClicked()
// get scenegraph splatcloud-node
SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( *objIter );
// apply update (make vertex-buffer-object invalid so it will be rebuilt the next time the node is drawn (or picked))
splatCloudNode->invalidateVBO();
// rebuild the vertex-buffer-object the next time the node is drawn (or picked)
splatCloudNode->modifiedAll();
// emit signal that object has to be updated
emit updatedObject( objIter->id(), UPDATE_ALL );
......@@ -763,8 +763,8 @@ void SplatCloudRenderingControlPlugin::slotContextRebuildVBOActionTriggered()
// if object is a SplatCloud...
if( splatCloudNode )
{
// apply update (make vertex-buffer-object invalid so it will be rebuilt the next time the node is drawn (or picked))
splatCloudNode->invalidateVBO();
// rebuild the vertex-buffer-object the next time the node is drawn (or picked)
splatCloudNode->modifiedAll();
// emit signal that object has to be updated
emit updatedObject( object->id(), UPDATE_ALL );
......
......@@ -24,8 +24,8 @@ void main()
// output vertex in clip-coordinates
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
// calculate pointsize (gl_Color.a is the pointsize in model-coordinates)
float ecPointsize = modelviewScale * pointsizeScale * gl_Color.a;
// calculate pointsize (gl_MultiTexCoord0.x is the pointsize in model-coordinates)
float ecPointsize = modelviewScale * pointsizeScale * gl_MultiTexCoord0.x;
// output pointsize in window-coordinates
// - divided by gl_Position.w to shrink size by distance
......@@ -33,13 +33,22 @@ void main()
// - multiply by viewportScaleFov_y to get window coordinates
gl_PointSize = ecPointsize * viewportScaleFov_y / gl_Position.w;
////////////////////////////////////////////////////////////////////
/**/ /**/
/**/ // pass texture coordinate as color to fragment-shader /**/
/**/ gl_FrontColor = gl_MultiTexCoord0; /**/
/**/ /**/
/**/ /**/
////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
/**/ /**/
/**/ // pass primary color to fragment-shader /**/
/**/ gl_FrontColor = gl_Color; /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
//////////////////////////////////////////////////////////////
}
}
......@@ -24,8 +24,8 @@ void main()
// output vertex in clip-coordinates
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
// calculate pointsize (gl_Color.a is the pointsize in model-coordinates)
float ecPointsize = modelviewScale * pointsizeScale * gl_Color.a;
// calculate pointsize (gl_MultiTexCoord0.x is the pointsize in model-coordinates)
float ecPointsize = modelviewScale * pointsizeScale * gl_MultiTexCoord0.x;
// output pointsize in window-coordinates
// - divided by gl_Position.w to shrink size by distance
......@@ -33,13 +33,22 @@ void main()
// - multiply by viewportScaleFov_y to get window coordinates
gl_PointSize = ecPointsize * viewportScaleFov_y / gl_Position.w;
////////////////////////////////////////////////////////////////////
/**/ /**/
/**/ // pass color to fragment-shader /**/
/**/ gl_FrontColor.rgb = gl_Color.rgb; /**/
/**/ gl_FrontColor.a = 1.0; /**/
/**/ /**/
////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
/**/ /**/
/**/ // pass secondary color to fragment-shader /**/
/**/ // (if selected, pass selection-color instead) /**/
/**/ if( gl_MultiTexCoord1.x != 0.0 ) /**/
/**/ { /**/
/**/ gl_FrontColor = vec4( 1.0, 0.0, 0.0, 1.0 ); /**/
/**/ } /**/
/**/ else /**/
/**/ { /**/
/**/ gl_FrontColor.rgb = gl_SecondaryColor.rgb; /**/
/**/ gl_FrontColor.a = 1.0; /**/
/**/ /**/
/**/ } /**/
/**/ /**/
//////////////////////////////////////////////////////////////
}
}
......@@ -21,13 +21,22 @@ void main()
// output vertex in clip-coordinates
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
////////////////////////////////////////////////////////////////////
/**/ /**/
/**/ // pass texture coordinate as color to fragment-shader /**/
/**/ gl_FrontColor = gl_MultiTexCoord0; /**/
/**/ /**/
/**/ /**/
////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
/**/ /**/
/**/ // pass primary color to fragment-shader /**/
/**/ gl_FrontColor = gl_Color; /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ /**/
//////////////////////////////////////////////////////////////
}
}
......@@ -21,13 +21,22 @@ void main()
// output vertex in clip-coordinates
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
////////////////////////////////////////////////////////////////////
/**/ /**/
/**/ // pass color to fragment-shader /**/
/**/ gl_FrontColor.rgb = gl_Color.rgb; /**/
/**/ gl_FrontColor.a = 1.0; /**/
/**/ /**/
////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
/**/ /**/
/**/ // pass secondary color to fragment-shader /**/
/**/ // (if selected, pass selection-color instead) /**/
/**/ if( gl_MultiTexCoord1.x != 0.0 ) /**/
/**/ { /**/
/**/ gl_FrontColor = vec4( 1.0, 0.0, 0.0, 1.0 ); /**/
/**/ } /**/
/**/ else /**/
/**/ { /**/
/**/ gl_FrontColor.rgb = gl_SecondaryColor.rgb; /**/
/**/ gl_FrontColor.a = 1.0; /**/
/**/ /**/
/**/ } /**/
/**/ /**/
//////////////////////////////////////////////////////////////
}
}
......@@ -5,8 +5,8 @@ varying vec3 ecCenter;
varying vec3 ecScaledNormal;
varying float ecSquaredRadius;
uniform vec4 invViewportScale;
uniform vec4 invViewportTransp;
uniform vec4 invViewportScale;
uniform vec4 invViewportTransp;
uniform float viewportScale_z;
uniform float viewportTransp_z;
......
......@@ -38,8 +38,8 @@ void main()
// - scale so we do not have to do this in fragment-shader for every fragment
ecScaledNormal = ecNormal / dot( ecCenter, ecNormal );
// calculate pointsize (gl_Color.a is the pointsize in model-coordinates)
float ecPointsize = modelviewScale * pointsizeScale * gl_Color.a;
// calculate pointsize (gl_MultiTexCoord0.x is the pointsize in model-coordinates)
float ecPointsize = modelviewScale * pointsizeScale * gl_MultiTexCoord0.x;
// pass squared radius (= (1/2 pointsize)^2) in eye-coordinates to fragment-shader