add makefile build process

This commit is contained in:
Zack Buhman 2026-01-05 11:26:22 -06:00
parent 6a5b56ce95
commit a8b1297ddc
10 changed files with 35752 additions and 33 deletions

View File

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
BUILD_TYPE ?= debug
all: $(BUILD_TYPE)/d3d10.exe
%.fxo: %.fx
fxc /Od /Zi /T fx_4_0 /nologo /Fo $@ $<
$(BUILD_TYPE)/%.res: %.rc
rc.exe /d "_UNICODE" /d "UNICODE" /fo $@ $<
$(BUILD_TYPE)/%.obj: %.cpp
cl.exe /Fo"$@" /Fd"$(BUILD_TYPE)\vc80.pdb" @"compile_$(BUILD_TYPE).rsp" $<
OBJS = \
$(BUILD_TYPE)/cesium_man.obj \
$(BUILD_TYPE)/main.obj \
$(BUILD_TYPE)/main.res
$(BUILD_TYPE)/d3d10.exe: $(OBJS)
link.exe /OUT:"$(BUILD_TYPE)\d3d10.exe" /PDB:"$(BUILD_TYPE)\d3d10.pdb" @"link_$(BUILD_TYPE).rsp" $(OBJS) /NOLOGO /ERRORREPORT:PROMPT
mt.exe -manifest d3d10.exe.${BUILD_TYPE}.manifest -outputresource:$(BUILD_TYPE)\d3d10.exe;1

35254
cesium_man.cpp Normal file

File diff suppressed because it is too large Load Diff

445
cesium_man.hpp Normal file
View File

@ -0,0 +1,445 @@
const int skin_0__joints__length = 19;
extern const DWORD accessor_0[];
const int accessor_0__length = 14016;
const int accessor_0__size = (sizeof (DWORD)) * 14016;
extern const D3DXVECTOR4 accessor_1[];
const int accessor_1__length = 3273;
const int accessor_1__size = (sizeof (D3DXVECTOR4)) * 3273;
extern const D3DXVECTOR3 accessor_2[];
const int accessor_2__length = 3273;
const int accessor_2__size = (sizeof (D3DXVECTOR3)) * 3273;
extern const D3DXVECTOR3 accessor_3[];
const int accessor_3__length = 3273;
const int accessor_3__size = (sizeof (D3DXVECTOR3)) * 3273;
extern const D3DXVECTOR2 accessor_4[];
const int accessor_4__length = 3273;
const int accessor_4__size = (sizeof (D3DXVECTOR2)) * 3273;
extern const D3DXVECTOR4 accessor_5[];
const int accessor_5__length = 3273;
const int accessor_5__size = (sizeof (D3DXVECTOR4)) * 3273;
extern const float accessor_6[];
const int accessor_6__length = 48;
const int accessor_6__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_7[];
const int accessor_7__length = 48;
const int accessor_7__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_8[];
const int accessor_8__length = 48;
const int accessor_8__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_9[];
const int accessor_9__length = 48;
const int accessor_9__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_10[];
const int accessor_10__length = 48;
const int accessor_10__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_11[];
const int accessor_11__length = 48;
const int accessor_11__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_12[];
const int accessor_12__length = 48;
const int accessor_12__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_13[];
const int accessor_13__length = 48;
const int accessor_13__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_14[];
const int accessor_14__length = 48;
const int accessor_14__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_15[];
const int accessor_15__length = 48;
const int accessor_15__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_16[];
const int accessor_16__length = 48;
const int accessor_16__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_17[];
const int accessor_17__length = 48;
const int accessor_17__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_18[];
const int accessor_18__length = 48;
const int accessor_18__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_19[];
const int accessor_19__length = 48;
const int accessor_19__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_20[];
const int accessor_20__length = 48;
const int accessor_20__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_21[];
const int accessor_21__length = 48;
const int accessor_21__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_22[];
const int accessor_22__length = 48;
const int accessor_22__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_23[];
const int accessor_23__length = 48;
const int accessor_23__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_24[];
const int accessor_24__length = 48;
const int accessor_24__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_25[];
const int accessor_25__length = 48;
const int accessor_25__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_26[];
const int accessor_26__length = 48;
const int accessor_26__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_27[];
const int accessor_27__length = 48;
const int accessor_27__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_28[];
const int accessor_28__length = 48;
const int accessor_28__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_29[];
const int accessor_29__length = 48;
const int accessor_29__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_30[];
const int accessor_30__length = 48;
const int accessor_30__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_31[];
const int accessor_31__length = 48;
const int accessor_31__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_32[];
const int accessor_32__length = 48;
const int accessor_32__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_33[];
const int accessor_33__length = 48;
const int accessor_33__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_34[];
const int accessor_34__length = 48;
const int accessor_34__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_35[];
const int accessor_35__length = 48;
const int accessor_35__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_36[];
const int accessor_36__length = 48;
const int accessor_36__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_37[];
const int accessor_37__length = 48;
const int accessor_37__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_38[];
const int accessor_38__length = 48;
const int accessor_38__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_39[];
const int accessor_39__length = 48;
const int accessor_39__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_40[];
const int accessor_40__length = 48;
const int accessor_40__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_41[];
const int accessor_41__length = 48;
const int accessor_41__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_42[];
const int accessor_42__length = 48;
const int accessor_42__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_43[];
const int accessor_43__length = 48;
const int accessor_43__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_44[];
const int accessor_44__length = 48;
const int accessor_44__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_45[];
const int accessor_45__length = 48;
const int accessor_45__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_46[];
const int accessor_46__length = 48;
const int accessor_46__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_47[];
const int accessor_47__length = 48;
const int accessor_47__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_48[];
const int accessor_48__length = 48;
const int accessor_48__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_49[];
const int accessor_49__length = 48;
const int accessor_49__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_50[];
const int accessor_50__length = 48;
const int accessor_50__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_51[];
const int accessor_51__length = 48;
const int accessor_51__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_52[];
const int accessor_52__length = 48;
const int accessor_52__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_53[];
const int accessor_53__length = 48;
const int accessor_53__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_54[];
const int accessor_54__length = 48;
const int accessor_54__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_55[];
const int accessor_55__length = 48;
const int accessor_55__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_56[];
const int accessor_56__length = 48;
const int accessor_56__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_57[];
const int accessor_57__length = 48;
const int accessor_57__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_58[];
const int accessor_58__length = 48;
const int accessor_58__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_59[];
const int accessor_59__length = 48;
const int accessor_59__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_60[];
const int accessor_60__length = 48;
const int accessor_60__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_61[];
const int accessor_61__length = 48;
const int accessor_61__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_62[];
const int accessor_62__length = 48;
const int accessor_62__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_63[];
const int accessor_63__length = 48;
const int accessor_63__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_64[];
const int accessor_64__length = 48;
const int accessor_64__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_65[];
const int accessor_65__length = 48;
const int accessor_65__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_66[];
const int accessor_66__length = 48;
const int accessor_66__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_67[];
const int accessor_67__length = 48;
const int accessor_67__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_68[];
const int accessor_68__length = 48;
const int accessor_68__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_69[];
const int accessor_69__length = 48;
const int accessor_69__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_70[];
const int accessor_70__length = 48;
const int accessor_70__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_71[];
const int accessor_71__length = 48;
const int accessor_71__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_72[];
const int accessor_72__length = 48;
const int accessor_72__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_73[];
const int accessor_73__length = 48;
const int accessor_73__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_74[];
const int accessor_74__length = 48;
const int accessor_74__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_75[];
const int accessor_75__length = 48;
const int accessor_75__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_76[];
const int accessor_76__length = 48;
const int accessor_76__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_77[];
const int accessor_77__length = 48;
const int accessor_77__size = (sizeof (D3DXVECTOR3)) * 48;
extern const float accessor_78[];
const int accessor_78__length = 48;
const int accessor_78__size = (sizeof (float)) * 48;
extern const D3DXVECTOR3 accessor_79[];
const int accessor_79__length = 48;
const int accessor_79__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXVECTOR4 accessor_80[];
const int accessor_80__length = 48;
const int accessor_80__size = (sizeof (D3DXVECTOR4)) * 48;
extern const D3DXVECTOR3 accessor_81[];
const int accessor_81__length = 48;
const int accessor_81__size = (sizeof (D3DXVECTOR3)) * 48;
extern const D3DXMATRIX accessor_82[];
const int accessor_82__length = 19;
const int accessor_82__size = (sizeof (D3DXMATRIX)) * 19;
extern const Node node_0;
extern const Node node_1;
extern const Node node_2;
extern const Node node_3;
extern const Node node_4;
extern const Node node_5;
extern const Node node_6;
extern const Node node_7;
extern const Node node_8;
extern const Node node_9;
extern const Node node_10;
extern const Node node_11;
extern const Node node_12;
extern const Node node_13;
extern const Node node_14;
extern const Node node_15;
extern const Node node_16;
extern const Node node_17;
extern const Node node_18;
extern const Node node_19;
extern const Node node_20;
extern const Node node_21;
extern const Node * nodes[];
const int nodes__length = 22;
extern const AnimationChannel animation_0__channels[];
const int animation_0__channels__length = 57;

View File

@ -8,8 +8,6 @@
/EHsc
/RTC1
/MDd
/Fo"Debug\\"
/Fd"Debug\vc80.pdb"
/W3
/c
/Wp64

View File

@ -8,8 +8,6 @@
/FD
/EHsc
/MT
/Fo"Release\\"
/Fd"Release\vc80.pdb"
/W3
/c
/Wp64

View File

@ -3,8 +3,6 @@
/SUBSYSTEM:WINDOWS
/MANIFEST:NO
/MACHINE:X86
/OUT:"Debug\d3d10.exe"
/PDB:"Debug\d3d10.pdb"
d3d10.lib
d3dx10.lib
kernel32.lib
@ -19,5 +17,3 @@ oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
".\Debug\main.obj"
".\Debug\main.res"

View File

@ -5,8 +5,6 @@
/LTCG
/MANIFEST:NO
/MACHINE:X86
/OUT:"Release\d3d10.exe"
/PDB:"Release\d3d10.pdb"
d3d10.lib
d3dx10.lib
kernel32.lib
@ -21,5 +19,3 @@ oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
".\Release\main.obj"
".\Release\main.res"

View File

@ -11,8 +11,11 @@
//#include "rigged_simple.hpp"
//#define ROOT_MESH_NODE node_2
#include "rigged_figure.hpp"
#define ROOT_MESH_NODE node_1
//#include "rigged_figure.hpp"
//#define ROOT_MESH_NODE node_1
#include "cesium_man.hpp"
#define ROOT_MESH_NODE node_2
HINSTANCE g_hInstance = NULL;
HWND g_hWnd = NULL;
@ -206,16 +209,20 @@ HRESULT InitDirect3DViews()
descDepth.CPUAccessFlags = 0;
descDepth.MiscFlags = 0;
hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencil);
if (FAILED(hr))
if (FAILED(hr)) {
print("CreateTexture2D\n");
return hr;
}
D3D10_DEPTH_STENCIL_VIEW_DESC descDSV;
descDSV.Format = descDepth.Format;
descDSV.ViewDimension = D3D10_DSV_DIMENSION_TEXTURE2D;
descDSV.Texture2D.MipSlice = 0;
hr = g_pd3dDevice->CreateDepthStencilView(g_pDepthStencil, &descDSV, &g_pDepthStencilView);
if (FAILED(hr))
if (FAILED(hr)) {
print("CreateDepthStencilView\n");
return hr;
}
g_pd3dDevice->OMSetRenderTargets(1, &g_pRenderTargetView, g_pDepthStencilView);
@ -299,8 +306,10 @@ HRESULT InitDirect3DDevice()
ID3D10RasterizerState* pRState = NULL;
hr = g_pd3dDevice->CreateRasterizerState(&RSDesc, &pRState);
if (FAILED(hr))
if (FAILED(hr)) {
print("CreateRasterizerState\n");
return hr;
}
g_pd3dDevice->RSSetState(pRState);
@ -332,8 +341,10 @@ HRESULT InitDirect3DDevice()
descTexture.CPUAccessFlags = 0;
descTexture.MiscFlags = 0;
hr = g_pd3dDevice->CreateTexture2D(&descTexture, &initSeafloorData, &g_pTexture);
if (FAILED(hr))
if (FAILED(hr)) {
print("CreateTexture2D\n");
return hr;
}
D3D10_SHADER_RESOURCE_VIEW_DESC descSRV;
descSRV.Format = descTexture.Format;
@ -341,8 +352,10 @@ HRESULT InitDirect3DDevice()
descSRV.Texture2D.MostDetailedMip = 0;
descSRV.Texture2D.MipLevels = 1;
hr = g_pd3dDevice->CreateShaderResourceView(g_pTexture, &descSRV, &g_pTextureShaderResourceView);
if (FAILED(hr))
if (FAILED(hr)) {
print("CreateShaderResourceView\n");
return hr;
}
// effect
HRSRC hRes = FindResource(NULL, L"RES_MAIN_FXO", RT_RCDATA);
@ -480,10 +493,6 @@ HRESULT InitDirect3DDevice()
// index buffer
//////////////////////////////////////////////////////////////////////
assert(accessor_3_length == accessor_2_length);
assert(accessor_3_length == accessor_4_length);
assert(accessor_3_length == accessor_1_length);
bd.Usage = D3D10_USAGE_DEFAULT;
bd.ByteWidth = mesh->indices_size;
//bd.ByteWidth = (sizeof (DWORD)) * indices_length;
@ -493,8 +502,10 @@ HRESULT InitDirect3DDevice()
initData.pSysMem = mesh->indices;
//initData.pSysMem = indices;
hr = g_pd3dDevice->CreateBuffer(&bd, &initData, &g_pIndexBuffer);
if (FAILED(hr))
if (FAILED(hr)) {
print("CreateBuffer\n");
return hr;
}
g_pd3dDevice->IASetIndexBuffer(g_pIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
@ -606,14 +617,13 @@ static inline float Lerp(const float * frames, float t, int frame_ix)
return (t - frames[frame_ix]) / (frames[frame_ix + 1] - frames[frame_ix]);
}
const int joints_length = (sizeof (skin_0__joints)) / (sizeof (skin_0__joints[0]));
const int joints_length = skin_0__joints__length;
D3DXMATRIX mJoints[joints_length];
NodeInstance node_inst[nodes_length];
NodeInstance node_inst[nodes__length];
void InitializeNodeInstances()
{
for (int i = 0; i < nodes_length; i++) {
for (int i = 0; i < nodes__length; i++) {
node_inst[i].translation = nodes[i]->translation;
node_inst[i].rotation = nodes[i]->rotation;
node_inst[i].scale = nodes[i]->scale;
@ -648,9 +658,9 @@ D3DXMATRIX GlobalTransform(int node_ix)
void Animate(float t)
{
const AnimationChannel * channels = animation_0__channels;
const int channels_length = (sizeof (animation_0__channels)) / (sizeof (animation_0__channels[0]));
const int channels_length = animation_0__channels__length;
t = loop(t, 2.0833330154418945);
t = loop(t, 2.0);
// find frame and lerp (same accessor for all channels)
const float * input = channels[0].sampler->input;
@ -658,6 +668,7 @@ void Animate(float t)
int frame_ix = FindFrame(input, input_length, t);
float lerp = Lerp(input, t, frame_ix);
//float lerp = 0.0;
// sample all channels
if (1)
@ -732,8 +743,8 @@ void Render()
D3DXMATRIX rx;
D3DXMATRIX ry;
D3DXMatrixRotationX(&ry, (float)D3DX_PI * -0.5f);
D3DXMatrixRotationZ(&rx, (float)D3DX_PI * 0.5f + t * 0.5f);
D3DXMatrixRotationY(&ry, (float)D3DX_PI * -0.0f + t * 0.5f);
D3DXMatrixRotationZ(&rx, (float)D3DX_PI * -0.0f);
D3DXMatrixMultiply(&g_World1,
&rx,
&ry);

View File

@ -2,7 +2,7 @@ matrix World;
matrix View;
matrix Projection;
matrix mJoint[20];
matrix mJoint[39];
float4 vLightDir[2];
float4 vLightColor[2];