I'm using PointSprite function from this thread
https://forum.thegamecreators.com/thread/121302
Everything ok but I need sprites rotate to camera only by Y.
Is it possible to realize?
////////////////////////////////
// PS 1.1 Point Sprites //
// //
// By Carlos(Darkcoder)Wilkes //
// Darkcoder.co.uk //
////////////////////////////////
// Reference: http://www.gamedev.net/reference/articles/article2002.asp
//////////////////////////////
// Engine Matrices //
//////////////////////////////
matrix WorldViewProjection : WorldViewProjection;
matrix Projection : Projection;
//////////////////////////////
// Shader Constants //
//////////////////////////////
float ViewportHeight;
//////////////////////////////
// Shader Textures //
//////////////////////////////
texture DiffuseTX <string ResourceName = "" ;>;
sampler2D DiffuseSampler = sampler_state
{
texture = <DiffuseTX>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
//////////////////////////////
// Structs //
//////////////////////////////
struct PointSprite_Input
{
float4 Position : POSITION;
float PSize : PSize;
float4 Colour : COLOR;
float2 Colour1 : TEXCOORD0;
float2 Colour2 : TEXCOORD1;
};
struct PointSprite_Output
{
float4 Position : POSITION;
float2 UV0 : TEXCOORD0;
float PSize : PSize;
float4 Colour : COLOR;
};
//////////////////////////////
// Vertex Shaders //
//////////////////////////////
PointSprite_Output VS_PointSprite(PointSprite_Input IN)
{
PointSprite_Output OUT;
OUT.Position = mul( IN.Position, WorldViewProjection );
OUT.UV0 = 0.0;
OUT.PSize = IN.PSize * Projection._m11 / OUT.Position.w * ViewportHeight / 2;
OUT.Colour.rg = IN.Colour1.xy;
OUT.Colour.ba = IN.Colour2.xy;
return OUT;
}
//////////////////////////////
// Pixel Shaders //
//////////////////////////////
float4 PS_PointSprite(PointSprite_Output IN) : COLOR
{
return tex2D( DiffuseSampler ,IN.UV0 ) * IN.Colour;
}
//////////////////////////////
// Techniques //
//////////////////////////////
technique PointSprite
{
pass p0
{
FILLMODE = POINT;
POINTSPRITEENABLE = TRUE;
POINTSCALEENABLE = TRUE;
vertexShader = compile vs_1_1 VS_PointSprite();
pixelShader = compile ps_1_1 PS_PointSprite();
}
}