source: trunk/packages/vizservers/nanovis/FlowParticles.h @ 3568

Last change on this file since 3568 was 3568, checked in by ldelgass, 11 years ago

Fix crash on getting transfer function name, remove unused plane command.

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (c) 2004-2013  HUBzero Foundation, LLC
4 *
5 * Authors:
6 *   Wei Qiao <qiaow@purdue.edu>
7 *   Insoo Woo <iwoo@purdue.edu>
8 *   George A. Howlett <gah@purdue.edu>
9 *   Leif Delgass <ldelgass@purdue.edu>
10 */
11#ifndef FLOWPARTICLES_H
12#define FLOWPARTICLES_H
13
14#include <string>
15
16#include <tcl.h>
17
18#include <vrmath/Vector3f.h>
19
20#include "FlowTypes.h"
21#include "Switch.h"
22#include "NvParticleRenderer.h"
23#include "Volume.h"
24
25struct FlowParticlesValues {
26    FlowPosition position;   ///< Position on axis of particle plane
27    FlowColor color;         ///< Color of particles
28    int isHidden;            ///< Is particle injection plane active
29    float particleSize;      ///< Size of the particles
30};
31
32class FlowParticles
33{
34public:
35    FlowParticles(const char *name);
36
37    ~FlowParticles();
38
39    const char *name() const
40    {
41        return _name.c_str();
42    }
43
44    bool visible() const
45    {
46        return !_sv.isHidden;
47    }
48
49    int parseSwitches(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv)
50    {
51        if (Rappture::ParseSwitches(interp, _switches, objc, objv, &_sv,
52                                    SWITCH_DEFAULTS) < 0) {
53            return TCL_ERROR;
54        }
55        return TCL_OK;
56    }
57
58    void advect()
59    {
60        assert(_renderer->active());
61        _renderer->advect();
62    }
63
64    void render();
65
66    void reset()
67    {
68        _renderer->reset();
69    }
70
71    void initialize()
72    {
73        _renderer->initialize();
74    }
75
76    void setVectorField(Volume *volume, const vrmath::Vector3f& location,
77                        float scaleX, float scaleY, float scaleZ,
78                        float max)
79    {
80        _renderer->
81            setVectorField(volume->textureID(),
82                           location,
83                           scaleX,
84                           scaleY,
85                           scaleZ,
86                           max);
87    }
88
89    void configure();
90
91private:
92    /**
93     * Name of particle injection plane. Actual character string is
94     * stored in hash table.
95     */
96    std::string _name;
97    NvParticleRenderer *_renderer;        ///< Particle renderer
98    FlowParticlesValues _sv;
99
100    static Rappture::SwitchSpec _switches[];
101};
102
103#endif
Note: See TracBrowser for help on using the repository browser.