mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 06:52:55 +08:00
Added vertex shaders for skin mesh support
This commit is contained in:
parent
3462513e27
commit
9f84ba8ad0
@ -802,7 +802,7 @@ namespace CodeWalker.GameFiles
|
||||
//used by CW for animating skeletons.
|
||||
public Quaternion AnimRotation;
|
||||
public Vector3 AnimTranslation;
|
||||
|
||||
public Matrix AnimTransform;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -844,6 +844,7 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
AnimRotation = Rotation;
|
||||
AnimTranslation = Translation;
|
||||
AnimTransform = Matrix.AffineTransformation(1.0f, AnimRotation, AnimTranslation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -77,6 +77,8 @@ namespace CodeWalker.Rendering
|
||||
public ClipMapEntry ClipMapEntry;
|
||||
public Dictionary<ushort, RenderableModel> ModelBoneLinks;
|
||||
|
||||
public Matrix3_s[] BoneTransforms;
|
||||
|
||||
|
||||
public override void Init(DrawableBase drawable)
|
||||
{
|
||||
@ -297,6 +299,28 @@ namespace CodeWalker.Rendering
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//populate the bonetransforms array
|
||||
Matrix[] bonetrans = (fragtransforms != null) ? fragtransforms : (modeltransforms != null) ? modeltransforms : null;
|
||||
if (bonetrans != null)
|
||||
{
|
||||
BoneTransforms = new Matrix3_s[bonetrans.Length];
|
||||
for (int i = 0; i < bonetrans.Length; i++)
|
||||
{
|
||||
Matrix b = bonetrans[i];
|
||||
Matrix3_s bt = new Matrix3_s();
|
||||
bt.Row1 = b.Row1;
|
||||
bt.Row2 = b.Row2;
|
||||
bt.Row3 = b.Row3;
|
||||
BoneTransforms[i] = bt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private RenderableModel InitModel(DrawableModel dm)
|
||||
@ -445,17 +469,6 @@ namespace CodeWalker.Rendering
|
||||
for (int i = 0; i < bones.Count; i++)
|
||||
{
|
||||
var bone = bones[i];
|
||||
|
||||
RenderableModel bmodel = null;
|
||||
ModelBoneLinks?.TryGetValue(bone.Id, out bmodel);
|
||||
if (bmodel == null)
|
||||
{ continue; }
|
||||
|
||||
if (((bmodel.SkeletonBinding >> 8) & 0xFF) > 0) //skin mesh? //TODO: see eg. p_oil_pjack_03_s
|
||||
{ continue; }
|
||||
|
||||
//update model's transform from animated bone
|
||||
|
||||
var pos = bone.AnimTranslation;
|
||||
var ori = bone.AnimRotation;
|
||||
var pbone = bone.Parent;
|
||||
@ -465,8 +478,19 @@ namespace CodeWalker.Rendering
|
||||
ori = pbone.AnimRotation * ori;
|
||||
pbone = pbone.Parent;
|
||||
}
|
||||
bone.AnimTransform = Matrix.AffineTransformation(1.0f, ori, pos);
|
||||
|
||||
bmodel.Transform = Matrix.AffineTransformation(1.0f, ori, pos);
|
||||
|
||||
//update model's transform from animated bone
|
||||
RenderableModel bmodel = null;
|
||||
ModelBoneLinks?.TryGetValue(bone.Id, out bmodel);
|
||||
if (bmodel == null)
|
||||
{ continue; }
|
||||
|
||||
if (((bmodel.SkeletonBinding >> 8) & 0xFF) > 0) //skin mesh? //TODO: see eg. p_oil_pjack_03_s
|
||||
{ continue; }
|
||||
|
||||
bmodel.Transform = bone.AnimTransform;
|
||||
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,7 @@ namespace CodeWalker.Rendering
|
||||
|
||||
VertexShader basicvspnct;
|
||||
VertexShader basicvspnctt;
|
||||
VertexShader basicvspncttt;
|
||||
VertexShader basicvspncct;
|
||||
VertexShader basicvspncctt;
|
||||
VertexShader basicvspnccttt;
|
||||
@ -131,6 +132,13 @@ namespace CodeWalker.Rendering
|
||||
VertexShader basicvspnccttx;
|
||||
VertexShader basicvspnctttx;
|
||||
VertexShader basicvspncctttx;
|
||||
VertexShader basicvspbbnct;
|
||||
VertexShader basicvspbbnctx;
|
||||
VertexShader basicvspbbnctt;
|
||||
VertexShader basicvspbbncttt;
|
||||
VertexShader basicvspbbncct;
|
||||
VertexShader basicvspbbncctx;
|
||||
VertexShader basicvspbbncttx;
|
||||
VertexShader basicvsbox;
|
||||
VertexShader basicvssphere;
|
||||
VertexShader basicvscapsule;
|
||||
@ -144,6 +152,7 @@ namespace CodeWalker.Rendering
|
||||
GpuVarsBuffer<BasicShaderPSGeomVars> PSGeomVars;
|
||||
GpuVarsBuffer<BasicShaderInstGlobals> InstGlobalVars;
|
||||
GpuVarsBuffer<BasicShaderInstLocals> InstLocalVars;
|
||||
GpuABuffer<Matrix3_s> BoneMatrices;
|
||||
SamplerState texsampler;
|
||||
SamplerState texsampleranis;
|
||||
SamplerState texsamplertnt;
|
||||
@ -172,6 +181,7 @@ namespace CodeWalker.Rendering
|
||||
{
|
||||
byte[] vspnctbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCT.cso");
|
||||
byte[] vspncttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTT.cso");
|
||||
byte[] vspnctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTTT.cso");
|
||||
byte[] vspncctbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCT.cso");
|
||||
byte[] vspnccttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTT.cso");
|
||||
byte[] vspncctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTTT.cso");
|
||||
@ -181,6 +191,15 @@ namespace CodeWalker.Rendering
|
||||
byte[] vspnccttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTTX.cso");
|
||||
byte[] vspnctttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTTTX.cso");
|
||||
byte[] vspncctttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTTTX.cso");
|
||||
|
||||
byte[] vspbbnctbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCT.cso");
|
||||
byte[] vspbbnctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTX.cso");
|
||||
byte[] vspbbncttbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTT.cso");
|
||||
byte[] vspbbnctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTT.cso");
|
||||
byte[] vspbbncctbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCT.cso");
|
||||
byte[] vspbbncctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCTX.cso");
|
||||
byte[] vspbbncttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTX.cso");
|
||||
|
||||
byte[] vsboxbytes = File.ReadAllBytes("Shaders\\BasicVS_Box.cso");
|
||||
byte[] vsspherebytes = File.ReadAllBytes("Shaders\\BasicVS_Sphere.cso");
|
||||
byte[] vscapsulebytes = File.ReadAllBytes("Shaders\\BasicVS_Capsule.cso");
|
||||
@ -189,6 +208,7 @@ namespace CodeWalker.Rendering
|
||||
|
||||
basicvspnct = new VertexShader(device, vspnctbytes);
|
||||
basicvspnctt = new VertexShader(device, vspncttbytes);
|
||||
basicvspncttt = new VertexShader(device, vspnctttbytes);
|
||||
basicvspncct = new VertexShader(device, vspncctbytes);
|
||||
basicvspncctt = new VertexShader(device, vspnccttbytes);
|
||||
basicvspnccttt = new VertexShader(device, vspncctttbytes);
|
||||
@ -198,6 +218,13 @@ namespace CodeWalker.Rendering
|
||||
basicvspnccttx = new VertexShader(device, vspnccttxbytes);
|
||||
basicvspnctttx = new VertexShader(device, vspnctttxbytes);
|
||||
basicvspncctttx = new VertexShader(device, vspncctttxbytes);
|
||||
basicvspbbnct = new VertexShader(device, vspbbnctbytes);
|
||||
basicvspbbnctx = new VertexShader(device, vspbbnctxbytes);
|
||||
basicvspbbnctt = new VertexShader(device, vspbbncttbytes);
|
||||
basicvspbbncttt = new VertexShader(device, vspbbnctttbytes);
|
||||
basicvspbbncct = new VertexShader(device, vspbbncctbytes);
|
||||
basicvspbbncctx = new VertexShader(device, vspbbncctxbytes);
|
||||
basicvspbbncttx = new VertexShader(device, vspbbncttxbytes);
|
||||
basicvsbox = new VertexShader(device, vsboxbytes);
|
||||
basicvssphere = new VertexShader(device, vsspherebytes);
|
||||
basicvscapsule = new VertexShader(device, vscapsulebytes);
|
||||
@ -212,49 +239,47 @@ namespace CodeWalker.Rendering
|
||||
PSGeomVars = new GpuVarsBuffer<BasicShaderPSGeomVars>(device);
|
||||
InstGlobalVars = new GpuVarsBuffer<BasicShaderInstGlobals>(device);
|
||||
InstLocalVars = new GpuVarsBuffer<BasicShaderInstLocals>(device);
|
||||
BoneMatrices = new GpuABuffer<Matrix3_s>(device, 255);
|
||||
|
||||
InitInstGlobalVars();
|
||||
|
||||
|
||||
//supported layouts - requires Position, Normal, Colour, Texcoord
|
||||
layouts.Add(VertexType.Default, new InputLayout(device, vspnctbytes, VertexTypeDefault.GetLayout()));
|
||||
layouts.Add(VertexType.PNCH2, new InputLayout(device, vspnctbytes, VertexTypePNCH2.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCT, new InputLayout(device, vspnctbytes, VertexTypePBBNCT.GetLayout()));
|
||||
|
||||
layouts.Add(VertexType.PNCH2, new InputLayout(device, vspnctbytes, VertexTypePNCH2.GetLayout()));//TODO?
|
||||
layouts.Add(VertexType.PNCTT, new InputLayout(device, vspncttbytes, VertexTypePNCTT.GetLayout()));
|
||||
layouts.Add(VertexType.PNCTTT, new InputLayout(device, vspncttbytes, VertexTypePNCTTT.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTT, new InputLayout(device, vspncttbytes, VertexTypePBBNCTT.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTTT, new InputLayout(device, vspncttbytes, VertexTypePBBNCTTT.GetLayout()));
|
||||
|
||||
layouts.Add(VertexType.PNCTTT, new InputLayout(device, vspnctttbytes, VertexTypePNCTTT.GetLayout()));
|
||||
layouts.Add(VertexType.PNCCT, new InputLayout(device, vspncctbytes, VertexTypePNCCT.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCCT, new InputLayout(device, vspncctbytes, VertexTypePBBNCCT.GetLayout()));
|
||||
|
||||
layouts.Add(VertexType.PNCCTT, new InputLayout(device, vspnccttbytes, VertexTypePNCCTT.GetLayout()));
|
||||
|
||||
layouts.Add(VertexType.PNCCTTTT, new InputLayout(device, vspncctttbytes, VertexTypePNCCTTTT.GetLayout()));
|
||||
layouts.Add(VertexType.PNCCTTTT, new InputLayout(device, vspncctttbytes, VertexTypePNCCTTTT.GetLayout()));//TODO..?
|
||||
|
||||
|
||||
|
||||
//normalmap layouts - requires Position, Normal, Colour, Texcoord, Tangent (X)
|
||||
layouts.Add(VertexType.DefaultEx, new InputLayout(device, vspnctxbytes, VertexTypeDefaultEx.GetLayout()));
|
||||
layouts.Add(VertexType.PCCH2H4, new InputLayout(device, vspnctxbytes, VertexTypePCCH2H4.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTX, new InputLayout(device, vspnctxbytes, VertexTypePBBNCTX.GetLayout()));
|
||||
|
||||
layouts.Add(VertexType.PNCCTX, new InputLayout(device, vspncctxbytes, VertexTypePNCCTX.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCCTX, new InputLayout(device, vspncctxbytes, VertexTypePBBNCCTX.GetLayout()));
|
||||
|
||||
layouts.Add(VertexType.PNCTTX, new InputLayout(device, vspncttxbytes, VertexTypePNCTTX.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTTX, new InputLayout(device, vspncttxbytes, VertexTypePBBNCTTX.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTTTX, new InputLayout(device, vspncttxbytes, VertexTypePBBNCTTTX.GetLayout()));
|
||||
|
||||
layouts.Add(VertexType.PNCCTTX, new InputLayout(device, vspnccttxbytes, VertexTypePNCCTTX.GetLayout()));
|
||||
layouts.Add(VertexType.PNCCTTX_2, new InputLayout(device, vspnccttxbytes, VertexTypePNCCTTX_2.GetLayout()));
|
||||
layouts.Add(VertexType.PNCTTTX, new InputLayout(device, vspnctttxbytes, VertexTypePNCTTTX.GetLayout()));
|
||||
layouts.Add(VertexType.PNCTTTX_2, new InputLayout(device, vspnctttxbytes, VertexTypePNCTTTX_2.GetLayout()));
|
||||
layouts.Add(VertexType.PNCTTTX_3, new InputLayout(device, vspnctttxbytes, VertexTypePNCTTTX_3.GetLayout()));
|
||||
layouts.Add(VertexType.PNCTTTTX, new InputLayout(device, vspnctttxbytes, VertexTypePNCTTTTX.GetLayout()));
|
||||
layouts.Add(VertexType.PNCTTTTX, new InputLayout(device, vspnctttxbytes, VertexTypePNCTTTTX.GetLayout()));//TODO
|
||||
layouts.Add(VertexType.PNCCTTTX, new InputLayout(device, vspncctttxbytes, VertexTypePNCCTTTX.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCCTTX, new InputLayout(device, vspnccttxbytes, VertexTypePBBNCCTTX.GetLayout()));
|
||||
|
||||
|
||||
|
||||
//skinned layouts
|
||||
layouts.Add(VertexType.PBBNCT, new InputLayout(device, vspbbnctbytes, VertexTypePBBNCT.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTX, new InputLayout(device, vspbbnctxbytes, VertexTypePBBNCTX.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTT, new InputLayout(device, vspbbncttbytes, VertexTypePBBNCTT.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTTT, new InputLayout(device, vspbbnctttbytes, VertexTypePBBNCTTT.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCCT, new InputLayout(device, vspbbncctbytes, VertexTypePBBNCCT.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCCTX, new InputLayout(device, vspbbncctxbytes, VertexTypePBBNCCTX.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTTX, new InputLayout(device, vspbbncttxbytes, VertexTypePBBNCTTX.GetLayout()));
|
||||
layouts.Add(VertexType.PBBNCTTTX, new InputLayout(device, vspbbncttxbytes, VertexTypePBBNCTTTX.GetLayout()));//TODO
|
||||
layouts.Add(VertexType.PBBNCCTTX, new InputLayout(device, vspbbncctxbytes, VertexTypePBBNCCTTX.GetLayout()));//TODO
|
||||
|
||||
|
||||
|
||||
@ -366,17 +391,15 @@ namespace CodeWalker.Rendering
|
||||
{
|
||||
case VertexType.Default:
|
||||
case VertexType.PNCH2:
|
||||
case VertexType.PBBNCT:
|
||||
vs = basicvspnct;
|
||||
break;
|
||||
case VertexType.PNCTT:
|
||||
case VertexType.PNCTTT:
|
||||
case VertexType.PBBNCTT:
|
||||
case VertexType.PBBNCTTT:
|
||||
vs = basicvspnctt;
|
||||
break;
|
||||
case VertexType.PNCTTT:
|
||||
vs = basicvspncttt;
|
||||
break;
|
||||
case VertexType.PNCCT:
|
||||
case VertexType.PBBNCCT:
|
||||
vs = basicvspncct;
|
||||
break;
|
||||
case VertexType.PNCCTT://not used?
|
||||
@ -387,23 +410,16 @@ namespace CodeWalker.Rendering
|
||||
break;
|
||||
case VertexType.DefaultEx:
|
||||
case VertexType.PCCH2H4:
|
||||
case VertexType.PBBNCTX:
|
||||
vs = basicvspnctx;
|
||||
break;
|
||||
|
||||
case VertexType.PBBNCCTX:
|
||||
case VertexType.PNCCTX:
|
||||
vs = basicvspncctx;
|
||||
break;
|
||||
|
||||
case VertexType.PNCTTX:
|
||||
case VertexType.PBBNCTTX:
|
||||
vs = basicvspncttx;
|
||||
break;
|
||||
|
||||
case VertexType.PNCCTTX://not used?
|
||||
case VertexType.PNCCTTX_2://not used?
|
||||
case VertexType.PBBNCCTTX://not used?
|
||||
vs = basicvspnccttx;
|
||||
break;
|
||||
|
||||
@ -411,7 +427,6 @@ namespace CodeWalker.Rendering
|
||||
case VertexType.PNCTTTX_2:
|
||||
case VertexType.PNCTTTX_3:
|
||||
case VertexType.PNCTTTTX: //not using last texcoords!
|
||||
case VertexType.PBBNCTTTX:
|
||||
vs = basicvspnctttx;
|
||||
break;
|
||||
|
||||
@ -419,6 +434,34 @@ namespace CodeWalker.Rendering
|
||||
vs = basicvspncctttx;
|
||||
break;
|
||||
|
||||
case VertexType.PBBNCT:
|
||||
vs = basicvspbbnct;
|
||||
break;
|
||||
case VertexType.PBBNCTT:
|
||||
vs = basicvspbbnctt;
|
||||
break;
|
||||
case VertexType.PBBNCTTT:
|
||||
vs = basicvspbbncttt;
|
||||
break;
|
||||
case VertexType.PBBNCCT:
|
||||
vs = basicvspbbncct;
|
||||
break;
|
||||
case VertexType.PBBNCTX:
|
||||
vs = basicvspbbnctx;
|
||||
break;
|
||||
case VertexType.PBBNCCTX:
|
||||
vs = basicvspbbncctx;
|
||||
break;
|
||||
case VertexType.PBBNCTTX:
|
||||
vs = basicvspbbncttx;
|
||||
break;
|
||||
case VertexType.PBBNCCTTX://not used?
|
||||
vs = basicvspbbncctx;//TODO
|
||||
break;
|
||||
case VertexType.PBBNCTTTX:
|
||||
vs = basicvspbbncttx;//TODO
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -514,6 +557,14 @@ namespace CodeWalker.Rendering
|
||||
|
||||
public override void SetModelVars(DeviceContext context, RenderableModel model)
|
||||
{
|
||||
if (((model.SkeletonBinding >> 8) & 0xFF) > 0)
|
||||
{
|
||||
if (model.Owner.BoneTransforms != null)
|
||||
{
|
||||
SetBoneMatrices(context, model.Owner.BoneTransforms);
|
||||
}
|
||||
}
|
||||
|
||||
if (!model.UseTransform) return;
|
||||
VSModelVars.Vars.Transform = Matrix.Transpose(model.Transform);
|
||||
VSModelVars.Update(context);
|
||||
@ -730,6 +781,12 @@ namespace CodeWalker.Rendering
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBoneMatrices(DeviceContext context, Matrix3_s[] matrices)
|
||||
{
|
||||
BoneMatrices.Update(context, matrices);
|
||||
BoneMatrices.SetVSCBuffer(context, 7);
|
||||
}
|
||||
|
||||
|
||||
public void SetInstanceVars(DeviceContext context, RenderableInstanceBatch batch)
|
||||
{
|
||||
@ -920,10 +977,12 @@ namespace CodeWalker.Rendering
|
||||
PSGeomVars.Dispose();
|
||||
InstGlobalVars.Dispose();
|
||||
InstLocalVars.Dispose();
|
||||
BoneMatrices.Dispose();
|
||||
|
||||
basicps.Dispose();
|
||||
basicvspnct.Dispose();
|
||||
basicvspnctt.Dispose();
|
||||
basicvspncttt.Dispose();
|
||||
basicvspncct.Dispose();
|
||||
basicvspncctt.Dispose();
|
||||
basicvspnccttt.Dispose();
|
||||
@ -933,6 +992,13 @@ namespace CodeWalker.Rendering
|
||||
basicvspnccttx.Dispose();
|
||||
basicvspnctttx.Dispose();
|
||||
basicvspncctttx.Dispose();
|
||||
basicvspbbnct.Dispose();
|
||||
basicvspbbnctx.Dispose();
|
||||
basicvspbbnctt.Dispose();
|
||||
basicvspbbncttt.Dispose();
|
||||
basicvspbbncct.Dispose();
|
||||
basicvspbbncctx.Dispose();
|
||||
basicvspbbncttx.Dispose();
|
||||
basicvsbox.Dispose();
|
||||
basicvssphere.Dispose();
|
||||
basicvscapsule.Dispose();
|
||||
|
@ -52,6 +52,48 @@ namespace CodeWalker.Rendering
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class GpuABuffer<T> where T : struct //Dynamic GPU buffer of items updated by CPU, for array of structs used as a constant buffer
|
||||
{
|
||||
public int StructSize;
|
||||
public int StructCount;
|
||||
public int BufferSize;
|
||||
public Buffer Buffer;
|
||||
|
||||
public GpuABuffer(Device device, int count)
|
||||
{
|
||||
StructCount = count;
|
||||
StructSize = System.Runtime.InteropServices.Marshal.SizeOf<T>();
|
||||
BufferSize = StructCount * StructSize;
|
||||
Buffer = new Buffer(device, BufferSize, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
if (Buffer != null)
|
||||
{
|
||||
Buffer.Dispose();
|
||||
Buffer = null;
|
||||
}
|
||||
}
|
||||
public void Update(DeviceContext context, T[] data)
|
||||
{
|
||||
var dataBox = context.MapSubresource(Buffer, 0, MapMode.WriteDiscard, MapFlags.None);
|
||||
Utilities.Write(dataBox.DataPointer, data, 0, data.Length);
|
||||
context.UnmapSubresource(Buffer, 0);
|
||||
}
|
||||
|
||||
public void SetVSCBuffer(DeviceContext context, int slot)
|
||||
{
|
||||
context.VertexShader.SetConstantBuffer(slot, Buffer);
|
||||
}
|
||||
public void SetPSCBuffer(DeviceContext context, int slot)
|
||||
{
|
||||
context.PixelShader.SetConstantBuffer(slot, Buffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class GpuSBuffer<T> where T : struct //for static struct data as resource view
|
||||
{
|
||||
public int StructSize;
|
||||
@ -147,6 +189,12 @@ namespace CodeWalker.Rendering
|
||||
Utilities.Write(dataBox.DataPointer, DataArray, 0, CurrentCount);
|
||||
context.UnmapSubresource(Buffer, 0);
|
||||
}
|
||||
public void Update(DeviceContext context, T[] data)
|
||||
{
|
||||
var dataBox = context.MapSubresource(Buffer, 0, MapMode.WriteDiscard, MapFlags.None);
|
||||
Utilities.Write(dataBox.DataPointer, data, 0, data.Length);
|
||||
context.UnmapSubresource(Buffer, 0);
|
||||
}
|
||||
|
||||
public void SetVSResource(DeviceContext context, int slot)
|
||||
{
|
||||
|
@ -56,7 +56,10 @@ cbuffer VSInstLocals : register(b6)
|
||||
float3 gLodFadeInstRange; // Offset: 352 Size: 12 [unused]
|
||||
uint gUseComputeShaderOutputBuffer;// Offset: 364 Size: 4
|
||||
}
|
||||
|
||||
cbuffer BoneMatrices : register(b7) //rage_bonemtx
|
||||
{
|
||||
row_major float3x4 gBoneMtx[255]; // Offset: 0 Size: 12240
|
||||
}
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
@ -254,6 +257,35 @@ float3 GetGrassInstancePosition(float3 ipos, float3 vc0, float3 vc1, uint iid)
|
||||
}
|
||||
|
||||
|
||||
float3x4 BoneMatrix(float4 weights, float4 indices)
|
||||
{
|
||||
uint4 binds = (uint4)(indices * 255.001953);
|
||||
float3x4 b0 = gBoneMtx[binds.x];
|
||||
float3x4 b1 = gBoneMtx[binds.y];
|
||||
float3x4 b2 = gBoneMtx[binds.z];
|
||||
float3x4 b3 = gBoneMtx[binds.w];
|
||||
float4 t0 = b0[0]*weights.x + b1[0]*weights.y + b2[0]*weights.z + b3[0]*weights.w;
|
||||
float4 t1 = b0[1]*weights.x + b1[1]*weights.y + b2[1]*weights.z + b3[1]*weights.w;
|
||||
float4 t2 = b0[2]*weights.x + b1[2]*weights.y + b2[2]*weights.z + b3[2]*weights.w;
|
||||
return float3x4(t0, t1, t2);
|
||||
}
|
||||
float3 BoneTransform(float3 ipos, float3x4 m)
|
||||
{
|
||||
float3 r;
|
||||
float4 p = float4(ipos, 1);
|
||||
r.x = dot(m[0], p);
|
||||
r.y = dot(m[1], p);
|
||||
r.z = dot(m[2], p);
|
||||
return r;
|
||||
}
|
||||
float3 BoneTransformNormal(float3 inorm, float3x4 m)
|
||||
{
|
||||
float3 r;
|
||||
r.x = dot(m[0].xyz, inorm);
|
||||
r.y = dot(m[1].xyz, inorm);
|
||||
r.z = dot(m[2].xyz, inorm);
|
||||
return r;
|
||||
}
|
||||
float3 ModelTransform(float3 ipos, float3 vc0, float3 vc1, uint iid)
|
||||
{
|
||||
if (IsInstanced)
|
||||
|
BIN
Shaders/BasicVS_PBBNCCT.cso
Normal file
BIN
Shaders/BasicVS_PBBNCCT.cso
Normal file
Binary file not shown.
46
Shaders/BasicVS_PBBNCCT.hlsl
Normal file
46
Shaders/BasicVS_PBBNCCT.hlsl
Normal file
@ -0,0 +1,46 @@
|
||||
#include "BasicVS.hlsli"
|
||||
|
||||
struct VS_INPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float4 BlendWeights : BLENDWEIGHTS;
|
||||
float4 BlendIndices : BLENDINDICES;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Colour1 : COLOR1;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
|
||||
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
||||
{
|
||||
VS_OUTPUT output;
|
||||
float3x4 bone = BoneMatrix(input.BlendWeights, input.BlendIndices);
|
||||
float3 bpos = BoneTransform(input.Position.xyz, bone);
|
||||
float3 opos = ModelTransform(bpos, input.Colour0.xyz, input.Colour1.xyz, iid);
|
||||
float4 cpos = ScreenTransform(opos);
|
||||
float3 bnorm = BoneTransformNormal(input.Normal, bone);
|
||||
float3 onorm = NormalTransform(bnorm);
|
||||
float3 otang = 0.5; // NormalTransform(float3(1, 0, 0)); //no tangent to use on this vertex type...
|
||||
|
||||
float4 tnt = ColourTint(input.Colour0.b, input.Colour1.b, iid); //colour tinting if enabled
|
||||
|
||||
float4 lightspacepos;
|
||||
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
|
||||
output.LightShadow = lightspacepos;
|
||||
output.Shadows = float4(shadowdepth, 0, 0, 0);
|
||||
|
||||
output.Position = cpos;
|
||||
output.CamRelPos = opos;
|
||||
output.Normal = onorm;
|
||||
output.Texcoord0 = GlobalUVAnim(input.Texcoord0);
|
||||
output.Texcoord1 = 0.5; // input.Texcoord;
|
||||
output.Texcoord2 = 0.5; // input.Texcoord;
|
||||
output.Colour0 = input.Colour0;
|
||||
output.Colour1 = input.Colour1;
|
||||
output.Tint = tnt;
|
||||
output.Tangent = float4(otang, 1);
|
||||
output.Bitangent = float4(cross(otang, onorm), 0);
|
||||
return output;
|
||||
}
|
||||
|
BIN
Shaders/BasicVS_PBBNCCTX.cso
Normal file
BIN
Shaders/BasicVS_PBBNCCTX.cso
Normal file
Binary file not shown.
49
Shaders/BasicVS_PBBNCCTX.hlsl
Normal file
49
Shaders/BasicVS_PBBNCCTX.hlsl
Normal file
@ -0,0 +1,49 @@
|
||||
#include "BasicVS.hlsli"
|
||||
|
||||
struct VS_INPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float4 BlendWeights : BLENDWEIGHTS;
|
||||
float4 BlendIndices : BLENDINDICES;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Colour1 : COLOR1;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float4 Tangent : TANGENT;
|
||||
};
|
||||
|
||||
|
||||
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
||||
{
|
||||
VS_OUTPUT output;
|
||||
float3x4 bone = BoneMatrix(input.BlendWeights, input.BlendIndices);
|
||||
float3 bpos = BoneTransform(input.Position.xyz, bone);
|
||||
float3 opos = ModelTransform(bpos, input.Colour0.xyz, input.Colour1.xyz, iid);
|
||||
float4 cpos = ScreenTransform(opos);
|
||||
float3 bnorm = BoneTransformNormal(input.Normal.xyz, bone);
|
||||
float3 btang = BoneTransformNormal(input.Tangent.xyz, bone);
|
||||
float3 onorm = NormalTransform(bnorm);
|
||||
float3 otang = NormalTransform(btang);
|
||||
|
||||
float4 tnt = ColourTint(input.Colour0.b, input.Colour1.b, iid); //colour tinting if enabled
|
||||
|
||||
float4 lightspacepos;
|
||||
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
|
||||
output.LightShadow = lightspacepos;
|
||||
output.Shadows = float4(shadowdepth, 0, 0, 0);
|
||||
|
||||
output.Position = cpos;
|
||||
output.CamRelPos = opos;
|
||||
output.Normal = onorm;
|
||||
output.Texcoord0 = GlobalUVAnim(input.Texcoord0);
|
||||
output.Texcoord1 = 0.5; // input.Texcoord;
|
||||
output.Texcoord2 = 0.5; // input.Texcoord;
|
||||
output.Colour0 = input.Colour0;
|
||||
output.Colour1 = input.Colour1;
|
||||
output.Tint = tnt;
|
||||
output.Tangent = float4(otang, input.Tangent.w);
|
||||
output.Bitangent = float4(cross(otang, onorm) * input.Tangent.w, 0);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
BIN
Shaders/BasicVS_PBBNCT.cso
Normal file
BIN
Shaders/BasicVS_PBBNCT.cso
Normal file
Binary file not shown.
45
Shaders/BasicVS_PBBNCT.hlsl
Normal file
45
Shaders/BasicVS_PBBNCT.hlsl
Normal file
@ -0,0 +1,45 @@
|
||||
#include "BasicVS.hlsli"
|
||||
|
||||
struct VS_INPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float4 BlendWeights : BLENDWEIGHTS;
|
||||
float4 BlendIndices : BLENDINDICES;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
|
||||
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
||||
{
|
||||
VS_OUTPUT output;
|
||||
float3x4 bone = BoneMatrix(input.BlendWeights, input.BlendIndices);
|
||||
float3 bpos = BoneTransform(input.Position.xyz, bone);
|
||||
float3 opos = ModelTransform(bpos, input.Colour0.xyz, input.Colour0.xyz, iid);
|
||||
float4 cpos = ScreenTransform(opos);
|
||||
float3 bnorm = BoneTransformNormal(input.Normal, bone);
|
||||
float3 onorm = NormalTransform(bnorm);
|
||||
float3 otang = 0.5; // NormalTransform(float3(1, 0, 0)); //no tangent to use on this vertex type...
|
||||
|
||||
float4 tnt = ColourTint(input.Colour0.b, 0, iid); //colour tinting if enabled
|
||||
|
||||
float4 lightspacepos;
|
||||
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
|
||||
output.LightShadow = lightspacepos;
|
||||
output.Shadows = float4(shadowdepth, 0, 0, 0);
|
||||
|
||||
output.Position = cpos;
|
||||
output.CamRelPos = opos;
|
||||
output.Normal = onorm;
|
||||
output.Texcoord0 = GlobalUVAnim(input.Texcoord0);
|
||||
output.Texcoord1 = 0.5; // input.Texcoord;
|
||||
output.Texcoord2 = 0.5; // input.Texcoord;
|
||||
output.Colour0 = input.Colour0;
|
||||
output.Colour1 = float4(0.5, 0.5, 0.5, 1); //input.Colour
|
||||
output.Tint = tnt;
|
||||
output.Tangent = float4(otang, 1);
|
||||
output.Bitangent = float4(cross(otang, onorm), 0);
|
||||
return output;
|
||||
}
|
||||
|
BIN
Shaders/BasicVS_PBBNCTT.cso
Normal file
BIN
Shaders/BasicVS_PBBNCTT.cso
Normal file
Binary file not shown.
46
Shaders/BasicVS_PBBNCTT.hlsl
Normal file
46
Shaders/BasicVS_PBBNCTT.hlsl
Normal file
@ -0,0 +1,46 @@
|
||||
#include "BasicVS.hlsli"
|
||||
|
||||
struct VS_INPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float4 BlendWeights : BLENDWEIGHTS;
|
||||
float4 BlendIndices : BLENDINDICES;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
};
|
||||
|
||||
|
||||
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
||||
{
|
||||
VS_OUTPUT output;
|
||||
float3x4 bone = BoneMatrix(input.BlendWeights, input.BlendIndices);
|
||||
float3 bpos = BoneTransform(input.Position.xyz, bone);
|
||||
float3 opos = ModelTransform(bpos, input.Colour0.xyz, input.Colour0.xyz, iid);
|
||||
float4 cpos = ScreenTransform(opos);
|
||||
float3 bnorm = BoneTransformNormal(input.Normal, bone);
|
||||
float3 onorm = NormalTransform(bnorm);
|
||||
float3 otang = 0.5; // NormalTransform(float3(1, 0, 0)); //no tangent to use on this vertex type...
|
||||
|
||||
float4 tnt = ColourTint(input.Colour0.b, 0, iid); //colour tinting if enabled
|
||||
|
||||
float4 lightspacepos;
|
||||
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
|
||||
output.LightShadow = lightspacepos;
|
||||
output.Shadows = float4(shadowdepth, 0, 0, 0);
|
||||
|
||||
output.Position = cpos;
|
||||
output.CamRelPos = opos;
|
||||
output.Normal = onorm;
|
||||
output.Texcoord0 = GlobalUVAnim(input.Texcoord0);
|
||||
output.Texcoord1 = input.Texcoord1;
|
||||
output.Texcoord2 = 0.5; // input.Texcoord;
|
||||
output.Colour0 = input.Colour0;
|
||||
output.Colour1 = float4(0.5, 0.5, 0.5, 1); //input.Colour;
|
||||
output.Tint = tnt;
|
||||
output.Tangent = float4(otang, 1);
|
||||
output.Bitangent = float4(cross(otang, onorm), 0);
|
||||
return output;
|
||||
}
|
||||
|
BIN
Shaders/BasicVS_PBBNCTTT.cso
Normal file
BIN
Shaders/BasicVS_PBBNCTTT.cso
Normal file
Binary file not shown.
47
Shaders/BasicVS_PBBNCTTT.hlsl
Normal file
47
Shaders/BasicVS_PBBNCTTT.hlsl
Normal file
@ -0,0 +1,47 @@
|
||||
#include "BasicVS.hlsli"
|
||||
|
||||
struct VS_INPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float4 BlendWeights : BLENDWEIGHTS;
|
||||
float4 BlendIndices : BLENDINDICES;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
float2 Texcoord2 : TEXCOORD2;
|
||||
};
|
||||
|
||||
|
||||
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
||||
{
|
||||
VS_OUTPUT output;
|
||||
float3x4 bone = BoneMatrix(input.BlendWeights, input.BlendIndices);
|
||||
float3 bpos = BoneTransform(input.Position.xyz, bone);
|
||||
float3 opos = ModelTransform(bpos, input.Colour0.xyz, input.Colour0.xyz, iid);
|
||||
float4 cpos = ScreenTransform(opos);
|
||||
float3 bnorm = BoneTransformNormal(input.Normal, bone);
|
||||
float3 onorm = NormalTransform(bnorm);
|
||||
float3 otang = 0.5; // NormalTransform(float3(1, 0, 0)); //no tangent to use on this vertex type...
|
||||
|
||||
float4 tnt = ColourTint(input.Colour0.b, 0, iid); //colour tinting if enabled
|
||||
|
||||
float4 lightspacepos;
|
||||
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
|
||||
output.LightShadow = lightspacepos;
|
||||
output.Shadows = float4(shadowdepth, 0, 0, 0);
|
||||
|
||||
output.Position = cpos;
|
||||
output.CamRelPos = opos;
|
||||
output.Normal = onorm;
|
||||
output.Texcoord0 = GlobalUVAnim(input.Texcoord0);
|
||||
output.Texcoord1 = input.Texcoord1;
|
||||
output.Texcoord2 = input.Texcoord2;
|
||||
output.Colour0 = input.Colour0;
|
||||
output.Colour1 = float4(0.5, 0.5, 0.5, 1); //input.Colour
|
||||
output.Tint = tnt;
|
||||
output.Tangent = float4(otang, 1);
|
||||
output.Bitangent = float4(cross(otang, onorm), 0);
|
||||
return output;
|
||||
}
|
||||
|
BIN
Shaders/BasicVS_PBBNCTTX.cso
Normal file
BIN
Shaders/BasicVS_PBBNCTTX.cso
Normal file
Binary file not shown.
47
Shaders/BasicVS_PBBNCTTX.hlsl
Normal file
47
Shaders/BasicVS_PBBNCTTX.hlsl
Normal file
@ -0,0 +1,47 @@
|
||||
#include "BasicVS.hlsli"
|
||||
|
||||
struct VS_INPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float4 BlendWeights : BLENDWEIGHTS;
|
||||
float4 BlendIndices : BLENDINDICES;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
float4 Tangent : TANGENT;
|
||||
};
|
||||
|
||||
|
||||
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
||||
{
|
||||
VS_OUTPUT output;
|
||||
float3x4 bone = BoneMatrix(input.BlendWeights, input.BlendIndices);
|
||||
float3 bpos = BoneTransform(input.Position.xyz, bone);
|
||||
float3 opos = ModelTransform(bpos, input.Colour0.xyz, input.Colour0.xyz, iid);
|
||||
float4 cpos = ScreenTransform(opos);
|
||||
float3 bnorm = BoneTransformNormal(input.Normal.xyz, bone);
|
||||
float3 btang = BoneTransformNormal(input.Tangent.xyz, bone);
|
||||
float3 onorm = NormalTransform(bnorm);
|
||||
float3 otang = NormalTransform(btang);
|
||||
|
||||
float4 tnt = ColourTint(input.Colour0.b, 0, iid); //colour tinting if enabled
|
||||
|
||||
float4 lightspacepos;
|
||||
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
|
||||
output.LightShadow = lightspacepos;
|
||||
output.Shadows = float4(shadowdepth, 0, 0, 0);
|
||||
|
||||
output.Position = cpos;
|
||||
output.CamRelPos = opos;
|
||||
output.Normal = onorm;
|
||||
output.Texcoord0 = GlobalUVAnim(input.Texcoord0);
|
||||
output.Texcoord1 = input.Texcoord1;
|
||||
output.Texcoord2 = 0.5; // input.Texcoord;
|
||||
output.Colour0 = input.Colour0;
|
||||
output.Colour1 = float4(0.5, 0.5, 0.5, 1); //input.Colour
|
||||
output.Tint = tnt;
|
||||
output.Tangent = float4(otang, input.Tangent.w);
|
||||
output.Bitangent = float4(cross(otang, onorm) * input.Tangent.w, 0);
|
||||
return output;
|
||||
}
|
BIN
Shaders/BasicVS_PBBNCTX.cso
Normal file
BIN
Shaders/BasicVS_PBBNCTX.cso
Normal file
Binary file not shown.
47
Shaders/BasicVS_PBBNCTX.hlsl
Normal file
47
Shaders/BasicVS_PBBNCTX.hlsl
Normal file
@ -0,0 +1,47 @@
|
||||
#include "BasicVS.hlsli"
|
||||
|
||||
struct VS_INPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float4 BlendWeights : BLENDWEIGHTS;
|
||||
float4 BlendIndices : BLENDINDICES;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float4 Tangent : TANGENT;
|
||||
};
|
||||
|
||||
|
||||
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
||||
{
|
||||
VS_OUTPUT output;
|
||||
float3x4 bone = BoneMatrix(input.BlendWeights, input.BlendIndices);
|
||||
float3 bpos = BoneTransform(input.Position.xyz, bone);
|
||||
float3 opos = ModelTransform(bpos, input.Colour0.xyz, input.Colour0.xyz, iid);
|
||||
float4 cpos = ScreenTransform(opos);
|
||||
float3 bnorm = BoneTransformNormal(input.Normal.xyz, bone);
|
||||
float3 btang = BoneTransformNormal(input.Tangent.xyz, bone);
|
||||
float3 onorm = NormalTransform(bnorm);
|
||||
float3 otang = NormalTransform(btang);
|
||||
|
||||
float4 tnt = ColourTint(input.Colour0.b, 0, iid); //colour tinting if enabled
|
||||
|
||||
float4 lightspacepos;
|
||||
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
|
||||
output.LightShadow = lightspacepos;
|
||||
output.Shadows = float4(shadowdepth, 0, 0, 0);
|
||||
|
||||
output.Position = cpos;
|
||||
output.CamRelPos = opos;
|
||||
output.Normal = onorm;
|
||||
output.Texcoord0 = GlobalUVAnim(input.Texcoord0);
|
||||
output.Texcoord1 = 0.5; // input.Texcoord;
|
||||
output.Texcoord2 = 0.5; // input.Texcoord;
|
||||
output.Colour0 = input.Colour0;
|
||||
output.Colour1 = float4(0.5, 0.5, 0.5, 1); //input.Colour
|
||||
output.Tint = tnt;
|
||||
output.Tangent = float4(otang, input.Tangent.w);
|
||||
output.Bitangent = float4(cross(otang, onorm) * input.Tangent.w, 0);
|
||||
return output;
|
||||
}
|
||||
|
BIN
Shaders/BasicVS_PNCTTT.cso
Normal file
BIN
Shaders/BasicVS_PNCTTT.cso
Normal file
Binary file not shown.
41
Shaders/BasicVS_PNCTTT.hlsl
Normal file
41
Shaders/BasicVS_PNCTTT.hlsl
Normal file
@ -0,0 +1,41 @@
|
||||
#include "BasicVS.hlsli"
|
||||
|
||||
struct VS_INPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
float2 Texcoord2 : TEXCOORD2;
|
||||
};
|
||||
|
||||
|
||||
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
||||
{
|
||||
VS_OUTPUT output;
|
||||
float3 opos = ModelTransform(input.Position.xyz, input.Colour0.xyz, input.Colour0.xyz, iid);
|
||||
float4 cpos = ScreenTransform(opos);
|
||||
float3 bnorm = NormalTransform(input.Normal);
|
||||
float3 btang = 0.5; // NormalTransform(float3(1, 0, 0)); //no tangent to use on this vertex type...
|
||||
|
||||
float4 tnt = ColourTint(input.Colour0.b, 0, iid); //colour tinting if enabled
|
||||
|
||||
float4 lightspacepos;
|
||||
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
|
||||
output.LightShadow = lightspacepos;
|
||||
output.Shadows = float4(shadowdepth, 0, 0, 0);
|
||||
|
||||
output.Position = cpos;
|
||||
output.CamRelPos = opos;
|
||||
output.Normal = bnorm;
|
||||
output.Texcoord0 = GlobalUVAnim(input.Texcoord0);
|
||||
output.Texcoord1 = input.Texcoord1;
|
||||
output.Texcoord2 = input.Texcoord2;
|
||||
output.Colour0 = input.Colour0;
|
||||
output.Colour1 = float4(0.5, 0.5, 0.5, 1); //input.Colour
|
||||
output.Tint = tnt;
|
||||
output.Tangent = float4(btang, 1);
|
||||
output.Bitangent = float4(cross(btang, bnorm), 0);
|
||||
return output;
|
||||
}
|
@ -150,6 +150,76 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCCT.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCCTX.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCT.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCTT.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCTTT.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCTTX.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCTX.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCCT.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
@ -206,6 +276,16 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCTTT.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCTTTX.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
|
@ -66,6 +66,14 @@
|
||||
<FxCompile Include="SkyMoonVS.hlsl" />
|
||||
<FxCompile Include="SkyMoonPS.hlsl" />
|
||||
<FxCompile Include="PathDynVS.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCTT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCTTT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCTTT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCCT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCCTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCTTX.hlsl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Quaternion.hlsli" />
|
||||
|
Loading…
Reference in New Issue
Block a user