Last change
on this file was
4904,
checked in by ldelgass, 10 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
|
Rev | Line | |
---|
[2798] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
[3502] | 2 | /* |
---|
| 3 | * Copyright (c) 2004-2013 HUBzero Foundation, LLC |
---|
| 4 | * |
---|
| 5 | */ |
---|
[3612] | 6 | #include "ParticleAdvectionShader.h" |
---|
[585] | 7 | |
---|
[3611] | 8 | using namespace nv; |
---|
| 9 | |
---|
[3612] | 10 | ParticleAdvectionShader::ParticleAdvectionShader() : |
---|
[953] | 11 | _velocityVolumeID(0), |
---|
| 12 | _scale(1.0f, 1.0f, 1.0f), |
---|
| 13 | _max(1.0f), |
---|
[4904] | 14 | _timeStep(0.0005f) |
---|
[585] | 15 | { |
---|
[850] | 16 | init(); |
---|
[585] | 17 | } |
---|
| 18 | |
---|
[3612] | 19 | ParticleAdvectionShader::~ParticleAdvectionShader() |
---|
[585] | 20 | { |
---|
| 21 | } |
---|
| 22 | |
---|
[3612] | 23 | void ParticleAdvectionShader::init() |
---|
[585] | 24 | { |
---|
[4904] | 25 | loadFragmentProgram("update_pos.cg"); |
---|
[585] | 26 | } |
---|
| 27 | |
---|
[1362] | 28 | void |
---|
[3612] | 29 | ParticleAdvectionShader::bind(unsigned int texID, unsigned int initPosTexID) |
---|
[1299] | 30 | { |
---|
[2956] | 31 | setFPTextureParameter("pos_tex", texID); |
---|
| 32 | setFPTextureParameter("init_pos_tex", initPosTexID); |
---|
| 33 | setFPTextureParameter("vel_tex", _velocityVolumeID); |
---|
[1299] | 34 | |
---|
[2956] | 35 | setFPParameter1f("timestep", _timeStep); |
---|
| 36 | setFPParameter1f("max", _max); |
---|
| 37 | setFPParameter3f("scale", _scale.x, _scale.y, _scale.z); |
---|
[1331] | 38 | |
---|
[3612] | 39 | Shader::bind(); |
---|
[1299] | 40 | } |
---|
[2837] | 41 | |
---|
| 42 | void |
---|
[3612] | 43 | ParticleAdvectionShader::unbind() |
---|
[2837] | 44 | { |
---|
[2956] | 45 | disableFPTextureParameter("pos_tex"); |
---|
| 46 | disableFPTextureParameter("init_pos_tex"); |
---|
| 47 | disableFPTextureParameter("vel_tex"); |
---|
[2916] | 48 | |
---|
[3612] | 49 | Shader::unbind(); |
---|
[2837] | 50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.