source: trunk/packages/vizservers/nanovis/NvParticleAdvectionShader.cpp @ 3502

Last change on this file since 3502 was 3502, checked in by ldelgass, 12 years ago

Add basic VTK structured points reader to nanovis, update copyright dates.

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