Changeset 2332 for trunk/packages


Ignore:
Timestamp:
Aug 5, 2011 9:20:18 AM (13 years ago)
Author:
ldelgass
Message:
  • Don't enable backface culling if object is not opaque
  • Add edge visibility,color,linewidth for Glyphs
  • Add control for 2 sided lighting in renderer
  • Remove cached scalar range/bounds from DataSet?, VTK already caches this
  • Add DataSet? methods for setting active scalars/vectors, and getting range of vector magnitudes, a vector component, or a named field. This is beginning work needed to allow selecting fields to use in filters and color mapping.
Location:
trunk/packages/vizservers/vtkvis
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/ColorMap.cpp

    r2320 r2332  
    248248 * \brief Perform linear interpolation of two color control points
    249249 */
    250 void ColorMap::lerp(double *result, const ControlPoint& cp1, const ControlPoint& cp2, double value)
     250void ColorMap::lerp(double *result,
     251                    const ControlPoint& cp1,
     252                    const ControlPoint& cp2,
     253                    double value)
    251254{
    252255    double factor = (value - cp1.value) / (cp2.value - cp1.value);
     
    259262 * \brief Perform linear interpolation of two opacity control points
    260263 */
    261 void ColorMap::lerp(double *result, const OpacityControlPoint& cp1, const OpacityControlPoint& cp2, double value)
     264void ColorMap::lerp(double *result,
     265                    const OpacityControlPoint& cp1,
     266                    const OpacityControlPoint& cp2,
     267                    double value)
    262268{
    263269    double factor = (value - cp1.value) / (cp2.value - cp1.value);
  • trunk/packages/vizservers/vtkvis/Makefile.in

    r2328 r2332  
    2323MKDIR_P         = @MKDIR_P@
    2424
    25 GL_LIB_SPEC     = -lGL
     25GL_LIB_SPEC     = -lGL -lm
    2626
    2727TCL_LIB_SPEC    = @TCL_LIB_SPEC@
     
    5151USE_OFFSCREEN_RENDERING = yes
    5252
    53 EXTRA_CFLAGS    = -Wall -Wno-deprecated #vtk uses deprecated strstream header (instead of sstream)
     53#vtk uses deprecated strstream header (instead of sstream)
     54EXTRA_CFLAGS    = -Wall -Wno-deprecated
    5455DEFINES         =
    5556ifdef DEBUG
  • trunk/packages/vizservers/vtkvis/RpGlyphs.cpp

    r2330 r2332  
    3131    _scaleFactor(1.0)
    3232{
     33    _backfaceCulling = true;
    3334}
    3435
     
    175176    initProp();
    176177
    177     getActor()->GetProperty()->BackfaceCullingOn();
    178 
    179178    getActor()->SetMapper(_pdMapper);
    180179    _pdMapper->Update();
  • trunk/packages/vizservers/vtkvis/RpMolecule.cpp

    r2330 r2332  
    2929    _atomScaling(NO_ATOM_SCALING)
    3030{
     31    _backfaceCulling = true;
    3132}
    3233
     
    4849    if (_atomProp == NULL) {
    4950        _atomProp = vtkSmartPointer<vtkActor>::New();
    50         _atomProp->GetProperty()->BackfaceCullingOn();
     51        if (_backfaceCulling && _opacity == 1.0)
     52            _atomProp->GetProperty()->BackfaceCullingOn();
    5153        _atomProp->GetProperty()->EdgeVisibilityOff();
    5254        _atomProp->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);
     
    5961    if (_bondProp == NULL) {
    6062        _bondProp = vtkSmartPointer<vtkActor>::New();
    61         _bondProp->GetProperty()->BackfaceCullingOn();
     63        if (_backfaceCulling && _opacity == 1.0)
     64            _bondProp->GetProperty()->BackfaceCullingOn();
    6265        _bondProp->GetProperty()->EdgeVisibilityOff();
    6366        _bondProp->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);
  • trunk/packages/vizservers/vtkvis/RpStreamlines.cpp

    r2331 r2332  
    3232    _seedVisible(true)
    3333{
     34    _backfaceCulling = true;
    3435    _seedColor[0] = 1.0f;
    3536    _seedColor[1] = 1.0f;
     
    6162            break;
    6263        case TUBES:
    63             _linesActor->GetProperty()->BackfaceCullingOn();
     64            if (_backfaceCulling && _opacity == 1.0)
     65                _linesActor->GetProperty()->BackfaceCullingOn();
    6466            _linesActor->GetProperty()->SetRepresentationToSurface();
    6567            _linesActor->GetProperty()->EdgeVisibilityOff();
     
    437439        tubeFilter->SetRadius(radius);
    438440        _pdMapper->SetInputConnection(_lineFilter->GetOutputPort());
    439         _linesActor->GetProperty()->BackfaceCullingOn();
     441        if (_backfaceCulling && _opacity == 1.0)
     442            _linesActor->GetProperty()->BackfaceCullingOn();
    440443        _linesActor->GetProperty()->SetRepresentationToSurface();
    441444        _linesActor->GetProperty()->LightingOn();
     
    506509
    507510/**
     511 * \brief Set opacity of this object
     512 */
     513void Streamlines::setOpacity(double opacity)
     514{
     515    _opacity = opacity;
     516    if (_linesActor != NULL) {
     517        _linesActor->GetProperty()->SetOpacity(_opacity);
     518        if (_opacity < 1.0)
     519            _linesActor->GetProperty()->BackfaceCullingOff();
     520        else if (_backfaceCulling && _lineType == TUBES)
     521            _linesActor->GetProperty()->BackfaceCullingOn();
     522    }
     523    if (_seedActor != NULL) {
     524        _seedActor->GetProperty()->SetOpacity(_opacity);
     525    }
     526}
     527
     528/**
    508529 * \brief Turn on/off rendering of this Streamlines
    509530 */
  • trunk/packages/vizservers/vtkvis/RpStreamlines.h

    r2328 r2332  
    4545
    4646    virtual void setLighting(bool state);
    47    
     47
     48    virtual void setOpacity(double opacity);
     49
    4850    virtual void setVisibility(bool state);
    4951
  • trunk/packages/vizservers/vtkvis/RpVtkDataSet.cpp

    r2320 r2332  
    1717#include <vtkProperty.h>
    1818#include <vtkPointData.h>
     19#include <vtkCellData.h>
    1920#include <vtkLookupTable.h>
    2021
     
    2829    _visible(true)
    2930{
    30     _dataRange[0] = 0;
    31     _dataRange[1] = 1;
    32     for (int i = 0; i < 6; i++) {
    33         _bounds[i] = 0;
    34     }
    3531}
    3632
     
    123119    _dataSet->SetPipelineInformation(NULL);
    124120
    125     _dataSet->GetScalarRange(_dataRange);
    126     _dataSet->GetBounds(_bounds);
    127 
    128121    TRACE("DataSet class: %s", _dataSet->GetClassName());
    129     TRACE("Scalar Range: %.12e, %.12e", _dataRange[0], _dataRange[1]);
     122#ifdef WANT_TRACE
     123    double dataRange[2];
     124    getDataRange(dataRange);
     125    double bounds[6];
     126    getBounds(bounds);
     127#endif
     128    TRACE("Scalar Range: %.12e, %.12e", dataRange[0], dataRange[1]);
    130129    TRACE("DataSet bounds: %g %g %g %g %g %g",
    131           _bounds[0], _bounds[1],
    132           _bounds[2], _bounds[3],
    133           _bounds[4], _bounds[5]);
     130          bounds[0], bounds[1],
     131          bounds[2], bounds[3],
     132          bounds[4], bounds[5]);
    134133    return true;
    135134}
     
    144143    _dataSet = ds;
    145144    _dataSet->SetPipelineInformation(NULL);
    146     _dataSet->GetScalarRange(_dataRange);
    147     _dataSet->GetBounds(_bounds);
    148145
    149146    TRACE("DataSet class: %s", _dataSet->GetClassName());
    150     TRACE("Scalar Range: %.12e, %.12e", _dataRange[0], _dataRange[1]);
     147#ifdef WANT_TRACE
     148    double dataRange[2];
     149    getDataRange(dataRange);
     150    double bounds[6];
     151    getBounds(bounds);
     152#endif
     153    TRACE("Scalar Range: %.12e, %.12e", dataRange[0], dataRange[1]);
    151154    TRACE("DataSet bounds: %g %g %g %g %g %g",
    152           _bounds[0], _bounds[1],
    153           _bounds[2], _bounds[3],
    154           _bounds[4], _bounds[5]);
     155          bounds[0], bounds[1],
     156          bounds[2], bounds[3],
     157          bounds[4], bounds[5]);
    155158    return true;
    156159}
     
    184187        return NULL;
    185188    }
    186     _dataSet->GetScalarRange(_dataRange);
    187     _dataSet->GetBounds(_bounds);
    188189
    189190    TRACE("DataSet class: %s", _dataSet->GetClassName());
    190     TRACE("Scalar Range: %.12e, %.12e", _dataRange[0], _dataRange[1]);
     191#ifdef WANT_TRACE
     192    double dataRange[2];
     193    getDataRange(dataRange);
     194    double bounds[6];
     195    getBounds(bounds);
     196#endif   
     197    TRACE("Scalar Range: %.12e, %.12e", dataRange[0], dataRange[1]);
     198    TRACE("DataSet bounds: %g %g %g %g %g %g",
     199          bounds[0], bounds[1],
     200          bounds[2], bounds[3],
     201          bounds[4], bounds[5]);
    191202    return _dataSet;
    192203}
     
    197208bool DataSet::is2D() const
    198209{
    199     return (_bounds[4] == 0. && _bounds[4] == _bounds[5]);
     210    double bounds[6];
     211    getBounds(bounds);
     212    return (bounds[4] == 0. && bounds[4] == bounds[5]);
    200213}
    201214
     
    219232 * \brief Get the underlying VTK DataSet subclass class name
    220233 */
    221 const char *DataSet::getVtkType()
     234const char *DataSet::getVtkType() const
    222235{
    223236    return _dataSet->GetClassName();
     
    225238
    226239/**
     240 * \brief Set the ative scalar array to the named field
     241 */
     242bool DataSet::setActiveScalar(const char *name)
     243{
     244    bool found = false;
     245    if (_dataSet != NULL) {
     246        if (_dataSet->GetPointData() != NULL) {
     247            if (_dataSet->GetPointData()->SetActiveScalars(name))
     248                found = true;
     249        }
     250        if (_dataSet->GetCellData() != NULL) {
     251            if (_dataSet->GetCellData()->SetActiveScalars(name))
     252                found = true;
     253        }
     254    }
     255    return found;
     256}
     257
     258/**
     259 * \brief Set the ative vector array to the named field
     260 */
     261bool DataSet::setActiveVector(const char *name)
     262{
     263    bool found = false;
     264    if (_dataSet != NULL) {
     265        if (_dataSet->GetPointData() != NULL) {
     266            if (_dataSet->GetPointData()->SetActiveVectors(name))
     267                found = true;
     268        }
     269        if (_dataSet->GetCellData() != NULL) {
     270            if (_dataSet->GetCellData()->SetActiveVectors(name))
     271                found = true;
     272        }
     273    }
     274    return found;
     275}
     276
     277/**
    227278 * \brief Get the range of scalar values in the DataSet
    228279 */
    229 void DataSet::getDataRange(double minmax[2])
    230 {
    231     memcpy(minmax, _dataRange, sizeof(double)*2);
     280void DataSet::getDataRange(double minmax[2]) const
     281{
     282    _dataSet->GetScalarRange(minmax);
     283}
     284
     285/**
     286 * \brief Get the range of scalar values (or vector magnitudes) for
     287 * the named field in the DataSet
     288 */
     289void DataSet::getDataRange(double minmax[2], const char *fieldName) const
     290{
     291    if (_dataSet == NULL)
     292        return;
     293    if (_dataSet->GetPointData() != NULL &&
     294        _dataSet->GetPointData()->GetArray(fieldName) != NULL) {
     295        _dataSet->GetPointData()->GetArray(fieldName)->GetRange(minmax, -1);
     296    } else if (_dataSet->GetCellData() != NULL &&
     297        _dataSet->GetCellData()->GetArray(fieldName) != NULL) {
     298        _dataSet->GetCellData()->GetArray(fieldName)->GetRange(minmax, -1);
     299    } else if (_dataSet->GetFieldData() != NULL &&
     300        _dataSet->GetFieldData()->GetArray(fieldName) != NULL) {
     301        _dataSet->GetFieldData()->GetArray(fieldName)->GetRange(minmax, -1);
     302    }
     303}
     304
     305/**
     306 * \brief Get the range of vector magnitudes in the DataSet
     307 */
     308void DataSet::getVectorMagnitudeRange(double minmax[2]) const
     309{
     310    if (_dataSet == NULL)
     311        return;
     312    if (_dataSet->GetPointData() != NULL &&
     313        _dataSet->GetPointData()->GetVectors() != NULL) {
     314        _dataSet->GetPointData()->GetVectors()->GetRange(minmax, -1);
     315    } else if (_dataSet->GetCellData() != NULL &&
     316               _dataSet->GetCellData()->GetVectors() != NULL) {
     317        _dataSet->GetCellData()->GetVectors()->GetRange(minmax, -1);
     318    }
     319}
     320
     321/**
     322 * \brief Get the range of a vector component in the DataSet
     323 */
     324void DataSet::getVectorComponentRange(double minmax[2], int component) const
     325{
     326    if (_dataSet == NULL)
     327        return;
     328    if (_dataSet->GetPointData() != NULL ||
     329        _dataSet->GetPointData()->GetVectors() != NULL) {
     330        _dataSet->GetPointData()->GetVectors()->GetRange(minmax, component);
     331    } else if (_dataSet->GetCellData() != NULL &&
     332               _dataSet->GetCellData()->GetVectors() != NULL) {
     333        _dataSet->GetCellData()->GetVectors()->GetRange(minmax, component);
     334    }
    232335}
    233336
     
    235338 * \brief Get the bounds the DataSet
    236339 */
    237 void DataSet::getBounds(double bounds[6])
    238 {
    239     memcpy(bounds, _bounds, sizeof(double)*6);
     340void DataSet::getBounds(double bounds[6]) const
     341{
     342    _dataSet->GetBounds(bounds);
    240343}
    241344
     
    247350 * \return the value of the nearest point or 0 if no scalar data available
    248351 */
    249 double DataSet::getDataValue(double x, double y, double z)
     352double DataSet::getDataValue(double x, double y, double z) const
    250353{
    251354    if (_dataSet == NULL)
  • trunk/packages/vizservers/vtkvis/RpVtkDataSet.h

    r2290 r2332  
    4343    vtkDataSet *getVtkDataSet();
    4444
    45     const char *getVtkType();
     45    const char *getVtkType() const;
    4646
    47     void getDataRange(double minmax[2]);
     47    bool setActiveScalar(const char *name);
    4848
    49     void getBounds(double bounds[6]);
     49    bool setActiveVector(const char *name);
    5050
    51     double getDataValue(double x, double y, double z);
     51    void getDataRange(double minmax[2]) const;
     52
     53    void getDataRange(double minmax[2], const char *fieldName) const;
     54
     55    void getVectorMagnitudeRange(double minmax[2]) const;
     56
     57    void getVectorComponentRange(double minmax[2], int component) const;
     58
     59    void getBounds(double bounds[6]) const;
     60
     61    double getDataValue(double x, double y, double z) const;
    5262
    5363    void setVisibility(bool state);
     
    6070    std::string _name;
    6171    vtkSmartPointer<vtkDataSet> _dataSet;
    62     double _dataRange[2];
    63     double _bounds[6];
    6472    bool _visible;
    6573};
  • trunk/packages/vizservers/vtkvis/RpVtkGraphicsObject.h

    r2328 r2332  
    2626
    2727#include "RpVtkDataSet.h"
     28#include "Trace.h"
    2829
    2930namespace Rappture {
     
    3940        _opacity(1.0),
    4041        _edgeWidth(1.0f),
    41         _lighting(true)
     42        _lighting(true),
     43        _backfaceCulling(false)
    4244    {
    4345        _color[0] = 1.0f;
     
    229231        if (getActor() != NULL) {
    230232            getActor()->GetProperty()->SetOpacity(opacity);
     233            if (_backfaceCulling && _opacity < 1.0) {
     234                getActor()->GetProperty()->BackfaceCullingOff();
     235                TRACE("Backface culling off");
     236            } else if (_backfaceCulling && _opacity == 1.0) {
     237                getActor()->GetProperty()->BackfaceCullingOn();
     238                TRACE("Backface culling on");
     239            }
    231240        } else if (getAssembly() != NULL) {
    232241            vtkProp3DCollection *props = getAssembly()->GetParts();
     
    236245                if (vtkActor::SafeDownCast(prop) != NULL) {
    237246                    vtkActor::SafeDownCast(prop)->GetProperty()->SetOpacity(opacity);
     247                    if (_backfaceCulling && _opacity < 1.0) {
     248                        vtkActor::SafeDownCast(prop)->GetProperty()->BackfaceCullingOff();
     249                        TRACE("Backface culling off");
     250                    } else if (_backfaceCulling && _opacity == 1.0) {
     251                        vtkActor::SafeDownCast(prop)->GetProperty()->BackfaceCullingOn();
     252                        TRACE("Backface culling on");
     253                    }
    238254                }
    239255            }
     
    557573
    558574    /**
     575     * \brief Toggle backface culling of prop
     576     */
     577    virtual void setBackfaceCulling(bool state)
     578    {
     579        _backfaceCulling = state;
     580        if (state && _opacity < 1.0)
     581            return;
     582        if (getActor() != NULL) {
     583            getActor()->GetProperty()->SetBackfaceCulling((state ? 1 : 0));
     584         } else if (getAssembly() != NULL) {
     585            vtkProp3DCollection *props = getAssembly()->GetParts();
     586            vtkProp3D *prop;
     587            props->InitTraversal();
     588            while ((prop = props->GetNextProp3D()) != NULL) {
     589                if (vtkActor::SafeDownCast(prop) != NULL) {
     590                    vtkActor::SafeDownCast(prop)->GetProperty()->SetBackfaceCulling((state ? 1 : 0));
     591                }
     592            }
     593        }
     594    }
     595
     596    /**
    559597     * \brief Subclasses need to implement setting clipping planes in their mappers
    560598     */
     
    575613            if (!_lighting)
    576614                property->LightingOff();
     615            if (_backfaceCulling && _opacity == 1.0) {
     616                property->BackfaceCullingOn();
     617            }
    577618        }
    578619    }
     
    590631    float _edgeWidth;
    591632    bool _lighting;
     633    bool _backfaceCulling;
    592634
    593635    vtkSmartPointer<vtkProp> _prop;
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp

    r2329 r2332  
    20692069
    20702070/**
    2071  * \brief Set opacity of Glyphs for the given DataSet
    2072  */
    2073 void Renderer::setGlyphsOpacity(const DataSetId& id, double opacity)
     2071 * \brief Set the visibility of polygon edges for the specified DataSet
     2072 */
     2073void Renderer::setGlyphsEdgeVisibility(const DataSetId& id, bool state)
    20742074{
    20752075    GlyphsHashmap::iterator itr;
     
    20892089
    20902090    do {
     2091        itr->second->setEdgeVisibility(state);
     2092    } while (doAll && ++itr != _glyphs.end());
     2093
     2094    _needsRedraw = true;
     2095}
     2096
     2097/**
     2098 * \brief Set the RGB polygon edge color for the specified DataSet
     2099 */
     2100void Renderer::setGlyphsEdgeColor(const DataSetId& id, float color[3])
     2101{
     2102    GlyphsHashmap::iterator itr;
     2103
     2104    bool doAll = false;
     2105
     2106    if (id.compare("all") == 0) {
     2107        itr = _glyphs.begin();
     2108        doAll = true;
     2109    } else {
     2110        itr = _glyphs.find(id);
     2111    }
     2112    if (itr == _glyphs.end()) {
     2113        ERROR("Glyphs not found: %s", id.c_str());
     2114        return;
     2115    }
     2116
     2117    do {
     2118        itr->second->setEdgeColor(color);
     2119    } while (doAll && ++itr != _glyphs.end());
     2120
     2121    _needsRedraw = true;
     2122}
     2123
     2124/**
     2125 * \brief Set the polygon edge width for the specified DataSet (may be a no-op)
     2126 *
     2127 * If the OpenGL implementation/hardware does not support wide lines,
     2128 * this function may not have an effect.
     2129 */
     2130void Renderer::setGlyphsEdgeWidth(const DataSetId& id, float edgeWidth)
     2131{
     2132    GlyphsHashmap::iterator itr;
     2133
     2134    bool doAll = false;
     2135
     2136    if (id.compare("all") == 0) {
     2137        itr = _glyphs.begin();
     2138        doAll = true;
     2139    } else {
     2140        itr = _glyphs.find(id);
     2141    }
     2142    if (itr == _glyphs.end()) {
     2143        ERROR("Glyphs not found: %s", id.c_str());
     2144        return;
     2145    }
     2146
     2147    do {
     2148        itr->second->setEdgeWidth(edgeWidth);
     2149    } while (doAll && ++itr != _glyphs.end());
     2150
     2151    _needsRedraw = true;
     2152}
     2153
     2154/**
     2155 * \brief Turn Glyphs lighting on/off for the specified DataSet
     2156 */
     2157void Renderer::setGlyphsLighting(const DataSetId& id, bool state)
     2158{
     2159    GlyphsHashmap::iterator itr;
     2160
     2161    bool doAll = false;
     2162
     2163    if (id.compare("all") == 0) {
     2164        itr = _glyphs.begin();
     2165        doAll = true;
     2166    } else {
     2167        itr = _glyphs.find(id);
     2168    }
     2169    if (itr == _glyphs.end()) {
     2170        ERROR("Glyphs not found: %s", id.c_str());
     2171        return;
     2172    }
     2173
     2174    do {
     2175        itr->second->setLighting(state);
     2176    } while (doAll && ++itr != _glyphs.end());
     2177    _needsRedraw = true;
     2178}
     2179
     2180/**
     2181 * \brief Set opacity of Glyphs for the given DataSet
     2182 */
     2183void Renderer::setGlyphsOpacity(const DataSetId& id, double opacity)
     2184{
     2185    GlyphsHashmap::iterator itr;
     2186
     2187    bool doAll = false;
     2188
     2189    if (id.compare("all") == 0) {
     2190        itr = _glyphs.begin();
     2191        doAll = true;
     2192    } else {
     2193        itr = _glyphs.find(id);
     2194    }
     2195    if (itr == _glyphs.end()) {
     2196        ERROR("Glyphs not found: %s", id.c_str());
     2197        return;
     2198    }
     2199
     2200    do {
    20912201        itr->second->setOpacity(opacity);
    20922202    } while (doAll && ++itr != _glyphs.end());
     
    21462256    } while (doAll && ++itr != _glyphs.end());
    21472257
    2148     _needsRedraw = true;
    2149 }
    2150 
    2151 /**
    2152  * \brief Turn Glyphs lighting on/off for the specified DataSet
    2153  */
    2154 void Renderer::setGlyphsLighting(const DataSetId& id, bool state)
    2155 {
    2156     GlyphsHashmap::iterator itr;
    2157 
    2158     bool doAll = false;
    2159 
    2160     if (id.compare("all") == 0) {
    2161         itr = _glyphs.begin();
    2162         doAll = true;
    2163     } else {
    2164         itr = _glyphs.find(id);
    2165     }
    2166     if (itr == _glyphs.end()) {
    2167         ERROR("Glyphs not found: %s", id.c_str());
    2168         return;
    2169     }
    2170 
    2171     do {
    2172         itr->second->setLighting(state);
    2173     } while (doAll && ++itr != _glyphs.end());
    21742258    _needsRedraw = true;
    21752259}
     
    63686452
    63696453/**
     6454 * \brief Control the use of two sided lighting
     6455 */
     6456void Renderer::setUseTwoSidedLighting(bool state)
     6457{
     6458    _renderer->SetTwoSidedLighting(state ? 1 : 0);
     6459    _needsRedraw = true;
     6460}
     6461
     6462/**
    63706463 * \brief Control the use of the depth peeling algorithm for transparency
    63716464 */
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.h

    r2329 r2332  
    172172    void setClipPlane(Axis axis, double ratio, int direction);
    173173
     174    void setUseTwoSidedLighting(bool state);
     175
    174176    void setUseDepthPeeling(bool state);
    175177
     
    281283
    282284    Glyphs *getGlyphs(const DataSetId& id);
     285
     286    void setGlyphsEdgeVisibility(const DataSetId& id, bool state);
     287
     288    void setGlyphsEdgeColor(const DataSetId& id, float color[3]);
     289
     290    void setGlyphsEdgeWidth(const DataSetId& id, float edgeWidth);
    283291
    284292    void setGlyphsLighting(const DataSetId& id, bool state);
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r2329 r2332  
    13511351
    13521352static int
     1353GlyphsEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1354                       Tcl_Obj *const *objv)
     1355{
     1356    bool state;
     1357    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     1358        return TCL_ERROR;
     1359    }
     1360    if (objc == 4) {
     1361        const char *name = Tcl_GetString(objv[3]);
     1362        g_renderer->setGlyphsEdgeVisibility(name, state);
     1363    } else {
     1364        g_renderer->setGlyphsEdgeVisibility("all", state);
     1365    }
     1366    return TCL_OK;
     1367}
     1368
     1369static int
    13531370GlyphsLightingOp(ClientData clientData, Tcl_Interp *interp, int objc,
    13541371                 Tcl_Obj *const *objv)
     
    13631380    } else {
    13641381        g_renderer->setGlyphsLighting("all", state);
     1382    }
     1383    return TCL_OK;
     1384}
     1385
     1386static int
     1387GlyphsLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1388                  Tcl_Obj *const *objv)
     1389{
     1390    float color[3];
     1391    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     1392        GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK ||
     1393        GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) {
     1394        return TCL_ERROR;
     1395    }
     1396    if (objc == 6) {
     1397        const char *name = Tcl_GetString(objv[5]);
     1398        g_renderer->setGlyphsEdgeColor(name, color);
     1399    } else {
     1400        g_renderer->setGlyphsEdgeColor("all", color);
     1401    }
     1402    return TCL_OK;
     1403}
     1404
     1405static int
     1406GlyphsLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1407                  Tcl_Obj *const *objv)
     1408{
     1409    float width;
     1410    if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {
     1411        return TCL_ERROR;
     1412    }
     1413    if (objc == 4) {
     1414        const char *name = Tcl_GetString(objv[3]);
     1415        g_renderer->setGlyphsEdgeWidth(name, width);
     1416    } else {
     1417        g_renderer->setGlyphsEdgeWidth("all", width);
    13651418    }
    13661419    return TCL_OK;
     
    14791532    {"colormap",  1, GlyphsColorMapOp, 3, 4, "colorMapName ?dataSetNme?"},
    14801533    {"delete",    1, GlyphsDeleteOp, 2, 3, "?dataSetName?"},
    1481     {"lighting",  1, GlyphsLightingOp, 3, 4, "bool ?dataSetName?"},
     1534    {"edges",     1, GlyphsEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
     1535    {"lighting",  3, GlyphsLightingOp, 3, 4, "bool ?dataSetName?"},
     1536    {"linecolor", 5, GlyphsLineColorOp, 5, 6, "r g b ?dataSetName?"},
     1537    {"linewidth", 5, GlyphsLineWidthOp, 3, 4, "width ?dataSetName?"},
    14821538    {"opacity",   1, GlyphsOpacityOp, 3, 4, "value ?dataSetName?"},
    14831539    {"scale",     2, GlyphsScaleOp, 3, 4, "scaleFactor ?dataSetName?"},
     
    29573013
    29583014static int
     3015RendererTwoSidedLightingOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3016                           Tcl_Obj *const *objv)
     3017{
     3018    bool state;
     3019    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     3020        return TCL_ERROR;
     3021    }
     3022    g_renderer->setUseTwoSidedLighting(state);
     3023    return TCL_OK;
     3024}
     3025
     3026static int
    29593027RendererRenderOp(ClientData clientData, Tcl_Interp *interp, int objc,
    29603028                 Tcl_Obj *const *objv)
     
    29653033
    29663034static Rappture::CmdSpec rendererOps[] = {
    2967     {"clipplane", 1, RendererClipPlaneOp, 5, 5, "axis ratio direction"},
    2968     {"depthpeel", 1, RendererDepthPeelingOp, 3, 3, "bool"},
    2969     {"render",    1, RendererRenderOp, 2, 2, ""}
     3035    {"clipplane",  1, RendererClipPlaneOp, 5, 5, "axis ratio direction"},
     3036    {"depthpeel",  1, RendererDepthPeelingOp, 3, 3, "bool"},
     3037    {"light2side", 1, RendererTwoSidedLightingOp, 3, 3, "bool"},
     3038    {"render",     1, RendererRenderOp, 2, 2, ""}
    29703039};
    29713040static int nRendererOps = NumCmdSpecs(rendererOps);
  • trunk/packages/vizservers/vtkvis/protocol.txt

    r2329 r2332  
    1515renderer depthpeel <bool>
    1616         Set use of depth peeling algorithm for transparency
     17renderer light2side <bool>
     18         Toggle use of two-sided lighting (controls if backfaces are lit with a
     19         flipped normal)
    1720renderer render
    1821         Force a new image to be rendered - use for advancing animation
     
    112115glyphs colormap <colorMapName> <?dataSetName?>
    113116glyphs delete <?dataSetName?>
     117glyphs edges <bool> <?datasetName?>
    114118glyphs lighting <bool> <?datasetName?>
     119glyphs linecolor <r> <g> <b> <?datasetName?>
     120glyphs linewidth <val> <?datasetName?>
    115121glyphs opacity <val> <?datasetName?>
    116122glyphs scale <scaleFactor> <?datasetName?>
Note: See TracChangeset for help on using the changeset viewer.