2025/11/08
Sprite Sheet 만듬 미션에 필요한 이미지들 추가 밎 미니맵 이미지 추가
@@ -11,4 +11,5 @@ namespace Client
|
||||
enum class SHADER_PASS_NORTEX { DEFAULT, TERRAIN, END };
|
||||
enum class SHADER_PASS_PARTICLE { EXPLOSION, END };
|
||||
enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, END };
|
||||
enum class SHADER_PASS_UIEDITOR { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, END };
|
||||
}
|
||||
@@ -17,6 +17,7 @@ namespace Client {
|
||||
#define FX_CELL TEXT("FX_CELL")
|
||||
#define FX_DEFERRED TEXT("FX_DEFFERED")
|
||||
#define FX_PARTICLE TEXT("FX_PARTICLE")
|
||||
#define FX_UIEDITOR TEXT("FX_UIEDITOR")
|
||||
|
||||
#pragma endregion
|
||||
#pragma region MACRO_PROTOTYPE
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
|
||||
Texture2D g_DepthTexture;
|
||||
|
||||
int g_iImageCount;
|
||||
|
||||
float g_fFar;
|
||||
float g_fTime;
|
||||
float g_fFrame;
|
||||
float g_fDeltaU;
|
||||
float g_fDeltaV;
|
||||
uint g_iIndexU;
|
||||
uint g_iIndexV;
|
||||
|
||||
Texture2D g_Texture;
|
||||
Texture2D g_Texture2;
|
||||
Texture2D g_DiffuseTexture;
|
||||
Texture2D g_MaskingTexture;
|
||||
|
||||
|
||||
struct VS_IN
|
||||
{
|
||||
float3 vPosition : POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VS_OUT
|
||||
{
|
||||
float4 vPosition : SV_Position;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
VS_OUT VS_MAIN(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
|
||||
|
||||
matrix matWV, matWVP;
|
||||
matWV = mul(g_WorldMatrix, g_ViewMatrix);
|
||||
matWVP = mul(matWV, g_ProjMatrix);
|
||||
|
||||
Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP);
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float4 vPosition : SV_Position;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 vColor : SV_Target0;
|
||||
};
|
||||
|
||||
PS_OUT PS_MAIN(PS_IN In) // 일반 UI
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
float4 Color = g_Texture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (Color.a <= 0.3f)
|
||||
discard;
|
||||
|
||||
Out.vColor = Color;
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT PS_Cursor(PS_IN In) // 마우스 커서
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
float4 Color = float4(0.f, 0.f, 0.f, 0.f); // Out에 출력하기 위한 값
|
||||
float4 White = float4(1.f, 1.f, 1.f, 1.f); // 마지막에 하얀색으로 바꿔주기 위한 값
|
||||
|
||||
float2 UV = In.vTexcoord; // UV를 돌리기 위해서 받아옴
|
||||
float2 Center = float2(0.5f, 0.5f); // 이미지를 회전 하기 전에 중심으로 옮길 값
|
||||
|
||||
float CW = -g_fTime; // 시계 방향
|
||||
float CCW = g_fTime; // 반시계 방향
|
||||
|
||||
float2 RedCircle = UV; // 빨간 원을 반시계 방향으로 돌려주기 위한 준비
|
||||
float2 RedUV = UV - Center; // 중심으로 옮겨줌
|
||||
// 값을 돌리기 위해서 회전 행렬을 만들어 준다.
|
||||
RedCircle.x = RedUV.x * cos(CCW) - RedUV.y * sin(CCW); // x축은 x*cos(각도) - y*sin(각도)
|
||||
RedCircle.y = RedUV.x * sin(CCW) + RedUV.y * cos(CCW); // y축은 x*sin(각도) + y*cos(각도)
|
||||
RedCircle = RedCircle + Center; // 이제 위에서 다 돌려주면 다시 중심에서 원점으로 옮겨준다.
|
||||
|
||||
float2 BlueCircle = UV; // 파란색은 시계 방향으로 돌려준다
|
||||
float2 BlueUV = UV - Center; // 중심으로 옮겨줌
|
||||
// 값을 돌리기 위해서 회전 행렬을 만들어 준다.
|
||||
BlueCircle.x = BlueUV.x * cos(CW) - BlueUV.y * sin(CW); // x축은 x*cos(각도) - y*sin(각도)
|
||||
BlueCircle.y = BlueUV.x * sin(CW) + BlueUV.y * cos(CW); // y축은 x*sin(각도) + y*cos(각도)
|
||||
BlueCircle = BlueCircle + Center; // 이제 위에서 다 돌려주면 다시 중심에서 원점으로 옮겨준다.
|
||||
|
||||
// 두개 다 같은 이미지 인데 원의 색상이 2개임
|
||||
float4 Texture1 = g_Texture.Sample(ClampSampler, RedCircle); // 큰 원은 빨간색임
|
||||
float4 Texture2 = g_Texture2.Sample(ClampSampler, BlueCircle); // 작은 원은 파란색임
|
||||
|
||||
if (Texture1.r >= 0.7f) // 우선 빨간 원을 먼저 그려준다.
|
||||
Color = Texture1;
|
||||
|
||||
if (Texture2.b >= 0.7f) // 다음으로 파란 원을 그려준다.
|
||||
Color = Texture2;
|
||||
|
||||
if (all(Color.rgb <= 0.5f)) // 이제 혹시 모를 색상이 들어갈 수 있어서 한번 정리 해준다.
|
||||
discard;
|
||||
|
||||
Color = White; // 하얀색으로 바꿔줌
|
||||
|
||||
Out.vColor = Color;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT PS_Sptire_Sheet(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
float4 Color = float4(0.f, 0.f, 0.f, 0.f); // 최종 이미지 출력
|
||||
|
||||
float2 UV = In.vTexcoord; // 이미지의 UV값
|
||||
|
||||
int iTotalFrame = g_iImageCount * g_iImageCount; // 이미지의 최대 프레임 (몇 곱하기 몇인지)
|
||||
|
||||
int iCurrentFrame = int(floor(g_fTime / g_fFrame)) % iTotalFrame; // 현재 프레임이 어디 위치인지
|
||||
|
||||
int iFrameX = iCurrentFrame % g_iImageCount; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지)
|
||||
int iFrameY = iCurrentFrame / g_iImageCount; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지)
|
||||
|
||||
float fFreamWidth = 1.0 / g_iImageCount; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
|
||||
float fFreamHeight = 1.0 / g_iImageCount; // 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로 만든 다음에 한줄씩 밑으로 내려준다.
|
||||
|
||||
float4 Texture = g_Texture.Sample(DefaultSampler, UV);
|
||||
|
||||
Color = Texture;
|
||||
|
||||
if(Color.r <= 0.f)
|
||||
discard;
|
||||
|
||||
Out.vColor = Color;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT PS_AlphaBlend(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
float4 Color = g_Texture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
Out.vColor = Color;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
technique11 PosTexTechnique11
|
||||
{
|
||||
pass Default
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN();
|
||||
}
|
||||
|
||||
pass AlphaBlend
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_AlphaBlend();
|
||||
}
|
||||
|
||||
pass Mouse_Cursor
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_Cursor();
|
||||
}
|
||||
|
||||
pass Sptire_Sheet
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_Sptire_Sheet();
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ VS_OUT_SHADOW VS_MAIN_SHADOW(VS_IN In)
|
||||
g_BoneMatrices[In.vBlendIndex.z] * In.vBlendWeight.z +
|
||||
g_BoneMatrices[In.vBlendIndex.w] * fWeightW;
|
||||
|
||||
/* 스키닝 */
|
||||
/* ?ㅽ궎??*/
|
||||
vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix);
|
||||
|
||||
matrix matWV, matWVP;
|
||||
|
||||
|
After Width: | Height: | Size: 371 KiB |
|
After Width: | Height: | Size: 76 B |
|
After Width: | Height: | Size: 146 B |
|
After Width: | Height: | Size: 399 B |
|
After Width: | Height: | Size: 416 B |
|
After Width: | Height: | Size: 137 B |
|
After Width: | Height: | Size: 367 B |
|
After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 777 B |
|
After Width: | Height: | Size: 768 B |
|
After Width: | Height: | Size: 707 B |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 795 B |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 333 B |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 487 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 579 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 860 B |
|
After Width: | Height: | Size: 829 B |
|
After Width: | Height: | Size: 949 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 760 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 371 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 298 B |
|
After Width: | Height: | Size: 844 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 1021 B |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 537 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 650 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 899 B |
|
After Width: | Height: | Size: 954 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 864 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.7 KiB |