251111_진우
[ADD] CS로 만든 OUTPUT 버퍼를 PS에 바인딩 할 수 있도록함 [ADD] UV Slicing을 통해 애니메이션 구현 [ADD] 디졸브 , 노이즈 구현함
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -32,6 +32,13 @@ sampler BorderZeroSampler = sampler_state
|
||||
BorderColor = float4(0, 0, 0, 0);
|
||||
};
|
||||
|
||||
sampler PointSampler = sampler_state
|
||||
{
|
||||
Filter = MIN_MAG_MIP_POINT;
|
||||
AddressU = wrap;
|
||||
AddressV = wrap;
|
||||
};
|
||||
|
||||
RasterizerState RS_Default
|
||||
{
|
||||
FillMode = Solid;
|
||||
|
||||
@@ -69,16 +69,16 @@ PS_OUT_BACKBUFFER PS_OUT_LASTCOLOR(PS_IN In)
|
||||
Out.vBackBuffer.rgb = vColorTexture.rgb;
|
||||
break;
|
||||
case 2:
|
||||
Out.vBackBuffer.rgb *= vColorTexture.rgb;
|
||||
Out.vBackBuffer.rgb += vColorTexture.rgb;
|
||||
break;
|
||||
case 3:
|
||||
Out.vBackBuffer.rgb -= vColorTexture.rgb;
|
||||
break;
|
||||
case 4:
|
||||
Out.vBackBuffer.rgb /= vColorTexture.rgb;
|
||||
Out.vBackBuffer.rgb *= vColorTexture.rgb;
|
||||
break;
|
||||
case 5:
|
||||
Out.vBackBuffer.rgb += vColorTexture.rgb;
|
||||
Out.vBackBuffer.rgb /= vColorTexture.rgb;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -11,8 +11,8 @@ struct Particle
|
||||
|
||||
struct ParticleValue
|
||||
{
|
||||
float fSpeed;
|
||||
float fRotaionSpeed;
|
||||
float fSpeed;
|
||||
float fRotaionSpeed;
|
||||
|
||||
float4 vOriginRight;
|
||||
float4 vOriginUp;
|
||||
@@ -21,42 +21,34 @@ struct ParticleValue
|
||||
|
||||
float2 vMaskingUVMoveTime;
|
||||
float2 vDiffuseUVMoveTime;
|
||||
float2 vNoiseUVMoveTime;
|
||||
float2 vAniTime;
|
||||
|
||||
float2 vAniIndex;
|
||||
};
|
||||
|
||||
struct ParticleOut
|
||||
{
|
||||
float4 vRight;
|
||||
float4 vUp;
|
||||
float4 vLook;
|
||||
float4 vTranslation;
|
||||
float2 vLifeTime;
|
||||
|
||||
float2 vMaskingUVMoveTime;
|
||||
float2 vDiffuseUVMoveTime;
|
||||
float2 vAniTime;
|
||||
|
||||
float2 vAniIndex;
|
||||
|
||||
};
|
||||
|
||||
|
||||
StructuredBuffer<Particle> g_ParticleBufferInput : register(t0);
|
||||
StructuredBuffer<ParticleValue> g_ParticleValueBufferInput : register(t1);
|
||||
|
||||
RWStructuredBuffer<ParticleOut> g_ParticleBufferOutput : register(u0);
|
||||
RWStructuredBuffer<Particle> g_VBInstanceOutput : register(u0);
|
||||
RWStructuredBuffer<ParticleValue> g_ParticleValueOutput : register(u1);
|
||||
|
||||
cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함
|
||||
{
|
||||
float fTimeDelta;
|
||||
float fTimeDelta;
|
||||
|
||||
bool isLoop;
|
||||
bool isPadding1;
|
||||
bool isPadding2;
|
||||
bool isPadding3;
|
||||
|
||||
float fPadding; // 반드시 상수버퍼는 16바이트 배수로 만들어져야 한다.
|
||||
float fPadding2;
|
||||
float fPadding3;
|
||||
}
|
||||
|
||||
|
||||
//내가 몇개의 스레드를 사용할 것인지 지정하는데
|
||||
//GPU 칩의 개수를 X * Y * Z의 개수 만큼 사용하겠다는 의미이다.
|
||||
[numthreads(256, 1, 1)]
|
||||
@@ -69,8 +61,6 @@ void CS_MAIN(
|
||||
|
||||
ParticleValue particleValue = g_ParticleValueBufferInput[iIndex];
|
||||
|
||||
ParticleOut ParticleOut;
|
||||
|
||||
// 라이프타임 움직임
|
||||
particle.vTranslation.y -= particleValue.fSpeed * fTimeDelta;
|
||||
|
||||
@@ -78,6 +68,12 @@ void CS_MAIN(
|
||||
|
||||
if (particle.vLifeTime.x >= particle.vLifeTime.y)
|
||||
{
|
||||
if (isLoop == false)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
particle.vLifeTime.x = 0.f;
|
||||
particle.vTranslation.y = 0.f;
|
||||
}
|
||||
@@ -91,7 +87,7 @@ void CS_MAIN(
|
||||
{
|
||||
particleValue.vAniTime.x = 0.f;
|
||||
|
||||
particleValue.vAniIndex.x++;
|
||||
particleValue.vAniIndex.x += 1.f;
|
||||
|
||||
if (particleValue.vAniIndex.x > particleValue.vAniIndex.y) // 애니메이션에 끝에 다다랐다면
|
||||
{
|
||||
@@ -105,7 +101,7 @@ void CS_MAIN(
|
||||
|
||||
particleValue.vMaskingUVMoveTime.x += fTimeDelta;
|
||||
|
||||
if (particleValue.vMaskingUVMoveTime.x >= particleValue.vMaskingUVMoveTime.x)
|
||||
if (particleValue.vMaskingUVMoveTime.x >= particleValue.vMaskingUVMoveTime.y)
|
||||
{
|
||||
particleValue.vMaskingUVMoveTime.x = 0.f;
|
||||
}
|
||||
@@ -115,25 +111,24 @@ void CS_MAIN(
|
||||
|
||||
particleValue.vDiffuseUVMoveTime.x += fTimeDelta;
|
||||
|
||||
if (particleValue.vDiffuseUVMoveTime.x >= particleValue.vDiffuseUVMoveTime.x)
|
||||
if (particleValue.vDiffuseUVMoveTime.x >= particleValue.vDiffuseUVMoveTime.y)
|
||||
{
|
||||
particleValue.vDiffuseUVMoveTime.x = 0.f;
|
||||
}
|
||||
|
||||
//노이즈 움직임
|
||||
particleValue.vNoiseUVMoveTime.x += fTimeDelta;
|
||||
|
||||
if (particleValue.vNoiseUVMoveTime.x >= particleValue.vNoiseUVMoveTime.y)
|
||||
{
|
||||
particleValue.vNoiseUVMoveTime.x = 0.f;
|
||||
}
|
||||
|
||||
|
||||
//아웃풋 대입
|
||||
|
||||
ParticleOut.vRight = particle.vRight;
|
||||
ParticleOut.vUp = particle.vUp;
|
||||
ParticleOut.vLook = particle.vLook;
|
||||
ParticleOut.vTranslation = particle.vTranslation;
|
||||
ParticleOut.vLifeTime = particle.vLifeTime;
|
||||
g_VBInstanceOutput[iIndex] = particle;
|
||||
|
||||
ParticleOut.vMaskingUVMoveTime = particleValue.vMaskingUVMoveTime;
|
||||
ParticleOut.vDiffuseUVMoveTime = particleValue.vDiffuseUVMoveTime;
|
||||
ParticleOut.vAniTime = particleValue.vAniTime;
|
||||
ParticleOut.vAniIndex = particleValue.vAniIndex;
|
||||
|
||||
|
||||
g_ParticleBufferOutput[iIndex] = ParticleOut;
|
||||
g_ParticleValueOutput[iIndex] = particleValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ PS_OUT PS_Sptire_Sheet(PS_IN In)
|
||||
|
||||
Color = Texture;
|
||||
|
||||
if (Color.r <= 0.f)
|
||||
if (Color.r <= 0.4f)
|
||||
discard;
|
||||
|
||||
Out.vColor = Color;
|
||||
|
||||
@@ -1,19 +1,50 @@
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
|
||||
struct ParticleValue
|
||||
{
|
||||
float fSpeed;
|
||||
float fRotaionSpeed;
|
||||
|
||||
float4 vOriginRight;
|
||||
float4 vOriginUp;
|
||||
float4 vOriginLook;
|
||||
float4 vOriginTranslation;
|
||||
|
||||
float2 vMaskingUVMoveTime;
|
||||
float2 vDiffuseUVMoveTime;
|
||||
float2 vNoiseUVMoveTime;
|
||||
float2 vAniTime;
|
||||
|
||||
float2 vAniIndex;
|
||||
};
|
||||
|
||||
|
||||
matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
|
||||
|
||||
Texture2D g_DiffuseTexture;
|
||||
Texture2D g_NormalTexture;
|
||||
Texture2D g_MaskingTexture;
|
||||
Texture2D g_DissolveTexture;
|
||||
Texture2D g_NoiseTexture;
|
||||
Texture2D g_DiffuseTexture : register(t0);
|
||||
|
||||
Texture2D g_NormalTexture : register(t1);
|
||||
Texture2D g_MaskingTexture : register(t2);
|
||||
Texture2D g_DissolveTexture : register(t3);
|
||||
Texture2D g_NoiseTexture : register(t4);
|
||||
|
||||
StructuredBuffer<ParticleValue> g_ParticleValue : register(t5);
|
||||
|
||||
float4 g_vCamPosition;
|
||||
|
||||
vector g_vColor;
|
||||
|
||||
float2 g_vUVGainAmount;
|
||||
float2 g_vDiffuseUVGainAmount;
|
||||
float2 g_vMaskingUVGainAmount;
|
||||
|
||||
float2 g_vDiffuseNoiseUVGainAmount;
|
||||
float2 g_vMaskNoiseUVGainAmount;
|
||||
|
||||
float2 g_vUVCutting;
|
||||
|
||||
float g_fBlurIntensity; //블러 세기
|
||||
float g_fNoiseDistortionIntensity; // 노이즈 왜곡 세기
|
||||
|
||||
float4 g_vEmissive;
|
||||
float g_fColorOption;
|
||||
@@ -23,10 +54,13 @@ bool g_isDiffuse;
|
||||
bool g_isMasking;
|
||||
bool g_isDissolve;
|
||||
bool g_isNoise;
|
||||
bool g_isUVMove;
|
||||
|
||||
bool g_isDiffuseUVMove;
|
||||
bool g_isMaskUVMove;
|
||||
|
||||
float g_fFar;
|
||||
|
||||
|
||||
struct VS_IN
|
||||
{
|
||||
float3 vPosition : POSITION;
|
||||
@@ -52,9 +86,10 @@ struct VS_OUT
|
||||
float2 vLifeTime : TEXCOORD1;
|
||||
float4 vWorldPos : TEXCOORD2;
|
||||
float4 vProjPos : TEXCOORD3;
|
||||
uint iGPUIndex : TEXCOORD4;
|
||||
};
|
||||
|
||||
VS_OUT VS_MAIN(VS_IN In)
|
||||
VS_OUT VS_MAIN(VS_IN In, uint iGPUIndex : SV_InstanceID)
|
||||
{
|
||||
VS_OUT Out = (VS_OUT) 0;
|
||||
|
||||
@@ -80,7 +115,7 @@ VS_OUT VS_MAIN(VS_IN In)
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
Out.vLifeTime = In.vLifeTime;
|
||||
Out.vWorldPos = mul(vector(In.vPosition, 1.f), g_WorldMatrix);
|
||||
|
||||
Out.iGPUIndex = iGPUIndex;
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -95,6 +130,7 @@ struct PS_IN
|
||||
float2 vLifeTime : TEXCOORD1;
|
||||
float4 vWorldPos : TEXCOORD2;
|
||||
float4 vProjPos : TEXCOORD3;
|
||||
uint iGPUIndex : TEXCOORD4;
|
||||
};
|
||||
|
||||
struct PS_OUT
|
||||
@@ -138,18 +174,59 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
|
||||
vector vMtrlDiffuse;
|
||||
vector vMtrlMask;
|
||||
vector vMtrlNoise;
|
||||
vector vMtrlDisolve;
|
||||
vector vMtrlDissolve;
|
||||
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
|
||||
if (g_isUVMove)
|
||||
{
|
||||
vTexcoord += g_vUVGainAmount * (In.vLifeTime.x / In.vLifeTime.y);
|
||||
}
|
||||
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
|
||||
float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime;
|
||||
float2 vMaskingTime = g_ParticleValue[In.iGPUIndex].vMaskingUVMoveTime;
|
||||
float2 vNoiseUVMoveTime = g_ParticleValue[In.iGPUIndex].vNoiseUVMoveTime;
|
||||
|
||||
if (g_isDiffuse == true)
|
||||
{
|
||||
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float2 UV = In.vTexcoord; // 이미지의 UV값
|
||||
|
||||
int iTotalFrame = g_vUVCutting.x * g_vUVCutting.y; // 이미지의 최대 프레임 (몇 곱하기 몇인지)
|
||||
|
||||
int iCurrentFrame = int(fAnimIndex.x); // 현재 프레임이 어디 위치인지
|
||||
|
||||
int iFrameX = iCurrentFrame % (int) g_vUVCutting.x; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지)
|
||||
int iFrameY = iCurrentFrame / (int) g_vUVCutting.x; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지)
|
||||
|
||||
float fFreamWidth = 1.0 / g_vUVCutting.x; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
|
||||
float fFreamHeight = 1.0 / g_vUVCutting.y; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다.
|
||||
|
||||
UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 먼저 uv를 0~1이 아닌 0~fFrameWidth로 만든 다음에 한칸씩 옆으로 밀어준다.
|
||||
UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 먼저 uv를 0~1이 아닌 0~fFrameHeight로 만든 다음에 한줄씩 밑으로 내려준다.
|
||||
|
||||
|
||||
if (g_isDiffuseUVMove)
|
||||
{
|
||||
UV += (g_vDiffuseUVGainAmount / g_vUVCutting) * (vDiffuseTime.x / vDiffuseTime.y);
|
||||
}
|
||||
|
||||
/* 노이즈 */
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
float2 vNoiseUV = In.vTexcoord + (g_vDiffuseNoiseUVGainAmount) * (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y);
|
||||
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
|
||||
|
||||
//0.5f를 빼는 이유는 중심을 0으로 옮겨서 양음수 방향으로 offset을 줄수 있다.
|
||||
vMtrlNoise.rg -= 0.5f;
|
||||
|
||||
//아마 분할되었다면 noise도 분할해야할듯
|
||||
vMtrlNoise.rg /= g_vUVCutting;
|
||||
|
||||
//노이즈 텍스쳐로 uv를 왜곡함
|
||||
|
||||
UV = UV + (vMtrlNoise).rg * g_fNoiseDistortionIntensity;
|
||||
}
|
||||
|
||||
|
||||
/* 최종 색깔 */
|
||||
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV);
|
||||
|
||||
vMtrlDiffuse += g_vColor;
|
||||
|
||||
if (vMtrlDiffuse.a < 0.3f)
|
||||
discard;
|
||||
@@ -162,35 +239,48 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
|
||||
|
||||
if (g_isMasking == true)
|
||||
{
|
||||
vMtrlMask = g_MaskingTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float2 vMaskTexcoord = In.vTexcoord;
|
||||
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
|
||||
float2 vNoiseUV = In.vTexcoord + (g_vMaskNoiseUVGainAmount) * (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y);
|
||||
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
|
||||
|
||||
//노이즈 텍스쳐로 uv를 왜곡함
|
||||
vMaskTexcoord = vMaskTexcoord + (vMtrlNoise - 0.5f).rg * g_fNoiseDistortionIntensity;
|
||||
}
|
||||
|
||||
if (g_isMaskUVMove)
|
||||
{
|
||||
if (vMaskingTime.y > 0)
|
||||
vMaskTexcoord += g_vMaskingUVGainAmount * (vMaskingTime.x / vMaskingTime.y);
|
||||
}
|
||||
|
||||
vMtrlMask = g_MaskingTexture.Sample(PointSampler, vMaskTexcoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
vMtrlMask.r = 1.f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
|
||||
|
||||
if (g_isDissolve == true)
|
||||
{
|
||||
vMtrlDisolve = g_DissolveTexture.Sample(DefaultSampler, vTexcoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
vMtrlDisolve.r = 0.f;
|
||||
}
|
||||
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vTexcoord);
|
||||
}
|
||||
|
||||
|
||||
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r - vMtrlDisolve.r * (In.vLifeTime.x / In.vLifeTime.y));
|
||||
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
|
||||
discard;
|
||||
}
|
||||
|
||||
Out.vDiffuse = vMtrlDiffuse;
|
||||
|
||||
// 색깔 추가할 처리 (이미시브)
|
||||
if (vMtrlDiffuse.a >= g_fEmissiveCutAlpha )
|
||||
if (vMtrlDiffuse.a >= g_fEmissiveCutAlpha)
|
||||
Out.vColorTarget = vector(g_vEmissive.rgb, g_fColorOption / 10.f);
|
||||
else
|
||||
Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f);
|
||||
@@ -204,9 +294,10 @@ struct VS_BLUR_OUT
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
float2 vLifeTime : TEXCOORD1;
|
||||
uint iGPUIndex : TEXCOORD2;
|
||||
};
|
||||
|
||||
VS_BLUR_OUT VS_BLUR(VS_IN In)
|
||||
VS_BLUR_OUT VS_BLUR(VS_IN In, uint iGPUIndex : SV_InstanceID)
|
||||
{
|
||||
VS_BLUR_OUT Out = (VS_BLUR_OUT) 0;
|
||||
|
||||
@@ -227,7 +318,7 @@ VS_BLUR_OUT VS_BLUR(VS_IN In)
|
||||
Out.vPosition = mul(vPosition, matWVP);
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
Out.vLifeTime = In.vLifeTime;
|
||||
|
||||
Out.iGPUIndex = iGPUIndex;
|
||||
|
||||
|
||||
return Out;
|
||||
@@ -238,6 +329,7 @@ struct PS_BLUR_IN
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
float2 vLifeTime : TEXCOORD1;
|
||||
uint iGPUIndex : TEXCOORD2;
|
||||
|
||||
};
|
||||
|
||||
@@ -255,18 +347,59 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
|
||||
vector vMtrlDiffuse;
|
||||
vector vMtrlMask;
|
||||
vector vMtrlNoise;
|
||||
vector vMtrlDisolve;
|
||||
vector vMtrlDissolve;
|
||||
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
|
||||
if (g_isUVMove)
|
||||
{
|
||||
vTexcoord += g_vUVGainAmount * (In.vLifeTime.x / In.vLifeTime.y);
|
||||
}
|
||||
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
|
||||
float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime;
|
||||
float2 vMaskingTime = g_ParticleValue[In.iGPUIndex].vMaskingUVMoveTime;
|
||||
float2 vNoiseUVMoveTime = g_ParticleValue[In.iGPUIndex].vNoiseUVMoveTime;
|
||||
|
||||
if (g_isDiffuse == true)
|
||||
{
|
||||
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float2 UV = In.vTexcoord; // 이미지의 UV값
|
||||
|
||||
int iTotalFrame = g_vUVCutting.x * g_vUVCutting.y; // 이미지의 최대 프레임 (몇 곱하기 몇인지)
|
||||
|
||||
int iCurrentFrame = int(fAnimIndex.x); // 현재 프레임이 어디 위치인지
|
||||
|
||||
int iFrameX = iCurrentFrame % (int) g_vUVCutting.x; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지)
|
||||
int iFrameY = iCurrentFrame / (int) g_vUVCutting.x; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지)
|
||||
|
||||
float fFreamWidth = 1.0 / g_vUVCutting.x; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
|
||||
float fFreamHeight = 1.0 / g_vUVCutting.y; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다.
|
||||
|
||||
UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 먼저 uv를 0~1이 아닌 0~fFrameWidth로 만든 다음에 한칸씩 옆으로 밀어준다.
|
||||
UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 먼저 uv를 0~1이 아닌 0~fFrameHeight로 만든 다음에 한줄씩 밑으로 내려준다.
|
||||
|
||||
|
||||
if (g_isDiffuseUVMove)
|
||||
{
|
||||
UV += (g_vDiffuseUVGainAmount / g_vUVCutting) * (vDiffuseTime.x / vDiffuseTime.y);
|
||||
}
|
||||
|
||||
/* 노이즈 */
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
float2 vNoiseUV = In.vTexcoord + (g_vDiffuseNoiseUVGainAmount) * (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y);
|
||||
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
|
||||
|
||||
//0.5f를 빼는 이유는 중심을 0으로 옮겨서 양음수 방향으로 offset을 줄수 있다.
|
||||
vMtrlNoise.rg -= 0.5f;
|
||||
|
||||
//아마 분할되었다면 noise도 분할해야할듯
|
||||
vMtrlNoise.rg /= g_vUVCutting;
|
||||
|
||||
//노이즈 텍스쳐로 uv를 왜곡함
|
||||
|
||||
UV = UV + (vMtrlNoise).rg * g_fNoiseDistortionIntensity;
|
||||
}
|
||||
|
||||
|
||||
/* 최종 색깔 */
|
||||
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV);
|
||||
|
||||
vMtrlDiffuse += g_vColor;
|
||||
|
||||
if (vMtrlDiffuse.a < 0.3f)
|
||||
discard;
|
||||
@@ -279,30 +412,44 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
|
||||
|
||||
if (g_isMasking == true)
|
||||
{
|
||||
vMtrlMask = g_MaskingTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float2 vMaskTexcoord = In.vTexcoord;
|
||||
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
|
||||
float2 vNoiseUV = In.vTexcoord + (g_vMaskNoiseUVGainAmount) * (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y);
|
||||
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
|
||||
|
||||
//노이즈 텍스쳐로 uv를 왜곡함
|
||||
vMaskTexcoord = vMaskTexcoord + (vMtrlNoise - 0.5f).rg * g_fNoiseDistortionIntensity;
|
||||
}
|
||||
|
||||
if (g_isMaskUVMove)
|
||||
{
|
||||
if (vMaskingTime.y > 0)
|
||||
vMaskTexcoord += g_vMaskingUVGainAmount * (vMaskingTime.x / vMaskingTime.y);
|
||||
}
|
||||
|
||||
vMtrlMask = g_MaskingTexture.Sample(PointSampler, vMaskTexcoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
vMtrlMask.r = 1.f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
|
||||
|
||||
if (g_isDissolve == true)
|
||||
{
|
||||
vMtrlDisolve = g_DissolveTexture.Sample(DefaultSampler, vTexcoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
vMtrlDisolve.r = 0.f;
|
||||
}
|
||||
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vTexcoord);
|
||||
}
|
||||
|
||||
|
||||
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r - vMtrlDisolve.r * (In.vLifeTime.x / In.vLifeTime.y));
|
||||
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
|
||||
discard;
|
||||
}
|
||||
|
||||
Out.vDiffuse = vMtrlDiffuse * g_fBlurIntensity;
|
||||
|
||||
return Out;
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -32,6 +32,13 @@ sampler BorderZeroSampler = sampler_state
|
||||
BorderColor = float4(0, 0, 0, 0);
|
||||
};
|
||||
|
||||
sampler PointSampler = sampler_state
|
||||
{
|
||||
Filter = MIN_MAG_MIP_POINT;
|
||||
AddressU = wrap;
|
||||
AddressV = wrap;
|
||||
};
|
||||
|
||||
RasterizerState RS_Default
|
||||
{
|
||||
FillMode = Solid;
|
||||
|
||||
@@ -69,16 +69,16 @@ PS_OUT_BACKBUFFER PS_OUT_LASTCOLOR(PS_IN In)
|
||||
Out.vBackBuffer.rgb = vColorTexture.rgb;
|
||||
break;
|
||||
case 2:
|
||||
Out.vBackBuffer.rgb *= vColorTexture.rgb;
|
||||
Out.vBackBuffer.rgb += vColorTexture.rgb;
|
||||
break;
|
||||
case 3:
|
||||
Out.vBackBuffer.rgb -= vColorTexture.rgb;
|
||||
break;
|
||||
case 4:
|
||||
Out.vBackBuffer.rgb /= vColorTexture.rgb;
|
||||
Out.vBackBuffer.rgb *= vColorTexture.rgb;
|
||||
break;
|
||||
case 5:
|
||||
Out.vBackBuffer.rgb += vColorTexture.rgb;
|
||||
Out.vBackBuffer.rgb /= vColorTexture.rgb;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -11,8 +11,8 @@ struct Particle
|
||||
|
||||
struct ParticleValue
|
||||
{
|
||||
float fSpeed;
|
||||
float fRotaionSpeed;
|
||||
float fSpeed;
|
||||
float fRotaionSpeed;
|
||||
|
||||
float4 vOriginRight;
|
||||
float4 vOriginUp;
|
||||
@@ -21,42 +21,34 @@ struct ParticleValue
|
||||
|
||||
float2 vMaskingUVMoveTime;
|
||||
float2 vDiffuseUVMoveTime;
|
||||
float2 vNoiseUVMoveTime;
|
||||
float2 vAniTime;
|
||||
|
||||
float2 vAniIndex;
|
||||
};
|
||||
|
||||
struct ParticleOut
|
||||
{
|
||||
float4 vRight;
|
||||
float4 vUp;
|
||||
float4 vLook;
|
||||
float4 vTranslation;
|
||||
float2 vLifeTime;
|
||||
|
||||
float2 vMaskingUVMoveTime;
|
||||
float2 vDiffuseUVMoveTime;
|
||||
float2 vAniTime;
|
||||
|
||||
float2 vAniIndex;
|
||||
|
||||
};
|
||||
|
||||
|
||||
StructuredBuffer<Particle> g_ParticleBufferInput : register(t0);
|
||||
StructuredBuffer<ParticleValue> g_ParticleValueBufferInput : register(t1);
|
||||
|
||||
RWStructuredBuffer<ParticleOut> g_ParticleBufferOutput : register(u0);
|
||||
RWStructuredBuffer<Particle> g_VBInstanceOutput : register(u0);
|
||||
RWStructuredBuffer<ParticleValue> g_ParticleValueOutput : register(u1);
|
||||
|
||||
cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함
|
||||
{
|
||||
float fTimeDelta;
|
||||
float fTimeDelta;
|
||||
|
||||
bool isLoop;
|
||||
bool isPadding1;
|
||||
bool isPadding2;
|
||||
bool isPadding3;
|
||||
|
||||
float fPadding; // 반드시 상수버퍼는 16바이트 배수로 만들어져야 한다.
|
||||
float fPadding2;
|
||||
float fPadding3;
|
||||
}
|
||||
|
||||
|
||||
//내가 몇개의 스레드를 사용할 것인지 지정하는데
|
||||
//GPU 칩의 개수를 X * Y * Z의 개수 만큼 사용하겠다는 의미이다.
|
||||
[numthreads(256, 1, 1)]
|
||||
@@ -69,8 +61,6 @@ void CS_MAIN(
|
||||
|
||||
ParticleValue particleValue = g_ParticleValueBufferInput[iIndex];
|
||||
|
||||
ParticleOut ParticleOut;
|
||||
|
||||
// 라이프타임 움직임
|
||||
particle.vTranslation.y -= particleValue.fSpeed * fTimeDelta;
|
||||
|
||||
@@ -78,6 +68,12 @@ void CS_MAIN(
|
||||
|
||||
if (particle.vLifeTime.x >= particle.vLifeTime.y)
|
||||
{
|
||||
if (isLoop == false)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
particle.vLifeTime.x = 0.f;
|
||||
particle.vTranslation.y = 0.f;
|
||||
}
|
||||
@@ -91,7 +87,7 @@ void CS_MAIN(
|
||||
{
|
||||
particleValue.vAniTime.x = 0.f;
|
||||
|
||||
particleValue.vAniIndex.x++;
|
||||
particleValue.vAniIndex.x += 1.f;
|
||||
|
||||
if (particleValue.vAniIndex.x > particleValue.vAniIndex.y) // 애니메이션에 끝에 다다랐다면
|
||||
{
|
||||
@@ -105,7 +101,7 @@ void CS_MAIN(
|
||||
|
||||
particleValue.vMaskingUVMoveTime.x += fTimeDelta;
|
||||
|
||||
if (particleValue.vMaskingUVMoveTime.x >= particleValue.vMaskingUVMoveTime.x)
|
||||
if (particleValue.vMaskingUVMoveTime.x >= particleValue.vMaskingUVMoveTime.y)
|
||||
{
|
||||
particleValue.vMaskingUVMoveTime.x = 0.f;
|
||||
}
|
||||
@@ -115,25 +111,24 @@ void CS_MAIN(
|
||||
|
||||
particleValue.vDiffuseUVMoveTime.x += fTimeDelta;
|
||||
|
||||
if (particleValue.vDiffuseUVMoveTime.x >= particleValue.vDiffuseUVMoveTime.x)
|
||||
if (particleValue.vDiffuseUVMoveTime.x >= particleValue.vDiffuseUVMoveTime.y)
|
||||
{
|
||||
particleValue.vDiffuseUVMoveTime.x = 0.f;
|
||||
}
|
||||
|
||||
//노이즈 움직임
|
||||
particleValue.vNoiseUVMoveTime.x += fTimeDelta;
|
||||
|
||||
if (particleValue.vNoiseUVMoveTime.x >= particleValue.vNoiseUVMoveTime.y)
|
||||
{
|
||||
particleValue.vNoiseUVMoveTime.x = 0.f;
|
||||
}
|
||||
|
||||
|
||||
//아웃풋 대입
|
||||
|
||||
ParticleOut.vRight = particle.vRight;
|
||||
ParticleOut.vUp = particle.vUp;
|
||||
ParticleOut.vLook = particle.vLook;
|
||||
ParticleOut.vTranslation = particle.vTranslation;
|
||||
ParticleOut.vLifeTime = particle.vLifeTime;
|
||||
g_VBInstanceOutput[iIndex] = particle;
|
||||
|
||||
ParticleOut.vMaskingUVMoveTime = particleValue.vMaskingUVMoveTime;
|
||||
ParticleOut.vDiffuseUVMoveTime = particleValue.vDiffuseUVMoveTime;
|
||||
ParticleOut.vAniTime = particleValue.vAniTime;
|
||||
ParticleOut.vAniIndex = particleValue.vAniIndex;
|
||||
|
||||
|
||||
g_ParticleBufferOutput[iIndex] = ParticleOut;
|
||||
g_ParticleValueOutput[iIndex] = particleValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +1,50 @@
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
|
||||
struct ParticleValue
|
||||
{
|
||||
float fSpeed;
|
||||
float fRotaionSpeed;
|
||||
|
||||
float4 vOriginRight;
|
||||
float4 vOriginUp;
|
||||
float4 vOriginLook;
|
||||
float4 vOriginTranslation;
|
||||
|
||||
float2 vMaskingUVMoveTime;
|
||||
float2 vDiffuseUVMoveTime;
|
||||
float2 vNoiseUVMoveTime;
|
||||
float2 vAniTime;
|
||||
|
||||
float2 vAniIndex;
|
||||
};
|
||||
|
||||
|
||||
matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
|
||||
|
||||
Texture2D g_DiffuseTexture;
|
||||
Texture2D g_NormalTexture;
|
||||
Texture2D g_MaskingTexture;
|
||||
Texture2D g_DissolveTexture;
|
||||
Texture2D g_NoiseTexture;
|
||||
Texture2D g_DiffuseTexture : register(t0);
|
||||
|
||||
Texture2D g_NormalTexture : register(t1);
|
||||
Texture2D g_MaskingTexture : register(t2);
|
||||
Texture2D g_DissolveTexture : register(t3);
|
||||
Texture2D g_NoiseTexture : register(t4);
|
||||
|
||||
StructuredBuffer<ParticleValue> g_ParticleValue : register(t5);
|
||||
|
||||
float4 g_vCamPosition;
|
||||
|
||||
vector g_vColor;
|
||||
|
||||
float2 g_vUVGainAmount;
|
||||
float2 g_vDiffuseUVGainAmount;
|
||||
float2 g_vMaskingUVGainAmount;
|
||||
|
||||
float2 g_vDiffuseNoiseUVGainAmount;
|
||||
float2 g_vMaskNoiseUVGainAmount;
|
||||
|
||||
float2 g_vUVCutting;
|
||||
|
||||
float g_fBlurIntensity; //블러 세기
|
||||
float g_fNoiseDistortionIntensity; // 노이즈 왜곡 세기
|
||||
|
||||
float4 g_vEmissive;
|
||||
float g_fColorOption;
|
||||
@@ -25,27 +54,12 @@ bool g_isDiffuse;
|
||||
bool g_isMasking;
|
||||
bool g_isDissolve;
|
||||
bool g_isNoise;
|
||||
bool g_isUVMove;
|
||||
|
||||
bool g_isDiffuseUVMove;
|
||||
bool g_isMaskUVMove;
|
||||
|
||||
float g_fFar;
|
||||
|
||||
struct ParticleValue
|
||||
{
|
||||
float4 vRight;
|
||||
float4 vUp;
|
||||
float4 vLook;
|
||||
float4 vTranslation;
|
||||
float2 vLifeTime;
|
||||
|
||||
float2 vMaskingUVMoveTime;
|
||||
float2 vDiffuseUVMoveTime;
|
||||
float2 vAniTime;
|
||||
|
||||
float2 vAniIndex;
|
||||
|
||||
};
|
||||
|
||||
StructuredBuffer<ParticleValue> g_ParticleValue : register(t0);
|
||||
|
||||
struct VS_IN
|
||||
{
|
||||
@@ -75,7 +89,7 @@ struct VS_OUT
|
||||
uint iGPUIndex : TEXCOORD4;
|
||||
};
|
||||
|
||||
VS_OUT VS_MAIN(VS_IN In, uint iGPUIndex : SV_VertexID)
|
||||
VS_OUT VS_MAIN(VS_IN In, uint iGPUIndex : SV_InstanceID)
|
||||
{
|
||||
VS_OUT Out = (VS_OUT) 0;
|
||||
|
||||
@@ -160,28 +174,59 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
|
||||
vector vMtrlDiffuse;
|
||||
vector vMtrlMask;
|
||||
vector vMtrlNoise;
|
||||
vector vMtrlDisolve;
|
||||
vector vMtrlDissolve;
|
||||
|
||||
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
|
||||
float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime;
|
||||
float2 vMaskingTime = g_ParticleValue[In.iGPUIndex].vMaskingUVMoveTime;
|
||||
|
||||
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
|
||||
float2 vUVPerCell = In.vTexcoord / g_vUVCutting; //이게 한 셀당 크기
|
||||
|
||||
vTexcoord.x = vTexcoord.x * vUVPerCell.x + (fAnimIndex.x % g_vUVCutting.x) * vUVPerCell.x;
|
||||
vTexcoord.y = vTexcoord.y * vUVPerCell.y + (fAnimIndex.x / g_vUVCutting.y) * vUVPerCell.y;
|
||||
|
||||
if (g_isUVMove)
|
||||
{
|
||||
vTexcoord += (g_vUVGainAmount / g_vUVCutting) * (vDiffuseTime.x / vDiffuseTime.y);
|
||||
}
|
||||
float2 vNoiseUVMoveTime = g_ParticleValue[In.iGPUIndex].vNoiseUVMoveTime;
|
||||
|
||||
if (g_isDiffuse == true)
|
||||
{
|
||||
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float2 UV = In.vTexcoord; // 이미지의 UV값
|
||||
|
||||
int iTotalFrame = g_vUVCutting.x * g_vUVCutting.y; // 이미지의 최대 프레임 (몇 곱하기 몇인지)
|
||||
|
||||
int iCurrentFrame = int(fAnimIndex.x); // 현재 프레임이 어디 위치인지
|
||||
|
||||
int iFrameX = iCurrentFrame % (int) g_vUVCutting.x; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지)
|
||||
int iFrameY = iCurrentFrame / (int) g_vUVCutting.x; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지)
|
||||
|
||||
float fFreamWidth = 1.0 / g_vUVCutting.x; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
|
||||
float fFreamHeight = 1.0 / g_vUVCutting.y; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다.
|
||||
|
||||
UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 먼저 uv를 0~1이 아닌 0~fFrameWidth로 만든 다음에 한칸씩 옆으로 밀어준다.
|
||||
UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 먼저 uv를 0~1이 아닌 0~fFrameHeight로 만든 다음에 한줄씩 밑으로 내려준다.
|
||||
|
||||
|
||||
if (g_isDiffuseUVMove)
|
||||
{
|
||||
UV += (g_vDiffuseUVGainAmount / g_vUVCutting) * (vDiffuseTime.x / vDiffuseTime.y);
|
||||
}
|
||||
|
||||
/* 노이즈 */
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
float2 vNoiseUV = In.vTexcoord + (g_vDiffuseNoiseUVGainAmount) * (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y);
|
||||
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
|
||||
|
||||
//0.5f를 빼는 이유는 중심을 0으로 옮겨서 양음수 방향으로 offset을 줄수 있다.
|
||||
vMtrlNoise.rg -= 0.5f;
|
||||
|
||||
//아마 분할되었다면 noise도 분할해야할듯
|
||||
vMtrlNoise.rg /= g_vUVCutting;
|
||||
|
||||
//노이즈 텍스쳐로 uv를 왜곡함
|
||||
|
||||
UV = UV + (vMtrlNoise).rg * g_fNoiseDistortionIntensity;
|
||||
}
|
||||
|
||||
|
||||
/* 최종 색깔 */
|
||||
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV);
|
||||
|
||||
vMtrlDiffuse += g_vColor;
|
||||
|
||||
if (vMtrlDiffuse.a < 0.3f)
|
||||
discard;
|
||||
@@ -194,35 +239,48 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
|
||||
|
||||
if (g_isMasking == true)
|
||||
{
|
||||
vMtrlMask = g_MaskingTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float2 vMaskTexcoord = In.vTexcoord;
|
||||
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
|
||||
float2 vNoiseUV = In.vTexcoord + (g_vMaskNoiseUVGainAmount) * (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y);
|
||||
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
|
||||
|
||||
//노이즈 텍스쳐로 uv를 왜곡함
|
||||
vMaskTexcoord = vMaskTexcoord + (vMtrlNoise - 0.5f).rg * g_fNoiseDistortionIntensity;
|
||||
}
|
||||
|
||||
if (g_isMaskUVMove)
|
||||
{
|
||||
if (vMaskingTime.y > 0)
|
||||
vMaskTexcoord += g_vMaskingUVGainAmount * (vMaskingTime.x / vMaskingTime.y);
|
||||
}
|
||||
|
||||
vMtrlMask = g_MaskingTexture.Sample(PointSampler, vMaskTexcoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
vMtrlMask.r = 1.f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
|
||||
|
||||
if (g_isDissolve == true)
|
||||
{
|
||||
vMtrlDisolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
vMtrlDisolve.r = 0.f;
|
||||
}
|
||||
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
}
|
||||
|
||||
|
||||
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r - vMtrlDisolve.r * (In.vLifeTime.x / In.vLifeTime.y));
|
||||
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
|
||||
discard;
|
||||
}
|
||||
|
||||
Out.vDiffuse = vMtrlDiffuse;
|
||||
|
||||
// 색깔 추가할 처리 (이미시브)
|
||||
if (vMtrlDiffuse.a >= g_fEmissiveCutAlpha )
|
||||
if (vMtrlDiffuse.a >= g_fEmissiveCutAlpha)
|
||||
Out.vColorTarget = vector(g_vEmissive.rgb, g_fColorOption / 10.f);
|
||||
else
|
||||
Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f);
|
||||
@@ -236,9 +294,10 @@ struct VS_BLUR_OUT
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
float2 vLifeTime : TEXCOORD1;
|
||||
uint iGPUIndex : TEXCOORD2;
|
||||
};
|
||||
|
||||
VS_BLUR_OUT VS_BLUR(VS_IN In)
|
||||
VS_BLUR_OUT VS_BLUR(VS_IN In, uint iGPUIndex : SV_InstanceID)
|
||||
{
|
||||
VS_BLUR_OUT Out = (VS_BLUR_OUT) 0;
|
||||
|
||||
@@ -259,7 +318,7 @@ VS_BLUR_OUT VS_BLUR(VS_IN In)
|
||||
Out.vPosition = mul(vPosition, matWVP);
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
Out.vLifeTime = In.vLifeTime;
|
||||
|
||||
Out.iGPUIndex = iGPUIndex;
|
||||
|
||||
|
||||
return Out;
|
||||
@@ -270,6 +329,7 @@ struct PS_BLUR_IN
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
float2 vLifeTime : TEXCOORD1;
|
||||
uint iGPUIndex : TEXCOORD2;
|
||||
|
||||
};
|
||||
|
||||
@@ -287,18 +347,59 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
|
||||
vector vMtrlDiffuse;
|
||||
vector vMtrlMask;
|
||||
vector vMtrlNoise;
|
||||
vector vMtrlDisolve;
|
||||
vector vMtrlDissolve;
|
||||
|
||||
float2 vTexcoord = In.vTexcoord / g_vUVCutting;
|
||||
|
||||
if (g_isUVMove)
|
||||
{
|
||||
vTexcoord += g_vUVGainAmount / g_vUVCutting * (In.vLifeTime.x / In.vLifeTime.y);
|
||||
}
|
||||
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
|
||||
float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime;
|
||||
float2 vMaskingTime = g_ParticleValue[In.iGPUIndex].vMaskingUVMoveTime;
|
||||
float2 vNoiseUVMoveTime = g_ParticleValue[In.iGPUIndex].vNoiseUVMoveTime;
|
||||
|
||||
if (g_isDiffuse == true)
|
||||
{
|
||||
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float2 UV = In.vTexcoord; // 이미지의 UV값
|
||||
|
||||
int iTotalFrame = g_vUVCutting.x * g_vUVCutting.y; // 이미지의 최대 프레임 (몇 곱하기 몇인지)
|
||||
|
||||
int iCurrentFrame = int(fAnimIndex.x); // 현재 프레임이 어디 위치인지
|
||||
|
||||
int iFrameX = iCurrentFrame % (int) g_vUVCutting.x; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지)
|
||||
int iFrameY = iCurrentFrame / (int) g_vUVCutting.x; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지)
|
||||
|
||||
float fFreamWidth = 1.0 / g_vUVCutting.x; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
|
||||
float fFreamHeight = 1.0 / g_vUVCutting.y; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다.
|
||||
|
||||
UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 먼저 uv를 0~1이 아닌 0~fFrameWidth로 만든 다음에 한칸씩 옆으로 밀어준다.
|
||||
UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 먼저 uv를 0~1이 아닌 0~fFrameHeight로 만든 다음에 한줄씩 밑으로 내려준다.
|
||||
|
||||
|
||||
if (g_isDiffuseUVMove)
|
||||
{
|
||||
UV += (g_vDiffuseUVGainAmount / g_vUVCutting) * (vDiffuseTime.x / vDiffuseTime.y);
|
||||
}
|
||||
|
||||
/* 노이즈 */
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
float2 vNoiseUV = In.vTexcoord + (g_vDiffuseNoiseUVGainAmount) * (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y);
|
||||
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
|
||||
|
||||
//0.5f를 빼는 이유는 중심을 0으로 옮겨서 양음수 방향으로 offset을 줄수 있다.
|
||||
vMtrlNoise.rg -= 0.5f;
|
||||
|
||||
//아마 분할되었다면 noise도 분할해야할듯
|
||||
vMtrlNoise.rg /= g_vUVCutting;
|
||||
|
||||
//노이즈 텍스쳐로 uv를 왜곡함
|
||||
|
||||
UV = UV + (vMtrlNoise).rg * g_fNoiseDistortionIntensity;
|
||||
}
|
||||
|
||||
|
||||
/* 최종 색깔 */
|
||||
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV);
|
||||
|
||||
vMtrlDiffuse += g_vColor;
|
||||
|
||||
if (vMtrlDiffuse.a < 0.3f)
|
||||
discard;
|
||||
@@ -311,30 +412,44 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
|
||||
|
||||
if (g_isMasking == true)
|
||||
{
|
||||
vMtrlMask = g_MaskingTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float2 vMaskTexcoord = In.vTexcoord;
|
||||
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
|
||||
float2 vNoiseUV = In.vTexcoord + (g_vMaskNoiseUVGainAmount) * (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y);
|
||||
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
|
||||
|
||||
//노이즈 텍스쳐로 uv를 왜곡함
|
||||
vMaskTexcoord = vMaskTexcoord + (vMtrlNoise - 0.5f).rg * g_fNoiseDistortionIntensity;
|
||||
}
|
||||
|
||||
if (g_isMaskUVMove)
|
||||
{
|
||||
if (vMaskingTime.y > 0)
|
||||
vMaskTexcoord += g_vMaskingUVGainAmount * (vMaskingTime.x / vMaskingTime.y);
|
||||
}
|
||||
|
||||
vMtrlMask = g_MaskingTexture.Sample(PointSampler, vMaskTexcoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
vMtrlMask.r = 1.f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
|
||||
|
||||
if (g_isDissolve == true)
|
||||
{
|
||||
vMtrlDisolve = g_DissolveTexture.Sample(DefaultSampler, vTexcoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
vMtrlDisolve.r = 0.f;
|
||||
}
|
||||
|
||||
if (g_isNoise == true)
|
||||
{
|
||||
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vTexcoord);
|
||||
}
|
||||
|
||||
|
||||
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r - vMtrlDisolve.r * (In.vLifeTime.x / In.vLifeTime.y));
|
||||
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
|
||||
discard;
|
||||
}
|
||||
|
||||
Out.vDiffuse = vMtrlDiffuse * g_fBlurIntensity;
|
||||
|
||||
return Out;
|
||||
|
||||
Binary file not shown.
@@ -40,8 +40,9 @@ void CEditEffect::Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_pInstance_ModelCom == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
m_pInstance_ModelCom->Drop(fTimeDelta);
|
||||
|
||||
}
|
||||
|
||||
void CEditEffect::Late_Update(_float fTimeDelta)
|
||||
@@ -109,22 +110,15 @@ void CEditEffect::Describe_Entity()
|
||||
{
|
||||
//여기서 모델, 텍스쳐, 선택할 수 있도록 함
|
||||
|
||||
CInstance_Model::INSTANCE_DESC InstanceDesc = {};
|
||||
|
||||
InstanceDesc.iNumInstance = 1;
|
||||
InstanceDesc.vLifeTime = _float2(1.f, 3.f);
|
||||
InstanceDesc.vRange = _float3(0.f, 0.f, 0.f);
|
||||
InstanceDesc.vSizeMin = _float3(1.f, 1.f, 1.f);
|
||||
InstanceDesc.vSizeMax = _float3(1.f, 1.f, 1.f);
|
||||
InstanceDesc.vSpeed = _float2(0.f, 0.f);
|
||||
InstanceDesc.vAniIndex = _float2(0.f, 32.f);
|
||||
InstanceDesc.vAniTime = _float2(1.f, 3.f);
|
||||
InstanceDesc.vDiffuseUVMoveTime = _float2(1.f, 3.f);
|
||||
InstanceDesc.vMaskingUVMoveTime = _float2(1.f, 3.f);
|
||||
//트레일 만들기
|
||||
//사인 러프
|
||||
//머테리얼 바인딩
|
||||
//블러가 디졸브에 안사라짐
|
||||
//루프 빌보드
|
||||
|
||||
const char* pRenderNames[] = {"PRIORITY" , "SHADOW", "NONBLEND", "BLUR" , "NONLIGHT" ,"EFFECT", "BLEND" , "UI"};
|
||||
|
||||
int iCurrentItem = static_cast<int>(m_eRenderOrder);
|
||||
_int iCurrentItem = static_cast<_int>(m_eRenderOrder);
|
||||
|
||||
if (ImGui::Combo("Render Order", &iCurrentItem, pRenderNames, ENUM_CLASS(RENDER::END)))
|
||||
{
|
||||
@@ -136,35 +130,55 @@ void CEditEffect::Describe_Entity()
|
||||
GUI::Checkbox("Masking", &m_isMasking);
|
||||
GUI::Checkbox("Dissolve", &m_isDissolve);
|
||||
GUI::Checkbox("Noise", &m_isNoise);
|
||||
GUI::Checkbox("UVMove", &m_isUVMove);
|
||||
GUI::Checkbox("Blur", &m_isBlur);
|
||||
|
||||
|
||||
GUI::ColorEdit4("Color", (_float*)&m_vColor);
|
||||
GUI::ColorEdit4("MixColor", (_float*)&m_vColor);
|
||||
|
||||
GUI::DragFloat("BlurIntensity", &m_fBlurIntensity , 0.005f , 0.f , 1.f);
|
||||
GUI::DragFloat("EmissiveCutAlpha", &m_fEmissiveCutAlpha, 0.005f, 0.f, 1.f);
|
||||
ImGui::PushItemWidth(80);
|
||||
GUI::InputFloat2("UVCutting", (_float*)&m_vUVCutting);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
if (GUI::TreeNode("BLUR"))
|
||||
{
|
||||
ImGui::PushItemWidth(80);
|
||||
GUI::DragFloat("BlurIntensity", &m_fBlurIntensity, 0.005f, 0.f, 1.f);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
GUI::TreePop();
|
||||
}
|
||||
|
||||
|
||||
GUI::ColorEdit4("Emissive", (_float*)&m_vEmissive);
|
||||
GUI::InputFloat("ColorTargetOption", &m_fColorOption);
|
||||
GUI::InputFloat2("UVCutting", (_float*)& m_vUVCutting);
|
||||
if (GUI::TreeNode("EMISSIVE"))
|
||||
{
|
||||
const char* pCompute[] = { "EQUL" , "PLUS", "SUBSTRACT", "MULTY" , "DIV" };
|
||||
|
||||
_int iColorOption = (_int)m_fColorOption;
|
||||
|
||||
if (ImGui::Combo("OPTION", &iColorOption, pCompute, 5))
|
||||
{
|
||||
m_fColorOption = (_float)iColorOption;
|
||||
}
|
||||
|
||||
ImGui::PushItemWidth(80);
|
||||
GUI::DragFloat("EmissiveCutAlpha", &m_fEmissiveCutAlpha, 0.005f, 0.f, 1.f);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
GUI::ColorEdit4("Emissive", (_float*)&m_vEmissive);
|
||||
|
||||
|
||||
|
||||
GUI::DragFloat2("vUVGainAmount", (_float*)&m_vUVGainAmount , 0.01f);
|
||||
|
||||
|
||||
//UVMove를 각각의 텍스쳐마다 적용할 수 있어야함
|
||||
//노이즈 적용하기
|
||||
//디졸브 적용하기
|
||||
//라이프 타임에 의해서가 아닌 공용시간으로 제어해야함
|
||||
//UV잘라서 적용할 수 있도록
|
||||
GUI::TreePop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (GUI::TreeNode("MODEL"))
|
||||
{
|
||||
CInstance_Model::INSTANCE_DESC InstanceDesc = {};
|
||||
|
||||
if(m_pInstance_ModelCom != nullptr)
|
||||
InstanceDesc = m_pInstance_ModelCom->Get_EffectValue();
|
||||
|
||||
m_pGameInstance->Asset_Description<CInstance_Model>(ENUM_CLASS(LEVEL::EFFECT), "INSTANCE_MODEL", (CComponent**)&m_pInstance_ModelCom, &InstanceDesc, this);
|
||||
|
||||
if (m_pInstance_ModelCom != nullptr)
|
||||
@@ -180,6 +194,15 @@ void CEditEffect::Describe_Entity()
|
||||
{
|
||||
if (GUI::TreeNode("DIFFUSE"))
|
||||
{
|
||||
GUI::Checkbox("DiffuseUVMove", &m_isDiffuseUVMove);
|
||||
|
||||
ImGui::PushItemWidth(80);
|
||||
|
||||
GUI::DragFloat2("DiffuseUVGainAmount", (_float*)&m_vDiffuseUVGainAmount, 0.01f);
|
||||
GUI::DragFloat2("DiffuseNoiseUVGainAmount", (_float*)&m_vDiffuseNoiseUVGainAmount, 0.01f);
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "DIFFUSE_TEXTURE", (CComponent**)&m_pDiffuse_TextureCom, nullptr, this);
|
||||
|
||||
GUI::Separator(); GUI::Spacing();
|
||||
@@ -193,6 +216,14 @@ void CEditEffect::Describe_Entity()
|
||||
{
|
||||
if (GUI::TreeNode("MASKING"))
|
||||
{
|
||||
|
||||
GUI::Checkbox("MaskUVMove", &m_isMaskUVMove);
|
||||
|
||||
ImGui::PushItemWidth(80);
|
||||
GUI::DragFloat2("MaskingUVGainAmount", (_float*)&m_vMaskingUVGainAmount, 0.01f);
|
||||
GUI::DragFloat2("MaskNoiseUVGainAmount", (_float*)&m_vMaskNoiseUVGainAmount, 0.01f);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "MASKING_TEXTURE", (CComponent**)&m_pMasking_TextureCom, nullptr, this);
|
||||
|
||||
GUI::Separator(); GUI::Spacing();
|
||||
@@ -203,9 +234,9 @@ void CEditEffect::Describe_Entity()
|
||||
|
||||
if (m_isDissolve == true)
|
||||
{
|
||||
if (GUI::TreeNode("DISOLVE"))
|
||||
if (GUI::TreeNode("DISSOLVE"))
|
||||
{
|
||||
m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "DISOLVE_TEXTURE", (CComponent**)&m_pNoise_TextureCom, &InstanceDesc, this);
|
||||
m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "DISSOLVE_TEXTURE", (CComponent**)&m_pDissolve_TextureCom, nullptr, this);
|
||||
|
||||
GUI::Separator(); GUI::Spacing();
|
||||
|
||||
@@ -217,6 +248,11 @@ void CEditEffect::Describe_Entity()
|
||||
{
|
||||
if (GUI::TreeNode("NOISE"))
|
||||
{
|
||||
ImGui::PushItemWidth(80);
|
||||
GUI::DragFloat("NoiseDistortionIntensity", &m_fNoiseDistortionIntensity, 0.005f, 0.f, 1.f);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
|
||||
m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "NOISE_TEXTURE", (CComponent**)&m_pNoise_TextureCom, nullptr, this);
|
||||
|
||||
GUI::Separator(); GUI::Spacing();
|
||||
|
||||
@@ -39,18 +39,18 @@ HRESULT CEffectObject::Render()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pInstance_ModelCom->Bind_CS_Output(5, 1)))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
if (FAILED(m_pInstance_ModelCom->Render(i)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//¹ÙÀεùÇÑ ¹öÆÛ ÃʱâÈ
|
||||
|
||||
ID3D11ShaderResourceView* pResetSRV[1] = { nullptr };
|
||||
m_pContext->CSSetShaderResources(0, 1, pResetSRV);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,10 @@ HRESULT CEffectObject::Render_Blur()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pInstance_ModelCom->Bind_CS_Output(5, 1)))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
if (FAILED(m_pInstance_ModelCom->Render(i)))
|
||||
{
|
||||
return E_FAIL;
|
||||
@@ -86,9 +90,11 @@ HRESULT CEffectObject::Render_Blur()
|
||||
|
||||
HRESULT CEffectObject::Bind_ShaderResources()
|
||||
{
|
||||
|
||||
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -113,7 +119,11 @@ HRESULT CEffectObject::Bind_ShaderResources()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_isUVMove", &m_isUVMove, sizeof(_bool)))) {
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_isDiffuseUVMove", &m_isDiffuseUVMove, sizeof(_bool)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_isMaskUVMove", &m_isMaskUVMove, sizeof(_bool)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -133,17 +143,32 @@ HRESULT CEffectObject::Bind_ShaderResources()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_vUVGainAmount", &m_vUVGainAmount, sizeof(_float2)))) {
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fNoiseDistortionIntensity", &m_fNoiseDistortionIntensity, sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_vDiffuseUVGainAmount", &m_vDiffuseUVGainAmount, sizeof(_float2)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_vMaskingUVGainAmount", &m_vMaskingUVGainAmount, sizeof(_float2)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_vDiffuseNoiseUVGainAmount", &m_vDiffuseNoiseUVGainAmount, sizeof(_float2)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_vMaskNoiseUVGainAmount", &m_vMaskNoiseUVGainAmount, sizeof(_float2)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_vUVCutting", &m_vUVCutting, sizeof(_float2)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(FAILED(m_pInstance_ModelCom->Bind_CS_Output(0)))
|
||||
return E_FAIL;
|
||||
|
||||
if (m_pDiffuse_TextureCom != nullptr)
|
||||
{
|
||||
if (FAILED(m_pDiffuse_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_DiffuseTexture", 0))) {
|
||||
@@ -165,9 +190,9 @@ HRESULT CEffectObject::Bind_ShaderResources()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pDisolve_TextureCom != nullptr)
|
||||
if (m_pDissolve_TextureCom != nullptr)
|
||||
{
|
||||
if (FAILED(m_pDisolve_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_DisolveTexture", 0))) {
|
||||
if (FAILED(m_pDissolve_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_DissolveTexture", 0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
@@ -176,6 +201,10 @@ HRESULT CEffectObject::Bind_ShaderResources()
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -213,7 +242,7 @@ void CEffectObject::Free()
|
||||
SAFE_RELEASE(m_pDiffuse_TextureCom);
|
||||
SAFE_RELEASE(m_pNoise_TextureCom);
|
||||
SAFE_RELEASE(m_pMasking_TextureCom);
|
||||
SAFE_RELEASE(m_pDisolve_TextureCom);
|
||||
SAFE_RELEASE(m_pDissolve_TextureCom);
|
||||
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pInstance_ModelCom);
|
||||
|
||||
@@ -427,7 +427,7 @@ HRESULT CLoader::Loading_For_Effect()
|
||||
Asset_FileLoad("../Bin/Resources/Models/Effect/ParticleMesh", L"Prototype_Instance_Model_", [&](_wstring wstrFileName, const _char* pFilePath) {
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::EFFECT), wstrFileName,
|
||||
CInstance_Model::Create(m_pDevice, m_pContext, pFilePath, MODEL::NONANIM, XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity(), 0))))
|
||||
CInstance_Model::Create(m_pDevice, m_pContext, pFilePath, MODEL::NONANIM, XMMatrixScaling(0.1f, 0.1f, 0.1f) * XMMatrixIdentity(), 0))))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -99,7 +99,7 @@ HRESULT CLoading_Panel::Bind_ShaderResources()
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pTextureCom->Bind_ShaderResource(m_pShaderCom, "g_Texture", 0)))
|
||||
if (FAILED(m_pDiffuse_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_Texture", 0)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ void CLoading_Panel::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pTextureCom);
|
||||
SAFE_RELEASE(m_pDiffuse_TextureCom);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pVIBufferCom);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class CEffectObject abstract : public CGameObject
|
||||
CTexture* m_pDiffuse_TextureCom = { nullptr };
|
||||
CTexture* m_pNoise_TextureCom = { nullptr };
|
||||
CTexture* m_pMasking_TextureCom = { nullptr };
|
||||
CTexture* m_pDisolve_TextureCom = { nullptr };
|
||||
CTexture* m_pDissolve_TextureCom = { nullptr };
|
||||
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CInstance_Model* m_pInstance_ModelCom = { nullptr };
|
||||
@@ -42,19 +42,26 @@ class CEffectObject abstract : public CGameObject
|
||||
protected:
|
||||
_float4 m_vColor = { 0.f ,0.f ,0.f ,1.f };
|
||||
|
||||
_float2 m_vUVGainAmount = {};
|
||||
_float2 m_vDiffuseUVGainAmount = {};
|
||||
_float2 m_vMaskingUVGainAmount = {};
|
||||
|
||||
_float2 m_vDiffuseNoiseUVGainAmount = {};
|
||||
_float2 m_vMaskNoiseUVGainAmount = {};
|
||||
|
||||
_float2 m_vUVCutting = {1.f ,1.f};
|
||||
|
||||
_bool m_isDiffuse = {};
|
||||
_bool m_isMasking = {};
|
||||
_bool m_isDissolve = {};
|
||||
_bool m_isNoise = {};
|
||||
_bool m_isUVMove = {};
|
||||
_bool m_isDiffuseUVMove = {};
|
||||
_bool m_isMaskUVMove = {};
|
||||
_bool m_isBlur = {};
|
||||
|
||||
_float4 m_vEmissive = { 0.f ,0.f ,0.f ,0.f};
|
||||
_float m_fColorOption = {};
|
||||
_float m_fBlurIntensity = {};
|
||||
_float m_fNoiseDistortionIntensity = {};
|
||||
_float m_fEmissiveCutAlpha = {};
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class CMiniMap_Panel final : public CPanelObject
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
private:
|
||||
CTexture* m_pTextureCom = { nullptr };
|
||||
CTexture* m_pDiffuse_TextureCom = { nullptr };
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CVIBuffer_Rect* m_pVIBufferCom = { nullptr };
|
||||
CGameObject* m_pMission_KeyHold = { nullptr };
|
||||
|
||||
@@ -32,6 +32,13 @@ sampler BorderZeroSampler = sampler_state
|
||||
BorderColor = float4(0, 0, 0, 0);
|
||||
};
|
||||
|
||||
sampler PointSampler = sampler_state
|
||||
{
|
||||
Filter = MIN_MAG_MIP_POINT;
|
||||
AddressU = wrap;
|
||||
AddressV = wrap;
|
||||
};
|
||||
|
||||
RasterizerState RS_Default
|
||||
{
|
||||
FillMode = Solid;
|
||||
|
||||
@@ -69,16 +69,16 @@ PS_OUT_BACKBUFFER PS_OUT_LASTCOLOR(PS_IN In)
|
||||
Out.vBackBuffer.rgb = vColorTexture.rgb;
|
||||
break;
|
||||
case 2:
|
||||
Out.vBackBuffer.rgb *= vColorTexture.rgb;
|
||||
Out.vBackBuffer.rgb += vColorTexture.rgb;
|
||||
break;
|
||||
case 3:
|
||||
Out.vBackBuffer.rgb -= vColorTexture.rgb;
|
||||
break;
|
||||
case 4:
|
||||
Out.vBackBuffer.rgb /= vColorTexture.rgb;
|
||||
Out.vBackBuffer.rgb *= vColorTexture.rgb;
|
||||
break;
|
||||
case 5:
|
||||
Out.vBackBuffer.rgb += vColorTexture.rgb;
|
||||
Out.vBackBuffer.rgb /= vColorTexture.rgb;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -11,8 +11,8 @@ struct Particle
|
||||
|
||||
struct ParticleValue
|
||||
{
|
||||
float fSpeed;
|
||||
float fRotaionSpeed;
|
||||
float fSpeed;
|
||||
float fRotaionSpeed;
|
||||
|
||||
float4 vOriginRight;
|
||||
float4 vOriginUp;
|
||||
@@ -21,42 +21,34 @@ struct ParticleValue
|
||||
|
||||
float2 vMaskingUVMoveTime;
|
||||
float2 vDiffuseUVMoveTime;
|
||||
float2 vNoiseUVMoveTime;
|
||||
float2 vAniTime;
|
||||
|
||||
float2 vAniIndex;
|
||||
};
|
||||
|
||||
struct ParticleOut
|
||||
{
|
||||
float4 vRight;
|
||||
float4 vUp;
|
||||
float4 vLook;
|
||||
float4 vTranslation;
|
||||
float2 vLifeTime;
|
||||
|
||||
float2 vMaskingUVMoveTime;
|
||||
float2 vDiffuseUVMoveTime;
|
||||
float2 vAniTime;
|
||||
|
||||
float2 vAniIndex;
|
||||
|
||||
};
|
||||
|
||||
|
||||
StructuredBuffer<Particle> g_ParticleBufferInput : register(t0);
|
||||
StructuredBuffer<ParticleValue> g_ParticleValueBufferInput : register(t1);
|
||||
|
||||
RWStructuredBuffer<ParticleOut> g_ParticleBufferOutput : register(u0);
|
||||
RWStructuredBuffer<Particle> g_VBInstanceOutput : register(u0);
|
||||
RWStructuredBuffer<ParticleValue> g_ParticleValueOutput : register(u1);
|
||||
|
||||
cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함
|
||||
{
|
||||
float fTimeDelta;
|
||||
float fTimeDelta;
|
||||
|
||||
bool isLoop;
|
||||
bool isPadding1;
|
||||
bool isPadding2;
|
||||
bool isPadding3;
|
||||
|
||||
float fPadding; // 반드시 상수버퍼는 16바이트 배수로 만들어져야 한다.
|
||||
float fPadding2;
|
||||
float fPadding3;
|
||||
}
|
||||
|
||||
|
||||
//내가 몇개의 스레드를 사용할 것인지 지정하는데
|
||||
//GPU 칩의 개수를 X * Y * Z의 개수 만큼 사용하겠다는 의미이다.
|
||||
[numthreads(256, 1, 1)]
|
||||
@@ -69,8 +61,6 @@ void CS_MAIN(
|
||||
|
||||
ParticleValue particleValue = g_ParticleValueBufferInput[iIndex];
|
||||
|
||||
ParticleOut ParticleOut;
|
||||
|
||||
// 라이프타임 움직임
|
||||
particle.vTranslation.y -= particleValue.fSpeed * fTimeDelta;
|
||||
|
||||
@@ -78,6 +68,12 @@ void CS_MAIN(
|
||||
|
||||
if (particle.vLifeTime.x >= particle.vLifeTime.y)
|
||||
{
|
||||
if (isLoop == false)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
particle.vLifeTime.x = 0.f;
|
||||
particle.vTranslation.y = 0.f;
|
||||
}
|
||||
@@ -91,7 +87,7 @@ void CS_MAIN(
|
||||
{
|
||||
particleValue.vAniTime.x = 0.f;
|
||||
|
||||
particleValue.vAniIndex.x++;
|
||||
particleValue.vAniIndex.x += 1.f;
|
||||
|
||||
if (particleValue.vAniIndex.x > particleValue.vAniIndex.y) // 애니메이션에 끝에 다다랐다면
|
||||
{
|
||||
@@ -105,7 +101,7 @@ void CS_MAIN(
|
||||
|
||||
particleValue.vMaskingUVMoveTime.x += fTimeDelta;
|
||||
|
||||
if (particleValue.vMaskingUVMoveTime.x >= particleValue.vMaskingUVMoveTime.x)
|
||||
if (particleValue.vMaskingUVMoveTime.x >= particleValue.vMaskingUVMoveTime.y)
|
||||
{
|
||||
particleValue.vMaskingUVMoveTime.x = 0.f;
|
||||
}
|
||||
@@ -115,25 +111,24 @@ void CS_MAIN(
|
||||
|
||||
particleValue.vDiffuseUVMoveTime.x += fTimeDelta;
|
||||
|
||||
if (particleValue.vDiffuseUVMoveTime.x >= particleValue.vDiffuseUVMoveTime.x)
|
||||
if (particleValue.vDiffuseUVMoveTime.x >= particleValue.vDiffuseUVMoveTime.y)
|
||||
{
|
||||
particleValue.vDiffuseUVMoveTime.x = 0.f;
|
||||
}
|
||||
|
||||
//노이즈 움직임
|
||||
particleValue.vNoiseUVMoveTime.x += fTimeDelta;
|
||||
|
||||
if (particleValue.vNoiseUVMoveTime.x >= particleValue.vNoiseUVMoveTime.y)
|
||||
{
|
||||
particleValue.vNoiseUVMoveTime.x = 0.f;
|
||||
}
|
||||
|
||||
|
||||
//아웃풋 대입
|
||||
|
||||
ParticleOut.vRight = particle.vRight;
|
||||
ParticleOut.vUp = particle.vUp;
|
||||
ParticleOut.vLook = particle.vLook;
|
||||
ParticleOut.vTranslation = particle.vTranslation;
|
||||
ParticleOut.vLifeTime = particle.vLifeTime;
|
||||
g_VBInstanceOutput[iIndex] = particle;
|
||||
|
||||
ParticleOut.vMaskingUVMoveTime = particleValue.vMaskingUVMoveTime;
|
||||
ParticleOut.vDiffuseUVMoveTime = particleValue.vDiffuseUVMoveTime;
|
||||
ParticleOut.vAniTime = particleValue.vAniTime;
|
||||
ParticleOut.vAniIndex = particleValue.vAniIndex;
|
||||
|
||||
|
||||
g_ParticleBufferOutput[iIndex] = ParticleOut;
|
||||
g_ParticleValueOutput[iIndex] = particleValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ CComputeShader::CComputeShader(ID3D11Device* pDevice, ID3D11DeviceContext* pCont
|
||||
Safe_AddRef(m_pGameInstance);
|
||||
}
|
||||
|
||||
HRESULT CComputeShader::Initialize(const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iOutputStructStride, _uint iInputStructStride[])
|
||||
HRESULT CComputeShader::Initialize(const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[])
|
||||
{
|
||||
m_iNumElement = iNumElement;
|
||||
m_iNumInputBuffer = iNumInputBuffer;
|
||||
m_iOutputStructStride = iOutputStructStride;
|
||||
m_iNumOutputBuffer = iNumOutputBuffer;
|
||||
|
||||
if (FAILED(CreateComputeShader(pShaderFilePath, pStartFunctionName)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(CreateBuffer(iNumElement, iNumInputBuffer, iInputStructStride)))
|
||||
if (FAILED(CreateBuffer(iNumElement, iInputStructStride, iOutputStructStride)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(CreateResurceViews(iNumElement, iNumInputBuffer)))
|
||||
@@ -33,7 +33,7 @@ HRESULT CComputeShader::Initialize(const _tchar* pShaderFilePath, const _char* p
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE CComputeShader::Dispatch(_uint iSRVIndex, _uint iUAVIndex, _float3 vGroupCount, ID3D11Buffer** ppBuffers, ID3D11Buffer* pConstantBuffer)
|
||||
vector<D3D11_MAPPED_SUBRESOURCE> CComputeShader::Dispatch(_uint iSRVIndex, _uint iUAVIndex, _float3 vGroupCount, ID3D11Buffer** ppBuffers, ID3D11Buffer* pConstantBuffer)
|
||||
{
|
||||
//VBBuffer-> dynamic , pConstantBuffer-> dynamic , m_pInputBuffer, m_pOutputBuffer-> default , m_pStagingBuffer-> Staging
|
||||
|
||||
@@ -47,9 +47,9 @@ D3D11_MAPPED_SUBRESOURCE CComputeShader::Dispatch(_uint iSRVIndex, _uint iUAVInd
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE PreSubResource = {};
|
||||
|
||||
m_pContext->CopyResource(m_pStagingBuffer[i], ppBuffers[i]);
|
||||
m_pContext->CopyResource(m_pInputStagingBuffer[i], ppBuffers[i]);
|
||||
|
||||
m_pContext->CopyResource(m_pInputBuffer[i], m_pStagingBuffer[i]);
|
||||
m_pContext->CopyResource(m_pInputBuffer[i], m_pInputStagingBuffer[i]);
|
||||
|
||||
}
|
||||
|
||||
@@ -71,22 +71,30 @@ D3D11_MAPPED_SUBRESOURCE CComputeShader::Dispatch(_uint iSRVIndex, _uint iUAVInd
|
||||
|
||||
//디폴트-> 스테이징 버퍼는 복사가 가능함 (다이나믹은 cpu 기반이라 복사 안됨)
|
||||
//0번 스테이징 버퍼가 아우풋 스테이징 버퍼와 같음
|
||||
m_pContext->CopyResource(m_pOutputStagingBuffer, m_pOutputBuffer);
|
||||
|
||||
//스테이징 버퍼를 열어서 카피함
|
||||
D3D11_MAPPED_SUBRESOURCE StagingSubResource = {};
|
||||
//D3D11_MAPPED_SUBRESOURCE OutSubResource = {};
|
||||
vector<D3D11_MAPPED_SUBRESOURCE> StagingSubResources = {};
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pOutputStagingBuffer, 0, D3D11_MAP_READ, 0, &StagingSubResource)))
|
||||
for (_uint i = 0; i < m_iNumOutputBuffer; i++)
|
||||
{
|
||||
|
||||
m_pContext->Unmap(m_pOutputStagingBuffer, 0);
|
||||
}
|
||||
m_pContext->CopyResource(m_pOutputStagingBuffer[i], m_pOutputBuffer[i]);
|
||||
|
||||
//스테이징 버퍼를 열어서 카피함
|
||||
D3D11_MAPPED_SUBRESOURCE StagingSubResource = {};
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pOutputStagingBuffer[i], 0, D3D11_MAP_READ, 0, &StagingSubResource)))
|
||||
{
|
||||
|
||||
StagingSubResources.push_back(StagingSubResource);
|
||||
|
||||
m_pContext->Unmap(m_pOutputStagingBuffer[i], 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reset();
|
||||
|
||||
|
||||
return StagingSubResource;
|
||||
return StagingSubResources;
|
||||
}
|
||||
|
||||
void CComputeShader::Bind_SRV(_uint iIndex)
|
||||
@@ -98,34 +106,45 @@ void CComputeShader::Bind_SRV(_uint iIndex)
|
||||
|
||||
void CComputeShader::Bind_UAV(_uint iIndex)
|
||||
{
|
||||
m_pContext->CSSetUnorderedAccessViews(iIndex, 1, &m_pOutputUAV, nullptr);
|
||||
m_pContext->CSSetUnorderedAccessViews(iIndex, m_iNumOutputBuffer, &m_pOutputUAV[0], nullptr);
|
||||
}
|
||||
|
||||
void CComputeShader::Bind_OutPut_SRV(_uint iIndex)
|
||||
void CComputeShader::Bind_OutPut_SRV(_uint iIndex , _uint iBufferIndex)
|
||||
{
|
||||
m_pContext->CSSetShaderResources(iIndex, // 시작슬롯 번호
|
||||
m_pContext->PSSetShaderResources(iIndex, // 시작슬롯 번호
|
||||
1, // 버퍼 개수
|
||||
&m_pOutputSRV); // 버퍼 시작 주소
|
||||
&m_pOutputSRV[iBufferIndex]); // 버퍼 시작 주소
|
||||
|
||||
}
|
||||
|
||||
void CComputeShader::Reset()
|
||||
{
|
||||
//다음 랜더링 패스에 연관되지 않도록 초기화
|
||||
ID3D11UnorderedAccessView* pResetUAV[1] = { nullptr };
|
||||
ID3D11ShaderResourceView* pResetSRV[2] = { nullptr, nullptr };
|
||||
|
||||
m_pContext->CSSetUnorderedAccessViews(0, 1, pResetUAV, nullptr);
|
||||
m_pContext->CSSetShaderResources(0, 2, pResetSRV);
|
||||
vector<ID3D11ShaderResourceView*> pResetSRVs = {};
|
||||
vector<ID3D11UnorderedAccessView*> pResetUAVs = {};
|
||||
|
||||
for (_uint i = 0; i < m_iNumInputBuffer; i++)
|
||||
{
|
||||
pResetSRVs.push_back(nullptr);
|
||||
}
|
||||
|
||||
for (_uint i = 0; i < m_iNumOutputBuffer; i++)
|
||||
{
|
||||
pResetUAVs.push_back(nullptr);
|
||||
}
|
||||
|
||||
m_pContext->CSSetShaderResources(0, m_iNumInputBuffer, &pResetSRVs[0]);
|
||||
m_pContext->CSSetUnorderedAccessViews(0, m_iNumOutputBuffer, &pResetUAVs[0], nullptr);
|
||||
m_pContext->CSSetShader(nullptr, nullptr, 0);
|
||||
}
|
||||
|
||||
HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iNumInputBuffer, _uint iInputStructStride[])
|
||||
HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride[], _uint iOuputStructStride[])
|
||||
{
|
||||
|
||||
//인 아웃풋 버퍼
|
||||
|
||||
|
||||
for (_uint i = 0; i < iNumInputBuffer; i++) // 인풋 버퍼를 여러개 사용할 수 있도록 만든다
|
||||
for (_uint i = 0; i < m_iNumInputBuffer; i++) // 인풋 버퍼를 여러개 사용할 수 있도록 만든다
|
||||
{
|
||||
D3D11_BUFFER_DESC InputBufferdesc = {};
|
||||
|
||||
@@ -155,14 +174,18 @@ HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iNumInputBuffer, _
|
||||
if (FAILED(m_pDevice->CreateBuffer(&StagingBufferDesc, nullptr, &pStagingBuffer)))
|
||||
return E_FAIL;
|
||||
|
||||
m_pStagingBuffer.push_back(pStagingBuffer);
|
||||
m_pInputStagingBuffer.push_back(pStagingBuffer);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//아웃풋 버퍼
|
||||
for (_uint i = 0; i < m_iNumOutputBuffer; i++)
|
||||
{
|
||||
// 아웃풋 버퍼
|
||||
|
||||
D3D11_BUFFER_DESC Bufferdesc = {};
|
||||
Bufferdesc.ByteWidth = m_iOutputStructStride * iNumElement;
|
||||
Bufferdesc.StructureByteStride = m_iOutputStructStride;
|
||||
Bufferdesc.ByteWidth = iOuputStructStride[i] * iNumElement;
|
||||
Bufferdesc.StructureByteStride = iOuputStructStride[i];
|
||||
Bufferdesc.Usage = D3D11_USAGE_DEFAULT; // 인 아웃풋 버퍼는 디폴트로 설정해야함
|
||||
Bufferdesc.CPUAccessFlags = 0; // 디폴트 버퍼는 CPU에서 Read Write가 불가능하며
|
||||
//오직 Update_SubResource를 통해서만 갱신이 가능하다.
|
||||
@@ -170,23 +193,28 @@ HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iNumInputBuffer, _
|
||||
Bufferdesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
|
||||
Bufferdesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
if(FAILED(m_pDevice->CreateBuffer(&Bufferdesc, nullptr, &m_pOutputBuffer)))
|
||||
ID3D11Buffer* pOutputBuffer = nullptr;
|
||||
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&Bufferdesc, nullptr, &pOutputBuffer)))
|
||||
return E_FAIL;
|
||||
|
||||
m_pOutputBuffer.push_back(pOutputBuffer);
|
||||
|
||||
//아웃풋 스테이징 버퍼
|
||||
D3D11_BUFFER_DESC OutPutStagingBufferDesc = {};
|
||||
OutPutStagingBufferDesc.Usage = D3D11_USAGE_STAGING; // 스테이징 버퍼
|
||||
OutPutStagingBufferDesc.ByteWidth = m_iOutputStructStride * iNumElement;
|
||||
OutPutStagingBufferDesc.StructureByteStride = m_iOutputStructStride;
|
||||
OutPutStagingBufferDesc.ByteWidth = iOuputStructStride[i] * iNumElement;
|
||||
OutPutStagingBufferDesc.StructureByteStride = iOuputStructStride[i];
|
||||
OutPutStagingBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&OutPutStagingBufferDesc, nullptr, &m_pOutputStagingBuffer)))
|
||||
ID3D11Buffer* pOutputStagingBuffer = nullptr;
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&OutPutStagingBufferDesc, nullptr, &pOutputStagingBuffer)))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
m_pOutputStagingBuffer.push_back(pOutputStagingBuffer);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -201,8 +229,8 @@ HRESULT CComputeShader::CreateResurceViews(_uint iNumElement, _uint iNumInputBuf
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.BufferEx.FirstElement = 0;
|
||||
srvDesc.BufferEx.NumElements = iNumElement;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = iNumElement;
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pInputBuffer[i], &srvDesc, &pSrv)))
|
||||
return E_FAIL;
|
||||
@@ -211,26 +239,42 @@ HRESULT CComputeShader::CreateResurceViews(_uint iNumElement, _uint iNumInputBuf
|
||||
|
||||
}
|
||||
|
||||
// UAV
|
||||
D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc = {};
|
||||
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
||||
uavDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
uavDesc.Buffer.FirstElement = 0;
|
||||
uavDesc.Buffer.NumElements = iNumElement;
|
||||
|
||||
if(FAILED(m_pDevice->CreateUnorderedAccessView(m_pOutputBuffer, &uavDesc, &m_pOutputUAV)))
|
||||
return E_FAIL;
|
||||
|
||||
//OUTPUT
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN; // StructuredBuffer는 UNKNOWN
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Buffer.NumElements = iNumElement;
|
||||
srvDesc.BufferEx.FirstElement = 0;
|
||||
for (_uint i = 0; i < m_iNumOutputBuffer; i++)
|
||||
{
|
||||
//UAV
|
||||
D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc = {};
|
||||
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
||||
uavDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
uavDesc.Buffer.FirstElement = 0;
|
||||
uavDesc.Buffer.NumElements = iNumElement;
|
||||
|
||||
ID3D11UnorderedAccessView* pOutputUAV = { nullptr };
|
||||
|
||||
if (FAILED(m_pDevice->CreateUnorderedAccessView(m_pOutputBuffer[i], &uavDesc, &pOutputUAV)))
|
||||
return E_FAIL;
|
||||
|
||||
m_pOutputUAV.push_back(pOutputUAV);
|
||||
|
||||
|
||||
//SRV
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN; // StructuredBuffer는 UNKNOWN
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Buffer.NumElements = iNumElement;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
|
||||
|
||||
ID3D11ShaderResourceView* pOutputSrv = {};
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pOutputBuffer[i], &srvDesc, &pOutputSrv)))
|
||||
return E_FAIL;
|
||||
|
||||
m_pOutputSRV.push_back(pOutputSrv);
|
||||
}
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pOutputBuffer, &srvDesc, &m_pOutputSRV)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -272,11 +316,11 @@ HRESULT CComputeShader::CreateComputeShader(const _tchar* pShaderFilePath, const
|
||||
}
|
||||
|
||||
|
||||
CComputeShader* CComputeShader::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iOutputStructStride, _uint iInputStructStride[])
|
||||
CComputeShader* CComputeShader::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[])
|
||||
{
|
||||
CComputeShader* pInstance = new CComputeShader(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize(pShaderFilePath, pStartFunctionName , iNumElement, iNumInputBuffer, iOutputStructStride, iInputStructStride)))
|
||||
if (FAILED(pInstance->Initialize(pShaderFilePath, pStartFunctionName , iNumElement, iNumInputBuffer, iNumOutputBuffer,iOutputStructStride, iInputStructStride)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CComputeShader Prototype");
|
||||
Safe_Release(pInstance);
|
||||
@@ -293,11 +337,17 @@ void CComputeShader::Free()
|
||||
{
|
||||
Safe_Release(m_pInputSRV[i]);
|
||||
Safe_Release(m_pInputBuffer[i]);
|
||||
Safe_Release(m_pStagingBuffer[i]);
|
||||
Safe_Release(m_pInputStagingBuffer[i]);
|
||||
}
|
||||
|
||||
Safe_Release(m_pOutputUAV);
|
||||
Safe_Release(m_pOutputBuffer);
|
||||
for (_uint i = 0; i < m_iNumOutputBuffer; i++)
|
||||
{
|
||||
Safe_Release(m_pOutputUAV[i]);
|
||||
Safe_Release(m_pOutputBuffer[i]);
|
||||
Safe_Release(m_pOutputSRV[i]);
|
||||
}
|
||||
|
||||
|
||||
Safe_Release(m_pComputeShader);
|
||||
Safe_Release(m_pDevice);
|
||||
Safe_Release(m_pContext);
|
||||
|
||||
@@ -89,10 +89,48 @@ HRESULT CInstance_Model::Ready_Meshes(MODEL eType, const aiScene* pAIScene, _fma
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT CInstance_Model::Change_NumInstance()
|
||||
{
|
||||
Safe_Release(m_pVBInstance);
|
||||
Safe_Release(m_pComputeShader);
|
||||
Safe_Release(m_pConstantBuffer);
|
||||
Safe_Release(m_pParticleValueBuffer);
|
||||
|
||||
//모든 버퍼를 지우고 재 생성 해야함
|
||||
|
||||
if (FAILED(Create_Instance_Buffer(&m_InstanceDesc)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(Create_SubResource_Buffer()))
|
||||
return E_FAIL;
|
||||
|
||||
//시작 시에 인스턴트 버퍼를 구성 해줌
|
||||
Instane_Buffer_ReStruct();
|
||||
|
||||
_uint CS_InputStrides[] = {
|
||||
sizeof(VTX_INSTANCE_PARTICLE),
|
||||
sizeof(CS_PARTICLE_VALUE_DESC),
|
||||
};
|
||||
|
||||
_uint CS_OutputStrides[] = {
|
||||
sizeof(VTX_INSTANCE_PARTICLE),
|
||||
sizeof(CS_PARTICLE_VALUE_DESC),
|
||||
};
|
||||
|
||||
m_pComputeShader = CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl", "CS_MAIN", m_iNumInstance, 2, 2, CS_OutputStrides, CS_InputStrides);
|
||||
|
||||
if (m_pComputeShader == nullptr)
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CInstance_Model::Create_Instance_Buffer(const INSTANCE_DESC* pDesc)
|
||||
{
|
||||
|
||||
m_InstanceDesc = *pDesc;
|
||||
if (pDesc != nullptr)
|
||||
m_InstanceDesc = *pDesc;
|
||||
|
||||
m_iNumInstance = m_InstanceDesc.iNumInstance;
|
||||
|
||||
@@ -158,8 +196,7 @@ HRESULT CInstance_Model::Initialize(void* pArg)
|
||||
|
||||
INSTANCE_DESC* pInstanceDesc = static_cast<INSTANCE_DESC*>(pArg);
|
||||
|
||||
if (pInstanceDesc == nullptr)
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
if (FAILED(Create_Instance_Buffer(pInstanceDesc)))
|
||||
return E_FAIL;
|
||||
@@ -170,13 +207,18 @@ HRESULT CInstance_Model::Initialize(void* pArg)
|
||||
//시작 시에 인스턴트 버퍼를 구성 해줌
|
||||
Instane_Buffer_ReStruct();
|
||||
|
||||
_uint CS_Strides[] = {
|
||||
_uint CS_InputStrides[] = {
|
||||
sizeof(VTX_INSTANCE_PARTICLE),
|
||||
sizeof(CS_PARTICLE_VALUE_DESC),
|
||||
};
|
||||
|
||||
_uint CS_OutputStrides[] = {
|
||||
sizeof(VTX_INSTANCE_PARTICLE),
|
||||
sizeof(CS_PARTICLE_VALUE_DESC),
|
||||
};
|
||||
|
||||
m_pComputeShader = CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl", "CS_MAIN", m_iNumInstance, 2, sizeof(CS_PARTICLE_OUT), CS_Strides);
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl", "CS_MAIN", m_iNumInstance, 2, 2, CS_OutputStrides, CS_InputStrides);
|
||||
|
||||
if (m_pComputeShader == nullptr)
|
||||
return E_FAIL;
|
||||
@@ -193,9 +235,7 @@ void CInstance_Model::Drop(_float fTimeDelta)
|
||||
CS_PARTICLE_DESC* pDesc = static_cast<CS_PARTICLE_DESC*>(ConstantSubResource.pData);
|
||||
|
||||
pDesc->fTimeDelta = fTimeDelta;
|
||||
pDesc->fPadding = 0;
|
||||
pDesc->fPadding2 = 0;
|
||||
pDesc->fPadding3 = 0;
|
||||
pDesc->isLoop = m_InstanceDesc.isLoop;
|
||||
|
||||
m_pContext->Unmap(m_pConstantBuffer, 0);
|
||||
}
|
||||
@@ -211,19 +251,31 @@ void CInstance_Model::Drop(_float fTimeDelta)
|
||||
|
||||
};
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE OutSubResource = {};
|
||||
vector<D3D11_MAPPED_SUBRESOURCE> OutSubResources = {};
|
||||
D3D11_MAPPED_SUBRESOURCE VBInstanceResource = {};
|
||||
|
||||
OutSubResource = m_pComputeShader->Dispatch(0, 0, _float3((_float)iGroupCountX, 1.f, 1.f), CSBuffers, m_pConstantBuffer);
|
||||
OutSubResources = m_pComputeShader->Dispatch(0, 0, _float3((_float)iGroupCountX, 1.f, 1.f), CSBuffers, m_pConstantBuffer);
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_DISCARD, 0, &VBInstanceResource)))
|
||||
{
|
||||
memcpy(VBInstanceResource.pData, OutSubResource.pData, m_iInstanceStride * m_InstanceDesc.iNumInstance); // 아웃풋 버퍼에 들어온 값들을 전부 복사한다.
|
||||
|
||||
memcpy(VBInstanceResource.pData, OutSubResources[0].pData, m_iInstanceStride * m_InstanceDesc.iNumInstance); // 아웃풋 버퍼에 들어온 값들을 전부 복사한다.
|
||||
|
||||
m_pContext->Unmap(m_pVBInstance, 0);
|
||||
}
|
||||
|
||||
//TODO:: 벨류버퍼 갱신 해야함 , OutPut버퍼 두개만들어야할듯..
|
||||
D3D11_MAPPED_SUBRESOURCE ParticleValueResource = {};
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pParticleValueBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &ParticleValueResource)))
|
||||
{
|
||||
CS_PARTICLE_VALUE_DESC* pValueDesc = static_cast<CS_PARTICLE_VALUE_DESC*>(OutSubResources[1].pData);
|
||||
|
||||
memcpy(ParticleValueResource.pData, OutSubResources[1].pData, sizeof(CS_PARTICLE_VALUE_DESC) * m_InstanceDesc.iNumInstance); // 아웃풋 버퍼에 들어온 값들을 전부 복사한다.
|
||||
|
||||
m_pContext->Unmap(m_pParticleValueBuffer, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -302,6 +354,7 @@ void CInstance_Model::Instane_Buffer_ReStruct()
|
||||
pParticleValues[i].vAniTime = _float2(0.0f, m_pGameInstance->Random_Float(m_InstanceDesc.vAniTime.x, m_InstanceDesc.vAniTime.y));
|
||||
pParticleValues[i].vMaskingUVMoveTime = _float2(0.0f, m_pGameInstance->Random_Float(m_InstanceDesc.vMaskingUVMoveTime.x, m_InstanceDesc.vMaskingUVMoveTime.y));
|
||||
pParticleValues[i].vDiffuseUVMoveTime = _float2(0.0f, m_pGameInstance->Random_Float(m_InstanceDesc.vDiffuseUVMoveTime.x, m_InstanceDesc.vDiffuseUVMoveTime.y));
|
||||
pParticleValues[i].vNoiseUVMoveTime = _float2(0.0f, m_pGameInstance->Random_Float(m_InstanceDesc.vNoiseUVMoveTime.x, m_InstanceDesc.vNoiseUVMoveTime.y));
|
||||
pParticleValues[i].fSpeed = m_pGameInstance->Random_Float(m_InstanceDesc.vSpeed.x, m_InstanceDesc.vSpeed.y);
|
||||
pParticleValues[i].fRotaionSpeed = m_pGameInstance->Random_Float(m_InstanceDesc.vRotationSpeed.x, m_InstanceDesc.vRotationSpeed.y);
|
||||
pParticleValues[i].vAniIndex = _float2(0.f, m_InstanceDesc.vAniIndex.y);
|
||||
@@ -321,12 +374,12 @@ void CInstance_Model::Instane_Buffer_ReStruct()
|
||||
|
||||
}
|
||||
|
||||
HRESULT CInstance_Model::Bind_CS_Output(_uint Index)
|
||||
HRESULT CInstance_Model::Bind_CS_Output(_uint Index, _uint iBufferIndex)
|
||||
{
|
||||
if (m_pComputeShader == nullptr)
|
||||
return E_FAIL;
|
||||
|
||||
m_pComputeShader->Bind_OutPut_SRV(Index);
|
||||
m_pComputeShader->Bind_OutPut_SRV(Index , iBufferIndex);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -382,12 +435,19 @@ void CInstance_Model::Describe_Entity()
|
||||
if (ImGui::TreeNode("Model Option"))
|
||||
{
|
||||
ImGui::Separator(); ImGui::Spacing();
|
||||
ImGui::PushItemWidth(80);
|
||||
|
||||
if (ImGui::InputInt("NumInstance", &m_InstanceDesc.iNumInstance))
|
||||
{
|
||||
Instane_Buffer_ReStruct();
|
||||
Change_NumInstance();
|
||||
}
|
||||
|
||||
if (GUI::Checkbox("Loop", &m_InstanceDesc.isLoop))
|
||||
{
|
||||
Instane_Buffer_ReStruct();
|
||||
}
|
||||
|
||||
|
||||
if (ImGui::DragFloat3("SizeMin", reinterpret_cast<_float*>(&m_InstanceDesc.vSizeMin)))
|
||||
{
|
||||
Instane_Buffer_ReStruct();
|
||||
@@ -444,6 +504,11 @@ void CInstance_Model::Describe_Entity()
|
||||
Instane_Buffer_ReStruct();
|
||||
}
|
||||
|
||||
if (ImGui::DragFloat2("NoiseUVMoveTime", reinterpret_cast<_float*>(&m_InstanceDesc.vNoiseUVMoveTime)))
|
||||
{
|
||||
Instane_Buffer_ReStruct();
|
||||
}
|
||||
|
||||
if (ImGui::DragFloat2("AniTime", reinterpret_cast<_float*>(&m_InstanceDesc.vAniTime)))
|
||||
{
|
||||
Instane_Buffer_ReStruct();
|
||||
@@ -453,6 +518,7 @@ void CInstance_Model::Describe_Entity()
|
||||
Instane_Buffer_ReStruct();
|
||||
}
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,16 +13,16 @@ class ENGINE_DLL CComputeShader final : public CBase
|
||||
|
||||
|
||||
public:
|
||||
HRESULT Initialize(const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iOutputStructStride, _uint iInputStructStride[]);
|
||||
HRESULT Initialize(const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[]);
|
||||
public:
|
||||
D3D11_MAPPED_SUBRESOURCE Dispatch(_uint iSRVIndex, _uint iUAVIndex, _float3 vGroupCount, ID3D11Buffer** ppBuffers, ID3D11Buffer* pConstantBuffer = nullptr);
|
||||
void Bind_OutPut_SRV(_uint iIndex);
|
||||
vector<D3D11_MAPPED_SUBRESOURCE> Dispatch(_uint iSRVIndex, _uint iUAVIndex, _float3 vGroupCount, ID3D11Buffer** ppBuffers, ID3D11Buffer* pConstantBuffer = nullptr);
|
||||
void Bind_OutPut_SRV(_uint iIndex, _uint iBufferIndex);
|
||||
private:
|
||||
void Bind_SRV(_uint iIndex);
|
||||
void Bind_UAV(_uint iIndex);
|
||||
void Reset();
|
||||
|
||||
HRESULT CreateBuffer(_uint iNumElement, _uint iNumInputBuffer, _uint iStructStride[]);
|
||||
HRESULT CreateBuffer(_uint iNumElement, _uint iInputStructStride[], _uint iOuputStructStride[]);
|
||||
HRESULT CreateResurceViews(_uint iNumElement, _uint iNumInputBuffer);
|
||||
HRESULT CreateComputeShader(const _tchar* pShaderFilePath, const _char* pStartFunctionName);
|
||||
|
||||
@@ -33,24 +33,26 @@ class ENGINE_DLL CComputeShader final : public CBase
|
||||
|
||||
private:
|
||||
vector<ID3D11ShaderResourceView*> m_pInputSRV = {};
|
||||
ID3D11UnorderedAccessView* m_pOutputUAV = nullptr;
|
||||
vector<ID3D11UnorderedAccessView*> m_pOutputUAV = {};
|
||||
vector< ID3D11ShaderResourceView*> m_pOutputSRV = {};
|
||||
|
||||
vector<ID3D11Buffer*> m_pInputBuffer = {};
|
||||
ID3D11Buffer* m_pOutputBuffer = nullptr;
|
||||
vector<ID3D11Buffer*> m_pOutputBuffer = {};
|
||||
|
||||
vector<ID3D11Buffer*> m_pInputStagingBuffer = {};
|
||||
vector<ID3D11Buffer*> m_pOutputStagingBuffer = {};
|
||||
|
||||
vector<ID3D11Buffer*> m_pStagingBuffer = {};
|
||||
ID3D11Buffer* m_pOutputStagingBuffer = {};
|
||||
ID3D11ComputeShader* m_pComputeShader = nullptr;
|
||||
|
||||
ID3D11ShaderResourceView* m_pOutputSRV = { nullptr };
|
||||
|
||||
|
||||
private:
|
||||
_uint m_iNumElement = 0; // 인수 개수
|
||||
_uint m_iNumInputBuffer = 0; // 인풋 버퍼의 개수
|
||||
_uint m_iOutputStructStride = 0; // µ¥ÀÌÅÍ Å©±â
|
||||
_uint m_iNumOutputBuffer = 0; // ÀÎDz ¹öÆÛÀÇ °³¼ö
|
||||
|
||||
public:
|
||||
static CComputeShader* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iOutputStructStride, _uint iInputStructStride[]);
|
||||
static CComputeShader* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[]);
|
||||
virtual void Free() override;
|
||||
|
||||
};
|
||||
|
||||
@@ -10,10 +10,12 @@ class ENGINE_DLL CInstance_Model final : public CComponent
|
||||
public:
|
||||
typedef struct tagInstanceDesc
|
||||
{
|
||||
_int iNumInstance = {}; // 인스턴스 개수
|
||||
_float2 vLifeTime = {}; // 라이프 타임 min , max
|
||||
_float3 vSizeMin = {}; // 사이즈 min xyz
|
||||
_float3 vSizeMax = {}; // 사이즈 max xyz
|
||||
_int iNumInstance = {1}; // 인스턴스 개수
|
||||
|
||||
_bool isLoop = { true };
|
||||
_float2 vLifeTime = {1.f , 1.f}; // 라이프 타임 min , max
|
||||
_float3 vSizeMin = {1.f, 1.f ,1.f}; // 사이즈 min xyz
|
||||
_float3 vSizeMax = {1.f ,1.f ,1.f}; // 사이즈 max xyz
|
||||
_float3 vRotationAngleMin = {}; // 로테이션 min x y z for angle
|
||||
_float3 vRotationAngleMax = {};// 로테이션 max x y z for angle
|
||||
_float2 vRotationSpeed = {}; // 로테이션 스피드 min , max
|
||||
@@ -21,9 +23,10 @@ class ENGINE_DLL CInstance_Model final : public CComponent
|
||||
_float3 vCenter = {}; // 센터 위치
|
||||
_float3 vRange = {}; // 위치 범위
|
||||
|
||||
_float2 vMaskingUVMoveTime = {};
|
||||
_float2 vDiffuseUVMoveTime = {};
|
||||
_float2 vAniTime = {};
|
||||
_float2 vMaskingUVMoveTime = {1.f, 1.f};
|
||||
_float2 vDiffuseUVMoveTime = {1.f, 1.f};
|
||||
_float2 vNoiseUVMoveTime = {1.f ,1.f};
|
||||
_float2 vAniTime = {1.f , 1.f};
|
||||
_float2 vAniIndex = {};
|
||||
|
||||
}INSTANCE_DESC;
|
||||
@@ -31,7 +34,10 @@ class ENGINE_DLL CInstance_Model final : public CComponent
|
||||
typedef struct tagCSParticleDesc
|
||||
{
|
||||
_float fTimeDelta = {};
|
||||
_float fPadding = {};
|
||||
_bool isLoop = {};
|
||||
_bool isPadding1 = {};
|
||||
_bool isPadding2 = {};
|
||||
_bool isPadding3 = {};
|
||||
_float fPadding2 = {};
|
||||
_float fPadding3 = {};
|
||||
|
||||
@@ -49,28 +55,13 @@ class ENGINE_DLL CInstance_Model final : public CComponent
|
||||
|
||||
_float2 vMaskingUVMoveTime = {};
|
||||
_float2 vDiffuseUVMoveTime = {};
|
||||
_float2 vNoiseUVMoveTime = {};
|
||||
_float2 vAniTime = {};
|
||||
|
||||
_float2 vAniIndex = {};
|
||||
|
||||
}CS_PARTICLE_VALUE_DESC;
|
||||
|
||||
|
||||
struct ParticleOut
|
||||
{
|
||||
_float4 vRight = {};
|
||||
_float4 vUp = {};
|
||||
_float4 vLook = {};
|
||||
_float4 vTranslation = {};
|
||||
_float2 vLifeTime = {};
|
||||
|
||||
_float2 vMaskingUVMoveTime = {};
|
||||
_float2 vDiffuseUVMoveTime = {};
|
||||
_float2 vAniTime = {};
|
||||
|
||||
_float2 vAniIndex = {};
|
||||
|
||||
}CS_PARTICLE_OUT;
|
||||
public:
|
||||
CInstance_Model(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CInstance_Model(const CInstance_Model& rhs);
|
||||
@@ -88,12 +79,14 @@ class ENGINE_DLL CInstance_Model final : public CComponent
|
||||
HRESULT Render(_uint iMeshIndx);
|
||||
void Instane_Buffer_ReStruct();
|
||||
_uint Get_NumMeshes() const { return m_iNumMeshes; }
|
||||
HRESULT Bind_CS_Output(_uint Index);
|
||||
HRESULT Bind_CS_Output(_uint Index , _uint iBufferIndex);
|
||||
INSTANCE_DESC Get_EffectValue() { return m_InstanceDesc; }
|
||||
private:
|
||||
#ifdef EDITOR_PROJECT
|
||||
HRESULT Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex);
|
||||
HRESULT Ready_Meshes(MODEL eType, const aiScene* pAIScene, _fmatrix& PreTransformMatrix);
|
||||
#endif
|
||||
HRESULT Change_NumInstance();
|
||||
HRESULT Create_Instance_Buffer(const INSTANCE_DESC* pDesc);
|
||||
HRESULT Create_SubResource_Buffer();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user