source: nanovis/trunk/ParticleAdvectionShader.h @ 5712

Last change on this file since 5712 was 5712, checked in by ldelgass, 4 years ago

merge comment from nanovis 1.2 branch

  • Property svn:eol-style set to native
File size: 1.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 */
6#ifndef NV_PARTICLE_ADVECTION_SHADER_H
7#define NV_PARTICLE_ADVECTION_SHADER_H
8
9#include <vrmath/Vector3f.h>
10
11#include "Shader.h"
12
13namespace nv {
14
15class ParticleAdvectionShader : public Shader
16{
17public:
18    ParticleAdvectionShader();
19
20    virtual ~ParticleAdvectionShader();
21
22    virtual void bind(unsigned int texID, unsigned int initPosTexID, bool init);
23
24    virtual void unbind();
25
26    void setScale(const vrmath::Vector3f& scale)
27    {
28        _scale = scale;
29    }
30
31    void setVelocityVolume(unsigned int texID, float max)
32    {
33        _velocityVolumeID = texID;
34        _max = max;
35        /* FIXME: _max is the maximum displacement in world coords per
36         * time step.  Need to determine a scale factor to get an
37         * appropriate animation speed
38         */
39        if (_max > 100.f)
40            _max = 100.0f;
41        setTimeStep(0.0005f);
42    }
43
44    void setTimeStep(float timeStep)
45    {
46        _timeStep = timeStep;
47    }
48
49private:
50    void init();
51
52    unsigned int _velocityVolumeID;
53    vrmath::Vector3f _scale;
54    float _max;
55    float _timeStep;
56};
57
58}
59
60#endif
Note: See TracBrowser for help on using the repository browser.