source: nanovis/branches/1.2/ParticleAdvectionShader.cpp @ 5489

Last change on this file since 5489 was 5397, checked in by ldelgass, 9 years ago

Hand merge fix for flow reset

  • Property svn:eol-style set to native
File size: 1.1 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#include "ParticleAdvectionShader.h"
7
8using namespace nv;
9
10ParticleAdvectionShader::ParticleAdvectionShader() :
11    _velocityVolumeID(0),
12    _scale(1.0f, 1.0f, 1.0f),
13    _max(1.0f),
14    _timeStep(0.0005f)
15{
16    init();
17}
18
19ParticleAdvectionShader::~ParticleAdvectionShader()
20{
21}
22
23void ParticleAdvectionShader::init()
24{
25    loadFragmentProgram("update_pos.cg");
26}
27
28void
29ParticleAdvectionShader::bind(unsigned int texID, unsigned int initPosTexID, bool init)
30{
31    setFPTextureParameter("pos_tex", texID);
32    setFPTextureParameter("init_pos_tex", initPosTexID);
33    setFPTextureParameter("vel_tex", _velocityVolumeID);
34
35    setFPParameter1f("timestep", _timeStep);
36    setFPParameter1f("max", init ? 0 : _max);
37    setFPParameter3f("scale", _scale.x, _scale.y, _scale.z);
38
39    Shader::bind();
40}
41
42void
43ParticleAdvectionShader::unbind()
44{
45     disableFPTextureParameter("pos_tex");
46     disableFPTextureParameter("init_pos_tex");
47     disableFPTextureParameter("vel_tex");
48
49     Shader::unbind();
50}
Note: See TracBrowser for help on using the repository browser.