Skip to content

Commit df1ab4e

Browse files
committed
v4.3 updates, 3d model viewer gltf dx12
1 parent 00ee7de commit df1ab4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+202
-182
lines changed

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# this must be before add_executable
22
# link_directories(
3-
# ${PROJECT_EXTERNAL_LIBDIR}/directxtex/DirectXTex-jun2020b/DirectXTex/Bin/Desktop_2017/x64
3+
# ${PROJECT_EXTERNAL_LIBDIR}/directxtex/DirectXTex-jun2020b/DirectXTex/Bin/Desktop_2019/x64
44
# )
55

66
add_library(ModelViewer_DX12 SHARED)
@@ -45,14 +45,16 @@ target_include_directories(ModelViewer_DX12 PUBLIC
4545
${PROJECT_SOURCE_DIR}/applications/_plugins/common/model_viewer
4646
${PROJECT_SOURCE_DIR}/applications/_libs/cmp_meshoptimizer
4747
${PROJECT_SOURCE_DIR}/applications/_plugins/common/qtimgui
48+
${PROJECT_SOURCE_DIR}/external/imgui
49+
4850
${PROJECT_SOURCE_DIR}/../common/lib/ext/glm
4951
${Qt5Gui_INCLUDE_DIRS}
50-
)
52+
${PROJECT_SOURCE_DIR}/../common/lib/ext/imgui
53+
)
5154

5255
target_link_libraries(ModelViewer_DX12 PRIVATE
5356
CMP_Compressonator
5457
CMP_Framework
55-
# CMP_MeshCompressor
5658
CMP_GUI_Gltf
5759
CMP_GpuDecode
5860
CMP_Imgui

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/bloom.cpp renamed to applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/cmp_bloom.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
// THE SOFTWARE.
1919

2020

21-
#include "dynamicbufferringdx12.h"
22-
#include "staticbufferpooldx12.h"
23-
#include "uploadheapdx12.h"
24-
#include "texturedx12.h"
25-
#include "postprocps.h"
26-
#include "texturedx12.h"
27-
#include "bloom.h"
21+
#include "cmp_dynamicbufferringdx12.h"
22+
#include "cmp_staticbufferpooldx12.h"
23+
#include "cmp_uploadheapdx12.h"
24+
#include "cmp_texturedx12.h"
25+
#include "cmp_postprocps.h"
26+
#include "cmp_texturedx12.h"
27+
#include "cmp_bloom.h"
2828

2929

30-
void Bloom::OnCreate(
30+
void CMP_Bloom::OnCreate(
3131
ID3D12Device* pDevice,
3232
UINT node,
3333
ResourceViewHeapsDX12 *pHeaps,
@@ -75,7 +75,8 @@ void Bloom::OnCreate(
7575
}
7676
}
7777

78-
void Bloom::OnCreateWindowSizeDependentResources(ID3D12Device* pDevice, DWORD Width, DWORD Height, UINT node, UINT nodemask) {
78+
void CMP_Bloom::OnCreateWindowSizeDependentResources(ID3D12Device* pDevice, DWORD Width, DWORD Height, UINT node, UINT nodemask)
79+
{
7980
m_Width = Width;
8081
m_Height = Height;
8182

@@ -95,30 +96,34 @@ void Bloom::OnCreateWindowSizeDependentResources(ID3D12Device* pDevice, DWORD Wi
9596

9697
}
9798

98-
void Bloom::OnDestroyWindowSizeDependentResources() {
99+
void CMP_Bloom::OnDestroyWindowSizeDependentResources()
100+
{
99101
for (int i = 0; i < BLOOM_DEPTH; i++) {
100102
m_mip[i].OnDestroy();
101103
m_blurTempMip[i].OnDestroy();
102104
}
103105
}
104106

105-
void Bloom::OnDestroy() {
107+
void CMP_Bloom::OnDestroy()
108+
{
106109
m_downscale.OnDestroy();
107110
m_blurY.OnDestroy();
108111
m_blurX.OnDestroy();
109112
m_blendAdd.OnDestroy();
110113
m_blendFactor.OnDestroy();
111114
}
112115

113-
void Bloom::SetViewPortAndScissor(ID3D12GraphicsCommandList* pCommandList, int i) {
116+
void CMP_Bloom::SetViewPortAndScissor(ID3D12GraphicsCommandList* pCommandList, int i)
117+
{
114118
D3D12_VIEWPORT viewPort = { 0.0f, 0.0f, static_cast<float>(m_Width >> (i + 1)), static_cast<float>(m_Height >> (i + 1)), 0.0f, 1.0f };
115119
D3D12_RECT rectScissor = { 0, 0, (LONG)(m_Width >> (i + 1)), (LONG)(m_Height >> (i + 1)) };
116120
pCommandList->RSSetViewports(1, &viewPort);
117121
pCommandList->RSSetScissorRects(1, &rectScissor);
118122

119123
}
120124

121-
void Bloom::Draw(ID3D12GraphicsCommandList* pCommandList, TextureDX12 *pInput, float glowFactor) {
125+
void CMP_Bloom::Draw(ID3D12GraphicsCommandList* pCommandList, TextureDX12* pInput, float glowFactor)
126+
{
122127
pInput->CreateRTV(0, &m_inputRTV);
123128
pInput->CreateSRV(0, &m_inputSRV);
124129

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/bloom.h renamed to applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/cmp_bloom.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
// THE SOFTWARE.
1919

2020
#pragma once
21-
#include "postprocps.h"
21+
#include "cmp_postprocps.h"
2222

2323
#define BLOOM_DEPTH 6
2424

25-
class Bloom {
25+
class CMP_Bloom {
2626
public:
2727
void OnCreate(
2828
ID3D12Device* pDevice,

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/blurps.cpp renamed to applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/cmp_blurps.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1818
// THE SOFTWARE.
1919

20-
#include "dynamicbufferringdx12.h"
21-
#include "staticbufferpooldx12.h"
22-
#include "uploadheapdx12.h"
23-
#include "texturedx12.h"
24-
#include "postprocps.h"
25-
#include "blurps.h"
20+
#include "cmp_dynamicbufferringdx12.h"
21+
#include "cmp_staticbufferpooldx12.h"
22+
#include "cmp_uploadheapdx12.h"
23+
#include "cmp_texturedx12.h"
24+
#include "cmp_postprocps.h"
25+
#include "cmp_blurps.h"
2626

2727
#include <directxmath.h>
2828

@@ -57,7 +57,7 @@ void GenerateGaussianWeights(int count, float *out) {
5757
}
5858
}
5959

60-
void BlurPS::OnCreate(
60+
void CMP_BlurPS::OnCreate(
6161
ID3D12Device* pDevice,
6262
UINT node,
6363
ResourceViewHeapsDX12 *pHeaps,
@@ -100,7 +100,8 @@ void BlurPS::OnCreate(
100100
*/
101101
}
102102

103-
void BlurPS::OnCreateWindowSizeDependentResources(ID3D12Device* pDevice, DWORD Width, DWORD Height, UINT node, UINT nodemask) {
103+
void CMP_BlurPS::OnCreateWindowSizeDependentResources(ID3D12Device* pDevice, DWORD Width, DWORD Height, UINT node, UINT nodemask)
104+
{
104105
m_Width = Width;
105106
m_Height = Height;
106107

@@ -113,17 +114,20 @@ void BlurPS::OnCreateWindowSizeDependentResources(ID3D12Device* pDevice, DWORD W
113114

114115
}
115116

116-
void BlurPS::OnDestroyWindowSizeDependentResources() {
117+
void CMP_BlurPS::OnDestroyWindowSizeDependentResources()
118+
{
117119
m_temp.OnDestroy();
118120
}
119121

120-
void BlurPS::OnDestroy() {
122+
void CMP_BlurPS::OnDestroy()
123+
{
121124
m_blurY.OnDestroy();
122125
m_blurX.OnDestroy();
123126
}
124127

125128

126-
void BlurPS::Draw(ID3D12GraphicsCommandList* pCommandList, CBV_SRV_UAV *pSrcResource, D3D12_CPU_DESCRIPTOR_HANDLE *pDestination) {
129+
void CMP_BlurPS::Draw(ID3D12GraphicsCommandList* pCommandList, CBV_SRV_UAV* pSrcResource, D3D12_CPU_DESCRIPTOR_HANDLE* pDestination)
130+
{
127131
D3D12_VIEWPORT viewPort = { 0.0f, 0.0f, static_cast<float>(m_Width), static_cast<float>(m_Height), 0.0f, 1.0f };
128132
D3D12_RECT rectScissor = { 0, 0, (LONG)m_Width, (LONG)m_Height };
129133

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/blurps.h renamed to applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/cmp_blurps.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
// THE SOFTWARE.
1919

2020
#pragma once
21-
#include "postprocps.h"
21+
#include "cmp_postprocps.h"
2222

23-
class BlurPS {
23+
class CMP_BlurPS
24+
{
2425
public:
2526
void OnCreate(
2627
ID3D12Device* pDevice,

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/camera.cpp renamed to applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/cmp_camera.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1818
// THE SOFTWARE.
1919

20-
#include "camera.h"
20+
#include "cmp_camera.h"
2121

2222
#include <windows.h>
2323

@@ -31,7 +31,8 @@ using namespace DirectX;
3131
// OnCreate
3232
//
3333
//--------------------------------------------------------------------------------------
34-
void Camera::SetFov(float fovV, uint32_t width, uint32_t height) {
34+
void CMP_Camera::SetFov(float fovV, uint32_t width, uint32_t height)
35+
{
3536
// fovV = fovV * 0.025f; avacado
3637

3738
m_aspectRatio = width *1.f / height;
@@ -57,7 +58,8 @@ void Camera::SetFov(float fovV, uint32_t width, uint32_t height) {
5758
// LookAt
5859
//
5960
//--------------------------------------------------------------------------------------
60-
void Camera::LookAt(XMVECTOR eyePos, XMVECTOR lookAt) {
61+
void CMP_Camera::LookAt(XMVECTOR eyePos, XMVECTOR lookAt)
62+
{
6163
m_eyePos = eyePos;
6264
XMVECTOR up = XMVectorSet(0, 1, 0, 0);
6365
m_View = XMMatrixLookAtRH(eyePos, lookAt, up);
@@ -68,7 +70,8 @@ void Camera::LookAt(XMVECTOR eyePos, XMVECTOR lookAt) {
6870
// UpdateCamera
6971
//
7072
//--------------------------------------------------------------------------------------
71-
void Camera::UpdateCameraWASD(float roll, float pitch, const bool keyDown[256], double deltaTime) {
73+
void CMP_Camera::UpdateCameraWASD(float roll, float pitch, const bool keyDown[256], double deltaTime)
74+
{
7275
float speed = 0.0003f * (keyDown[VK_SHIFT] ? 25.f * (float)deltaTime : 5.f * (float)deltaTime);
7376

7477
float eyeDir[3] = { 0,0,0 };
@@ -104,7 +107,8 @@ void Camera::UpdateCameraWASD(float roll, float pitch, const bool keyDown[256],
104107
LookAt(m_eyePos, at);
105108
}
106109

107-
void Camera::UpdateCamera(float roll, float pitch, float distance) {
110+
void CMP_Camera::UpdateCamera(float roll, float pitch, float distance)
111+
{
108112
m_eyePos = XMVectorSet(distance * sinf(roll) * cosf(pitch), distance * sinf(pitch), distance * cosf(roll) * cosf(pitch), 0);
109113
XMVECTOR at = XMVectorSet(0, 0, 0, 0);
110114
LookAt(m_eyePos, at);

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/camera.h renamed to applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/cmp_camera.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
// typical camera class
2626

27-
class Camera {
27+
class CMP_Camera
28+
{
2829
public:
2930
void LookAt(DirectX::XMVECTOR eyePos, DirectX::XMVECTOR lookAt);
3031
void SetFov(float fov, uint32_t width, uint32_t height);

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/commandlistringdx12.cpp renamed to applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/cmp_commandlistringdx12.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1818
// THE SOFTWARE.
1919

20-
#include "commandlistringdx12.h"
20+
#include "cmp_commandlistringdx12.h"
2121

22-
#include <error.h>
22+
#include "cmp_error.h"
2323

2424

2525
//--------------------------------------------------------------------------------------

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/commandlistringdx12.h renamed to applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/cmp_commandlistringdx12.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// THE SOFTWARE.
1919

2020
#pragma once
21-
#include "ring.h"
21+
#include "cmp_ring.h"
2222

2323
#include <d3dx12.h>
2424
#include <windows.h>

0 commit comments

Comments
 (0)