[Modify] 셰이더 추가 및 이미지 변경, enum 변경
This commit is contained in:
@@ -17,6 +17,8 @@ float g_fDeltaV;
|
||||
uint g_iIndexU;
|
||||
uint g_iIndexV;
|
||||
|
||||
uint g_iQuestType;
|
||||
|
||||
Texture2D g_Texture;
|
||||
Texture2D g_Texture2;
|
||||
Texture2D g_DiffuseTexture;
|
||||
@@ -74,36 +76,58 @@ PS_OUT PS_MAIN(PS_IN In) // 일반 UI
|
||||
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;
|
||||
}
|
||||
|
||||
PS_OUT PS_Clamp(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
float4 Color = g_Texture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
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); // 마지막에 하얀색으로 바꿔주기 위한 값
|
||||
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); // 이미지를 회전 하기 전에 중심으로 옮길 값
|
||||
float2 UV = In.vTexcoord; // UV를 돌리기 위해서 받아옴
|
||||
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; // 중심으로 옮겨줌
|
||||
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; // 이제 위에서 다 돌려주면 다시 중심에서 원점으로 옮겨준다.
|
||||
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; // 중심으로 옮겨줌
|
||||
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; // 이제 위에서 다 돌려주면 다시 중심에서 원점으로 옮겨준다.
|
||||
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); // 작은 원은 파란색임
|
||||
float4 Texture1 = g_Texture.Sample(ClampSampler, RedCircle); // 큰 원은 빨간색임
|
||||
float4 Texture2 = g_Texture2.Sample(ClampSampler, BlueCircle); // 작은 원은 파란색임
|
||||
|
||||
if (Texture1.r >= 0.7f) // 우선 빨간 원을 먼저 그려준다.
|
||||
Color = Texture1;
|
||||
@@ -125,22 +149,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; // 이미지의 UV값
|
||||
|
||||
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; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지)
|
||||
int iFrameY = iCurrentFrame / g_iImageCountX; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지)
|
||||
|
||||
float fFreamWidth = 1.0 / g_iImageCountX; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
|
||||
float fFreamHeight = 1.0 / g_iImageCountY; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다.
|
||||
float fFreamWidth = 1.0 / g_iImageCountX; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
|
||||
float fFreamHeight = 1.0 / g_iImageCountY; // 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로 만든 다음에 한줄씩 밑으로 내려준다.
|
||||
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);
|
||||
|
||||
@@ -156,17 +180,6 @@ PS_OUT PS_Sptire_Sheet(PS_IN In)
|
||||
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;
|
||||
}
|
||||
|
||||
PS_OUT PS_Key_Hold(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
@@ -175,8 +188,6 @@ PS_OUT PS_Key_Hold(PS_IN In)
|
||||
|
||||
float4 Color = g_Texture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
|
||||
|
||||
if (Color.r >= 0.3f)
|
||||
Color.rgb = Grey;
|
||||
|
||||
@@ -185,6 +196,26 @@ PS_OUT PS_Key_Hold(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT PS_QuestType(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
float3 Color = float3(255, 255, 0) / 255.f;
|
||||
|
||||
float4 Texture1 = g_Texture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (g_iQuestType == 0)
|
||||
{
|
||||
if (Texture1.r >= 0.3f)
|
||||
{
|
||||
Texture1.rgb = Color;
|
||||
}
|
||||
}
|
||||
|
||||
Out.vColor = Texture1;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
technique11 PosTexTechnique11
|
||||
{
|
||||
pass Default
|
||||
@@ -207,6 +238,16 @@ technique11 PosTexTechnique11
|
||||
PixelShader = compile ps_5_0 PS_AlphaBlend();
|
||||
}
|
||||
|
||||
pass TextureClamp
|
||||
{
|
||||
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_Clamp();
|
||||
}
|
||||
|
||||
pass Mouse_Cursor
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
@@ -236,4 +277,14 @@ technique11 PosTexTechnique11
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_Key_Hold();
|
||||
}
|
||||
|
||||
pass QuestType
|
||||
{
|
||||
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_QuestType();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,9 +40,15 @@ HRESULT CActive_Icon::Initialize(void* pArg)
|
||||
m_fTimeMult = 3.f;
|
||||
m_fAlpha = 1.f;
|
||||
m_fAlphaTime = 3.f;
|
||||
m_eType = QUESTYPE::MAIN;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CActive_Icon::QuestType(QUESTYPE eType)
|
||||
{
|
||||
m_eType = eType;
|
||||
}
|
||||
|
||||
void CActive_Icon::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
if (!__super::Chack_Visible())
|
||||
@@ -107,7 +113,7 @@ HRESULT CActive_Icon::Render()
|
||||
if (FAILED(Bind_ShaderResources())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::DEFAULT)))) {
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::QUESTYPE)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pVIBufferCom->Bind_Resources())) {
|
||||
@@ -163,6 +169,10 @@ HRESULT CActive_Icon::Bind_ShaderResources()
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_iQuestType", &m_eType, sizeof(_uint))))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,15 @@ HRESULT CMission_Icon::Initialize(void* pArg)
|
||||
m_fTimeMult = 3.f;
|
||||
m_fAlpha = 1.f;
|
||||
m_fAlphaTime = 3.f;
|
||||
m_eType = QUESTYPE::MAIN;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CMission_Icon::QuestType(QUESTYPE eType)
|
||||
{
|
||||
m_eType = eType;
|
||||
}
|
||||
|
||||
void CMission_Icon::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
if (!__super::Chack_Visible())
|
||||
@@ -107,7 +113,7 @@ HRESULT CMission_Icon::Render()
|
||||
if (FAILED(Bind_ShaderResources())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::CURSOR)))) {
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::QUESTYPE)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pVIBufferCom->Bind_Resources())) {
|
||||
@@ -163,6 +169,10 @@ HRESULT CMission_Icon::Bind_ShaderResources()
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_iQuestType", &m_eType, sizeof(_uint))))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,14 @@ class CActive_Icon final : public CElementObject
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
public:
|
||||
void QuestType(QUESTYPE eType);
|
||||
|
||||
private:
|
||||
CTexture* m_pDiffuse_TextureCom = { nullptr };
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CVIBuffer_Rect* m_pVIBufferCom = { nullptr };
|
||||
class CGameObject* m_pMission_KeyHold = { nullptr };
|
||||
class CGameObject* m_pMission_Key = { nullptr };
|
||||
QUESTYPE m_eType = QUESTYPE::END;
|
||||
|
||||
public:
|
||||
static CActive_Icon* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Editor
|
||||
enum class SHADER_PASS_PARTICLE { EXPLOSION, END };
|
||||
enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, END };
|
||||
enum class SHADER_PASS_INSTANCE_MODEL { DEFAULT, NON_NOMALMAP, BLUR ,END };
|
||||
enum class SHADER_PASS_UIEDITOR { DEFAULT, ALPHABLEND, CURSOR, LODING, HOLD, END };
|
||||
enum class SHADER_PASS_UIEDITOR { DEFAULT, ALPHABLEND, CLAMP, CURSOR, LODING, HOLD, QUESTYPE, END };
|
||||
}
|
||||
|
||||
using namespace Editor;
|
||||
|
||||
@@ -26,11 +26,14 @@ class CMission_Icon final : public CElementObject
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
public:
|
||||
void QuestType(QUESTYPE eType);
|
||||
|
||||
private:
|
||||
CTexture* m_pDiffuse_TextureCom = { nullptr };
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CVIBuffer_Rect* m_pVIBufferCom = { nullptr };
|
||||
|
||||
QUESTYPE m_eType = QUESTYPE::END;
|
||||
|
||||
public:
|
||||
static CMission_Icon* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
|
||||
Reference in New Issue
Block a user