Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,878 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// File: OptimizedMesh.cpp
|
||||
//
|
||||
// Desc: Sample of optimizing meshes in D3D
|
||||
//
|
||||
// Copyright (c) 1998-2001 Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <commdlg.h>
|
||||
#include <d3dx8.h>
|
||||
#include "D3DApp.h"
|
||||
#include "D3DFont.h"
|
||||
#include "D3DUtil.h"
|
||||
#include "DXUtil.h"
|
||||
#include "resource.h"
|
||||
|
||||
struct SStripData
|
||||
{
|
||||
LPDIRECT3DINDEXBUFFER8 m_pStrips; // strip indices (single strip)
|
||||
LPDIRECT3DINDEXBUFFER8 m_pStripsMany; // strip indices (many strips)
|
||||
|
||||
DWORD m_cStripIndices;
|
||||
DWORD *m_rgcStripLengths;
|
||||
DWORD m_cStrips;
|
||||
|
||||
SStripData()
|
||||
:m_pStrips(NULL),
|
||||
m_pStripsMany(NULL),
|
||||
m_cStripIndices(0),
|
||||
m_rgcStripLengths(NULL)
|
||||
{}
|
||||
};
|
||||
|
||||
struct SMeshData
|
||||
{
|
||||
LPD3DXMESH m_pMeshSysMem; // System memory copy of mesh
|
||||
|
||||
LPD3DXMESH m_pMesh; // Local version of mesh, copied on resize
|
||||
LPDIRECT3DVERTEXBUFFER8 m_pVertexBuffer; // vertex buffer of mesh
|
||||
|
||||
SStripData *m_rgStripData; // strip indices split by attribute
|
||||
DWORD m_cStripDatas;
|
||||
|
||||
SMeshData()
|
||||
:m_pMeshSysMem(NULL),
|
||||
m_pMesh(NULL),
|
||||
m_pVertexBuffer(NULL),
|
||||
m_rgStripData(NULL),
|
||||
m_cStripDatas(0)
|
||||
{}
|
||||
|
||||
void ReleaseLocalMeshes()
|
||||
{
|
||||
SAFE_RELEASE(m_pMesh);
|
||||
SAFE_RELEASE(m_pVertexBuffer);
|
||||
}
|
||||
|
||||
void ReleaseAll()
|
||||
{
|
||||
SAFE_RELEASE(m_pMeshSysMem);
|
||||
SAFE_RELEASE(m_pMesh);
|
||||
SAFE_RELEASE(m_pVertexBuffer);
|
||||
|
||||
for (DWORD iStripData = 0; iStripData < m_cStripDatas; iStripData++)
|
||||
{
|
||||
SAFE_RELEASE(m_rgStripData[iStripData].m_pStrips);
|
||||
SAFE_RELEASE(m_rgStripData[iStripData].m_pStripsMany);
|
||||
delete []m_rgStripData[iStripData].m_rgcStripLengths;
|
||||
}
|
||||
|
||||
delete []m_rgStripData;
|
||||
m_rgStripData = NULL;
|
||||
m_cStripDatas = 0;
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: class CMyD3DApplication
|
||||
// Desc: Main class to run this application. Most functionality is inherited
|
||||
// from the CD3DApplication base class.
|
||||
//-----------------------------------------------------------------------------
|
||||
class CMyD3DApplication : public CD3DApplication
|
||||
{
|
||||
TCHAR m_strMeshFilename[512];
|
||||
TCHAR m_strInitialDir[512];
|
||||
|
||||
BOOL m_bShowVertexCacheOptimized;
|
||||
BOOL m_bShowStripReordered;
|
||||
BOOL m_bShowStrips;
|
||||
BOOL m_bShowSingleStrip;
|
||||
BOOL m_bForce32ByteFVF;
|
||||
|
||||
CD3DFont* m_pFont; // Font for outputting frame stats
|
||||
|
||||
CD3DArcBall m_ArcBall; // Mouse rotation utility
|
||||
D3DXVECTOR3 m_vObjectCenter; // Center of bounding sphere of object
|
||||
FLOAT m_fObjectRadius; // Radius of bounding sphere of object
|
||||
|
||||
D3DXMATRIX m_matWorld;
|
||||
DWORD m_cObjectsPerSide; // sqrt of the number of objects to draw
|
||||
|
||||
DWORD m_dwMemoryOptions;
|
||||
|
||||
// various forms of mesh data
|
||||
SMeshData m_MeshAttrSorted;
|
||||
SMeshData m_MeshStripReordered;
|
||||
SMeshData m_MeshVertexCacheOptimized;
|
||||
|
||||
DWORD m_dwNumMaterials; // Number of materials
|
||||
LPDIRECT3DTEXTURE8* m_pMeshTextures;
|
||||
D3DMATERIAL8* m_pMeshMaterials;
|
||||
|
||||
public:
|
||||
HRESULT OneTimeSceneInit();
|
||||
HRESULT InitDeviceObjects();
|
||||
HRESULT RestoreDeviceObjects();
|
||||
HRESULT InvalidateDeviceObjects();
|
||||
HRESULT DeleteDeviceObjects();
|
||||
HRESULT Render();
|
||||
HRESULT FrameMove();
|
||||
HRESULT FinalCleanup();
|
||||
|
||||
LRESULT MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||
CMyD3DApplication();
|
||||
|
||||
HRESULT LoadMeshData(LPD3DXMESH *pMeshSysMemLoaded, LPD3DXBUFFER *ppAdjacencyBuffer);
|
||||
HRESULT OptimizeMeshData(LPD3DXMESH pMeshSysMem, LPD3DXBUFFER pAdjacencyBuffer, DWORD dwOptFlags, SMeshData *pMeshData);
|
||||
HRESULT UpdateLocalMeshes(SMeshData *pMeshData);
|
||||
HRESULT DrawMeshData(SMeshData *pMeshData);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: WinMain()
|
||||
// Desc: Entry point to the program. Initializes everything, and goes into a
|
||||
// message-processing loop. Idle time is used to render the scene.
|
||||
//-----------------------------------------------------------------------------
|
||||
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
|
||||
{
|
||||
CMyD3DApplication d3dApp;
|
||||
|
||||
if( FAILED( d3dApp.Create( hInst ) ) )
|
||||
return 0;
|
||||
|
||||
return d3dApp.Run();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CMyD3DApplication()
|
||||
// Desc: Constructor
|
||||
//-----------------------------------------------------------------------------
|
||||
CMyD3DApplication::CMyD3DApplication()
|
||||
{
|
||||
// Override base class members
|
||||
m_strWindowTitle = _T("OptimizedMesh: Optimizing Meshes in D3D");
|
||||
m_bUseDepthBuffer = TRUE;
|
||||
m_bShowCursorWhenFullscreen = TRUE;
|
||||
|
||||
// Initialize member variables
|
||||
m_bShowVertexCacheOptimized = TRUE;
|
||||
m_bShowStripReordered = FALSE;
|
||||
m_bShowSingleStrip = TRUE;
|
||||
m_bShowStrips = FALSE;
|
||||
m_bShowSingleStrip = FALSE;
|
||||
m_bForce32ByteFVF = TRUE;
|
||||
|
||||
m_dwMemoryOptions = D3DXMESH_MANAGED;
|
||||
|
||||
m_pFont = new CD3DFont( _T("Arial"), 12, D3DFONT_BOLD );
|
||||
|
||||
_tcscpy( m_strInitialDir, DXUtil_GetDXSDKMediaPath() );
|
||||
_tcscpy( m_strMeshFilename, _T("knot.x") );
|
||||
|
||||
m_cObjectsPerSide = 1;
|
||||
|
||||
// initialize mesh data structures
|
||||
m_dwNumMaterials = 0;
|
||||
m_pMeshTextures = NULL;
|
||||
m_pMeshMaterials = NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OneTimeSceneInit()
|
||||
// Desc: Called during initial app startup, this function performs all the
|
||||
// permanent initialization.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::OneTimeSceneInit()
|
||||
{
|
||||
// Set cursor to indicate that user can move the object with the mouse
|
||||
#ifdef _WIN64
|
||||
SetClassLongPtr( m_hWnd, GCLP_HCURSOR, (LONG_PTR)LoadCursor( NULL, IDC_SIZEALL ) );
|
||||
#else
|
||||
SetClassLong( m_hWnd, GCL_HCURSOR, (LONG)LoadCursor( NULL, IDC_SIZEALL ) );
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: FrameMove()
|
||||
// Desc: Called once per frame, the call is the entry point for animating
|
||||
// the scene.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::FrameMove()
|
||||
{
|
||||
// Setup viewing postion from ArcBall
|
||||
D3DXMATRIX matTemp;
|
||||
D3DXMatrixTranslation( &m_matWorld, -m_vObjectCenter.x,
|
||||
-m_vObjectCenter.y,
|
||||
-m_vObjectCenter.z );
|
||||
D3DXMatrixMultiply( &m_matWorld, &m_matWorld, m_ArcBall.GetTranslationMatrix() );
|
||||
D3DXMatrixMultiply( &m_matWorld, &m_matWorld, m_ArcBall.GetRotationMatrix() );
|
||||
|
||||
D3DXMatrixTranslation( &matTemp, -m_fObjectRadius * (m_cObjectsPerSide-1),//* 0.5f,
|
||||
-m_fObjectRadius * (m_cObjectsPerSide-1),//* 0.5f,
|
||||
0 );
|
||||
D3DXMatrixMultiply( &m_matWorld, &m_matWorld, &matTemp );
|
||||
|
||||
D3DXMATRIX matView;
|
||||
D3DXMatrixLookAtLH( &matView, &D3DXVECTOR3( 0, 0,-3.7f*m_fObjectRadius * m_cObjectsPerSide),
|
||||
&D3DXVECTOR3( 0, 0, 0 ),
|
||||
&D3DXVECTOR3( 0, 1, 0 ) );
|
||||
m_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMyD3DApplication::DrawMeshData(SMeshData *pMeshData)
|
||||
{
|
||||
HRESULT hr;
|
||||
DWORD iCurFace;
|
||||
|
||||
// Set and draw each of the materials in the mesh
|
||||
for( DWORD iMaterial=0; iMaterial < m_dwNumMaterials; iMaterial++ )
|
||||
{
|
||||
m_pd3dDevice->SetMaterial( &m_pMeshMaterials[iMaterial] );
|
||||
m_pd3dDevice->SetTexture( 0, m_pMeshTextures[iMaterial] );
|
||||
|
||||
if( !m_bShowStrips && !m_bShowSingleStrip)
|
||||
{
|
||||
pMeshData->m_pMesh->DrawSubset( iMaterial );
|
||||
}
|
||||
else // drawing strips
|
||||
{
|
||||
DWORD dwFVF;
|
||||
DWORD cBytesPerVertex;
|
||||
DWORD iStrip;
|
||||
|
||||
dwFVF = pMeshData->m_pMesh->GetFVF();
|
||||
cBytesPerVertex = D3DXGetFVFVertexSize(dwFVF);
|
||||
|
||||
m_pd3dDevice->SetVertexShader(dwFVF);
|
||||
m_pd3dDevice->SetStreamSource(0, pMeshData->m_pVertexBuffer, cBytesPerVertex);
|
||||
|
||||
if(m_bShowSingleStrip)
|
||||
{
|
||||
m_pd3dDevice->SetIndices(pMeshData->m_rgStripData[iMaterial].m_pStrips, 0);
|
||||
|
||||
hr = m_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP,
|
||||
0, pMeshData->m_pMesh->GetNumVertices(),
|
||||
0, pMeshData->m_rgStripData[iMaterial].m_cStripIndices - 2);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pd3dDevice->SetIndices(pMeshData->m_rgStripData[iMaterial].m_pStripsMany, 0);
|
||||
|
||||
iCurFace = 0;
|
||||
for (iStrip = 0; iStrip < pMeshData->m_rgStripData[iMaterial].m_cStrips; iStrip++)
|
||||
{
|
||||
hr = m_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP,
|
||||
0, pMeshData->m_pMesh->GetNumVertices(),
|
||||
iCurFace, pMeshData->m_rgStripData[iMaterial].m_rgcStripLengths[iStrip]);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
iCurFace += 2 + pMeshData->m_rgStripData[iMaterial].m_rgcStripLengths[iStrip];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: Render()
|
||||
// Desc: Called once per frame, the call is the entry point for 3d
|
||||
// rendering. This function sets up render states, clears the
|
||||
// viewport, and renders the scene.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::Render()
|
||||
{
|
||||
DWORD xOffset;
|
||||
DWORD yOffset;
|
||||
D3DXMATRIX matWorld;
|
||||
D3DXMATRIX matTemp;
|
||||
DWORD cTriangles = 0;
|
||||
FLOAT fTrisPerSec;
|
||||
TCHAR strInfo[120];
|
||||
TCHAR *szOptString;
|
||||
|
||||
// Clear the scene
|
||||
m_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
|
||||
0x000000ff, 1.0f, 0x00000000 );
|
||||
|
||||
// Draw scene
|
||||
if( SUCCEEDED( m_pd3dDevice->BeginScene() ) )
|
||||
{
|
||||
for (xOffset = 0; xOffset < m_cObjectsPerSide; xOffset++)
|
||||
{
|
||||
for (yOffset = 0; yOffset < m_cObjectsPerSide; yOffset++)
|
||||
{
|
||||
D3DXMatrixTranslation( &matTemp, m_fObjectRadius * xOffset * 2,
|
||||
m_fObjectRadius * yOffset * 2,
|
||||
0 );
|
||||
D3DXMatrixMultiply( &matWorld, &m_matWorld, &matTemp );
|
||||
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
|
||||
|
||||
if (m_bShowVertexCacheOptimized)
|
||||
DrawMeshData(&m_MeshVertexCacheOptimized);
|
||||
else if (m_bShowStripReordered)
|
||||
DrawMeshData(&m_MeshStripReordered);
|
||||
else
|
||||
DrawMeshData(&m_MeshAttrSorted);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate and show triangles per sec, a reasonable throughput number
|
||||
if (m_MeshAttrSorted.m_pMesh != NULL)
|
||||
cTriangles = m_MeshAttrSorted.m_pMesh->GetNumFaces() * m_cObjectsPerSide * m_cObjectsPerSide;
|
||||
else
|
||||
cTriangles = 0;
|
||||
|
||||
fTrisPerSec = m_fFPS * cTriangles;
|
||||
|
||||
if (m_bShowVertexCacheOptimized)
|
||||
szOptString = _T("VCache Optimized");
|
||||
else if (m_bShowStripReordered)
|
||||
szOptString = _T("Strip Reordered");
|
||||
else
|
||||
szOptString = _T("Unoptimized");
|
||||
|
||||
// Output statistics
|
||||
wsprintf( strInfo, _T("%s, %ld tris per sec, %ld triangles"),
|
||||
szOptString, (DWORD)fTrisPerSec, cTriangles);
|
||||
|
||||
m_pFont->DrawText( 2, 0, D3DCOLOR_ARGB(255,255,255,0), m_strFrameStats );
|
||||
m_pFont->DrawText( 2, 20, D3DCOLOR_ARGB(255,255,255,0), m_strDeviceStats );
|
||||
m_pFont->DrawText( 2, 40, D3DCOLOR_ARGB(255,255,255,0), strInfo);
|
||||
|
||||
|
||||
m_pd3dDevice->EndScene();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
HRESULT CMyD3DApplication::LoadMeshData
|
||||
(
|
||||
LPD3DXMESH *ppMesh,
|
||||
LPD3DXBUFFER *ppAdjacencyBuffer
|
||||
)
|
||||
{
|
||||
LPDIRECT3DVERTEXBUFFER8 pMeshVB = NULL;
|
||||
LPD3DXBUFFER pD3DXMtrlBuffer = NULL;
|
||||
BYTE* pVertices;
|
||||
TCHAR strMesh[512];
|
||||
HRESULT hr = S_OK;
|
||||
BOOL bNormalsInFile;
|
||||
LPD3DXMESH pMeshSysMem = NULL;
|
||||
LPD3DXMESH pMeshTemp;
|
||||
DWORD *rgdwAdjacencyTemp = NULL;
|
||||
DWORD i;
|
||||
D3DXMATERIAL* d3dxMaterials;
|
||||
DWORD dw32Bit;
|
||||
|
||||
// Get a path to the media file
|
||||
DXUtil_FindMediaFile( strMesh, m_strMeshFilename );
|
||||
|
||||
// Load the mesh from the specified file
|
||||
hr = D3DXLoadMeshFromX( strMesh, D3DXMESH_SYSTEMMEM, m_pd3dDevice,
|
||||
ppAdjacencyBuffer, &pD3DXMtrlBuffer,
|
||||
&m_dwNumMaterials, &pMeshSysMem );
|
||||
if( FAILED(hr) )
|
||||
goto End;
|
||||
|
||||
// remember if the mesh is 32 or 16 bit, to be added in on the clones
|
||||
dw32Bit = pMeshSysMem->GetOptions() & D3DXMESH_32BIT;
|
||||
|
||||
// Get the array of materials out of the returned buffer, and allocate a texture array
|
||||
d3dxMaterials = (D3DXMATERIAL*)pD3DXMtrlBuffer->GetBufferPointer();
|
||||
m_pMeshMaterials = new D3DMATERIAL8[m_dwNumMaterials];
|
||||
m_pMeshTextures = new LPDIRECT3DTEXTURE8[m_dwNumMaterials];
|
||||
|
||||
for( i=0; i<m_dwNumMaterials; i++ )
|
||||
{
|
||||
m_pMeshMaterials[i] = d3dxMaterials[i].MatD3D;
|
||||
m_pMeshMaterials[i].Ambient = m_pMeshMaterials[i].Diffuse;
|
||||
m_pMeshTextures[i] = NULL;
|
||||
|
||||
// Get a path to the texture
|
||||
TCHAR strPath[512];
|
||||
if (d3dxMaterials[i].pTextureFilename != NULL)
|
||||
{
|
||||
DXUtil_FindMediaFile( strPath, d3dxMaterials[i].pTextureFilename );
|
||||
|
||||
// Load the texture
|
||||
D3DXCreateTextureFromFile( m_pd3dDevice, strPath, &m_pMeshTextures[i] );
|
||||
}
|
||||
}
|
||||
|
||||
// Done with the material buffer
|
||||
SAFE_RELEASE( pD3DXMtrlBuffer );
|
||||
|
||||
// Lock the vertex buffer, to generate a simple bounding sphere
|
||||
hr = pMeshSysMem->GetVertexBuffer( &pMeshVB );
|
||||
if( SUCCEEDED(hr) )
|
||||
{
|
||||
hr = pMeshVB->Lock( 0, 0, &pVertices, D3DLOCK_NOSYSLOCK );
|
||||
if( SUCCEEDED(hr) )
|
||||
{
|
||||
hr = D3DXComputeBoundingSphere( pVertices, pMeshSysMem->GetNumVertices(),
|
||||
pMeshSysMem->GetFVF(),
|
||||
&m_vObjectCenter, &m_fObjectRadius );
|
||||
pMeshVB->Unlock();
|
||||
}
|
||||
pMeshVB->Release();
|
||||
}
|
||||
if( FAILED(hr) )
|
||||
goto End;
|
||||
|
||||
// remember if there were normals in the file, before possible clone operation
|
||||
bNormalsInFile = pMeshSysMem->GetFVF() & D3DFVF_NORMAL;
|
||||
|
||||
// if using 32byte vertices, check fvf
|
||||
if (m_bForce32ByteFVF)
|
||||
{
|
||||
// force 32 byte vertices
|
||||
if (pMeshSysMem->GetFVF() != (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1))
|
||||
{
|
||||
hr = pMeshSysMem->CloneMeshFVF( pMeshSysMem->GetOptions(), D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1,
|
||||
m_pd3dDevice, &pMeshTemp );
|
||||
if( FAILED(hr) )
|
||||
goto End;
|
||||
|
||||
pMeshSysMem->Release();
|
||||
pMeshSysMem = pMeshTemp;
|
||||
}
|
||||
}
|
||||
// otherwise, just make sure that there is a normal mesh
|
||||
else if ( !(pMeshSysMem->GetFVF() & D3DFVF_NORMAL) )
|
||||
{
|
||||
hr = pMeshSysMem->CloneMeshFVF( pMeshSysMem->GetOptions(), pMeshSysMem->GetFVF() | D3DFVF_NORMAL,
|
||||
m_pd3dDevice, &pMeshTemp );
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
pMeshSysMem->Release();
|
||||
pMeshSysMem = pMeshTemp;
|
||||
}
|
||||
|
||||
|
||||
// Compute normals for the mesh, if not present
|
||||
if (!bNormalsInFile)
|
||||
{
|
||||
D3DXComputeNormals( pMeshSysMem, NULL );
|
||||
}
|
||||
|
||||
*ppMesh = pMeshSysMem;
|
||||
pMeshSysMem = NULL;
|
||||
|
||||
End:
|
||||
SAFE_RELEASE( pMeshSysMem );
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CMyD3DApplication::OptimizeMeshData
|
||||
(
|
||||
LPD3DXMESH pMeshSysMem,
|
||||
LPD3DXBUFFER pAdjacencyBuffer,
|
||||
DWORD dwOptFlags,
|
||||
SMeshData *pMeshData
|
||||
)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
LPD3DXBUFFER pbufTemp = NULL;
|
||||
DWORD iMaterial;
|
||||
|
||||
// attribute sort - the un-optimized mesh option
|
||||
// remember the adjacency for the vertex cache optimization
|
||||
hr = pMeshSysMem->Optimize( dwOptFlags|D3DXMESH_SYSTEMMEM,
|
||||
(DWORD*)pAdjacencyBuffer->GetBufferPointer(),
|
||||
NULL, NULL, NULL, &pMeshData->m_pMeshSysMem);
|
||||
if( FAILED(hr) )
|
||||
goto End;
|
||||
|
||||
pMeshData->m_cStripDatas = m_dwNumMaterials;
|
||||
pMeshData->m_rgStripData = new SStripData[pMeshData->m_cStripDatas];
|
||||
if (pMeshData->m_rgStripData == NULL)
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
goto End;
|
||||
}
|
||||
|
||||
for (iMaterial = 0; iMaterial < m_dwNumMaterials; iMaterial++)
|
||||
{
|
||||
hr = D3DXConvertMeshSubsetToSingleStrip(pMeshData->m_pMeshSysMem, iMaterial,
|
||||
D3DXMESH_IB_MANAGED, &pMeshData->m_rgStripData[iMaterial].m_pStrips,
|
||||
&pMeshData->m_rgStripData[iMaterial].m_cStripIndices);
|
||||
if (FAILED(hr))
|
||||
goto End;
|
||||
|
||||
hr = D3DXConvertMeshSubsetToStrips(pMeshData->m_pMeshSysMem, iMaterial,
|
||||
D3DXMESH_IB_MANAGED, &pMeshData->m_rgStripData[iMaterial].m_pStripsMany,
|
||||
NULL, &pbufTemp, &pMeshData->m_rgStripData[iMaterial].m_cStrips);
|
||||
if (FAILED(hr))
|
||||
goto End;
|
||||
|
||||
pMeshData->m_rgStripData[iMaterial].m_rgcStripLengths = new DWORD[pMeshData->m_rgStripData[iMaterial].m_cStrips];
|
||||
if (pMeshData->m_rgStripData[iMaterial].m_rgcStripLengths == NULL)
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
goto End;
|
||||
}
|
||||
memcpy(pMeshData->m_rgStripData[iMaterial].m_rgcStripLengths, pbufTemp->GetBufferPointer(), sizeof(DWORD)*pMeshData->m_rgStripData[iMaterial].m_cStrips);
|
||||
|
||||
}
|
||||
|
||||
End:
|
||||
SAFE_RELEASE(pbufTemp);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: InitDeviceObjects()
|
||||
// Desc: Initialize scene objects.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::InitDeviceObjects()
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
LPD3DXMESH pMeshSysMem = NULL;
|
||||
LPD3DXBUFFER pAdjacencyBuffer = NULL;
|
||||
|
||||
// Initialize the font
|
||||
m_pFont->InitDeviceObjects( m_pd3dDevice );
|
||||
|
||||
// check current display setting
|
||||
CheckMenuItem( GetMenu(m_hWnd), ID_OPTIONS_DISPLAY1 + (m_cObjectsPerSide-1), MF_CHECKED );
|
||||
CheckMenuItem( GetMenu(m_hWnd), IDM_SHOWNONOPTIMIZEDMESH, (!m_bShowStripReordered && !m_bShowVertexCacheOptimized) ? MF_CHECKED : MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(m_hWnd), IDM_SHOWVCACHEOPTIMIZED, m_bShowVertexCacheOptimized ? MF_CHECKED : MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(m_hWnd), IDM_SHOWSTRIPREORDERED, m_bShowStripReordered ? MF_CHECKED : MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(m_hWnd), IDM_SHOWTRILIST, (!m_bShowStrips && !m_bShowSingleStrip) ? MF_CHECKED : MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(m_hWnd), IDM_SHOWONESTRIP, m_bShowSingleStrip ? MF_CHECKED : MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(m_hWnd), IDM_SHOWMANYSTRIPS, m_bShowStrips ? MF_CHECKED : MF_UNCHECKED );
|
||||
|
||||
CheckMenuItem( GetMenu(m_hWnd), IDM_DYNAMICVB, (m_dwMemoryOptions == D3DXMESH_DYNAMIC) ? MF_CHECKED : MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(m_hWnd), IDM_FORCE32BYTEVERTEX, m_bForce32ByteFVF ? MF_CHECKED : MF_UNCHECKED );
|
||||
|
||||
hr = LoadMeshData(&pMeshSysMem, &pAdjacencyBuffer);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
// ignore load errors, just draw blank screen if mesh is invalid
|
||||
hr = S_OK;
|
||||
goto End;
|
||||
}
|
||||
|
||||
hr = OptimizeMeshData(pMeshSysMem, pAdjacencyBuffer, D3DXMESHOPT_ATTRSORT, &m_MeshAttrSorted);
|
||||
if (FAILED(hr))
|
||||
goto End;
|
||||
|
||||
hr = OptimizeMeshData(pMeshSysMem, pAdjacencyBuffer, D3DXMESHOPT_STRIPREORDER, &m_MeshStripReordered);
|
||||
if (FAILED(hr))
|
||||
goto End;
|
||||
|
||||
hr = OptimizeMeshData(pMeshSysMem, pAdjacencyBuffer, D3DXMESHOPT_VERTEXCACHE, &m_MeshVertexCacheOptimized);
|
||||
if (FAILED(hr))
|
||||
goto End;
|
||||
|
||||
End:
|
||||
SAFE_RELEASE( pMeshSysMem );
|
||||
SAFE_RELEASE( pAdjacencyBuffer );
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CMyD3DApplication::UpdateLocalMeshes(SMeshData *pMeshData)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
// if a mesh was loaded, update the local meshes
|
||||
if (pMeshData->m_pMeshSysMem != NULL)
|
||||
{
|
||||
hr = pMeshData->m_pMeshSysMem->CloneMeshFVF( m_dwMemoryOptions|D3DXMESH_VB_WRITEONLY, pMeshData->m_pMeshSysMem->GetFVF(),
|
||||
m_pd3dDevice, &pMeshData->m_pMesh );
|
||||
if (FAILED(hr))
|
||||
goto End;
|
||||
|
||||
hr = pMeshData->m_pMesh->GetVertexBuffer(&pMeshData->m_pVertexBuffer);
|
||||
if (FAILED(hr))
|
||||
goto End;
|
||||
|
||||
}
|
||||
|
||||
End:
|
||||
return hr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: RestoreDeviceObjects()
|
||||
// Desc: Initialize scene objects.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::RestoreDeviceObjects()
|
||||
{
|
||||
m_pFont->RestoreDeviceObjects();
|
||||
|
||||
// Setup render state
|
||||
m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, TRUE );
|
||||
m_pd3dDevice->SetRenderState( D3DRS_DITHERENABLE, TRUE );
|
||||
m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
|
||||
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
|
||||
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR );
|
||||
|
||||
// Setup the light
|
||||
D3DLIGHT8 light;
|
||||
light.Type = D3DLIGHT_DIRECTIONAL;
|
||||
light.Diffuse.r = light.Diffuse.g = light.Diffuse.b = 1.0f;
|
||||
light.Specular.r = light.Specular.g = light.Specular.b = 0.0f;
|
||||
light.Ambient.r = light.Ambient.g = light.Ambient.b = 0.3f;
|
||||
light.Position = D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
|
||||
D3DXVec3Normalize( (D3DXVECTOR3*)&light.Direction, &D3DXVECTOR3( 0.3f, -1.0f, 1.0f ) );
|
||||
light.Attenuation0 = light.Attenuation1 = light.Attenuation2 = 0.0f;
|
||||
light.Range = sqrtf(FLT_MAX);
|
||||
m_pd3dDevice->SetLight(0, &light );
|
||||
m_pd3dDevice->LightEnable(0, TRUE );
|
||||
|
||||
m_ArcBall.SetWindow( m_d3dsdBackBuffer.Width, m_d3dsdBackBuffer.Height, 0.85f );
|
||||
m_ArcBall.SetRadius( m_fObjectRadius );
|
||||
|
||||
FLOAT fAspect = m_d3dsdBackBuffer.Width / (FLOAT)m_d3dsdBackBuffer.Height;
|
||||
|
||||
D3DXMATRIX matProj;
|
||||
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, fAspect, m_fObjectRadius/64.0f,
|
||||
m_fObjectRadius*200.0f);
|
||||
m_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
|
||||
|
||||
// update the local copies of the meshes
|
||||
UpdateLocalMeshes(&m_MeshAttrSorted);
|
||||
UpdateLocalMeshes(&m_MeshStripReordered);
|
||||
UpdateLocalMeshes(&m_MeshVertexCacheOptimized);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: InvalidateDeviceObjects()
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::InvalidateDeviceObjects()
|
||||
{
|
||||
m_pFont->InvalidateDeviceObjects();
|
||||
|
||||
m_MeshAttrSorted.ReleaseLocalMeshes();
|
||||
m_MeshStripReordered.ReleaseLocalMeshes();
|
||||
m_MeshVertexCacheOptimized.ReleaseLocalMeshes();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: DeleteDeviceObjects()
|
||||
// Desc: Called when the app is exiting, or the device is being changed,
|
||||
// this function deletes any device dependent objects.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::DeleteDeviceObjects()
|
||||
{
|
||||
m_pFont->DeleteDeviceObjects();
|
||||
|
||||
for( UINT i=0; i<m_dwNumMaterials; i++ )
|
||||
SAFE_RELEASE( m_pMeshTextures[i] );
|
||||
SAFE_DELETE_ARRAY( m_pMeshTextures );
|
||||
SAFE_DELETE_ARRAY( m_pMeshMaterials );
|
||||
|
||||
m_MeshAttrSorted.ReleaseAll();
|
||||
m_MeshStripReordered.ReleaseAll();
|
||||
m_MeshVertexCacheOptimized.ReleaseAll();
|
||||
|
||||
m_dwNumMaterials = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: FinalCleanup()
|
||||
// Desc: Called during initial app startup, this function performs all the
|
||||
// permanent initialization.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::FinalCleanup()
|
||||
{
|
||||
SAFE_DELETE( m_pFont );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: MsgProc()
|
||||
// Desc: Message proc function to handle key and menu input
|
||||
//-----------------------------------------------------------------------------
|
||||
LRESULT CMyD3DApplication::MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
// Pass mouse messages to the ArcBall so it can build internal matrices
|
||||
m_ArcBall.HandleMouseMessages( hWnd, uMsg, wParam, lParam );
|
||||
|
||||
// Trap the context menu
|
||||
if( WM_CONTEXTMENU==uMsg )
|
||||
return 0;
|
||||
|
||||
if( uMsg == WM_COMMAND )
|
||||
{
|
||||
// Toggle mesh optimization
|
||||
if( LOWORD(wParam) == IDM_SHOWNONOPTIMIZEDMESH )
|
||||
{
|
||||
m_bShowVertexCacheOptimized = FALSE;
|
||||
m_bShowStripReordered = FALSE;
|
||||
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWNONOPTIMIZEDMESH, MF_CHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWVCACHEOPTIMIZED, MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWSTRIPREORDERED, MF_UNCHECKED );
|
||||
}
|
||||
else if( LOWORD(wParam) == IDM_SHOWVCACHEOPTIMIZED )
|
||||
{
|
||||
m_bShowVertexCacheOptimized = TRUE;
|
||||
m_bShowStripReordered = FALSE;
|
||||
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWNONOPTIMIZEDMESH, MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWVCACHEOPTIMIZED, MF_CHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWSTRIPREORDERED, MF_UNCHECKED );
|
||||
}
|
||||
else if( LOWORD(wParam) == IDM_SHOWSTRIPREORDERED )
|
||||
{
|
||||
m_bShowVertexCacheOptimized = FALSE;
|
||||
m_bShowStripReordered = TRUE;
|
||||
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWNONOPTIMIZEDMESH, MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWVCACHEOPTIMIZED, MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWSTRIPREORDERED, MF_CHECKED );
|
||||
}
|
||||
// Toggle strips
|
||||
else if( LOWORD(wParam) == IDM_SHOWTRILIST )
|
||||
{
|
||||
m_bShowStrips = FALSE;
|
||||
m_bShowSingleStrip = FALSE;
|
||||
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWTRILIST, MF_CHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWONESTRIP, MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWMANYSTRIPS, MF_UNCHECKED );
|
||||
}
|
||||
else if( LOWORD(wParam) == IDM_SHOWONESTRIP )
|
||||
{
|
||||
m_bShowStrips = FALSE;
|
||||
m_bShowSingleStrip = TRUE;
|
||||
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWTRILIST, MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWONESTRIP, MF_CHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWMANYSTRIPS, MF_UNCHECKED );
|
||||
}
|
||||
else if( LOWORD(wParam) == IDM_SHOWMANYSTRIPS )
|
||||
{
|
||||
m_bShowStrips = TRUE;
|
||||
m_bShowSingleStrip = FALSE;
|
||||
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWTRILIST, MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWONESTRIP, MF_UNCHECKED );
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_SHOWMANYSTRIPS, MF_CHECKED );
|
||||
}
|
||||
// Toggle vertex buffer mode
|
||||
else if( LOWORD(wParam) == IDM_DYNAMICVB )
|
||||
{
|
||||
if (m_dwMemoryOptions == D3DXMESH_DYNAMIC)
|
||||
{
|
||||
m_dwMemoryOptions = D3DXMESH_MANAGED;
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_DYNAMICVB, MF_UNCHECKED );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dwMemoryOptions = D3DXMESH_DYNAMIC;
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_DYNAMICVB, MF_CHECKED );
|
||||
}
|
||||
// Destroy and recreate everything
|
||||
InvalidateDeviceObjects();
|
||||
RestoreDeviceObjects();
|
||||
}
|
||||
else if( LOWORD(wParam) == IDM_FORCE32BYTEVERTEX )
|
||||
{
|
||||
m_bForce32ByteFVF = !m_bForce32ByteFVF;
|
||||
|
||||
CheckMenuItem( GetMenu(hWnd), IDM_FORCE32BYTEVERTEX, m_bForce32ByteFVF ? MF_CHECKED : MF_UNCHECKED );
|
||||
|
||||
// Destroy and recreate everything
|
||||
InvalidateDeviceObjects();
|
||||
DeleteDeviceObjects();
|
||||
InitDeviceObjects();
|
||||
RestoreDeviceObjects();
|
||||
}
|
||||
// Handle the open file command
|
||||
else if( LOWORD(wParam) == IDM_OPENFILE )
|
||||
{
|
||||
TCHAR g_strFilename[512] = _T("");
|
||||
|
||||
// Display the OpenFileName dialog. Then, try to load the specified file
|
||||
OPENFILENAME ofn = { sizeof(OPENFILENAME), NULL, NULL,
|
||||
_T(".X Files (.x)\0*.x\0\0"),
|
||||
NULL, 0, 1, m_strMeshFilename, 512, g_strFilename, 512,
|
||||
m_strInitialDir, _T("Open Mesh File"),
|
||||
OFN_FILEMUSTEXIST, 0, 1, NULL, 0, NULL, NULL };
|
||||
|
||||
if( TRUE == GetOpenFileName( &ofn ) )
|
||||
{
|
||||
_tcscpy( m_strInitialDir, m_strMeshFilename );
|
||||
TCHAR* pLastSlash = _tcsrchr( m_strInitialDir, _T('\\') );
|
||||
if( pLastSlash )
|
||||
*pLastSlash = 0;
|
||||
SetCurrentDirectory( m_strInitialDir );
|
||||
|
||||
// Destroy and recreate everything
|
||||
InvalidateDeviceObjects();
|
||||
DeleteDeviceObjects();
|
||||
InitDeviceObjects();
|
||||
RestoreDeviceObjects();
|
||||
}
|
||||
}
|
||||
|
||||
else if ((LOWORD(wParam) >= ID_OPTIONS_DISPLAY1) && (LOWORD(wParam) <= ID_OPTIONS_DISPLAY36))
|
||||
{
|
||||
// uncheck old item
|
||||
CheckMenuItem( GetMenu(hWnd), ID_OPTIONS_DISPLAY1 + (m_cObjectsPerSide-1), MF_UNCHECKED );
|
||||
|
||||
// calc new item
|
||||
m_cObjectsPerSide = LOWORD(wParam) - ID_OPTIONS_DISPLAY1 + 1;
|
||||
|
||||
// check new item
|
||||
CheckMenuItem( GetMenu(hWnd), ID_OPTIONS_DISPLAY1 + (m_cObjectsPerSide-1), MF_CHECKED );
|
||||
}
|
||||
}
|
||||
|
||||
return CD3DApplication::MsgProc( hWnd, uMsg, wParam, lParam );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
# Microsoft Developer Studio Project File - Name="OptimizedMesh" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=OptimizedMesh - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "optimizedmesh.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "optimizedmesh.mak" CFG="OptimizedMesh - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "OptimizedMesh - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "OptimizedMesh - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "OptimizedMesh - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 d3dx8.lib d3d8.lib winmm.lib dxguid.lib d3dxof.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /machine:I386 /stack:0x200000,0x200000
|
||||
|
||||
!ELSEIF "$(CFG)" == "OptimizedMesh - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 d3dx8dt.lib d3d8.lib winmm.lib dxguid.lib d3dxof.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /stack:0x200000,0x200000
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "OptimizedMesh - Win32 Release"
|
||||
# Name "OptimizedMesh - Win32 Debug"
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\directx.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WinMain.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\d3dapp.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\d3dapp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\d3dfont.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\d3dfont.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\d3dutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\d3dutil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\dxutil.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\OptimizedMesh.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readme.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "OptimizedMesh"=.\optimizedmesh.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on optimizedmesh.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=OptimizedMesh - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to OptimizedMesh - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "OptimizedMesh - Win32 Release" && "$(CFG)" != "OptimizedMesh - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "optimizedmesh.mak" CFG="OptimizedMesh - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "OptimizedMesh - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "OptimizedMesh - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "OptimizedMesh - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\optimizedmesh.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\d3dapp.obj"
|
||||
-@erase "$(INTDIR)\d3dfont.obj"
|
||||
-@erase "$(INTDIR)\d3dutil.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\OptimizedMesh.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\WinMain.res"
|
||||
-@erase "$(OUTDIR)\optimizedmesh.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\optimizedmesh.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\WinMain.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\optimizedmesh.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=d3dx8.lib d3d8.lib winmm.lib dxguid.lib d3dxof.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\optimizedmesh.pdb" /machine:I386 /out:"$(OUTDIR)\optimizedmesh.exe" /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\d3dapp.obj" \
|
||||
"$(INTDIR)\d3dfont.obj" \
|
||||
"$(INTDIR)\d3dutil.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\OptimizedMesh.obj" \
|
||||
"$(INTDIR)\WinMain.res"
|
||||
|
||||
"$(OUTDIR)\optimizedmesh.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "OptimizedMesh - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\optimizedmesh.exe" "$(OUTDIR)\optimizedmesh.bsc"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\d3dapp.obj"
|
||||
-@erase "$(INTDIR)\d3dapp.sbr"
|
||||
-@erase "$(INTDIR)\d3dfont.obj"
|
||||
-@erase "$(INTDIR)\d3dfont.sbr"
|
||||
-@erase "$(INTDIR)\d3dutil.obj"
|
||||
-@erase "$(INTDIR)\d3dutil.sbr"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\dxutil.sbr"
|
||||
-@erase "$(INTDIR)\OptimizedMesh.obj"
|
||||
-@erase "$(INTDIR)\OptimizedMesh.sbr"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(INTDIR)\WinMain.res"
|
||||
-@erase "$(OUTDIR)\optimizedmesh.bsc"
|
||||
-@erase "$(OUTDIR)\optimizedmesh.exe"
|
||||
-@erase "$(OUTDIR)\optimizedmesh.ilk"
|
||||
-@erase "$(OUTDIR)\optimizedmesh.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\optimizedmesh.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\WinMain.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\optimizedmesh.bsc"
|
||||
BSC32_SBRS= \
|
||||
"$(INTDIR)\d3dapp.sbr" \
|
||||
"$(INTDIR)\d3dfont.sbr" \
|
||||
"$(INTDIR)\d3dutil.sbr" \
|
||||
"$(INTDIR)\dxutil.sbr" \
|
||||
"$(INTDIR)\OptimizedMesh.sbr"
|
||||
|
||||
"$(OUTDIR)\optimizedmesh.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
|
||||
$(BSC32) @<<
|
||||
$(BSC32_FLAGS) $(BSC32_SBRS)
|
||||
<<
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=d3dx8dt.lib d3d8.lib winmm.lib dxguid.lib d3dxof.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\optimizedmesh.pdb" /debug /machine:I386 /out:"$(OUTDIR)\optimizedmesh.exe" /pdbtype:sept /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\d3dapp.obj" \
|
||||
"$(INTDIR)\d3dfont.obj" \
|
||||
"$(INTDIR)\d3dutil.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\OptimizedMesh.obj" \
|
||||
"$(INTDIR)\WinMain.res"
|
||||
|
||||
"$(OUTDIR)\optimizedmesh.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("optimizedmesh.dep")
|
||||
!INCLUDE "optimizedmesh.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "optimizedmesh.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "OptimizedMesh - Win32 Release" || "$(CFG)" == "OptimizedMesh - Win32 Debug"
|
||||
SOURCE=.\WinMain.rc
|
||||
|
||||
"$(INTDIR)\WinMain.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\d3dapp.cpp
|
||||
|
||||
!IF "$(CFG)" == "OptimizedMesh - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\d3dapp.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "OptimizedMesh - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\d3dapp.obj" "$(INTDIR)\d3dapp.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\..\common\src\d3dfont.cpp
|
||||
|
||||
!IF "$(CFG)" == "OptimizedMesh - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\d3dfont.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "OptimizedMesh - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\d3dfont.obj" "$(INTDIR)\d3dfont.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\..\common\src\d3dutil.cpp
|
||||
|
||||
!IF "$(CFG)" == "OptimizedMesh - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\d3dutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "OptimizedMesh - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\d3dutil.obj" "$(INTDIR)\d3dutil.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
|
||||
!IF "$(CFG)" == "OptimizedMesh - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "OptimizedMesh - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\dxutil.obj" "$(INTDIR)\dxutil.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\OptimizedMesh.cpp
|
||||
|
||||
!IF "$(CFG)" == "OptimizedMesh - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\OptimizedMesh.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "OptimizedMesh - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\OptimizedMesh.obj" "$(INTDIR)\OptimizedMesh.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OptimizedMesh Direct3D Sample
|
||||
//
|
||||
// Copyright (c) 1998-2001 Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
The OptimizedMesh sample illustrates how to load and optimize a file-based
|
||||
mesh using the D3DX mesh utility functions.
|
||||
|
||||
For more info on D3DX, refer to the DirectX SDK documentation.
|
||||
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\D3D\OptimizedMesh
|
||||
Executable: DXSDK\Samples\Multimedia\D3D\Bin
|
||||
|
||||
|
||||
User's Guide
|
||||
============
|
||||
The following keys are implemented. The dropdown menus can be used for the
|
||||
same controls.
|
||||
<Enter> Starts and stops the scene
|
||||
<Space> Advances the scene by a small increment
|
||||
<F1> Shows help or available commands.
|
||||
<F2> Prompts user to select a new rendering device or display mode
|
||||
<Alt+Enter> Toggles between fullscreen and windowed modes
|
||||
<Esc> Exits the app.
|
||||
|
||||
|
||||
Programming Notes
|
||||
=================
|
||||
Many Direct3D samples on the DirectX SDK use file-based meshes. This sample
|
||||
is a good sample to look to see the bare bones code necessary for loading a
|
||||
mesh. Note that the D3DX mesh loading functionality collapses the frame
|
||||
hierarchy of a .x file into one mesh.
|
||||
|
||||
For other samples, the bare bones D3DX mesh functionality is wrapped in a
|
||||
common class class CD3DMesh. If it is desired to keep the frame hierarchy,
|
||||
the common class CD3DFile can be used.
|
||||
|
||||
This sample makes use of common DirectX code (consisting of helper functions,
|
||||
etc.) that is shared with other samples on the DirectX SDK. All common
|
||||
headers and source code can be found in the following directory:
|
||||
DXSDK\Samples\Multimedia\Common
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by winmain.rc
|
||||
//
|
||||
#define IDI_MAIN_ICON 101
|
||||
#define IDR_MAIN_ACCEL 113
|
||||
#define IDR_MENU 141
|
||||
#define IDR_POPUP 142
|
||||
#define IDD_SELECTDEVICE 144
|
||||
#define IDC_DEVICE_COMBO 1000
|
||||
#define IDC_MODE_COMBO 1001
|
||||
#define IDC_ADAPTER_COMBO 1002
|
||||
#define IDC_FULLSCREENMODES_COMBO 1003
|
||||
#define IDC_MULTISAMPLE_COMBO 1005
|
||||
#define IDC_WINDOWED_CHECKBOX 1012
|
||||
#define IDC_FULLSCREEN_TEXT 1014
|
||||
#define IDC_WINDOW 1016
|
||||
#define IDC_FULLSCREEN 1018
|
||||
#define IDD_VSHADER 1019
|
||||
#define IDM_CHANGEDEVICE 40002
|
||||
#define IDM_TOGGLEFULLSCREEN 40003
|
||||
#define IDM_TOGGLESTART 40004
|
||||
#define IDM_SINGLESTEP 40005
|
||||
#define IDM_EXIT 40006
|
||||
#define IDM_OPENFILE 40011
|
||||
#define IDM_SHOWOPTIMIZEDMESH 40012
|
||||
#define ID_OPTIONS_DISPLAY1 40014
|
||||
#define ID_OPTIONS_DISPLAY4 40015
|
||||
#define ID_OPTIONS_DISPLAY9 40016
|
||||
#define ID_OPTIONS_DISPLAY16 40017
|
||||
#define ID_OPTIONS_DISPLAY25 40018
|
||||
#define ID_OPTIONS_DISPLAY36 40019
|
||||
#define IDM_SHOWSTRIPS 40020
|
||||
#define IDM_SHOWSINGLESTRIP 40021
|
||||
#define IDM_CACHESIZE_12 40022
|
||||
#define IDM_CACHESIZE_13 40023
|
||||
#define IDM_CACHESIZE_14 40024
|
||||
#define IDM_CACHESIZE_15 40025
|
||||
#define IDM_CACHESIZE_16 40026
|
||||
#define IDM_CACHESIZE_17 40027
|
||||
#define IDM_CACHESIZE_18 40028
|
||||
#define IDM_MAGICNUMBER_5 40029
|
||||
#define IDM_MAGICNUMBER_6 40030
|
||||
#define IDM_MAGICNUMBER_7 40031
|
||||
#define IDM_MAGICNUMBER_8 40032
|
||||
#define IDM_MAGICNUMBER_9 40033
|
||||
#define IDM_MAGICNUMBER_10 40034
|
||||
#define IDM_SHOWXBOX 40035
|
||||
#define IDM_LOADTAMER 40036
|
||||
#define IDM_DYNAMICVB 40037
|
||||
#define IDM_SHOWNONOPTIMIZEDMESH 40038
|
||||
#define IDM_SHOWONESTRIP 40039
|
||||
#define IDM_SHOWMANYSTRIPS 40040
|
||||
#define IDM_FORCE32BYTEVERTEX 40041
|
||||
#define IDM_SHOWSTRIPREORDERED 40042
|
||||
#define IDM_SHOWVCACHEOPTIMIZED 40043
|
||||
#define IDM_SHOWTRILIST 40044
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 146
|
||||
#define _APS_NEXT_COMMAND_VALUE 40045
|
||||
#define _APS_NEXT_CONTROL_VALUE 1027
|
||||
#define _APS_NEXT_SYMED_VALUE 102
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,209 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define IDC_STATIC -1
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_MAIN_ICON ICON DISCARDABLE "DirectX.ico"
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#define IDC_STATIC -1\r\n"
|
||||
"#include <windows.h>\r\n"
|
||||
"\r\n"
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_MAIN_ACCEL ACCELERATORS DISCARDABLE
|
||||
BEGIN
|
||||
"D", IDM_DYNAMICVB, VIRTKEY, CONTROL, NOINVERT
|
||||
"F", IDM_FORCE32BYTEVERTEX, VIRTKEY, CONTROL, NOINVERT
|
||||
"M", IDM_SHOWMANYSTRIPS, VIRTKEY, CONTROL, NOINVERT
|
||||
"O", IDM_SHOWONESTRIP, VIRTKEY, CONTROL, NOINVERT
|
||||
"S", IDM_SHOWSTRIPREORDERED, VIRTKEY, CONTROL, NOINVERT
|
||||
"T", IDM_SHOWTRILIST, VIRTKEY, CONTROL, NOINVERT
|
||||
"U", IDM_SHOWNONOPTIMIZEDMESH, VIRTKEY, CONTROL, NOINVERT
|
||||
"V", IDM_SHOWVCACHEOPTIMIZED, VIRTKEY, CONTROL, NOINVERT
|
||||
VK_ESCAPE, IDM_EXIT, VIRTKEY, NOINVERT
|
||||
VK_F2, IDM_CHANGEDEVICE, VIRTKEY, NOINVERT
|
||||
VK_RETURN, IDM_TOGGLESTART, VIRTKEY, NOINVERT
|
||||
VK_RETURN, IDM_TOGGLEFULLSCREEN, VIRTKEY, ALT, NOINVERT
|
||||
VK_SPACE, IDM_SINGLESTEP, VIRTKEY, NOINVERT
|
||||
"X", IDM_EXIT, VIRTKEY, ALT, NOINVERT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_SELECTDEVICE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 259
|
||||
TOPMARGIN, 7
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_SELECTDEVICE DIALOG DISCARDABLE 0, 0, 267, 138
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Select Device"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Rendering device",IDC_STATIC,5,5,200,45
|
||||
LTEXT "&Adapter:",IDC_STATIC,22,17,65,10,SS_CENTERIMAGE
|
||||
COMBOBOX IDC_ADAPTER_COMBO,90,15,105,100,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "&Device:",IDC_STATIC,22,32,65,10,SS_CENTERIMAGE
|
||||
COMBOBOX IDC_DEVICE_COMBO,90,30,105,100,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
GROUPBOX "Rendering mode",IDC_STATIC,5,52,200,45
|
||||
CONTROL "Use desktop &window",IDC_WINDOW,"Button",
|
||||
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,10,62,85,15
|
||||
CONTROL "&Fullscreen mode:",IDC_FULLSCREEN,"Button",
|
||||
BS_AUTORADIOBUTTON,10,77,75,15
|
||||
COMBOBOX IDC_FULLSCREENMODES_COMBO,90,77,105,204,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_GROUP | WS_TABSTOP
|
||||
GROUPBOX "Multisample",IDC_STATIC,5,101,200,28
|
||||
LTEXT "&Multisample Type:",IDC_STATIC,22,113,62,10,
|
||||
SS_CENTERIMAGE
|
||||
COMBOBOX IDC_MULTISAMPLE_COMBO,90,111,105,100,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
DEFPUSHBUTTON "OK",IDOK,210,10,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,210,30,50,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MENU MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&Open file...", IDM_OPENFILE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Go/stop\tEnter", IDM_TOGGLESTART
|
||||
MENUITEM "&Single step\tSpace", IDM_SINGLESTEP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Change device...\tF2", IDM_CHANGEDEVICE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit\tESC", IDM_EXIT
|
||||
END
|
||||
POPUP "&Options"
|
||||
BEGIN
|
||||
MENUITEM "&Dynamic VBs\tCtrl+D", IDM_DYNAMICVB
|
||||
MENUITEM "&Force 32 Byte FVF\tCtrl+F", IDM_FORCE32BYTEVERTEX
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Show &unoptimized mesh\tCtrl+U", IDM_SHOWNONOPTIMIZEDMESH
|
||||
MENUITEM "Show Strip Reorded mesh\tCtrl+S", IDM_SHOWSTRIPREORDERED
|
||||
MENUITEM "Show VCache optimized &mesh\tCtrl+V",
|
||||
IDM_SHOWVCACHEOPTIMIZED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Show using Tri List\tCtrl+T", IDM_SHOWTRILIST
|
||||
MENUITEM "Show using &one Strip\tCtrl+O", IDM_SHOWONESTRIP
|
||||
MENUITEM "Show using &many Strips\tCtrl+M", IDM_SHOWMANYSTRIPS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Display 1 mesh", ID_OPTIONS_DISPLAY1
|
||||
MENUITEM "Display 4 meshes", ID_OPTIONS_DISPLAY4
|
||||
MENUITEM "Display 9 meshes", ID_OPTIONS_DISPLAY9
|
||||
MENUITEM "Display 16 meshes", ID_OPTIONS_DISPLAY16
|
||||
MENUITEM "Display 25 meshes", ID_OPTIONS_DISPLAY25
|
||||
MENUITEM "Display 36 meshes", ID_OPTIONS_DISPLAY36
|
||||
END
|
||||
END
|
||||
|
||||
IDR_POPUP MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "Popup"
|
||||
BEGIN
|
||||
MENUITEM "&Go/stop", IDM_TOGGLESTART
|
||||
MENUITEM "&Single step", IDM_SINGLESTEP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Change device...", IDM_CHANGEDEVICE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", IDM_EXIT
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
Reference in New Issue
Block a user