Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

General/vuTFunc/vuTFLinear.cpp

Go to the documentation of this file.
00001 #include "simpleFuncs.h"
00002 #include "vuTFLinear.h"
00003 
00004 void vuTFLinear::addLinear(dword channels,
00005                            byte density,
00006                            byte width,
00007                            float max_value,
00008                            float min_value)
00009 {
00010     float m;
00011     float b;
00012     float v;
00013     byte i;
00014 
00015     m = (max_value-min_value)/(float)width;
00016     b = max_value - m*((float)density);
00017     for(i=density-width; i<=density+width; ++i)
00018     {
00019         v = m*((float)i)+b;
00020 
00021         if (channels & vuTFRed)
00022             m_Table[i<<2] = snapToZeroOne(m_Table[i<<2]+v);
00023 
00024         if (channels & vuTFGreen)
00025             m_Table[(i<<2)+1] = snapToZeroOne(m_Table[(i<<2)+1]+v);
00026 
00027         if (channels & vuTFBlue)
00028             m_Table[(i<<2)+2] = snapToZeroOne(m_Table[(i<<2)+2]+v);
00029 
00030         if (channels & vuTFAlpha)
00031             m_Table[(i<<2)+3] = snapToZeroOne(m_Table[(i<<2)+3]+v);
00032 
00033         if (i == density)
00034         {
00035             m *= -1.0f;
00036             b = max_value*2 - b;
00037         }
00038     }
00039 }

Generated on Wed Dec 15 21:20:38 2004 for vuVolume by  doxygen 1.3.9.1