00001 #include <iostream.h>
00002 #include "FrameBuf16.h"
00003 #include "SplatSlicer.h"
00004
00005 #define SHSP_SPLAT_SIZE 50
00006 #define SHSP_MAXSPLATCROP 0.0 // full extension in z direction
00007 #define SHSP_SPLATRADIUS 1.6
00008 #define SHSP_SHEETWIDTH 1
00009
00010
00014 float pow(float b, unsigned int e)
00015 {
00016 float r = 1;
00017 while(e) {
00018 if(e&1) r*=b;
00019 b*=b;
00020 e=e>>1;
00021 }
00022 return r;
00023 }
00024
00025 void main(void)
00026 {
00027 RGBABuffer fb(6,6);
00028 RGBABuffer bb(6,6);
00029 AlphaMask ab;
00030 SplatSlicer m_Splat;
00031 m_Splat.buildSplat(SHSP_SPLATRADIUS,3,3,128);
00032
00033 float vcol[4] = {1.0000, 0.0000, 1.0000, 1.00};
00034 float ccol[4] = {0.0f,0.0f,0.0f,0.0f};
00035 float col[4] = {1.0f,0.0f,0.0f,0.5f};
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 ab.clear(ccol);
00059 fb.clear(ccol);
00060 ccol[3] = 0;
00061 bb.clear(ccol);
00062
00063 ColourRGBa rgbac(vcol);
00064 rgbac.setAlpha(1);
00065 fb.addColourWithM1subM2(m_Splat.getSpla(2), m_Splat.getSpla(-1),
00066 rgbac,
00067 0,0);
00068 m_Splat.getSpla(2).print();
00069 m_Splat.getSpla(-1).print();
00070 fb.print();
00071 cout<<"-------------------"<<endl;
00072 bb.blendOver(fb);
00073 bb.print();
00074 return 0;
00075
00076 ab.clear(ccol);
00077 fb.clear(ccol);
00078 ccol[3] = 1;
00079 ccol[0] = .8;
00080 bb.clear(ccol);
00081 ab.getData()[2] = word(0.5*P2_16);
00082 printf("ab\n");
00083 ab.print();
00084 rgbac = col;
00085 fb.addColourWithMask(ab,rgbac,0,0);
00086 printf("fb\n");
00087 fb.print();
00088 bb.blendUnder(fb,0,0);
00089 printf("bb\n");
00090 bb.print();
00091
00092 ccol[0] = 1;
00093 fb.clear(ccol);
00094 bb.blendUnder(fb,0,0);
00095 bb.print();
00096 }