Merge branch 'Develope' into Effect1121_Follow

This commit is contained in:
GiJungSUk
2025-11-21 21:59:19 +09:00
916 changed files with 7606 additions and 3381 deletions
@@ -119,7 +119,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
float3 vF0 = float3(0.04f, 0.04f, 0.04f);
float fMetallic = 0.f;
float fRoughness = 0.f;
float fRoughness = 0.5f;
float fOcclusion = 1.f;
float fAttenuation = 1.f;
@@ -145,13 +145,20 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
fRoughness = vSRO.g;
fOcclusion = vSRO.b;
}
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
{
Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient));
Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f);
float fDiffuseAOStrength = lerp(0.3f, 5.f, fOcclusion);
return Out;
}
float fDiffuseAOStrength = lerp(0.3f, 1.f, fOcclusion);
PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
PBR_Out.vShade *= fDiffuseAOStrength;
saturate(PBR_Out.vShade);
Out.vShade = float4(PBR_Out.vShade, 1.f);
Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
@@ -184,6 +191,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
float3 vF0 = float3(0.04f, 0.04f, 0.04f);
float fMetallic = 0.f;
float fRoughness = 0.5f;
float fOcclusion = 1.f;
float fAttenuation = 1.f;
@@ -213,6 +221,13 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
fRoughness = vSRO.g;
fOcclusion = vSRO.b;
}
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
{
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)));
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
return Out;
}
PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
@@ -282,6 +297,13 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
fRoughness = vSRO.g;
fOcclusion = vSRO.b;
}
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
{
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)));
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
return Out;
}
PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
@@ -0,0 +1,64 @@
float PI = 3.141592;
struct Mesh
{
float3 vPosition;
float3 vNormal;
float3 vTangent;
float3 vBinormal;
float2 vTexcoord;
uint4 vBlendIndex;
float4 vBlendWeight;
};
struct SkinngMesh
{
float3 vPosition;
float3 vNormal;
float3 vTangent;
float3 vBinormal;
float2 vTexcoord;
};
StructuredBuffer<Mesh> g_MeshBufferInput : register(t0);
RWStructuredBuffer<SkinngMesh> gSkinngMeshOutput : register(u0);
cbuffer g_ConstantBuffer : register(b0)
{
row_major float4x4 BoneMatrix[512];
};
//[numthreads(256, 1, 1)]
[numthreads(256, 1, 1)]
void CS_MAIN(uint3 DispatchThreadID : SV_DispatchThreadID)
{
uint iIndex = DispatchThreadID.x;
Mesh mesh = g_MeshBufferInput[iIndex];
float fWeightW = 1.f -
(mesh.vBlendWeight.x + mesh.vBlendWeight.y + mesh.vBlendWeight.z);
matrix SkinMatrix =
BoneMatrix[mesh.vBlendIndex.x] * mesh.vBlendWeight.x +
BoneMatrix[mesh.vBlendIndex.y] * mesh.vBlendWeight.y +
BoneMatrix[mesh.vBlendIndex.z] * mesh.vBlendWeight.z +
BoneMatrix[mesh.vBlendIndex.w] * fWeightW;
float4 vPosition = mul(float4(mesh.vPosition, 1), SkinMatrix);
float4 vNormal = mul(float4(mesh.vNormal, 0), SkinMatrix);
float4 vBinormal = mul(float4(mesh.vBinormal, 0), SkinMatrix);
float4 vTangent = mul(float4(mesh.vTangent, 0), SkinMatrix);
SkinngMesh outv;
outv.vPosition = vPosition.xyz;
outv.vNormal = vNormal.xyz;
outv.vTangent = vTangent.xyz;
outv.vBinormal = vBinormal.xyz;
outv.vTexcoord = mesh.vTexcoord;
gSkinngMeshOutput[iIndex] = outv;
}
@@ -611,6 +611,7 @@ call Update_Lib.bat
<None Include="..\Public\fMod\fmod_errors.cs" />
</ItemGroup>
<ItemGroup>
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Mesh_Compute.hlsl" />
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_WeightBlend.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Effect</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
@@ -1245,5 +1245,8 @@
<FxCompile Include="..\Bin\Resources\ShaderFiles\Engine_Shader_Functions.hlsli">
<Filter>99.Define\01.SHADER\Inc</Filter>
</FxCompile>
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Mesh_Compute.hlsl">
<Filter>99.Define\01.SHADER</Filter>
</FxCompile>
</ItemGroup>
</Project>
+26 -1
View File
@@ -8,11 +8,36 @@ CBase::CBase()
_uint CBase::AddRef()
{
return ++m_iRefCnt;
return m_iRefCnt.fetch_add(1, memory_order_relaxed) + 1; // +1 한 이후의 갯수를 출력
}
_uint CBase::Release()
{
for (;;)
{
_uint iOldRefCount = m_iRefCnt.load(memory_order_acquire);
if (iOldRefCount == 0u) // -1 할 때 갯수가 0이면 소멸
{
Free();
delete this;
return 0u;
}
_uint iNewRefCount = iOldRefCount - 1u;
if (m_iRefCnt.compare_exchange_weak(
iOldRefCount,
iNewRefCount,
memory_order_acq_rel,
memory_order_acquire))
{
return iNewRefCount; // -1 한 이후의 갯수를 출력함을 보장
}
}
if (0 == m_iRefCnt)
{
Free();
+10
View File
@@ -5,6 +5,16 @@ CBone::CBone()
{
}
CBone::CBone(const CBone& other):
CBase()
{
memcpy_s(m_szName, sizeof(_char) * MAX_PATH, other.m_szName, sizeof(_char) * MAX_PATH);
m_TransformationMatrix = other.m_TransformationMatrix;
m_CombinedTransformationMatrix = other.m_CombinedTransformationMatrix;
m_iParentBoneIndex = other.m_iParentBoneIndex;
m_matInitial = other.m_matInitial;
}
void CBone::Get_KeyFrame(KEYFRAME& kf, _bool bIsCurrentFrame)
{
_vector vScale = {};
+2 -1
View File
@@ -171,7 +171,8 @@ void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, _float f
_vector vCurrentPos = pTransform->Get_State(STATE::POSITION);
_vector vTargetPos = vCurrentPos + vDeltaWorld;
pTransform->Set_State(STATE::POSITION, vTargetPos);
//pTransform->Set_State(STATE::POSITION, vTargetPos);
pTransform->AccumulateMomentum(vDeltaWorld);
m_vPrevRootPos = vCurRootPos;
vTranslation = XMVectorZero();
@@ -113,9 +113,14 @@ void CComputeShader::Bind_UAV(_uint iIndex)
void CComputeShader::Bind_OutPut_SRV(_uint iIndex, _uint iBufferIndex)
{
m_pContext->PSSetShaderResources(iIndex, // 시작슬롯 번호
1, // 버퍼 개수
&m_pOutputSRV[iBufferIndex]); // 버퍼 시작 주소
//m_pContext->PSSetShaderResources(iIndex, // 시작슬롯 번호
// 1, // 버퍼 개수
// &m_pOutputSRV[iBufferIndex]); // 버퍼 시작 주소
ID3D11ShaderResourceView* pSRV = m_pOutputSRV[iBufferIndex];
// VS에 바인딩
m_pContext->VSSetShaderResources(iIndex, 1, &pSRV);
}
-1
View File
@@ -82,7 +82,6 @@ void CFSM::Set_Parent(FSMSTATE::ESTATE Child, FSMSTATE::ESTATE Parent)
pChild->Set_Parent(pParent);
}
CFSM* CFSM::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CFSM* pInstance = new CFSM(pDevice, pContext);
@@ -306,7 +306,7 @@ void CGameInstance::Present_TimeCost() const
GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x);
GUI::Text("Timer_Occupancy %d", int(m_fTimer_Present / fTotal * 100.f));
}
GUI::Text("GameInstance RefCNT : %d", m_iRefCnt);
GUI::Text("GameInstance RefCNT : %d", m_iRefCnt.load());
static float values[60] = {};
static int values_offset = 0;
static double refresh_time = 0.0;
@@ -455,11 +455,6 @@ HRESULT CMaterial::Bind_SRV(CShader* pShader)
pConstantName = "g_NormalTexture";
break;
case aiTextureType_SHININESS:
{
_float fUsingSurfaceParams = ((_float)aiTextureType_SPECULAR / (_float)AI_TEXTURE_TYPE_MAX);
pConstantName = "g_SurfaceParamsTexture";
pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float));
}
break;
case aiTextureType_OPACITY:
break;
+74 -4
View File
@@ -3,7 +3,7 @@
#include "Model.h"
#include "Bone.h"
#include "Shader.h"
#include "ComputeShader.h"
CMesh::CMesh(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CVIBuffer{ pDevice, pContext }
{
@@ -113,8 +113,6 @@ HRESULT CMesh::Initialize_Prototype(MODEL eType, vector<class CBone*>& Bones, co
#pragma endregion
return S_OK;
}
#endif
@@ -291,7 +289,7 @@ HRESULT CMesh::Initialize_Prototype(MODEL eType, const CModel* pModel, SaveMesh*
#pragma endregion
Create_RawVB(m_RawVertices);
return S_OK;
}
@@ -509,11 +507,82 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save
if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &InitialVBData, &m_pVB)))
return E_FAIL;
m_RawVertices.resize(m_iNumVertices);
for (_uint i = 0; i < m_iNumVertices; i++)
{
m_RawVertices[i].vPosition = pVertices[i].vPosition;
m_RawVertices[i].vNormal = pVertices[i].vNormal;
m_RawVertices[i].vTangent = pVertices[i].vTangent;
m_RawVertices[i].vBinormal = pVertices[i].vBinormal;
m_RawVertices[i].vTexcoord = pVertices[i].vTexcoord;
m_RawVertices[i].vBlendIndex = pVertices[i].vBlendIndex;
m_RawVertices[i].vBlendWeight = pVertices[i].vBlendWeight;
}
Safe_Delete_Array(pVertices);
return S_OK;
}
HRESULT CMesh::Create_RawVB(vector<MESH_DESC>& RawVertices)
{
m_iRawVertexStride = sizeof(MESH_DESC);
D3D11_BUFFER_DESC desc{};
desc.Usage = D3D11_USAGE_DEFAULT;
desc.ByteWidth = m_iRawVertexStride *m_iNumVertices;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = 0;
desc.StructureByteStride = m_iRawVertexStride;
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
D3D11_SUBRESOURCE_DATA init{};
init.pSysMem = RawVertices.data();
m_pDevice->CreateBuffer(&desc, &init, &m_pVBMesh);
return S_OK;
}
void CMesh::ComputSkinning(CComputeShader* ComputeShader, ID3D11Buffer* ConstantBuffer)
{
if (ComputeShader == nullptr)
return;
_uint iGroupCountX = (m_iNumVertices + 255) / 256;
ID3D11Buffer* CSBuffers[] = {
m_pVBMesh
};
vector<D3D11_MAPPED_SUBRESOURCE> OutSubResources = {};
D3D11_MAPPED_SUBRESOURCE VBInstanceResource = {};
OutSubResources = ComputeShader->Dispatch(0, 0, _float3((_float)iGroupCountX, 1.f, 1.f), CSBuffers, ConstantBuffer);
}
void CMesh::FillBoneDesc(const vector<_float4x4>& CombinedMatrices, BONE_DESC* pOut)
{
for (size_t i = 0; i < m_iNumBones; ++i)
{
const _float4x4& offset = m_offsetMatrices[i];
const _float4x4& combined = CombinedMatrices[m_BoneIndices[i]];
_matrix matOffset = XMLoadFloat4x4(&offset);
_matrix matCombined = XMLoadFloat4x4(&combined);
XMStoreFloat4x4(&pOut->BoneMatrix[i], matOffset * matCombined);
}
}
HRESULT CMesh::Initialize(void* pArg)
{
return S_OK;
@@ -822,6 +891,7 @@ void CMesh::Free()
__super::Free();
Safe_Delete_Array(m_pBoneMatrices);
SAFE_RELEASE(m_pVBMesh);
}
void CMesh::Describe_Entity()
+102 -11
View File
@@ -7,6 +7,7 @@
#include "LerpAnim.h"
#include "GameObject.h"
#include "Transform.h"
#include "ComputeShader.h"
CModel::CModel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CComponent{ pDevice, pContext }
@@ -899,6 +900,96 @@ HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fma
#endif // EDITOR_PROJECT
HRESULT CModel::Create_CS()
{
_uint vertexCount = 0;
_uint MaxvertexCount = 0;
for (_uint i = 0; i < m_Meshes.size(); ++i)
{
vertexCount = m_Meshes[i]->Get_Vertex();
if (MaxvertexCount < vertexCount)
MaxvertexCount = vertexCount;
}
_uint CS_InputStrides[] = {
sizeof(MESH_DESC)
};
size_t meshCount = m_Meshes.size();
_uint* CS_OutputStrides = new _uint[meshCount];
for (size_t i = 0; i < meshCount; i++)
{
CS_OutputStrides[i] = sizeof(SKINNG_MESH_DESC)*(_uint)meshCount;
}
m_pComputeShader = CComputeShader::Create(m_pDevice, m_pContext,
L"../Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl", "CS_MAIN", MaxvertexCount, 1, (_uint)meshCount, CS_InputStrides,CS_OutputStrides);
if (m_pComputeShader == nullptr)
return E_FAIL;
Safe_Delete_Array(CS_OutputStrides);
return S_OK;
}
void CModel::ComputeSkinning()
{
Get_BoneMatrix();
for (_uint i = 0; i < m_iNumMeshes; ++i)
{
D3D11_MAPPED_SUBRESOURCE ConstantSubResource{};
if (SUCCEEDED(m_pContext->Map(m_pConstantBuffer, 0,
D3D11_MAP_WRITE_DISCARD, 0, &ConstantSubResource)))
{
CMesh::BONE_DESC* pDesc =
static_cast<CMesh::BONE_DESC*>(ConstantSubResource.pData);
m_Meshes[i]->FillBoneDesc(m_BoneMatrix,pDesc);
m_pContext->Unmap(m_pConstantBuffer, 0);
}
m_Meshes[i]->ComputSkinning(m_pComputeShader, m_pConstantBuffer);
}
}
void CModel::Create_Con()
{
D3D11_BUFFER_DESC cbDesc = {};
cbDesc.Usage = D3D11_USAGE_DYNAMIC;
cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
cbDesc.ByteWidth = sizeof(BONE_DESC);
if (FAILED(m_pDevice->CreateBuffer(&cbDesc, nullptr, &m_pConstantBuffer)))
return;
}
HRESULT CModel::Bind_CS_Output(_uint Index, _uint iBufferIndex)
{
if (m_pComputeShader == nullptr)
return E_FAIL;
m_pComputeShader->Bind_OutPut_SRV(Index, iBufferIndex);
return S_OK;
}
void CModel::Get_BoneMatrix()
{
m_BoneMatrix.resize(m_Bones.size());
for (size_t i =0; i < m_Bones.size(); i++)
{
m_BoneMatrix[i] = (*m_Bones[i]->Get_CombinedTransformationMatrixPtr());
}
}
HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix)
{
m_eType = eType;
@@ -944,16 +1035,6 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _
if (FAILED(Ready_Animations())) {
return E_FAIL;
}
#ifdef 기무리
if (MODEL::ENVIROMENT == m_eType) {
m_pGameInstance->LoadTriMeshes(pModelFilePath, m_TriMeshes);
for (_uint i = 0; i < m_iNumMeshes; ++i) {
m_pGameInstance->RegistTriMesh(m_Meshes[i]->Get_Name(), m_TriMeshes[i]);
}
}
#endif //
return S_OK;
}
@@ -1236,6 +1317,13 @@ HRESULT CModel::Initialize(void* pArg)
m_pTransform = m_pOwner->Get_Component<CTransform>();
SAFE_ADDREF(m_pTransform);
Create_Con();
if (FAILED(Create_CS()))
return E_FAIL;
return S_OK;
}
@@ -1359,8 +1447,11 @@ void CModel::Free()
SAFE_RELEASE(m_pLerpAnim);
m_SaveModel.clear();
}
SAFE_RELEASE(m_pComputeShader);
SAFE_RELEASE(m_pConstantBuffer);
}
void CModel::Describe_Entity()
{
//GUI::Begin("Model_Desc");
@@ -505,7 +505,6 @@ HRESULT CPhysX_Manager::Initialize()
// }
//}
#endif // 기무리
#endif // EDITOR_PROJECT
#ifdef 진우
@@ -538,7 +537,38 @@ HRESULT CPhysX_Manager::Initialize()
// }
//}
#endif // 진우
#endif // EDITOR_PROJECT
#ifdef Bin
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
PlaneData.iSubKind = UINT_MAX;
PlaneData.pOwner = nullptr;
PlaneData.pBody = nullptr;
m_pMaterials.reserve(ENUM_CLASS(PXMATERIAL::END));
m_pMaterials.push_back(m_pPhysics->createMaterial(0.5f, 0.5f, 0.6f));
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);;
//{
// float halfExtent = .5f;
// physx::PxShape* shape = m_pPhysics->createShape(physx::PxSphereGeometry(halfExtent), *pMaterial);
// physx::PxU32 size = 30;
// physx::PxTransform pxTransform(physx::PxVec3(0));
// for (physx::PxU32 i = 0; i < size; i++) {
// for (physx::PxU32 j = 0; j < size - i; j++) {
// physx::PxTransform localTm(physx::PxVec3(physx::PxReal(j * 2) - physx::PxReal(size - i) + 100, physx::PxReal(i * 2 + 1), 0) * halfExtent);
// physx::PxRigidDynamic* body = m_pPhysics->createRigidDynamic(pxTransform.transform(localTm));
// body->attachShape(*shape);
// physx::PxRigidBodyExt::updateMassAndInertia(*body, 10.0f);
// m_pScene->addActor(*body);
// }
// }
//}
#endif // 진우
return S_OK;
+5 -3
View File
@@ -4,12 +4,12 @@
#include "GameInstance.h"
CUnit::CUnit(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CGameObject(pDevice, pContext)
: CContainerObject(pDevice, pContext)
{
}
CUnit::CUnit(const CUnit& Prototype)
: CGameObject(Prototype)
: CContainerObject(Prototype)
{
}
@@ -30,15 +30,17 @@ HRESULT CUnit::Initialize(void* pArg)
void CUnit::Priority_Update(_float fTimeDelta)
{
__super::Priority_Update(fTimeDelta);
}
void CUnit::Update(_float fTimeDelta)
{
__super::Update(fTimeDelta);
}
void CUnit::Late_Update(_float fTimeDelta)
{
__super::Late_Update(fTimeDelta);
}
HRESULT CUnit::Render()
@@ -10,9 +10,6 @@ CVIBuffer_UI_Instance::CVIBuffer_UI_Instance(ID3D11Device* pDevice, ID3D11Device
CVIBuffer_UI_Instance::CVIBuffer_UI_Instance(const CVIBuffer_UI_Instance& Prototype)
: CVIBuffer_Instance{ Prototype }
, m_pInstanceVertices{ Prototype.m_pInstanceVertices }
, m_fSize{ Prototype.m_fSize }
, m_fPositionOffSetX{ Prototype.m_fPositionOffSetX }
, m_fPositionOffSetY{ Prototype.m_fPositionOffSetY }
, m_fPosition{ Prototype.m_fPosition }
{
}
@@ -114,21 +111,12 @@ HRESULT CVIBuffer_UI_Instance::Initialize_Prototype(const INSTANCE_DESC* pInstan
m_pInstanceVertices = new VTX_INSTANCE_UI[m_iNumInstance];
ZeroMemory(m_pInstanceVertices, sizeof(VTX_INSTANCE_UI) * m_iNumInstance);
m_fSize = new _float2[m_iNumInstance];
ZeroMemory(m_fSize, sizeof(_float2) * m_iNumInstance);
m_fPosition = new _float2[m_iNumInstance];
ZeroMemory(m_fPosition, sizeof(_float2) * m_iNumInstance);
m_fPositionOffSetX = new _float[m_iNumInstance];
ZeroMemory(m_fPositionOffSetX, sizeof(_float) * m_iNumInstance);
m_fPositionOffSetY = new _float[m_iNumInstance];
ZeroMemory(m_fPositionOffSetY, sizeof(_float) * m_iNumInstance);
for (size_t i = 0; i < m_iNumInstance; ++i)
{
m_pInstanceVertices[i].fSize = (pDesc->vSize);
m_pInstanceVertices[i].fPos = _float2(pDesc->vPsition.x, pDesc->vPsition.y);
}
@@ -180,7 +168,38 @@ void CVIBuffer_UI_Instance::Set_Size(_float fSizeX, _float fSizeY)
{
pVertices[i].fSize.x = fSizeX;
pVertices[i].fSize.y = fSizeY;
}
m_pContext->Unmap(m_pVBInstance, 0);
}
void CVIBuffer_UI_Instance::Set_SizeX(_float fSizeX)
{
D3D11_MAPPED_SUBRESOURCE SubResource{};
m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource);
VTX_INSTANCE_UI* pVertices = static_cast<VTX_INSTANCE_UI*>(SubResource.pData);
for (size_t i = 0; i < m_iNumInstance; i++)
{
pVertices[i].fSize.x = fSizeX;
}
m_pContext->Unmap(m_pVBInstance, 0);
}
void CVIBuffer_UI_Instance::Set_SizeY(_float fSizeY)
{
D3D11_MAPPED_SUBRESOURCE SubResource{};
m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource);
VTX_INSTANCE_UI* pVertices = static_cast<VTX_INSTANCE_UI*>(SubResource.pData);
for (size_t i = 0; i < m_iNumInstance; i++)
{
pVertices[i].fSize.y = fSizeY;
}
m_pContext->Unmap(m_pVBInstance, 0);
+2 -2
View File
@@ -16,10 +16,10 @@ class ENGINE_DLL CBase abstract
_uint Release();
protected:
_uint m_iRefCnt = {};
atomic<_uint> m_iRefCnt = { 0 };
public:
virtual void Free();
};
NS_END
NS_END
+2 -1
View File
@@ -8,6 +8,7 @@ class ENGINE_DLL CBone final : public CBase
{
private:
CBone();
CBone(const CBone& other);
virtual ~CBone() = default;
public:
_matrix Get_CombinedTransformationMatrix() const {
@@ -59,4 +60,4 @@ class ENGINE_DLL CBone final : public CBase
};
NS_END
NS_END
@@ -6,7 +6,6 @@ NS_BEGIN(Engine)
class ENGINE_DLL CComputeShader final : public CBase
{
private:
CComputeShader(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual ~CComputeShader() = default;
@@ -17,6 +16,7 @@ class ENGINE_DLL CComputeShader final : public CBase
public:
vector<D3D11_MAPPED_SUBRESOURCE> Dispatch(_uint iSRVIndex, _uint iUAVIndex, _float3 vGroupCount, ID3D11Buffer** ppBuffers, ID3D11Buffer* pConstantBuffer = nullptr);
void Bind_OutPut_SRV(_uint iIndex, _uint iBufferIndex);
ID3D11ComputeShader* Get_Compute() { return m_pComputeShader; }
private:
void Bind_SRV(_uint iIndex);
void Bind_UAV(_uint iIndex);
@@ -43,7 +43,7 @@ class ENGINE_DLL CComputeShader final : public CBase
vector<ID3D11Buffer*> m_pOutputStagingBuffer = {};
ID3D11ComputeShader* m_pComputeShader = nullptr;
private:
+1 -1
View File
@@ -22,7 +22,7 @@
#elif 진우
#undef ASSERT_JINWOO
#define ASSERT_JINWOO(expression) assert(expression)
#elif 82103
#elif gimch
#undef ASSERT_JINHO
#define ASSERT_JINHO(expression) assert(expression)
#elif Bin
@@ -349,4 +349,13 @@ typedef struct tagPhsXUserData {
}PhsXUserData;
typedef struct tagOnCollsionInfo
{
_vector vWorldPos = {}; // 접촉지점
_vector vWorldNomal = {}; // 접촉노말
_vector vHitDir = {}; // 시도한 move 방향
_float fLength = {}; // 작용된 힘
}ON_COLLISION_INFO;
NS_END
+3 -1
View File
@@ -3,8 +3,9 @@
NS_BEGIN(FSMSTATE)
enum ESTATE
{
ROOT,
IDLE,IDLE_TURN,
MOVE, WALK, WALK_FWD, WALK_BWD, JOG, SPRINT,
MOVE, WALK, FWD, BWD, JOG, SPRINT,
JUMP,
LAND,
DODGE,
@@ -29,6 +30,7 @@ class ENGINE_DLL CFSM final : public CComponent
void Change_State(_uint iIndex);
void Update(_float fTimeDelta);
CState* Get_Current() { return m_pCurrent; }
_uint Get_CurrState();
_uint Get_PrevState();
void Set_Parent(FSMSTATE::ESTATE Child, FSMSTATE::ESTATE Parent);
+51
View File
@@ -6,6 +6,36 @@ NS_BEGIN(Engine)
class ENGINE_DLL CMesh final : public CVIBuffer
{
public:
typedef struct tagMeshDesc
{
_float3 vPosition = {};
_float3 vNormal = {};
_float3 vTangent = {};
_float3 vBinormal = {};
_float2 vTexcoord = {};
XMUINT4 vBlendIndex = {};
_float4 vBlendWeight = {};
}MESH_DESC;
typedef struct tagSkinngMeshDesc
{
_float3 vPosition = {};
_float3 vNormal = {};
_float3 vTangent = {};
_float3 vBinormal = {};
_float2 vTexcoord = {};
}SKINNG_MESH_DESC;
typedef struct tagBoneDesc
{
_float4x4 BoneMatrix[512];
}BONE_DESC;
private:
CMesh(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CMesh(const CMesh& rhs);
@@ -36,6 +66,11 @@ class ENGINE_DLL CMesh final : public CVIBuffer
virtual HRESULT Bind_Resources_Instance(ID3D11Buffer* pVBInstance, _uint iInstanceStride, _uint iBufferCount);
virtual HRESULT Render_Instance(_uint iNumInstance);
void ComputSkinning(class CComputeShader* ComputeShader, ID3D11Buffer* ConstantBuffer);
void FillBoneDesc(const vector<_float4x4>& CombinedMatrices, BONE_DESC* pOut);
_uint Get_Vertex() { return m_iNumVertices; }
private:
virtual HRESULT Initialize_Prototype(HANDLE hFile, DWORD& dwByte);
virtual HRESULT Initialize(void* pArg) override;
@@ -45,11 +80,15 @@ class ENGINE_DLL CMesh final : public CVIBuffer
virtual HRESULT Initialize_Prototype(MODEL eType, const class CModel* pModel, SaveMesh* _SaveMesh, _fmatrix PreTransformMatrix);
HRESULT Ready_VertexBuffer_For_NonAnim(SaveMesh* _SaveMesh, _fmatrix PreTransformMatrix);
HRESULT Ready_VertexBuffer_For_Anim(const class CModel* pModel, SaveMesh* _SaveMesh);
HRESULT Create_RawVB(vector<MESH_DESC>& RawVertices);
//
private:
_char m_szName[MAX_PATH] = {};
_uint m_iMaterialIndex = {};
_uint m_iNumBones = { };
_uint m_iStartIndex = {};
vector<_int> m_BoneIndices;
_float4x4* m_pBoneMatrices = { nullptr };
@@ -59,6 +98,18 @@ class ENGINE_DLL CMesh final : public CVIBuffer
std::vector<_float3> m_Vertices;
//
private:
MESH_DESC m_MeshDesc = {};
BONE_DESC m_BoneDesc = {};
_uint m_iNumBuffer = {};
_uint m_iNumMeshes = {};
_int m_iRootBoneIndex = { -1 };
_int m_iRawVertexStride = {};
vector<MESH_DESC> m_RawVertices;
ID3D11Buffer* m_pVBMesh = { nullptr };
public:
static CMesh* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, HANDLE hFile, DWORD& dwByte);
// 바이너리
+47 -2
View File
@@ -6,6 +6,34 @@ NS_BEGIN(Engine)
class ENGINE_DLL CModel final : public CComponent
{
public:
typedef struct tagMeshDesc
{
_float3 vPosition = {};
_float3 vNormal = {};
_float3 vTangent = {};
_float3 vBinormal = {};
_float2 vTexcoord = {};
XMUINT4 vBlendIndex = {};
_float4 vBlendWeight = {};
}MESH_DESC;
typedef struct tagSkinngMeshDesc
{
_float3 vPosition = {};
_float3 vNormal = {};
_float3 vTangent = {};
_float3 vBinormal = {};
_float2 vTexcoord = {};
}SKINNG_MESH_DESC;
typedef struct tagBoneDesc
{
_float4x4 BoneMatrix[512];
}BONE_DESC;
private:
CModel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CModel(const CModel& rhs);
@@ -60,12 +88,16 @@ class ENGINE_DLL CModel final : public CComponent
static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 )
_int Get_BoneIndex(const _char* pBoneName) const;
_matrix Get_BoneMatrix(_uint iBoneIndex);
#pragma endregion
#pragma region Material
HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader);
#pragma endregion
void ComputeSkinning();
void Create_Con();
HRESULT Bind_CS_Output(_uint Index, _uint iBufferIndex);
void Get_BoneMatrix();
public:
#ifdef EDITOR_PROJECT
@@ -127,11 +159,24 @@ static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> Bones); /
_matrix m_DeltaAnimationMatrix = {}; // 루트본의 델타애니메이션
class CTransform* m_pTransform = { nullptr }; // 모델 대상의 트랜스폼
// 바이너리
SaveModel* m_pSaveModel = { nullptr };
list<SaveModel> m_SaveModel;
//
vector<_float4x4> m_BoneMatrix;
private:
HRESULT Create_CS();
MESH_DESC m_MeshDesc = {};
BONE_DESC m_BoneDesc = {};
_uint m_iNumBuffer = {};
class CComputeShader* m_pComputeShader = {};
ID3D11Buffer* m_pConstantBuffer = { nullptr };
_uint AccumulatedVertexCount = {};
private:
// 바이너리
virtual HRESULT Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix);
@@ -87,6 +87,11 @@ class CPhysX_Manager final : public CBase
#ifdef 진우
PhsXUserData PlaneData = {};
#endif // 기무리
#ifdef Bin
PhsXUserData PlaneData = {};
#endif // 기무리
+3 -4
View File
@@ -6,10 +6,10 @@ enum ESTATE
{
IDLE, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD,
MOVE,
WALK, WALK_FWD, WALK_BWD, WALK_STOP,
JOG,
WALK, WALK_FWD, WALK_BWD,WALK_STOP,
JOG,JOG_FWD, JOG_STOP,
SPRINT,
JUMP,JUMP_WALK,JUMP_SPRINT,
JUMP,JUMP_JOG,JUMP_SPRINT,
LAND,
DODGE,
COMBAT, LIGHT_ATTACK, CAST, SKILL, SKILL2,
@@ -40,7 +40,6 @@ class ENGINE_DLL CState abstract : public CBase
_uint Get_State() { return m_eState; }
void Set_Parent(CState* State) { m_pParent = State; }
CState* Get_Parent() { return m_pParent; }
protected:
CUnit* m_pOwner = { nullptr };
CModel* m_pModel = { nullptr };
+1 -1
View File
@@ -8,7 +8,7 @@ class ENGINE_DLL CUIObject abstract : public CGameObject
{
public:
enum class SKILLTYPE {
SHADOW, CONTROL, POWER, DAMAGE,
CONTROL, POWER, DAMAGE,
UTILITY ,TRANSFORM, CURSE, ESSENTIAL
};
typedef struct tagUIObjectDesc
+4 -2
View File
@@ -1,14 +1,14 @@
#pragma once
#include "Engine_Define.h"
#include "GameObject.h"
#include "ContainerObject.h"
NS_BEGIN(Engine)
class CShader;
class CModel;
class CFSM;
class ENGINE_DLL CUnit abstract : public CGameObject
class ENGINE_DLL CUnit abstract : public CContainerObject
{
public:
typedef struct tagObjectDesc
@@ -30,6 +30,7 @@ class ENGINE_DLL CUnit abstract : public CGameObject
_wstring& Get_PrototypeTag() { return m_strModelPrototypeTag; }
void Load_KeyFrame();
public:
#pragma region STATE
pair<_uint, _bool> Get_AnimInfo(_uint iIndex) { return m_Animation[iIndex]; }
virtual _bool Check(FSMSTATE::ESTATE state) { return false; }
@@ -40,6 +41,7 @@ class ENGINE_DLL CUnit abstract : public CGameObject
_float Get_KeyFrame(_string FrameName);
_bool IsCurrentKeyFrame(_string FrameName);
virtual void Reset_Sprint() {};
virtual void Reset_Walk() {};
#pragma endregion
protected:
@@ -22,14 +22,14 @@ class ENGINE_DLL CVIBuffer_UI_Instance final : public CVIBuffer_Instance
public:
virtual void Set_Pos(_float fX, _float fY, _float OffSetX, _float OffSetY, _uint iCols);
virtual void Set_Size(_float fSizeX, _float fSizeY);
virtual void Set_SizeX(_float fSizeX);
virtual void Set_SizeY(_float fSizeY);
virtual void Set_Cloned(_bool isCloned) { m_isCloned = isCloned; }
private:
VTX_INSTANCE_UI* m_pInstanceVertices = { nullptr };
_bool m_isCloned = { false };
_float2* m_fSize{ nullptr };
_float* m_fPositionOffSetX{};
_float* m_fPositionOffSetY{};
_float2* m_fPosition{ nullptr };
_float m_fAddPosition{};