Changeset 3859 for trunk/packages


Ignore:
Timestamp:
Aug 8, 2013 1:33:28 PM (11 years ago)
Author:
ldelgass
Message:

Add parallelpiped command to vtkvis

Location:
trunk/packages/vizservers/vtkvis
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/Makefile.in

    r3851 r3859  
    147147                Molecule.cpp \
    148148                Outline.cpp \
     149                Parallelpiped.cpp \
    149150                PolyData.cpp \
    150151                Polygon.cpp \
     
    230231Molecule.o: Molecule.h MoleculeData.h GraphicsObject.h DataSet.h Renderer.h ColorMap.h Trace.h
    231232Outline.o: Outline.h GraphicsObject.h DataSet.h Trace.h
     233Parallelpiped.o: Parallelpiped.h Shape.h GraphicsObject.h DataSet.h Renderer.h Trace.h
    232234PolyData.o: PolyData.h GraphicsObject.h DataSet.h Renderer.h Trace.h
    233235Polygon.o: Polygon.h Shape.h GraphicsObject.h DataSet.h Renderer.h Trace.h
     
    235237PseudoColor.o: PseudoColor.h GraphicsObject.h DataSet.h Renderer.h ColorMap.h Trace.h
    236238ReadBuffer.o: ReadBuffer.h Trace.h
    237 Renderer.o: Renderer.h RendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h Math.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h PolyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h Trace.h
    238 RendererCmd.o: Renderer.h RendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h PolyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h ReadBuffer.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h
    239 RendererGraphicsObjs.o: Renderer.h RendererGraphicsObjs.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h PolyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h Trace.h
     239Renderer.o: Renderer.h RendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h Math.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h Parallelpiped.h PolyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h Trace.h
     240RendererCmd.o: Renderer.h RendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h Parallelpiped.h PolyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h ReadBuffer.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h
     241RendererGraphicsObjs.o: Renderer.h RendererGraphicsObjs.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h Parallelpiped.h PolyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h Trace.h
    240242RenderServer.o: RenderServer.h RendererCmd.h Renderer.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h ReadBuffer.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h
    241243ResponseQueue.o: ResponseQueue.h Trace.h
  • trunk/packages/vizservers/vtkvis/RenderServer.h

    r3819 r3859  
    1616class Renderer;
    1717
    18 #define VTKVIS_VERSION_STRING "1.5"
     18#define VTKVIS_VERSION_STRING "1.6"
    1919
    2020#define MSECS_ELAPSED(t1, t2) \
  • trunk/packages/vizservers/vtkvis/Renderer.cpp

    r3828 r3859  
    197197    deleteAllGraphicsObjects<Molecule>();
    198198    deleteAllGraphicsObjects<Outline>();
     199    deleteAllGraphicsObjects<Parallelpiped>();
    199200    deleteAllGraphicsObjects<PolyData>();
    200201    deleteAllGraphicsObjects<Polygon>();
     
    24362437    setGraphicsObjectAspect<Molecule>(aspectRatio);
    24372438    setGraphicsObjectAspect<Outline>(aspectRatio);
     2439    setGraphicsObjectAspect<Parallelpiped>(aspectRatio);
    24382440    setGraphicsObjectAspect<PolyData>(aspectRatio);
    24392441    setGraphicsObjectAspect<Polygon>(aspectRatio);
     
    33573359    mergeGraphicsObjectBounds<Molecule>(bounds, onlyVisible);
    33583360    mergeGraphicsObjectBounds<Outline>(bounds, onlyVisible);
     3361    mergeGraphicsObjectBounds<Parallelpiped>(bounds, onlyVisible);
    33593362    mergeGraphicsObjectBounds<PolyData>(bounds, onlyVisible);
    33603363    mergeGraphicsObjectBounds<Polygon>(bounds, onlyVisible);
     
    34293432    mergeGraphicsObjectUnscaledBounds<Outline>(bounds, onlyVisible);
    34303433    mergeGraphicsObjectUnscaledBounds<PolyData>(bounds, onlyVisible);
     3434    mergeGraphicsObjectUnscaledBounds<Parallelpiped>(bounds, onlyVisible);
    34313435    mergeGraphicsObjectUnscaledBounds<Polygon>(bounds, onlyVisible);
    34323436    mergeGraphicsObjectUnscaledBounds<PseudoColor>(bounds, onlyVisible);
     
    45774581    setGraphicsObjectClippingPlanes<Molecule>(_activeClipPlanes);
    45784582    setGraphicsObjectClippingPlanes<Outline>(_activeClipPlanes);
     4583    setGraphicsObjectClippingPlanes<Parallelpiped>(_activeClipPlanes);
    45794584    setGraphicsObjectClippingPlanes<PolyData>(_activeClipPlanes);
    45804585    setGraphicsObjectClippingPlanes<Polygon>(_activeClipPlanes);
  • trunk/packages/vizservers/vtkvis/Renderer.h

    r3818 r3859  
    4545#include "Molecule.h"
    4646#include "Outline.h"
     47#include "Parallelpiped.h"
    4748#include "PolyData.h"
    4849#include "Polygon.h"
     
    809810                              const char *name, double range[2] = NULL);
    810811
    811     // N-sided Regular Polygons
    812 
    813     bool addPolygon(const DataSetId& id, int numSides, double center[3], double normal[3], double radius);
     812    // Parallelpipeds
     813
     814    bool addParallelpiped(const DataSetId& id, double vec1[3], double vec2[3], double vec3[3],
     815                          bool flipNormals = false);
    814816
    815817    // PolyData meshes
     
    826828                              DataSet::DataAttributeType type,
    827829                              const char *name, double range[2] = NULL);
     830
     831    // N-sided Regular Polygons
     832
     833    bool addPolygon(const DataSetId& id, int numSides, double center[3], double normal[3], double radius);
    828834
    829835    // Color-mapped surfaces
     
    975981    typedef std::tr1::unordered_map<DataSetId, Molecule *> MoleculeHashmap;
    976982    typedef std::tr1::unordered_map<DataSetId, Outline *> OutlineHashmap;
     983    typedef std::tr1::unordered_map<DataSetId, Parallelpiped *> ParallelpipedHashmap;
    977984    typedef std::tr1::unordered_map<DataSetId, PolyData *> PolyDataHashmap;
    978985    typedef std::tr1::unordered_map<DataSetId, Polygon *> PolygonHashmap;
     
    11141121    MoleculeHashmap _molecules;
    11151122    OutlineHashmap _outlines;
     1123    ParallelpipedHashmap _parallelpipeds;
    11161124    PolyDataHashmap _polyDatas;
    11171125    PolygonHashmap _polygons;
  • trunk/packages/vizservers/vtkvis/RendererCmd.cpp

    r3835 r3859  
    85598559
    85608560static int
     8561ParallelpipedAddOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8562                   Tcl_Obj *const *objv)
     8563{
     8564    double vec1[3], vec2[3], vec3[3];
     8565    if (Tcl_GetDoubleFromObj(interp, objv[2], &vec1[0]) != TCL_OK ||
     8566        Tcl_GetDoubleFromObj(interp, objv[3], &vec1[1]) != TCL_OK ||
     8567        Tcl_GetDoubleFromObj(interp, objv[4], &vec1[2]) != TCL_OK ||
     8568        Tcl_GetDoubleFromObj(interp, objv[5], &vec2[0]) != TCL_OK ||
     8569        Tcl_GetDoubleFromObj(interp, objv[6], &vec2[1]) != TCL_OK ||
     8570        Tcl_GetDoubleFromObj(interp, objv[7], &vec2[2]) != TCL_OK ||
     8571        Tcl_GetDoubleFromObj(interp, objv[8], &vec3[0]) != TCL_OK ||
     8572        Tcl_GetDoubleFromObj(interp, objv[9], &vec3[1]) != TCL_OK ||
     8573        Tcl_GetDoubleFromObj(interp, objv[10], &vec3[2]) != TCL_OK) {
     8574        return TCL_ERROR;
     8575    }
     8576    const char *name = Tcl_GetString(objv[11]);
     8577    if (!g_renderer->addParallelpiped(name, vec1, vec2, vec3)) {
     8578        Tcl_AppendResult(interp, "Failed to create parallelpiped", (char*)NULL);
     8579        return TCL_ERROR;
     8580    }
     8581    return TCL_OK;
     8582}
     8583
     8584static int
     8585ParallelpipedDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8586                      Tcl_Obj *const *objv)
     8587{
     8588    if (objc == 3) {
     8589        const char *name = Tcl_GetString(objv[2]);
     8590        g_renderer->deleteGraphicsObject<Parallelpiped>(name);
     8591    } else {
     8592        g_renderer->deleteGraphicsObject<Parallelpiped>("all");
     8593    }
     8594    return TCL_OK;
     8595}
     8596
     8597static int
     8598ParallelpipedColorOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8599                     Tcl_Obj *const *objv)
     8600{
     8601    float color[3];
     8602    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     8603        GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK ||
     8604        GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) {
     8605        return TCL_ERROR;
     8606    }
     8607    if (objc == 6) {
     8608        const char *name = Tcl_GetString(objv[5]);
     8609        g_renderer->setGraphicsObjectColor<Parallelpiped>(name, color);
     8610    } else {
     8611        g_renderer->setGraphicsObjectColor<Parallelpiped>("all", color);
     8612    }
     8613    return TCL_OK;
     8614}
     8615
     8616static int
     8617ParallelpipedCullingOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8618                       Tcl_Obj *const *objv)
     8619{
     8620    bool state;
     8621    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     8622        return TCL_ERROR;
     8623    }
     8624    if (objc == 4) {
     8625        const char *name = Tcl_GetString(objv[3]);
     8626        g_renderer->setGraphicsObjectCulling<Parallelpiped>(name, state);
     8627    } else {
     8628        g_renderer->setGraphicsObjectCulling<Parallelpiped>("all", state);
     8629    }
     8630    return TCL_OK;
     8631}
     8632
     8633static int
     8634ParallelpipedEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8635                              Tcl_Obj *const *objv)
     8636{
     8637    bool state;
     8638    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     8639        return TCL_ERROR;
     8640    }
     8641    if (objc == 4) {
     8642        const char *name = Tcl_GetString(objv[3]);
     8643        g_renderer->setGraphicsObjectEdgeVisibility<Parallelpiped>(name, state);
     8644    } else {
     8645        g_renderer->setGraphicsObjectEdgeVisibility<Parallelpiped>("all", state);
     8646    }
     8647    return TCL_OK;
     8648}
     8649
     8650static int
     8651ParallelpipedFlipNormalsOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8652                           Tcl_Obj *const *objv)
     8653{
     8654    bool state;
     8655    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     8656        return TCL_ERROR;
     8657    }
     8658    if (objc == 4) {
     8659        const char *name = Tcl_GetString(objv[3]);
     8660        g_renderer->setGraphicsObjectFlipNormals<Parallelpiped>(name, state);
     8661    } else {
     8662        g_renderer->setGraphicsObjectFlipNormals<Parallelpiped>("all", state);
     8663    }
     8664    return TCL_OK;
     8665}
     8666
     8667static int
     8668ParallelpipedLightingOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8669                        Tcl_Obj *const *objv)
     8670{
     8671    bool state;
     8672    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     8673        return TCL_ERROR;
     8674    }
     8675    if (objc == 4) {
     8676        const char *name = Tcl_GetString(objv[3]);
     8677        g_renderer->setGraphicsObjectLighting<Parallelpiped>(name, state);
     8678    } else {
     8679        g_renderer->setGraphicsObjectLighting<Parallelpiped>("all", state);
     8680    }
     8681    return TCL_OK;
     8682}
     8683
     8684static int
     8685ParallelpipedLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8686                         Tcl_Obj *const *objv)
     8687{
     8688    float color[3];
     8689    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     8690        GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK ||
     8691        GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) {
     8692        return TCL_ERROR;
     8693    }
     8694    if (objc == 6) {
     8695        const char *name = Tcl_GetString(objv[5]);
     8696        g_renderer->setGraphicsObjectEdgeColor<Parallelpiped>(name, color);
     8697    } else {
     8698        g_renderer->setGraphicsObjectEdgeColor<Parallelpiped>("all", color);
     8699    }
     8700    return TCL_OK;
     8701}
     8702
     8703static int
     8704ParallelpipedLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8705                         Tcl_Obj *const *objv)
     8706{
     8707    float width;
     8708    if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {
     8709        return TCL_ERROR;
     8710    }
     8711    if (objc == 4) {
     8712        const char *name = Tcl_GetString(objv[3]);
     8713        g_renderer->setGraphicsObjectEdgeWidth<Parallelpiped>(name, width);
     8714    } else {
     8715        g_renderer->setGraphicsObjectEdgeWidth<Parallelpiped>("all", width);
     8716    }
     8717    return TCL_OK;
     8718}
     8719
     8720static int
     8721ParallelpipedMaterialOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8722                        Tcl_Obj *const *objv)
     8723{
     8724    double ambient, diffuse, specCoeff, specPower;
     8725    if (Tcl_GetDoubleFromObj(interp, objv[2], &ambient) != TCL_OK ||
     8726        Tcl_GetDoubleFromObj(interp, objv[3], &diffuse) != TCL_OK ||
     8727        Tcl_GetDoubleFromObj(interp, objv[4], &specCoeff) != TCL_OK ||
     8728        Tcl_GetDoubleFromObj(interp, objv[5], &specPower) != TCL_OK) {
     8729        return TCL_ERROR;
     8730    }
     8731
     8732    if (objc == 7) {
     8733        const char *name = Tcl_GetString(objv[6]);
     8734        g_renderer->setGraphicsObjectAmbient<Parallelpiped>(name, ambient);
     8735        g_renderer->setGraphicsObjectDiffuse<Parallelpiped>(name, diffuse);
     8736        g_renderer->setGraphicsObjectSpecular<Parallelpiped>(name, specCoeff, specPower);
     8737    } else {
     8738        g_renderer->setGraphicsObjectAmbient<Parallelpiped>("all", ambient);
     8739        g_renderer->setGraphicsObjectDiffuse<Parallelpiped>("all", diffuse);
     8740        g_renderer->setGraphicsObjectSpecular<Parallelpiped>("all", specCoeff, specPower);
     8741    }
     8742    return TCL_OK;
     8743}
     8744
     8745static int
     8746ParallelpipedOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8747                       Tcl_Obj *const *objv)
     8748{
     8749    double opacity;
     8750    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
     8751        return TCL_ERROR;
     8752    }
     8753    if (objc == 4) {
     8754        const char *name = Tcl_GetString(objv[3]);
     8755        g_renderer->setGraphicsObjectOpacity<Parallelpiped>(name, opacity);
     8756    } else {
     8757        g_renderer->setGraphicsObjectOpacity<Parallelpiped>("all", opacity);
     8758    }
     8759    return TCL_OK;
     8760}
     8761
     8762static int
     8763ParallelpipedOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8764                      Tcl_Obj *const *objv)
     8765{
     8766    double quat[4];
     8767    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     8768        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     8769        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     8770        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     8771        return TCL_ERROR;
     8772    }
     8773    if (objc == 7) {
     8774        const char *name = Tcl_GetString(objv[6]);
     8775        g_renderer->setGraphicsObjectOrientation<Parallelpiped>(name, quat);
     8776    } else {
     8777        g_renderer->setGraphicsObjectOrientation<Parallelpiped>("all", quat);
     8778    }
     8779    return TCL_OK;
     8780}
     8781
     8782static int
     8783ParallelpipedOriginOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8784                      Tcl_Obj *const *objv)
     8785{
     8786    double origin[3];
     8787    if (Tcl_GetDoubleFromObj(interp, objv[2], &origin[0]) != TCL_OK ||
     8788        Tcl_GetDoubleFromObj(interp, objv[3], &origin[1]) != TCL_OK ||
     8789        Tcl_GetDoubleFromObj(interp, objv[4], &origin[2]) != TCL_OK) {
     8790        return TCL_ERROR;
     8791    }
     8792    if (objc == 6) {
     8793        const char *name = Tcl_GetString(objv[5]);
     8794        g_renderer->setGraphicsObjectOrigin<Parallelpiped>(name, origin);
     8795    } else {
     8796        g_renderer->setGraphicsObjectOrigin<Parallelpiped>("all", origin);
     8797    }
     8798    return TCL_OK;
     8799}
     8800
     8801static int
     8802ParallelpipedPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8803                        Tcl_Obj *const *objv)
     8804{
     8805    double pos[3];
     8806    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     8807        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     8808        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     8809        return TCL_ERROR;
     8810    }
     8811    if (objc == 6) {
     8812        const char *name = Tcl_GetString(objv[5]);
     8813        g_renderer->setGraphicsObjectPosition<Parallelpiped>(name, pos);
     8814    } else {
     8815        g_renderer->setGraphicsObjectPosition<Parallelpiped>("all", pos);
     8816    }
     8817    return TCL_OK;
     8818}
     8819
     8820static int
     8821ParallelpipedScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8822                     Tcl_Obj *const *objv)
     8823{
     8824    double scale[3];
     8825    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     8826        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     8827        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     8828        return TCL_ERROR;
     8829    }
     8830    if (objc == 6) {
     8831        const char *name = Tcl_GetString(objv[5]);
     8832        g_renderer->setGraphicsObjectScale<Parallelpiped>(name, scale);
     8833    } else {
     8834        g_renderer->setGraphicsObjectScale<Parallelpiped>("all", scale);
     8835    }
     8836    return TCL_OK;
     8837}
     8838
     8839static int
     8840ParallelpipedShadingOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8841                       Tcl_Obj *const *objv)
     8842{
     8843    GraphicsObject::ShadingModel shadeModel;
     8844    const char *str = Tcl_GetString(objv[2]);
     8845    if (str[0] == 'f' && strcmp(str, "flat") == 0) {
     8846        shadeModel = GraphicsObject::SHADE_FLAT;
     8847    } else if (str[0] == 's' && strcmp(str, "smooth") == 0) {
     8848        shadeModel = GraphicsObject::SHADE_GOURAUD;
     8849    } else {
     8850         Tcl_AppendResult(interp, "bad shading option \"", str,
     8851                         "\": should be one of: 'flat', 'smooth'", (char*)NULL);
     8852        return TCL_ERROR;
     8853    }
     8854    if (objc == 4) {
     8855        const char *name = Tcl_GetString(objv[3]);
     8856        g_renderer->setGraphicsObjectShadingModel<Parallelpiped>(name, shadeModel);
     8857    } else {
     8858        g_renderer->setGraphicsObjectShadingModel<Parallelpiped>("all", shadeModel);
     8859    }
     8860    return TCL_OK;
     8861}
     8862
     8863static int
     8864ParallelpipedVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8865                       Tcl_Obj *const *objv)
     8866{
     8867    bool state;
     8868    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     8869        return TCL_ERROR;
     8870    }
     8871    if (objc == 4) {
     8872        const char *name = Tcl_GetString(objv[3]);
     8873        g_renderer->setGraphicsObjectVisibility<Parallelpiped>(name, state);
     8874    } else {
     8875        g_renderer->setGraphicsObjectVisibility<Parallelpiped>("all", state);
     8876    }
     8877    return TCL_OK;
     8878}
     8879
     8880static int
     8881ParallelpipedWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc,
     8882                         Tcl_Obj *const *objv)
     8883{
     8884    bool state;
     8885    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     8886        return TCL_ERROR;
     8887    }
     8888    if (objc == 4) {
     8889        const char *name = Tcl_GetString(objv[3]);
     8890        g_renderer->setGraphicsObjectWireframe<Parallelpiped>(name, state);
     8891    } else {
     8892        g_renderer->setGraphicsObjectWireframe<Parallelpiped>("all", state);
     8893    }
     8894    return TCL_OK;
     8895}
     8896
     8897static Rappture::CmdSpec parallelpipedOps[] = {
     8898    {"add",       1, ParallelpipedAddOp, 12, 12, "v0x v0y v0z v1x v1y v1z v2x v2y v2z name"},
     8899    {"color",     2, ParallelpipedColorOp, 5, 6, "r g b ?name?"},
     8900    {"culling",   2, ParallelpipedCullingOp, 3, 4, "bool ?name?"},
     8901    {"delete",    1, ParallelpipedDeleteOp, 2, 3, "?name?"},
     8902    {"edges",     1, ParallelpipedEdgeVisibilityOp, 3, 4, "bool ?name?"},
     8903    {"flipnorms", 1, ParallelpipedFlipNormalsOp, 3, 4, "bool ?name?"},
     8904    {"lighting",  3, ParallelpipedLightingOp, 3, 4, "bool ?name?"},
     8905    {"linecolor", 5, ParallelpipedLineColorOp, 5, 6, "r g b ?name?"},
     8906    {"linewidth", 5, ParallelpipedLineWidthOp, 3, 4, "width ?name?"},
     8907    {"material",  1, ParallelpipedMaterialOp, 6, 7, "ambientCoeff diffuseCoeff specularCoeff specularPower ?name?"},
     8908    {"opacity",   2, ParallelpipedOpacityOp, 3, 4, "value ?name?"},
     8909    {"orient",    4, ParallelpipedOrientOp, 6, 7, "qw qx qy qz ?name?"},
     8910    {"origin",    4, ParallelpipedOriginOp, 5, 6, "x y z ?name?"},
     8911    {"pos",       1, ParallelpipedPositionOp, 5, 6, "x y z ?name?"},
     8912    {"scale",     2, ParallelpipedScaleOp, 5, 6, "sx sy sz ?name?"},
     8913    {"shading",   2, ParallelpipedShadingOp, 3, 4, "val ?name?"},
     8914    {"visible",   1, ParallelpipedVisibleOp, 3, 4, "bool ?name?"},
     8915    {"wireframe", 1, ParallelpipedWireframeOp, 3, 4, "bool ?name?"}
     8916};
     8917static int nParallelpipedOps = NumCmdSpecs(parallelpipedOps);
     8918
     8919static int
     8920ParallelpipedCmd(ClientData clientData, Tcl_Interp *interp, int objc,
     8921       Tcl_Obj *const *objv)
     8922{
     8923    Tcl_ObjCmdProc *proc;
     8924
     8925    proc = Rappture::GetOpFromObj(interp, nParallelpipedOps, parallelpipedOps,
     8926                                  Rappture::CMDSPEC_ARG1, objc, objv, 0);
     8927    if (proc == NULL) {
     8928        return TCL_ERROR;
     8929    }
     8930    return (*proc) (clientData, interp, objc, objv);
     8931}
     8932
     8933static int
    85618934PolyDataAddOp(ClientData clientData, Tcl_Interp *interp, int objc,
    85628935              Tcl_Obj *const *objv)
     
    1222812601{
    1222912602    Tcl_MakeSafe(interp);
    12230     Tcl_CreateObjCommand(interp, "arc",         ArcCmd,         clientData, NULL);
    12231     Tcl_CreateObjCommand(interp, "arrow",       ArrowCmd,       clientData, NULL);
    12232     Tcl_CreateObjCommand(interp, "axis",        AxisCmd,        clientData, NULL);
    12233     Tcl_CreateObjCommand(interp, "box",         BoxCmd,         clientData, NULL);
    12234     Tcl_CreateObjCommand(interp, "camera",      CameraCmd,      clientData, NULL);
    12235     Tcl_CreateObjCommand(interp, "clientinfo",  ClientInfoCmd,  clientData, NULL);
    12236     Tcl_CreateObjCommand(interp, "colormap",    ColorMapCmd,    clientData, NULL);
    12237     Tcl_CreateObjCommand(interp, "cone",        ConeCmd,        clientData, NULL);
    12238     Tcl_CreateObjCommand(interp, "contour2d",   Contour2DCmd,   clientData, NULL);
    12239     Tcl_CreateObjCommand(interp, "contour3d",   Contour3DCmd,   clientData, NULL);
    12240     Tcl_CreateObjCommand(interp, "cutplane",    CutplaneCmd,    clientData, NULL);
    12241     Tcl_CreateObjCommand(interp, "cylinder",    CylinderCmd,    clientData, NULL);
    12242     Tcl_CreateObjCommand(interp, "dataset",     DataSetCmd,     clientData, NULL);
    12243     Tcl_CreateObjCommand(interp, "disk",        DiskCmd,        clientData, NULL);
    12244     Tcl_CreateObjCommand(interp, "glyphs",      GlyphsCmd,      clientData, NULL);
    12245     Tcl_CreateObjCommand(interp, "group",       GroupCmd,       clientData, NULL);
    12246     Tcl_CreateObjCommand(interp, "heightmap",   HeightMapCmd,   clientData, NULL);
    12247     Tcl_CreateObjCommand(interp, "image",       ImageCmd,       clientData, NULL);
    12248     Tcl_CreateObjCommand(interp, "imgflush",    ImageFlushCmd,  clientData, NULL);
    12249     Tcl_CreateObjCommand(interp, "legend",      LegendCmd,      clientData, NULL);
    12250     Tcl_CreateObjCommand(interp, "legend2",     LegendSimpleCmd,clientData, NULL);
    12251     Tcl_CreateObjCommand(interp, "lic",         LICCmd,         clientData, NULL);
    12252     Tcl_CreateObjCommand(interp, "line",        LineCmd,        clientData, NULL);
    12253     Tcl_CreateObjCommand(interp, "molecule",    MoleculeCmd,    clientData, NULL);
    12254     Tcl_CreateObjCommand(interp, "outline",     OutlineCmd,     clientData, NULL);
    12255     Tcl_CreateObjCommand(interp, "polydata",    PolyDataCmd,    clientData, NULL);
    12256     Tcl_CreateObjCommand(interp, "polygon",     PolygonCmd,     clientData, NULL);
    12257     Tcl_CreateObjCommand(interp, "pseudocolor", PseudoColorCmd, clientData, NULL);
    12258     Tcl_CreateObjCommand(interp, "renderer",    RendererCmd,    clientData, NULL);
    12259     Tcl_CreateObjCommand(interp, "screen",      ScreenCmd,      clientData, NULL);
    12260     Tcl_CreateObjCommand(interp, "sphere",      SphereCmd,      clientData, NULL);
    12261     Tcl_CreateObjCommand(interp, "streamlines", StreamlinesCmd, clientData, NULL);
    12262     Tcl_CreateObjCommand(interp, "text3d",      Text3DCmd,      clientData, NULL);
    12263     Tcl_CreateObjCommand(interp, "volume",      VolumeCmd,      clientData, NULL);
    12264     Tcl_CreateObjCommand(interp, "warp",        WarpCmd,        clientData, NULL);
     12603    Tcl_CreateObjCommand(interp, "arc",           ArcCmd,           clientData, NULL);
     12604    Tcl_CreateObjCommand(interp, "arrow",         ArrowCmd,         clientData, NULL);
     12605    Tcl_CreateObjCommand(interp, "axis",          AxisCmd,          clientData, NULL);
     12606    Tcl_CreateObjCommand(interp, "box",           BoxCmd,           clientData, NULL);
     12607    Tcl_CreateObjCommand(interp, "camera",        CameraCmd,        clientData, NULL);
     12608    Tcl_CreateObjCommand(interp, "clientinfo",    ClientInfoCmd,    clientData, NULL);
     12609    Tcl_CreateObjCommand(interp, "colormap",      ColorMapCmd,      clientData, NULL);
     12610    Tcl_CreateObjCommand(interp, "cone",          ConeCmd,          clientData, NULL);
     12611    Tcl_CreateObjCommand(interp, "contour2d",     Contour2DCmd,     clientData, NULL);
     12612    Tcl_CreateObjCommand(interp, "contour3d",     Contour3DCmd,     clientData, NULL);
     12613    Tcl_CreateObjCommand(interp, "cutplane",      CutplaneCmd,      clientData, NULL);
     12614    Tcl_CreateObjCommand(interp, "cylinder",      CylinderCmd,      clientData, NULL);
     12615    Tcl_CreateObjCommand(interp, "dataset",       DataSetCmd,       clientData, NULL);
     12616    Tcl_CreateObjCommand(interp, "disk",          DiskCmd,          clientData, NULL);
     12617    Tcl_CreateObjCommand(interp, "glyphs",        GlyphsCmd,        clientData, NULL);
     12618    Tcl_CreateObjCommand(interp, "group",         GroupCmd,         clientData, NULL);
     12619    Tcl_CreateObjCommand(interp, "heightmap",     HeightMapCmd,     clientData, NULL);
     12620    Tcl_CreateObjCommand(interp, "image",         ImageCmd,         clientData, NULL);
     12621    Tcl_CreateObjCommand(interp, "imgflush",      ImageFlushCmd,    clientData, NULL);
     12622    Tcl_CreateObjCommand(interp, "legend",        LegendCmd,        clientData, NULL);
     12623    Tcl_CreateObjCommand(interp, "legend2",       LegendSimpleCmd,  clientData, NULL);
     12624    Tcl_CreateObjCommand(interp, "lic",           LICCmd,           clientData, NULL);
     12625    Tcl_CreateObjCommand(interp, "line",          LineCmd,          clientData, NULL);
     12626    Tcl_CreateObjCommand(interp, "molecule",      MoleculeCmd,      clientData, NULL);
     12627    Tcl_CreateObjCommand(interp, "outline",       OutlineCmd,       clientData, NULL);
     12628    Tcl_CreateObjCommand(interp, "parallelpiped", ParallelpipedCmd, clientData, NULL);
     12629    Tcl_CreateObjCommand(interp, "polydata",      PolyDataCmd,      clientData, NULL);
     12630    Tcl_CreateObjCommand(interp, "polygon",       PolygonCmd,       clientData, NULL);
     12631    Tcl_CreateObjCommand(interp, "pseudocolor",   PseudoColorCmd,   clientData, NULL);
     12632    Tcl_CreateObjCommand(interp, "renderer",      RendererCmd,      clientData, NULL);
     12633    Tcl_CreateObjCommand(interp, "screen",        ScreenCmd,        clientData, NULL);
     12634    Tcl_CreateObjCommand(interp, "sphere",        SphereCmd,        clientData, NULL);
     12635    Tcl_CreateObjCommand(interp, "streamlines",   StreamlinesCmd,   clientData, NULL);
     12636    Tcl_CreateObjCommand(interp, "text3d",        Text3DCmd,        clientData, NULL);
     12637    Tcl_CreateObjCommand(interp, "volume",        VolumeCmd,        clientData, NULL);
     12638    Tcl_CreateObjCommand(interp, "warp",          WarpCmd,          clientData, NULL);
    1226512639}
    1226612640
     
    1229512669    Tcl_DeleteCommand(interp, "molecule");
    1229612670    Tcl_DeleteCommand(interp, "outline");
     12671    Tcl_DeleteCommand(interp, "parallelpiped");
    1229712672    Tcl_DeleteCommand(interp, "polydata");
    1229812673    Tcl_DeleteCommand(interp, "polygon");
  • trunk/packages/vizservers/vtkvis/RendererGraphicsObjs.cpp

    r3818 r3859  
    2828#include "Line.h"
    2929#include "Molecule.h"
     30#include "Parallelpiped.h"
    3031#include "PolyData.h"
    3132#include "PseudoColor.h"
     
    123124Renderer::getGraphicsObjectHashmap<Outline>()
    124125{ return _outlines; }
     126
     127template<>
     128Renderer::ParallelpipedHashmap &
     129Renderer::getGraphicsObjectHashmap<Parallelpiped>()
     130{ return _parallelpipeds; }
    125131
    126132template<>
     
    173179template Group *Renderer::getGraphicsObject(const DataSetId&);
    174180template Line *Renderer::getGraphicsObject(const DataSetId&);
     181template Parallelpiped *Renderer::getGraphicsObject(const DataSetId&);
    175182template Polygon *Renderer::getGraphicsObject(const DataSetId&);
    176183template Sphere *Renderer::getGraphicsObject(const DataSetId&);
     
    287294    }
    288295    if ((gobj = getGraphicsObject<Line>(id)) != NULL) {
     296        return gobj;
     297    }
     298    if ((gobj = getGraphicsObject<Parallelpiped>(id)) != NULL) {
    289299        return gobj;
    290300    }
     
    29382948
    29392949/**
     2950 * \brief Create a new Parallelpiped and associate it with an ID
     2951 */
     2952bool Renderer::addParallelpiped(const DataSetId& id,
     2953                                double vec1[3], double vec2[3], double vec3[3],
     2954                                bool flipNormals)
     2955{
     2956    Parallelpiped *gobj;
     2957    if ((gobj = getGraphicsObject<Parallelpiped>(id)) != NULL) {
     2958        WARN("Replacing existing %s %s", gobj->getClassName(), id.c_str());
     2959        deleteGraphicsObject<Parallelpiped>(id);
     2960    }
     2961
     2962    gobj = new Parallelpiped();
     2963 
     2964    gobj->setDataSet(NULL, this);
     2965
     2966    if (gobj->getProp() == NULL &&
     2967        gobj->getOverlayProp() == NULL) {
     2968        delete gobj;
     2969        return false;
     2970    } else {
     2971        if (gobj->getProp())
     2972            _renderer->AddViewProp(gobj->getProp());
     2973        if (gobj->getOverlayProp())
     2974            _renderer->AddViewProp(gobj->getOverlayProp());
     2975    }
     2976
     2977    gobj->setVectors(vec1, vec2, vec3);
     2978    if (flipNormals)
     2979        gobj->flipNormals(flipNormals);
     2980
     2981    getGraphicsObjectHashmap<Parallelpiped>()[id] = gobj;
     2982
     2983    sceneBoundsChanged();
     2984    _needsRedraw = true;
     2985    return true;
     2986}
     2987
     2988/**
    29402989 * \brief Create a new n-sided regular Polygon and associate it with an ID
    29412990 */
  • trunk/packages/vizservers/vtkvis/protocol.txt

    r3835 r3859  
    685685outline scale <sx> <sy> <sz> <?datasetName?>
    686686outline visible <bool> <?datasetName?>
     687
     688parallelpiped add <v0x> <v0y> <v0z> <v1x> <v1y> <v1z> <v2x> <v2y> <v2z> <name>
     689              Specify parallelpiped using 3 basis vectors.  The 3 vectors should
     690              be given in order to create a right-handed coordinate system, i.e.
     691              (v0 cross v1) dot v2 should be positive.
     692parallelpiped color <r> <g> <b> <?name?>
     693parallelpiped culling <bool> <?name?>
     694parallelpiped delete <?name?>
     695parallelpiped edges <bool> <?name?>
     696parallelpiped flipnorm <bool> <?name?>
     697parallelpiped lighting <bool> <?name?>
     698parallelpiped linecolor <r> <g> <b> <?name?>
     699parallelpiped linewidth <val> <?name?>
     700parallelpiped material <ambientCoeff> <diffuseCoeff> <specularCoeff> <specularExp> <?name?>
     701parallelpiped opacity <val> <?name?>
     702parallelpiped orient <qw> <qx> <qy> <qz> <?name?>
     703parallelpiped origin <x> <y> <z> <?name?>
     704parallelpiped pos <x> <y> <z> <?name?>
     705parallelpiped scale <sx> <sy> <sz> <?name?>
     706parallelpiped shading <val> <?name?>
     707              val = flat|smooth
     708parallelpiped visible <bool> <?name?>
     709parallelpiped wireframe <bool> <?name?>
    687710
    688711polydata add <?datasetName?>
Note: See TracChangeset for help on using the changeset viewer.