1 | |
---|
2 | #include <stdio.h> |
---|
3 | #include <stdlib.h> |
---|
4 | #include <assert.h> |
---|
5 | #include <R2/R2FilePath.h> |
---|
6 | #include <R2/R2string.h> |
---|
7 | #include "PointShader.h" |
---|
8 | |
---|
9 | PointShader::PointShader() : |
---|
10 | NvShader(), |
---|
11 | _normal(0) |
---|
12 | { |
---|
13 | this->loadVertexProgram("pointsvp.cg", "main"); |
---|
14 | _modelviewVP = getNamedParameterFromVP("modelview"); |
---|
15 | _projectionVP = getNamedParameterFromVP("projection"); |
---|
16 | _attenVP = getNamedParameterFromVP("atten"); |
---|
17 | _posoffsetVP = getNamedParameterFromVP("posoffset"); |
---|
18 | _baseposVP = getNamedParameterFromVP("basepos"); |
---|
19 | _scaleVP = getNamedParameterFromVP("scale"); |
---|
20 | _normalParam = getNamedParameterFromVP("normal"); |
---|
21 | } |
---|
22 | |
---|
23 | PointShader::~PointShader() |
---|
24 | { |
---|
25 | } |
---|
26 | |
---|
27 | void PointShader::setParameters() |
---|
28 | { |
---|
29 | cgGLSetStateMatrixParameter(_modelviewVP, CG_GL_MODELVIEW_MATRIX, CG_GL_MATRIX_IDENTITY); |
---|
30 | cgGLSetStateMatrixParameter(_projectionVP, CG_GL_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY); |
---|
31 | |
---|
32 | cgGLSetParameter1f(_attenVP, 1.0f); |
---|
33 | cgGLSetParameter4f(_posoffsetVP, 1.0f, 1.0f, 1.0f, 1.0f); |
---|
34 | cgGLSetParameter4f(_baseposVP, 1.0f, 1.0f, 1.0f, 1.0f); |
---|
35 | cgGLSetParameter4f(_scaleVP, 1.0f, 1.0f, 1.0f, 1.0f); |
---|
36 | |
---|
37 | //cgGLSetTextureParameter(_normalParam,_normal->getGraphicsObjectID()); |
---|
38 | //cgGLEnableTextureParameter(_normalParam); |
---|
39 | |
---|
40 | } |
---|
41 | |
---|
42 | void PointShader::resetParameters() |
---|
43 | { |
---|
44 | //cgGLDisableTextureParameter(_normalParam); |
---|
45 | } |
---|