Changeset 373 for trunk/gui/vizservers


Ignore:
Timestamp:
Mar 23, 2006, 8:28:56 AM (19 years ago)
Author:
qiaow
Message:

buildable code with Color and Sphere classes

Location:
trunk/gui/vizservers/nanovis
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/vizservers/nanovis/Color.h

    r371 r373  
    1616#define _COLOR_H_
    1717
    18 #include "Vector4.h"
    19 
    2018class Color 
    2119{
  • trunk/gui/vizservers/nanovis/Makefile

    r366 r373  
    11OBJ_NANOVIS = nanovis.o Socket.o RenderVertexArray.o Plane.o ConvexPolygon.o Vector4.o Vector3.o Mat4x4.o \
    2                 Texture1D.o Texture3D.o ColorMap.o Volume.o Texture2D.o ParticleSystem.o
     2                Texture1D.o Texture3D.o ColorMap.o Volume.o Texture2D.o ParticleSystem.o Sphere.o Color.o
    33
    44AUXSRC = config.h define.h global.h
     
    77SORTSRC = ./sort
    88
    9 LIB_NANOVIS = -ltcl8.4 -lGL -lglut -lGLEW -lCg -lCgGL -pthread
     9LIB_NANOVIS = -ltcl8.4 -lGL -lglut -lGLEW -lCg -lCgGL -pthread -lstdc++
    1010LIB_CLIENT = -lGL -lglut -pthread
    11 CFLAG = -g -c -Wall -I../../../src2/core
     11CFLAG = -g -c -Wall -I../src2/core
    1212
    1313all: nanovis
     
    1717
    1818nanovis: $(OBJ_NANOVIS)
    19         gcc -g -o nanovis $(OBJ_NANOVIS) $(LIB_NANOVIS) ../../../src2/core/*.o
     19        gcc -g -o nanovis $(OBJ_NANOVIS) $(LIB_NANOVIS) ../src2/core/*.o
    2020
    2121Socket.o: $(SOCKETSRC)/Socket.h $(SOCKETSRC)/Socket.cpp
     
    2727#qdclient: $(OBJ_CLIENT)
    2828#       gcc -g -o qdclient $(OBJ_CLIENT) $(LIB_CLIENT)
     29
     30Color.o: Color.cpp
     31        gcc $(CFLAG) Color.cpp
     32
     33Sphere.o: Vector3.o Color.o
     34        gcc $(CFLAG) Sphere.cpp
    2935
    3036ColorMap.o: ColorMap.cpp
  • trunk/gui/vizservers/nanovis/Sphere.cpp

    r371 r373  
    1616#include "Sphere.h"
    1717#include <stdio.h>
    18 #include <GL/glut.h>
    1918
    2019Sphere::Sphere(float x, float y, float z,
     
    2322                int _stack,
    2423                int _slice):
    25         center(Vector3(x,y,z)),
    26         color(Color(r,g,b,a)),
    2724        radius(_radius),
    2825        stack(_stack),
    29         slice(_slice)
     26        slice(_slice),
     27        center(Vector3(x,y,z)),
     28        color(Color(r,g,b,a))
    3029{ }
    3130
    3231
    33 Sphere::draw(GLUquadric* quad){
     32void Sphere::draw(GLUquadric* quad){
    3433  glColor4f(color.r, color.g, color.b, color.a);
    3534
    3635  glMatrixMode(GL_MODELVIEW);
    3736  glPushMatrix();
    38   glTranslate(center.x, center.y, center.z);
     37  glTranslatef(center.x, center.y, center.z);
    3938
    4039  //draw it
     
    4342}
    4443
    45 Sphere::set_horizontal_res(int _slice):slice(_slice){}
    46 Sphere::set_vertical_res(int _stack):stack(_stack){}
     44void Sphere::set_horizontal_res(int _slice) {slice=_slice;}
     45void Sphere::set_vertical_res(int _stack) {stack=_stack;}
    4746
  • trunk/gui/vizservers/nanovis/Sphere.h

    r371 r373  
    1616#define _SPHERE_H_
    1717
     18#include <GL/glut.h>
    1819#include "Color.h"
     20#include "Vector3.h"
    1921
    2022class Sphere{
     
    3032        ~Sphere(){};
    3133        Sphere(float x, float y, float z, float r, float g, float b, float a, float r, int _stack, int _slice);
    32         set_vertical_res(int _stack);
    33         set_horizontal_res(int _slice);
     34        void set_vertical_res(int _stack);
     35        void set_horizontal_res(int _slice);
    3436       
    3537        //display the sphere
    36         draw();
     38        void draw(GLUquadric* q);
    3739};
    3840
  • trunk/gui/vizservers/nanovis/Volume.cpp

    r371 r373  
    1717
    1818
    19 Volume::Volume(int x, int y, int z,
     19Volume::Volume(float x, float y, float z,
    2020                int w, int h, int d,
    2121                NVISdatatype t, NVISinterptype interp, int n, float* data):
  • trunk/gui/vizservers/nanovis/nanovis.cpp

    r372 r373  
    273273
    274274            nx = (int)ceil(dx/dmin);
     275            ny = (int)ceil(dy/dmin);
     276            nz = (int)ceil(dz/dmin);
     277
     278#ifndef NV40
    275279            nx = pow(2.0, ceil(log10((double)nx)/log10(2.0)));  // must be an even power of 2
    276             ny = (int)ceil(dy/dmin);
    277280            ny = pow(2.0, ceil(log10((double)ny)/log10(2.0)));
    278             nz = (int)ceil(dz/dmin);
    279281            nz = pow(2.0, ceil(log10((double)nz)/log10(2.0)));
     282#endif
     283
    280284            float *data = new float[4*nx*ny*nz];
    281285
     
    385389  }
    386390
    387   volume[index] = new Volume(width, height, depth, NVIS_FLOAT, NVIS_LINEAR_INTERP, n_component, data);
     391  volume[index] = new Volume(0., 0., 0., width, height, depth, NVIS_FLOAT, NVIS_LINEAR_INTERP, n_component, data);
    388392  assert(volume[index]!=0);
    389393}
     
    13951399   */
    13961400
     1401   /*
    13971402   glBegin(GL_QUADS);
    1398    /*
    1399    glTexCoord2f(0, 0); glVertex3f(-1, -1, slice_z);
    1400    glTexCoord2f(1, 0); glVertex3f(1, -1, slice_z);
    1401    glTexCoord2f(1, 1); glVertex3f(1, 1, slice_z);
    1402    glTexCoord2f(0, 1); glVertex3f(-1, 1, slice_z);
    1403    */
    14041403   glTexCoord2f(0, 0); glVertex3f(0, 0, slice_z);
    14051404   glTexCoord2f(1, 0); glVertex3f(1, 0, slice_z);
     
    14071406   glTexCoord2f(0, 1); glVertex3f(0, 1, slice_z);
    14081407   glEnd();
     1408   */
    14091409
    14101410   //soft_display_verts();
  • trunk/gui/vizservers/nanovis/nanovis.h

    r273 r373  
    107107float  tmax   = NPIX/(SCALE*NPN);
    108108float  dmax   = SCALE/NPIX;
     109
     110
     111//currently active shader
     112int cur_shader = 0;
  • trunk/gui/vizservers/nanovis/shaders/one_volume.cg

    r372 r373  
    2727  //float3 sample = tex3D(volume, tex_coord.xyz).xyz;
    2828  float sample = tex3D(volume, tex_coord.xyz);
    29   //float sample = 1;
    3029
    31   //OUT.Color = float4(sample, 10*sqrt(sample.x*sample.x + sample.y*sample.y + sample.z*sample.z)/renderParameters.x);
    3230  if (sample < 0.) {
    3331      OUT.Color = float4(0.0, 0.0, 0.0, 0.0);
    3432  } else {
    35       OUT.Color = float4(sample, sample, sample, sample*0.1);
     33      OUT.Color = float4(sample, sample, sample, sample/renderParameters.x);
    3634  }
     35
    3736  return OUT;
    3837}
Note: See TracChangeset for help on using the changeset viewer.