source: nanovis/branches/1.1/FlowParticles.h @ 4617

Last change on this file since 4617 was 4612, checked in by ldelgass, 10 years ago

merge r3597 from trunk

  • Property svn:eol-style set to native
File size: 2.3 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 <cassert>
15#include <string>
16
17#include <tcl.h>
18
19#include <vrmath/Vector3f.h>
20
21#include "FlowTypes.h"
22#include "Switch.h"
23#include "NvParticleRenderer.h"
24#include "Volume.h"
25
26struct FlowParticlesValues {
27    FlowPosition position;   ///< Position on axis of particle plane
28    FlowColor color;         ///< Color of particles
29    int isHidden;            ///< Is particle injection plane active
30    float particleSize;      ///< Size of the particles
31};
32
33class FlowParticles
34{
35public:
36    FlowParticles(const char *name);
37
38    ~FlowParticles();
39
40    const char *name() const
41    {
42        return _name.c_str();
43    }
44
45    bool visible() const
46    {
47        return !_sv.isHidden;
48    }
49
50    int parseSwitches(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv)
51    {
52        if (Rappture::ParseSwitches(interp, _switches, objc, objv, &_sv,
53                                    SWITCH_DEFAULTS) < 0) {
54            return TCL_ERROR;
55        }
56        return TCL_OK;
57    }
58
59    void advect()
60    {
61        assert(_renderer->active());
62        _renderer->advect();
63    }
64
65    void render();
66
67    void reset()
68    {
69        _renderer->reset();
70    }
71
72    void initialize()
73    {
74        _renderer->initialize();
75    }
76
77    void setVectorField(Volume *volume, const vrmath::Vector3f& location,
78                        float scaleX, float scaleY, float scaleZ,
79                        float max)
80    {
81        _renderer->
82            setVectorField(volume->textureID(),
83                           location,
84                           scaleX,
85                           scaleY,
86                           scaleZ,
87                           max);
88    }
89
90    void configure();
91
92private:
93    /**
94     * Name of particle injection plane. Actual character string is
95     * stored in hash table.
96     */
97    std::string _name;
98    NvParticleRenderer *_renderer;        ///< Particle renderer
99    FlowParticlesValues _sv;
100
101    static Rappture::SwitchSpec _switches[];
102};
103
104#endif
Note: See TracBrowser for help on using the repository browser.