Changeset 2820 for trunk/packages/vizservers
- Timestamp:
- Mar 7, 2012 11:10:08 AM (12 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Makefile.in
r2819 r2820 161 161 TransferFunction.o \ 162 162 Unirect.o \ 163 Util.o \164 163 VelocityArrowsSlice.o \ 165 164 Volume.o \ … … 349 348 TransferFunction.o: TransferFunction.cpp 350 349 Unirect.o: Unirect.cpp Unirect.h Trace.h 351 Util.o: Util.cpp Util.h352 350 VelocityArrowsSlice.o: VelocityArrowsSlice.cpp VelocityArrowsSlice.h 353 351 Volume.o: Volume.cpp Volume.h $(AUXSRC) -
trunk/packages/vizservers/nanovis/TransferFunction.cpp
r2798 r2820 14 14 * ====================================================================== 15 15 */ 16 17 16 18 17 #include "TransferFunction.h" … … 55 54 } 56 55 56 void 57 TransferFunction::sample(float fraction, float *key, int count, Vector3 *keyValue, Vector3 *ret) 58 { 59 int limit = count - 1; 60 if (fraction <= key[0]) { 61 *ret = keyValue[0]; 62 } else if (fraction >= key[limit]) { 63 *ret = keyValue[limit]; 64 } else { 65 int n; 66 for (n = 0; n < limit; n++){ 67 if (fraction >= key[n] && fraction < key[n+1]) break; 68 } 69 if (n >= limit) { 70 *ret = keyValue[limit]; 71 } else { 72 float inter = (fraction - key[n]) / (key[n + 1] - key[n]); 73 ret->set(inter * (keyValue[n + 1].x - keyValue[n].x) + keyValue[n].x, 74 inter * (keyValue[n + 1].y - keyValue[n].y) + keyValue[n].y, 75 inter * (keyValue[n + 1].z - keyValue[n].z) + keyValue[n].z); 76 } 77 } 78 } 79 80 void 81 TransferFunction::sample(float fraction, float *key, int count, float *keyValue, float *ret) 82 { 83 int limit = count - 1; 84 if (fraction <= key[0]) { 85 *ret = keyValue[0]; 86 } else if (fraction >= key[limit]) { 87 *ret = keyValue[limit]; 88 } else { 89 int n; 90 for (n = 0; n < limit; n++){ 91 if (fraction >= key[n] && fraction < key[n+1]) break; 92 } 93 if (n >= limit) { 94 *ret = keyValue[limit]; 95 } else { 96 float inter = (fraction - key[n]) / (key[n + 1] - key[n]); 97 *ret = inter * (keyValue[n + 1] - keyValue[n]) + keyValue[n]; 98 } 99 } 100 } -
trunk/packages/vizservers/nanovis/TransferFunction.h
r2798 r2820 14 14 * ====================================================================== 15 15 */ 16 #ifndef TRANSFER_FUNCTION_H 17 #define TRANSFER_FUNCTION_H 16 18 17 #ifndef _TRANSFER_FUNCTION_H_ 18 #define _TRANSFER_FUNCTION_H_ 19 19 #include <R2/R2Object.h> 20 20 21 21 #include "Texture1D.h" 22 #include <R2/R2Object.h>22 #include "Vector3.h" 23 23 24 25 class TransferFunction : public R2Object{24 class TransferFunction : public R2Object 25 { 26 26 int _size; //the resolution of the color map, how many 27 27 //(RGBA) quadraples … … 30 30 const char *_name; 31 31 GLuint _id; //OpenGL's texture identifier 32 32 33 protected : 33 34 ~TransferFunction(); 35 34 36 public: 35 37 TransferFunction(int size, float *data); … … 57 59 _name = name; 58 60 } 61 62 static void sample(float fraction, float *key, int count, Vector3 *keyValue, Vector3 *ret); 63 static void sample(float fraction, float *key, int count, float *keyValue, float *ret); 59 64 }; 60 65 -
trunk/packages/vizservers/nanovis/nanovis.cpp
r2819 r2820 41 41 #include "PointSetRenderer.h" 42 42 #include "PointSet.h" 43 #include "Util.h"44 43 #include <NvLIC.h> 45 44 #include <Trace.h>
Note: See TracChangeset
for help on using the changeset viewer.