Colorintensity

From GameStudio Wiki

Jump to: navigation, search

Lite-C:


Material and function to adjust the effect:

// Colorintensity
MATERIAL* Colorintensity_mat =
{
	effect = "colorintensity.fx";
}

function Colorintensity_set_Value(r,g,b,a)
{
	Colorintensity_mat.skill1 = floatv(r);
	Colorintensity_mat.skill2 = floatv(g);
	Colorintensity_mat.skill3 = floatv(b);
	Colorintensity_mat.skill4 = floatv(a);
}

The colorintensity.fx file:

//changes the colorintensity depending on vecValues1[0][1][2]

texture TargetMap;

float4 vecSkill1;

sampler postTex = sampler_state
{
   texture = (TargetMap);
   MinFilter = linear;
   MagFilter = linear;
   MipFilter = linear;
   AddressU = Clamp;
   AddressV = Clamp;
};

float4 Colorintensity_PS( float2 Tex : TEXCOORD0 ) : COLOR0
{
	float4 Color;

	Color = tex2D(postTex, Tex.xy);

	Color.r = Color.r*vecSkill1.r;
	Color.g = Color.g*vecSkill1.g;
	Color.b = Color.b*vecSkill1.b;
	Color.a = vecSkill1.a;

	return Color;
}

technique tech_00
{
	pass pass_00
	{
		VertexShader = null;
		PixelShader = compile ps_2_0 Colorintensity_PS();
	}
}

technique fallback { pass one { } }


C-Script


Material and function to adjust the effect:

// Colorintensity
material Colorintensity_mat
{
	effect = "colorintensity.fx";
}

function Colorintensity_set_Value(r,g,b,a)
{
	Colorintensity_mat.skill1 = floatv(r);
	Colorintensity_mat.skill2 = floatv(g);
	Colorintensity_mat.skill3 = floatv(b);
	Colorintensity_mat.skill4 = floatv(a);
}

The colorintensity.fx file:

//changes the colorintensity depending on vecValues1[0][1][2]

texture entSkin1;

float4 vecSkill1;

sampler postTex = sampler_state
{
   texture = (entSkin1);
   MinFilter = linear;
   MagFilter = linear;
   MipFilter = linear;
   AddressU = Clamp;
   AddressV = Clamp;
};

float4 Colorintensity_PS( float2 Tex : TEXCOORD0 ) : COLOR0
{
	float4 Color;

	Color = tex2D(postTex, Tex.xy);

	Color.r = Color.r*vecSkill1.r;
	Color.g = Color.g*vecSkill1.g;
	Color.b = Color.b*vecSkill1.b;
	Color.a = vecSkill1.a;

	return Color;
}

technique tech_00
{
	pass pass_00
	{
		VertexShader = null;
		PixelShader = compile ps_2_0 Colorintensity_PS();
	}
}

technique tech_01
{
	pass pass_00
	{
		Texture[0] = <entSkin1>;
	}
}

--Slin 23:20, 10 November 2007 (CET)

Personal tools