source: nanovis/branches/1.1/ParticleAdvectionShader.cpp @ 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: 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)
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", _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.