1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | #ifndef __NV_PARTICLE_ADV_SHADER_H__ |
---|
3 | #define __NV_PARTICLE_ADV_SHADER_H__ |
---|
4 | |
---|
5 | #include "Vector3.h" |
---|
6 | #include "NvShader.h" |
---|
7 | |
---|
8 | class NvParticleAdvectionShader : public NvShader { |
---|
9 | |
---|
10 | CGparameter _posTimestepParam; |
---|
11 | CGparameter _velTexParam; |
---|
12 | //CGparameter _tfTexParam; |
---|
13 | CGparameter _posTexParam; |
---|
14 | CGparameter _initPosTexParam; |
---|
15 | CGparameter _scaleParam; |
---|
16 | CGparameter _maxParam; |
---|
17 | CGparameter _modeParam; |
---|
18 | unsigned int _velocityVolumeID; |
---|
19 | Vector3 _scale; |
---|
20 | float _max; |
---|
21 | float _timeStep; |
---|
22 | |
---|
23 | int _mode; |
---|
24 | |
---|
25 | public : |
---|
26 | NvParticleAdvectionShader(); |
---|
27 | ~NvParticleAdvectionShader(); |
---|
28 | |
---|
29 | private : |
---|
30 | void init(); |
---|
31 | public : |
---|
32 | //void bind(unsigned int texID, unsigned int tfTexID, unsigned int initPosTexID); |
---|
33 | void bind(unsigned int texID, unsigned int initPosTexID); |
---|
34 | void unbind(); |
---|
35 | void setScale(const Vector3& scale); |
---|
36 | void setVelocityVolume(unsigned int texID, float max); |
---|
37 | void setTimeStep(float timeStep); |
---|
38 | void setRenderMode(int mode); |
---|
39 | }; |
---|
40 | |
---|
41 | inline void NvParticleAdvectionShader::setTimeStep(float timeStep) |
---|
42 | { |
---|
43 | _timeStep = timeStep; |
---|
44 | } |
---|
45 | |
---|
46 | inline void NvParticleAdvectionShader::unbind() |
---|
47 | { |
---|
48 | cgGLDisableProfile(CG_PROFILE_FP30); |
---|
49 | |
---|
50 | cgGLDisableTextureParameter(_velTexParam); |
---|
51 | cgGLDisableTextureParameter(_posTexParam); |
---|
52 | //cgGLDisableTextureParameter(_tfTexParam); |
---|
53 | cgGLDisableTextureParameter(_initPosTexParam); |
---|
54 | } |
---|
55 | |
---|
56 | inline void NvParticleAdvectionShader::setScale(const Vector3& scale) |
---|
57 | { |
---|
58 | _scale = scale; |
---|
59 | } |
---|
60 | |
---|
61 | inline void NvParticleAdvectionShader::setVelocityVolume(unsigned int texID, float max) |
---|
62 | { |
---|
63 | _velocityVolumeID = texID; |
---|
64 | _max = max; |
---|
65 | } |
---|
66 | |
---|
67 | inline void NvParticleAdvectionShader::setRenderMode(int mode) |
---|
68 | { |
---|
69 | _mode = mode; |
---|
70 | } |
---|
71 | |
---|
72 | #endif //__NV_PARTICLE_ADV_SHADER_H__ |
---|