LosaDev source snapshot 2019

This commit is contained in:
LosaDev committed 2026-11-07 13:30:45 +07:00
commit c198676e97
20588 files changed
+8812878

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

+187
View File
@@ -0,0 +1,187 @@
xof 0303txt 0032
template VertexDuplicationIndices {
<b8d65549-d7c9-4995-89cf-53a9a8b031e3>
DWORD nIndices;
DWORD nOriginalVertices;
array DWORD indices[nIndices];
}
template FVFData {
<b6e70a0e-8ef9-4e83-94ad-ecc8b0c04897>
DWORD dwFVF;
DWORD nDWords;
array DWORD data[nDWords];
}
template VertexElement {
<f752461c-1e23-48f6-b9f8-8350850f336f>
DWORD Type;
DWORD Method;
DWORD Usage;
DWORD UsageIndex;
}
template DeclData {
<bf22e553-292c-4781-9fea-62bd554bdd93>
DWORD nElements;
array VertexElement Elements[nElements];
DWORD nDWords;
array DWORD data[nDWords];
}
template EffectParamFloats {
<3014b9a0-62f5-478c-9b86-e4ac9f4e418b>
STRING ParamName;
DWORD nFloats;
array FLOAT Floats[nFloats];
}
template EffectParamString {
<1dbc4c88-94c1-46ee-9076-2c28818c9481>
STRING ParamName;
STRING Value;
}
template EffectParamDWord {
<e13963bc-ae51-4c5d-b00f-cfa3a9d97ce5>
STRING ParamName;
DWORD Value;
}
template EffectInstance {
<e331f7e4-0559-4cc2-8e99-1cec1657928f>
STRING EffectFilename;
[...]
}
Mesh {
24;
-0.800000;-0.500000;-0.100000;,
-0.800000;-0.500000;0.100000;,
-0.800000;0.500000;0.100000;,
-0.800000;0.500000;-0.100000;,
-0.800000;0.500000;-0.100000;,
-0.800000;0.500000;0.100000;,
0.800000;0.500000;0.100000;,
0.800000;0.500000;-0.100000;,
0.800000;0.500000;-0.100000;,
0.800000;0.500000;0.100000;,
0.800000;-0.500000;0.100000;,
0.800000;-0.500000;-0.100000;,
-0.800000;-0.500000;0.100000;,
-0.800000;-0.500000;-0.100000;,
0.800000;-0.500000;-0.100000;,
0.800000;-0.500000;0.100000;,
-0.800000;-0.500000;0.100000;,
0.800000;-0.500000;0.100000;,
0.800000;0.500000;0.100000;,
-0.800000;0.500000;0.100000;,
-0.800000;-0.500000;-0.100000;,
-0.800000;0.500000;-0.100000;,
0.800000;0.500000;-0.100000;,
0.800000;-0.500000;-0.100000;;
12;
3;0,1,2;,
3;2,3,0;,
3;4,5,6;,
3;6,7,4;,
3;8,9,10;,
3;10,11,8;,
3;12,13,14;,
3;14,15,12;,
3;16,17,18;,
3;18,19,16;,
3;20,21,22;,
3;22,23,20;;
MeshTextureCoords {
24;
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;;
}
MeshMaterialList {
4;
12;
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
2;
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"ground2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"env2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"ground2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"env2.bmp";
}
}
}
}
File diff suppressed because it is too large. Load diff
+282
View File
@@ -0,0 +1,282 @@
xof 0303txt 0032
template VertexDuplicationIndices {
<b8d65549-d7c9-4995-89cf-53a9a8b031e3>
DWORD nIndices;
DWORD nOriginalVertices;
array DWORD indices[nIndices];
}
template FVFData {
<b6e70a0e-8ef9-4e83-94ad-ecc8b0c04897>
DWORD dwFVF;
DWORD nDWords;
array DWORD data[nDWords];
}
template VertexElement {
<f752461c-1e23-48f6-b9f8-8350850f336f>
DWORD Type;
DWORD Method;
DWORD Usage;
DWORD UsageIndex;
}
template DeclData {
<bf22e553-292c-4781-9fea-62bd554bdd93>
DWORD nElements;
array VertexElement Elements[nElements];
DWORD nDWords;
array DWORD data[nDWords];
}
template EffectParamFloats {
<3014b9a0-62f5-478c-9b86-e4ac9f4e418b>
STRING ParamName;
DWORD nFloats;
array FLOAT Floats[nFloats];
}
template EffectParamString {
<1dbc4c88-94c1-46ee-9076-2c28818c9481>
STRING ParamName;
STRING Value;
}
template EffectParamDWord {
<e13963bc-ae51-4c5d-b00f-cfa3a9d97ce5>
STRING ParamName;
DWORD Value;
}
template EffectInstance {
<e331f7e4-0559-4cc2-8e99-1cec1657928f>
STRING EffectFilename;
[...]
}
Mesh {
34;
-6.000000;-3.000000;-6.000000;,
6.000000;-3.000000;-6.000000;,
-6.000000;-3.000000;6.000000;,
6.000000;-3.000000;6.000000;,
-6.000000;-3.000000;-6.000000;,
6.000000;-3.000000;-6.000000;,
-6.000000;2.500000;-6.000000;,
-4.000000;2.500000;-6.000000;,
4.000000;2.500000;-6.000000;,
6.000000;2.500000;-6.000000;,
-4.000000;3.000000;-6.000000;,
4.000000;3.000000;-6.000000;,
-6.000000;-3.000000;6.000000;,
6.000000;-3.000000;6.000000;,
-6.000000;2.500000;6.000000;,
-4.000000;2.500000;6.000000;,
4.000000;2.500000;6.000000;,
6.000000;2.500000;6.000000;,
-4.000000;3.000000;6.000000;,
4.000000;3.000000;6.000000;,
-6.000000;-3.000000;-6.000000;,
-6.000000;2.500000;-6.000000;,
-6.000000;2.500000;-6.000000;,
-4.000000;2.500000;-6.000000;,
4.000000;2.500000;-6.000000;,
6.000000;2.500000;-6.000000;,
-4.000000;3.000000;-6.000000;,
4.000000;3.000000;-6.000000;,
-6.000000;2.500000;6.000000;,
-4.000000;2.500000;6.000000;,
4.000000;2.500000;6.000000;,
6.000000;2.500000;6.000000;,
-4.000000;3.000000;6.000000;,
4.000000;3.000000;6.000000;;
24;
3;0,2,1;,
3;1,2,3;,
3;20,5,21;,
3;21,5,9;,
3;7,8,10;,
3;10,8,11;,
3;4,6,12;,
3;12,6,14;,
3;12,14,13;,
3;13,14,17;,
3;15,18,16;,
3;16,18,19;,
3;13,17,5;,
3;5,17,9;,
3;22,23,28;,
3;28,23,29;,
3;23,26,29;,
3;29,26,32;,
3;26,27,32;,
3;32,27,33;,
3;27,24,33;,
3;33,24,30;,
3;24,25,30;,
3;30,25,31;;
MeshNormals {
34;
0.000000;1.000000;0.000000;,
0.000000;1.000000;0.000000;,
0.000000;1.000000;0.000000;,
0.000000;1.000000;0.000000;,
1.000000;0.000000;0.000000;,
-0.707107;0.000000;0.707107;,
1.000000;0.000000;0.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
-0.707107;0.000000;0.707107;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.894427;0.000000;-0.447214;,
-0.447214;0.000000;-0.894427;,
0.447214;0.000000;-0.894427;,
0.000000;0.000000;-1.000000;,
0.000000;0.000000;-1.000000;,
-0.894427;0.000000;-0.447214;,
0.000000;0.000000;-1.000000;,
0.000000;0.000000;-1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;-1.000000;0.000000;,
0.124035;-0.992278;0.000000;,
-0.447214;-0.894427;0.000000;,
0.000000;-1.000000;0.000000;,
0.124035;-0.992278;0.000000;,
-0.031235;-0.999512;0.000000;,
0.000000;-1.000000;0.000000;,
0.447214;-0.894427;0.000000;,
-0.124035;-0.992278;0.000000;,
0.000000;-1.000000;0.000000;,
0.031235;-0.999512;0.000000;,
-0.124035;-0.992278;0.000000;;
24;
3;0,2,1;,
3;1,2,3;,
3;20,5,21;,
3;21,5,9;,
3;7,8,10;,
3;10,8,11;,
3;4,6,12;,
3;12,6,14;,
3;12,14,13;,
3;13,14,17;,
3;15,18,16;,
3;16,18,19;,
3;13,17,5;,
3;5,17,9;,
3;22,23,28;,
3;28,23,29;,
3;23,26,29;,
3;29,26,32;,
3;26,27,32;,
3;32,27,33;,
3;27,24,33;,
3;33,24,30;,
3;24,25,30;,
3;30,25,31;;
}
MeshTextureCoords {
34;
0.000000;0.000000;,
0.000000;2.000000;,
2.000000;0.000000;,
2.000000;2.000000;,
0.000000;1.000000;,
6.000000;1.000000;,
0.000000;0.083333;,
7.666667;0.083333;,
6.333333;0.083333;,
6.000000;0.083333;,
7.666667;0.000000;,
6.333333;0.000000;,
2.000000;1.000000;,
4.000000;1.000000;,
2.000000;0.083333;,
2.333333;0.083333;,
3.666667;0.083333;,
4.000000;0.083333;,
2.333333;0.000000;,
3.666667;0.000000;,
8.000000;1.000000;,
8.000000;0.083333;,
0.000000;0.000000;,
0.333333;0.000000;,
1.833333;0.000000;,
2.166667;0.000000;,
0.416667;0.000000;,
1.750000;0.000000;,
0.000000;2.000000;,
0.333333;2.000000;,
1.833333;2.000000;,
2.166667;2.000000;,
0.416667;2.000000;,
1.750000;2.000000;;
}
MeshMaterialList {
3;
24;
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2;
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"ground2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"env2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"seafloor.bmp";
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+280
View File
@@ -0,0 +1,280 @@
//-----------------------------------------------------------------------------
// File: ShadowMap.fx
//
// Desc: Effect file for high dynamic range cube mapping sample.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#define SMAP_SIZE 512
#define SHADOW_EPSILON 0.00005f
float4x4 g_mWorldView;
float4x4 g_mProj;
float4x4 g_mViewToLightProj; // Transform from view space to light projection space
float4 g_vMaterial;
texture g_txScene;
texture g_txShadow;
float3 g_vLightPos; // Light position in view space
float3 g_vLightDir; // Light direction in view space
float4 g_vLightDiffuse = float4( 1.0f, 1.0f, 1.0f, 1.0f ); // Light diffuse color
float4 g_vLightAmbient = float4( 0.3f, 0.3f, 0.3f, 1.0f ); // Use an ambient light of 0.3
float g_fCosTheta; // Cosine of theta of the spot light
sampler2D g_samScene =
sampler_state
{
Texture = <g_txScene>;
MinFilter = Point;
MagFilter = Linear;
MipFilter = Linear;
};
sampler2D g_samShadow =
sampler_state
{
Texture = <g_txShadow>;
MinFilter = Point;
MagFilter = Point;
MipFilter = Point;
AddressU = Clamp;
AddressV = Clamp;
};
//-----------------------------------------------------------------------------
// Vertex Shader: VertScene
// Desc: Process vertex for scene
//-----------------------------------------------------------------------------
void VertScene( float4 iPos : POSITION,
float3 iNormal : NORMAL,
float2 iTex : TEXCOORD0,
out float4 oPos : POSITION,
out float2 Tex : TEXCOORD0,
out float4 vPos : TEXCOORD1,
out float3 vNormal : TEXCOORD2,
out float4 vPosLight : TEXCOORD3 )
{
//
// Transform position to view space
//
vPos = mul( iPos, g_mWorldView );
//
// Transform to screen coord
//
oPos = mul( vPos, g_mProj );
//
// Compute view space normal
//
vNormal = mul( iNormal, (float3x3)g_mWorldView );
//
// Propagate texture coord
//
Tex = iTex;
//
// Transform the position to light projection space, or the
// projection space as if the camera is looking out from
// the spotlight.
//
vPosLight = mul( vPos, g_mViewToLightProj );
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixScene
// Desc: Process pixel (do per-pixel lighting) for enabled scene
//-----------------------------------------------------------------------------
float4 PixScene( float2 Tex : TEXCOORD0,
float4 vPos : TEXCOORD1,
float3 vNormal : TEXCOORD2,
float4 vPosLight : TEXCOORD3 ) : COLOR
{
float4 Diffuse;
// vLight is the unit vector from the light to this pixel
float3 vLight = normalize( float3( vPos - g_vLightPos ) );
// Compute diffuse from the light
if( dot( vLight, g_vLightDir ) > g_fCosTheta ) // Light must face the pixel (within Theta)
{
// Pixel is in lit area. Find out if it's
// in shadow using 2x2 percentage closest filtering
//transform from RT space to texture space.
float2 ShadowTexC = 0.5 * vPosLight.xy / vPosLight.w + float2( 0.5, 0.5 );
ShadowTexC.y = 1.0f - ShadowTexC.y;
// transform to texel space
float2 texelpos = SMAP_SIZE * ShadowTexC;
// Determine the lerp amounts
float2 lerps = frac( texelpos );
//read in bilerp stamp, doing the shadow checks
float sourcevals[4];
sourcevals[0] = (tex2D( g_samShadow, ShadowTexC ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[1] = (tex2D( g_samShadow, ShadowTexC + float2(1.0/SMAP_SIZE, 0) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[2] = (tex2D( g_samShadow, ShadowTexC + float2(0, 1.0/SMAP_SIZE) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[3] = (tex2D( g_samShadow, ShadowTexC + float2(1.0/SMAP_SIZE, 1.0/SMAP_SIZE) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
// lerp between the shadow values to calculate our light amount
float LightAmount = lerp( lerp( sourcevals[0], sourcevals[1], lerps.x ),
lerp( sourcevals[2], sourcevals[3], lerps.x ),
lerps.y );
// Light it
Diffuse = ( saturate( dot( -vLight, normalize( vNormal ) ) ) * LightAmount * ( 1 - g_vLightAmbient ) + g_vLightAmbient )
* g_vMaterial;
} else
{
Diffuse = g_vLightAmbient * g_vMaterial;
}
return tex2D( g_samScene, Tex ) * Diffuse;
}
//-----------------------------------------------------------------------------
// Vertex Shader: VertLight
// Desc: Process vertex for the light object
//-----------------------------------------------------------------------------
void VertLight( float4 iPos : POSITION,
float3 iNormal : NORMAL,
float2 iTex : TEXCOORD0,
out float4 oPos : POSITION,
out float2 Tex : TEXCOORD0 )
{
//
// Transform position to view space
//
oPos = mul( iPos, g_mWorldView );
//
// Transform to screen coord
//
oPos = mul( oPos, g_mProj );
//
// Propagate texture coord
//
Tex = iTex;
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixLight
// Desc: Process pixel for the light object
//-----------------------------------------------------------------------------
float4 PixLight( float2 Tex : TEXCOORD0,
float4 vPos : TEXCOORD1 ) : COLOR
{
return tex2D( g_samScene, Tex );
}
//-----------------------------------------------------------------------------
// Vertex Shader: VertShadow
// Desc: Process vertex for the shadow map
//-----------------------------------------------------------------------------
void VertShadow( float4 Pos : POSITION,
float3 Normal : NORMAL,
out float4 oPos : POSITION,
out float2 Depth : TEXCOORD0 )
{
//
// Compute the projected coordinates
//
oPos = mul( Pos, g_mWorldView );
oPos = mul( oPos, g_mProj );
//
// Store z and w in our spare texcoord
//
Depth.xy = oPos.zw;
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixShadow
// Desc: Process pixel for the shadow map
//-----------------------------------------------------------------------------
void PixShadow( float2 Depth : TEXCOORD0,
out float4 Color : COLOR )
{
//
// Depth is z / w
//
Color = Depth.x / Depth.y;
}
//-----------------------------------------------------------------------------
// Technique: RenderScene
// Desc: Renders scene objects
//-----------------------------------------------------------------------------
technique RenderScene
{
pass p0
{
VertexShader = compile vs_1_1 VertScene();
PixelShader = compile ps_2_0 PixScene();
}
}
//-----------------------------------------------------------------------------
// Technique: RenderLight
// Desc: Renders the light object
//-----------------------------------------------------------------------------
technique RenderLight
{
pass p0
{
VertexShader = compile vs_1_1 VertLight();
PixelShader = compile ps_1_1 PixLight();
}
}
//-----------------------------------------------------------------------------
// Technique: RenderShadow
// Desc: Renders the shadow map
//-----------------------------------------------------------------------------
technique RenderShadow
{
pass p0
{
VertexShader = compile vs_1_1 VertShadow();
PixelShader = compile ps_2_0 PixShadow();
}
}
+280
View File
@@ -0,0 +1,280 @@
//-----------------------------------------------------------------------------
// File: ShadowMap.fx
//
// Desc: Effect file for high dynamic range cube mapping sample.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#define SMAP_SIZE 512
#define SHADOW_EPSILON 0.00005f
float4x4 g_mWorldView;
float4x4 g_mProj;
float4x4 g_mViewToLightProj; // Transform from view space to light projection space
float4 g_vMaterial;
texture g_txScene;
texture g_txShadow;
float3 g_vLightPos; // Light position in view space
float3 g_vLightDir; // Light direction in view space
float4 g_vLightDiffuse = float4( 1.0f, 1.0f, 1.0f, 1.0f ); // Light diffuse color
float4 g_vLightAmbient = float4( 0.3f, 0.3f, 0.3f, 1.0f ); // Use an ambient light of 0.3
float g_fCosTheta; // Cosine of theta of the spot light
sampler2D g_samScene =
sampler_state
{
Texture = <g_txScene>;
MinFilter = Point;
MagFilter = Linear;
MipFilter = Linear;
};
sampler2D g_samShadow =
sampler_state
{
Texture = <g_txShadow>;
MinFilter = Point;
MagFilter = Point;
MipFilter = Point;
AddressU = Clamp;
AddressV = Clamp;
};
//-----------------------------------------------------------------------------
// Vertex Shader: VertScene
// Desc: Process vertex for scene
//-----------------------------------------------------------------------------
void VertScene( float4 iPos : POSITION,
float3 iNormal : NORMAL,
float2 iTex : TEXCOORD0,
out float4 oPos : POSITION,
out float2 Tex : TEXCOORD0,
out float4 vPos : TEXCOORD1,
out float3 vNormal : TEXCOORD2,
out float4 vPosLight : TEXCOORD3 )
{
//
// Transform position to view space
//
vPos = mul( iPos, g_mWorldView );
//
// Transform to screen coord
//
oPos = mul( vPos, g_mProj );
//
// Compute view space normal
//
vNormal = mul( iNormal, (float3x3)g_mWorldView );
//
// Propagate texture coord
//
Tex = iTex;
//
// Transform the position to light projection space, or the
// projection space as if the camera is looking out from
// the spotlight.
//
vPosLight = mul( vPos, g_mViewToLightProj );
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixScene
// Desc: Process pixel (do per-pixel lighting) for enabled scene
//-----------------------------------------------------------------------------
float4 PixScene( float2 Tex : TEXCOORD0,
float4 vPos : TEXCOORD1,
float3 vNormal : TEXCOORD2,
float4 vPosLight : TEXCOORD3 ) : COLOR
{
float4 Diffuse;
// vLight is the unit vector from the light to this pixel
float3 vLight = normalize( float3( vPos - g_vLightPos ) );
// Compute diffuse from the light
if( dot( vLight, g_vLightDir ) > g_fCosTheta ) // Light must face the pixel (within Theta)
{
// Pixel is in lit area. Find out if it's
// in shadow using 2x2 percentage closest filtering
//transform from RT space to texture space.
float2 ShadowTexC = 0.5 * vPosLight.xy / vPosLight.w + float2( 0.5, 0.5 );
ShadowTexC.y = 1.0f - ShadowTexC.y;
// transform to texel space
float2 texelpos = SMAP_SIZE * ShadowTexC;
// Determine the lerp amounts
float2 lerps = frac( texelpos );
//read in bilerp stamp, doing the shadow checks
float sourcevals[4];
sourcevals[0] = (tex2D( g_samShadow, ShadowTexC ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[1] = (tex2D( g_samShadow, ShadowTexC + float2(1.0/SMAP_SIZE, 0) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[2] = (tex2D( g_samShadow, ShadowTexC + float2(0, 1.0/SMAP_SIZE) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[3] = (tex2D( g_samShadow, ShadowTexC + float2(1.0/SMAP_SIZE, 1.0/SMAP_SIZE) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
// lerp between the shadow values to calculate our light amount
float LightAmount = lerp( lerp( sourcevals[0], sourcevals[1], lerps.x ),
lerp( sourcevals[2], sourcevals[3], lerps.x ),
lerps.y );
// Light it
Diffuse = ( saturate( dot( -vLight, normalize( vNormal ) ) ) * LightAmount * ( 1 - g_vLightAmbient ) + g_vLightAmbient )
* g_vMaterial;
} else
{
Diffuse = g_vLightAmbient * g_vMaterial;
}
return tex2D( g_samScene, Tex ) * Diffuse;
}
//-----------------------------------------------------------------------------
// Vertex Shader: VertLight
// Desc: Process vertex for the light object
//-----------------------------------------------------------------------------
void VertLight( float4 iPos : POSITION,
float3 iNormal : NORMAL,
float2 iTex : TEXCOORD0,
out float4 oPos : POSITION,
out float2 Tex : TEXCOORD0 )
{
//
// Transform position to view space
//
oPos = mul( iPos, g_mWorldView );
//
// Transform to screen coord
//
oPos = mul( oPos, g_mProj );
//
// Propagate texture coord
//
Tex = iTex;
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixLight
// Desc: Process pixel for the light object
//-----------------------------------------------------------------------------
float4 PixLight( float2 Tex : TEXCOORD0,
float4 vPos : TEXCOORD1 ) : COLOR
{
return tex2D( g_samScene, Tex );
}
//-----------------------------------------------------------------------------
// Vertex Shader: VertShadow
// Desc: Process vertex for the shadow map
//-----------------------------------------------------------------------------
void VertShadow( float4 Pos : POSITION,
float3 Normal : NORMAL,
out float4 oPos : POSITION,
out float2 Depth : TEXCOORD0 )
{
//
// Compute the projected coordinates
//
oPos = mul( Pos, g_mWorldView );
oPos = mul( oPos, g_mProj );
//
// Store z and w in our spare texcoord
//
Depth.xy = oPos.zw;
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixShadow
// Desc: Process pixel for the shadow map
//-----------------------------------------------------------------------------
void PixShadow( float2 Depth : TEXCOORD0,
out float4 Color : COLOR )
{
//
// Depth is z / w
//
Color = Depth.x / Depth.y;
}
//-----------------------------------------------------------------------------
// Technique: RenderScene
// Desc: Renders scene objects
//-----------------------------------------------------------------------------
technique RenderScene
{
pass p0
{
VertexShader = compile vs_2_0 VertScene();
PixelShader = compile ps_2_0 PixScene();
}
}
//-----------------------------------------------------------------------------
// Technique: RenderLight
// Desc: Renders the light object
//-----------------------------------------------------------------------------
technique RenderLight
{
pass p0
{
VertexShader = compile vs_2_0 VertLight();
PixelShader = compile ps_2_0 PixLight();
}
}
//-----------------------------------------------------------------------------
// Technique: RenderShadow
// Desc: Renders the shadow map
//-----------------------------------------------------------------------------
technique RenderShadow
{
pass p0
{
VertexShader = compile vs_2_0 VertShadow();
PixelShader = compile ps_2_0 PixShadow();
}
}
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

+437
View File
@@ -0,0 +1,437 @@
xof 0303txt 0032
template VertexDuplicationIndices {
<b8d65549-d7c9-4995-89cf-53a9a8b031e3>
DWORD nIndices;
DWORD nOriginalVertices;
array DWORD indices[nIndices];
}
template FVFData {
<b6e70a0e-8ef9-4e83-94ad-ecc8b0c04897>
DWORD dwFVF;
DWORD nDWords;
array DWORD data[nDWords];
}
template VertexElement {
<f752461c-1e23-48f6-b9f8-8350850f336f>
DWORD Type;
DWORD Method;
DWORD Usage;
DWORD UsageIndex;
}
template DeclData {
<bf22e553-292c-4781-9fea-62bd554bdd93>
DWORD nElements;
array VertexElement Elements[nElements];
DWORD nDWords;
array DWORD data[nDWords];
}
template EffectParamFloats {
<3014b9a0-62f5-478c-9b86-e4ac9f4e418b>
STRING ParamName;
DWORD nFloats;
array FLOAT Floats[nFloats];
}
template EffectParamString {
<1dbc4c88-94c1-46ee-9076-2c28818c9481>
STRING ParamName;
STRING Value;
}
template EffectParamDWord {
<e13963bc-ae51-4c5d-b00f-cfa3a9d97ce5>
STRING ParamName;
DWORD Value;
}
template EffectInstance {
<e331f7e4-0559-4cc2-8e99-1cec1657928f>
STRING EffectFilename;
[...]
}
Mesh {
53;
0.000000;0.000000;-0.500000;,
0.000000;0.200000;-0.500000;,
0.076537;0.184776;-0.500000;,
0.141421;0.141421;-0.500000;,
0.184776;0.076537;-0.500000;,
0.200000;-0.000000;-0.500000;,
0.184776;-0.076537;-0.500000;,
0.141421;-0.141421;-0.500000;,
0.076537;-0.184776;-0.500000;,
-0.000000;-0.200000;-0.500000;,
-0.076537;-0.184776;-0.500000;,
-0.141421;-0.141421;-0.500000;,
-0.184776;-0.076537;-0.500000;,
-0.200000;0.000000;-0.500000;,
-0.184776;0.076537;-0.500000;,
-0.141421;0.141421;-0.500000;,
-0.076537;0.184776;-0.500000;,
0.000000;0.200000;-0.500000;,
0.097545;0.490393;0.500000;,
0.277785;0.415735;0.500000;,
0.415735;0.277785;0.500000;,
0.490393;0.097545;0.500000;,
0.490393;-0.097545;0.500000;,
0.415735;-0.277785;0.500000;,
0.277785;-0.415735;0.500000;,
0.097545;-0.490393;0.500000;,
-0.097545;-0.490393;0.500000;,
-0.277785;-0.415735;0.500000;,
-0.415735;-0.277785;0.500000;,
-0.490393;-0.097545;0.500000;,
-0.490393;0.097545;0.500000;,
-0.415735;0.277785;0.500000;,
-0.277785;0.415735;0.500000;,
-0.097545;0.490393;0.500000;,
0.097545;0.490393;0.500000;,
0.097545;0.490393;0.500000;,
0.277785;0.415735;0.500000;,
0.415735;0.277785;0.500000;,
0.490393;0.097545;0.500000;,
0.490393;-0.097545;0.500000;,
0.415735;-0.277785;0.500000;,
0.277785;-0.415735;0.500000;,
0.097545;-0.490393;0.500000;,
-0.097545;-0.490393;0.500000;,
-0.277785;-0.415735;0.500000;,
-0.415735;-0.277785;0.500000;,
-0.490393;-0.097545;0.500000;,
-0.490393;0.097545;0.500000;,
-0.415735;0.277785;0.500000;,
-0.277785;0.415735;0.500000;,
-0.097545;0.490393;0.500000;,
0.097545;0.490393;0.500000;,
0.000000;0.000000;0.500000;;
64;
3;0,1,2;,
3;0,2,3;,
3;0,3,4;,
3;0,4,5;,
3;0,5,6;,
3;0,6,7;,
3;0,7,8;,
3;0,8,9;,
3;0,9,10;,
3;0,10,11;,
3;0,11,12;,
3;0,12,13;,
3;0,13,14;,
3;0,14,15;,
3;0,15,16;,
3;0,16,17;,
3;1,18,2;,
3;2,18,19;,
3;2,19,3;,
3;3,19,20;,
3;3,20,4;,
3;4,20,21;,
3;4,21,5;,
3;5,21,22;,
3;5,22,6;,
3;6,22,23;,
3;6,23,7;,
3;7,23,24;,
3;7,24,8;,
3;8,24,25;,
3;8,25,9;,
3;9,25,26;,
3;9,26,10;,
3;10,26,27;,
3;10,27,11;,
3;11,27,28;,
3;11,28,12;,
3;12,28,29;,
3;12,29,13;,
3;13,29,30;,
3;13,30,14;,
3;14,30,31;,
3;14,31,15;,
3;15,31,32;,
3;15,32,16;,
3;16,32,33;,
3;16,33,17;,
3;17,33,34;,
3;52,36,35;,
3;52,37,36;,
3;52,38,37;,
3;52,39,38;,
3;52,40,39;,
3;52,41,40;,
3;52,42,41;,
3;52,43,42;,
3;52,44,43;,
3;52,45,44;,
3;52,46,45;,
3;52,47,46;,
3;52,48,47;,
3;52,49,48;,
3;52,50,49;,
3;52,51,50;;
MeshNormals {
53;
0.000000;0.000000;-1.000000;,
0.174494;0.877241;-0.447214;,
0.356907;0.861651;-0.360798;,
0.659479;0.659479;-0.360798;,
0.861651;0.356907;-0.360798;,
0.932644;0.000000;-0.360798;,
0.861651;-0.356907;-0.360798;,
0.659479;-0.659479;-0.360798;,
0.356907;-0.861651;-0.360798;,
-0.000000;-0.932644;-0.360798;,
-0.356908;-0.861651;-0.360798;,
-0.659479;-0.659479;-0.360798;,
-0.861651;-0.356907;-0.360798;,
-0.932644;0.000000;-0.360798;,
-0.861651;0.356908;-0.360798;,
-0.659479;0.659479;-0.360798;,
-0.356907;0.861651;-0.360798;,
-0.052791;0.941890;-0.331747;,
0.316849;0.905180;-0.283295;,
0.532520;0.796972;-0.285057;,
0.796972;0.532520;-0.285057;,
0.940093;0.186996;-0.285058;,
0.940093;-0.186996;-0.285057;,
0.796972;-0.532520;-0.285058;,
0.532520;-0.796972;-0.285057;,
0.186996;-0.940093;-0.285057;,
-0.186996;-0.940093;-0.285057;,
-0.532520;-0.796972;-0.285057;,
-0.796972;-0.532520;-0.285057;,
-0.940093;-0.186996;-0.285057;,
-0.940093;0.186996;-0.285058;,
-0.796972;0.532520;-0.285057;,
-0.532520;0.796972;-0.285057;,
-0.186996;0.940093;-0.285057;,
0.000000;0.960328;-0.278872;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;;
64;
3;0,1,2;,
3;0,2,3;,
3;0,3,4;,
3;0,4,5;,
3;0,5,6;,
3;0,6,7;,
3;0,7,8;,
3;0,8,9;,
3;0,9,10;,
3;0,10,11;,
3;0,11,12;,
3;0,12,13;,
3;0,13,14;,
3;0,14,15;,
3;0,15,16;,
3;0,16,17;,
3;1,18,2;,
3;2,18,19;,
3;2,19,3;,
3;3,19,20;,
3;3,20,4;,
3;4,20,21;,
3;4,21,5;,
3;5,21,22;,
3;5,22,6;,
3;6,22,23;,
3;6,23,7;,
3;7,23,24;,
3;7,24,8;,
3;8,24,25;,
3;8,25,9;,
3;9,25,26;,
3;9,26,10;,
3;10,26,27;,
3;10,27,11;,
3;11,27,28;,
3;11,28,12;,
3;12,28,29;,
3;12,29,13;,
3;13,29,30;,
3;13,30,14;,
3;14,30,31;,
3;14,31,15;,
3;15,31,32;,
3;15,32,16;,
3;16,32,33;,
3;16,33,17;,
3;17,33,34;,
3;52,36,35;,
3;52,37,36;,
3;52,38,37;,
3;52,39,38;,
3;52,40,39;,
3;52,41,40;,
3;52,42,41;,
3;52,43,42;,
3;52,44,43;,
3;52,45,44;,
3;52,46,45;,
3;52,47,46;,
3;52,48,47;,
3;52,49,48;,
3;52,50,49;,
3;52,51,50;;
}
MeshTextureCoords {
53;
0.500000;0.000000;,
0.000000;0.300000;,
0.062500;0.300000;,
0.125000;0.300000;,
0.187500;0.300000;,
0.250000;0.300000;,
0.312500;0.300000;,
0.375000;0.300000;,
0.437500;0.300000;,
0.500000;0.300000;,
0.562500;0.300000;,
0.625000;0.300000;,
0.687500;0.300000;,
0.750000;0.300000;,
0.812500;0.300000;,
0.875000;0.300000;,
0.937500;0.300000;,
1.000000;0.300000;,
0.000000;0.992990;,
0.062500;0.992990;,
0.125000;0.992990;,
0.187500;0.992990;,
0.250000;0.992990;,
0.312500;0.992990;,
0.375000;0.992990;,
0.437500;0.992990;,
0.500000;0.992990;,
0.562500;0.992990;,
0.625000;0.992990;,
0.687500;0.992990;,
0.750000;0.992990;,
0.812500;0.992990;,
0.875000;0.992990;,
0.937500;0.992990;,
1.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;;
}
MeshMaterialList {
1;
64;
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0;
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
1.000000;1.000000;1.000000;;
TextureFilename {
"spotlight.bmp";
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB