Last change
on this file since 1446 was
825,
checked in by vrinside, 17 years ago
|
Image Loader initialization
Point Renderer code added..
- Put a data container and manage the containters with std::vector
- Renderer
1) scale factor part should be taken into account
|
File size:
1.4 KB
|
Line | |
---|
1 | #ifndef __POINTSHADER_H__
|
---|
2 | #define __POINTSHADER_H__
|
---|
3 |
|
---|
4 | #include "Nv.h"
|
---|
5 | #include "NvShader.h"
|
---|
6 | #include "Texture3D.h"
|
---|
7 |
|
---|
8 | class PointShader : public NvShader {
|
---|
9 | CGparameter _modelviewVP;
|
---|
10 | CGparameter _projectionVP;
|
---|
11 |
|
---|
12 | CGparameter _attenVP;
|
---|
13 | CGparameter _posoffsetVP;
|
---|
14 | CGparameter _baseposVP;
|
---|
15 | CGparameter _scaleVP;
|
---|
16 | CGparameter _normalParam;
|
---|
17 |
|
---|
18 | Texture3D* _normal;
|
---|
19 | public :
|
---|
20 | PointShader();
|
---|
21 | ~PointShader();
|
---|
22 | protected :
|
---|
23 | virtual void setParameters();
|
---|
24 | virtual void resetParameters();
|
---|
25 |
|
---|
26 | public :
|
---|
27 | void setScale(float scale);
|
---|
28 | void setNormalTexture(Texture3D* n);
|
---|
29 | void bind();
|
---|
30 | void unbind();
|
---|
31 | };
|
---|
32 |
|
---|
33 | inline void PointShader::setNormalTexture(Texture3D* n)
|
---|
34 | {
|
---|
35 | _normal = n;
|
---|
36 | }
|
---|
37 |
|
---|
38 | inline void PointShader::setScale(float scale)
|
---|
39 | {
|
---|
40 | cgGLSetParameter4f(_scaleVP, scale, 1.0f, 1.0f, 1.0f);
|
---|
41 | }
|
---|
42 |
|
---|
43 | inline void PointShader::bind()
|
---|
44 | {
|
---|
45 | setParameters();
|
---|
46 |
|
---|
47 | if (_cgVP)
|
---|
48 | {
|
---|
49 | cgGLBindProgram(_cgVP);
|
---|
50 | cgGLEnableProfile((CGprofile) CG_PROFILE_VP30);
|
---|
51 | }
|
---|
52 | if (_cgFP)
|
---|
53 | {
|
---|
54 | cgGLBindProgram(_cgFP);
|
---|
55 | cgGLEnableProfile((CGprofile) CG_PROFILE_FP30);
|
---|
56 | }
|
---|
57 | }
|
---|
58 |
|
---|
59 | inline void PointShader::unbind()
|
---|
60 | {
|
---|
61 | if (_cgVP)
|
---|
62 | {
|
---|
63 | cgGLDisableProfile((CGprofile)CG_PROFILE_VP30 );
|
---|
64 | }
|
---|
65 |
|
---|
66 | if (_cgFP)
|
---|
67 | {
|
---|
68 | cgGLDisableProfile((CGprofile)CG_PROFILE_FP30 );
|
---|
69 | }
|
---|
70 |
|
---|
71 | resetParameters();
|
---|
72 | }
|
---|
73 |
|
---|
74 | #endif // __POINTSHADER_H__
|
---|
Note: See
TracBrowser
for help on using the repository browser.