source: nanovis/branches/1.1/ParticleAdvectionShader.cpp @ 4889

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

Merge r3611:3618 from trunk

  • 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    _mode(1)
16{
17    init();
18}
19
20ParticleAdvectionShader::~ParticleAdvectionShader()
21{
22}
23
24void ParticleAdvectionShader::init()
25{
26    loadFragmentProgram("update_pos.cg", "main");
27}
28
29void 
30ParticleAdvectionShader::bind(unsigned int texID, unsigned int initPosTexID)
31{
32    setFPTextureParameter("pos_tex", texID);
33    setFPTextureParameter("init_pos_tex", initPosTexID);
34    setFPTextureParameter("vel_tex", _velocityVolumeID);
35
36    setFPParameter1f("timestep", _timeStep);
37    setFPParameter1f("max", _max);
38    setFPParameter1f("mode", _mode);
39    setFPParameter3f("scale", _scale.x, _scale.y, _scale.z);
40
41    Shader::bind();
42}
43
44void
45ParticleAdvectionShader::unbind()
46{
47     disableFPTextureParameter("pos_tex");
48     disableFPTextureParameter("init_pos_tex");
49     disableFPTextureParameter("vel_tex");
50
51     Shader::unbind();
52}
Note: See TracBrowser for help on using the repository browser.