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

Last change on this file since 4906 was 4904, checked in by ldelgass, 5 years ago

Merge serveral changes from trunk. Does not include threading, world space
changes, etc.

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