Changeset 401


Ignore:
Timestamp:
Apr 10, 2006 7:49:34 AM (18 years ago)
Author:
qiaow
Message:

Added Renderable class, the superclass of every class that can be drawn.

Location:
trunk/gui/vizservers/nanovis
Files:
5 added
9 edited

Legend:

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

    r397 r401  
    2424                CGcontext _context, NVISid _vector_field,
    2525                float scalex, float scaley, float scalez):
     26        Renderable(Vector3(0.,0.,0.)),
    2627        size(_size),
    2728        offset(_offset),
    2829        m_g_context(_context),
    29         display_width(_width),
    30         display_height(_height),
     30        width(_width),
     31        height(_height),
    3132        iframe(0),
    3233        Npat(64),
     
    7879  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    7980  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    80   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, display_width, display_height, 0,
     81  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, width, height, 0,
    8182               GL_RGB, GL_INT, NULL);
    8283  glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
     
    293294}
    294295
     296void Lic::render(){ display(); }
     297
     298
    295299void Lic::display(){
    296300
  • trunk/gui/vizservers/nanovis/Lic.h

    r397 r401  
    2525#include "global.h"
    2626
     27#include "Renderable.h"
    2728#include "Vector3.h"
    2829#include "Volume.h"
    29 
    3030
    3131#define NPN 256   //resolution of background pattern
     
    3535#define SCALE 3.0 //scale for background pattern. small value -> fine texture
    3636
    37 class Lic{
     37class Lic : public Renderable {
    3838
    3939private:
    40   int display_width, display_height;
     40  int width, height;
    4141  int size;             //the lic is a square of size, it can be stretched
    4242  float* slice_vector; //storage for the per slice vectors driving the follow
     
    6464
    6565public:
    66   Vector3 normal;
     66  Vector3 normal; //the normal vector of the Lic plane,
     67                // the inherited Vector3 location is its center
    6768  Lic(int _size, int _width, int _height, float _offset,
    68                   CGcontext _context, NVISid _vector_field,
    69                   float scalex, float scaley, float scalez);
     69          CGcontext _context, NVISid _vector_field,
     70          float scalex, float scaley, float scalez);
    7071  ~Lic();
    7172
    7273  void convolve();
    7374  void display();       //display the convolution result
     75  void render();
    7476  void make_patterns();
    7577  void make_magnitudes();
  • trunk/gui/vizservers/nanovis/Makefile

    r397 r401  
    33                PerfQuery.o TransferFunction.o ControlPoint.o ColorGradient.o ColorPaletteWindow.o\
    44                ColorGradientGLUTWindow.o TransferFunctionGLUTWindow.o MainWindow.o Event.o \
    5                 Lic.o
     5                Lic.o Renderable.o
    66
    77OBJ_CLIENT = Socket.o ClientSocket.o RenderClient.o Event.o
     
    7070        gcc $(CFLAG) $(TFSRC)/ControlPoint.cpp
    7171
    72 Sphere.o: Vector3.o Color.o
     72Sphere.o: Renderable.o Color.o
    7373        gcc $(CFLAG) Sphere.cpp
    7474
     
    8585        gcc $(CFLAG) Texture3D.cpp
    8686
    87 ParticleSystem.o: ParticleSystem.cpp $(AUXSRC)
     87ParticleSystem.o: Renderable.o ParticleSystem.cpp $(AUXSRC)
    8888        gcc $(CFLAG) ParticleSystem.cpp
    8989
    90 Lic.o: Lic.cpp Lic.h $(AUXSRC)
     90Renderable.o: Renderable.cpp
     91        gcc $(CFLAG) Renderable.cpp
     92
     93Lic.o: Renderable.o Lic.cpp Lic.h $(AUXSRC)
    9194        gcc $(CFLAG) Lic.cpp
    9295
  • trunk/gui/vizservers/nanovis/ParticleSystem.cpp

    r397 r401  
    203203
    204204
     205void ParticleSystem::render(){ display_vertices(); }
     206
    205207void ParticleSystem::display_vertices(){
    206208  glDisable(GL_TEXTURE_2D);
  • trunk/gui/vizservers/nanovis/ParticleSystem.h

    r397 r401  
    2525#include "global.h"
    2626
     27#include "Renderable.h"
    2728#include "RenderVertexArray.h"
    2829#include "Vector3.h"
     
    4041
    4142
    42 class ParticleSystem{
     43class ParticleSystem : public Renderable{
    4344
    4445  NVISid psys_fbo[2];   //frame buffer objects: two are defined, flip them as input output every step
     
    7475  void display_vertices();
    7576  void reset();
     77  void render();
    7678
    7779};
  • trunk/gui/vizservers/nanovis/Sphere.cpp

    r379 r401  
    2222                int _stack,
    2323                int _slice):
     24        Renderable(Vector3(x, y, z)),
    2425        radius(_radius),
    2526        stack(_stack),
    2627        slice(_slice),
    27         center(Vector3(x,y,z)),
    28         color(Color(r,g,b))
    29 { }
     28        color(Color(r,g,b)) { }
    3029
     30Sphere::~Sphere(){}
     31
     32void Sphere::render(){}
    3133
    3234void Sphere::draw(GLUquadric* quad){
     
    3537  glMatrixMode(GL_MODELVIEW);
    3638  glPushMatrix();
    37   glTranslatef(center.x, center.y, center.z);
     39  glTranslatef(location.x, location.y, location.z);
    3840
    3941  //draw it
  • trunk/gui/vizservers/nanovis/Sphere.h

    r379 r401  
    1313 * ======================================================================
    1414 */
     15
    1516#ifndef _SPHERE_H_
    1617#define _SPHERE_H_
    1718
    1819#include <GL/glut.h>
     20
    1921#include "Color.h"
    20 #include "Vector3.h"
     22#include "Renderable.h"
    2123
    22 class Sphere{
     24class Sphere : public Renderable{
    2325
    2426public:
    25         Vector3 center;
    2627        float radius;
    2728        Color color;
     
    2930        int slice;
    3031
    31         Sphere(){};
    32         ~Sphere(){};
     32        ~Sphere();
    3333        Sphere(float x, float y, float z, float r, float g, float b, float _radius, int _stack, int _slice);
    3434        void set_vertical_res(int _stack);
     
    3737        //display the sphere
    3838        void draw(GLUquadric* q);
     39        void render();
    3940};
    4041
  • trunk/gui/vizservers/nanovis/nanovis.cpp

    r397 r401  
    16551655   draw_3d_axis();
    16561656   
    1657    lic->display();      //display the line integral convolution result
     1657   lic->render();       //display the line integral convolution result
    16581658   
    16591659   //soft_display_verts();
    16601660   perf->enable();
    1661      psys->display_vertices();
     1661     psys->render();
    16621662   perf->disable();
    16631663   //fprintf(stderr, "particle pixels: %d\n", perf->get_pixel_count());
  • trunk/gui/vizservers/nanovis/shaders/one_volume.cg

    r396 r401  
    1818
    1919
    20 //#define PHONG_SHADING
     20#define PHONG_SHADING
    2121
    2222PixelOut main(v2f IN, /* uniform sampler1D tf,*/
     
    3737#ifdef PHONG_SHADING
    3838      //lighting parameters
    39       float3 normal = normalize(sample.yzw);
     39      float3 normal;
     40      if(length(sample.yzw)>0.0)
     41        normal = normalize(sample.yzw);
     42
    4043      float3 light_vector = normalize(IN.Light);
    4144      float3 eye_vector = normalize(IN.EyeVector);
     
    4649      //sample the transfer function texture
    4750      float4 color = tex1D(tf, sample.x);
    48       color.w = 5*color.w/renderParameters.x;
     51      color.w = 30*color.w/renderParameters.x;
    4952
    5053      //float4 color = float4(sample.x, 0, 0, 1);
Note: See TracChangeset for help on using the changeset viewer.