Initial commit.

This commit is contained in:
Justin Marshall
2019-09-27 07:04:44 +01:00
commit 3be9600a12
13 changed files with 2020 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
numlayers 2
layer_0
{
albedo megagen/test/dirt_albedo.tga
mask megagen/white.tga
}
layer_1
{
albedo megagen/test/stones_albedo.tga
mask megagen/test_box/mountain_layer.tga
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

+124
View File
@@ -0,0 +1,124 @@
/*
===========================================================================
IcedTech GPL Source Code
Copyright (C) 2019 Real Vector Math Studios(Justin Marshall).
This file is part of the IcedTech GPL Source Code ("IcedTech GPL Source Code").
IcedTech GPL 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.
IcedTech GPL 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 IcedTech GPL Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the IcedTech GPL 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 IcedTech GPL 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);
uniform sampler2D samp2 : register(s2);
uniform sampler2D samp3 : register(s3);
uniform sampler2D samp4 : register(s4);
uniform sampler2D samp5 : register(s5);
uniform sampler2D samp6 : register(s6);
uniform sampler2D samp7 : register(s7);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
float2 texcoord3 : TEXCOORD3;
float2 texcoord4 : TEXCOORD4;
float2 texcoord5 : TEXCOORD5;
float2 texcoord6 : TEXCOORD6;
float4 texcoord7 : TEXCOORD7;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 mask1, mask2;
float4 invMask1, invMask2;
float4 combined;
float2 scaled;
float4 R2;
mask1.x = tex2D(samp0, fragment.texcoord0.xy).x;
mask1.y = tex2D(samp0, fragment.texcoord1.xy).x;
mask1.z = tex2D(samp0, fragment.texcoord2.xy).x;
mask1.w = tex2D(samp0, fragment.texcoord3.xy).x;
mask2.x = tex2D(samp0, fragment.texcoord4.xy).x;
mask2.y = tex2D(samp0, fragment.texcoord5.xy).x;
mask2.z = tex2D(samp0, fragment.texcoord6.xy).x;
mask2.w = 1.0;
invMask1 = 1 - mask1;
invMask2 = 1 - mask2;
combined = float4(0, 0, 0, 0);
scaled = fragment.texcoord7.zw;
// Sample the lowest quality first.
R2 = tex2D(samp1, scaled.xy);
R2.xyz = ConvertYCoCgToRGB(R2);
scaled = scaled * 2;
combined = combined * invMask1.x;
combined = (R2 * mask1.x) + combined;
R2 = tex2D(samp2, scaled.xy);
R2.xyz = ConvertYCoCgToRGB(R2);
scaled = scaled * 2;
combined = combined * invMask1.y;
combined = (R2 * mask1.y) + combined;
R2 = tex2D(samp3, scaled.xy);
R2.xyz = ConvertYCoCgToRGB(R2);
scaled = scaled * 2;
combined = combined * invMask1.z;
combined = (R2 * mask1.z) + combined;
R2 = tex2D(samp4, scaled.xy);
R2.xyz = ConvertYCoCgToRGB(R2);
scaled = scaled * 2;
combined = combined * invMask1.w;
combined = (R2 * mask1.w) + combined;
R2 = tex2D(samp5, scaled.xy);
R2.xyz = ConvertYCoCgToRGB(R2);
scaled = scaled * 2;
combined = combined * invMask2.x;
combined = (R2 * mask2.x) + combined;
R2 = tex2D(samp6, scaled.xy);
R2.xyz = ConvertYCoCgToRGB(R2);
scaled = scaled * 2;
combined = combined * invMask2.y;
combined = (R2 * mask2.y) + combined;
//R2 = tex2D(samp7, scaled.xy);
//R2.xyz = ConvertYCoCgToRGB(R2);
//scaled = scaled * 2;
//combined = combined * invMask2.z;
//combined = (R2 * mask2.z) + combined;
result.color = combined;
}
+70
View File
@@ -0,0 +1,70 @@
/*
===========================================================================
IcedTech GPL Source Code
Copyright (C) 2019 Real Vector Math Studios(Justin Marshall).
This file is part of the IcedTech GPL Source Code ("IcedTech GPL Source Code").
IcedTech GPL 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.
IcedTech GPL 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 IcedTech GPL Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the IcedTech GPL 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 IcedTech GPL 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;
float2 texcoord2 : TEXCOORD2;
float2 texcoord3 : TEXCOORD3;
float2 texcoord4 : TEXCOORD4;
float2 texcoord5 : TEXCOORD5;
float2 texcoord6 : TEXCOORD6;
float4 texcoord7 : TEXCOORD7;
};
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 );
// Megatexture masks, (texCoord * scale) + offset.
result.texcoord0.xy = (vertex.texcoord * rpMegaTextureLevel0.w) + rpMegaTextureLevel0.xy;
result.texcoord1.xy = (vertex.texcoord * rpMegaTextureLevel1.w) + rpMegaTextureLevel1.xy;
result.texcoord2.xy = (vertex.texcoord * rpMegaTextureLevel2.w) + rpMegaTextureLevel2.xy;
result.texcoord3.xy = (vertex.texcoord * rpMegaTextureLevel3.w) + rpMegaTextureLevel3.xy;
result.texcoord4.xy = (vertex.texcoord * rpMegaTextureLevel4.w) + rpMegaTextureLevel4.xy;
result.texcoord5.xy = (vertex.texcoord * rpMegaTextureLevel5.w) + rpMegaTextureLevel5.xy;
result.texcoord6.xy = (vertex.texcoord * rpMegaTextureLevel6.w) + rpMegaTextureLevel6.xy;
// Images only have scale.
result.texcoord7.xy = vertex.texcoord * rpMegaTextureLevel6.w;
result.texcoord7.zw = vertex.texcoord;
}