⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cloud.fx

📁 java实现的简单的分形树。简单易学!是学习分形知识的很好的例子。其java语法简单
💻 FX
字号:

// Cloud rendering.
//
// Outputs color into RT0, normal/Z into RT1.
// Clouds aren't affected by atmospheric scattering here, and are over-edge
// diffuse shaded.
//
// Versions: vs1.1, ps2.0

#include "_shared.fx"
#include "_library.fx"


// --------------------------------------------------------------------------
//  vertex shader

struct VS_OUTPUT {
	float4 pos		: POSITION;
	float4 normalZ	: TEXCOORD0;
	float4 color	: COLOR0;
};

VS_OUTPUT vsMain (
	float4	pos : POSITION,
	float3	normal : NORMAL )
{
    VS_OUTPUT o;
	o.pos = mul( pos, mWVP );
	float3 n = mul( normal, (float3x3)mWorld );
	
	// slightly over-edge directional light
	float cosang = ( dot( n, vLightDir ) + 1.0 ) * 0.5;
	o.color.xyz = cosang * vScatterSunColor * 0.5 + 0.5;
	o.color.w = 1;

	// normal/Z
	o.normalZ = gNormalZ( o.pos, n );

	return o;
}

// --------------------------------------------------------------------------
//  pixel shader

struct PS_INPUT {
	float4 normalZ : TEXCOORD0;
	float4 color : COLOR0;
};

struct PS_OUTPUT {
	half4 color : COLOR0;
	half4 normalZ : COLOR1;
};

PS_OUTPUT psMain( PS_INPUT i ) : COLOR
{
	PS_OUTPUT o;
	// color
	o.color = i.color;

	// normal/Z
	o.normalZ = float4( i.normalZ.xyz, i.normalZ.w );

	return o;
}


// --------------------------------------------------------------------------
//  effect

technique tec0 {
	pass P0 {
		VertexShader = compile vs_1_1 vsMain();
		PixelShader = compile ps_2_0 psMain();
	}
	pass PLast {
	}
}
technique tecDummy {
	pass P0 {
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -