Ignore:
Timestamp:
Jun 9, 2009 5:25:13 PM (15 years ago)
Author:
gah
Message:

added particle size option, movie token for flowvis

Location:
trunk/packages/vizservers/nanovis
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/FlowCmd.cpp

    r1493 r1497  
    8787    {Rappture::SWITCH_CUSTOM, "-position", "number",
    8888        offsetof(FlowParticlesValues, position), 0, 0, &positionSwitch},
     89    {Rappture::SWITCH_FLOAT, "-size", "float",
     90        offsetof(FlowParticlesValues, particleSize), 0},
    8991    {Rappture::SWITCH_END}
    9092};
     
    155157    _rendererPtr->setColor(Vector4(_sv.color.r, _sv.color.g, _sv.color.b,
    156158                _sv.color.a));
     159    _rendererPtr->particleSize(_sv.particleSize);
    157160    _rendererPtr->setAxis(_sv.position.axis);
    158161    _rendererPtr->active(!_sv.isHidden);
     
    19081911    Trace("FLOW started\n");
    19091912
    1910     Rappture::Outcome result;
     1913    Rappture::Outcome context;
    19111914    Rappture::AVTranslate movie(width, height, frameRate, bitRate);
    19121915
     
    19161919    }
    19171920
    1918     movie.init(result, fileName);
     1921    movie.init(context, fileName);
    19191922
    19201923    for (int i = 0; i < numFrames; i++) {
     
    19311934        // This is done before bmp_write_to_file because bmp_write_to_file
    19321935        // turns rgb data to bgr
    1933         movie.append(result, NanoVis::screen_buffer, pad);
     1936        movie.append(context, NanoVis::screen_buffer, pad);
    19341937        // NanoVis::bmp_write_to_file(frame_count, fileName);
    19351938    }
    19361939
    1937     movie.done(result);
     1940    movie.done(context);
    19381941    Trace("FLOW end\n");
    19391942
     
    19471950    // FIXME: find a way to get the data from the movie object as a void*
    19481951    Rappture::Buffer data;
    1949     if (!data.load(result, fileName)) {
     1952    if (!data.load(context, fileName)) {
    19501953        Tcl_AppendResult(interp, "can't load data from temporary movie file \"",
    1951                 fileName, "\": ", result.remark(), (char *)NULL);
     1954                fileName, "\": ", context.remark(), (char *)NULL);
    19521955        return TCL_ERROR;
    19531956    }
    19541957    // Build the command string for the client.
    19551958    char command[200];
    1956     sprintf(command,"nv>image -bytes %lu -type movie -token token\n",
    1957             (unsigned long)data.size());
     1959    sprintf(command,"nv>image -bytes %lu -type movie -token \"%s\"\n",
     1960            (unsigned long)data.size(), Tcl_GetString(objv[7]));
    19581961
    19591962    NanoVis::sendDataToClient(command, data.bytes(), data.size());
     
    19821985    {"next",     2, FlowNextOp,    2, 2, "",},
    19831986    {"reset",    1, FlowResetOp,   2, 2, "",},
    1984     {"video",    1, FlowVideoOp,   7, 7,       
    1985         "width height numFrames frameRate bitRate ",},
     1987    {"video",    1, FlowVideoOp,   8, 8,       
     1988        "width height numFrames frameRate bitRate token",},
    19861989};
    19871990static int nFlowCmdOps = NumCmdSpecs(flowCmdOps);
  • trunk/packages/vizservers/nanovis/FlowCmd.h

    r1493 r1497  
    2020    int isHidden;                       /* Indicates if particle injection
    2121                                         * plane is active or not. */
     22    float particleSize;                 /* Size of the particles. */
    2223};
    2324
     
    4041    FlowParticles(const char *name, Tcl_HashEntry *hPtr);
    4142    ~FlowParticles(void);
    42     void SetColor(FlowColor &color) {
    43         _sv.color = color;
    44         _rendererPtr->setColor(Vector4(color.r, color.g, color.b, color.a));
    45     }
    4643    const char *name(void) {
    4744        return _name;
  • trunk/packages/vizservers/nanovis/NvParticleRenderer.cpp

    r1482 r1497  
    4545
    4646NvParticleRenderer::NvParticleRenderer(int w, int h, CGcontext context) :
     47    _particleSize(1.2),
    4748    scale(1, 1, 1),
    4849    origin(0, 0, 0),
    49     _activate(false) 
     50    _activate(false)
    5051{
    5152    psys_width = w;
     
    446447*/
    447448
    448     glPointSize(1.2);
     449    glPointSize(_particleSize);
    449450    //glColor4f(.2,.2,.8,1.);
    450451    glColor4f(_color.x, _color.y, _color.z, _color.w);
  • trunk/packages/vizservers/nanovis/NvParticleRenderer.h

    r1478 r1497  
    3434
    3535struct Particle {
    36   float x;
    37   float y;
    38   float z;
    39   float aux;
     36    float x;
     37    float y;
     38    float z;
     39    float aux;
    4040
    41   Particle(){};
    42   Particle(float _x, float _y, float _z, float _life) :
    43    x(_x), y(_y), z(_z), aux(_life){}
     41    Particle(){};
     42    Particle(float _x, float _y, float _z, float _life) :
     43        x(_x), y(_y), z(_z), aux(_life){}
    4444};
    4545
     
    7676    float max_life;
    7777
     78    float _particleSize;                // Size of the particle: default is 1.2
     79
    7880    /**
    7981     * @brief vertex array for display particles
     
    8183    RenderVertexArray* m_vertex_array; 
    8284
    83   //Nvidia CG shaders and their parameters
    84   /*
    85   CGcontext m_g_context;
    86   CGprogram m_pos_fprog;
    87   CGparameter m_vel_tex_param, m_pos_tex_param, m_scale_param;
    88   CGparameter m_pos_timestep_param, m_pos_spherePos_param;
    89   */
     85    //Nvidia CG shaders and their parameters
     86    /*
     87      CGcontext m_g_context;
     88      CGprogram m_pos_fprog;
     89      CGparameter m_vel_tex_param, m_pos_tex_param, m_scale_param;
     90      CGparameter m_pos_timestep_param, m_pos_spherePos_param;
     91    */
    9092    static NvParticleAdvectionShader* _advectionShader;
    9193
     
    132134                           float r, float g, float b, float line_width);
    133135    void initializeDataArray();
     136    void particleSize(float size) {
     137        _particleSize = size;
     138    }
     139    float particleSize(void) {
     140        return _particleSize;
     141    }
    134142};
    135143
Note: See TracChangeset for help on using the changeset viewer.