COMMIT
COMMIT
This commit is contained in:
@@ -88,7 +88,7 @@ cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐
|
||||
bool isMoveUp;
|
||||
bool isExcludePos;
|
||||
bool isStopMove_For_Depth_Compare;
|
||||
bool isPadding2;
|
||||
bool isNoPos;
|
||||
|
||||
float fTimeDelta;
|
||||
float fSizeLerpOption; // 반드시 상수버퍼는 16바이트 배수로 만들어져야 한다.
|
||||
@@ -146,6 +146,11 @@ void CS_MAIN(
|
||||
particle.vTranslation = CurMat[3].xyzw;
|
||||
}
|
||||
|
||||
if (isNoPos)
|
||||
{
|
||||
particle.vTranslation.xyz += WorldMatrix[3].xyz;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 라이프타임 움직임
|
||||
|
||||
@@ -888,10 +888,7 @@ HRESULT CGameInstance::Bind_CS_RenderTarget(_uint iIndex, const _wstring& strTar
|
||||
{
|
||||
return m_pRenderTarget_Manager->Bind_CS_RenderTarget(iIndex, strTargetTag);
|
||||
}
|
||||
_float2 CGameInstance::Get_RenderTargetSize(const _wstring& wstrTargetKey)
|
||||
{
|
||||
return m_pRenderTarget_Manager->Get_RenderTargetSize(wstrTargetKey);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CGameInstance::RenderTarget_Debuger()
|
||||
{
|
||||
|
||||
@@ -569,6 +569,8 @@ void CInstance_Model::Compute_CS(_float fTimeDelta)
|
||||
pDesc->isRandomAniIndex = m_InstanceDesc.isRandomAniIndex;
|
||||
pDesc->isExcludePos = m_InstanceDesc.isExcludePos;
|
||||
pDesc->isStop_Move_For_Depth_Compare = m_InstanceDesc.isStop_Move_For_Depth_Compare;
|
||||
pDesc->isNoPos = m_InstanceDesc.isNoPos;
|
||||
|
||||
|
||||
pDesc->WorldMatrix = *m_pOwner->Get_Component<CTransform>()->Get_WorldMatrixPtr();
|
||||
pDesc->fSizeLerpOption = m_InstanceDesc.fSizeLerpOption;
|
||||
@@ -857,6 +859,13 @@ void CInstance_Model::Describe_Entity()
|
||||
Instane_Buffer_ReStruct();
|
||||
}
|
||||
|
||||
if (GUI::Checkbox("NoPos", &m_InstanceDesc.isNoPos))
|
||||
{
|
||||
Instane_Buffer_ReStruct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (GUI::Checkbox("RandomIndex", &m_InstanceDesc.isRandomAniIndex))
|
||||
{
|
||||
Instane_Buffer_ReStruct();
|
||||
|
||||
@@ -180,6 +180,7 @@ void CTrail::Trail_Update(_float fDeltaTime, _fmatrix WorldMatrix)
|
||||
XMStoreFloat3(&m_pVertices[m_iNumCount++].vPosition, vLerpLow);
|
||||
XMStoreFloat3(&m_pVertices[m_iNumCount++].vPosition, vLerpHigh);
|
||||
|
||||
|
||||
if (m_iNumCount >= m_iNumVertices)
|
||||
{
|
||||
memmove(m_pVertices, m_pVertices + 2, sizeof(VTXPOSTEX) * (m_iNumCount - 2));
|
||||
@@ -189,7 +190,7 @@ void CTrail::Trail_Update(_float fDeltaTime, _fmatrix WorldMatrix)
|
||||
|
||||
}
|
||||
|
||||
for (_uint i = 0; i < m_iNumCount; i += 2)
|
||||
for (_uint i = 0; i + 1 < m_iNumCount; i += 2)
|
||||
{
|
||||
|
||||
_float u = ((_float)i / (m_iNumCount - 2));
|
||||
@@ -201,7 +202,6 @@ void CTrail::Trail_Update(_float fDeltaTime, _fmatrix WorldMatrix)
|
||||
|
||||
m_pVertices[i + 1].vTexcoord = _float2(u, 1); // High
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -402,6 +402,176 @@ void CTrail::Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta, _float f
|
||||
}
|
||||
}
|
||||
|
||||
void CTrail::Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta, _float fDamping, _float fLength, _float fMass)
|
||||
{
|
||||
_matrix WorldMat = {};
|
||||
|
||||
WorldMat.r[0] = XMVector3Normalize(WorldMatrix.r[0]);
|
||||
WorldMat.r[1] = XMVector3Normalize(WorldMatrix.r[1]);
|
||||
WorldMat.r[2] = XMVector3Normalize(WorldMatrix.r[2]);
|
||||
WorldMat.r[3] = WorldMatrix.r[3];
|
||||
|
||||
_vector vLow = XMVector3TransformCoord(XMLoadFloat3(&m_TrailDesc.vLow), WorldMat);
|
||||
_vector vHigh = XMVector3TransformCoord(XMLoadFloat3(&m_TrailDesc.vHigh), WorldMat);
|
||||
|
||||
|
||||
if (m_iNumCount == 0)
|
||||
{
|
||||
for (_uint i = 0; i < m_iNumVertices; i += 2)
|
||||
{
|
||||
XMStoreFloat3(&m_pVertices[i].vPosition, vLow);
|
||||
XMStoreFloat3(&m_pVertices[i + 1].vPosition, vHigh);
|
||||
|
||||
m_pOldPosition[i] = m_pVertices[i].vPosition;
|
||||
m_pOldPosition[i + 1] = m_pVertices[i + 1].vPosition;
|
||||
}
|
||||
|
||||
// 처음엔 마디 1개(정점 2개)만 보여주며 시작
|
||||
m_iNumCount = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_iNumCount > 2)
|
||||
{
|
||||
memmove(m_pVertices + 2, m_pVertices, sizeof(VTXPOSTEX) * (m_iNumCount - 2));
|
||||
memmove(m_pOldPosition + 2, m_pOldPosition, sizeof(_float3) * (m_iNumCount - 2));
|
||||
}
|
||||
|
||||
if (m_iNumCount >= m_iNumVertices)
|
||||
m_iNumCount -= 2;
|
||||
|
||||
/* 시작 시 고정점 업데이트 */
|
||||
XMStoreFloat3(&m_pVertices[0].vPosition, vLow);
|
||||
XMStoreFloat3(&m_pVertices[1].vPosition, vHigh);
|
||||
|
||||
|
||||
m_pOldPosition[0] = m_pVertices[0].vPosition;
|
||||
m_pOldPosition[1] = m_pVertices[1].vPosition;
|
||||
|
||||
m_iNumCount += 2;
|
||||
}
|
||||
|
||||
|
||||
for (_uint i = 2; i < m_iNumCount; i++) /* 고정점은 연산에서 제외 0 , 1*/
|
||||
{
|
||||
|
||||
_vector vCurrentPos = XMLoadFloat3(&m_pVertices[i].vPosition);
|
||||
vCurrentPos = XMVectorSetW(vCurrentPos, 1.f);
|
||||
|
||||
|
||||
_vector vOldPos = XMLoadFloat3(&m_pOldPosition[i]);
|
||||
vOldPos = XMVectorSetW(vOldPos, 1.f);
|
||||
|
||||
//if (XMVectorGetX(XMVector3Length(vOldPos)) <= 0)
|
||||
// continue;
|
||||
|
||||
_vector vVelocity = (vCurrentPos - vOldPos) * fDamping;
|
||||
|
||||
_vector vGravity = XMVectorSet(0.0f, m_fGravity, 0.0f, 0.0f);
|
||||
|
||||
// Verlet 공식: Next = Curr + Vel + Acc * dt * dt
|
||||
_vector vNextPos = vCurrentPos + vVelocity + vGravity * (fTimeDelta * fTimeDelta);
|
||||
|
||||
// 과거 위치 갱신
|
||||
XMStoreFloat3(&m_pOldPosition[i], XMLoadFloat3(&m_pVertices[i].vPosition));
|
||||
|
||||
// 현재 위치 갱신
|
||||
XMStoreFloat3(&m_pVertices[i].vPosition, vNextPos);
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
for (_uint k = 0; k < m_iNumCount - 2; k += 2) {
|
||||
|
||||
/* Low , High */
|
||||
_vector vFirst[2] = { XMLoadFloat3(&m_pVertices[k].vPosition) , XMLoadFloat3(&m_pVertices[k + 1].vPosition) };
|
||||
_vector vNext[2] = { XMLoadFloat3(&m_pVertices[k + 2].vPosition) , XMLoadFloat3(&m_pVertices[k + 3].vPosition) };
|
||||
|
||||
|
||||
_vector vDeltaLow = vNext[0] - vFirst[0];
|
||||
_vector vDeltaHigh = vNext[1] - vFirst[1];
|
||||
|
||||
|
||||
_float fLowDist = XMVectorGetX(XMVector3Length(vDeltaLow));
|
||||
_float fHighDist = XMVectorGetX(XMVector3Length(vDeltaHigh));
|
||||
|
||||
// 거리가 0이면 오류 방지
|
||||
if (fLowDist < FLT_EPSILON5) continue;
|
||||
if (fHighDist < FLT_EPSILON5) continue;
|
||||
|
||||
// 늘어나거나 줄어든 비율 계산 (Difference)
|
||||
_float fLowDiff = (fLength - fLowDist) / fLowDist;
|
||||
_float fHighDiff = (fLength - fHighDist) / fHighDist;
|
||||
|
||||
// 각 점을 절반씩 밀거나 당겨서 거리 맞춤
|
||||
|
||||
_vector vLowOffset = vDeltaLow * (fMass * fLowDiff);
|
||||
_vector vHighOffset = vDeltaHigh * (fMass * fHighDiff);
|
||||
|
||||
// k!=0일 때만 vFirst를 움직임
|
||||
|
||||
if (k != 0)
|
||||
{
|
||||
vFirst[0] -= vLowOffset;
|
||||
vFirst[1] -= vHighOffset;
|
||||
}
|
||||
|
||||
// vNext는 모든 경우에 움직임
|
||||
vNext[0] += vLowOffset;
|
||||
vNext[1] += vHighOffset;
|
||||
|
||||
|
||||
// k=0일 때 vFirst (손잡이)가 움직이지 않은 몫을 vNext에게 전부 몰아줌
|
||||
|
||||
if (k == 0)
|
||||
{
|
||||
// vFirst가 움직여야 할 만큼 vNext에 추가 보정
|
||||
vNext[0] += vLowOffset;
|
||||
vNext[1] += vHighOffset;
|
||||
}
|
||||
|
||||
if (k != 0)
|
||||
{
|
||||
XMStoreFloat3(&m_pVertices[k].vPosition, vFirst[0]);
|
||||
XMStoreFloat3(&m_pVertices[k + 1].vPosition, vFirst[1]);
|
||||
}
|
||||
|
||||
// vNext 저장
|
||||
XMStoreFloat3(&m_pVertices[k + 2].vPosition, vNext[0]);
|
||||
XMStoreFloat3(&m_pVertices[k + 3].vPosition, vNext[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (_uint i = 0; i < m_iNumCount; i += 2)
|
||||
{
|
||||
|
||||
_float u = ((_float)i / (m_iNumCount - 2));
|
||||
|
||||
if (m_iNumCount - 2 <= 0)
|
||||
u = 0;
|
||||
|
||||
m_pVertices[i].vTexcoord = _float2(u, 0); // Low
|
||||
|
||||
m_pVertices[i + 1].vTexcoord = _float2(u, 1); // High
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE VBResource{};
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &VBResource)))
|
||||
{
|
||||
|
||||
memcpy(VBResource.pData, m_pVertices, sizeof(VTXPOSTEX) * m_iNumVertices);
|
||||
|
||||
VTXPOSTEX* pDebug = static_cast<VTXPOSTEX*>(VBResource.pData);
|
||||
|
||||
m_pContext->Unmap(m_pVB, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CTrail::Reset_Trail()
|
||||
{
|
||||
ZeroMemory(m_pVertices, sizeof(VTXPOSTEX) * m_iNumVertices);
|
||||
@@ -418,17 +588,24 @@ HRESULT CTrail::ReStructVB(_uint iNumVertices)
|
||||
{
|
||||
m_iNumVertices = iNumVertices;
|
||||
|
||||
|
||||
Safe_Delete_Array(m_pVertices);
|
||||
Safe_Delete_Array(m_pOldPosition);
|
||||
|
||||
if (FAILED(Create_VB()))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(Create_IB()))
|
||||
return E_FAIL;
|
||||
|
||||
Safe_Delete_Array(m_pVertices);
|
||||
Safe_Delete_Array(m_pOldPosition);
|
||||
|
||||
m_pOldPosition = new _float3[m_iNumVertices];
|
||||
m_pVertices = new VTXPOSTEX[m_iNumVertices]{};
|
||||
m_pVertices = new VTXPOSTEX[m_iNumVertices];
|
||||
|
||||
ZeroMemory(m_pVertices, sizeof(VTXPOSTEX) * m_iNumVertices);
|
||||
ZeroMemory(m_pOldPosition, sizeof(_float3) * m_iNumVertices);
|
||||
|
||||
|
||||
Reset_Trail();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -449,6 +626,7 @@ HRESULT CTrail::Save_Trail(HANDLE hFile)
|
||||
HRESULT CTrail::Load_Trail(TRAIL_DESC TrailDesc)
|
||||
{
|
||||
m_TrailDesc = TrailDesc;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,6 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
HRESULT Refit_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetInput, const _wstring& wstrRenderTargetOutput, SHADER_PASS_DEFERRED ePass);
|
||||
HRESULT Finish_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetOriginal, const _wstring& wstrRenderTargetBloomed, SHADER_PASS_DEFERRED ePass);
|
||||
HRESULT Bind_CS_RenderTarget(_uint iIndex, const _wstring& strTargetTag);
|
||||
_float2 Get_RenderTargetSize(const _wstring& wstrTargetKey);
|
||||
#ifdef _DEBUG
|
||||
void RenderTarget_Debuger();
|
||||
HRESULT Render_RenderTarget_Debug(class CShader* pShader, class CVIBuffer_Rect* pVIBuffer);
|
||||
|
||||
@@ -68,7 +68,7 @@ class ENGINE_DLL CInstance_Model final : public CComponent
|
||||
_float fMoveLerpOption = {};
|
||||
|
||||
_bool isDetphCompareStop = {};
|
||||
_bool isPadding0 = {};
|
||||
_bool isNoPos = {};
|
||||
|
||||
_float3 vVelocityMin = {};
|
||||
_float3 vVelocityMax = {};
|
||||
@@ -176,7 +176,7 @@ class ENGINE_DLL CInstance_Model final : public CComponent
|
||||
_int isMoveUp = {};
|
||||
_int isExcludePos = {};
|
||||
_int isStop_Move_For_Depth_Compare = {};
|
||||
_int isPadding2 = {};
|
||||
_int isNoPos = {};
|
||||
|
||||
_float fTimeDelta = {};
|
||||
_float fSizeLerpOption = {};
|
||||
|
||||
@@ -29,7 +29,6 @@ class CRenderTarget_Manager final : public CBase
|
||||
// 랜더 타겟의 크기를 dest로 다시 맞춤
|
||||
HRESULT Refit_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetInput, const _wstring& wstrRenderTargetOutput, SHADER_PASS_DEFERRED ePass);
|
||||
HRESULT Finish_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetOriginal, const _wstring& wstrRenderTargetBloomed, SHADER_PASS_DEFERRED ePass);
|
||||
_float2 Get_RenderTargetSize(const _wstring& wstrRenderTargetOriginal);
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
|
||||
@@ -30,6 +30,7 @@ class ENGINE_DLL CTrail final :
|
||||
|
||||
public:
|
||||
void Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta , _float fDamping, _float fLength, _float fMass, _fmatrix EndWorldMatrix);
|
||||
void Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta, _float fDamping, _float fLength, _float fMass);
|
||||
void Rope_Fix(_bool isFix) { m_isFix = isFix; }
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
|
||||
Reference in New Issue
Block a user