1 


2  void main(in float4 posin : POSITION,


3  in float4 colin : COLOR0,


4  out float psize : PSIZE,


5  out float4 posout : POSITION,


6  out float4 colout : COLOR0,


7  uniform float atten,


8  /*uniform sampler2D normal,*/


9  uniform float4 posoffset,


10  uniform float4 basepos,


11  uniform float4 scale,


12  uniform float4x4 modelview,


13  uniform float4x4 projection)


14  {


15 


16  float4 vec, homeye, eye;


17  vec.xyz = posin.xyz;


18  vec.w = 1.0;


19  homeye = mul(modelview, vec);


20  posout = mul(projection, homeye);


21 


22  float4 p = mul(modelview, vec);


23  //psize = scale.x *(p.w / p.z) * 10;


24 


25  //psize = 5 * scale.x;


26  //psize = 2 * p.w / p.z;


27  //colout = float4(colin.xyz,0.1);


28 


29 


30  // float tmp = posin.w * rsqrt(dot(eye.xyz, eye.xyz));


31  // psize = scale.x * max(tmp, 1.0);


32  psize = 10 * p.w / p.z;


33 


34  colout = float4(colin.xyz, colin.w * 0.25);


35  /*


36  float4 vec, homeye, eye;


37  float tmp;


38 


39  vec.xyz = posin.xyz;//(posin.xyz + posoffset.www) * basepos.www + basepos.xyz;


40  vec.w = 1.0;


41 


42  homeye = mul(modelview, vec);


43  posout = mul(projection, homeye);


44 


45  //eye = homeye / homeye.w;


46 


47  //tmp = posin.w * basepos.w * scale.w * rsqrt(atten * dot(eye.xyz, eye.xyz));


48 


49  //psize = scale.x * max(tmp, 1.0);


50  //tmp = min(tmp, 1.0);


51  //colout = colin;


52  //tmp = colin.w * scale.z * tmp * tmp;


53  //colout.w = max(tmp, 4.0/256);


54 


55  psize = 5.0;


56 


57 


58  colout = float4(0.0, 0.0, 1.0, 0.1);


59  */


60  }

