source: nanovis/trunk/ParticleAdvectionShader.cpp @ 4817

Last change on this file since 4817 was 3630, checked in by ldelgass, 11 years ago

Nanovis refactoring to fix problems with scaling and multiple results.
Do rendering in world space to properly place and scale multiple data sets.
Also fix flows to reduce resets of animations. More work toward removing
Cg dependency. Fix panning to convert viewport coords to world coords.

  • 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.