[Add] Nine_Slice 추가

This commit is contained in:
fbtk
2025-11-12 23:28:52 +09:00
parent 4938c926a1
commit 842b025860
8 changed files with 71 additions and 49 deletions
@@ -99,47 +99,47 @@ PS_OUT PS_Clamp(PS_IN In)
return Out;
}
PS_OUT PS_Cursor(PS_IN In) // 留덉슦??而ㅼ꽌
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); // 留덉?留됱뿉 ?섏??됱쑝濡?諛붽퓭二쇨린 ?꾪븳 媛?
float4 Color = float4(0.f, 0.f, 0.f, 0.f);
float4 White = float4(1.f, 1.f, 1.f, 1.f);
float2 UV = In.vTexcoord; // UV瑜??뚮━湲??꾪빐??諛쏆븘??
float2 Center = float2(0.5f, 0.5f); // ?대?吏€瑜??뚯쟾 ?섍린 ?꾩뿉 以묒떖?쇰줈 ??만 媛?
float2 UV = In.vTexcoord;
float2 Center = float2(0.5f, 0.5f);
float CW = -g_fTime; // ?쒓퀎 諛⑺뼢
float CCW = g_fTime; // 諛섏떆怨?諛⑺뼢
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 RedCircle = UV;
float2 RedUV = UV - Center;
RedCircle.x = RedUV.x * cos(CCW) - RedUV.y * sin(CCW);
RedCircle.y = RedUV.x * sin(CCW) + RedUV.y * cos(CCW);
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; // ?댁젣 ?꾩뿉?????뚮젮二쇰㈃ ?ㅼ떆 以묒떖?먯꽌 ?먯젏?쇰줈 ??꺼以€??
float2 BlueCircle = UV;
float2 BlueUV = UV - Center;
BlueCircle.x = BlueUV.x * cos(CW) - BlueUV.y * sin(CW);
BlueCircle.y = BlueUV.x * sin(CW) + BlueUV.y * cos(CW);
BlueCircle = BlueCircle + Center;
// ?먭컻 ??媛숈? ?대?吏€ ?몃뜲 ?먯쓽 ?됱긽??2媛쒖엫
float4 Texture1 = g_Texture.Sample(ClampSampler, RedCircle); // ???먯? 鍮④컙?됱엫
float4 Texture2 = g_Texture2.Sample(ClampSampler, BlueCircle); // ?묒? ?먯? ?뚮??됱엫
float4 Texture1 = g_Texture.Sample(ClampSampler, RedCircle);
float4 Texture2 = g_Texture2.Sample(ClampSampler, BlueCircle);
if (Texture1.r >= 0.7f) // ?곗꽑 鍮④컙 ?먯쓣 癒쇱? 洹몃젮以€??
if (Texture1.r >= 0.7f)
Color = Texture1;
if (Texture2.b >= 0.7f) // ?ㅼ쓬?쇰줈 ?뚮? ?먯쓣 洹몃젮以€??
if (Texture2.b >= 0.7f)
Color = Texture2;
if (all(Color.rgb <= 0.5f)) // ?댁젣 ?뱀떆 紐⑤? ?됱긽???ㅼ뼱媛????덉뼱???쒕쾲 ?뺣━ ?댁???
if (all(Color.rgb <= 0.5f))
discard;
Color = White; // ?섏??됱쑝濡?諛붽퓭以?
Color = White;
Out.vColor = Color;
@@ -150,22 +150,22 @@ PS_OUT PS_Sptire_Sheet(PS_IN In)
{
PS_OUT Out;
float4 Color = float4(0.f, 0.f, 0.f, 0.f); // 理쒖쥌 ?대?吏€ 異쒕젰
float4 Color = float4(0.f, 0.f, 0.f, 0.f);
float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha;
float2 UV = In.vTexcoord; // ?대?吏€??UV媛?
float2 UV = In.vTexcoord;
int iTotalFrame = g_iImageCountX * g_iImageCountY; // ?대?吏€??理쒕? ?꾨젅??(紐?怨깊븯湲?紐뉗씤吏€)
int iTotalFrame = g_iImageCountX * g_iImageCountY;
int iCurrentFrame = int(floor(g_fTime / g_fFrame)) % iTotalFrame; // ?꾩옱 ?꾨젅?꾩씠 ?대뵒 ?꾩튂?몄?
int iCurrentFrame = int(floor(g_fTime / g_fFrame)) % iTotalFrame;
int iFrameX = iCurrentFrame % g_iImageCountX; // ?꾩옱 x異뺤쓽 ?꾩튂(?꾩옱 ?대?吏€??紐뉖쾲吏?移몄쓣 蹂댁뿬以?吏€)
int iFrameY = iCurrentFrame / g_iImageCountX; // ?꾩옱 y異뺤쓽 ?꾩튂(?꾩옱 ?대?吏€??紐뉖쾲吏?以꾩쓣 蹂댁뿬以?吏€)
int iFrameX = iCurrentFrame % g_iImageCountX;
int iFrameY = iCurrentFrame / g_iImageCountX;
float fFreamWidth = 1.0 / g_iImageCountX; // 1.0 ?섎늻湲??대?吏€ 媛?닔瑜??댁꽌 ?쒖뭏???쇰쭏??媛덉? ?뺥빐以€??
float fFreamHeight = 1.0 / g_iImageCountY; // 1.0 ?섎늻湲??대?吏€ 媛?닔瑜??댁꽌 ?쒖쨪???쇰쭏??媛덉? ?뺥빐以€??
float fFreamWidth = 1.0 / g_iImageCountX;
float fFreamHeight = 1.0 / g_iImageCountY;
UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 癒쇱? uv瑜?0~1???꾨땶 0~fFrameWidth濡?留뚮뱺 ?ㅼ쓬???쒖뭏???놁쑝濡?諛€?댁???
UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 癒쇱? uv瑜?0~1???꾨땶 0~fFrameHeight濡?留뚮뱺 ?ㅼ쓬???쒖쨪??諛묒쑝濡??대젮以€??
UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth;
UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight;
float4 Texture = g_Texture.Sample(DefaultSampler, UV);
@@ -217,17 +217,11 @@ PS_OUT PS_QuestType(PS_IN In)
PS_OUT PS_UVMult(PS_IN In)
{
PS_OUT Out;
float2 UV = In.vTexcoord;
float4 Color = float4(0.f, 0.f, 0.f, 0.f);
float4 Texture1 = g_Texture.Sample(ClampSampler, float2(UV.x * g_fDeltaU, UV.y * g_fDeltaV));
Color = Texture1;
Out.vColor = Color;
float4 color = g_Texture.Sample(DefaultSampler, In.vTexcoord);
Out.vColor = color;
return Out;
}
@@ -15,7 +15,7 @@ vector g_vColor;
float2 g_vUVGainAmount;
float2 g_vUVCutting;
float g_fBlurIntensity; //블러 세기
float g_fBlurIntensity; //釉붾윭 ?멸린
float4 g_vEmissive;
float g_fColorOption;
@@ -169,7 +169,7 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
float2 vTexcoord = In.vTexcoord;
float2 vUVPerCell = In.vTexcoord / g_vUVCutting; //이게 한 셀당 크기
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;
@@ -221,7 +221,7 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
Out.vDiffuse = vMtrlDiffuse;
// 색깔 추가할 처리 (이미시브)
// ?됯퉼 異붽???泥섎━ (?대??쒕툕)
if (vMtrlDiffuse.a >= g_fEmissiveCutAlpha )
Out.vColorTarget = vector(g_vEmissive.rgb, g_fColorOption / 10.f);
else
@@ -40,7 +40,7 @@ HRESULT CMissionBanner_Border::Initialize(void* pArg)
m_fTimeMult = 3.f;
m_fAlpha = 1.f;
m_fAlphaTime = 3.f;
m_vUVScale = _float2(2.f, 2.f);
m_vUVScale = _float2(1.f,1.f);
return S_OK;
}
@@ -83,6 +83,7 @@ HRESULT CUIObject::Initialize(void* pArg)
m_bVisible = true;
m_vNine_Slice = XMVectorSet(-m_fSizeX * 0.5f, m_fSizeX * 0.5f, -m_fSizeY * 0.5f, m_fSizeY * 0.5f);
return S_OK;
}
@@ -272,6 +273,26 @@ _float2 CUIObject::Get_UV()
return m_vUVScale;
}
void CUIObject::Nine_Slice_Left(_float X)
{
XMVectorSetX(m_vNine_Slice, X);
}
void CUIObject::Nine_Slice_Right(_float Y)
{
XMVectorSetY(m_vNine_Slice, Y);
}
void CUIObject::Nine_Slice_Top(_float Z)
{
XMVectorSetZ(m_vNine_Slice, Z);
}
void CUIObject::Nine_Slice_Bottom(_float W)
{
XMVectorSetW(m_vNine_Slice, W);
}
_float2 CUIObject::Get_Origin_Position()
{
return m_fOrigin_Posigion;
+7
View File
@@ -59,6 +59,11 @@ class ENGINE_DLL CUIObject abstract : public CGameObject
virtual void Set_V(_float V);
virtual _float2 Get_UV();
virtual void Nine_Slice_Left(_float X);
virtual void Nine_Slice_Right(_float Y);
virtual void Nine_Slice_Top(_float Z);
virtual void Nine_Slice_Bottom(_float W);
public:
virtual _float2 Get_Origin_Position(); // Start Position
virtual _vector Get_Current_Position(); // Current Position
@@ -98,6 +103,8 @@ class ENGINE_DLL CUIObject abstract : public CGameObject
RECT m_pRect{};
_vector m_vNine_Slice{};
protected:
virtual HRESULT Initialize_Prototype();
virtual HRESULT Initialize(void* pArg);