source: nanovis/trunk/StdVertexShader.cpp @ 4587

Last change on this file since 4587 was 3630, checked in by ldelgass, 7 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.4 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 <vrmath/Vector4f.h>
7
8#include "StdVertexShader.h"
9
10using namespace vrmath;
11using namespace nv;
12
13StdVertexShader::StdVertexShader()
14{
15    init();
16}
17
18StdVertexShader::~StdVertexShader()
19{
20}
21
22void StdVertexShader::init()
23{
24    loadVertexProgram("vertex_std.cg");
25}
26
27void StdVertexShader::bind(const Vector4f& objPlaneS,
28                           const Vector4f& objPlaneT,
29                           const Vector4f& objPlaneR,
30                           float *mvp, float *mvInv)
31{
32    if (mvp != NULL) {
33        setVPMatrixParameterf("modelViewProjMatrix", mvp);
34    } else {
35        setGLStateMatrixVPParameter("modelViewProjMatrix",
36                                    MODELVIEW_PROJECTION_MATRIX);
37    }
38    if (mvInv != NULL) {
39        setVPMatrixParameterf("modelViewInv", mvInv);
40    } else {
41        setGLStateMatrixVPParameter("modelViewInv",
42                                    MODELVIEW_MATRIX, MATRIX_INVERSE);
43    }
44
45    setVPParameter4f("light0Position", 1, 1, 1, 1);
46    setVPParameter4f("objPlaneS",
47                     objPlaneS.x, objPlaneS.y, objPlaneS.z, objPlaneS.w);
48    setVPParameter4f("objPlaneT",
49                     objPlaneT.x, objPlaneT.y, objPlaneT.z, objPlaneT.w);
50    setVPParameter4f("objPlaneR",
51                     objPlaneR.x, objPlaneR.y, objPlaneR.z, objPlaneR.w);
52
53    Shader::bind();
54}
Note: See TracBrowser for help on using the repository browser.