wip2
This commit is contained in:
parent
fcbaf7ab66
commit
433c5281e7
@ -378,6 +378,10 @@ namespace collada_scene {
|
||||
return E_FAIL;
|
||||
}
|
||||
DWORD dwResSize = SizeofResource(NULL, hRes);
|
||||
if (dwResSize == 0) {
|
||||
*ppVertexBuffer = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
void * pData = LockResource(LoadResource(NULL, hRes));
|
||||
|
||||
D3D10_BUFFER_DESC bd;
|
||||
@ -437,6 +441,8 @@ namespace collada_scene {
|
||||
XMConvertToRadians(XMVectorGetW(transform.vector)));
|
||||
case transform_type::SCALE:
|
||||
return XMMatrixScalingFromVector(transform.vector);
|
||||
case transform_type::MATRIX:
|
||||
return transform.matrix;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
@ -851,7 +857,7 @@ namespace collada_scene {
|
||||
|
||||
g_pViewEyeVariable->SetFloatVector((float *)&eye);
|
||||
|
||||
int lights = min(2, m_lightInstancesCount);
|
||||
int lights = min(4, m_lightInstancesCount);
|
||||
g_pLightPosVariable->SetFloatVectorArray((float *)m_lightPositions, 0, lights);
|
||||
g_pLightDirVariable->SetFloatVectorArray((float *)m_lightDirections, 0, lights);
|
||||
g_pLightColorVariable->SetFloatVectorArray((float *)m_lightColors, 0, lights);
|
||||
|
||||
36
src/main.cpp
36
src/main.cpp
@ -129,7 +129,7 @@ XMFLOAT4 g_vLightColors[2] = {
|
||||
|
||||
//
|
||||
|
||||
XMVECTOR g_Eye = XMVectorSet(0.0f, -40.0f, 25.0f, 1.0f);
|
||||
XMVECTOR g_Eye = XMVectorSet(0.0f, -260.0f, 260.0f, 1.0f);
|
||||
XMVECTOR g_At = XMVectorSet(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
// collada scene state
|
||||
@ -283,7 +283,8 @@ HRESULT InitWindow(HINSTANCE hInstance, int nCmdShow)
|
||||
return E_FAIL;
|
||||
|
||||
// create window
|
||||
RECT rc = { 0, 0, 512, 512 };
|
||||
//RECT rc = { 0, 0, 512, 512 };
|
||||
RECT rc = { 0, 0, 1365, 1024 };
|
||||
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);
|
||||
UINT width = rc.right - rc.left;
|
||||
UINT height = rc.bottom - rc.top;
|
||||
@ -1105,6 +1106,24 @@ HRESULT InitDirect3DDevice()
|
||||
|
||||
g_pd3dDevice->RSSetState(pRState);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// depth stencil state
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
D3D10_DEPTH_STENCIL_DESC dsDesc;
|
||||
dsDesc.DepthEnable = true;
|
||||
dsDesc.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ALL;
|
||||
dsDesc.DepthFunc = D3D10_COMPARISON_LESS;
|
||||
dsDesc.StencilEnable = false;
|
||||
|
||||
// Create depth stencil state
|
||||
ID3D10DepthStencilState * pDSState;
|
||||
g_pd3dDevice->CreateDepthStencilState(&dsDesc, &pDSState);
|
||||
|
||||
g_pd3dDevice->OMSetDepthStencilState(pDSState, 1);
|
||||
*/
|
||||
|
||||
//
|
||||
|
||||
InitDirect3DViews();
|
||||
@ -1225,8 +1244,8 @@ HRESULT InitDirect3DDevice()
|
||||
float fFov = XM_PI * 0.5f;
|
||||
float fAspect = width / (float)height;
|
||||
float fNear = 0.1f;
|
||||
float fFar = 100.0f;
|
||||
g_Projection = XMMatrixPerspectiveFovLH(fFov,
|
||||
float fFar = 1000.0f;
|
||||
g_Projection = XMMatrixPerspectiveFovRH(fFov,
|
||||
fAspect,
|
||||
fNear,
|
||||
fFar);
|
||||
@ -1261,7 +1280,7 @@ BOOL Resize()
|
||||
|
||||
InitDirect3DViews();
|
||||
|
||||
float fFov = XM_PI * 0.5f;
|
||||
float fFov = XM_PI * 1.0f;
|
||||
float fAspect = width / (float)height;
|
||||
float fNear = 0.1f;
|
||||
float fFar = 100.0f;
|
||||
@ -1735,8 +1754,7 @@ void Update(float t, float dt)
|
||||
g_Eye = XMVector4Transform(g_Eye, mTranslateView * mRotateView);
|
||||
XMVECTOR Up = XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
g_View = XMMatrixLookAtLH(g_Eye, g_At, Up);
|
||||
|
||||
g_View = XMMatrixLookAtRH(g_Eye, g_At, Up);
|
||||
}
|
||||
|
||||
void RenderVolume(float t)
|
||||
@ -1818,7 +1836,7 @@ void Render(float t, float dt)
|
||||
{
|
||||
// clear
|
||||
|
||||
const float ClearColor[4] = { 0.2f, 0.125f, 0.2f, 1.0f };
|
||||
const float ClearColor[4] = { 0.2f * 0.2f, 0.125f * 0.2f, 0.2f * 0.2f, 1.0f };
|
||||
g_pd3dDevice->OMSetRenderTargets(1, &g_pRenderTargetView, g_pDepthStencilView);
|
||||
g_pd3dDevice->ClearRenderTargetView(g_pRenderTargetView, ClearColor);
|
||||
g_pd3dDevice->ClearDepthStencilView(g_pDepthStencilView, D3D10_CLEAR_DEPTH, 1.0f, 0);
|
||||
@ -1845,6 +1863,8 @@ void Render(float t, float dt)
|
||||
g_SceneState.update(t);
|
||||
g_SceneState.render();
|
||||
|
||||
RenderBloom();
|
||||
|
||||
RenderFont(dt);
|
||||
|
||||
// present
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user