Ignore:
Timestamp:
Apr 3, 2012 3:51:13 PM (12 years ago)
Author:
gah
Message:

sync back with trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/packages/vizservers/nanovis/PlaneRenderer.h

    r953 r2936  
    1 
     1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22/*
    33 * ----------------------------------------------------------------------
     
    1414 * ======================================================================
    1515 */
     16#ifndef PLANE_RENDERER_H
     17#define PLANE_RENDERER_H
    1618
    17 #ifndef _PLANE_RENDERER_H_
    18 #define _PLANE_RENDERER_H_
    19 
    20 #include <GL/glew.h>
    21 #include <Cg/cgGL.h>
    22 #include <GL/glut.h>
    2319#include <math.h>
    2420#include <stdio.h>
    2521#include <assert.h>
    2622#include <float.h>
     23
    2724#include <vector>
    2825
    29 #include "define.h"
    30 #include "global.h"
     26#include <GL/glew.h>
     27#include <Cg/cgGL.h>
     28
     29#include "NvColorTableShader.h"
    3130#include "TransferFunction.h"
    3231#include "Texture2D.h"
    3332
    34 using namespace std;
     33class PlaneRenderer
     34{
     35public:
     36    PlaneRenderer(int width, int height);
    3537
    36 class PlaneRenderer{
     38    ~PlaneRenderer();
     39
     40    /// Add a plane and its transfer function.
     41    int addPlane(Texture2D *p, TransferFunction *tf);
     42
     43    void removePlane(int index);
     44
     45    /// Set the active plane to be rendered
     46    void setActivePlane(int index);
     47
     48    /// Change the rendering size
     49    void setScreenSize(int w, int h);
     50
     51    void render();
    3752
    3853private:
    39     vector <Texture2D*> plane;  // Array of volumes
    40     vector <TransferFunction*> tf; // Array of corresponding transfer functions
    41     int active_plane;           // The active plane, only one is rendered
    42     int n_planes;
     54    std::vector<Texture2D *> _plane;     ///< Array of images
     55    std::vector<TransferFunction *> _tf; ///< Array of corresponding transfer functions
     56    int _activePlane;                    ///< The active plane, only one is rendered
     57    int _numPlanes;
    4358
    44     int render_width;   //render size
    45     int render_height; 
     59    int _renderWidth;
     60    int _renderHeight; 
    4661
    47     //cg related
    48     CGcontext g_context;        // The Nvidia cg context
    49     CGprogram m_fprog;
    50     CGparameter m_data_param;
    51     CGparameter m_tf_param;
    52     CGparameter m_render_param;
    53 
    54     void init_shaders();
    55     void activate_shader(int plane_index);
    56     void deactivate_shader();
    57 
    58 public:
    59     PlaneRenderer(CGcontext _context, int width, int height);
    60     ~PlaneRenderer();
    61 
    62     int add_plane(Texture2D* _p, TransferFunction* _tf);
    63     // Add a plane and its transfer function. We require a transfer function
    64     // when a plane is added.
    65     void remove_plane(int index);
    66     void set_active_plane(int index); //set the active plane to be rendered
    67     void set_screen_size(int w, int h); //change the rendering size
    68     void render();
     62    NvColorTableShader *_shader;
    6963};
    7064
Note: See TracChangeset for help on using the changeset viewer.