chore: 删除未使用的资源文件
This commit is contained in:
BIN
MVS/Res/Image/earth_d.jpg
Normal file
BIN
MVS/Res/Image/earth_d.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 189 KiB |
BIN
MVS/Res/Image/head.png
Normal file
BIN
MVS/Res/Image/head.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
MVS/Res/Model/Sphere.lhsm
Normal file
BIN
MVS/Res/Model/Sphere.lhsm
Normal file
Binary file not shown.
99
MVS/Res/Shader/gs.hlsl
Normal file
99
MVS/Res/Shader/gs.hlsl
Normal file
@@ -0,0 +1,99 @@
|
||||
struct VertexData{
|
||||
float4 position:POSITION;
|
||||
float4 texcoord:TEXCOORD0;
|
||||
float4 normal:NORMAL;
|
||||
float4 tangent:TANGENT;
|
||||
};
|
||||
|
||||
struct VSOut{
|
||||
float4 position:SV_POSITION;
|
||||
float4 normal:NORMAL;
|
||||
float4 texcoord:TEXCOORD0;
|
||||
};
|
||||
|
||||
static const float PI=3.141592;
|
||||
cbuffer globalConstants:register(b0){
|
||||
float4 misc;
|
||||
};
|
||||
|
||||
Texture2D T_DiffuseTexture:register(t0);
|
||||
SamplerState samplerState:register(s0);
|
||||
|
||||
struct MaterialData{
|
||||
float r;
|
||||
};
|
||||
StructuredBuffer<MaterialData> materialData:register(t0,space1);
|
||||
cbuffer DefaultVertexCB:register(b1){
|
||||
float4x4 ProjectionMatrix;
|
||||
float4x4 ViewMatrix;
|
||||
float4x4 ModelMatrix;
|
||||
float4x4 IT_ModelMatrix;
|
||||
float4x4 ReservedMemory[1020];
|
||||
};
|
||||
|
||||
VSOut MainVS(VertexData inVertexData){
|
||||
VSOut vo;
|
||||
vo.normal=mul(IT_ModelMatrix,inVertexData.normal);
|
||||
float4 positionWS=mul(ModelMatrix,inVertexData.position);
|
||||
float4 positionVS=mul(ViewMatrix,positionWS);
|
||||
vo.position=mul(ProjectionMatrix,positionVS);
|
||||
//vo.position=float4(positionWS.xyz+vo.normal.xyz*sin(misc.x)*0.2f,1.0f);
|
||||
vo.texcoord=inVertexData.texcoord;
|
||||
return vo;
|
||||
}
|
||||
|
||||
[maxvertexcount(4)]
|
||||
void MainGS(triangle VSOut inPoint[3],uint inPrimitiveID:SV_PrimitiveID,
|
||||
inout TriangleStream<VSOut> outTriangleStream){
|
||||
outTriangleStream.Append(inPoint[0]);
|
||||
outTriangleStream.Append(inPoint[1]);
|
||||
outTriangleStream.Append(inPoint[2]);
|
||||
/*VSOut vo;
|
||||
float3 positionWS=inPoint[0].position.xyz;
|
||||
float3 N=normalize(inPoint[0].normal.xyz);
|
||||
vo.normal=float4(N,0.0f);
|
||||
float3 helperVec=abs(N.y)>0.999?float3(0.0f,0.0f,1.0f):float3(0.0f,1.0f,0.0f);
|
||||
float3 tangent=normalize(cross(N,helperVec));//u
|
||||
float3 bitangent=normalize(cross(tangent,N));//v
|
||||
float scale=materialData[inPrimitiveID].r;
|
||||
|
||||
|
||||
float3 p0WS=positionWS-(bitangent*0.5f-tangent*0.5f)*scale;//left bottom
|
||||
float4 p0VS=mul(ViewMatrix,float4(p0WS,1.0f));
|
||||
vo.position=mul(ProjectionMatrix,p0VS);
|
||||
vo.texcoord=float4(0.0f,1.0f,0.0f,0.0f);
|
||||
outTriangleStream.Append(vo);
|
||||
|
||||
float3 p1WS=positionWS-(bitangent*0.5f+tangent*0.5f)*scale;//right bottom
|
||||
float4 p1VS=mul(ViewMatrix,float4(p1WS,1.0f));
|
||||
vo.position=mul(ProjectionMatrix,p1VS);
|
||||
vo.texcoord=float4(1.0f,1.0f,0.0f,0.0f);
|
||||
outTriangleStream.Append(vo);
|
||||
|
||||
float3 p2WS=positionWS+(bitangent*0.5f+tangent*0.5f)*scale;//left top
|
||||
float4 p2VS=mul(ViewMatrix,float4(p2WS,1.0f));
|
||||
vo.position=mul(ProjectionMatrix,p2VS);
|
||||
vo.texcoord=float4(0.0f,0.0f,0.0f,0.0f);
|
||||
outTriangleStream.Append(vo);
|
||||
|
||||
float3 p3WS=positionWS+(bitangent*0.5f-tangent*0.5f)*scale;//right top
|
||||
float4 p3VS=mul(ViewMatrix,float4(p3WS,1.0f));
|
||||
vo.position=mul(ProjectionMatrix,p3VS);
|
||||
vo.texcoord=float4(1.0f,0.0f,0.0f,0.0f);
|
||||
outTriangleStream.Append(vo);*/
|
||||
|
||||
}
|
||||
|
||||
float4 MainPS(VSOut inPSInput):SV_TARGET{
|
||||
float3 N=normalize(inPSInput.normal.xyz);
|
||||
float3 bottomColor=float3(0.1f,0.4f,0.6f);
|
||||
float3 topColor=float3(0.7f,0.7f,0.7f);
|
||||
float theta=asin(N.y);//-PI/2 ~ PI/2
|
||||
theta/=PI;//-0.5~0.5
|
||||
theta+=0.5f;//0.0~1.0
|
||||
float ambientColorIntensity=1.0;
|
||||
float3 ambientColor=lerp(bottomColor,topColor,theta)*ambientColorIntensity;
|
||||
float4 diffuseColor=T_DiffuseTexture.Sample(samplerState,inPSInput.texcoord.xy);
|
||||
float3 surfaceColor=diffuseColor.rgb;
|
||||
return float4(surfaceColor,1.0f);
|
||||
}
|
||||
65
MVS/Res/Shader/ndctriangle.hlsl
Normal file
65
MVS/Res/Shader/ndctriangle.hlsl
Normal file
@@ -0,0 +1,65 @@
|
||||
struct VertexData{
|
||||
float4 position:POSITION;
|
||||
float4 texcoord:TEXCOORD0;
|
||||
float4 normal:NORMAL;
|
||||
float4 tangent:TANGENT;
|
||||
};
|
||||
|
||||
struct VSOut{
|
||||
float4 position:SV_POSITION;
|
||||
float4 normal:NORMAL;
|
||||
float4 texcoord:TEXCOORD0;
|
||||
float4 positionWS:TEXCOORD1;
|
||||
};
|
||||
|
||||
static const float PI=3.141592;
|
||||
cbuffer globalConstants:register(b0){
|
||||
float4 misc;
|
||||
};
|
||||
|
||||
cbuffer DefaultVertexCB:register(b1){
|
||||
float4x4 ProjectionMatrix;
|
||||
float4x4 ViewMatrix;
|
||||
float4x4 ModelMatrix;
|
||||
float4x4 IT_ModelMatrix;
|
||||
float4x4 ReservedMemory[1020];
|
||||
};
|
||||
|
||||
VSOut MainVS(VertexData inVertexData){
|
||||
VSOut vo;
|
||||
vo.normal=mul(IT_ModelMatrix,inVertexData.normal);
|
||||
float3 positionMS=inVertexData.position.xyz+vo.normal*sin(misc.x);
|
||||
float4 positionWS=mul(ModelMatrix,float4(positionMS,1.0));
|
||||
float4 positionVS=mul(ViewMatrix,positionWS);
|
||||
vo.position=mul(ProjectionMatrix,positionVS);
|
||||
vo.positionWS=positionWS;
|
||||
vo.texcoord=inVertexData.texcoord;
|
||||
return vo;
|
||||
}
|
||||
|
||||
float4 MainPS(VSOut inPSInput):SV_TARGET{
|
||||
float3 N=normalize(inPSInput.normal.xyz);
|
||||
float3 bottomColor=float3(0.1f,0.4f,0.6f);
|
||||
float3 topColor=float3(0.7f,0.7f,0.7f);
|
||||
float theta=asin(N.y);//-PI/2 ~ PI/2
|
||||
theta/=PI;//-0.5~0.5
|
||||
theta+=0.5f;//0.0~1.0
|
||||
float ambientColorIntensity=0.2;
|
||||
float3 ambientColor=lerp(bottomColor,topColor,theta)*ambientColorIntensity;
|
||||
float3 L=normalize(float3(1.0f,1.0f,-1.0f));
|
||||
|
||||
float diffuseIntensity=max(0.0f,dot(N,L));
|
||||
float3 diffuseLightColor=float3(0.1f,0.4f,0.6f);
|
||||
float3 diffuseColor=diffuseLightColor*diffuseIntensity;
|
||||
|
||||
float3 specularColor=float3(0.0f,0.0f,0.0f);
|
||||
if(diffuseIntensity>0.0f){
|
||||
float3 cameraPositionWS=float3(0.0f,0.0f,0.0f);
|
||||
float3 V=normalize(cameraPositionWS.xyz-inPSInput.positionWS.xyz);
|
||||
float3 R=normalize(reflect(-L,N));
|
||||
float specularIntensity=pow(max(0.0f,dot(V,R)),128.0f);
|
||||
specularColor=float3(1.0f,1.0f,1.0f)*specularIntensity;
|
||||
}
|
||||
float3 surfaceColor=ambientColor+diffuseColor+specularColor;
|
||||
return float4(surfaceColor,1.0f);
|
||||
}
|
||||
Reference in New Issue
Block a user