Changeset 3612
- Timestamp:
- Apr 2, 2013, 8:31:43 PM (11 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 22 edited
- 14 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/ColorTableShader.cpp
r3611 r3612 4 4 * 5 5 */ 6 #include " NvColorTableShader.h"6 #include "ColorTableShader.h" 7 7 8 8 using namespace nv; 9 9 10 NvColorTableShader::NvColorTableShader()10 ColorTableShader::ColorTableShader() 11 11 { 12 12 init(); 13 13 } 14 14 15 NvColorTableShader::~NvColorTableShader()15 ColorTableShader::~ColorTableShader() 16 16 { 17 17 } 18 18 19 void NvColorTableShader::init()19 void ColorTableShader::init() 20 20 { 21 21 loadFragmentProgram("one_plane.cg", "main"); 22 22 } 23 23 24 void NvColorTableShader::bind(Texture2D *plane, TransferFunction *tf)24 void ColorTableShader::bind(Texture2D *plane, TransferFunction *tf) 25 25 { 26 26 setFPTextureParameter("data", plane->id()); … … 29 29 setFPParameter4f("render_param", 0., 0., 0., 0.); 30 30 31 NvShader::bind();31 Shader::bind(); 32 32 } 33 33 34 void NvColorTableShader::unbind()34 void ColorTableShader::unbind() 35 35 { 36 36 disableFPTextureParameter("data"); 37 37 disableFPTextureParameter("tf"); 38 38 39 NvShader::unbind();39 Shader::unbind(); 40 40 } -
trunk/packages/vizservers/nanovis/ColorTableShader.h
r3611 r3612 7 7 #define NV_COLORTABLE_SHADER_H 8 8 9 #include " NvShader.h"9 #include "Shader.h" 10 10 #include "Texture2D.h" 11 11 #include "TransferFunction.h" … … 13 13 namespace nv { 14 14 15 class NvColorTableShader : public NvShader15 class ColorTableShader : public Shader 16 16 { 17 17 public: 18 NvColorTableShader();18 ColorTableShader(); 19 19 20 virtual ~ NvColorTableShader();20 virtual ~ColorTableShader(); 21 21 22 22 virtual void bind(Texture2D *plane, TransferFunction *tf); -
trunk/packages/vizservers/nanovis/HeightMap.cpp
r3611 r3612 39 39 _heights(NULL) 40 40 { 41 _shader = new NvShader();41 _shader = new Shader(); 42 42 _shader->loadFragmentProgram("heightcolor.cg", "main"); 43 43 } -
trunk/packages/vizservers/nanovis/HeightMap.h
r3611 r3612 12 12 13 13 #include "TransferFunction.h" 14 #include " NvShader.h"14 #include "Shader.h" 15 15 #include "AxisRange.h" 16 16 … … 132 132 TransferFunction *_transferFunc; 133 133 float _opacity; 134 NvShader *_shader;134 Shader *_shader; 135 135 int *_indexBuffer; 136 136 int _indexCount; -
trunk/packages/vizservers/nanovis/LIC.cpp
r3611 r3612 1 1 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 2 /* 3 * ----------------------------------------------------------------------4 * NvLIC.h: line integral convolution class5 *6 * ======================================================================7 * AUTHOR: Insoo Woo <iwoo@purdue.edu, Wei Qiao <qiaow@purdue.edu>8 * Purdue Rendering and Perceptualization Lab (PURPL)9 *10 3 * Copyright (c) 2004-2013 HUBzero Foundation, LLC 11 4 * 12 * See the file "license.terms" for information on usage and 13 * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 14 * ====================================================================== 5 * Authors: 6 * Wei Qiao <qiaow@purdue.edu> 15 7 */ 16 8 #include <stdlib.h> … … 22 14 23 15 #include "LIC.h" 24 #include " NvShader.h"16 #include "Shader.h" 25 17 #include "Trace.h" 26 18 … … 111 103 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboOrig); 112 104 113 _renderVelShader = new NvShader();105 _renderVelShader = new Shader(); 114 106 _renderVelShader->loadFragmentProgram("render_vel.cg", "main"); 115 107 -
trunk/packages/vizservers/nanovis/LIC.h
r3611 r3612 1 1 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 2 /* 3 * ----------------------------------------------------------------------4 * NvLIC.h: line integral convolution class5 *6 * ======================================================================7 * AUTHOR: Wei Qiao <qiaow@purdue.edu>8 * Purdue Rendering and Perceptualization Lab (PURPL)9 *10 3 * Copyright (c) 2004-2013 HUBzero Foundation, LLC 11 4 * 12 * See the file "license.terms" for information on usage and 13 * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 14 * ====================================================================== 5 * Authors: 6 * Wei Qiao <qiaow@purdue.edu> 15 7 */ 16 8 #ifndef NV_LIC_H … … 22 14 23 15 #include "Volume.h" 24 #include " NvShader.h"16 #include "Shader.h" 25 17 26 18 namespace nv { … … 84 76 private: 85 77 /** 86 * @brief the normal vector of the NvLIC plane,78 * @brief the normal vector of the LIC plane, 87 79 * the inherited Vector3 location is its center 88 80 */ … … 111 103 GLuint _disListID; 112 104 113 NvShader *_renderVelShader;105 Shader *_renderVelShader; 114 106 115 107 GLuint _colorTex, _patternTex, _magTex; -
trunk/packages/vizservers/nanovis/Makefile.in
r3611 r3612 111 111 Chain.o \ 112 112 CmdProc.o \ 113 ColorTableShader.o \ 113 114 Command.o \ 114 115 ContourLineFilter.o \ … … 122 123 HeightMap.o \ 123 124 LIC.o \ 124 NvColorTableShader.o \125 NvParticleAdvectionShader.o \126 NvRegularVolumeShader.o \127 NvShader.o \128 NvStdVertexShader.o \129 NvVolumeShader.o \130 NvZincBlendeVolumeShader.o \131 125 OrientationIndicator.o \ 126 ParticleAdvectionShader.o \ 132 127 ParticleRenderer.o \ 133 128 PerfQuery.o \ … … 137 132 ReadBuffer.o \ 138 133 ReaderCommon.o \ 134 RegularVolumeShader.o \ 139 135 RenderVertexArray.o \ 140 136 ResponseQueue.o \ 137 Shader.o \ 138 StdVertexShader.o \ 141 139 Switch.o \ 142 140 Texture1D.o \ … … 150 148 VolumeInterpolator.o \ 151 149 VolumeRenderer.o \ 150 VolumeShader.o \ 152 151 VtkReader.o \ 153 152 ZincBlendeReconstructor.o \ 154 153 ZincBlendeVolume.o \ 154 ZincBlendeVolumeShader.o \ 155 155 dxReader.o \ 156 156 md5.o \ … … 282 282 Chain.o: Chain.cpp Chain.h 283 283 CmdProc.o: CmdProc.cpp CmdProc.h 284 ColorTableShader.o: ColorTableShader.cpp ColorTableShader.h Shader.h 284 285 Command.o: Command.cpp nanovis.h config.h define.h FlowCmd.h CmdProc.h Trace.h PlaneRenderer.h PPMWriter.h BMPWriter.h dxReader.h Grid.h HeightMap.h Camera.h ZincBlendeReconstructor.h OrientationIndicator.h Unirect.h Volume.h VolumeRenderer.h 285 286 ContourLineFilter.o: ContourLineFilter.cpp ContourLineFilter.h … … 293 294 HeightMap.o: HeightMap.cpp HeightMap.h 294 295 LIC.o: LIC.cpp LIC.h 295 NvColorTableShader.o: NvColorTableShader.cpp NvColorTableShader.h NvShader.h296 NvParticleAdvectionShader.o: NvParticleAdvectionShader.cpp NvParticleAdvectionShader.h NvShader.h297 NvRegularVolumeShader.o: NvRegularVolumeShader.cpp NvRegularVolumeShader.h NvVolumeShader.h NvShader.h298 NvShader.o: NvShader.cpp NvShader.h299 NvStdVertexShader.o: NvStdVertexShader.cpp NvStdVertexShader.h NvShader.h300 NvVolumeShader.o: NvVolumeShader.cpp NvVolumeShader.h NvShader.h301 NvZincBlendeVolumeShader.o: NvZincBlendeVolumeShader.cpp NvZincBlendeVolumeShader.h NvVolumeShader.h NvShader.h302 296 OrientationIndicator.o: OrientationIndicator.cpp OrientationIndicator.h 297 ParticleAdvectionShader.o: ParticleAdvectionShader.cpp ParticleAdvectionShader.h Shader.h 303 298 ParticleEmitter.o: ParticleEmitter.cpp ParticleEmitter.h 304 299 ParticleRenderer.o: ParticleRenderer.cpp ParticleRenderer.h … … 314 309 PPMWriter.o: PPMWriter.cpp PPMWriter.h 315 310 ReaderCommon.o: ReaderCommon.cpp ReaderCommon.h GradientFilter.h $(VRMATH_DIR)/include/vrmath/Vector3f.h 311 RegularVolumeShader.o: RegularVolumeShader.cpp RegularVolumeShader.h VolumeShader.h Shader.h 316 312 RenderVertexArray.o: RenderVertexArray.cpp RenderVertexArray.h 313 Shader.o: Shader.cpp Shader.h 314 StdVertexShader.o: StdVertexShader.cpp StdVertexShader.h Shader.h 317 315 Switch.o: Switch.cpp Switch.h 318 316 Texture1D.o: Texture1D.cpp Texture1D.h … … 325 323 Volume.o: Volume.cpp Volume.h config.h define.h 326 324 VolumeInterpolator.o: VolumeInterpolator.cpp VolumeInterpolator.h Volume.h 327 VolumeRenderer.o: VolumeRenderer.cpp VolumeRenderer.h ConvexPolygon.h Volume.h nanovis.h Trace.h Plane.h NvStdVertexShader.h NvShader.h 325 VolumeRenderer.o: VolumeRenderer.cpp VolumeRenderer.h ConvexPolygon.h Volume.h nanovis.h Trace.h Plane.h StdVertexShader.h Shader.h 326 VolumeShader.o: VolumeShader.cpp VolumeShader.h Shader.h 328 327 VtkReader.o: VtkReader.h Trace.h Volume.h $(VRMATH_DIR)/include/vrmath/Vector3f.h ReaderCommon.h nanovis.h 329 328 ZincBlendeReconstructor.o: ZincBlendeReconstructor.cpp ZincBlendeReconstructor.h ZincBlendeVolume.h Volume.h $(VRMATH_DIR)/include/vrmath/Vector3f.h 330 329 ZincBlendeVolume.o: ZincBlendeVolume.cpp ZincBlendeVolume.h config.h define.h 330 ZincBlendeVolumeShader.o: ZincBlendeVolumeShader.cpp ZincBlendeVolumeShader.h VolumeShader.h Shader.h 331 331 dxReader.o: dxReader.cpp ReaderCommon.h config.h nanovis.h Unirect.h ZincBlendeVolume.h ZincBlendeReconstructor.h 332 332 md5.o: md5.h 333 333 nanovis.o: nanovis.cpp nanovis.h config.h define.h Command.h Flow.h Grid.h HeightMap.h Camera.h LIC.h ZincBlendeReconstructor.h OrientationIndicator.h PerfQuery.h PlaneRenderer.h PointSetRenderer.h PointSet.h Switch.h Trace.h Unirect.h VelocityArrowsSlice.h VolumeInterpolator.h VolumeRenderer.h ZincBlendeVolume.h Axis.h Chain.h 334 nanovisServer.o: nanovisServer.cpp nanovisServer.h config.h nanovis.h define.h Command.h PPMWriter.h ReadBuffer.h NvShader.h ResponseQueue.h Trace.h334 nanovisServer.o: nanovisServer.cpp nanovisServer.h config.h nanovis.h define.h Command.h PPMWriter.h ReadBuffer.h Shader.h ResponseQueue.h Trace.h -
trunk/packages/vizservers/nanovis/ParticleAdvectionShader.cpp
r3611 r3612 4 4 * 5 5 */ 6 #include " NvParticleAdvectionShader.h"6 #include "ParticleAdvectionShader.h" 7 7 8 8 using namespace nv; 9 9 10 NvParticleAdvectionShader::NvParticleAdvectionShader() :10 ParticleAdvectionShader::ParticleAdvectionShader() : 11 11 _velocityVolumeID(0), 12 12 _scale(1.0f, 1.0f, 1.0f), … … 18 18 } 19 19 20 NvParticleAdvectionShader::~NvParticleAdvectionShader()20 ParticleAdvectionShader::~ParticleAdvectionShader() 21 21 { 22 22 } 23 23 24 void NvParticleAdvectionShader::init()24 void ParticleAdvectionShader::init() 25 25 { 26 26 loadFragmentProgram("update_pos.cg", "main"); … … 28 28 29 29 void 30 NvParticleAdvectionShader::bind(unsigned int texID, unsigned int initPosTexID)30 ParticleAdvectionShader::bind(unsigned int texID, unsigned int initPosTexID) 31 31 { 32 32 setFPTextureParameter("pos_tex", texID); … … 39 39 setFPParameter3f("scale", _scale.x, _scale.y, _scale.z); 40 40 41 NvShader::bind();41 Shader::bind(); 42 42 } 43 43 44 44 void 45 NvParticleAdvectionShader::unbind()45 ParticleAdvectionShader::unbind() 46 46 { 47 47 disableFPTextureParameter("pos_tex"); … … 49 49 disableFPTextureParameter("vel_tex"); 50 50 51 NvShader::unbind();51 Shader::unbind(); 52 52 } -
trunk/packages/vizservers/nanovis/ParticleAdvectionShader.h
r3611 r3612 9 9 #include <vrmath/Vector3f.h> 10 10 11 #include " NvShader.h"11 #include "Shader.h" 12 12 13 13 namespace nv { 14 14 15 class NvParticleAdvectionShader : public NvShader15 class ParticleAdvectionShader : public Shader 16 16 { 17 17 public: 18 NvParticleAdvectionShader();18 ParticleAdvectionShader(); 19 19 20 virtual ~ NvParticleAdvectionShader();20 virtual ~ParticleAdvectionShader(); 21 21 22 22 virtual void bind(unsigned int texID, unsigned int initPosTexID); -
trunk/packages/vizservers/nanovis/ParticleRenderer.cpp
r3611 r3612 19 19 using namespace nv; 20 20 21 NvParticleAdvectionShader *ParticleRenderer::_advectionShader = NULL;21 ParticleAdvectionShader *ParticleRenderer::_advectionShader = NULL; 22 22 ParticleAdvectionShaderInstance shaderInstance; 23 23 … … 103 103 104 104 if (_advectionShader == NULL) { 105 _advectionShader = new NvParticleAdvectionShader();105 _advectionShader = new ParticleAdvectionShader(); 106 106 } 107 107 } -
trunk/packages/vizservers/nanovis/ParticleRenderer.h
r3611 r3612 14 14 #include <vrmath/Vector4f.h> 15 15 16 #include " NvParticleAdvectionShader.h"16 #include "ParticleAdvectionShader.h" 17 17 #include "RenderVertexArray.h" 18 18 … … 84 84 } 85 85 86 static NvParticleAdvectionShader *_advectionShader;86 static ParticleAdvectionShader *_advectionShader; 87 87 88 88 private: -
trunk/packages/vizservers/nanovis/ParticleSystem.cpp
r3502 r3612 30 30 #include "Texture2D.h" 31 31 #include "Texture3D.h" 32 #include " NvShader.h"32 #include "Shader.h" 33 33 #include "Trace.h" 34 34 … … 423 423 { 424 424 // TBD... 425 _context = NvShader::getCgContext();425 _context = Shader::getCgContext(); 426 426 427 427 std::string path = FilePath::getInstance()->getPath("distance.cg"); -
trunk/packages/vizservers/nanovis/PlaneRenderer.cpp
r3611 r3612 1 1 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 2 /* 3 * ----------------------------------------------------------------------4 * PlaneRenderer.cpp : PlaneRenderer class for volume visualization5 *6 * ======================================================================7 * AUTHOR: Wei Qiao <qiaow@purdue.edu>8 * Purdue Rendering and Perceptualization Lab (PURPL)9 *10 3 * Copyright (c) 2004-2013 HUBzero Foundation, LLC 11 4 * 12 * See the file "license.terms" for information on usage and 13 * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 14 * ====================================================================== 5 * Authors: 6 * Wei Qiao <qiaow@purdue.edu> 15 7 */ 16 8 … … 27 19 _renderWidth(width), 28 20 _renderHeight(height), 29 _shader(new NvColorTableShader())21 _shader(new ColorTableShader()) 30 22 { 31 23 _plane.clear(); -
trunk/packages/vizservers/nanovis/PlaneRenderer.h
r3611 r3612 1 1 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 2 /* 3 * ----------------------------------------------------------------------4 * PlaneRenderer.h : PlaneRenderer class for 2D visualization5 *6 * ======================================================================7 * AUTHOR: Wei Qiao <qiaow@purdue.edu>8 * Purdue Rendering and Perceptualization Lab (PURPL)9 *10 3 * Copyright (c) 2004-2013 HUBzero Foundation, LLC 11 4 * 12 * See the file "license.terms" for information on usage and 13 * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 14 * ====================================================================== 5 * Authors: 6 * Wei Qiao <qiaow@purdue.edu> 15 7 */ 16 8 #ifndef PLANE_RENDERER_H … … 19 11 #include <vector> 20 12 21 #include " NvColorTableShader.h"13 #include "ColorTableShader.h" 22 14 #include "TransferFunction.h" 23 15 #include "Texture2D.h" … … 54 46 int _renderHeight; 55 47 56 NvColorTableShader *_shader;48 ColorTableShader *_shader; 57 49 }; 58 50 -
trunk/packages/vizservers/nanovis/PointSet.cpp
r3502 r3612 12 12 #include "PointSet.h" 13 13 #include "PCASplit.h" 14 15 using namespace nv; 14 16 15 17 void -
trunk/packages/vizservers/nanovis/PointSet.h
r3502 r3612 11 11 12 12 #include "PCASplit.h" 13 14 namespace nv { 13 15 14 16 class PointSet … … 87 89 }; 88 90 91 } 92 89 93 #endif -
trunk/packages/vizservers/nanovis/PointSetRenderer.cpp
r3502 r3612 14 14 #include "PCASplit.h" 15 15 16 using namespace nv; 16 17 using namespace nv::util; 17 18 -
trunk/packages/vizservers/nanovis/PointSetRenderer.h
r3502 r3612 14 14 #include "PointShader.h" 15 15 #include "Texture2D.h" 16 17 namespace nv { 16 18 17 19 class PointSetRenderer … … 34 36 }; 35 37 38 } 39 36 40 #endif -
trunk/packages/vizservers/nanovis/PointShader.cpp
r3502 r3612 6 6 #include "PointShader.h" 7 7 8 using namespace nv; 9 8 10 PointShader::PointShader() : 9 NvShader(),11 Shader(), 10 12 _scale(1.0f), 11 13 _normal(NULL) … … 29 31 //setVPTextureParameter("normal", _normal->getGraphicsObjectID()); 30 32 31 NvShader::bind();33 Shader::bind(); 32 34 } 33 35 … … 36 38 //disableVPTextureParameter("normal"); 37 39 38 NvShader::unbind();40 Shader::unbind(); 39 41 } -
trunk/packages/vizservers/nanovis/PointShader.h
r3502 r3612 7 7 #define POINTSHADER_H 8 8 9 #include " NvShader.h"9 #include "Shader.h" 10 10 #include "Texture3D.h" 11 11 12 class PointShader : public NvShader 12 namespace nv { 13 14 class PointShader : public Shader 13 15 { 14 16 public: … … 37 39 }; 38 40 41 } 42 39 43 #endif -
trunk/packages/vizservers/nanovis/RegularVolumeShader.cpp
r3611 r3612 4 4 * 5 5 */ 6 #include " NvRegularVolumeShader.h"6 #include "RegularVolumeShader.h" 7 7 8 8 using namespace nv; 9 9 10 NvRegularVolumeShader::NvRegularVolumeShader()10 RegularVolumeShader::RegularVolumeShader() 11 11 { 12 12 init(); 13 13 } 14 14 15 NvRegularVolumeShader::~NvRegularVolumeShader()15 RegularVolumeShader::~RegularVolumeShader() 16 16 { 17 17 } 18 18 19 void NvRegularVolumeShader::init()19 void RegularVolumeShader::init() 20 20 { 21 21 loadFragmentProgram("one_volume.cg", "main"); 22 22 } 23 23 24 void NvRegularVolumeShader::bind(unsigned int tfID, Volume *volume,24 void RegularVolumeShader::bind(unsigned int tfID, Volume *volume, 25 25 int sliceMode, float sampleRatio) 26 26 { … … 46 46 (volume->twoSidedLighting() ? 1.0f : 0.0f)); 47 47 48 NvShader:: bind();48 Shader:: bind(); 49 49 } 50 50 51 void NvRegularVolumeShader::unbind()51 void RegularVolumeShader::unbind() 52 52 { 53 53 disableFPTextureParameter("volume"); 54 54 disableFPTextureParameter("tf"); 55 55 56 NvShader::unbind();56 Shader::unbind(); 57 57 } -
trunk/packages/vizservers/nanovis/RegularVolumeShader.h
r3611 r3612 8 8 9 9 #include "Volume.h" 10 #include " NvVolumeShader.h"10 #include "VolumeShader.h" 11 11 12 12 namespace nv { 13 13 14 14 /// Shader for regular volume (uniform grid) 15 class NvRegularVolumeShader : public NvVolumeShader15 class RegularVolumeShader : public VolumeShader 16 16 { 17 17 public: 18 NvRegularVolumeShader();18 RegularVolumeShader(); 19 19 20 virtual ~ NvRegularVolumeShader();20 virtual ~RegularVolumeShader(); 21 21 22 22 virtual void bind(unsigned int tfID, Volume *volume, -
trunk/packages/vizservers/nanovis/Shader.cpp
r3611 r3612 12 12 #include <util/FilePath.h> 13 13 14 #include " NvShader.h"14 #include "Shader.h" 15 15 #include "Trace.h" 16 16 … … 18 18 using namespace nv::util; 19 19 20 CGprofile NvShader::_defaultVertexProfile = CG_PROFILE_VP40;21 CGprofile NvShader::_defaultFragmentProfile = CG_PROFILE_FP40;22 CGcontext NvShader::_cgContext = NULL;20 CGprofile Shader::_defaultVertexProfile = CG_PROFILE_VP40; 21 CGprofile Shader::_defaultFragmentProfile = CG_PROFILE_FP40; 22 CGcontext Shader::_cgContext = NULL; 23 23 24 void NvShader::initCg(CGprofile defaultVertexProfile,25 24 void Shader::initCg(CGprofile defaultVertexProfile, 25 CGprofile defaultFragmentProfile) 26 26 { 27 27 _defaultVertexProfile = defaultVertexProfile; … … 30 30 } 31 31 32 void NvShader::exitCg()32 void Shader::exitCg() 33 33 { 34 34 setErrorCallback(NULL); … … 42 42 } 43 43 44 bool NvShader::printErrorInfo()44 bool Shader::printErrorInfo() 45 45 { 46 46 CGerror lastError = cgGetError(); … … 56 56 57 57 CGprogram 58 NvShader::loadCgSourceProgram(CGcontext context, const char *fileName,59 58 Shader::loadCgSourceProgram(CGcontext context, const char *fileName, 59 CGprofile profile, const char *entryPoint) 60 60 { 61 61 std::string path = FilePath::getInstance()->getPath(fileName); … … 76 76 } 77 77 78 NvShader::NvShader():78 Shader::Shader(): 79 79 _vertexProfile(_defaultVertexProfile), 80 80 _fragmentProfile(_defaultFragmentProfile), … … 84 84 } 85 85 86 NvShader::~NvShader()86 Shader::~Shader() 87 87 { 88 TRACE(" In ~NvShader");88 TRACE("Enter"); 89 89 if (_cgContext == NULL) { 90 90 TRACE("Lost Cg context: vp: %s, fp: %s", _vpFile.c_str(), _fpFile.c_str()); … … 94 94 } 95 95 96 void NvShader::loadVertexProgram(const char *fileName, const char *entryPoint)96 void Shader::loadVertexProgram(const char *fileName, const char *entryPoint) 97 97 { 98 98 if (_cgVP != NULL) { … … 104 104 } 105 105 106 void NvShader::loadFragmentProgram(const char *fileName, const char *entryPoint)106 void Shader::loadFragmentProgram(const char *fileName, const char *entryPoint) 107 107 { 108 108 if (_cgFP != NULL) { … … 114 114 } 115 115 116 void NvShader::resetPrograms()116 void Shader::resetPrograms() 117 117 { 118 118 if (_cgVP != NULL) { … … 127 127 } 128 128 129 void NvShader::setErrorCallback(NvCgCallbackFunction callback)129 void Shader::setErrorCallback(CgCallbackFunction callback) 130 130 { 131 TRACE(" NvShader setting error callback to: %p", callback);131 TRACE("Shader setting error callback to: %p", callback); 132 132 cgSetErrorCallback(callback); 133 133 } -
trunk/packages/vizservers/nanovis/Shader.h
r3611 r3612 18 18 namespace nv { 19 19 20 class NvShader20 class Shader 21 21 { 22 22 public: 23 enum NvGLMatrix {23 enum GLMatrix { 24 24 MODELVIEW_MATRIX = CG_GL_MODELVIEW_MATRIX, 25 25 PROJECTION_MATRIX = CG_GL_PROJECTION_MATRIX, 26 26 MODELVIEW_PROJECTION_MATRIX = CG_GL_MODELVIEW_PROJECTION_MATRIX 27 27 }; 28 enum NvGLMatrixType {28 enum GLMatrixType { 29 29 MATRIX_IDENTITY = CG_GL_MATRIX_IDENTITY, 30 30 MATRIX_INVERSE = CG_GL_MATRIX_INVERSE 31 31 }; 32 32 33 typedef void NvCgCallbackFunction(void);34 35 NvShader();36 37 virtual ~ NvShader();33 typedef void CgCallbackFunction(void); 34 35 Shader(); 36 37 virtual ~Shader(); 38 38 39 39 /** … … 201 201 } 202 202 203 void setGLStateMatrixVPParameter(const char *name, NvGLMatrix matrix,204 NvGLMatrixType type = MATRIX_IDENTITY)203 void setGLStateMatrixVPParameter(const char *name, GLMatrix matrix, 204 GLMatrixType type = MATRIX_IDENTITY) 205 205 { 206 206 CGparameter param = getVPParam(name); … … 210 210 } 211 211 212 void setGLStateMatrixFPParameter(const char *name, NvGLMatrix matrix,213 NvGLMatrixType type = MATRIX_IDENTITY)212 void setGLStateMatrixFPParameter(const char *name, GLMatrix matrix, 213 GLMatrixType type = MATRIX_IDENTITY) 214 214 { 215 215 CGparameter param = getFPParam(name); … … 266 266 static bool printErrorInfo(); 267 267 268 static void setErrorCallback( NvCgCallbackFunction callback);268 static void setErrorCallback(CgCallbackFunction callback); 269 269 270 270 static CGcontext getCgContext() -
trunk/packages/vizservers/nanovis/StdVertexShader.cpp
r3611 r3612 4 4 * 5 5 */ 6 #include " NvStdVertexShader.h"6 #include "StdVertexShader.h" 7 7 8 8 using namespace nv; 9 9 10 NvStdVertexShader::NvStdVertexShader()10 StdVertexShader::StdVertexShader() 11 11 { 12 12 init(); 13 13 } 14 14 15 NvStdVertexShader::~NvStdVertexShader()15 StdVertexShader::~StdVertexShader() 16 16 { 17 17 } 18 18 19 void NvStdVertexShader::init()19 void StdVertexShader::init() 20 20 { 21 21 loadVertexProgram("vertex_std.cg", "main"); 22 22 } 23 23 24 void NvStdVertexShader::bind(float *mvp, float *mvInv)24 void StdVertexShader::bind(float *mvp, float *mvInv) 25 25 { 26 26 if (mvp != NULL) { … … 35 35 } 36 36 37 NvShader::bind();37 Shader::bind(); 38 38 } -
trunk/packages/vizservers/nanovis/StdVertexShader.h
r3611 r3612 7 7 #define NV_STD_VERTEX_SHADER_H 8 8 9 #include " NvShader.h"9 #include "Shader.h" 10 10 11 11 namespace nv { 12 12 13 class NvStdVertexShader : public NvShader13 class StdVertexShader : public Shader 14 14 { 15 15 public: 16 NvStdVertexShader();16 StdVertexShader(); 17 17 18 virtual ~ NvStdVertexShader();18 virtual ~StdVertexShader(); 19 19 20 20 virtual void bind(float *mvp = NULL, float *mvInv = NULL); … … 22 22 virtual void unbind() 23 23 { 24 NvShader::unbind();24 Shader::unbind(); 25 25 } 26 26 -
trunk/packages/vizservers/nanovis/VelocityArrowsSlice.cpp
r3611 r3612 19 19 #include "nanovis.h" 20 20 #include "VelocityArrowsSlice.h" 21 #include " NvShader.h"21 #include "Shader.h" 22 22 #include "Camera.h" 23 23 … … 424 424 tan(NanoVis::getCamera()->fov() * 0.5) * NanoVis::winHeight * 0.5); 425 425 _particleShader.setGLStateMatrixVPParameter("modelview", 426 NvShader::MODELVIEW_MATRIX,427 NvShader::MATRIX_IDENTITY);426 Shader::MODELVIEW_MATRIX, 427 Shader::MATRIX_IDENTITY); 428 428 _particleShader.setGLStateMatrixVPParameter("mvp", 429 NvShader::MODELVIEW_PROJECTION_MATRIX,430 NvShader::MATRIX_IDENTITY);429 Shader::MODELVIEW_PROJECTION_MATRIX, 430 Shader::MATRIX_IDENTITY); 431 431 432 432 glEnableClientState(GL_VERTEX_ARRAY); -
trunk/packages/vizservers/nanovis/VelocityArrowsSlice.h
r3611 r3612 12 12 13 13 #include "Texture2D.h" 14 #include " NvShader.h"14 #include "Shader.h" 15 15 16 16 namespace nv { … … 105 105 float _maxPointSize; 106 106 107 NvShader _queryVelocityFP; 108 109 NvShader _particleShader; 107 Shader _queryVelocityFP; 108 Shader _particleShader; 110 109 111 110 int _renderTargetWidth; -
trunk/packages/vizservers/nanovis/VolumeRenderer.cpp
r3611 r3612 28 28 #include "Plane.h" 29 29 #include "ConvexPolygon.h" 30 #include " NvStdVertexShader.h"30 #include "StdVertexShader.h" 31 31 #include "Trace.h" 32 32 … … 53 53 void VolumeRenderer::initShaders() 54 54 { 55 _cutplaneShader = new NvShader();55 _cutplaneShader = new Shader(); 56 56 _cutplaneShader->loadVertexProgram("cutplane_vp.cg", "main"); 57 57 _cutplaneShader->loadFragmentProgram("cutplane_fp.cg", "main"); 58 58 59 59 //standard vertex program 60 _stdVertexShader = new NvStdVertexShader();60 _stdVertexShader = new StdVertexShader(); 61 61 62 62 //volume rendering shader: one cubic volume 63 _regularVolumeShader = new NvRegularVolumeShader();63 _regularVolumeShader = new RegularVolumeShader(); 64 64 65 65 //volume rendering shader: one zincblende orbital volume. … … 71 71 //The engine is already capable of rendering multiple volumes and combine them. Thus, we just invoke this shader on 72 72 //S, P, D and SS orbitals with different transfor functions. The result is a multi-orbital rendering. 73 _zincBlendeShader = new NvZincBlendeVolumeShader();73 _zincBlendeShader = new ZincBlendeVolumeShader(); 74 74 } 75 75 … … 287 287 glScalef(volScaling.x, volScaling.y, volScaling.z); 288 288 _cutplaneShader->setGLStateMatrixVPParameter("modelViewProjMatrix", 289 NvShader::MODELVIEW_PROJECTION_MATRIX);289 Shader::MODELVIEW_PROJECTION_MATRIX); 290 290 glPopMatrix(); 291 291 -
trunk/packages/vizservers/nanovis/VolumeRenderer.h
r3611 r3612 21 21 #include "Volume.h" 22 22 #include "VolumeInterpolator.h" 23 #include " NvRegularVolumeShader.h"24 #include " NvZincBlendeVolumeShader.h"25 #include " NvStdVertexShader.h"23 #include "RegularVolumeShader.h" 24 #include "ZincBlendeVolumeShader.h" 25 #include "StdVertexShader.h" 26 26 27 27 namespace nv { … … 87 87 * Shader for single slice cutplane render 88 88 */ 89 NvShader *_cutplaneShader;89 Shader *_cutplaneShader; 90 90 91 91 /** 92 92 * Shader for rendering a single cubic volume 93 93 */ 94 NvRegularVolumeShader *_regularVolumeShader;94 RegularVolumeShader *_regularVolumeShader; 95 95 96 96 /** … … 108 108 * same space. 109 109 */ 110 NvZincBlendeVolumeShader *_zincBlendeShader;110 ZincBlendeVolumeShader *_zincBlendeShader; 111 111 112 112 /** 113 113 * standard vertex shader 114 114 */ 115 NvStdVertexShader *_stdVertexShader;115 StdVertexShader *_stdVertexShader; 116 116 }; 117 117 -
trunk/packages/vizservers/nanovis/VolumeShader.cpp
r3611 r3612 4 4 * 5 5 */ 6 #include " NvVolumeShader.h"6 #include "VolumeShader.h" 7 7 8 8 using namespace nv; 9 9 10 NvVolumeShader::NvVolumeShader()10 VolumeShader::VolumeShader() 11 11 { 12 12 } 13 13 14 NvVolumeShader::~NvVolumeShader()14 VolumeShader::~VolumeShader() 15 15 { 16 16 } -
trunk/packages/vizservers/nanovis/VolumeShader.h
r3611 r3612 7 7 #define NV_VOLUME_SHADER_H 8 8 9 #include " NvShader.h"9 #include "Shader.h" 10 10 11 11 namespace nv { … … 13 13 class Volume; 14 14 15 class NvVolumeShader : public NvShader15 class VolumeShader : public Shader 16 16 { 17 17 public : 18 virtual ~ NvVolumeShader();18 virtual ~VolumeShader(); 19 19 20 20 virtual void bind(unsigned int tfID, Volume *volume, … … 23 23 virtual void unbind() 24 24 { 25 NvShader::unbind();25 Shader::unbind(); 26 26 } 27 27 28 28 protected : 29 NvVolumeShader();29 VolumeShader(); 30 30 }; 31 31 -
trunk/packages/vizservers/nanovis/ZincBlendeVolumeShader.cpp
r3611 r3612 5 5 */ 6 6 7 #include " NvZincBlendeVolumeShader.h"7 #include "ZincBlendeVolumeShader.h" 8 8 #include "ZincBlendeVolume.h" 9 9 10 10 using namespace nv; 11 11 12 NvZincBlendeVolumeShader::NvZincBlendeVolumeShader()12 ZincBlendeVolumeShader::ZincBlendeVolumeShader() 13 13 { 14 14 init(); 15 15 } 16 16 17 NvZincBlendeVolumeShader::~NvZincBlendeVolumeShader()17 ZincBlendeVolumeShader::~ZincBlendeVolumeShader() 18 18 { 19 19 } 20 20 21 void NvZincBlendeVolumeShader::init()21 void ZincBlendeVolumeShader::init() 22 22 { 23 23 loadFragmentProgram("zincblende_volume.cg", "main"); 24 24 } 25 25 26 void NvZincBlendeVolumeShader::bind(unsigned int tfID, Volume *volume,26 void ZincBlendeVolumeShader::bind(unsigned int tfID, Volume *volume, 27 27 int sliceMode, float sampleRatio) 28 28 { … … 46 46 0.0f); 47 47 48 NvShader::bind();48 Shader::bind(); 49 49 } 50 50 51 void NvZincBlendeVolumeShader::unbind()51 void ZincBlendeVolumeShader::unbind() 52 52 { 53 53 disableFPTextureParameter("tf"); … … 55 55 disableFPTextureParameter("volumeB"); 56 56 57 NvShader::unbind();57 Shader::unbind(); 58 58 } -
trunk/packages/vizservers/nanovis/ZincBlendeVolumeShader.h
r3611 r3612 7 7 #define NV_ZINCBLENDE_SHADER_H 8 8 9 #include " NvVolumeShader.h"9 #include "VolumeShader.h" 10 10 11 11 namespace nv { 12 12 13 class NvZincBlendeVolumeShader : public NvVolumeShader13 class ZincBlendeVolumeShader : public VolumeShader 14 14 { 15 15 public: 16 NvZincBlendeVolumeShader();16 ZincBlendeVolumeShader(); 17 17 18 virtual ~ NvZincBlendeVolumeShader();18 virtual ~ZincBlendeVolumeShader(); 19 19 20 20 virtual void bind(unsigned int tfID, Volume *volume, -
trunk/packages/vizservers/nanovis/nanovis.cpp
r3611 r3612 42 42 #include "Camera.h" 43 43 #include "LIC.h" 44 #include " NvShader.h"44 #include "Shader.h" 45 45 #include "OrientationIndicator.h" 46 46 #include "PlaneRenderer.h" … … 461 461 void cgErrorCallback(void) 462 462 { 463 if (! NvShader::printErrorInfo()) {463 if (!Shader::printErrorInfo()) { 464 464 TRACE("Cg error, exiting..."); 465 465 exit(1); … … 536 536 ImageLoaderFactory::getInstance()->addLoaderImpl("bmp", new BMPImageLoaderImpl()); 537 537 538 NvShader::initCg();539 NvShader::setErrorCallback(cgErrorCallback);538 Shader::initCg(); 539 Shader::setErrorCallback(cgErrorCallback); 540 540 541 541 fonts = new Fonts(); -
trunk/packages/vizservers/nanovis/nanovisServer.cpp
r3606 r3612 33 33 #include "PPMWriter.h" 34 34 #include "ReadBuffer.h" 35 #include " NvShader.h"35 #include "Shader.h" 36 36 #ifdef USE_THREADS 37 37 #include <pthread.h> … … 352 352 NanoVis::removeAllData(); 353 353 354 NvShader::exitCg();354 Shader::exitCg(); 355 355 356 356 //close log file … … 436 436 void cgErrorCallback(void) 437 437 { 438 if (! NvShader::printErrorInfo()) {438 if (!Shader::printErrorInfo()) { 439 439 TRACE("Cg error, exiting..."); 440 440 exitService(1); … … 580 580 581 581 // Override callback with one that cleans up server on exit 582 NvShader::setErrorCallback(cgErrorCallback);582 Shader::setErrorCallback(cgErrorCallback); 583 583 584 584 if (!NanoVis::initGL()) {
Note: See TracChangeset
for help on using the changeset viewer.