mirror of
https://github.com/ncblakely/GiantsTools
synced 2024-11-24 15:15:37 +01:00
Syncing with game code changes. Support CPV objects in object shader.
This commit is contained in:
parent
3685055df2
commit
b6adcfc8b1
@ -97,29 +97,25 @@
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="fx\Object.fx">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /O1 /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /O1 /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="fx\FixedFuncEMU.fx">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
<None Include="FFP_orig.fx" />
|
||||
<None Include="fxh\Constants.fxh" />
|
||||
<None Include="fxh\Lighting.fxh" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="reference\FixedFuncEMU.fx">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="FFP_orig.fx" />
|
||||
<None Include="fx\Lighting.fxh" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="fx\Constants.fxh" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@ -11,15 +11,21 @@
|
||||
<Filter Include="Include">
|
||||
<UniqueIdentifier>{026956f1-0f27-4b3d-80ab-f81eafce58f5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Pixel">
|
||||
<UniqueIdentifier>{0ead58ec-1210-4df1-88c8-dfd73f6fb054}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="fx\Constants.fxh">
|
||||
<Filter>Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="fx\Lighting.fxh">
|
||||
<None Include="FFP_orig.fx" />
|
||||
<None Include="fxh\Constants.fxh">
|
||||
<Filter>Include</Filter>
|
||||
</None>
|
||||
<None Include="fxh\Lighting.fxh">
|
||||
<Filter>Include</Filter>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="reference\FixedFuncEMU.fx" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -4,7 +4,7 @@
|
||||
// Land bumpmapping and lighting shader.
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#include "Constants.fxh"
|
||||
#include "../fxh/Constants.fxh"
|
||||
|
||||
float4x4 g_mWorldViewProjection : WorldViewProjection;
|
||||
float4x4 g_World : World;
|
||||
@ -22,10 +22,10 @@ float4 g_TextureFactor : TextureFactor;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
texture g_LandTexture;
|
||||
texture g_LandBumpTexture;
|
||||
texture g_ShoreTexture;
|
||||
texture g_LandDetailTexture;
|
||||
texture g_LandTexture : Texture0;
|
||||
texture g_LandBumpTexture : Texture1;
|
||||
//texture g_LandDetailTexture : Texture2;
|
||||
//texture g_ShoreTexture : Texture3;
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Texture samplers
|
||||
@ -48,23 +48,23 @@ sampler_state
|
||||
MagFilter = LINEAR;
|
||||
};
|
||||
|
||||
sampler g_LandDetailTextureSampler =
|
||||
sampler_state
|
||||
{
|
||||
Texture = <g_LandDetailTexture>;
|
||||
MipFilter = LINEAR;
|
||||
MinFilter = LINEAR;
|
||||
MagFilter = LINEAR;
|
||||
};
|
||||
|
||||
sampler g_ShoreTextureSampler =
|
||||
sampler_state
|
||||
{
|
||||
Texture = <g_LandBumpTexture>;
|
||||
MipFilter = LINEAR;
|
||||
MinFilter = LINEAR;
|
||||
MagFilter = LINEAR;
|
||||
};
|
||||
//sampler g_LandDetailTextureSampler =
|
||||
//sampler_state
|
||||
//{
|
||||
// Texture = <g_LandDetailTexture>;
|
||||
// MipFilter = LINEAR;
|
||||
// MinFilter = LINEAR;
|
||||
// MagFilter = LINEAR;
|
||||
//};
|
||||
//
|
||||
//sampler g_ShoreTextureSampler =
|
||||
//sampler_state
|
||||
//{
|
||||
// Texture = <g_LandBumpTexture>;
|
||||
// MipFilter = LINEAR;
|
||||
// MinFilter = LINEAR;
|
||||
// MagFilter = LINEAR;
|
||||
//};
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Vertex shader output structure
|
||||
|
@ -2,11 +2,27 @@
|
||||
#include "../fxh/Lighting.fxh"
|
||||
|
||||
// Lighting state
|
||||
float4 g_DirectionalLightAmbient[MAX_DIRECTIONAL_LIGHTS] : DirectionalLightAmbient;
|
||||
float4 g_DirectionalAmbientLightSum : DirectionalLightAmbientSum;
|
||||
float4 g_DirectionalLightDiffuse[MAX_DIRECTIONAL_LIGHTS] : DirectionalLightDiffuse;
|
||||
float3 g_DirectionalLightDirection[MAX_DIRECTIONAL_LIGHTS] : DirectionalLightDirection;
|
||||
bool g_DirectionalLightEnabled[MAX_DIRECTIONAL_LIGHTS] : DirectionalLightEnabled;
|
||||
float4 g_DirectionalLightSpecular[MAX_DIRECTIONAL_LIGHTS] : DirectionalLightSpecular;
|
||||
int g_numDirectionalLights : DirectionalLightCount;
|
||||
|
||||
// Texturing and blending
|
||||
TextureBlendStage g_blendStages[MAX_BLEND_STAGES] : BlendStages;
|
||||
int g_numBlendStages : BlendStageCount;
|
||||
float4 g_textureFactor : TextureFactor;
|
||||
|
||||
texture g_ObjTexture : Texture0;
|
||||
|
||||
sampler g_ObjTextureSampler =
|
||||
sampler_state
|
||||
{
|
||||
Texture = <g_ObjTexture>;
|
||||
MipFilter = LINEAR;
|
||||
MinFilter = LINEAR;
|
||||
MagFilter = LINEAR;
|
||||
};
|
||||
|
||||
// Camera
|
||||
float3 g_CameraPosition : CameraPosition;
|
||||
@ -18,27 +34,9 @@ Material g_Material : Material;
|
||||
float4x4 g_WorldViewProjection : WorldViewProjection;
|
||||
float4x4 g_World : World;
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Pos : POSITION;
|
||||
float4 Diffuse : COLOR0;
|
||||
float4 Specular : COLOR1;
|
||||
float4 Tex0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 CalculateAmbientLight()
|
||||
{
|
||||
float4 ambient = 0;
|
||||
for (int i = 0; i < MAX_DIRECTIONAL_LIGHTS; i++)
|
||||
{
|
||||
if (g_DirectionalLightEnabled[i])
|
||||
{
|
||||
ambient += g_DirectionalLightAmbient[i];
|
||||
}
|
||||
}
|
||||
|
||||
return ambient;
|
||||
}
|
||||
// =======================================================
|
||||
// Textured per pixel lighting
|
||||
//
|
||||
|
||||
float4 CalculateDiffuse(float3 N, float3 L, float4 diffuseColor)
|
||||
{
|
||||
@ -86,17 +84,14 @@ Lighting ComputeLighting(float3 worldPos, float3 N)
|
||||
{
|
||||
Lighting finalLighting = (Lighting)0;
|
||||
|
||||
for (int i = 0; i < MAX_DIRECTIONAL_LIGHTS; i++)
|
||||
{
|
||||
if (g_DirectionalLightEnabled[i])
|
||||
for (int i = 0; i < g_numDirectionalLights; i++)
|
||||
{
|
||||
Lighting lighting = DoDirectionalLight(worldPos, N, i);
|
||||
finalLighting.Diffuse += lighting.Diffuse;
|
||||
finalLighting.Specular += lighting.Specular;
|
||||
}
|
||||
}
|
||||
|
||||
float4 ambient = g_Material.Ambient * CalculateAmbientLight();
|
||||
float4 ambient = g_Material.Ambient * g_DirectionalAmbientLightSum;
|
||||
float4 diffuse = g_Material.Diffuse * finalLighting.Diffuse;
|
||||
float4 specular = g_Material.Specular * finalLighting.Specular;
|
||||
|
||||
@ -106,87 +101,129 @@ Lighting ComputeLighting(float3 worldPos, float3 N)
|
||||
return finalLighting;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: DoPointLight()
|
||||
// Desc: Point light computation
|
||||
//-----------------------------------------------------------------------------
|
||||
//COLOR_PAIR DoPointLight(float4 vPosition, float3 N, float3 V, int i)
|
||||
//{
|
||||
// float3 L = mul((float3x3)matViewIT, normalize((lights[i].vPos-(float3)mul(matWorld,vPosition))));
|
||||
// COLOR_PAIR Out;
|
||||
// float NdotL = dot(N, L);
|
||||
// Out.Color = lights[i].vAmbient;
|
||||
// Out.Specular = 0;
|
||||
// float fAtten = 1.f;
|
||||
// if(NdotL >= 0.f)
|
||||
// {
|
||||
// //compute diffuse color
|
||||
// Out.Color += NdotL * lights[i].vDiffuse;
|
||||
//
|
||||
// //add specular component
|
||||
// if(bSpecular)
|
||||
// {
|
||||
// float3 H = normalize(L + V); //half vector
|
||||
// Out.Specular = pow(max(0, dot(H, N)), fMaterialPower) * lights[i].vSpecular;
|
||||
// }
|
||||
//
|
||||
// float LD = length(lights[i].vPos-(float3)mul(matWorld,vPosition));
|
||||
// if(LD > lights[i].fRange)
|
||||
// {
|
||||
// fAtten = 0.f;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// fAtten *= 1.f/(lights[i].vAttenuation.x + lights[i].vAttenuation.y*LD + lights[i].vAttenuation.z*LD*LD);
|
||||
// }
|
||||
// Out.Color *= fAtten;
|
||||
// Out.Specular *= fAtten;
|
||||
// }
|
||||
// return Out;
|
||||
//}
|
||||
struct PixelLightingVSOutput
|
||||
{
|
||||
float4 Pos : POSITION;
|
||||
float2 Tex0 : TEXCOORD0;
|
||||
float3 Normal : TEXCOORD1;
|
||||
float3 WorldPos : TEXCOORD2;
|
||||
};
|
||||
|
||||
VS_OUTPUT VSMain (
|
||||
PixelLightingVSOutput PixelLightingVS(
|
||||
float4 vPosition : POSITION0,
|
||||
float3 vNormal : NORMAL0,
|
||||
float2 tc : TEXCOORD0)
|
||||
{
|
||||
VS_OUTPUT Out = (VS_OUTPUT)0;
|
||||
// Simple transform, pre-compute as much as we can for the pixel shader
|
||||
PixelLightingVSOutput output;
|
||||
|
||||
vNormal = normalize(vNormal);
|
||||
Out.Pos = mul(vPosition, g_WorldViewProjection);
|
||||
|
||||
//automatic texture coordinate generation
|
||||
Out.Tex0.xy = tc;
|
||||
|
||||
//directional lights
|
||||
float4 worldPos = mul(vPosition, g_World); //position in view space
|
||||
float3 normal = mul(vNormal, (float3x3)g_World);
|
||||
Lighting lighting = ComputeLighting(worldPos, normal);
|
||||
|
||||
////point lights
|
||||
//for(int i = 0; i < iLightPointNum; i++)
|
||||
//{
|
||||
// COLOR_PAIR ColOut = DoPointLight(vPosition, N, V, i+iLightPointIni);
|
||||
// Out.Color += ColOut.Color;
|
||||
// Out.Specular += ColOut.Specular;
|
||||
//}
|
||||
|
||||
Out.Diffuse = lighting.Diffuse;
|
||||
Out.Specular = lighting.Specular;
|
||||
|
||||
return Out;
|
||||
output.Pos = mul(vPosition, g_WorldViewProjection);
|
||||
output.Normal = mul(normalize(vNormal), (float3x3)g_World);
|
||||
output.WorldPos = mul(vPosition, g_World);
|
||||
output.Tex0 = tc;
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 ps_main(VS_OUTPUT input) : COLOR0
|
||||
float4 GetColorArg(int colorArg, float4 textureColor, float4 diffuseColor)
|
||||
{
|
||||
return input.Diffuse;
|
||||
float4 result;
|
||||
if (colorArg == D3DTA_TEXTURE) result = textureColor;
|
||||
else if (colorArg == D3DTA_DIFFUSE) result = diffuseColor;
|
||||
else if (colorArg == D3DTA_TFACTOR) result = g_textureFactor;
|
||||
else result = float4(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
technique TexturedVertexLighting
|
||||
float4 Modulate(int stageIndex, float4 textureColor, float4 diffuseColor, float factor)
|
||||
{
|
||||
float4 left = GetColorArg(g_blendStages[stageIndex].colorArg1, textureColor, diffuseColor);
|
||||
float4 right = GetColorArg(g_blendStages[stageIndex].colorArg2, textureColor, diffuseColor);
|
||||
|
||||
return (left * right) * factor;
|
||||
}
|
||||
|
||||
float4 ProcessStages(float4 textureColor, float4 diffuseColor)
|
||||
{
|
||||
float4 output = 0;
|
||||
for (int i = 0; i < g_numBlendStages; i++)
|
||||
{
|
||||
if (g_blendStages[i].colorOp == D3DTOP_MODULATE4X)
|
||||
{
|
||||
output += Modulate(i, textureColor, diffuseColor, 4.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
output += Modulate(i, textureColor, diffuseColor, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
struct PixelLightingPSOutput
|
||||
{
|
||||
float4 Diffuse : COLOR0;
|
||||
float4 Specular : COLOR1;
|
||||
};
|
||||
|
||||
PixelLightingPSOutput PixelLightingPS(PixelLightingVSOutput input)
|
||||
{
|
||||
float4 color = tex2D(g_ObjTextureSampler, input.Tex0);
|
||||
|
||||
Lighting lighting = ComputeLighting(input.WorldPos, input.Normal);
|
||||
|
||||
PixelLightingPSOutput output;
|
||||
output.Diffuse = ProcessStages(color, lighting.Diffuse);
|
||||
output.Specular = color * lighting.Specular;
|
||||
return output;
|
||||
}
|
||||
|
||||
technique PixelLighting
|
||||
{
|
||||
pass P0
|
||||
{
|
||||
//PixelShader = compile ps_2_0 ps_main();
|
||||
VertexShader = compile vs_2_0 VSMain();
|
||||
PixelShader = compile ps_3_0 PixelLightingPS();
|
||||
VertexShader = compile vs_3_0 PixelLightingVS();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================
|
||||
// Color per vertex
|
||||
//
|
||||
|
||||
struct ColorPerVertexVSOutput
|
||||
{
|
||||
float4 Pos : POSITION;
|
||||
float2 Tex0 : TEXCOORD0;
|
||||
float4 Color : COLOR0;
|
||||
};
|
||||
|
||||
float4 ColorPerVertexPS(ColorPerVertexVSOutput input) : COLOR0
|
||||
{
|
||||
float4 color = tex2D(g_ObjTextureSampler, input.Tex0); //* input.Color;
|
||||
return color;
|
||||
}
|
||||
|
||||
ColorPerVertexVSOutput ColorPerVertexVS(
|
||||
float4 vPosition : POSITION0,
|
||||
float2 tc : TEXCOORD0,
|
||||
float4 color : COLOR0)
|
||||
{
|
||||
// Simple transform, pre-compute as much as we can for the pixel shader
|
||||
ColorPerVertexVSOutput output = (ColorPerVertexVSOutput)0;
|
||||
|
||||
output.Pos = mul(vPosition, g_WorldViewProjection);
|
||||
output.Tex0 = tc;
|
||||
output.Color = color;
|
||||
return output;
|
||||
}
|
||||
|
||||
technique ColorPerVertex
|
||||
{
|
||||
pass P0
|
||||
{
|
||||
//PixelShader = compile ps_3_0 ColorPerVertexPS();
|
||||
VertexShader = compile vs_3_0 ColorPerVertexVS();
|
||||
}
|
||||
}
|
@ -34,8 +34,8 @@ float4 MainPS(const PS_INPUT input) : COLOR0
|
||||
float4 const44 : register(c44);
|
||||
matrix<float, 4, 4> matWorld : OceanWorldViewProjection : register(c2);
|
||||
float4 fog : register (c26);
|
||||
texture tex0;
|
||||
texture tex1;
|
||||
texture g_SeabedTexture : Texture0;
|
||||
texture g_EnvironmentTexture : Texture1;
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
@ -87,8 +87,8 @@ technique t0
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
Texture[0] = <tex0>; // Seabed texture
|
||||
Texture[1] = <tex1>; // Environment texture
|
||||
Texture[0] = <g_SeabedTexture>; // Seabed texture
|
||||
Texture[1] = <g_EnvironmentTexture>; // Environment texture
|
||||
|
||||
// All of these constants are set by the game engine before drawing the shader
|
||||
// Each constant register (c# in the asm code) has 4 floating point values
|
||||
|
@ -9,7 +9,7 @@ float4x4 g_WorldViewProjection : WorldViewProjection;
|
||||
float4 g_TextureFactor : TextureFactor;
|
||||
//float4 g_Fog : Fog;
|
||||
|
||||
texture2D g_WaterTexture;
|
||||
texture2D g_WaterTexture : Texture0;
|
||||
sampler2D g_WaterTextureSampler =
|
||||
sampler_state
|
||||
{
|
||||
|
@ -1,4 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#define MAX_DIRECTIONAL_LIGHTS 3
|
||||
#define MAX_LIGHTS 4
|
||||
|
||||
#define MAX_BLEND_STAGES 2 // Giants does not currently use more than 2
|
||||
|
||||
#define D3DTOP_DISABLE 1 // disables stage
|
||||
#define D3DTOP_SELECTARG1 2 // the default
|
||||
#define D3DTOP_SELECTARG2 3
|
||||
#define D3DTOP_MODULATE 4 // multiply args together
|
||||
#define D3DTOP_MODULATE2X 5 // multiply and 1 bit
|
||||
#define D3DTOP_MODULATE4X 6 // multiply and 2 bits
|
||||
// Add
|
||||
#define D3DTOP_ADD 7 // add arguments together
|
||||
#define D3DTOP_ADDSIGNED 8 // add with -0.5 bias
|
||||
#define D3DTOP_ADDSIGNED2X 9 // as above but left 1 bit
|
||||
#define D3DTOP_SUBTRACT 10 // Arg1 - Arg2, with no saturation
|
||||
#define D3DTOP_ADDSMOOTH 11 // add 2 args, subtract product
|
||||
// Arg1 + Arg2 - Arg1*Arg2
|
||||
// Arg1 + (1-Arg1)*Arg2
|
||||
// Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
|
||||
#define D3DTOP_BLENDDIFFUSEALPHA 12 // iterated alpha
|
||||
#define D3DTOP_BLENDTEXTUREALPHA 13 // texture alpha
|
||||
#define D3DTOP_BLENDFACTORALPHA 14 // alpha from D3DRS_TEXTUREFACTOR
|
||||
// Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
|
||||
#define D3DTOP_BLENDTEXTUREALPHAPM 15 // texture alpha
|
||||
#define D3DTOP_BLENDCURRENTALPHA 16 // by alpha of current color
|
||||
// Specular mapping
|
||||
#define D3DTOP_PREMODULATE 17 // modulate with next texture before use
|
||||
#define D3DTOP_MODULATEALPHA_ADDCOLOR 18 // Arg1.RGB + Arg1.A*Arg2.RGB
|
||||
// COLOROP only
|
||||
#define D3DTOP_MODULATECOLOR_ADDALPHA 19 // Arg1.RGB*Arg2.RGB + Arg1.A
|
||||
// COLOROP only
|
||||
#define D3DTOP_MODULATEINVALPHA_ADDCOLOR 20 // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
|
||||
// COLOROP only
|
||||
#define D3DTOP_MODULATEINVCOLOR_ADDALPHA 21 // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
|
||||
// COLOROP only
|
||||
// Bump mapping
|
||||
#define D3DTOP_BUMPENVMAP 22 // per pixel env map perturbation
|
||||
#define D3DTOP_BUMPENVMAPLUMINANCE 23 // with luminance channel
|
||||
// This can do either diffuse or specular bump mapping with correct input.
|
||||
// Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
|
||||
// where each component has been scaled and offset to make it signed.
|
||||
// The result is replicated into all four (including alpha) channels.
|
||||
// This is a valid COLOROP only.
|
||||
#define D3DTOP_DOTPRODUCT3 24,
|
||||
// Triadic ops
|
||||
#define D3DTOP_MULTIPLYADD 25, // Arg0 + Arg1*Arg2
|
||||
#define D3DTOP_LERP 26 // (Arg0)*Arg1 + (1-Arg0)*Arg2
|
||||
|
||||
/*
|
||||
* Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending
|
||||
* operations set in texture processing stage controls in D3DRENDERSTATE.
|
||||
*/
|
||||
#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector
|
||||
#define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only)
|
||||
#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write)
|
||||
#define D3DTA_TEXTURE 0x00000002 // select texture color (read only)
|
||||
#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only)
|
||||
#define D3DTA_SPECULAR 0x00000004 // select specular color (read only)
|
||||
#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write)
|
||||
#define D3DTA_CONSTANT 0x00000006 // select texture stage constant
|
||||
#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier)
|
||||
#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier)
|
@ -1,5 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
struct Material
|
||||
{
|
||||
float4 Diffuse;
|
||||
@ -14,3 +12,13 @@ struct Lighting
|
||||
float4 Diffuse : COLOR0;
|
||||
float4 Specular : COLOR1;
|
||||
};
|
||||
|
||||
struct TextureBlendStage
|
||||
{
|
||||
int colorOp;
|
||||
int colorArg1;
|
||||
int colorArg2;
|
||||
int alphaOp;
|
||||
int alphaArg1;
|
||||
int alphaArg2;
|
||||
};
|
Loading…
Reference in New Issue
Block a user