Ignore:
Timestamp:
Mar 8, 2007 5:56:29 PM (17 years ago)
Author:
vrinside
Message:

Added new zinc blende renderer - It is still needed to compare with unicell based simulation data.
Removed tentatively used class, NvVolQDVolumeShader,NvVolQDVolume
Moved Font.bmp into resources directory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/vizservers/nanovis/VolumeRenderer.cpp

    r580 r617  
    1414 */
    1515
     16#include <R2/R2string.h>
     17#include <R2/R2FilePath.h>
    1618#include "VolumeRenderer.h"
    17 
    18 
    19 VolumeRenderer::VolumeRenderer(CGcontext _context):
     19#include "NvStdVertexShader.h"
     20
     21
     22VolumeRenderer::VolumeRenderer():
    2023  n_volumes(0),
    21   g_context(_context),
    2224  slice_mode(false),
    2325  volume_mode(true)
    2426{
    25   volume.clear();
    26   tf.clear();
    27 
    28   init_shaders();
    29   init_font("/opt/nanovis/lib/font/Font.bmp");
     27    volume.clear();
     28    tf.clear();
     29
     30    init_shaders();
     31
     32    R2string path = R2FilePath::getInstance()->getPath("Font.bmp");
     33    init_font((const char*) path);
    3034}
    3135
    3236VolumeRenderer::~VolumeRenderer()
    3337{
    34     delete m_zincBlendeShader;
    35     delete m_regularVolumeShader;
    36     delete m_volQDVolumeShader;
     38    delete _zincBlendeShader;
     39    delete _regularVolumeShader;
     40    delete _stdVertexShader;
    3741}
    3842
     
    4145 
    4246  //standard vertex program
    43   m_vert_std_vprog = loadProgram(g_context, CG_PROFILE_VP30, CG_SOURCE, "/opt/nanovis/lib/shaders/vertex_std.cg");
    44   m_mvp_vert_std_param = cgGetNamedParameter(m_vert_std_vprog, "modelViewProjMatrix");
    45   m_mvi_vert_std_param = cgGetNamedParameter(m_vert_std_vprog, "modelViewInv");
    46 
     47  _stdVertexShader = new NvStdVertexShader();
    4748
    4849  //volume rendering shader: one cubic volume
    49   m_regularVolumeShader = new NvRegularVolumeShader();
     50  _regularVolumeShader = new NvRegularVolumeShader();
    5051
    5152  //volume rendering shader: one zincblende orbital volume.
     
    5758  //The engine is already capable of rendering multiple volumes and combine them. Thus, we just invoke this shader on
    5859  //S, P, D and SS orbitals with different transfor functions. The result is a multi-orbital rendering.
    59   m_zincBlendeShader = new NvZincBlendeVolumeShader();
    60 
    61   m_volQDVolumeShader = new NvVolQDVolumeShader();
     60  _zincBlendeShader = new NvZincBlendeVolumeShader();
    6261}
    6362
     
    669668
    670669
    671 void VolumeRenderer::activate_volume_shader(int volume_index, bool slice_mode){
    672 
     670void VolumeRenderer::activate_volume_shader(int volume_index, bool slice_mode)
     671{
    673672  //vertex shader
    674   cgGLSetStateMatrixParameter(m_mvp_vert_std_param, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY);
    675   cgGLSetStateMatrixParameter(m_mvi_vert_std_param, CG_GL_MODELVIEW_MATRIX, CG_GL_MATRIX_INVERSE);
    676   cgGLBindProgram(m_vert_std_vprog);
    677   cgGLEnableProfile(CG_PROFILE_VP30);
    678 
     673  _stdVertexShader->bind();
    679674
    680675  if (volume[volume_index]->volume_type == CUBIC)
    681676  {
    682677    //regular cubic volume
    683     m_regularVolumeShader->bind(tf[volume_index]->id, volume[volume_index], slice_mode);
    684   }
    685 
     678    _regularVolumeShader->bind(tf[volume_index]->id, volume[volume_index], slice_mode);
     679  }
    686680  else if (volume[volume_index]->volume_type == ZINCBLENDE)
    687681  {
    688     m_zincBlendeShader->bind(tf[volume_index]->id, volume[volume_index], slice_mode);
    689   }
    690   else if (volume[volume_index]->volume_type == VOLQD)
    691   {
    692     m_volQDVolumeShader->bind(tf[volume_index]->id, volume[volume_index], slice_mode);
     682    _zincBlendeShader->bind(tf[volume_index]->id, volume[volume_index], slice_mode);
    693683  }
    694684}
     
    697687void VolumeRenderer::deactivate_volume_shader()
    698688{
    699   cgGLDisableProfile(CG_PROFILE_VP30);
    700 
    701   m_regularVolumeShader->unbind();
    702   m_zincBlendeShader->unbind();
     689    _stdVertexShader->unbind();
     690    _regularVolumeShader->unbind();
     691    _zincBlendeShader->unbind();
    703692}
    704693
     
    756745
    757746
    758 void VolumeRenderer::init_font(char* filename) {
     747void VolumeRenderer::init_font(const char* filename) {
    759748
    760749    FILE *file;
Note: See TracChangeset for help on using the changeset viewer.