Merge branch 'Develope' into UI
This commit is contained in:
@@ -45,6 +45,20 @@ float GetRimLight(float3 vCamPosition, float3 vPosition, float3 vNormal, float f
|
||||
return fRimLight;
|
||||
}
|
||||
|
||||
float LinearAttenuation(float fLightRange, float fLightDistance)
|
||||
{
|
||||
return saturate((fLightRange - fLightDistance) / fLightRange);
|
||||
}
|
||||
|
||||
float PowerAttenuation(float fLightRange, float fLightDistance, float fPower)
|
||||
{
|
||||
// 1 -> Linear,
|
||||
// ( 1 > fPower )-> 뾰족하게 감쇄
|
||||
// ( 1 < fPower )-> 완만하게 감쇄
|
||||
float fValue = saturate((fLightRange - fLightDistance) / fLightRange);
|
||||
return pow(fValue, fPower);
|
||||
}
|
||||
|
||||
float2 Get_MovedUV(float2 vOriginalUV, float fDeltaU, float fDeltaV, uint iIndexU, uint iIndexV)
|
||||
{
|
||||
float2 vDelta = float2(fDeltaU, fDeltaV);
|
||||
@@ -145,6 +159,8 @@ PBR_LIGHT_OUT PBR_Lighting(
|
||||
if (NdotL <= 0 || NdotV <= 0)
|
||||
{
|
||||
return Out;
|
||||
Out.vShade = 0;
|
||||
Out.vSpecular = 0;
|
||||
}
|
||||
|
||||
float fAlpha = max(fRoughness * fRoughness, 0.04f);
|
||||
|
||||
@@ -129,7 +129,7 @@ DepthStencilState DSS_Default_Environment_SRead
|
||||
DepthStencilState DSS_Default_OutLine_SWrite
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = zero;
|
||||
DepthWriteMask = true;
|
||||
DepthFunc = less_equal;
|
||||
|
||||
StencilEnable = true;
|
||||
|
||||
@@ -25,6 +25,9 @@ float g_fLightRange;
|
||||
float g_fSpotInnerAngle;
|
||||
float g_fSpotOuterAngle;
|
||||
|
||||
bool g_bUsePowerLightAttenuation;
|
||||
float g_fLightAttenuationPower;
|
||||
|
||||
vector g_vLightDir;
|
||||
vector g_vLightPos;
|
||||
vector g_vLightPosOffset;
|
||||
@@ -181,7 +184,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fDiffuseAOStrength = lerp(0.3f, 3.f, fOcclusion);
|
||||
//float fDiffuseAOStrength = lerp(0.3f, 3.f, fOcclusion);
|
||||
{ // 수치조정 // 디렉셔널
|
||||
float fMinRoughness = 0.05f;
|
||||
fRoughness = max(fRoughness, fMinRoughness); // 러프니스 최소값 보장
|
||||
@@ -191,11 +194,14 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
|
||||
|
||||
PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
|
||||
PBR_Out.vShade *= fOcclusion;
|
||||
|
||||
PBR_Out.vShade *= fDiffuseAOStrength;
|
||||
float3 vAmbient = g_vLightAmbient.rgb * fOcclusion * fAttenuation;
|
||||
float3 vFinalDiffuse = PBR_Out.vShade + vAmbient;
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(PBR_Out.vShade, 1.f);
|
||||
Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -229,12 +235,23 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float fOcclusion = 1.f;
|
||||
float fAttenuation = 1.f;
|
||||
|
||||
float fCameraDistance = length(g_vCamPosition.xyz - vWorldPosition.xyz);
|
||||
float fLightDistance = length(g_vLightPos.xyz - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
float3 vFinalLightPosition = g_vLightPos.xyz + g_vLightPosOffset.xyz;
|
||||
|
||||
float fCameraDistance = length(g_vCamPosition.xyz - vWorldPosition.xyz);
|
||||
float fLightDistance = length(vFinalLightPosition - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(vFinalLightPosition - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
|
||||
if (g_bUsePowerLightAttenuation)
|
||||
{
|
||||
fAttenuation = PowerAttenuation(g_fLightRange, fLightDistance, g_fLightAttenuationPower);
|
||||
}
|
||||
else
|
||||
{
|
||||
fAttenuation = LinearAttenuation(g_fLightRange, fLightDistance);
|
||||
}
|
||||
|
||||
|
||||
fAttenuation = saturate((g_fLightRange - fLightDistance) / g_fLightRange);
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
@@ -268,7 +285,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fDiffuseAOStrength = lerp(0.3f, 3.f, fOcclusion);
|
||||
//float fDiffuseAOStrength = lerp(0.3f, 3.f, fOcclusion);
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
fRoughness = max(fRoughness, fMinRoughness); // 러프니스 최소값 보장
|
||||
@@ -278,10 +295,14 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
|
||||
PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
|
||||
|
||||
PBR_Out.vShade *= fDiffuseAOStrength;
|
||||
PBR_Out.vShade *= fOcclusion;
|
||||
|
||||
Out.vShade = float4(PBR_Out.vShade, 1.f);
|
||||
Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
|
||||
float3 vAmbient = g_vLightAmbient.rgb * fOcclusion * fAttenuation;
|
||||
float3 vFinalDiffuse = PBR_Out.vShade + vAmbient;
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -319,8 +340,19 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float fLightDistance = length(g_vLightPos.xyz - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
float3 vLightToPixel = -vToLight;
|
||||
|
||||
|
||||
if (g_bUsePowerLightAttenuation)
|
||||
{
|
||||
fAttenuation = PowerAttenuation(g_fLightRange, fLightDistance, g_fLightAttenuationPower);
|
||||
}
|
||||
else
|
||||
{
|
||||
fAttenuation = LinearAttenuation(g_fLightRange, fLightDistance);
|
||||
}
|
||||
|
||||
|
||||
fAttenuation = saturate((g_fLightRange - fLightDistance) / g_fLightRange);
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
@@ -328,7 +360,10 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fCosAngle = dot(vToView, g_vLightDir.xyz);
|
||||
// 각도 기반 감쇠
|
||||
float3 vLightDir = normalize(g_vLightDir.xyz);
|
||||
float fCosAngle = dot(vLightDir, vLightToPixel);
|
||||
|
||||
if (fCosAngle < g_fSpotOuterAngle)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
@@ -337,6 +372,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
}
|
||||
|
||||
float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
|
||||
fSpotAttenenuation *= fSpotAttenenuation;
|
||||
fAttenuation *= fSpotAttenenuation;
|
||||
|
||||
if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
|
||||
@@ -365,7 +401,6 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fDiffuseAOStrength = lerp(0.3f, 3.f, fOcclusion);
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
fRoughness = max(fRoughness, fMinRoughness); // 러프니스 최소값 보장
|
||||
@@ -375,10 +410,14 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
|
||||
PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
|
||||
|
||||
PBR_Out.vShade *= fDiffuseAOStrength;
|
||||
PBR_Out.vShade *= fOcclusion;
|
||||
|
||||
float3 vAmbient = g_vLightAmbient.rgb * fOcclusion * fAttenuation;
|
||||
float3 vFinalDiffuse = PBR_Out.vShade + vAmbient;
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(PBR_Out.vShade, 1.f);
|
||||
Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ CAnimation::CAnimation(const CAnimation& rhs)
|
||||
, m_iBoneCount{rhs.m_iBoneCount}
|
||||
, m_fProgress{rhs.m_fProgress }
|
||||
, m_fDurationSeconds{ rhs.m_fDurationSeconds }
|
||||
, m_fTempTrack{rhs.m_fTempTrack }
|
||||
{
|
||||
memcpy_s(m_TickPerSeconds, sizeof(_float) * 2, rhs.m_TickPerSeconds, sizeof(_float) * 2);
|
||||
|
||||
@@ -72,6 +73,7 @@ void CAnimation::ResetRootMotion()
|
||||
void CAnimation::Depart_Animation()
|
||||
{
|
||||
m_fCurrentTrackPosition = 0.f;
|
||||
m_fTempTrack = 0.f;
|
||||
fill(m_CurrentKeyFrameIndices.begin(), m_CurrentKeyFrameIndices.end(), 0);
|
||||
}
|
||||
_float CAnimation::Get_AnimProgressRatio()
|
||||
@@ -212,6 +214,118 @@ void CAnimation::InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, _float
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CAnimation::InterpSecondAnim(CAnimation* pPreAnim, vector<_uint> BoneMask,vector<CBone*>& Bones, _float fRatio)
|
||||
{
|
||||
if (!pPreAnim)
|
||||
return;
|
||||
|
||||
if (m_Channels.empty() || pPreAnim->m_Channels.empty())
|
||||
return;
|
||||
|
||||
if (Bones.empty())
|
||||
return;
|
||||
|
||||
if (fRatio <= 0.f)
|
||||
fRatio = 0.f;
|
||||
else if (fRatio >= 1.f)
|
||||
fRatio = 1.f;
|
||||
|
||||
_uint boneCount = (_uint)Bones.size();
|
||||
|
||||
vector<_matrix> preBoneMats(boneCount);
|
||||
vector<_bool> preHasBone(boneCount, false);
|
||||
|
||||
_uint preChannelCount = (_uint)pPreAnim->m_Channels.size();
|
||||
_uint preMatCount = (_uint)pPreAnim->m_vBoneTransformationMatrix.size();
|
||||
|
||||
for (_uint i = 0; i < preChannelCount; ++i)
|
||||
{
|
||||
_uint boneIndex = pPreAnim->m_Channels[i]->Get_BoneIndex();
|
||||
if (boneIndex < 0 || boneIndex >= boneCount)
|
||||
continue;
|
||||
|
||||
if (i >= preMatCount)
|
||||
continue;
|
||||
|
||||
preBoneMats[boneIndex] = pPreAnim->m_vBoneTransformationMatrix[i];
|
||||
preHasBone[boneIndex] = true;
|
||||
}
|
||||
|
||||
if (m_vBoneTransformationMatrix.size() < m_Channels.size())
|
||||
m_vBoneTransformationMatrix.resize(m_Channels.size(), XMMatrixIdentity());
|
||||
|
||||
_bool hasSaveAnim = (m_pSaveAnim != nullptr);
|
||||
|
||||
_uint curChannelCount = (_uint)m_Channels.size();
|
||||
_uint curMatCount = (_uint)m_vBoneTransformationMatrix.size();
|
||||
|
||||
for (_uint i = 0; i < curChannelCount; ++i)
|
||||
{
|
||||
_uint boneIndex = m_Channels[i]->Get_BoneIndex();
|
||||
if (boneIndex < 0 || boneIndex >= (boneCount))
|
||||
continue;
|
||||
|
||||
if (i >= curMatCount)
|
||||
continue;
|
||||
|
||||
_matrix curMat = m_vBoneTransformationMatrix[i];
|
||||
|
||||
_bool isUpperBone = BoneMask[boneIndex];
|
||||
|
||||
if (!isUpperBone)
|
||||
{
|
||||
if (preHasBone[boneIndex])
|
||||
Bones[boneIndex]->Set_TransformationMatrix(preBoneMats[boneIndex]);
|
||||
else
|
||||
Bones[boneIndex]->Set_TransformationMatrix(curMat);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!preHasBone[boneIndex] || fRatio <= 0.f)
|
||||
{
|
||||
Bones[boneIndex]->Set_TransformationMatrix(curMat);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fRatio >= 1.f)
|
||||
{
|
||||
Bones[boneIndex]->Set_TransformationMatrix(curMat);
|
||||
continue;
|
||||
}
|
||||
|
||||
_matrix preMat = preBoneMats[boneIndex];
|
||||
|
||||
_vector curS, curR, curT;
|
||||
_vector preS, preR, preT;
|
||||
|
||||
XMMatrixDecompose(&curS, &curR, &curT, curMat);
|
||||
XMMatrixDecompose(&preS, &preR, &preT, preMat);
|
||||
|
||||
_vector finalS = XMVectorLerp(preS, curS, fRatio);
|
||||
_vector finalR = XMQuaternionSlerp(preR, curR, fRatio);
|
||||
_vector finalT = XMVectorLerp(preT, curT, fRatio);
|
||||
|
||||
if (hasSaveAnim)
|
||||
{
|
||||
_string& boneName = m_pSaveAnim->Channels[i].ChannelName;
|
||||
if (boneName == "Reference")
|
||||
{
|
||||
finalT = XMVectorZero();
|
||||
}
|
||||
}
|
||||
|
||||
_matrix finalMat = XMMatrixAffineTransformation(finalS, XMVectorZero(), finalR, finalT);
|
||||
|
||||
Bones[boneIndex]->Set_TransformationMatrix(finalMat);
|
||||
|
||||
m_vBoneTransformationMatrix[i] = finalMat;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CAnimation::CreateGPUData(ID3D11Device* pDevice)
|
||||
{
|
||||
vector<CHANNEL_DESC> channels;
|
||||
|
||||
@@ -139,11 +139,14 @@ void CChannel::Update_TransformationMatirx(
|
||||
LocalPos.Translation.z,
|
||||
1.f);
|
||||
|
||||
if (Bones[m_iBoneIndex]->Compare_Name("Reference") && vector)
|
||||
if (Bones[m_iBoneIndex]->Compare_Name("Reference")|| Bones[m_iBoneIndex]->Compare_Name("root"))
|
||||
{
|
||||
vector[0] = vScale;
|
||||
vector[1] = vRotation;
|
||||
vector[2] = vTranslation;
|
||||
if (vector)
|
||||
{
|
||||
vector[0] = vScale;
|
||||
vector[1] = vRotation;
|
||||
vector[2] = vTranslation;
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsSpine)
|
||||
|
||||
@@ -156,20 +156,117 @@ HRESULT CCharacter_Controller::ConvertToDO(CRigidBody_Dynamic& BodyOriginal)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CCharacter_Controller::Set_OnGroundFlag(_bool bOnGround)
|
||||
{
|
||||
m_iIsOnGround = iCoyote_Counter;
|
||||
}
|
||||
|
||||
void CCharacter_Controller::Set_CurrentSlope(_float fSlope)
|
||||
{
|
||||
m_fCurrentSlopeDegree = fSlope;
|
||||
}
|
||||
|
||||
void CCharacter_Controller::Rewind_Grounded()
|
||||
{
|
||||
if (m_eBeforeCollisionFlags.isSet(PSX::PxControllerCollisionFlag::eCOLLISION_DOWN)) {
|
||||
m_iIsOnGround = iCoyote_Counter;
|
||||
return;
|
||||
}
|
||||
m_iIsOnGround -= 1;
|
||||
if (0 > m_iIsOnGround) {
|
||||
m_iIsOnGround = 0;
|
||||
}
|
||||
}
|
||||
|
||||
_bool CCharacter_Controller::UpdateGroundByCast(_float fTimeDelta)
|
||||
{
|
||||
_vector vFoot = Get_FootPosition();
|
||||
_float3 fFoot;
|
||||
XMStoreFloat3(&fFoot, vFoot);
|
||||
fFoot.y += 0.0625f;
|
||||
|
||||
PSX::PxSweepBuffer pxBuffer = {};
|
||||
|
||||
m_pController->getFootPosition();
|
||||
_bool bHit = { false };
|
||||
|
||||
bHit = m_pGameInstance->SphereCast(0.0625f, fFoot, { 0.f, -1.f, 0.f }, 0.0625f, PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eSTATIC, pxBuffer);
|
||||
|
||||
if (true == bHit) { // 쿼리해서 스태틱 중에 터레인 액터들이 맞으면 다시 갱신
|
||||
const PSX::PxSweepHit& hit = pxBuffer.block;
|
||||
|
||||
PSX::PxRigidActor* pActor = hit.actor;
|
||||
PSX::PxShape* pShape = hit.shape;
|
||||
|
||||
if (nullptr != pActor && nullptr != pActor->userData)
|
||||
{
|
||||
PhsXUserData* pUserData = static_cast<PhsXUserData*>(pActor->userData);
|
||||
|
||||
switch (pUserData->eKind)
|
||||
{
|
||||
case PHYSX_KIND::BODY_STATIC:
|
||||
{
|
||||
switch (PXOBJECT(pUserData->iSubKind))
|
||||
{
|
||||
case PXOBJECT::TERRAIN:
|
||||
case PXOBJECT::FLOOR:
|
||||
case PXOBJECT::ROAD:
|
||||
{ // 임계값 이상이면 지면에 서서히 붙임
|
||||
_float fYHitPos = hit.position.y;
|
||||
_float fYFoot = (_float)m_pController->getFootPosition().y;
|
||||
_float fDiff = (fYHitPos - fYFoot);
|
||||
if (fDiff > m_vAccHeight.w) {
|
||||
_vector vMomentum = m_pTransform->Get_CurrentMomentum();
|
||||
_float fYCurrentMomentum = XMVectorGetY(vMomentum);
|
||||
fYCurrentMomentum = fDiff * 0.3f;
|
||||
m_pTransform->Set_CurrentMomentum(XMVectorSetY(vMomentum, fYCurrentMomentum));
|
||||
}
|
||||
else {
|
||||
m_iIsOnGround = iCoyote_Counter;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
case PHYSX_KIND::BODY_DYNAMIC:
|
||||
break;
|
||||
case PHYSX_KIND::CCTActor:
|
||||
case PHYSX_KIND::OBSTACLEActor:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bHit;
|
||||
}
|
||||
|
||||
void CCharacter_Controller::Move(_float fTimeDelta)
|
||||
{
|
||||
PSX::PxVec3 pxVecMomentum = {}; // 순간 이동량
|
||||
_float fMinimumDistant = FLT_EPSILON3; // 이동량 오차 허용치, ( 크면 클수록 이동이 더 일찍 끝난다, 순간 이동량보다 같거나 더 크면 안움직일듯? )
|
||||
PSX::PxControllerFilters pxFilter = {}; // 충돌 대상 필터
|
||||
const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다?
|
||||
|
||||
if (true == m_bGravity) {
|
||||
m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * m_fGravity * fTimeDelta, 0.f, 0.f));
|
||||
if (0 >= m_iIsOnGround) { // 공중: 무조건 중력
|
||||
m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * m_fGravity * fTimeDelta, 0.f, 0.f));
|
||||
}
|
||||
else if ((iCoyote_Counter) >= m_iIsOnGround) {
|
||||
UpdateGroundByCast(fTimeDelta); // 바닥에 플레이어 붙이게 함
|
||||
}
|
||||
else if (m_fCurrentSlopeDegree > m_fWalkableSlopeDegree) { // 너무 가파른 경사: 중력
|
||||
//m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * fTimeDelta, 0.f, 0.f));
|
||||
}
|
||||
else {
|
||||
// 아니면 안함
|
||||
}
|
||||
}
|
||||
XMStoreFloat3((_float3*)&pxVecMomentum, m_pTransform->Get_CurrentMomentum());
|
||||
|
||||
|
||||
m_eBeforeCollisionFlags = m_pController->move(pxVecMomentum, fMinimumDistant, fTimeDelta, pxFilter, pPxObstacles);
|
||||
|
||||
}
|
||||
|
||||
void CCharacter_Controller::Set_Position(_fvector vNewPos)
|
||||
@@ -205,7 +302,7 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
m_eBodyType = pDesc->eBodyType;
|
||||
m_bAutoStepping = pDesc->bAutoStepping;
|
||||
m_pTransform = pDesc->pTransform;
|
||||
|
||||
m_fWalkableSlopeDegree = pDesc->fWalkableSlope;
|
||||
}
|
||||
{ // PhsXUserData
|
||||
m_tagData.eKind = PHYSX_KIND::CCTActor;
|
||||
@@ -226,6 +323,8 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
Desc.contactOffset = pDesc->fContactOffset;
|
||||
Desc.reportCallback = pDesc->pCallback_HitReport;
|
||||
Desc.behaviorCallback = pDesc->pCallback_Behavior;
|
||||
Desc.slopeLimit = cosf(XMConvertToRadians(m_fWalkableSlopeDegree));
|
||||
Desc.nonWalkableMode = PSX::PxControllerNonWalkableMode::ePREVENT_CLIMBING;
|
||||
Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
|
||||
m_pController = m_pGameInstance->Add_BoxController(Desc);
|
||||
m_pController->setUserData(&m_tagData);
|
||||
@@ -240,6 +339,8 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
Desc.contactOffset = pDesc->fContactOffset;
|
||||
Desc.reportCallback = pDesc->pCallback_HitReport;
|
||||
Desc.behaviorCallback = pDesc->pCallback_Behavior;
|
||||
Desc.slopeLimit = cosf(XMConvertToRadians(m_fWalkableSlopeDegree));
|
||||
Desc.nonWalkableMode = PSX::PxControllerNonWalkableMode::ePREVENT_CLIMBING;
|
||||
Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
|
||||
m_pController = m_pGameInstance->Add_CapsuleController(Desc);
|
||||
m_pController->setUserData(&m_tagData);
|
||||
@@ -256,8 +357,6 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pController->setSlopeLimit(m_fSlopeLimit);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (FAILED(Debug_Initialize())) {
|
||||
return E_FAIL;
|
||||
@@ -378,7 +477,11 @@ void CCharacter_Controller::Describe_Entity()
|
||||
GUIHelpMarker("A capsule is affected by its lower sphere and tends to generate an up vector on steps.\nIn eEASY, the up vector is combined with the step offset, allowing easier climbing; in eCONSTRAINED, the up vector is removed during step detection and only the step offset is used.");
|
||||
}
|
||||
}
|
||||
GUI::Text("%.1f", XMConvertToDegrees(acosf(m_fSlopeLimit))); GUI::SameLine(); GUI::SliderFloat("m_fSlopeLimit", &m_fSlopeLimit, 0.0f, 1.f);
|
||||
GUI::Text("%.1f", m_fCurrentSlopeDegree);
|
||||
GUI::Text("%.1f", m_fWalkableSlopeDegree); GUI::SameLine(); if (GUI::SliderFloat("m_fWalkableSlopeDegree", &m_fWalkableSlopeDegree, 0.0f, 90.f)) {
|
||||
m_pController->setSlopeLimit(cosf(XMConvertToRadians(m_fWalkableSlopeDegree)));
|
||||
}
|
||||
GUI::DragFloat("m_vAccHeight.w", &m_vAccHeight.w, 0.01f, 0.f, 1.f);
|
||||
GUI::SliderFloat("m_fGravity_Multiplier", &m_fGravity, 0.0f, 3.f);
|
||||
if (GUI::SliderFloat3("Volume", (_float*)&vVolume, 0.1f, 10.f, "%.2f")) {
|
||||
Modify_Volume(vVolume);
|
||||
|
||||
@@ -652,7 +652,9 @@ void CGameInstance::Add_SaveModel(const _char* filePath, SaveModel sModel)
|
||||
|
||||
SaveModel* CGameInstance::Load_SaveModel(const _char* filePath)
|
||||
{
|
||||
m_mtxLoadModelLock.lock();
|
||||
auto iter = m_sModelMap.find(filePath);
|
||||
m_mtxLoadModelLock.unlock();
|
||||
return &iter->second;
|
||||
}
|
||||
|
||||
@@ -684,6 +686,10 @@ PSX::PxRevoluteJoint* CGameInstance::Create_PxRevoluteJoint(PSX::PxRigidActor* p
|
||||
{
|
||||
return m_pPhysX_Manager->Create_PxRevoluteJoint(pActorFrame, pxLocalWallFrame, pActorObject, pxLocalActorFrame);
|
||||
}
|
||||
_bool CGameInstance::SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer)
|
||||
{
|
||||
return m_pPhysX_Manager->SphereCast(fRadius, vStartPos, vDir, fDistance, flagHitsData, flagQuery, hitBuffer);
|
||||
}
|
||||
PSX::PxController* CGameInstance::Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc)
|
||||
{
|
||||
return m_pPhysX_Manager->Add_CapsuleController(Desc);
|
||||
@@ -727,6 +733,10 @@ HRESULT CGameInstance::LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleM
|
||||
{
|
||||
return m_pPhysX_Manager->LoadTriMeshes(pPath, TriMeshes);
|
||||
}
|
||||
void CGameInstance::Add_Editor_Plane(PhsXUserData& PlaneData)
|
||||
{
|
||||
m_pPhysX_Manager->Add_Editor_Plane(PlaneData);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region FOG
|
||||
|
||||
@@ -52,8 +52,6 @@ HRESULT CLight::Initialize(void* pArg)
|
||||
|
||||
m_LightDesc = *pLightDesc;
|
||||
|
||||
m_pGameInstance->Add_Light(m_LightDesc.iLevel, this);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -92,9 +90,18 @@ HRESULT CLight::Render(CShader* pShader, CVIBuffer* pVIBuffer) const
|
||||
if (FAILED(pShader->Bind_RawValue("g_fSpotOuterAngle", &m_LightDesc.vSpotAngles.y, sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(pShader->Bind_RawValue("g_bUsePowerLightAttenuation", &m_bUsePowerAttenuation, sizeof(_bool)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(pShader->Bind_RawValue("g_fLightAttenuationPower", &m_fLightAttenuationPower, sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
iPassIndex = ENUM_CLASS(SHADER_PASS_DEFERRED::SPOT);
|
||||
}
|
||||
else {
|
||||
if (FAILED(pShader->Bind_RawValue("g_fLightRange", &m_LightDesc.fRange, sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(pShader->Bind_RawValue("g_vLightPos", m_LightDesc.pPosition, sizeof(_float4)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -104,6 +111,12 @@ HRESULT CLight::Render(CShader* pShader, CVIBuffer* pVIBuffer) const
|
||||
if (FAILED(pShader->Bind_RawValue("g_fLightRange", &m_LightDesc.fRange, sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(pShader->Bind_RawValue("g_bUsePowerLightAttenuation", &m_bUsePowerAttenuation, sizeof(_bool)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(pShader->Bind_RawValue("g_fLightAttenuationPower", &m_fLightAttenuationPower, sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
iPassIndex = ENUM_CLASS(SHADER_PASS_DEFERRED::POINT);
|
||||
}
|
||||
|
||||
@@ -180,6 +193,11 @@ void CLight::Describe_Entity()
|
||||
GUI::DragFloat4("Specular", reinterpret_cast<float*>(&m_LightDesc.vSpecular), 0.01f, 0.f, 1.f);
|
||||
GUI::DragFloat("Range", &m_LightDesc.fRange, 1.f, 0.f);
|
||||
GUI::DragFloat2("SpotAngle", reinterpret_cast<float*>(&m_LightDesc.vSpotAngles));
|
||||
GUI::Checkbox("UseLinearAtt", &m_bUsePowerAttenuation);
|
||||
if (true == m_bUsePowerAttenuation) {
|
||||
GUI::SameLine();
|
||||
GUI::DragFloat("Power", &m_fLightAttenuationPower, 0.01f, 0.01f);
|
||||
}
|
||||
|
||||
GUI::Spacing();
|
||||
GUI::Spacing();
|
||||
|
||||
@@ -209,6 +209,10 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
m_fRatio = (m_fBlendTime / m_fBlendDuration);
|
||||
if (m_fRatio > 1.f) m_fRatio = 1.f;
|
||||
|
||||
m_fSecondBlendTime += fTimeDelta;
|
||||
m_fSecondRatio = (m_fSecondBlendTime / m_fSecondBlendDuration);
|
||||
if (m_fSecondRatio > 1.f) m_fSecondRatio = 1.f;
|
||||
|
||||
CAnimation* pCurAnim = m_Animations[m_iCurrentAnimIndex];
|
||||
CAnimation* pPreAnim = m_Animations[m_iPreAnimIndex];
|
||||
|
||||
@@ -216,18 +220,47 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
|
||||
m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
pCurAnim->InterpAnim(pPreAnim, m_Bones, m_fRatio);
|
||||
|
||||
m_bIsSecondFinishedAnim = pSecondAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask);
|
||||
|
||||
pSecondAnim->InterpSecondAnim(pCurAnim, m_iBoneMask, m_Bones, m_fSecondRatio);
|
||||
if (m_fRatio >= 1.f)
|
||||
{
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
m_fBlendTime = 0.f;
|
||||
}
|
||||
|
||||
if (m_bIsSecondFinishedAnim)
|
||||
{
|
||||
if (m_bIsSecondLoop)
|
||||
{
|
||||
m_fSecondRatio = 1.f;
|
||||
}
|
||||
else
|
||||
m_fSecondBlendTime = 0.f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fSecondBlendTime += fTimeDelta;
|
||||
m_fSecondRatio = (m_fSecondBlendTime / m_fSecondBlendDuration);
|
||||
if (m_fSecondRatio > 1.f) m_fSecondRatio = 1.f;
|
||||
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
|
||||
m_bIsSecondFinishedAnim = m_Animations[m_iCurrSecondAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask);
|
||||
m_Animations[m_iCurrSecondAnimIndex]->InterpSecondAnim(m_Animations[m_iCurrentAnimIndex], m_iBoneMask, m_Bones, m_fSecondRatio);
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
|
||||
if (m_bIsSecondFinishedAnim)
|
||||
{
|
||||
if (m_bIsSecondLoop)
|
||||
{
|
||||
m_fSecondRatio = 1.f;
|
||||
}
|
||||
else
|
||||
m_fSecondBlendTime = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bRatio) {
|
||||
@@ -264,9 +297,9 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
return m_bIsFinishedAnim;
|
||||
}
|
||||
|
||||
void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop,_float fAmount,_bool bRatio)
|
||||
void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop, _float fAmount, _bool bRatio)
|
||||
{
|
||||
if (m_iCurrentAnimIndex == iIndex){
|
||||
if (m_iCurrentAnimIndex == iIndex) {
|
||||
return;
|
||||
}
|
||||
if (iIndex >= 0 && iIndex < m_iNumAnimations)
|
||||
@@ -275,12 +308,16 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop,_float fAmount,_bool
|
||||
m_vPrevRootRot = { 0.f,0.f,0.f,0.f };
|
||||
m_bInitialRootRotSaved = false;
|
||||
m_bInitialRootPos = false;
|
||||
if (m_iCurrentAnimIndex != -1)
|
||||
{
|
||||
m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
|
||||
m_Animations[m_iCurrentAnimIndex]->ResetRootMotion();
|
||||
}
|
||||
m_iCurrentAnimIndex = iIndex;
|
||||
m_bIsLoop = isLoop;
|
||||
m_fAmount = fAmount;
|
||||
m_bRatio = bRatio;
|
||||
m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
|
||||
m_Animations[m_iCurrentAnimIndex]->ResetRootMotion();
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -288,7 +325,7 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop,_float fAmount,_bool
|
||||
}
|
||||
}
|
||||
|
||||
void CModel::Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex,_bool isLoop)
|
||||
void CModel::Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex, _bool isLoop)
|
||||
{
|
||||
if (m_iCurrSecondAnimIndex == iIndex) {
|
||||
return;
|
||||
@@ -298,6 +335,7 @@ void CModel::Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex,_bool isLo
|
||||
m_iCurrSecondAnimIndex = iIndex;
|
||||
m_bIsSecondLoop = isLoop;
|
||||
m_iBoneMask = m_BoneMask[BoneIndex];
|
||||
m_fSecondBlendTime = 0.f;
|
||||
}
|
||||
else {
|
||||
m_iCurrSecondAnimIndex = -1;
|
||||
@@ -306,7 +344,8 @@ void CModel::Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex,_bool isLo
|
||||
|
||||
void CModel::Update_RootBone(_float Amount)
|
||||
{
|
||||
if (m_Bones[m_iRootBoneIndex]->Compare_Name("Reference") && m_pTransform != nullptr)
|
||||
if (m_Bones[m_iRootBoneIndex]->Compare_Name("Reference")&&
|
||||
m_pTransform != nullptr)
|
||||
{
|
||||
_float4x4 Root = m_Bones[m_iRootBoneIndex]->Get_TransformationMatrix();
|
||||
_matrix local = XMLoadFloat4x4(&Root);
|
||||
@@ -326,7 +365,7 @@ void CModel::Update_RootBone(_float Amount)
|
||||
_float dy = XMVectorGetY(vDeltaAdjusted);
|
||||
_float dz = XMVectorGetZ(vDeltaAdjusted);
|
||||
|
||||
_vector vDeltaWorld = vRight * dx + (vUp * dz) + (-vLook * dy);
|
||||
_vector vDeltaWorld = vRight * dx + (vUp * dz) + (-vLook * dy);
|
||||
|
||||
vDeltaWorld *= 0.01f;
|
||||
vDeltaWorld *= Amount;
|
||||
@@ -378,6 +417,58 @@ void CModel::Update_RootBone(_float Amount)
|
||||
|
||||
local = XMMatrixAffineTransformation(scale, XMVectorSet(0.f, 0.f, 0.f, 1.f), rot, trans);
|
||||
|
||||
m_Bones[m_iRootBoneIndex]->Set_TransformationMatrix(local);
|
||||
}
|
||||
else if (m_Bones[m_iRootBoneIndex]->Compare_Name("root") &&
|
||||
m_pTransform != nullptr)
|
||||
{
|
||||
_float4x4 Root = m_Bones[m_iRootBoneIndex]->Get_TransformationMatrix();
|
||||
_matrix local = XMLoadFloat4x4(&Root);
|
||||
|
||||
_matrix pre = XMLoadFloat4x4(&m_PreTransformMatrix);
|
||||
|
||||
_float4 curRotF4;
|
||||
XMStoreFloat4(&curRotF4, m_vector[1]);
|
||||
_vector qCur = XMLoadFloat4(&curRotF4);
|
||||
|
||||
if (!m_bInitialRootRotSaved)
|
||||
{
|
||||
m_vInitialRootRot = curRotF4;
|
||||
m_vPrevRootRot = curRotF4;
|
||||
m_bInitialRootRotSaved = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_vector qPrev = XMLoadFloat4(&m_vPrevRootRot);
|
||||
_vector qInvPrev = XMQuaternionInverse(qPrev);
|
||||
_vector qDelta = XMQuaternionMultiply(qInvPrev, qCur);
|
||||
|
||||
_vector axisLocal;
|
||||
_float angle = 0.f;
|
||||
XMQuaternionToAxisAngle(&axisLocal, &angle, qDelta);
|
||||
|
||||
_vector axisWorld = XMVector3TransformNormal(axisLocal, pre);
|
||||
axisWorld = XMVector3Normalize(axisWorld);
|
||||
|
||||
_float4 axis;
|
||||
XMStoreFloat4(&axis, axisWorld);
|
||||
|
||||
swap(axis.z, axis.y);
|
||||
m_pTransform->TurnAngle(XMLoadFloat4(&axis), angle);
|
||||
|
||||
}
|
||||
XMStoreFloat4(&m_vPrevRootRot, qCur);
|
||||
|
||||
_vector qInit = XMLoadFloat4(&m_vInitialRootRot);
|
||||
|
||||
_vector scale, rot, trans;
|
||||
XMMatrixDecompose(&scale, &rot, &trans, local);
|
||||
|
||||
rot = qInit;
|
||||
trans = XMVectorZero();
|
||||
|
||||
local = XMMatrixAffineTransformation(scale, XMVectorSet(0.f, 0.f, 0.f, 1.f), rot, trans);
|
||||
|
||||
m_Bones[m_iRootBoneIndex]->Set_TransformationMatrix(local);
|
||||
}
|
||||
}
|
||||
@@ -447,6 +538,11 @@ _float CModel::Get_CurrentTrackProgressRatio()
|
||||
return m_Animations[m_iCurrentAnimIndex]->Get_CurrentTrackProgressRatio();
|
||||
}
|
||||
|
||||
_float CModel::Get_TrackProgressRatio(_uint iIndex)
|
||||
{
|
||||
return m_Animations[iIndex]->Get_CurrentTrackProgressRatio();
|
||||
}
|
||||
|
||||
_float CModel::Get_AnimSpeed()
|
||||
{
|
||||
return m_Animations[m_iCurrentAnimIndex]->Get_AnimSpeed();
|
||||
@@ -457,7 +553,7 @@ void CModel::Set_AnimSpeed(_float fSpeed)
|
||||
m_Animations[m_iCurrentAnimIndex]->Set_AnimSpeed(fSpeed);
|
||||
}
|
||||
|
||||
HRESULT CModel::Anim_Event(_float fRatio,_uint AnimIndex,function<void()> Event)
|
||||
HRESULT CModel::Anim_Event(_float fRatio, _uint AnimIndex, function<void()> Event)
|
||||
{
|
||||
if (AnimIndex == m_iCurrentAnimIndex)
|
||||
{
|
||||
@@ -1308,7 +1404,7 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _
|
||||
m_eType = eType;
|
||||
|
||||
LoadData(pModelFilePath);
|
||||
|
||||
|
||||
m_pSaveModel = m_pGameInstance->Load_SaveModel(pModelFilePath);
|
||||
|
||||
LoadAdditionalAnimations(pModelFilePath);
|
||||
@@ -1611,9 +1707,9 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
m_pTransform = m_pOwner->Get_Component<CTransform>();
|
||||
SAFE_ADDREF(m_pTransform);
|
||||
|
||||
|
||||
|
||||
if (m_eType == MODEL::ANIM)
|
||||
{
|
||||
{
|
||||
Initialize_RootBone();
|
||||
InItialize_BoneIndex();
|
||||
Initialize_BoneMasks();
|
||||
@@ -1633,7 +1729,7 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
Create_ParentVB();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1696,7 +1792,7 @@ HRESULT CModel::Ready_Animations(const vector<CBone*>& Bones)
|
||||
|
||||
for (size_t i = 0; i < m_iNumAnimations; i++)
|
||||
{
|
||||
CAnimation* pAnimation = CAnimation::Create(Bones,this, &m_pSaveModel->Animations[i]);
|
||||
CAnimation* pAnimation = CAnimation::Create(Bones, this, &m_pSaveModel->Animations[i]);
|
||||
if (nullptr == pAnimation)
|
||||
return E_FAIL;
|
||||
|
||||
@@ -1790,7 +1886,7 @@ void CModel::Describe_Entity()
|
||||
|
||||
_string name = {};
|
||||
for (_uint i = 0; i < m_iNumAnimations; ++i) {
|
||||
|
||||
|
||||
name.clear();
|
||||
name.append(m_Animations[i]->Get_SZName());
|
||||
|
||||
@@ -1800,7 +1896,7 @@ void CModel::Describe_Entity()
|
||||
name = name.substr(pos);
|
||||
name = to_string(i) + '\t' + name + '\n';
|
||||
name.shrink_to_fit();
|
||||
WriteFile(hFile, name.data(),(DWORD) name.length(), nullptr, nullptr);
|
||||
WriteFile(hFile, name.data(), (DWORD)name.length(), nullptr, nullptr);
|
||||
}
|
||||
|
||||
CloseHandle(hFile);
|
||||
|
||||
@@ -13,36 +13,54 @@ COcclusionQuery::COcclusionQuery(const COcclusionQuery& rhs)
|
||||
|
||||
void COcclusionQuery::Begin_Query()
|
||||
{
|
||||
m_pContext->Begin(m_pQuery);
|
||||
m_pContext->Begin(m_pQuery[m_iCountFrame]);
|
||||
}
|
||||
|
||||
_bool COcclusionQuery::isDraw()
|
||||
{
|
||||
UINT64 iNumSample;
|
||||
|
||||
if (m_pContext->GetData(m_pQuery, &iNumSample, sizeof(UINT64), 0) != S_OK)
|
||||
return m_bPreFrameDraw;
|
||||
static int sCheckFrame = 0;
|
||||
|
||||
0 < iNumSample ? m_bThisFrameDraw = true : m_bThisFrameDraw = false;
|
||||
bool bVisible = m_bPreFrameDraw;
|
||||
|
||||
_bool bDraw = { false };
|
||||
|
||||
if(true == m_bThisFrameDraw)
|
||||
m_NumCullFrame = 0;
|
||||
else
|
||||
if (++sCheckFrame >= 5)
|
||||
{
|
||||
if(m_NumCullFrame < 5)
|
||||
++m_NumCullFrame;
|
||||
sCheckFrame = 0;
|
||||
|
||||
UINT64 sampleCount = 0;
|
||||
HRESULT hr = m_pContext->GetData(
|
||||
m_pQuery[m_iGetFrameIndex],
|
||||
&sampleCount,
|
||||
sizeof(UINT64),
|
||||
D3D11_ASYNC_GETDATA_DONOTFLUSH
|
||||
);
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
bVisible = (sampleCount > 0);
|
||||
}
|
||||
}
|
||||
|
||||
m_bPreFrameDraw = m_bThisFrameDraw;
|
||||
if (bVisible)
|
||||
{
|
||||
m_iNumCullFrame = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_iNumCullFrame < 2)
|
||||
++m_iNumCullFrame;
|
||||
}
|
||||
|
||||
return m_NumCullFrame < 5;
|
||||
m_bPreFrameDraw = bVisible;
|
||||
return (m_iNumCullFrame < 2);
|
||||
}
|
||||
|
||||
void COcclusionQuery::End_Query()
|
||||
{
|
||||
m_pContext->End(m_pQuery);
|
||||
m_pContext->End(m_pQuery[m_iCountFrame]);
|
||||
|
||||
m_iGetFrameIndex = (m_iCountFrame + 5 - 1) % 5;
|
||||
|
||||
m_iCountFrame = (m_iCountFrame + 1) % 5;
|
||||
}
|
||||
|
||||
HRESULT COcclusionQuery::Initialize_Prototype()
|
||||
@@ -57,14 +75,17 @@ HRESULT COcclusionQuery::Initialize(void* pArg)
|
||||
queryDesc.Query = D3D11_QUERY_OCCLUSION;
|
||||
queryDesc.MiscFlags = 0;
|
||||
|
||||
if (FAILED(m_pDevice->CreateQuery(&queryDesc, &m_pQuery)))
|
||||
for (_uint i = 0; i < 5; i++)
|
||||
{
|
||||
MSG_BOX("Failed to Created : ID3D11Query");
|
||||
return E_FAIL;
|
||||
if (FAILED(m_pDevice->CreateQuery(&queryDesc, &m_pQuery[i])))
|
||||
{
|
||||
MSG_BOX("Failed to Created : ID3D11Query");
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
m_bPreFrameDraw = m_bThisFrameDraw = true;
|
||||
m_NumCullFrame = 0;
|
||||
m_iNumCullFrame = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -99,7 +120,9 @@ void COcclusionQuery::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pQuery);
|
||||
for(auto& pQuery : m_pQuery)
|
||||
SAFE_RELEASE(pQuery);
|
||||
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
@@ -113,6 +113,7 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody
|
||||
{ // SetUp HeightField
|
||||
PSX::PxHeightField* pHeightField = Find_HeightField(RigidBody.Get_PxMeshKey());
|
||||
PSX::PxHeightFieldGeometry* pPxHeightGeometry = new PSX::PxHeightFieldGeometry(pHeightField);
|
||||
pPxHeightGeometry->heightScale = 0.01f/* 기본 정밀도 100배 0.01 -> 1cm, 1 -> 1m */;
|
||||
|
||||
// 유효성 체크
|
||||
PX_ASSERT(pPxHeightGeometry->isValid());
|
||||
@@ -152,6 +153,23 @@ PSX::PxMaterial* CPhysX_Manager::Create_Material(const _float3* vMatInfo)
|
||||
return pPxMaterial;
|
||||
}
|
||||
|
||||
_bool CPhysX_Manager::SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer)
|
||||
{
|
||||
PSX::PxSphereGeometry sphereGeom(fRadius);
|
||||
|
||||
PSX::PxVec3 startPos(vStartPos.x, vStartPos.y, vStartPos.z);
|
||||
PSX::PxQuat startRot(PSX::PxIdentity);
|
||||
|
||||
PSX::PxTransform startPose(startPos, startRot);
|
||||
|
||||
PSX::PxVec3 sweepDir(vDir.x, vDir.y, vDir.z);
|
||||
sweepDir.normalize();
|
||||
|
||||
PSX::PxQueryFilterData filterData(flagQuery);
|
||||
|
||||
return m_pScene->sweep(sphereGeom, startPose, sweepDir, fDistance, hitBuffer, flagHitsData, filterData);
|
||||
}
|
||||
|
||||
void CPhysX_Manager::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh)
|
||||
{
|
||||
m_TriangleMeshes.emplace(CMyTools::ToWstring(pName), pPxTriMesh);
|
||||
@@ -219,6 +237,19 @@ HRESULT CPhysX_Manager::SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangle
|
||||
assert(ok);
|
||||
return (ok ? S_OK : E_FAIL);
|
||||
}
|
||||
void CPhysX_Manager::Add_Editor_Plane(PhsXUserData& PlaneData)
|
||||
{
|
||||
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
PlaneData.iSubKind = UINT_MAX;
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 0), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_EDITPLANE");
|
||||
m_pScene->addActor(*pGroundPlane);
|
||||
}
|
||||
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
HRESULT CPhysX_Manager::LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes)
|
||||
@@ -509,6 +540,7 @@ HRESULT CPhysX_Manager::Initialize()
|
||||
m_pCCTManager->setPreventVerticalSlidingAgainstCeiling(false); // 천장타고 슬라이딩 허용 비허용
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
// 디버그서버의 클라 세팅
|
||||
PSX::PxPvdSceneClient* pPvdClient = m_pScene->getScenePvdClient();
|
||||
if (nullptr != pPvdClient) {
|
||||
@@ -516,25 +548,20 @@ HRESULT CPhysX_Manager::Initialize()
|
||||
pPvdClient->setScenePvdFlag(PSX::PxPvdSceneFlag::eTRANSMIT_CONTACTS, true);
|
||||
pPvdClient->setScenePvdFlag(PSX::PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true);
|
||||
}
|
||||
#endif DEBUG
|
||||
|
||||
m_pMaterials.reserve(ENUM_CLASS(PXMATERIAL::END));
|
||||
m_pMaterials.push_back(m_pPhysics->createMaterial(0.5f, 0.5f, 0.6f));
|
||||
|
||||
// m_pScene->overlap();??????
|
||||
#ifdef EDITOR_PROJECT
|
||||
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
PlaneData.iSubKind = UINT_MAX;
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
|
||||
if (true == m_bDebugCreatePlane) {
|
||||
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
PlaneData.iSubKind = UINT_MAX;
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 0), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_MANAGER_PLANE");
|
||||
m_pScene->addActor(*pGroundPlane);
|
||||
}
|
||||
#endif
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 50), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_MANAGER_PLANE");
|
||||
m_pScene->addActor(*pGroundPlane);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -175,6 +175,36 @@ _vector CTransform::Go_Down(_float fTimeDelta)
|
||||
return -vMomentum;
|
||||
}
|
||||
|
||||
_vector CTransform::Go_LerpStraight(_float fSpeed, _float fTimeDelta)
|
||||
{
|
||||
_vector vPos = Get_State(STATE::POSITION);
|
||||
_vector vLook =Get_State(STATE::LOOK);
|
||||
_vector vMomentum = XMVector3Normalize(vLook) * fSpeed * fTimeDelta;
|
||||
vPos += vMomentum;
|
||||
Set_State(STATE::POSITION, vPos);
|
||||
return +vMomentum;
|
||||
}
|
||||
|
||||
_vector CTransform::Go_LerpUp(_float fSpeed, _float fTimeDelta)
|
||||
{
|
||||
_vector vPos = Get_State(STATE::POSITION);
|
||||
_vector vUp = Get_State(STATE::UP);
|
||||
_vector vMomentum = XMVector3Normalize(vUp) * fSpeed * fTimeDelta;
|
||||
vPos += vMomentum;
|
||||
Set_State(STATE::POSITION, vPos);
|
||||
return +vMomentum;
|
||||
}
|
||||
|
||||
_vector CTransform::Go_LerpDown(_float fSpeed, _float fTimeDelta)
|
||||
{
|
||||
_vector vPos = Get_State(STATE::POSITION);
|
||||
_vector vUp = Get_State(STATE::UP);
|
||||
_vector vMomentum = XMVector3Normalize(vUp) * fSpeed * fTimeDelta;
|
||||
vPos -= vMomentum;
|
||||
Set_State(STATE::POSITION, vPos);
|
||||
return -vMomentum;
|
||||
}
|
||||
|
||||
void CTransform::Translation(_float3& vTrans)
|
||||
{
|
||||
Translation(XMLoadFloat3(&vTrans));
|
||||
@@ -193,6 +223,10 @@ _vector CTransform::Get_CurrentMomentum() const
|
||||
{
|
||||
return XMLoadFloat3(&m_vMomentum);
|
||||
}
|
||||
void CTransform::Set_CurrentMomentum(_fvector vMomentum)
|
||||
{
|
||||
XMStoreFloat3(&m_vMomentum, vMomentum);
|
||||
}
|
||||
_vector CTransform::Get_EstimatedPositionByMomentum() const
|
||||
{
|
||||
return XMVectorSetW(Get_State(STATE::POSITION) + XMLoadFloat3(&m_vMomentum), 1.f);
|
||||
@@ -326,6 +360,28 @@ void CTransform::LookAt(_fvector vAt)
|
||||
Set_State(STATE::LOOK, XMVector3Normalize(vLook) * vScale.z);
|
||||
}
|
||||
|
||||
void CTransform::LookAt_Horizontal(_fvector vAt)
|
||||
{
|
||||
_float3 vScale = Get_Scale();
|
||||
_vector vPos = Get_State(STATE::POSITION);
|
||||
|
||||
_vector vLook = XMVectorSet(
|
||||
XMVectorGetX(vAt) - XMVectorGetX(vPos),
|
||||
0.f,
|
||||
XMVectorGetZ(vAt) - XMVectorGetZ(vPos),
|
||||
0.f
|
||||
);
|
||||
|
||||
vLook = XMVector3Normalize(vLook);
|
||||
|
||||
_vector vRight = XMVector3Cross(XMVectorSet(0.f, 1.f, 0.f, 0.f), vLook);
|
||||
_vector vUp = XMVector3Cross(vLook, vRight);
|
||||
|
||||
Set_State(STATE::RIGHT, XMVector3Normalize(vRight) * vScale.x);
|
||||
Set_State(STATE::UP, XMVector3Normalize(vUp) * vScale.y);
|
||||
Set_State(STATE::LOOK, XMVector3Normalize(vLook) * vScale.z);
|
||||
}
|
||||
|
||||
_float CTransform::TargetDis(_fvector vTarget)
|
||||
{
|
||||
_vector vTargetDis = vTarget - Get_State(STATE::POSITION);
|
||||
|
||||
@@ -211,8 +211,9 @@ HRESULT CVIBuffer_Terrain::Initialize_Prototype(const _char* pFilePath)
|
||||
Safe_Delete_Array(pPixels);
|
||||
|
||||
m_pQuadTree = CQuadTree::Create(m_iNumVerticesX * m_iNumVerticesZ - m_iNumVerticesX, m_iNumVerticesX * m_iNumVerticesZ - 1, m_iNumVerticesX - 1, 0);
|
||||
if (nullptr == m_pQuadTree)
|
||||
if (nullptr == m_pQuadTree){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pQuadTree->SetUp_Neighbors();
|
||||
|
||||
@@ -400,7 +401,7 @@ void CVIBuffer_Terrain::ConvertToHeightField(const _tchar* pStaticKey)
|
||||
_uint iIndex = iRow * m_iNumVerticesX + iCol;
|
||||
_uint iPhysXIndex = iCol * m_iNumVerticesZ + iRow;
|
||||
|
||||
_float fRealHeight = m_HeigthValues[iIndex];
|
||||
_float fRealHeight = m_pVertexPositions[iIndex].y * 100.f /* 100배의 정밀도 1cm 단위. */;
|
||||
PSX::PxI16 iClampHeight = (PSX::PxI16)(PSX::PxClamp(fRealHeight, -32767.f, 32767.f));
|
||||
|
||||
PSX::PxHeightFieldSample& pxSample = pxSamples[iPhysXIndex];
|
||||
|
||||
@@ -23,6 +23,8 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
vector<_int>* Capture_Bones();
|
||||
void InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, _float fRatio);
|
||||
|
||||
void InterpSecondAnim(CAnimation* pPreAnim, vector<_uint> BoneMask, vector<CBone*>& Bones, _float fRatio);
|
||||
|
||||
void CreateGPUData(ID3D11Device* pDevice);
|
||||
|
||||
|
||||
@@ -32,7 +34,7 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
const _char* Get_SZName() const { return m_szName; }
|
||||
void Set_CurrentTrackPosition(_float TrackPosition) { m_fCurrentTrackPosition = TrackPosition; }
|
||||
_float Get_CurrentTrackPosition() { return m_fCurrentTrackPosition; }
|
||||
_float Get_CurrentTrackProgressRatio() { return m_fTempTrack / m_fDurationSeconds; }
|
||||
_float Get_CurrentTrackProgressRatio() { return m_fTempTrack / m_fDurationSeconds;}
|
||||
void Set_AnimSpeed(_float fSpeed) { m_fAnimSpeed = fSpeed; }
|
||||
_float Get_AnimSpeed() { return m_fAnimSpeed; }
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CTransform;
|
||||
|
||||
constexpr _int iCoyote_Counter = 3;
|
||||
|
||||
class ENGINE_DLL CCharacter_Controller final :
|
||||
public CComponent
|
||||
{
|
||||
@@ -14,19 +17,19 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
#pragma region STRUCT
|
||||
typedef struct tagCharacter_ControllerDesc
|
||||
{
|
||||
CTransform* pTransform = { nullptr };
|
||||
ACTOR eBodyType = { ACTOR::END };
|
||||
_float fContactOffset = { 0.f };
|
||||
_float3 fMaterial = { 0.5f, 0.5f, 0.6f };
|
||||
_bool bAutoStepping = { false }; // 계단 높이 타게 할건지 // 박스 콜라이더는 생각한대로 되는데 캡슐은 바닥의 구체 때문에 예상보다 더 높은 곳까지 오를 수 있음
|
||||
_float fStepOffset = { 0.05f }; // 허용가능한 계단 높이, 작게 유지하는게 좋음
|
||||
CTransform* pTransform = { nullptr };
|
||||
ACTOR eBodyType = { ACTOR::END };
|
||||
_float fContactOffset = { 0.f };
|
||||
_float3 fMaterial = { 0.9f, 0.9f, 0.6f };
|
||||
_bool bAutoStepping = { false }; // 계단 높이 타게 할건지 // 박스 콜라이더는 생각한대로 되는데 캡슐은 바닥의 구체 때문에 예상보다 더 높은 곳까지 오를 수 있음
|
||||
_float fStepOffset = { 0.05f }; // 허용가능한 계단 높이, 작게 유지하는게 좋음
|
||||
_uint iSubKind = { };
|
||||
PSX::PxUserControllerHitReport* pCallback_HitReport = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함
|
||||
PSX::PxControllerBehaviorCallback* pCallback_Behavior = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함
|
||||
PSX::PxUserControllerHitReport* pCallback_HitReport = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함
|
||||
PSX::PxControllerBehaviorCallback* pCallback_Behavior = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함
|
||||
|
||||
// 타고 올라갈 수 없는 경사면의 각도를 정의함. 0.f 면 비활성화 됨
|
||||
// _float fSlopeLimit = { 코사인각도 };
|
||||
|
||||
_float fWalkableSlope = { 22.f };
|
||||
|
||||
// Box인 경우 채워넣기
|
||||
_float3 vBoxSize = { 0.5f, 0.5f, 0.5f }; // CCT박스는 회전없는 AABB임
|
||||
|
||||
@@ -46,7 +49,7 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
virtual HRESULT Render() override;
|
||||
#endif
|
||||
PSX::PxRigidDynamic* Get_Actor();
|
||||
PSX::PxController* Get_Controller();
|
||||
PSX::PxController* Get_Controller();
|
||||
|
||||
_float Get_ContactOffset() const { return m_pController->getContactOffset(); }
|
||||
void Set_ContactOffset(_float fValue) { return m_pController->setContactOffset((PSX::PxF32)fValue); }
|
||||
@@ -55,25 +58,32 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
void Set_Position(_fvector vNewPos); // 순간이동
|
||||
_vector Get_Position();
|
||||
_vector Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 바닥 위치가 더 아래에 위치한다는 뜻 )
|
||||
|
||||
|
||||
PSX::PxControllerCollisionFlags Get_CollisionFlags();
|
||||
void Resize_Volume(_float fHeight); // 높이를 수정하고 바닥에 붙임
|
||||
void Modify_Volume(_float3 fVolume);
|
||||
void Modify_Volume(_float3 fVolume); // 높이 수정하고 바닥에 붙든 말든 상관안함
|
||||
_float3 Get_Volume();
|
||||
|
||||
HRESULT ConvertToDO(class CRigidBody_Dynamic& BodyOriginal);
|
||||
void Set_OnGroundFlag(_bool bOnGround);
|
||||
_bool IsGravity() { return m_bGravity; }
|
||||
void SetGravity(_bool bCondition) { m_bGravity = bCondition; };
|
||||
void Set_CurrentSlope(_float fSlope);
|
||||
void Rewind_Grounded();
|
||||
_bool IsActive() const { return m_bActive; }
|
||||
void SetActive(_bool bCondition) { m_bActive = bCondition; }
|
||||
_bool UpdateGroundByCast(_float fTimeDelta);
|
||||
|
||||
private:
|
||||
ACTOR m_eBodyType = { ACTOR::END };
|
||||
PSX::PxController* m_pController = { nullptr };
|
||||
CTransform* m_pTransform = { nullptr };
|
||||
_bool m_bAutoStepping = { false };
|
||||
_float m_fGravity = { 0.094f };
|
||||
_float m_fSlopeLimit = { 0.302f/*0~1*/}; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 )
|
||||
_float m_fGravity = { 0.450f };
|
||||
_float m_fWalkableSlopeDegree = { 22.f }; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 )
|
||||
_float m_fCurrentSlopeDegree = { 0.f };
|
||||
_int m_iIsOnGround = { 0 };
|
||||
_float4 m_vAccHeight = { 0.f, 0.16f, 0.f, 0.01f };
|
||||
PhsXUserData m_tagData = {};
|
||||
|
||||
PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};
|
||||
|
||||
@@ -19,7 +19,7 @@ enum class TEXTURE_LOAD_TYPE {
|
||||
};
|
||||
enum class PXMATERIAL {
|
||||
DEFAULT,
|
||||
END,
|
||||
END, // 정지마찰, 운동마찰, 반발계수
|
||||
};
|
||||
enum class PXBODYSTATE {
|
||||
DYNAMIC,
|
||||
@@ -89,6 +89,98 @@ enum class PHYSX_KIND {
|
||||
OBSTACLEActor,
|
||||
};
|
||||
|
||||
enum class PXOBJECT : _uint {
|
||||
#pragma region NOT_DEFINE
|
||||
NOT_DEFINE = 000,
|
||||
#pragma endregion
|
||||
#pragma region PLAYER
|
||||
PLAYER = 010,
|
||||
#pragma endregion
|
||||
#pragma region MONSTER
|
||||
MONSTER = 030,
|
||||
GOBLIN_WARRIOR, // 031
|
||||
GOBLIN_MAGICIAN,
|
||||
GOBLIN_THEIF,
|
||||
TROLL,
|
||||
PENSIVE_GUARDIAN,
|
||||
|
||||
#pragma endregion
|
||||
#pragma region HOSTILE_HITBOX
|
||||
HOSTILE_HITBOX = 100,
|
||||
GOBLIN_SMASH,
|
||||
GOBLIN_DAGGER,
|
||||
GOBLIN_SHIELD_BREAK_MELEE,
|
||||
GOBLIN_SHIELD_BREAK_MAGIC,
|
||||
GOBLIN_NORMAL_MAGIC,
|
||||
|
||||
#pragma endregion
|
||||
#pragma region ALLY_HITBOX
|
||||
ALLY_HITBOX = 200,
|
||||
SKILL_REVAILIO,
|
||||
SKILL_ACCIO,
|
||||
SKILL_DEPULSO,
|
||||
SKILL_DEPULSO_OBSTACLE,
|
||||
SKILL_DEPULSO_OBSTACLE_FLAMED,
|
||||
SKILL_NORMALJAP,
|
||||
SKILL_NORMALJAP_FINAL,
|
||||
SKILL_BOMBARD_STRIKE,
|
||||
SKILL_BOMBARD_FLAME,
|
||||
SKILL_INCENDIO_STRIKE,
|
||||
SKILL_INCENDIO_SPREAD,
|
||||
|
||||
#pragma endregion
|
||||
#pragma region NEUTRAL_HITBOX
|
||||
NEUTRAL_HITBOX = 300,
|
||||
FLAMED_FLOOR,
|
||||
|
||||
#pragma endregion
|
||||
#pragma region ENVIRIONMENT
|
||||
ENVIRIONMENT = 400,
|
||||
TERRAIN,
|
||||
FLOOR,
|
||||
ROAD,
|
||||
WATER,
|
||||
WALL,
|
||||
WALL_BREAKABLE,
|
||||
WALL_CLIMBABLE,
|
||||
DOOR,
|
||||
BUILDING,
|
||||
BOX,
|
||||
#pragma endregion
|
||||
#pragma region NPC
|
||||
NPC = 500,
|
||||
|
||||
#pragma endregion
|
||||
#pragma region ITEM
|
||||
ITEM = 600,
|
||||
DROPITEM = 630,
|
||||
TRAP = 660,
|
||||
|
||||
#pragma endregion
|
||||
#pragma region TRIGGERBOX
|
||||
TRIGGERBOX = 700,
|
||||
|
||||
|
||||
CINEMATIC = 770,
|
||||
CINEMATIC_INTRO,
|
||||
CINEMATIC_HOGSMEADE_ENTER,
|
||||
CINEMATIC_TROLL_ENCOUNTER,
|
||||
CINEMATIC_TROLL_DEAD,
|
||||
#pragma endregion
|
||||
#pragma region REGION
|
||||
REGION = 800,
|
||||
HOGWARTS,
|
||||
HOGSMEADE,
|
||||
|
||||
#pragma endregion
|
||||
#pragma region NOCOLLIDE
|
||||
NOCOLLIDE = 900,
|
||||
GAIL,
|
||||
|
||||
#pragma endregion
|
||||
END = 999
|
||||
};
|
||||
|
||||
NS_END
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ enum ESTATE : _u64Flag
|
||||
HIT = 1ULL << 18,
|
||||
BROOM_RIDE = 1ULL << 19,
|
||||
MOUNT_B = 1ULL << 20,
|
||||
DISMOUNT = 1ULL << 21,
|
||||
END
|
||||
};
|
||||
NS_END
|
||||
|
||||
@@ -12,7 +12,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
private:
|
||||
CGameInstance();
|
||||
virtual ~CGameInstance() = default;
|
||||
|
||||
mutex m_mtxLoadModelLock = {};
|
||||
public:
|
||||
HRESULT Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11Device** ppDevice, ID3D11DeviceContext** ppContext);
|
||||
void Update_Engine(_float fTimeDelta);
|
||||
@@ -199,6 +199,8 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody);
|
||||
PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame);
|
||||
|
||||
_bool SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer);
|
||||
|
||||
PSX::PxController* Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc);
|
||||
PSX::PxController* Add_BoxController(PSX::PxBoxControllerDesc& Desc);
|
||||
PSX::PxController* Get_Controller(_uint iControllerIndex);
|
||||
@@ -211,6 +213,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
#endif // EDITOR_PROJECT
|
||||
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes); // 모델 불러왔던 경로에 그대로 있음
|
||||
void Add_Editor_Plane(PhsXUserData& PlaneData);
|
||||
#pragma endregion
|
||||
#pragma region THREADHOLDER
|
||||
template<class Function, class... Args>
|
||||
|
||||
@@ -18,6 +18,13 @@ class ENGINE_DLL CLight final : public CComponent
|
||||
public:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
void Switch_LightAttenationMethod() { m_bUsePowerAttenuation = !m_bUsePowerAttenuation; }
|
||||
_bool Is_PowerLightAtt() { return m_bUsePowerAttenuation; }
|
||||
void Set_PowerLightAtt(_bool bValue) { m_bUsePowerAttenuation = bValue; }
|
||||
_float Get_AttPower() { return m_fLightAttenuationPower; }
|
||||
void Set_AttPower(_float fValue) { m_fLightAttenuationPower = fValue; }
|
||||
|
||||
public:
|
||||
const LIGHT_DESC* Get_LightDesc() { return &m_LightDesc; }
|
||||
void Set_Color(_float4& vDiffuse, _float4& vAmbient, _float4& vSpecular);
|
||||
@@ -25,7 +32,12 @@ class ENGINE_DLL CLight final : public CComponent
|
||||
HRESULT Render(class CShader* pShader, class CVIBuffer* pVIBuffer) const;
|
||||
|
||||
private:
|
||||
LIGHT_DESC m_LightDesc = {};
|
||||
LIGHT_DESC m_LightDesc = {};
|
||||
_bool m_bUsePowerAttenuation = { true };
|
||||
_float m_fLightAttenuationPower = { 3.30f };
|
||||
// 1 -> Linear,
|
||||
// ( 1 > fPower )-> 뾰족하게 감쇄
|
||||
// ( 1 < fPower )-> 완만하게 감쇄
|
||||
public:
|
||||
static CLight* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CComponent* Clone(void* pArg, CGameObject* pOwner) override;
|
||||
|
||||
@@ -25,8 +25,8 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
public:
|
||||
#pragma region Model
|
||||
_float Get_Radius() const { return m_fRadius; }
|
||||
_float3& Get_RadiusOffset() { return m_vRadiusOffset; }
|
||||
_float4x4* Get_PreTransformMatrixPtr() { return &m_PreTransformMatrix; }
|
||||
_float3& Get_RadiusOffset() { return m_vRadiusOffset; }
|
||||
_float4x4* Get_PreTransformMatrixPtr() { return &m_PreTransformMatrix; }
|
||||
_float4x4 Get_PreTransformMatrix() const { return m_PreTransformMatrix; };
|
||||
virtual HRESULT Render(_uint iMeshIndex);
|
||||
virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
||||
@@ -36,7 +36,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
_bool Play_Anim(_float fTimeDelta, CTransform* pTransform);
|
||||
_bool Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform);
|
||||
void Set_AnimationIndex(_uint iIndex, _bool isLoop = true, _float fAmount = 1.f, _bool bRatio = false);
|
||||
void Set_Second_AnimationIndex(_uint iIndex,_uint BoneIndex,_bool isLoop = false);
|
||||
void Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex, _bool isLoop = false);
|
||||
_bool IsFinishedAnim() const { return m_bIsFinishedAnim; }
|
||||
_bool IsFinishedSecondAnim() const { return m_bIsSecondFinishedAnim; }
|
||||
_bool IsLoopAnim() const { return m_bIsLoop; }
|
||||
@@ -44,6 +44,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
const _char* Get_AnimList(_uint iIndex);
|
||||
_float Get_CurrentTrackPosition();
|
||||
_float Get_CurrentTrackProgressRatio();
|
||||
_float Get_TrackProgressRatio(_uint iIndex);
|
||||
|
||||
size_t Get_AnimSize() { return m_Animations.size(); }
|
||||
void Set_PlayAnim(_bool bPlayAnim) { m_bPlayAnim = bPlayAnim; }
|
||||
@@ -54,33 +55,35 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
void Set_AnimSpeed(_float fSpeed);
|
||||
|
||||
HRESULT Anim_Event(_float fRatio, _uint AnimIndex, function<void()> Event);
|
||||
|
||||
void Set_BlendDuration(_float Duration) { m_fBlendDuration = Duration; }
|
||||
#pragma endregion
|
||||
#pragma region Mesh
|
||||
const _char* Get_MeshName(_uint iIndex);
|
||||
_uint Get_NumMeshes() const { return m_iNumMeshes; }
|
||||
void Update_RootBone(_float Amount =1.f);
|
||||
void Update_RootBone(_float Amount = 1.f);
|
||||
void Initialize_RootBone();
|
||||
#pragma endregion
|
||||
#pragma region Bone
|
||||
HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName);
|
||||
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
|
||||
static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 )
|
||||
_int Get_BoneIndex(const _char* pBoneName) const;
|
||||
_matrix Get_BoneMatrix(_uint iBoneIndex);
|
||||
void Combined_BoneMatrix();
|
||||
HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName);
|
||||
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
|
||||
static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 )
|
||||
_int Get_BoneIndex(const _char* pBoneName) const;
|
||||
_matrix Get_BoneMatrix(_uint iBoneIndex);
|
||||
void Combined_BoneMatrix();
|
||||
|
||||
|
||||
#pragma endregion
|
||||
#pragma region Material
|
||||
HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader);
|
||||
HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
void ComputeAnimation(_uint AnimIndex);
|
||||
void ComputeAnimation_Second(_uint AnimIndex);
|
||||
void InItialize_BoneIndex();
|
||||
void ComputeAnimation(_uint AnimIndex);
|
||||
void ComputeAnimation_Second(_uint AnimIndex);
|
||||
void InItialize_BoneIndex();
|
||||
|
||||
void Initialize_BoneMasks();
|
||||
void Initialize_BoneMasks();
|
||||
|
||||
public:
|
||||
#ifdef EDITOR_PROJECT
|
||||
@@ -144,11 +147,14 @@ void Combined_BoneMatrix();
|
||||
class CTransform* m_pTransform = { nullptr }; // 모델 대상의 트랜스폼
|
||||
|
||||
_float m_fRatio = {};
|
||||
_int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = {-1,-1,-1,-1,-1,-1};
|
||||
_int m_iCurrSecondAnimIndex = { -1 };
|
||||
_int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1 };
|
||||
_int m_iCurrSecondAnimIndex = { -1 };
|
||||
_bool m_bIsSecondFinishedAnim = { false };
|
||||
_bool m_bIsSecondLoop = { false };
|
||||
_bool m_bIsSecondLoop = { false };
|
||||
vector<vector<_uint>> m_BoneMask;
|
||||
_float m_fSecondBlendTime = {};
|
||||
_float m_fSecondBlendDuration = {0.3f};
|
||||
_float m_fSecondRatio = {};
|
||||
|
||||
|
||||
// 바이너리
|
||||
@@ -175,26 +181,26 @@ void Combined_BoneMatrix();
|
||||
#pragma region Compute
|
||||
|
||||
private:
|
||||
HRESULT Create_ParentVB();
|
||||
HRESULT Create_CS();
|
||||
void Create_Temp();
|
||||
void Create_LocalPosVB();
|
||||
void Create_Con();
|
||||
void UpdateAnimationCS(_uint AnimIndex);
|
||||
HRESULT Create_ParentVB();
|
||||
HRESULT Create_CS();
|
||||
void Create_Temp();
|
||||
void Create_LocalPosVB();
|
||||
void Create_Con();
|
||||
void UpdateAnimationCS(_uint AnimIndex);
|
||||
|
||||
_uint m_iNumBuffer = {};
|
||||
_uint m_iNumBuffer = {};
|
||||
|
||||
vector<PARENT_DESC> m_Parent = {};
|
||||
vector<ANIMSTATE_DESC> m_AnimRanges;
|
||||
vector<PARENT_DESC> m_Parent = {};
|
||||
vector<ANIMSTATE_DESC> m_AnimRanges;
|
||||
|
||||
LOCALPOS_DESC* m_pLocalPos[2] = {nullptr};
|
||||
LOCALPOS_DESC* m_pLocalPos[2] = { nullptr };
|
||||
|
||||
class CComputeShader* m_pComputeShader = nullptr;
|
||||
class CComputeShader* m_pComputeShader = nullptr;
|
||||
|
||||
ID3D11Buffer* m_pConstantBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pConstantBuffer = { nullptr };
|
||||
|
||||
ID3D11Buffer* m_pParentBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pLocalPosBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pParentBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pLocalPosBuffer = { nullptr };
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
|
||||
@@ -17,11 +17,13 @@ class ENGINE_DLL COcclusionQuery final : public CComponent
|
||||
void End_Query();
|
||||
|
||||
private:
|
||||
ID3D11Query* m_pQuery = { nullptr };
|
||||
ID3D11Query* m_pQuery[5] = {};
|
||||
|
||||
_bool m_bPreFrameDraw = {};
|
||||
_bool m_bThisFrameDraw = {};
|
||||
_uint m_NumCullFrame = {};
|
||||
_uint m_iNumCullFrame = {};
|
||||
_uint m_iCountFrame = {};
|
||||
_uint m_iGetFrameIndex = {};
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -29,10 +29,14 @@ class CPhysX_Manager final : public CBase
|
||||
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
|
||||
void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc);
|
||||
PSX::PxMaterial* Create_Material(const _float3* vMatInfo);
|
||||
|
||||
_bool SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer);
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
|
||||
HRESULT ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix);
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
void Add_Editor_Plane(PhsXUserData& PlaneData);
|
||||
#endif // EDITOR_PROJECT
|
||||
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
//HRESULT LoadTriMeshes_Binary(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
@@ -74,7 +78,9 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
PSX::PxScene* m_pScene = { nullptr }; // 피직스 시뮬레이션의 공간
|
||||
PSX::PxControllerManager* m_pCCTManager = { nullptr }; // 피직스 캐릭터 컨트롤러를 전부 추적하고 매니징함
|
||||
PSX::PxPvd* m_pPvd = { nullptr }; // 피직스 시뮬레이션 디버깅을 위한 도구
|
||||
#ifdef _DEBUG
|
||||
PSX::PxPvd* m_pPvd = { nullptr }; // 피직스 시뮬레이션 디버깅을 위한 도구
|
||||
#endif // _DEBUG
|
||||
PSX::PxCookingParams* m_pCookingParam = { nullptr };
|
||||
PSX::PxPvdTransport* m_pTransport = { nullptr };
|
||||
|
||||
@@ -90,12 +96,7 @@ class CPhysX_Manager final : public CBase
|
||||
map<_wstring, PSX::PxHeightFieldGeometry*> m_HeightFieldGeometry = {};
|
||||
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
_bool m_bDebugCreatePlane = { true };
|
||||
PhsXUserData PlaneData = {};
|
||||
#else
|
||||
_bool m_bDebugCreatePlane = { false };
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
vector<PSX::PxMaterial*> m_pMaterials = { };
|
||||
_uint m_iNumLevel = {};
|
||||
|
||||
@@ -15,7 +15,7 @@ enum ESTATE
|
||||
COMBAT, LIGHT_ATTACK, SPELL, SKILL, SKILL2,
|
||||
MAPHELP,POTION,
|
||||
ACCIO,DESCENDO,DIFFINDO,DEPULSO,LUMOS,LUMOS_STOP,DISILLUSION_ENTER,DISILLUSION_EXIT, ANCIENT_THROW,
|
||||
BROOM_IDLE,BROOM_FWD,BROOM_LEFT,BROOM_RIGHT,BROOM_DOWN,BROOM_UP, BROOM_HOVER_IDLE, BROOM_HOVER_START,BROOM_MOUNT, BROOM_MOUNT_END,
|
||||
BROOM_IDLE,BROOM_FWD,BROOM_LEFT,BROOM_RIGHT,BROOM_DOWN,BROOM_UP, BROOM_HOVER_IDLE, BROOM_HOVER_FWD, BROOM_HOVER_LEFT, BROOM_HOVER_RIGHT, BROOM_HOVER_START,BROOM_MOUNT, BROOM_MOUNT_END,BROOM_DISMOUNT,
|
||||
HIT, HIT_FWD, HIT_BWD, HIT_BWD2, HIT_BWD3, HIT_BWD4, HIT_L, HIT_R,
|
||||
KNOCKDOWN, KNOCKDOWN_FWD, KNOCKDOWN_FWD_SPLT, KNOCKDOWN_FWD_SPLT_HOLD, KNOCKDOWN_BWD, KNOCKDOWN_BWD_SPLT, KNOCKDOWN_BWD_SPLT_HOLD,
|
||||
GETUP, GETUP_BWD, GETUP_FWD, GETUP_L, GETUP_L_FD, GETUP_L_FU, GETUP_R, GETUP_R_FD, GETUP_R_FU, GETUP_SLOUCH,
|
||||
@@ -24,7 +24,7 @@ enum ESTATE
|
||||
TUMBLE, TUMBLE2,
|
||||
PETRIFICUSED_START,
|
||||
////////////////////////// 빗자루
|
||||
BROOM_MOUNT_B, BROOM_HOVER_IDLE_B, BROOM_HOVER_STOP_B,BROOM_FLY_DOWN_B, BROOM_FLY_LEFT_B, BROOM_FLY_RIGHT_B, BROOM_FLY_UP_B,BROOM_FLY_B,
|
||||
BROOM_MOUNT_B, BROOM_HOVER_IDLE_B, BROOM_HOVER_STOP_B,BROOM_HOVER_DOWN_B,BROOM_HOVER_UP_B,BROOM_HOVER_LEFT_B,BROOM_HOVER_RIGHT_B,BROOM_FLY_DOWN_B, BROOM_FLY_LEFT_B, BROOM_FLY_RIGHT_B, BROOM_FLY_UP_B,BROOM_FLY_B,
|
||||
/// ////////////////////////////
|
||||
END
|
||||
};
|
||||
|
||||
@@ -47,12 +47,17 @@ class ENGINE_DLL CTransform final :
|
||||
_vector Go_Right(_float fTimeDelta);
|
||||
_vector Go_Up(_float fTimeDelta);
|
||||
_vector Go_Down(_float fTimeDelta);
|
||||
///////////////////////////////////
|
||||
_vector Go_LerpStraight(_float fSpeed, _float fTimeDelta);
|
||||
_vector Go_LerpUp(_float fSpeed, _float fTimeDelta);
|
||||
_vector Go_LerpDown(_float fSpeed, _float fTimeDelta);
|
||||
|
||||
void Translation(_float3& vTrans);
|
||||
void Translation(_fvector vTrans);
|
||||
|
||||
void AccumulateMomentum(_fvector vMomentum);
|
||||
_vector Get_CurrentMomentum() const;
|
||||
void Set_CurrentMomentum(_fvector vMomentum);
|
||||
void RewindMomentum();
|
||||
|
||||
_vector Get_EstimatedPositionByMomentum() const;
|
||||
@@ -67,7 +72,7 @@ class ENGINE_DLL CTransform final :
|
||||
|
||||
// Up, Down 벡터를 바라보게 하면 터짐
|
||||
void LookAt(_fvector vAt);
|
||||
|
||||
void LookAt_Horizontal(_fvector vAt);
|
||||
_float TargetDis(_fvector vTarget);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user