Initial commit

This commit is contained in:
Brian Harris
2012-11-26 12:58:24 -06:00
parent a5214f79ef
commit 5016f605b8
1115 changed files with 587266 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // Y
uniform sampler2D samp1 : register(s1); // Cr
uniform sampler2D samp2 : register(s2); // Cb
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
const float3 crc = float3( 1.595794678, -0.813476563, 0 );
const float3 crb = float3( 0, -0.391448975, 2.017822266 );
const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );
const float3 YScalar = float3( 1.164123535f, 1.164123535f, 1.164123535f );
float Y = tex2D( samp0, fragment.texcoord0.xy ).x;
float Cr = tex2D( samp1, fragment.texcoord0.xy ).x;
float Cb = tex2D( samp2, fragment.texcoord0.xy ).x;
float3 p = ( YScalar * Y );
p += ( crc * Cr ) + ( crb * Cb ) + adj;
result.color.xyz = p;
result.color.w = 1.0;
result.color *= rpColor;
}

View File

@@ -0,0 +1,51 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,66 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // Y
uniform sampler2D samp1 : register(s1); // Cr
uniform sampler2D samp2 : register(s2); // Cb
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
const float3 crc = float3( 1.595794678, -0.813476563, 0 );
const float3 crb = float3( 0, -0.391448975, 2.017822266 );
const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );
const float3 YScalar = float3( 1.164123535f, 1.164123535f, 1.164123535f );
float Y = tex2D( samp0, fragment.texcoord0.xy ).x;
float Cr = tex2D( samp1, fragment.texcoord0.xy ).x;
float Cb = tex2D( samp2, fragment.texcoord0.xy ).x;
float3 p = ( YScalar * Y );
p += ( crc * Cr ) + ( crb * Cb ) + adj;
float4 binkImage;
binkImage.xyz = p;
binkImage.w = 1.0;
float4 color = ( binkImage * fragment.color ) + fragment.texcoord1;
result.color.xyz = color.xyz * color.w;
result.color.w = color.w;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0.xy = vertex.texcoord.xy;
result.texcoord1 = ( swizzleColor( vertex.color2 ) * 2 ) - 1;
result.color = swizzleColor( vertex.color );
}

View File

@@ -0,0 +1,46 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = idtex2Dproj( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;
}

View File

@@ -0,0 +1,59 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 binormal : BINORMAL;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0.x = dot4( vertex.position, rpTexGen0S );
result.texcoord0.y = dot4( vertex.position, rpTexGen0T );
result.texcoord0.z = 0.0;
result.texcoord0.w = dot4( vertex.position, rpTexGen0Q );
result.texcoord1.x = dot4( vertex.position, rpTexGen1S );
result.texcoord1.y = 0.5;
}

View File

@@ -0,0 +1,52 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); //_accum
uniform sampler2D samp1 : register(s1); //_currentRender
uniform sampler2D samp2 : register(s2); //mask
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 accumSample = tex2D( samp0, fragment.texcoord0 );
float4 maskSample = tex2D( samp2, fragment.texcoord1 );
float4 currentRenderSample = tex2D( samp1, fragment.texcoord1 );
result.color = lerp( accumSample, currentRenderSample, maskSample.a );
}

View File

@@ -0,0 +1,59 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform float4 rpUser0 : register( c128 ); //rpCenterScale
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
//center scale
const float4 centerScale = rpUser0;
result.texcoord0 = CenterScale( vertex.texcoord, centerScale.xy );
// pass through texcoords
result.texcoord1 = vertex.texcoord;
}

View File

@@ -0,0 +1,58 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); //_accum
uniform sampler2D samp1 : register(s1); //_currentRender
uniform sampler2D samp2 : register(s2); //mask
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
float2 texcoord2 : TEXCOORD2_centroid;
//float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 redTint = float4( 1, 0.98, 0.98, 1 );
float4 accumSample = tex2D( samp0, fragment.texcoord0 ) * redTint;
float4 maskSample = tex2D( samp2, fragment.texcoord1 );
float4 tint = float4( 1.0, 0.8, 0.8, 1 );
float4 currentRenderSample = tex2D( samp1, fragment.texcoord2 ) * tint;
result.color = lerp( accumSample, currentRenderSample, maskSample.a );
}

View File

@@ -0,0 +1,69 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex0
uniform float4 rpUser1 : register( c129 ); //rpRotateTex0
uniform float4 rpUser2 : register( c130 ); //rpCenterScaleTex1
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
const float4 centerScaleTex0 = rpUser0;
const float4 rotateTex0 = rpUser1;
const float4 centerScaleTex1 = rpUser2;
//center scale and rotate for _accum
float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex0.xy );
result.texcoord0 = Rotate2D( tc0, rotateTex0.xy );
//center scale for mask
result.texcoord1 = CenterScale( vertex.texcoord, centerScaleTex1.xy );
// pass through for currentrender
result.texcoord2 = vertex.texcoord;
}

View File

@@ -0,0 +1,70 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); //_accum
uniform sampler2D samp1 : register(s1); //_currentRender
uniform sampler2D samp2 : register(s2); //mask
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
float2 texcoord2 : TEXCOORD2_centroid;
float2 texcoord3 : TEXCOORD3_centroid;
float2 texcoord4 : TEXCOORD4;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float colorFactor = fragment.texcoord4.x;
float4 color0 = float4( 1.0f - colorFactor, 1.0f - colorFactor, 1.0f, 1.0f );
float4 color1 = float4( 1.0f, 0.95f - colorFactor, 0.95f, 0.5f );
float4 color2 = float4( 0.015f, 0.015f, 0.015f, 0.01f );
float4 accumSample0 = tex2D( samp0, fragment.texcoord0 ) * color0;
float4 accumSample1 = tex2D( samp0, fragment.texcoord1 ) * color1;
float4 accumSample2 = tex2D( samp0, fragment.texcoord2 ) * color2;
float4 maskSample = tex2D( samp2, fragment.texcoord3 );
float4 tint = float4( 0.8, 0.5, 0.5, 1 );
float4 currentRenderSample = tex2D( samp1, fragment.texcoord3 ) * tint;
// blend of the first 2 accumulation samples
float4 accumColor = lerp( accumSample0, accumSample1, 0.5f );
// add thrid sample
accumColor += accumSample2;
accumColor = lerp( accumColor, currentRenderSample, maskSample.a );
result.color = accumColor;
}

View File

@@ -0,0 +1,76 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex
uniform float4 rpUser1 : register( c129 ); //rpRotateTex
uniform float4 rpUser2 : register( c130 ); //rpColorFactor
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
float2 texcoord3 : TEXCOORD3;
float2 texcoord4 : TEXCOORD4;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
//_accum 1
const float4 centerScaleTex = rpUser0;
const float4 rotateTex = rpUser1;
float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex.xy );
result.texcoord0 = Rotate2D( tc0, rotateTex.xy );
// accum 2
result.texcoord1 = Rotate2D( tc0, float2( rotateTex.z, -rotateTex.w ) );
// accum 3
result.texcoord2 = Rotate2D( tc0, rotateTex.zw );
// pass through for currentrender
result.texcoord3 = vertex.texcoord;
// pass through the color fator
const float4 colorFactor = rpUser2;
result.texcoord4 = colorFactor.xx;
}

View File

@@ -0,0 +1,51 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); //_accum
uniform sampler2D samp1 : register(s1); //_currentRender
uniform sampler2D samp2 : register(s2); //mask
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 accumSample = tex2D( samp0, fragment.texcoord0 );
float4 currentRenderSample = tex2D( samp1, fragment.texcoord0 );
float4 maskSample = tex2D( samp2, fragment.texcoord0 );
result.color = lerp( accumSample, currentRenderSample, maskSample.a );
}

View File

@@ -0,0 +1,52 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
// pass through texcoords
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,67 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
uniform sampler2D samp1 : register(s1); // normal map
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float3 texcoord1 : TEXCOORD1_centroid;
float3 texcoord2 : TEXCOORD2_centroid;
float3 texcoord3 : TEXCOORD3_centroid;
float3 texcoord4 : TEXCOORD4_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
float3 localNormal = float3( bump.wy, 0.0f );
localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );
float3 globalNormal;
globalNormal.x = dot3( localNormal, fragment.texcoord2 );
globalNormal.y = dot3( localNormal, fragment.texcoord3 );
globalNormal.z = dot3( localNormal, fragment.texcoord4 );
float3 globalEye = normalize( fragment.texcoord1 );
float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );
reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
float4 envMap = texCUBE( samp0, reflectionVector );
result.color = float4( envMap.xyz, 1.0f ) * fragment.color;
}

View File

@@ -0,0 +1,80 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1;
float3 texcoord2 : TEXCOORD2;
float3 texcoord3 : TEXCOORD3;
float3 texcoord4 : TEXCOORD4;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 normal = vertex.normal * 2.0 - 1.0;
float4 tangent = vertex.tangent * 2.0 - 1.0;
float3 binormal = cross( normal.xyz, tangent.xyz ) * tangent.w;
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord.xy;
float4 toEye = rpLocalViewOrigin - vertex.position;
result.texcoord1.x = dot3( toEye, rpModelMatrixX );
result.texcoord1.y = dot3( toEye, rpModelMatrixY );
result.texcoord1.z = dot3( toEye, rpModelMatrixZ );
result.texcoord2.x = dot3( tangent, rpModelMatrixX );
result.texcoord3.x = dot3( tangent, rpModelMatrixY );
result.texcoord4.x = dot3( tangent, rpModelMatrixZ );
result.texcoord2.y = dot3( binormal, rpModelMatrixX );
result.texcoord3.y = dot3( binormal, rpModelMatrixY );
result.texcoord4.y = dot3( binormal, rpModelMatrixZ );
result.texcoord2.z = dot3( normal, rpModelMatrixX );
result.texcoord3.z = dot3( normal, rpModelMatrixY );
result.texcoord4.z = dot3( normal, rpModelMatrixZ );
result.color = rpColor;
}

View File

@@ -0,0 +1,67 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
uniform sampler2D samp1 : register(s1); // normal map
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float3 texcoord1 : TEXCOORD1_centroid;
float3 texcoord2 : TEXCOORD2_centroid;
float3 texcoord3 : TEXCOORD3_centroid;
float3 texcoord4 : TEXCOORD4_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
float3 localNormal = float3( bump.wy, 0.0f );
localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );
float3 globalNormal;
globalNormal.x = dot3( localNormal, fragment.texcoord2 );
globalNormal.y = dot3( localNormal, fragment.texcoord3 );
globalNormal.z = dot3( localNormal, fragment.texcoord4 );
float3 globalEye = normalize( fragment.texcoord1 );
float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );
reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
float4 envMap = texCUBE( samp0, reflectionVector );
result.color = float4( envMap.xyz, 1.0f ) * fragment.color;
}

View File

@@ -0,0 +1,137 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1;
float3 texcoord2 : TEXCOORD2;
float3 texcoord3 : TEXCOORD3;
float3 texcoord4 : TEXCOORD4;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
float4 vTangent = vertex.tangent * 2.0 - 1.0;
float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float3 normal;
normal.x = dot3( matX, vNormal );
normal.y = dot3( matY, vNormal );
normal.z = dot3( matZ, vNormal );
normal = normalize( normal );
float3 tangent;
tangent.x = dot3( matX, vTangent );
tangent.y = dot3( matY, vTangent );
tangent.z = dot3( matZ, vTangent );
tangent = normalize( tangent );
float3 binormal;
binormal.x = dot3( matX, vBinormal );
binormal.y = dot3( matY, vBinormal );
binormal.z = dot3( matZ, vBinormal );
binormal = normalize( binormal );
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord.xy;
float4 toEye = rpLocalViewOrigin - modelPosition;
result.texcoord1.x = dot3( toEye, rpModelMatrixX );
result.texcoord1.y = dot3( toEye, rpModelMatrixY );
result.texcoord1.z = dot3( toEye, rpModelMatrixZ );
result.texcoord2.x = dot3( tangent, rpModelMatrixX );
result.texcoord3.x = dot3( tangent, rpModelMatrixY );
result.texcoord4.x = dot3( tangent, rpModelMatrixZ );
result.texcoord2.y = dot3( binormal, rpModelMatrixX );
result.texcoord3.y = dot3( binormal, rpModelMatrixY );
result.texcoord4.y = dot3( binormal, rpModelMatrixZ );
result.texcoord2.z = dot3( normal, rpModelMatrixX );
result.texcoord3.z = dot3( normal, rpModelMatrixY );
result.texcoord4.z = dot3( normal, rpModelMatrixZ );
result.color = rpColor;
}

View File

@@ -0,0 +1,39 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,48 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float4 color : COLOR;
float3 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 src = tex2D( samp0, fragment.texcoord0.xy );
float4 target = fragment.color * dot3( float3( 0.333, 0.333, 0.333 ), src );
result.color = lerp( src, target, fragment.texcoord0.z );
}

View File

@@ -0,0 +1,61 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform float4 rpUser0 : register(c128); //rpFraction
uniform float4 rpUser1 : register(c129); //rpTargetHue
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 color : COLOR0;
float3 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.color = rpUser1; // targetHue
result.texcoord0.x = vertex.texcoord.x;
result.texcoord0.y = 1.0f - vertex.texcoord.y;
result.texcoord0.z = rpUser0.x; // fraction
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = float4( 0.0, 0.0, 0.0, 1.0 );
}

View File

@@ -0,0 +1,44 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = float4( 0.0, 0.0, 0.0, 1.0 );
}

View File

@@ -0,0 +1,85 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
}

View File

@@ -0,0 +1,57 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
struct PS_IN {
float4 position : VPOS;
float2 texcoord : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float2 screenTexCoord = fragment.texcoord;
// compute warp factor
float4 warpFactor = 1.0 - ( tex2D( samp1, screenTexCoord.xy ) * fragment.color );
screenTexCoord -= float2( 0.5, 0.5 );
screenTexCoord *= warpFactor.xy;
screenTexCoord += float2( 0.5, 0.5 );
// load the screen render
result.color = tex2D( samp0, screenTexCoord );
}

View File

@@ -0,0 +1,62 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
// User Renderparms start at 128 as per renderprogs.h
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord = vertex.texcoord.xy;
const float4 deformMagnitude = rpUser1;
result.color = deformMagnitude;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
struct PS_IN {
float4 position : VPOS;
float3 texcoord0 : TEXCOORD0_centroid;
float3 texcoord1 : TEXCOORD1_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float3 globalNormal = normalize( fragment.texcoord1 );
float3 globalEye = normalize( fragment.texcoord0 );
float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );
reflectionVector *= globalNormal;
reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
float4 envMap = texCUBE( samp0, reflectionVector );
result.color = float4( envMap.xyz, 1.0f ) * fragment.color;
}

View File

@@ -0,0 +1,59 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float4 normal : NORMAL;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float3 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float4 toEye = rpLocalViewOrigin - vertex.position;
result.texcoord0 = toEye.xyz;
result.texcoord1 = vNormal.xyz;
result.color = rpColor;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
struct PS_IN {
float4 position : VPOS;
float3 texcoord0 : TEXCOORD0_centroid;
float3 texcoord1 : TEXCOORD1_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float3 globalNormal = normalize( fragment.texcoord1 );
float3 globalEye = normalize( fragment.texcoord0 );
float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );
reflectionVector *= globalNormal;
reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
float4 envMap = texCUBE( samp0, reflectionVector );
result.color = float4( envMap.xyz, 1.0f ) * fragment.color;
}

View File

@@ -0,0 +1,105 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float3 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float3 vNormalSkinned;
vNormalSkinned.x = dot3( matX, vNormal );
vNormalSkinned.y = dot3( matY, vNormal );
vNormalSkinned.z = dot3( matZ, vNormal );
vNormalSkinned = normalize( vNormalSkinned );
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
float4 toEye = rpLocalViewOrigin - modelPosition;
result.texcoord0 = toEye.xyz;
result.texcoord1 = vNormalSkinned.xyz;
result.color = rpColor;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0.x = dot4( vertex.position, rpTexGen0S );
result.texcoord0.y = dot4( vertex.position, rpTexGen0T );
result.texcoord1.x = dot4( vertex.position, rpTexGen1S );
result.texcoord1.y = dot4( vertex.position, rpTexGen1T );
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;
}

View File

@@ -0,0 +1,96 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
// end of skinning
// start of fog portion
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
result.texcoord0.x = dot4( modelPosition, rpTexGen0S );
result.texcoord0.y = dot4( modelPosition, rpTexGen0T );
result.texcoord1.x = dot4( modelPosition, rpTexGen1S );
result.texcoord1.y = dot4( modelPosition, rpTexGen1T );
}

110
base/renderprogs/fxaa.pixel Normal file
View File

@@ -0,0 +1,110 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
#define FXAA_GREEN_AS_LUMA 1
#define FXAA_EARLY_EXIT 0
#include "Fxaa3_11.h"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1); // exponent bias -1
uniform sampler2D samp2 : register(s2); // exponent bias -2
uniform float4 rpUser0 : register( c128 );
uniform float4 rpUser1 : register( c129 );
uniform float4 rpUser2 : register( c130 );
uniform float4 rpUser3 : register( c131 );
uniform float4 rpUser4 : register( c132 );
uniform float4 rpUser5 : register( c133 );
uniform float4 rpUser6 : register( c134 );
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
const float4 FXAAQualityRCPFrame = rpUser0;
const float4 FXAAConsoleRcpFrameOpt = rpUser1;
const float4 FXAAConsoleRcpFrameOpt2 = rpUser2;
const float4 FXAAConsole360RcpFrameOpt2 = rpUser3;
const float4 FXAAQualityParms = rpUser4;
const float4 FXAAConsoleEdgeParms = rpUser5;
const float4 FXAAConsole360ConstDir = rpUser6;
// Inputs - see more info in fxaa3_11.hfile
FxaaFloat2 fxaaPos = fragment.texcoord0;
FxaaFloat4 fxaaConsolePos;
float2 halfPixelOffset = float2( 0.5, 0.5 ) * FXAAQualityRCPFrame.xy;
fxaaConsolePos.xy = fxaaPos.xy - ( halfPixelOffset );
fxaaConsolePos.zw = fxaaPos.xy + ( halfPixelOffset );
FxaaFloat2 fxaaQualityRcpFrame = FXAAQualityRCPFrame.xy;
FxaaFloat4 fxaaConsoleRcpFrameOpt = FXAAConsoleRcpFrameOpt;
FxaaFloat4 fxaaConsoleRcpFrameOpt2 = FXAAConsoleRcpFrameOpt2;
FxaaFloat4 fxaaConsole360RcpFrameOpt2 = FXAAConsole360RcpFrameOpt2;
// Quality parms
FxaaFloat fxaaQualitySubpix = FXAAQualityParms.x;
FxaaFloat fxaaQualityEdgeThreshold = FXAAQualityParms.y;
FxaaFloat fxaaQualityEdgeThresholdMin = FXAAQualityParms.z;
// Console specific Parms
FxaaFloat fxaaConsoleEdgeSharpness = FXAAConsoleEdgeParms.x;
FxaaFloat fxaaConsoleEdgeThreshold = FXAAConsoleEdgeParms.y;
FxaaFloat fxaaConsoleEdgeThresholdMin = FXAAConsoleEdgeParms.z;
// 360 specific parms these have to come from a constant register so that the compiler
// does not unoptimize the shader
FxaaFloat4 fxaaConsole360ConstDir = FXAAConsole360ConstDir;
float4 colorSample = FxaaPixelShader( fxaaPos,
fxaaConsolePos,
samp0,
samp1,
samp2,
fxaaQualityRcpFrame,
fxaaConsoleRcpFrameOpt,
fxaaConsoleRcpFrameOpt2,
fxaaConsole360RcpFrameOpt2,
fxaaQualitySubpix,
fxaaQualityEdgeThreshold,
fxaaQualityEdgeThresholdMin,
fxaaConsoleEdgeSharpness,
fxaaConsoleEdgeThreshold,
fxaaConsoleEdgeThresholdMin,
fxaaConsole360ConstDir );
result.color = colorSample;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position = vertex.position;
result.texcoord0 = vertex.texcoord;
}

176
base/renderprogs/global.inc Normal file
View File

@@ -0,0 +1,176 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
uniform float4 rpScreenCorrectionFactor : register(c0);
uniform float4 rpWindowCoord : register(c1);
uniform float4 rpDiffuseModifier : register(c2);
uniform float4 rpSpecularModifier : register(c3);
uniform float4 rpLocalLightOrigin : register(c4);
uniform float4 rpLocalViewOrigin : register(c5);
uniform float4 rpLightProjectionS : register(c6);
uniform float4 rpLightProjectionT : register(c7);
uniform float4 rpLightProjectionQ : register(c8);
uniform float4 rpLightFalloffS : register(c9);
uniform float4 rpBumpMatrixS : register(c10);
uniform float4 rpBumpMatrixT : register(c11);
uniform float4 rpDiffuseMatrixS : register(c12);
uniform float4 rpDiffuseMatrixT : register(c13);
uniform float4 rpSpecularMatrixS : register(c14);
uniform float4 rpSpecularMatrixT : register(c15);
uniform float4 rpVertexColorModulate : register(c16);
uniform float4 rpVertexColorAdd : register(c17);
uniform float4 rpColor : register(c18);
uniform float4 rpViewOrigin : register(c19);
uniform float4 rpGlobalEyePos : register(c20);
uniform float4 rpMVPmatrixX : register(c21);
uniform float4 rpMVPmatrixY : register(c22);
uniform float4 rpMVPmatrixZ : register(c23);
uniform float4 rpMVPmatrixW : register(c24);
uniform float4 rpModelMatrixX : register(c25);
uniform float4 rpModelMatrixY : register(c26);
uniform float4 rpModelMatrixZ : register(c27);
uniform float4 rpModelMatrixW : register(c28);
uniform float4 rpProjectionMatrixX : register(c29);
uniform float4 rpProjectionMatrixY : register(c30);
uniform float4 rpProjectionMatrixZ : register(c31);
uniform float4 rpProjectionMatrixW : register(c32);
uniform float4 rpModelViewMatrixX : register(c33);
uniform float4 rpModelViewMatrixY : register(c34);
uniform float4 rpModelViewMatrixZ : register(c35);
uniform float4 rpModelViewMatrixW : register(c36);
uniform float4 rpTextureMatrixS : register(c37);
uniform float4 rpTextureMatrixT : register(c38);
uniform float4 rpTexGen0S : register(c39);
uniform float4 rpTexGen0T : register(c40);
uniform float4 rpTexGen0Q : register(c41);
uniform float4 rpTexGen0Enabled : register(c42);
uniform float4 rpTexGen1S : register(c43);
uniform float4 rpTexGen1T : register(c44);
uniform float4 rpTexGen1Q : register(c45);
uniform float4 rpTexGen1Enabled : register(c46);
uniform float4 rpWobbleSkyX : register(c47);
uniform float4 rpWobbleSkyY : register(c48);
uniform float4 rpWobbleSkyZ : register(c49);
uniform float4 rpOverbright : register(c50);
uniform float4 rpEnableSkinning : register(c51);
uniform float4 rpAlphaTest : register(c52);
static float dot2( float2 a, float2 b ) { return dot( a, b ); }
static float dot3( float3 a, float3 b ) { return dot( a, b ); }
static float dot3( float3 a, float4 b ) { return dot( a, b.xyz ); }
static float dot3( float4 a, float3 b ) { return dot( a.xyz, b ); }
static float dot3( float4 a, float4 b ) { return dot( a.xyz, b.xyz ); }
static float dot4( float4 a, float4 b ) { return dot( a, b ); }
static float dot4( float2 a, float4 b ) { return dot( float4( a, 0, 1 ), b ); }
// ----------------------
// YCoCg Color Conversion
// ----------------------
static const half4 matrixRGB1toCoCg1YX = half4( 0.50, 0.0, -0.50, 0.50196078 ); // Co
static const half4 matrixRGB1toCoCg1YY = half4( -0.25, 0.5, -0.25, 0.50196078 ); // Cg
static const half4 matrixRGB1toCoCg1YZ = half4( 0.0, 0.0, 0.0, 1.0 ); // 1.0
static const half4 matrixRGB1toCoCg1YW = half4( 0.25, 0.5, 0.25, 0.0 ); // Y
static const half4 matrixCoCg1YtoRGB1X = half4( 1.0, -1.0, 0.0, 1.0 );
static const half4 matrixCoCg1YtoRGB1Y = half4( 0.0, 1.0, -0.50196078, 1.0 ); // -0.5 * 256.0 / 255.0
static const half4 matrixCoCg1YtoRGB1Z = half4( -1.0, -1.0, 1.00392156, 1.0 ); // +1.0 * 256.0 / 255.0
static half3 ConvertYCoCgToRGB( half4 YCoCg ) {
half3 rgbColor;
YCoCg.z = ( YCoCg.z * 31.875 ) + 1.0; //z = z * 255.0/8.0 + 1.0
YCoCg.z = 1.0 / YCoCg.z;
YCoCg.xy *= YCoCg.z;
rgbColor.x = dot4( YCoCg, matrixCoCg1YtoRGB1X );
rgbColor.y = dot4( YCoCg, matrixCoCg1YtoRGB1Y );
rgbColor.z = dot4( YCoCg, matrixCoCg1YtoRGB1Z );
return rgbColor;
}
static float2 CenterScale( float2 inTC, float2 centerScale ) {
float scaleX = centerScale.x;
float scaleY = centerScale.y;
float4 tc0 = float4( scaleX, 0, 0, 0.5 - ( 0.5f * scaleX ) );
float4 tc1 = float4( 0, scaleY, 0, 0.5 - ( 0.5f * scaleY ) );
float2 finalTC;
finalTC.x = dot4( inTC, tc0 );
finalTC.y = dot4( inTC, tc1 );
return finalTC;
}
static float2 Rotate2D( float2 inTC, float2 cs ) {
float sinValue = cs.y;
float cosValue = cs.x;
float4 tc0 = float4( cosValue, -sinValue, 0, ( -0.5f * cosValue ) + ( 0.5f * sinValue ) + 0.5f );
float4 tc1 = float4( sinValue, cosValue, 0, ( -0.5f * sinValue ) + ( -0.5f * cosValue ) + 0.5f );
float2 finalTC;
finalTC.x = dot4( inTC, tc0 );
finalTC.y = dot4( inTC, tc1 );
return finalTC;
}
// better noise function available at https://github.com/ashima/webgl-noise
float rand( float2 co ) {
return frac( sin( dot( co.xy, float2( 12.9898, 78.233 ) ) ) * 43758.5453 );
}
#define _half2( x ) half2( x )
#define _half3( x ) half3( x )
#define _half4( x ) half4( x )
#define _float2( x ) float2( x )
#define _float3( x ) float3( x )
#define _float4( x ) float4( x )
#define VPOS WPOS
static float4 idtex2Dproj( sampler2D samp, float4 texCoords ) { return tex2Dproj( samp, texCoords.xyw ); }
static float4 swizzleColor( float4 c ) { return c; }
static float2 vposToScreenPosTexCoord( float2 vpos ) { return vpos.xy * rpWindowCoord.xy; }
#define BRANCH
#define IFANY

View File

@@ -0,0 +1,48 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 color = ( tex2D( samp0, fragment.texcoord0 ) * fragment.color ) + fragment.texcoord1;
result.color.xyz = color.xyz * color.w;
result.color.w = color.w;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0.xy = vertex.texcoord.xy;
result.texcoord1 = ( swizzleColor( vertex.color2 ) * 2 ) - 1;
result.color = swizzleColor( vertex.color );
}

View File

@@ -0,0 +1,66 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
float4 texcoord2 : TEXCOORD2_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// load the distortion map
float4 mask = tex2D( samp2, fragment.texcoord0.xy );
// kill the pixel if the distortion wound up being very small
mask.xy -= 0.01f;
clip( mask );
// load the filtered normal map and convert to -1 to 1 range
float4 bumpMap = ( tex2D( samp1, fragment.texcoord1.xy ) * 2.0f ) - 1.0f;
float2 localNormal = bumpMap.wy;
localNormal *= mask.xy;
// calculate the screen texcoord in the 0.0 to 1.0 range
float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );
screenTexCoord += ( localNormal * fragment.texcoord2.xy );
screenTexCoord = saturate( screenTexCoord );
result.color = tex2D( samp0, screenTexCoord );
}

View File

@@ -0,0 +1,84 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
};
void main( VS_IN vertex, out VS_OUT result ) {
#include "skinning.inc"
// texture 0 takes the texture coordinates unmodified
result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 );
// texture 1 takes the texture coordinates and adds a scroll
const float4 textureScroll = rpUser0;
result.texcoord1 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll;
// texture 2 takes the deform magnitude and scales it by the projection distance
float4 vec = float4( 0, 1, 0, 1 );
vec.z = dot4( modelPosition, rpModelViewMatrixZ );
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
// using the X axis to the Y axis to calculate R1. It is an approximation to closely match
// what the original game did
const float magicProjectionAdjust = 0.43f;
float x = dot4 ( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
float w = dot4 ( vec, rpProjectionMatrixW );
// don't let the recip get near zero for polygons that cross the view plane
w = max( w, 1.0 );
x /= w;
//x = x * ( 1.0f / ( w + 0.00001f ) );
// clamp the distance so the the deformations don't get too wacky near the view
x = min( x, 0.02 );
const float4 deformMagnitude = rpUser1;
result.texcoord2 = x * deformMagnitude;
}

View File

@@ -0,0 +1,68 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
float4 texcoord2 : TEXCOORD2_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// load the distortion map
float4 mask = tex2D( samp2, fragment.texcoord0.xy );
// kill the pixel if the distortion wound up being very small
mask.xy *= fragment.color.xy;
mask.xy -= 0.01f;
clip( mask );
// load the filtered normal map and convert to -1 to 1 range
float4 bumpMap = ( tex2D( samp1, fragment.texcoord1.xy ) * 2.0f ) - 1.0f;
float2 localNormal = bumpMap.wy;
localNormal *= mask.xy;
// calculate the screen texcoord in the 0.0 to 1.0 range
float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );
screenTexCoord += ( localNormal * fragment.texcoord2.xy );
screenTexCoord = saturate( screenTexCoord );
result.color = tex2D( samp0, screenTexCoord );
}

View File

@@ -0,0 +1,86 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
#include "skinning.inc"
// texture 0 takes the texture coordinates unmodified
result.texcoord0 = float4( vertex.texcoord, 0 , 0 );
// texture 1 takes the texture coordinates and adds a scroll
const float4 textureScroll = rpUser0;
result.texcoord1 = float4( vertex.texcoord, 0, 0 ) + textureScroll;
// texture 2 takes the deform magnitude and scales it by the projection distance
float4 vec = float4( 0, 1, 0, 1 );
vec.z = dot4( modelPosition, rpModelViewMatrixZ );
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
// using the X axis to the Y axis to calculate x. It is an approximation to closely match
// what the original game did
const float magicProjectionAdjust = 0.43f;
float x = dot4 ( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
float w = dot4( vec, rpProjectionMatrixW );
// don't let the recip get near zero for polygons that cross the view plane
w = max( w, 1.0f );
x /= w;
//x = x * ( 1.0f / w );
// clamp the distance so the the deformations don't get too wacky near the view
x = min( x, 0.02f );
const float4 deformMagnitude = rpUser1;
result.texcoord2 = x * deformMagnitude;
result.color = swizzleColor( vertex.color );
}

View File

@@ -0,0 +1,57 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// load the filtered normal map and convert to -1 to 1 range
float4 bumpMap = ( tex2D( samp1, fragment.texcoord0.xy ) * 2.0f ) - 1.0f;
float2 localNormal = bumpMap.wy;
// calculate the screen texcoord in the 0.0 to 1.0 range
float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );
screenTexCoord += ( localNormal * fragment.texcoord1.xy );
screenTexCoord = saturate( screenTexCoord );
// load the screen render
result.color = tex2D( samp0, screenTexCoord.xy );
}

View File

@@ -0,0 +1,82 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
// User Renderparms start at 128 as per renderprogs.h
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
#include "skinning.inc"
//texture 0 takes the texture coordinates and adds a scroll
const float4 textureScroll = rpUser0;
result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll;
//texture 1 takes the deform magnitude and scales it by the projection distance
float4 vec = float4( 0, 1, 0, 1 );
vec.z = dot4( modelPosition, rpModelViewMatrixZ ); // this is the modelview matrix
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
// using the X axis to the Y axis to calculate x. It is an approximation to closely match
// what the original game did
const float magicProjectionAdjust = 0.43f;
float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
float w = dot4( vec, rpProjectionMatrixW );
//don't let the recip get near zero for polygons that cross the view plane
w = max( w, 1.0 );
x /= w;
//x = x * ( 1.0f / w );
// clamp the distance so the the deformations don't get too wacky near the view
x = min( x, 0.02 );
const float4 deformMagnitude = rpUser1;
result.texcoord1 = x * deformMagnitude;
}

View File

@@ -0,0 +1,78 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
struct PS_IN {
half4 position : VPOS;
half4 texcoord0 : TEXCOORD0_centroid;
half4 texcoord1 : TEXCOORD1_centroid;
half4 texcoord2 : TEXCOORD2_centroid;
half4 texcoord3 : TEXCOORD3_centroid;
half4 texcoord4 : TEXCOORD4_centroid;
half4 texcoord5 : TEXCOORD5_centroid;
half4 texcoord6 : TEXCOORD6_centroid;
half4 color : COLOR0;
};
struct PS_OUT {
half4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
half4 YCoCG = tex2D( samp3, fragment.texcoord4.xy );
half4 specMap = tex2D( samp4, fragment.texcoord5.xy );
half3 lightVector = normalize( fragment.texcoord0.xyz );
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
localNormal.xy = bumpMap.wy - 0.5;
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );
const half specularPower = 10.0f;
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
half3 specularContribution = _half3( pow( hDotN, specularPower ) );
half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;
half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;
half3 lightColor = dot3( lightVector, localNormal ) * lightProj.xyz * lightFalloff.xyz;
result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;
result.color.w = 1.0;
}

View File

@@ -0,0 +1,120 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 texcoord3 : TEXCOORD3;
float4 texcoord4 : TEXCOORD4;
float4 texcoord5 : TEXCOORD5;
float4 texcoord6 : TEXCOORD6;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float3 vNormal = vertex.normal.xyz * 2.0 - 1.0;
float4 vTangent = vertex.tangent * 2.0 - 1.0;
float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
//calculate vector to light in R0
float4 toLight = rpLocalLightOrigin - vertex.position;
//result.texcoord0
result.texcoord0.x = dot3( vTangent.xyz, toLight );
result.texcoord0.y = dot3( vBinormal, toLight );
result.texcoord0.z = dot3( vNormal, toLight );
result.texcoord0.w = 1.0f;
//textures 1 takes the base coordinates by the texture matrix
result.texcoord1 = defaultTexCoord;
result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );
result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );
//# texture 2 has one texgen
result.texcoord2 = defaultTexCoord;
result.texcoord2.x = dot4( vertex.position, rpLightFalloffS );
//# texture 3 has three texgens
result.texcoord3.x = dot4( vertex.position, rpLightProjectionS );
result.texcoord3.y = dot4( vertex.position, rpLightProjectionT );
result.texcoord3.z = 0.0f;
result.texcoord3.w = dot4( vertex.position, rpLightProjectionQ );
//# textures 4 takes the base coordinates by the texture matrix
result.texcoord4 = defaultTexCoord;
result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );
result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );
//# textures 5 takes the base coordinates by the texture matrix
result.texcoord5 = defaultTexCoord;
result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );
result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );
//# texture 6's texcoords will be the halfangle in texture space
//# calculate normalized vector to light in R0
toLight = normalize( toLight );
//# calculate normalized vector to viewer in R1
float4 toView = normalize( rpLocalViewOrigin - vertex.position );
//# add together to become the half angle vector in object space (non-normalized)
float4 halfAngleVector = toLight + toView;
//# put into texture space
result.texcoord6.x = dot3( vTangent.xyz, halfAngleVector );
result.texcoord6.y = dot3( vBinormal, halfAngleVector );
result.texcoord6.z = dot3( vNormal, halfAngleVector );
result.texcoord6.w = 1.0f;
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
//# for 1.0 : env[16] = 0, env[17] = 1
//# for color : env[16] = 1, env[17] = 0
//# for 1.0-color : env[16] = -1, env[17] = 1
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,78 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
struct PS_IN {
half4 position : VPOS;
half4 texcoord1 : TEXCOORD1_centroid;
half4 texcoord2 : TEXCOORD2_centroid;
half4 texcoord3 : TEXCOORD3_centroid;
half4 texcoord4 : TEXCOORD4_centroid;
half4 texcoord5 : TEXCOORD5_centroid;
half4 texcoord6 : TEXCOORD6_centroid;
half4 color : COLOR0;
};
struct PS_OUT {
half4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
half4 YCoCG = tex2D( samp3, fragment.texcoord4.xy );
half4 specMap = tex2D( samp4, fragment.texcoord5.xy );
const half3 ambientLightVector = half3( 0.5f, 9.5f - 0.385f, 0.8925f );
half3 lightVector = normalize( ambientLightVector );
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
localNormal.xy = bumpMap.wy - 0.5;
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );
const half specularPower = 10.0f;
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
half3 specularContribution = _half3( pow( hDotN, specularPower ) );
half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;
half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;
half3 lightColor = dot3( lightVector, localNormal ) * lightProj.xyz * lightFalloff.xyz;
result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;
result.color.w = 1.0;
}

View File

@@ -0,0 +1,113 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 texcoord3 : TEXCOORD3;
float4 texcoord4 : TEXCOORD4;
float4 texcoord5 : TEXCOORD5;
float4 texcoord6 : TEXCOORD6;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 normal = vertex.normal * 2.0 - 1.0;
float4 tangent = vertex.tangent * 2.0 - 1.0;
float3 binormal = cross( normal.xyz, tangent.xyz ) * tangent.w;
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
//calculate vector to light in R0
float4 toLight = rpLocalLightOrigin - vertex.position;
//textures 1 takes the base coordinates by the texture matrix
result.texcoord1 = defaultTexCoord;
result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );
result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );
//# texture 2 has one texgen
result.texcoord2 = defaultTexCoord;
result.texcoord2.x = dot4( vertex.position, rpLightFalloffS );
//# texture 3 has three texgens
result.texcoord3.x = dot4( vertex.position, rpLightProjectionS );
result.texcoord3.y = dot4( vertex.position, rpLightProjectionT );
result.texcoord3.z = 0.0f;
result.texcoord3.w = dot4( vertex.position, rpLightProjectionQ );
//# textures 4 takes the base coordinates by the texture matrix
result.texcoord4 = defaultTexCoord;
result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );
result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );
//# textures 5 takes the base coordinates by the texture matrix
result.texcoord5 = defaultTexCoord;
result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );
result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );
//# texture 6's texcoords will be the halfangle in texture space
//# calculate normalized vector to light in R0
toLight = normalize( toLight );
//# calculate normalized vector to viewer in R1
float4 toView = normalize( rpLocalViewOrigin - vertex.position );
//# add together to become the half angle vector in object space (non-normalized)
float4 halfAngleVector = toLight + toView;
//# put into texture space
result.texcoord6.x = dot3( tangent, halfAngleVector );
result.texcoord6.y = dot3( binormal, halfAngleVector );
result.texcoord6.z = dot3( normal, halfAngleVector );
result.texcoord6.w = 1.0f;
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
//# for 1.0 : env[16] = 0, env[17] = 1
//# for color : env[16] = 1, env[17] = 0
//# for 1.0-color : env[16] = -1, env[17] = 1
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,78 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
struct PS_IN {
half4 position : VPOS;
half4 texcoord1 : TEXCOORD1_centroid;
half4 texcoord2 : TEXCOORD2_centroid;
half4 texcoord3 : TEXCOORD3_centroid;
half4 texcoord4 : TEXCOORD4_centroid;
half4 texcoord5 : TEXCOORD5_centroid;
half4 texcoord6 : TEXCOORD6_centroid;
half4 color : COLOR0;
};
struct PS_OUT {
half4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
half4 YCoCG = tex2D( samp3, fragment.texcoord4.xy );
half4 specMap = tex2D( samp4, fragment.texcoord5.xy );
const half3 ambientLightVector = half3( 0.5f, 9.5f - 0.385f, 0.8925f );
half3 lightVector = normalize( ambientLightVector );
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
localNormal.xy = bumpMap.wy - 0.5;
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );
const half specularPower = 10.0f;
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
half3 specularContribution = _half3( pow( hDotN, specularPower ) );
half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;
half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;
half3 lightColor = dot3( lightVector, localNormal ) * lightProj.xyz * lightFalloff.xyz;
result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;
result.color.w = 1.0;
}

View File

@@ -0,0 +1,171 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 texcoord3 : TEXCOORD3;
float4 texcoord4 : TEXCOORD4;
float4 texcoord5 : TEXCOORD5;
float4 texcoord6 : TEXCOORD6;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
float4 vTangent = vertex.tangent * 2.0 - 1.0;
float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float3 normal;
normal.x = dot3( matX, vNormal );
normal.y = dot3( matY, vNormal );
normal.z = dot3( matZ, vNormal );
normal = normalize( normal );
float3 tangent;
tangent.x = dot3( matX, vTangent );
tangent.y = dot3( matY, vTangent );
tangent.z = dot3( matZ, vTangent );
tangent = normalize( tangent );
float3 binormal;
binormal.x = dot3( matX, vBinormal );
binormal.y = dot3( matY, vBinormal );
binormal.z = dot3( matZ, vBinormal );
binormal = normalize( binormal );
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
//calculate vector to light in R0
float4 toLight = rpLocalLightOrigin - modelPosition;
//textures 1 takes the base coordinates by the texture matrix
result.texcoord1 = defaultTexCoord;
result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );
result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );
//# texture 2 has one texgen
result.texcoord2 = defaultTexCoord;
result.texcoord2.x = dot4( modelPosition, rpLightFalloffS );
//# texture 3 has three texgens
result.texcoord3.x = dot4( modelPosition, rpLightProjectionS );
result.texcoord3.y = dot4( modelPosition, rpLightProjectionT );
result.texcoord3.z = 0.0f;
result.texcoord3.w = dot4( modelPosition, rpLightProjectionQ );
//# textures 4 takes the base coordinates by the texture matrix
result.texcoord4 = defaultTexCoord;
result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );
result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );
//# textures 5 takes the base coordinates by the texture matrix
result.texcoord5 = defaultTexCoord;
result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );
result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );
//# texture 6's texcoords will be the halfangle in texture space
//# calculate normalized vector to light in R0
toLight = normalize( toLight );
//# calculate normalized vector to viewer in R1
float4 toView = normalize( rpLocalViewOrigin - modelPosition );
//# add together to become the half angle vector in object space (non-normalized)
float4 halfAngleVector = toLight + toView;
//# put into texture space
result.texcoord6.x = dot3( tangent, halfAngleVector );
result.texcoord6.y = dot3( binormal, halfAngleVector );
result.texcoord6.z = dot3( normal, halfAngleVector );
result.texcoord6.w = 1.0f;
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
//# for 1.0 : env[16] = 0, env[17] = 1
//# for color : env[16] = 1, env[17] = 0
//# for 1.0-color : env[16] = -1, env[17] = 1
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,78 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
struct PS_IN {
half4 position : VPOS;
half4 texcoord0 : TEXCOORD0_centroid;
half4 texcoord1 : TEXCOORD1_centroid;
half4 texcoord2 : TEXCOORD2_centroid;
half4 texcoord3 : TEXCOORD3_centroid;
half4 texcoord4 : TEXCOORD4_centroid;
half4 texcoord5 : TEXCOORD5_centroid;
half4 texcoord6 : TEXCOORD6_centroid;
half4 color : COLOR0;
};
struct PS_OUT {
half4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
half4 YCoCG = tex2D( samp3, fragment.texcoord4.xy );
half4 specMap = tex2D( samp4, fragment.texcoord5.xy );
half3 lightVector = normalize( fragment.texcoord0.xyz );
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
localNormal.xy = bumpMap.wy - 0.5;
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );
const half specularPower = 10.0f;
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
half3 specularContribution = _half3( pow( hDotN, specularPower ) );
half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;
half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;
half3 lightColor = dot3( lightVector, localNormal ) * lightProj.xyz * lightFalloff.xyz;
result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;
result.color.w = 1.0;
}

View File

@@ -0,0 +1,185 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 texcoord3 : TEXCOORD3;
float4 texcoord4 : TEXCOORD4;
float4 texcoord5 : TEXCOORD5;
float4 texcoord6 : TEXCOORD6;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
float4 vTangent = vertex.tangent * 2.0 - 1.0;
float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float3 normal;
normal.x = dot3( matX, vNormal );
normal.y = dot3( matY, vNormal );
normal.z = dot3( matZ, vNormal );
normal = normalize( normal );
float3 tangent;
tangent.x = dot3( matX, vTangent );
tangent.y = dot3( matY, vTangent );
tangent.z = dot3( matZ, vTangent );
tangent = normalize( tangent );
float3 binormal;
binormal.x = dot3( matX, vBinormal );
binormal.y = dot3( matY, vBinormal );
binormal.z = dot3( matZ, vBinormal );
binormal = normalize( binormal );
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
//calculate vector to light in R0
float4 toLight = rpLocalLightOrigin - modelPosition;
//--------------------------------------------------------------
//result.texcoord0 is the direction to the light in tangent space
result.texcoord0.x = dot3( tangent, toLight );
result.texcoord0.y = dot3( binormal, toLight );
result.texcoord0.z = dot3( normal, toLight );
result.texcoord0.w = 1.0f;
//textures 1 takes the base coordinates by the texture matrix
result.texcoord1 = defaultTexCoord;
result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );
result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );
//# texture 2 has one texgen
result.texcoord2 = defaultTexCoord;
result.texcoord2.x = dot4( modelPosition, rpLightFalloffS );
//# texture 3 has three texgens
result.texcoord3.x = dot4( modelPosition, rpLightProjectionS );
result.texcoord3.y = dot4( modelPosition, rpLightProjectionT );
result.texcoord3.z = 0.0f;
result.texcoord3.w = dot4( modelPosition, rpLightProjectionQ );
//# textures 4 takes the base coordinates by the texture matrix
result.texcoord4 = defaultTexCoord;
result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );
result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );
//# textures 5 takes the base coordinates by the texture matrix
result.texcoord5 = defaultTexCoord;
result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );
result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );
//# texture 6's texcoords will be the halfangle in texture space
//# calculate normalized vector to light in R0
toLight = normalize( toLight );
//# calculate normalized vector to viewer in R1
float4 toView = normalize( rpLocalViewOrigin - modelPosition );
//# add together to become the half angle vector in object space (non-normalized)
float4 halfAngleVector = toLight + toView;
//# put into texture space
result.texcoord6.x = dot3( tangent, halfAngleVector );
result.texcoord6.y = dot3( binormal, halfAngleVector );
result.texcoord6.z = dot3( normal, halfAngleVector );
result.texcoord6.w = 1.0f;
// for joint transformation of the tangent space, we use color and
// color2 for weighting information, so hopefully there aren't any
// effects that need vertex color...
result.color = float4( 1.0f, 1.0f, 1.0f, 1.0f );
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
//# for 1.0 : env[16] = 0, env[17] = 1
//# for color : env[16] = 1, env[17] = 0
//# for 1.0-color : env[16] = -1, env[17] = 1
// result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,92 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // view color
uniform sampler2D samp1 : register(s1); // view depth
struct PS_IN {
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
#if 0
if ( fragment.texcoord0.x < 0.5 ) {
// only draw on half the screen for comparison
discard;
}
#endif
// don't motion blur the hands, which were drawn with alpha = 0
if ( tex2D( samp0, fragment.texcoord0 ).w == 0.0 ) {
discard;
}
// derive clip space from the depth buffer and screen position
float windowZ = tex2D( samp1, fragment.texcoord0 ).x;
float3 ndc = float3( fragment.texcoord0 * 2.0 - 1.0, windowZ * 2.0 - 1.0 );
float clipW = -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - ndc.z );
float4 clip = float4( ndc * clipW, clipW );
// convert from clip space this frame to clip space previous frame
float4 reClip;
reClip.x = dot( rpMVPmatrixX, clip );
reClip.y = dot( rpMVPmatrixY, clip );
reClip.z = dot( rpMVPmatrixZ, clip );
reClip.w = dot( rpMVPmatrixW, clip );
// convert to NDC values
float2 prevTexCoord;
prevTexCoord.x = ( reClip.x / reClip.w ) * 0.5 + 0.5;
prevTexCoord.y = ( reClip.y / reClip.w ) * 0.5 + 0.5;
// sample along the line from prevTexCoord to fragment.texcoord0
float2 texCoord = prevTexCoord; //fragment.texcoord0;
float2 delta = ( fragment.texcoord0 - prevTexCoord );
float3 sum = float3( 0.0 );
float goodSamples = 0;
float samples = rpOverbright.x;
for ( float i = 0 ; i < samples ; i = i + 1 ) {
float2 pos = fragment.texcoord0 + delta * ( ( i / ( samples - 1 ) ) - 0.5 );
float4 color = tex2D( samp0, pos );
// only take the values that are not part of the weapon
sum += color.xyz * color.w;
goodSamples += color.w;
}
float invScale = 1.0 / goodSamples;
result.color = float4( sum * invScale, 1.0 );
}

View File

@@ -0,0 +1,44 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position = vertex.position;
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,45 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float2 tCoords = fragment.texcoord0;
result.color = tex2D( samp0, tCoords );
}

View File

@@ -0,0 +1,52 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position = vertex.position;
//result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX );
//result.position.y = dot4( vertex.position, rpMVPmatrixY );
//result.position.z = dot4( vertex.position, rpMVPmatrixZ );
//result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vPos = vertex.position - rpLocalLightOrigin;
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
result.position.x = dot4( vPos, rpMVPmatrixX );
result.position.y = dot4( vPos, rpMVPmatrixY );
result.position.z = dot4( vPos, rpMVPmatrixZ );
result.position.w = dot4( vPos, rpMVPmatrixW );
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vPos = vertex.position - rpLocalLightOrigin;
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
result.position.x = dot4( vPos, rpMVPmatrixX );
result.position.y = dot4( vPos, rpMVPmatrixY );
result.position.z = dot4( vPos, rpMVPmatrixZ );
result.position.w = dot4( vPos, rpMVPmatrixW );
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,91 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 vertexPosition = vertex.position;
vertexPosition.w = 1.0;
float4 modelPosition;
modelPosition.x = dot4( matX, vertexPosition );
modelPosition.y = dot4( matY, vertexPosition );
modelPosition.z = dot4( matZ, vertexPosition );
modelPosition.w = vertex.position.w;
float4 vPos = modelPosition - rpLocalLightOrigin;
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
result.position.x = dot4( vPos, rpMVPmatrixX );
result.position.y = dot4( vPos, rpMVPmatrixY );
result.position.z = dot4( vPos, rpMVPmatrixZ );
result.position.w = dot4( vPos, rpMVPmatrixW );
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,91 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 vertexPosition = vertex.position;
vertexPosition.w = 1.0;
float4 modelPosition;
modelPosition.x = dot4( matX, vertexPosition );
modelPosition.y = dot4( matY, vertexPosition );
modelPosition.z = dot4( matZ, vertexPosition );
modelPosition.w = vertex.position.w;
float4 vPos = modelPosition - rpLocalLightOrigin;
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
result.position.x = dot4( vPos, rpMVPmatrixX );
result.position.y = dot4( vPos, rpMVPmatrixY );
result.position.z = dot4( vPos, rpMVPmatrixZ );
result.position.w = dot4( vPos, rpMVPmatrixW );
}

View File

@@ -0,0 +1,62 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
uniform sampler2D samp0 : register(s0);
static float2 screenPosToTexcoord( float2 pos, float4 bias_scale ) { return ( pos * bias_scale.zw + bias_scale.xy ); }
void main( PS_IN fragment, out PS_OUT result ) {
const float renderWidth = 1280.0f;
const float renderHeight = 720.0f;
const float4 positionToViewTexture = float4( 0.5f / renderWidth, 0.5f / renderHeight, 1.0f / renderWidth, 1.0f / renderHeight );
float interpolatedZOverW = ( 1.0 - ( fragment.texcoord0.z / fragment.texcoord0.w ) );
float3 pos;
pos.z = 1.0 / interpolatedZOverW;
pos.xy = pos.z * ( 2.0 * screenPosToTexcoord( fragment.position.xy, positionToViewTexture ) - 1.0 );
float3 normal = normalize( cross( ddy( pos ), ddx( pos ) ) );
// light is above and to the right in the eye plane
float3 L = normalize( float3( 1.0, 1.0, 0.0 ) - pos );
result.color.xyz = _float3( dot3( normal, L ) * 0.75 );
result.color.w = 1.0;
}

View File

@@ -0,0 +1,53 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 position;
position.x = dot4( vertex.position, rpMVPmatrixX );
position.y = dot4( vertex.position, rpMVPmatrixY );
position.z = dot4( vertex.position, rpMVPmatrixZ );
position.w = dot4( vertex.position, rpMVPmatrixW );
result.position = position;
result.texcoord0 = position;
}

View File

@@ -0,0 +1,71 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
float4 modelPosition = vertex.position;
BRANCH if ( rpEnableSkinning.x > 0.0 ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
}
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );

View File

@@ -0,0 +1,45 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float3 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = texCUBE( samp0, fragment.texcoord0 ) * fragment.color;
}

View File

@@ -0,0 +1,54 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float3 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.position.xyz - rpLocalViewOrigin.xyz;
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,39 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,48 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
}

View File

@@ -0,0 +1,49 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);
struct PS_IN {
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// texcoords will run from 0 to 1 across the entire screen
if ( fract( fragment.position.y * 0.5 ) < 0.5 ) {
result.color = tex2D( samp0, vec2( fragment.texcoord0 ) );
} else {
result.color = tex2D( samp1, vec2( fragment.texcoord0 ) );
}
}

View File

@@ -0,0 +1,48 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,74 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
/*
This shader will cover a square block of pixel coordinates, but some of them might
be scissored off if the edges of the screen or the midpoint divider are visible through
the optics.
*/
uniform sampler2D samp0 : register(s0);
struct PS_IN {
vec4 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
const float screenWarp_range = 1.45;
const vec2 warpCenter = vec2( 0.5, 0.5 );
vec2 centeredTexcoord = fragment.texcoord0.xy - warpCenter;
float radialLength = length( centeredTexcoord );
vec2 radialDir = normalize( centeredTexcoord );
// get it down into the 0 - PI/2 range
float range = screenWarp_range;
float scaledRadialLength = radialLength * range;
float tanScaled = tan( scaledRadialLength );
float rescaleValue = tan( 0.5 * range );
// If radialLength was 0.5, we want rescaled to also come out
// as 0.5, so the edges of the rendered image are at the edges
// of the warped image.
float rescaled = tanScaled / rescaleValue;
vec2 warped = warpCenter + vec2( 0.5, 0.5 ) * radialDir * rescaled;
result.color = tex2D( samp0, warped );
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float4 texcoord : TEXCOORD0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0: TEXCOORD0; // 0 to 1 box
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,44 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = tex2D( samp0, fragment.texcoord0 ) * rpColor;
}

View File

@@ -0,0 +1,58 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
// compute oldschool texgen or multiply by texture matrix
BRANCH if ( rpTexGen0Enabled.x > 0.0 ) {
result.texcoord0.x = dot4( vertex.position, rpTexGen0S );
result.texcoord0.y = dot4( vertex.position, rpTexGen0T );
} else {
result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );
result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );
}
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 color = tex2D( samp0, fragment.texcoord0 ) * fragment.color;
clip( color.a - rpAlphaTest.x );
result.color = color;
}

View File

@@ -0,0 +1,62 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
// compute oldschool texgen or multiply by texture matrix
BRANCH if ( rpTexGen0Enabled.x > 0.0 ) {
result.texcoord0.x = dot4( vertex.position, rpTexGen0S );
result.texcoord0.y = dot4( vertex.position, rpTexGen0T );
} else {
result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );
result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );
}
float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
result.color = vertexColor * rpColor;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 color = tex2D( samp0, fragment.texcoord0 ) * fragment.color;
clip( color.a - rpAlphaTest.x );
result.color = color;
}

View File

@@ -0,0 +1,100 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
// compute oldschool texgen or multiply by texture matrix
BRANCH if ( rpTexGen0Enabled.x > 0.0 ) {
result.texcoord0.x = dot4( modelPosition, rpTexGen0S );
result.texcoord0.y = dot4( modelPosition, rpTexGen0T );
} else {
result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );
result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );
}
float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
result.color = vertexColor * rpColor;
}

View File

@@ -0,0 +1,52 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// we always do a projective texture lookup so that we can support texgen
// materials without a separate shader. Basic materials will have texture
// coordinates with w = 1 which will result in a NOP projection when tex2Dproj
// gets called.
float4 texSample = idtex2Dproj( samp0, fragment.texcoord0 );
result.color = texSample * fragment.color;
}

View File

@@ -0,0 +1,66 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float4 tc0;
tc0.x = dot4( vertex.position, rpTexGen0S );
tc0.y = dot4( vertex.position, rpTexGen0T );
tc0.z = 0.0f;
tc0.w = dot4( vertex.position, rpTexGen0Q );
// multiply the texture matrix in
result.texcoord0.x = dot4( tc0, rpTextureMatrixS );
result.texcoord0.y = dot4( tc0, rpTextureMatrixT );
result.texcoord0.zw = tc0.zw;
// compute vertex modulation
float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
result.color = vertexColor * rpColor;
}

View File

@@ -0,0 +1,45 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float3 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = texCUBE( samp0, fragment.texcoord0 ) * fragment.color;
}

View File

@@ -0,0 +1,57 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float3 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float3 t0 = vertex.position.xyz - rpLocalViewOrigin.xyz;
result.texcoord0.x = dot3( t0, rpWobbleSkyX );
result.texcoord0.y = dot3( t0, rpWobbleSkyY );
result.texcoord0.z = dot3( t0, rpWobbleSkyZ );
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,39 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct PS_OUT {
float depth : DEPTH;
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.depth = 1;
result.color = float4( 0.0, 0.0, 0.0, 0.0 );
}

View File

@@ -0,0 +1,42 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position = vertex.position;
result.position.z = -1.0;
}