[merge commit]

This commit is contained in:
kimnuri
2025-12-31 15:26:49 +09:00
parent 4ad14e2866
commit bded4c41fd
18 changed files with 183 additions and 208 deletions
@@ -75,13 +75,10 @@ void CCallBack_Playable_HitReport::onShapeHit(const PSX::PxControllerShapeHit& h
case PXOBJECT::DOOR:
{
PSX::PxRigidDynamic* pDynamic = static_cast<PSX::PxRigidDynamic*>(pActor);
_float fDot = vDir.dot(PSX::PxVec3(0.f, 1.f, 0.f));
if (fDot > 0) {
pDynamic->addTorque(PSX::PxVec3(0.f, 1.f, 0.f) * fLength * 100.f, PSX::PxForceMode::eFORCE);
}
else {
pDynamic->addTorque(PSX::PxVec3(0.f, -1.f, 0.f) * fLength * 100.f, PSX::PxForceMode::eFORCE);
}
PSX::PxVec3 vCompressedDir = -vWorldNormal;
vCompressedDir.normalize();
pDynamic->addTorque(vCompressedDir * 100.f, PSX::PxForceMode::eFORCE);
} break;
default:
{
@@ -105,7 +105,7 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta)
#ifdef _DEBUG
Describe_Entity();
#endif // _DEBUG
#ifndef 기무리
if (dynamic_cast<CPlayer*>(m_pOwner)->Get_UIState() == ENUM_CLASS(UI_STATE::GAMEPLAYER))
{
m_bMovable = true;
@@ -113,6 +113,7 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta)
else {
m_bMovable = false;
}
#endif // 기무리
if (m_pGameInstance->Key_Up(DIK_PGDN)) {
m_bDampingParentPos = !m_bDampingParentPos;
}
@@ -333,7 +333,7 @@ HRESULT CLevel_GamePlay::Ready_Background()
#ifdef 기무리
isReady_Background = true;
isReady_Hogsmeade = true;
isReady_Hogwart = true;
isReady_Hogwart = false;
#endif //
#ifdef 인혁
isReady_Background = false;
+13 -14
View File
@@ -233,7 +233,6 @@
#pragma endregion
#pragma endregion
CLoader::CLoader(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: m_pDevice{ pDevice }
, m_pContext{ pContext }
@@ -1714,7 +1713,7 @@ HRESULT CLoader::Loading_For_GamePlay()
Desc.fDensity = 0.01f;
Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY());
Desc.eLockFlag = {};
Desc.vAutoDamping = { 12.f, 12.f };
Desc.vAutoDamping = { 12.f, 120.f };
Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f };
Desc.vLocalTranslation = { 0.f, 0.f, 0.f };
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_JOINT_ANCHOR"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
@@ -1752,7 +1751,7 @@ HRESULT CLoader::Loading_For_GamePlay()
Desc.fDensity = 0.01f;
Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY());
Desc.eLockFlag = {};
Desc.vAutoDamping = { 12.f, 12.f };
Desc.vAutoDamping = { 12.f, 120.f };
Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f };
Desc.vLocalTranslation = { 0.f, 0.f, 0.f };
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_JOINT_ROUTE"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
@@ -1767,7 +1766,7 @@ HRESULT CLoader::Loading_For_GamePlay()
Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT };
Desc.vMatInfo = { 0.5f, 0.5f, 0.01f };
Desc.fContactOffset = { 0.01f };
Desc.vhalfGeometryInfo = { 0.12f, 0.25f, 0.f };
Desc.vhalfGeometryInfo = { 0.06f, 0.25f, 0.f };
Desc.fDensity = 122.f;
Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY());
Desc.eLockFlag = {};
@@ -1840,25 +1839,25 @@ HRESULT CLoader::Loading_For_GamePlay()
CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{};
{
Desc.eType = ACTOR::BOX;
Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC };
Desc.ePxRigidBodyFlags = { /*PSX::PxRigidBodyFlag::eKINEMATIC*/ };
Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT };
Desc.vMatInfo = { 0.5f, 0.5f, 0.6f };
Desc.vMatInfo = { 0.5f, 0.5f, 0.1f };
Desc.fContactOffset = { 0.05f };
Desc.vhalfGeometryInfo = { 0.35f, 0.65f, 0.15f };
Desc.vhalfGeometryInfo = { 0.5f, 1.f, 0.125f };
Desc.fDensity = 1.f;
PSX::PxTransform pxPivotTransform = PSX::PxTransform(PSX::PxVec3(0.f, 1.f, 0.f));
Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f };
Desc.vLocalTranslation = { 0.5f, 0.f, 0.f };
Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 0.f };
Desc.vLocalTranslation = { 0.f, 0.f, 0.f };
Desc.pxMassCenter = pxPivotTransform;
Desc.eLockFlag = {
PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_X |
//PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_X |
//PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y |
PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z |
PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_Y |
PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_X |
PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_Z
//PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z |
//PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_Y |
//PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_X |
//PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_Z
};
Desc.vAutoDamping = { 10.f, 10.f };
}
+109 -134
View File
@@ -40,91 +40,22 @@ HRESULT CMapElement_Door::Initialize(void* pArg)
if (FAILED(Ready_Components(pArg)))
return E_FAIL;
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPosition), 1.f));
m_pTransformCom->Set_Scale(pDesc->vScale);
m_pTransformCom->Rotation(XMConvertToRadians(pDesc->vRotation.x), XMConvertToRadians(pDesc->vRotation.y), XMConvertToRadians(pDesc->vRotation.z));
XMStoreFloat4((_float4*)&m_pxStartQuat, m_pTransformCom->Get_QuarternionVector());
XMStoreFloat4x4(&m_InitialMatrix, m_pTransformCom->Get_XMWorldMatrix());
m_vRadianYAngle.y = pDesc->vRotation.z;
m_vRadianYAngle.x = m_vRadianYAngle.y + XMConvertToRadians(-70.f);
m_vRadianYAngle.z = m_vRadianYAngle.y + XMConvertToRadians(70.f);
{ // RIGID_BODY
CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{};
Desc.iSubKind = ENUM_CLASS(PXOBJECT::DOOR);
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_DOOR"), (CComponent**)&m_pRigidBody, &Desc))) {
return E_FAIL;
}
}
m_pActor = (PSX::PxRigidDynamic*)m_pRigidBody->Get_Actor();
return S_OK;
}
void CMapElement_Door::Priority_Update(_float fTimeDelta)
{
if (m_pActor->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC) {
m_vKinematicTimer.x += fTimeDelta;
if (m_vKinematicTimer.x < m_vKinematicTimer.z) {
// 행렬없이 럴프 버전
_float fTime = max(0.f, ((m_vKinematicTimer.x - m_vKinematicTimer.y) / (m_vKinematicTimer.z - m_vKinematicTimer.y)));
Lerp_Matrix(fTime);
//Lerp_NonMatrix(fTime);
}
else {
m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, false);
}
}
}
void CMapElement_Door::Update(_float fTimeDelta)
{
#ifdef _DEBUG
Describe_Entity();
#endif // _DEBUG
}
void CMapElement_Door::Late_Update(_float fTimeDelta)
{
_vector vRPY = m_pTransformCom->Get_RollPitchYawVector();
if (!(m_pActor->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC)) {
_float fPitch = XMVectorGetX(vRPY);
_float fYaw = XMVectorGetY(vRPY);
_float fRoll = XMVectorGetZ(vRPY);
_float fClampedYaw = ClampRadian(fYaw);
if (fClampedYaw != fYaw) {
_vector vNewQuat = XMQuaternionRotationRollPitchYaw(fPitch, fClampedYaw, fRoll);
PSX::PxTransform actorPose = m_pActor->getGlobalPose();
PSX::PxTransform massLocalPose = m_pActor->getCMassLocalPose();
PSX::PxVec3 vpxMassLocal = massLocalPose.p;
PSX::PxVec3 vpxMassWorld = actorPose.transform(vpxMassLocal);
_vector vMassLocal = XMVectorSet(vpxMassLocal.x, vpxMassLocal.y, vpxMassLocal.z, 0.f);
_vector vMassWorld = XMVectorSet(vpxMassWorld.x, vpxMassWorld.y, vpxMassWorld.z, 1.f);
_float3 vScale = m_pTransformCom->Get_Scale();
_matrix ScaleMatrix = XMMatrixScalingFromVector(XMLoadFloat3(&vScale));
_matrix RotationMatrix = XMMatrixRotationQuaternion(vNewQuat);
_matrix TranslationLocal = XMMatrixTranslationFromVector(-vMassLocal);
_matrix TranslationWorld = XMMatrixTranslationFromVector(vMassWorld);
// 최종 월드 행렬
_matrix world = TranslationLocal // 피벗중심으로 좌표계를 이동시킴
* (ScaleMatrix * RotationMatrix * TranslationWorld); // 그 후 SRT 적용
m_pTransformCom->Set_WorldMatrix(world);
m_pActor->setGlobalPose(XMWorldToPx_NoScaleNoFlip(world));
m_pActor->setAngularVelocity(PSX::PxVec3(0));
m_pActor->setLinearVelocity(PSX::PxVec3(0));
m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, true);
m_vKinematicTimer.x = 0.f;
}
}
if (m_pGameInstance->IsIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) {
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
}
@@ -187,12 +118,59 @@ HRESULT CMapElement_Door::Ready_Components(void* pArg)
ELEMENT_DOOR_DESC* pPhysXDummyDesc = static_cast<ELEMENT_DOOR_DESC*>(pArg);
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pPhysXDummyDesc->vPosition), 1.f));
m_pTransformCom->Set_Scale(pPhysXDummyDesc->vScale);
m_pTransformCom->Rotation(XMConvertToRadians(pPhysXDummyDesc->vRotation.x), XMConvertToRadians(pPhysXDummyDesc->vRotation.y), XMConvertToRadians(pPhysXDummyDesc->vRotation.z));
{ // RIGID_BODY
CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{};
Desc.iSubKind = ENUM_CLASS(PXOBJECT::DOOR);
Desc.bAutoOwnerTranslation = false;
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_DOOR"), (CComponent**)&m_pRigidBody, &Desc))) {
return E_FAIL;
}
m_pActor = (PSX::PxRigidDynamic*)m_pRigidBody->Get_Actor();
}
PSX::PxTransform pxLocalPivot = {};
pxLocalPivot.p = PSX::PxVec3();//PSX::PxVec3(0.f, pPhysXDummyDesc->vBoxLocalPosition.y * -0.5f, pPhysXDummyDesc->vBoxLocalPosition.z * 0.5f);
XMStoreFloat4((_float4*)&pxLocalPivot.q, XMQuaternionRotationAxis(XMVectorSet(0.f, 0.f, 1.f, 0.f), XM_PIDIV2));
PSX::PxTransform pxGlobalPivot = {};
pxGlobalPivot.p = PSX::PxVec3(39.64f, 5.12f, 71.f);
XMStoreFloat4((_float4*)&pxGlobalPivot.q, XMQuaternionRotationAxis(XMVectorSet(0.f, 0.f, 1.f, 0.f), XM_PIDIV2));
//_vector vAxisWorldUp = XMVectorSet(0.f, 1.f, 0.f, 0.f);
//_vector vPhysXUp = XMVectorSet(1.0f, 0.0f, 0.0f, 0.f);
//_vector vAxisWorldZ = XMVector3Cross(vAxisWorldUp, vPhysXUp);
//_vector vAxisWorldY = XMVector3Cross(vAxisWorldZ, vAxisWorldUp);
//_matrix rotMatrix = ;
//_vector vRotQ = XMQuaternionRotationMatrix(rotMatrix);
m_pJoint = (PSX::PxRevoluteJoint*)m_pGameInstance->Create_PxJoint(PHYSX_JOINT::REVOLUTE, nullptr, pxGlobalPivot, m_pActor, pxLocalPivot);
m_pActor->setSolverIterationCounts(8, 2);
m_pJoint->setLimit(PSX::PxJointAngularLimitPair(-XMConvertToRadians(120.f), XMConvertToRadians(120.f)));
m_pJoint->setRevoluteJointFlag(PSX::PxRevoluteJointFlag::eLIMIT_ENABLED, true);
m_pJoint->setDriveForceLimit(10.f);
m_pJoint->setRevoluteJointFlag(PSX::PxRevoluteJointFlag::eDRIVE_ENABLED, true);
m_pJoint->setConstraintFlag(PSX::PxConstraintFlag::eVISUALIZATION, true);
m_pActor->setLinearVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
m_pActor->setAngularVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
m_pActor->putToSleep();
return S_OK;
}
HRESULT CMapElement_Door::Bind_ShaderResources()
{
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) {
_float3 vScale = m_pTransformCom->Get_Scale();
_float4x4 WorldMatirx = {};
PSX::PxTransform pxPos = m_pRigidBody->Get_GlobalPosition();
XMStoreFloat4x4(&WorldMatirx, XMMatrixAffineTransformation(XMLoadFloat3(&vScale), XMVectorZero(), XMLoadFloat4((_float4*)&pxPos.q), XMVectorSetW(XMLoadFloat3((_float3*)&pxPos.p), 1.f)));
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", &WorldMatirx))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
@@ -209,67 +187,6 @@ HRESULT CMapElement_Door::Bind_ShaderResources()
return S_OK;
}
void CMapElement_Door::Lerp_Matrix(_float fTime)
{
{
_float4x4 OutMatrix = {};
_float4x4 CurrentMatrix = {};
XMStoreFloat4x4(&CurrentMatrix, m_pTransformCom->Get_XMWorldMatrix());
CMyTools::MatrixLerp(&CurrentMatrix, &m_InitialMatrix, OutMatrix, fTime);
m_pTransformCom->Set_WorldMatrix(OutMatrix);
}
}
void CMapElement_Door::Lerp_NonMatrix(_float fTime)
{
{
_vector vCurrQ = m_pTransformCom->Get_QuarternionVector();
_vector vInitialQ = XMLoadFloat4((_float4*)&m_pxStartQuat);
_vector vLerpQuat = XMVector4Normalize(XMVectorLerp(vCurrQ, vInitialQ, fTime));
PSX::PxTransform actorPose = m_pActor->getGlobalPose();
PSX::PxTransform massLocalPose = m_pActor->getCMassLocalPose();
PSX::PxVec3 vpxMassLocal = massLocalPose.p;
PSX::PxVec3 vpxMassWorld = actorPose.transform(vpxMassLocal);
_vector vMassLocal = XMVectorSet(vpxMassLocal.x, vpxMassLocal.y, vpxMassLocal.z, 0.f);
_vector vMassWorld = XMVectorSet(vpxMassWorld.x, vpxMassWorld.y, vpxMassWorld.z, 1.f);
_float3 vScale = m_pTransformCom->Get_Scale();
_matrix ScaleMatrix = XMMatrixScalingFromVector(XMLoadFloat3(&vScale));
_matrix RotationMatrix = XMMatrixRotationQuaternion(vLerpQuat);
_matrix TranslationLocal = XMMatrixTranslationFromVector(-vMassLocal);
_matrix TranslationWorld = XMMatrixTranslationFromVector(vMassWorld);
// 최종 월드 행렬
_matrix world = TranslationLocal // 피벗중심으로 좌표계를 이동시킴
* (ScaleMatrix * RotationMatrix * TranslationWorld); // 그 후 SRT 적용
m_pTransformCom->Set_WorldMatrix(world);
}
}
_float CMapElement_Door::ClampRadian(_float fNewRadian)
{
// [x, z] 사이로 잘라주는 단순한 클램프
_float minYaw = m_vRadianYAngle.x;
_float maxYaw = m_vRadianYAngle.z;
// 라디안 노멀라이즈 ([-pi, pi] 같은 범위로)
fNewRadian = CMyTools::NormalizeRadian(fNewRadian);
if (fNewRadian < minYaw) {
fNewRadian = minYaw;
}
else if (fNewRadian > maxYaw) {
fNewRadian = maxYaw;
}
return fNewRadian;
}
CMapElement_Door* CMapElement_Door::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CMapElement_Door* pInstance = new CMapElement_Door(pDevice, pContext);
@@ -314,6 +231,64 @@ void CMapElement_Door::Free()
void CMapElement_Door::Describe_Entity()
{
GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG);
GUI::PushItemWidth(80);
if (GUI::CollapsingHeader("DOOR")) {
{
m_pActor->wakeUp();
_vector vWorldPos = Get_WorldPostion();
PSX::PxTransform pxActorLocalPos = m_pJoint->getLocalPose(PSX::PxJointActorIndex::eACTOR1);
PSX::PxVec3 vAxis = {};
_float fAngle = {};
pxActorLocalPos.q.toRadiansAndUnitAxis(fAngle, vAxis);
GUI::Text("Pos : %.2f %.2f %.2f", pxActorLocalPos.p.x, pxActorLocalPos.p.y, pxActorLocalPos.p.z);
GUI::Text("fAngle vAxis : %.2f %.2f %.2f %.2f", fAngle, vAxis.x, vAxis.y, vAxis.z);
GUI::Text("Velo : %.2f", m_pJoint->getVelocity());
if (GUI::DragFloat3("Pos ", (_float*)&pxActorLocalPos.p, 0.01f, -2.f, 2.f, "%.2f")) {
m_pJoint->setLocalPose(PSX::PxJointActorIndex::eACTOR1, pxActorLocalPos);
}
if (GUI::DragFloat("fAngle", &fAngle, XMConvertToRadians(1.f), XMConvertToRadians(0.1f), 2.f * XM_2PI, "%.2f")) {
pxActorLocalPos.q = PSX::PxQuat(fAngle, vAxis);
m_pJoint->setLocalPose(PSX::PxJointActorIndex::eACTOR1, pxActorLocalPos);
}
}
{
PSX::PxTransform pxRelativeLocalPos = m_pJoint->getRelativeTransform();
PSX::PxVec3 vAxis = {};
_float fAngle = {};
pxRelativeLocalPos.q.toRadiansAndUnitAxis(fAngle, vAxis);
GUI::Text("RelPos : %.2f %.2f %.2f", pxRelativeLocalPos.p.x, pxRelativeLocalPos.p.y, pxRelativeLocalPos.p.z);
GUI::Text("fAngle vAxis : %.2f %.2f %.2f %.2f", fAngle, vAxis.x, vAxis.y, vAxis.z);
}
_float fDrive = m_pJoint->getDriveVelocity();
_float fDriveDegree = XMConvertToDegrees(fDrive);
if (GUI::DragFloat("Drive", &fDriveDegree, 1.f, -180.f, 180.f, "%.2f")) {
fDrive = XMConvertToRadians(fDriveDegree);
m_pJoint->setDriveVelocity(fDrive);
}
_float2 vDriveLimit = {};
_float2 vSpring = {};
{
auto pxDriveLimit = m_pJoint->getLimit();
vDriveLimit = { pxDriveLimit.lower, pxDriveLimit.upper };
vSpring.x = pxDriveLimit.stiffness;
vSpring.y = pxDriveLimit.damping;
//pxDriveLimit.;
}
if (GUI::DragFloat2("Limit ", (_float*)&vDriveLimit, XMConvertToRadians(1.f), -XMConvertToRadians(180.f), XMConvertToRadians(180.f), "%.2f")) {
m_pJoint->setLimit(PSX::PxJointAngularLimitPair(vDriveLimit.x, vDriveLimit.y, PSX::PxSpring(vSpring.x, vSpring.y)));
}
if (GUI::DragFloat2("Spring Damping", (_float*)&vSpring, 1.f, 0.f, 100.f, "%.2f")) {
m_pJoint->setLimit(PSX::PxJointAngularLimitPair(vDriveLimit.x, vDriveLimit.y, PSX::PxSpring(vSpring.x, vSpring.y)));
}
static _bool bKinematic = false;
if (GUI::Checkbox("KINE", &bKinematic)) {
m_pRigidBody->Set_Kinematic(bKinematic);
}
}
GUI::End();
}
#endif // _DEBUG
+11 -11
View File
@@ -221,17 +221,17 @@ void CPlayer::Late_Update(_float fTimeDelta)
////////////////////////////////////////////////////////////////////////////
#ifdef 기무리
if (nullptr == m_pRobePart) {
{
CPlayerRobe::PlayerRobe_DESC Desc{};
Desc.pModel = m_pModelCom;
Desc.pParentTransform = m_pTransformCom;
Desc.pSocketMatrix = m_pModelCom->Get_BoneMatrixPtr("Hips_Cloth");
if (FAILED(Add_PartObject<CPlayerRobe>("RobePart", g_iStaticLevel, &m_pRobePart, &Desc))) {
assert(false);
}
}
}
//if (nullptr == m_pRobePart) {
// {
// CPlayerRobe::PlayerRobe_DESC Desc{};
// Desc.pModel = m_pModelCom;
// Desc.pParentTransform = m_pTransformCom;
// Desc.pSocketMatrix = m_pModelCom->Get_BoneMatrixPtr("Hips_Cloth");
// if (FAILED(Add_PartObject<CPlayerRobe>("RobePart", g_iStaticLevel, &m_pRobePart, &Desc))) {
// assert(false);
// }
// }
//}
#endif // 기무리
}
@@ -99,9 +99,9 @@ HRESULT CPlayerRobe::Helper_RouteJointGenerater(CRigidBody_Dynamic::RIGIDBODY_DY
PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y--
PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_BasicPxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_BasicPxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
return S_OK;
}
@@ -356,8 +356,8 @@ HRESULT CPlayerRobe::Ready_Components()
PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y--
PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_BasicPxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_BasicPxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
}
}
{
@@ -381,8 +381,8 @@ HRESULT CPlayerRobe::Ready_Components()
PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y--
PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_BasicPxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_BasicPxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
}
}
{
@@ -406,8 +406,8 @@ HRESULT CPlayerRobe::Ready_Components()
PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y--
PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_BasicPxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_BasicPxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
}
}
}
@@ -433,6 +433,13 @@ HRESULT CRanrok::Render_Nonblend()
return E_FAIL;
}
#ifdef _DEBUG
#ifdef 기무리
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
return E_FAIL;
}
#endif // 기무리
#endif // _DEBUG
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
@@ -27,15 +27,12 @@ class CMapElement_Door final : public CMapElement
virtual HRESULT Render() override;
private:
CRigidBody* m_pRigidBody = { nullptr };
CRigidBody_Dynamic* m_pRigidBody = { nullptr };
PSX::PxRigidDynamic* m_pActor = { nullptr };
PSX::PxRevoluteJoint* m_pJoint = { nullptr };
_float3 m_vRadianYAngle = {};
_float3 m_vKinematicTimer = { 0.f, 2.f, 2.3f };
PSX::PxQuat m_pxStartQuat = {};
_float4x4 m_InitialMatrix = {};
#ifdef _DEBUG
_bool m_bUseSelectColor = { true };
@@ -50,9 +47,6 @@ class CMapElement_Door final : public CMapElement
virtual HRESULT Initialize(void* pArg) override;
virtual HRESULT Ready_Components(void* pArg) override;
virtual HRESULT Bind_ShaderResources() override;
void Lerp_Matrix(_float fTime);
void Lerp_NonMatrix(_float fTime);
_float ClampRadian(_float fNewRadian);
public:
static CMapElement_Door* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
@@ -1432,7 +1432,7 @@ technique11 DefaultTechnique
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_Default, 0);
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_MAIN();
VertexShader = compile vs_5_0 VS_MAIN_LEGACY();
GeometryShader = NULL;
PixelShader = compile ps_5_0 PS_Dragon_Body();
}
@@ -20,7 +20,7 @@ HRESULT CDynamic_D6Joint::Initialize_Prototype()
HRESULT CDynamic_D6Joint::Initialize(void* pArg)
{
DYNAMICJOINT_DESC* pDesc = static_cast<DYNAMICJOINT_DESC*>(pArg);
m_pJoint = m_pGameInstance->Create_PxD6Joint(pDesc->pActor0, pDesc->pActor1, *pDesc->pxJointWorldPos);
m_pJoint = m_pGameInstance->Create_BasicPxD6Joint(pDesc->pActor0, pDesc->pActor1, *pDesc->pxJointWorldPos);
return S_OK;
}
#ifdef _DEBUG
@@ -1057,9 +1057,9 @@ PSX::PxJoint* CGameInstance::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor
{
return m_pPhysX_Manager->Create_PxJoint(eType, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1);
}
PSX::PxD6Joint* CGameInstance::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos)
PSX::PxD6Joint* CGameInstance::Create_BasicPxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos)
{
return m_pPhysX_Manager->Create_PxD6Joint(pActor0, pActor1, pxJointWorldPos);
return m_pPhysX_Manager->Create_BasicPxD6Joint(pActor0, pActor1, pxJointWorldPos);
}
_bool CGameInstance::SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer)
{
@@ -177,7 +177,7 @@ PSX::PxJoint* CPhysX_Manager::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActo
return pOut;
}
PSX::PxD6Joint* CPhysX_Manager::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos)
PSX::PxD6Joint* CPhysX_Manager::Create_BasicPxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos)
{
const PSX::PxTransform pxWorldParentPos = pActor0->getGlobalPose();
const PSX::PxTransform pxWorldChildPos = pActor1->getGlobalPose();
@@ -187,8 +187,8 @@ PSX::PxD6Joint* CPhysX_Manager::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, P
PSX::PxD6Joint* pJoint = PSX::PxD6JointCreate(*m_pPhysics, pActor0, pxLocalParentPOs, pActor1, pxLocalChildPos);
pActor0->setSolverIterationCounts(8, 2);
pActor1->setSolverIterationCounts(8, 2);
pActor0->setSolverIterationCounts(16, 2);
pActor1->setSolverIterationCounts(16, 2);
pJoint->setMotion(PSX::PxD6Axis::eX, PSX::PxD6Motion::eLOCKED);
pJoint->setMotion(PSX::PxD6Axis::eY, PSX::PxD6Motion::eLOCKED);
@@ -198,12 +198,11 @@ PSX::PxD6Joint* CPhysX_Manager::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, P
pJoint->setMotion(PSX::PxD6Axis::eSWING2, PSX::PxD6Motion::eLIMITED);
pJoint->setTwistLimit(PSX::PxJointAngularLimitPair(-0.35f, 0.35f)); // 20도
pJoint->setSwingLimit(PSX::PxJointLimitCone(0.10f, 0.10f)); // 40도
pJoint->setTwistLimit(PSX::PxJointAngularLimitPair(-XMConvertToRadians(1.f), XMConvertToRadians(1.f))); // 20도
pJoint->setSwingLimit(PSX::PxJointLimitCone(XMConvertToRadians(1.f), XMConvertToRadians(1.f)));
pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(50.0f, 10.0f, FLT_MAX, true));
pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(50.0f, 100.0f, FLT_MAX, true));
pJoint->setDrivePosition(PSX::PxTransform(PSX::PxIdentity)); //생성 시 프레임 기준
//pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(0.0f, 0.0f, 0.0f, false));
pJoint->setConstraintFlag(PSX::PxConstraintFlag::eVISUALIZATION, true);
pJoint->setConstraintFlag(PSX::PxConstraintFlag::eIMPROVED_SLERP, true);
+10 -10
View File
@@ -248,11 +248,11 @@ void CRenderer::Render_Shadow()
m_pContext->RSSetViewports(1, &ViewPortDesc);
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_NEAR)]) {
if (nullptr != pRenderObject) {
if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_NEAR))) {
assert(false);
}
}
//if (nullptr != pRenderObject) {
// if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_NEAR))) {
// assert(false);
// }
//}
SAFE_RELEASE(pRenderObject);
}
@@ -282,11 +282,11 @@ void CRenderer::Render_Shadow()
m_pContext->RSSetViewports(1, &ViewPortDesc);
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_MIDDLE)]) {
if (nullptr != pRenderObject) {
if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_MIDDLE))) {
assert(false);
}
}
//if (nullptr != pRenderObject) {
// if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_MIDDLE))) {
// assert(false);
// }
//}
SAFE_RELEASE(pRenderObject);
}
@@ -12,6 +12,9 @@ typedef unsigned short _ushort;
typedef signed int _int;
typedef unsigned int _uint;
typedef XMUINT2 _uint2;
typedef XMUINT3 _uint3;
typedef XMUINT4 _uint4;
typedef signed long _long;
typedef unsigned long _ulong;
+1 -1
View File
@@ -219,7 +219,7 @@ class ENGINE_DLL CGameInstance final : public CBase
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel);
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel);
PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1);
PSX::PxD6Joint* Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos);
PSX::PxD6Joint* Create_BasicPxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos);
_bool SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer);
_bool SphereCast(_float fRadius, _fvector vStartPos, _gvector vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer);
@@ -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
@@ -36,7 +36,7 @@ class CPhysX_Manager final : public CBase
// https://documentation.help/nvidia-physx-sdk-guide/Joints.html
PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1);
PSX::PxD6Joint* Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos);
PSX::PxD6Joint* Create_BasicPxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos);
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh, _uint iLevel);
void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc, _uint iLevel);