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:
2025-11-29 16:24:34 +09:00
commit e067522598
5135 changed files with 1745744 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
// ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
#include "dxtex.h"
#include "dxtexdoc.h"
#include "dxtexview.h"
#include "ChildFrm.h"
#ifndef WM_IDLEUPDATECMDUI
#define WM_IDLEUPDATECMDUI 0x0363 // wParam == bDisableIfNoHandler
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CChildFrame)
ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction
CChildFrame::CChildFrame()
{
}
CChildFrame::~CChildFrame()
{
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CChildFrame diagnostics
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CMDIChildWnd::AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CMDIChildWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
BOOL CChildFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CMDIFrameWnd* pParentWnd, CCreateContext* pContext)
{
if (!CMDIChildWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, pContext))
return FALSE;
return TRUE;
}
// Handle WM_IDLEUPDATECMDUI to update modified indicator if necessary.
LRESULT CChildFrame::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM)
{
// Only update the title if the doc or view state has changed.
// Otherwise, the title bar will flicker.
CDxtexDoc* pDoc = (CDxtexDoc*)GetActiveDocument();
CDxtexView* pView = (CDxtexView*)GetActiveView();
if (pView->TitleModsChanged() || pDoc->TitleModsChanged())
{
// This will force MFC to call CChildFrame::OnUpdateTitleFrame:
m_nIdleFlags |= idleTitle;
pView->ClearTitleModsChanged();
pDoc->ClearTitleModsChanged();
}
// Do the default thing
CMDIChildWnd::OnIdleUpdateCmdUI();
return 0L;
}
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
CDxtexView* pView = (CDxtexView*)GetActiveView();
{
CString title;
GetWindowText(title);
title += " " + pView->GetStrTitleMods();
SetWindowText(title);
}
}

View File

@@ -0,0 +1,55 @@
// ChildFrm.h : interface of the CChildFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CHILDFRM_H__712C53CD_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
#define AFX_CHILDFRM_H__712C53CD_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CChildFrame : public CMDIChildWnd
{
DECLARE_DYNCREATE(CChildFrame)
public:
CChildFrame();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChildFrame)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW, const RECT& rect = rectDefault, CMDIFrameWnd* pParentWnd = NULL, CCreateContext* pContext = NULL);
virtual void OnUpdateFrameTitle(BOOL bAddToTitle);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CChildFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CChildFrame)
afx_msg LRESULT OnIdleUpdateCmdUI(WPARAM wParam, LPARAM);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHILDFRM_H__712C53CD_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)

View File

@@ -0,0 +1,117 @@
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "dxtex.h"
#include "MainFrm.h"
#include "DxtexDoc.h"
#include "DxtexView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
ON_UPDATE_COMMAND_UI(ID_INDICATOR_IMAGEINFO, OnUpdateImageInfo)
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_IMAGEINFO,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// Note: I changed the default toolbar creation code so we can still compile with VC5:
// if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
// | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
// !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.SetPaneInfo(1, ID_INDICATOR_IMAGEINFO, SBPS_NORMAL, 220);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMDIFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnUpdateImageInfo(CCmdUI *pCmdUI)
{
CString strInfo;
// Get the active MDI child window.
CMDIChildWnd *pChild = (CMDIChildWnd *)GetActiveFrame();
if (pChild != NULL && pChild != (CMDIChildWnd *)this)
{
// Get the active view attached to the active MDI child window.
CDxtexView* pView = (CDxtexView*)pChild->GetActiveView();
pView->GetImageInfo(strInfo);
pCmdUI->Enable();
pCmdUI->SetText(strInfo);
}
else
{
pCmdUI->Enable(FALSE);
}
}

View File

@@ -0,0 +1,57 @@
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__712C53CB_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
#define AFX_MAINFRM_H__712C53CB_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CMainFrame : public CMDIFrameWnd
{
DECLARE_DYNAMIC(CMainFrame)
public:
CMainFrame();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnUpdateImageInfo(CCmdUI *pCmdUI);
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__712C53CB_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)

View File

@@ -0,0 +1,125 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by dxtex.rc
//
#define IDD_ABOUTBOX 100
#define IDR_MAINFRAME 128
#define IDR_DXTXTYPE 129
#define IDD_CUBEMAP 131
#define IDD_VOLUMEMAP 132
#define IDD_CHANGEFORMAT 133
#define IDD_NEWTEXTURE 134
#define IDC_VERSION 1000
#define IDC_POSX 1001
#define IDC_NEGX 1002
#define IDC_POSY 1003
#define IDC_NEGY 1004
#define IDC_POSZ 1005
#define IDC_NEGZ 1006
#define IDC_RADIO2 1010
#define IDC_DXT1 1010
#define IDC_RADIO4 1011
#define IDC_DXT2 1011
#define IDC_RADIO8 1012
#define IDC_DXT3 1012
#define IDC_RADIO16 1013
#define IDC_DXT4 1013
#define IDC_RADIO32 1014
#define IDC_DXT5 1014
#define IDC_RADIO64 1015
#define IDC_A8R8G8B8 1015
#define IDC_RADIO128 1016
#define IDC_A1R5G5B5 1016
#define IDC_RADIO256 1017
#define IDC_R8R8G8B8 1017
#define IDC_RADIO512 1018
#define IDC_X1R5G5B5 1018
#define IDC_RADIO1024 1019
#define IDC_R3G3B2 1019
#define IDC_A8R3G3B2 1020
#define IDC_X4R4G4B4 1021
#define IDC_A4R4G4B4 1022
#define IDC_R8G8B8 1023
#define IDC_R5G6B5 1024
#define IDC_FMTDESC 1025
#define IDC_TEXTURE 1026
#define IDC_CUBEMAP 1027
#define IDC_VOLUMETEXTURE 1028
#define IDC_WIDTH 1029
#define IDC_HEIGHT 1030
#define IDC_DEPTH 1031
#define IDC_MIPCOUNT 1032
#define IDC_VOLUMEDEPTHLABEL 1033
#define IDC_X8R8G8B8 1034
#define ID_FORMAT_GENERATEMIPMAPS 32774
#define ID_FORMAT_CHANGEIMAGEFORMAT 32775
#define ID_FORMAT_DXT1 32779
#define ID_VIEW_ORIGINAL 32780
#define ID_VIEW_COMPRESSED 32781
#define ID_VIEW_SMALLERMIPLEVEL 32782
#define ID_VIEW_LARGERMIPLEVEL 32783
#define ID_VIEW_ALPHACHANNEL 32784
#define ID_VIEW_ZOOMIN 32785
#define ID_VIEW_ZOOMOUT 32786
#define ID_FORMAT_DXT2 32787
#define ID_FORMAT_DXT3 32788
#define ID_FORMAT_DXT4 32789
#define ID_FORMAT_DXT5 32790
#define ID_VIEW_CHANGEBACKGROUNDCOLOR 32791
#define ID_FILE_OPENALPHA 32792
#define ID_FILE_OPENSUBSURFACE 32794
#define ID_FILE_OPENALPHASUBSURFACE 32795
#define ID_FORMAT_CHANGECUBEMAPFACES 32796
#define ID_VIEW_POSX 32797
#define ID_VIEW_NEGX 32798
#define ID_VIEW_POSY 32799
#define ID_VIEW_NEGY 32800
#define ID_VIEW_POSZ 32801
#define ID_VIEW_NEGZ 32802
#define ID_FILE_OPENFACE 32803
#define ID_FILE_OPENALPHAFACE 32804
#define ID_FORMAT_MAKEINTOVOLUMEMAP 32806
#define ID_VIEW_HIGHERVOLUMESLICE 32807
#define ID_VIEW_LOWERVOLUMESLICE 32808
#define ID_FORMAT_CHANGESURFACEFMT 32811
#define ID_INDICATOR_IMAGEINFO 61216
#define ID_ERROR_ODDDIMENSIONS 61217
#define ID_ERROR_NOTPOW2 61218
#define ID_ERROR_WRONGDIMENSIONS 61219
#define ID_ERROR_GENERATEALPHAFAILED 61220
#define ID_ERROR_PREMULTALPHA 61221
#define ID_ERROR_PREMULTTODXT1 61222
#define ID_ERROR_CANTCREATEDEVICE 61223
#define IDS_FMTDESC_A8R8G8B8 61224
#define IDS_FMTDESC_A1R5G5B5 61225
#define IDS_FMTDESC_A4R4G4B4 61226
#define IDS_FMTDESC_R8G8B8 61227
#define IDS_FMTDESC_R5G6B5 61228
#define IDS_FMTDESC_DXT1 61229
#define IDS_FMTDESC_DXT2 61230
#define IDS_FMTDESC_DXT3 61231
#define IDS_FMTDESC_DXT4 61232
#define IDS_FMTDESC_DXT5 61233
#define ID_ERROR_CANTCREATETEXTURE 61239
#define ID_ERROR_D3DCREATEFAILED 61240
#define ID_ERROR_COULDNTLOADFILE 61241
#define ID_ERROR_COULDNTSAVEFILE 61242
#define IDS_FMTDESC_X8R8G8B8 61243
#define IDS_FMTDESC_X1R5G5B5 61244
#define IDS_FMTDESC_R3G3B2 61245
#define IDS_FMTDESC_A8R3G3B2 61246
#define IDS_FMTDESC_X4R4G4B4 61247
#define ID_ERROR_NULLREF 61248
#define ID_ERROR_NEEDALPHA 61249
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 136
#define _APS_NEXT_COMMAND_VALUE 32812
#define _APS_NEXT_CONTROL_VALUE 1035
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// dxtx.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,27 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__712C53C9_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
#define AFX_STDAFX_H__712C53C9_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <winver.h>
#include <basetsd.h>
#include <d3d8.h>
#include <d3dx8.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__712C53C9_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

View File

@@ -0,0 +1,100 @@
// dds.h
//
// This header defines constants and structures that are useful when parsing
// DDS files. DDS files were originally designed to use several structures
// and constants that are native to DirectDraw and are defined in ddraw.h,
// such as DDSURFACEDESC2 and DDSCAPS2. This file defines similar
// (compatible) constants and structures so that one can use DDS files
// without needing to include ddraw.h.
#ifndef _DDS_H_
#define _DDS_H_
struct DDS_PIXELFORMAT
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwFourCC;
DWORD dwRGBBitCount;
DWORD dwRBitMask;
DWORD dwGBitMask;
DWORD dwBBitMask;
DWORD dwABitMask;
};
#define DDS_FOURCC 0x00000004 // DDPF_FOURCC
#define DDS_RGB 0x00000040 // DDPF_RGB
#define DDS_RGBA 0x00000041 // DDPF_RGB | DDPF_ALPHAPIXELS
const DDS_PIXELFORMAT DDSPF_DXT1 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','1'), 0, 0, 0, 0, 0 };
const DDS_PIXELFORMAT DDSPF_DXT2 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','2'), 0, 0, 0, 0, 0 };
const DDS_PIXELFORMAT DDSPF_DXT3 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','3'), 0, 0, 0, 0, 0 };
const DDS_PIXELFORMAT DDSPF_DXT4 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','4'), 0, 0, 0, 0, 0 };
const DDS_PIXELFORMAT DDSPF_DXT5 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','5'), 0, 0, 0, 0, 0 };
const DDS_PIXELFORMAT DDSPF_A8R8G8B8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 };
const DDS_PIXELFORMAT DDSPF_A1R5G5B5 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000 };
const DDS_PIXELFORMAT DDSPF_A4R4G4B4 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x0000f000, 0x000000f0, 0x0000000f, 0x0000f000 };
const DDS_PIXELFORMAT DDSPF_R8G8B8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 };
const DDS_PIXELFORMAT DDSPF_R5G6B5 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 };
#define DDS_HEADER_FLAGS_TEXTURE 0x00001007 // DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT
#define DDS_HEADER_FLAGS_MIPMAP 0x00020000 // DDSD_MIPMAPCOUNT
#define DDS_HEADER_FLAGS_VOLUME 0x00800000 // DDSD_DEPTH
#define DDS_HEADER_FLAGS_PITCH 0x00000008 // DDSD_PITCH
#define DDS_HEADER_FLAGS_LINEARSIZE 0x00080000 // DDSD_LINEARSIZE
#define DDS_SURFACE_FLAGS_TEXTURE 0x00001000 // DDSCAPS_TEXTURE
#define DDS_SURFACE_FLAGS_MIPMAP 0x00400008 // DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
#define DDS_SURFACE_FLAGS_CUBEMAP 0x00000008 // DDSCAPS_COMPLEX
#define DDS_CUBEMAP_POSITIVEX 0x00000600 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX
#define DDS_CUBEMAP_NEGATIVEX 0x00000a00 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEX
#define DDS_CUBEMAP_POSITIVEY 0x00001200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEY
#define DDS_CUBEMAP_NEGATIVEY 0x00002200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEY
#define DDS_CUBEMAP_POSITIVEZ 0x00004200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ
#define DDS_CUBEMAP_NEGATIVEZ 0x00008200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ
#define DDS_CUBEMAP_ALLFACES ( DDS_CUBEMAP_POSITIVEX | DDS_CUBEMAP_NEGATIVEX |\
DDS_CUBEMAP_POSITIVEY | DDS_CUBEMAP_NEGATIVEY |\
DDS_CUBEMAP_POSITIVEZ | DDS_CUBEMAP_NEGATIVEZ )
#define DDS_FLAGS_VOLUME 0x00200000 // DDSCAPS2_VOLUME
struct DDS_HEADER
{
DWORD dwSize;
DWORD dwHeaderFlags;
DWORD dwHeight;
DWORD dwWidth;
DWORD dwPitchOrLinearSize;
DWORD dwDepth; // only if DDS_HEADER_FLAGS_VOLUME is set in dwHeaderFlags
DWORD dwMipMapCount;
DWORD dwReserved1[11];
DDS_PIXELFORMAT ddspf;
DWORD dwSurfaceFlags;
DWORD dwCubemapFlags;
DWORD dwReserved2[3];
};
#endif

View File

@@ -0,0 +1,454 @@
// Dialogs.cpp : implementation file
//
#include "stdafx.h"
#include "dxtex.h"
#include "dialogs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNewTextureDlg dialog
CNewTextureDlg::CNewTextureDlg(CWnd* pParent /*=NULL*/)
: CDialog(CNewTextureDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNewTextureDlg)
m_iTexType = 0;
m_dwWidth = 256;
m_dwHeight = 256;
m_dwDepth = 8;
m_iFmt = 0;
m_strFmtDesc = _T("");
m_numMips = 1;
//}}AFX_DATA_INIT
}
void CNewTextureDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewTextureDlg)
DDX_Radio(pDX, IDC_TEXTURE, m_iTexType);
DDX_Text(pDX, IDC_WIDTH, m_dwWidth);
DDV_MinMaxInt(pDX, m_dwWidth, 1, 1024);
DDX_Text(pDX, IDC_HEIGHT, m_dwHeight);
DDV_MinMaxInt(pDX, m_dwHeight, 1, 1024);
DDX_Text(pDX, IDC_DEPTH, m_dwDepth);
DDV_MinMaxInt(pDX, m_dwDepth, 2, 1024);
DDX_Radio(pDX, IDC_A8R8G8B8, m_iFmt);
DDX_Text(pDX, IDC_FMTDESC, m_strFmtDesc);
DDX_Text(pDX, IDC_MIPCOUNT, m_numMips);
DDV_MinMaxInt(pDX, m_numMips, 1, 20);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewTextureDlg, CDialog)
//{{AFX_MSG_MAP(CNewTextureDlg)
ON_BN_CLICKED(IDC_TEXTURE, OnChangeTextureType)
ON_BN_CLICKED(IDC_A8R8G8B8, OnChangeFormat)
ON_BN_CLICKED(IDC_VOLUMETEXTURE, OnChangeTextureType)
ON_BN_CLICKED(IDC_CUBEMAP, OnChangeTextureType)
ON_BN_CLICKED(IDC_A4R4G4B4, OnChangeFormat)
ON_BN_CLICKED(IDC_A1R5G5B5, OnChangeFormat)
ON_BN_CLICKED(IDC_R5G6B5, OnChangeFormat)
ON_BN_CLICKED(IDC_R8G8B8, OnChangeFormat)
ON_BN_CLICKED(IDC_X8R8G8B8, OnChangeFormat)
ON_BN_CLICKED(IDC_X1R5G5B5, OnChangeFormat)
ON_BN_CLICKED(IDC_R3G3B2, OnChangeFormat)
ON_BN_CLICKED(IDC_A8R3G3B2, OnChangeFormat)
ON_BN_CLICKED(IDC_X4R4G4B4, OnChangeFormat)
ON_BN_CLICKED(IDC_DXT1, OnChangeFormat)
ON_BN_CLICKED(IDC_DXT2, OnChangeFormat)
ON_BN_CLICKED(IDC_DXT3, OnChangeFormat)
ON_BN_CLICKED(IDC_DXT4, OnChangeFormat)
ON_BN_CLICKED(IDC_DXT5, OnChangeFormat)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewTextureDlg message handlers
BOOL CNewTextureDlg::OnInitDialog()
{
CDialog::OnInitDialog();
OnChangeTextureType();
OnChangeFormat();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CNewTextureDlg::OnChangeTextureType()
{
UpdateData(TRUE);
if (m_iTexType == 2)
{
// Volume Tex
GetDlgItem(IDC_VOLUMEDEPTHLABEL)->EnableWindow(TRUE);
GetDlgItem(IDC_DEPTH)->EnableWindow(TRUE);
}
else
{
// Normal or Cube Tex
GetDlgItem(IDC_VOLUMEDEPTHLABEL)->EnableWindow(FALSE);
GetDlgItem(IDC_DEPTH)->EnableWindow(FALSE);
}
UpdateData(FALSE);
OnChangeFormat();
}
void CNewTextureDlg::OnChangeFormat()
{
UpdateData(TRUE);
switch (m_iFmt)
{
case 0:
m_fmt = D3DFMT_A8R8G8B8;
m_strFmtDesc.LoadString(IDS_FMTDESC_A8R8G8B8);
break;
case 1:
m_fmt = D3DFMT_A1R5G5B5;
m_strFmtDesc.LoadString(IDS_FMTDESC_A1R5G5B5);
break;
case 2:
m_fmt = D3DFMT_A4R4G4B4;
m_strFmtDesc.LoadString(IDS_FMTDESC_A4R4G4B4);
break;
case 3:
m_fmt = D3DFMT_R8G8B8;
m_strFmtDesc.LoadString(IDS_FMTDESC_R8G8B8);
break;
case 4:
m_fmt = D3DFMT_R5G6B5;
m_strFmtDesc.LoadString(IDS_FMTDESC_R5G6B5);
break;
case 5:
m_fmt = D3DFMT_X8R8G8B8;
m_strFmtDesc.LoadString(IDS_FMTDESC_X8R8G8B8);
break;
case 6:
m_fmt = D3DFMT_X1R5G5B5;
m_strFmtDesc.LoadString(IDS_FMTDESC_X1R5G5B5);
break;
case 7:
m_fmt = D3DFMT_R3G3B2;
m_strFmtDesc.LoadString(IDS_FMTDESC_R3G3B2);
break;
case 8:
m_fmt = D3DFMT_A8R3G3B2;
m_strFmtDesc.LoadString(IDS_FMTDESC_A8R3G3B2);
break;
case 9:
m_fmt = D3DFMT_X4R4G4B4;
m_strFmtDesc.LoadString(IDS_FMTDESC_X4R4G4B4);
break;
case 10:
m_fmt = D3DFMT_DXT1;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT1);
break;
case 11:
m_fmt = D3DFMT_DXT2;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT2);
break;
case 12:
m_fmt = D3DFMT_DXT3;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT3);
break;
case 13:
m_fmt = D3DFMT_DXT4;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT4);
break;
case 14:
m_fmt = D3DFMT_DXT5;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT5);
break;
}
UpdateData(FALSE);
}
void CNewTextureDlg::OnOK()
{
UpdateData(TRUE);
// TODO: Need to do lots of validation of width/height/depth/mipcount here
if (m_iTexType != 2)
m_dwDepth = 0;
switch (m_iFmt)
{
case 0: m_fmt = D3DFMT_A8R8G8B8; break;
case 1: m_fmt = D3DFMT_A1R5G5B5; break;
case 2: m_fmt = D3DFMT_A4R4G4B4; break;
case 3: m_fmt = D3DFMT_R8G8B8; break;
case 4: m_fmt = D3DFMT_R5G6B5; break;
case 5: m_fmt = D3DFMT_X8R8G8B8; break;
case 6: m_fmt = D3DFMT_X1R5G5B5; break;
case 7: m_fmt = D3DFMT_R3G3B2; break;
case 8: m_fmt = D3DFMT_A8R3G3B2; break;
case 9: m_fmt = D3DFMT_X4R4G4B4; break;
case 10: m_fmt = D3DFMT_DXT1; break;
case 11: m_fmt = D3DFMT_DXT2; break;
case 12: m_fmt = D3DFMT_DXT3; break;
case 13: m_fmt = D3DFMT_DXT4; break;
case 14: m_fmt = D3DFMT_DXT5; break;
}
CDialog::OnOK();
}
/////////////////////////////////////////////////////////////////////////////
// CCubeMapDlg dialog
CCubeMapDlg::CCubeMapDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCubeMapDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCubeMapDlg)
m_iFace = 0;
//}}AFX_DATA_INIT
}
void CCubeMapDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCubeMapDlg)
DDX_Radio(pDX, IDC_POSX, m_iFace);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCubeMapDlg, CDialog)
//{{AFX_MSG_MAP(CCubeMapDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVolumeMapDlg dialog
CVolumeMapDlg::CVolumeMapDlg(CWnd* pParent /*=NULL*/)
: CDialog(CVolumeMapDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CVolumeMapDlg)
m_powLayers = 0;
//}}AFX_DATA_INIT
}
void CVolumeMapDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVolumeMapDlg)
DDX_Radio(pDX, IDC_RADIO2, m_powLayers);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVolumeMapDlg, CDialog)
//{{AFX_MSG_MAP(CVolumeMapDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVolumeMapDlg message handlers
/////////////////////////////////////////////////////////////////////////////
// CChangeFmtDlg dialog
CChangeFmtDlg::CChangeFmtDlg(CWnd* pParent /*=NULL*/)
: CDialog(CChangeFmtDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CChangeFmtDlg)
m_iFmt = -1;
m_strFmtDesc = _T("");
//}}AFX_DATA_INIT
}
void CChangeFmtDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CChangeFmtDlg)
DDX_Radio(pDX, IDC_A8R8G8B8, m_iFmt);
DDX_Text(pDX, IDC_FMTDESC, m_strFmtDesc);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CChangeFmtDlg, CDialog)
//{{AFX_MSG_MAP(CChangeFmtDlg)
ON_BN_CLICKED(IDC_A1R5G5B5, OnChangeFmt)
ON_BN_CLICKED(IDC_A4R4G4B4, OnChangeFmt)
ON_BN_CLICKED(IDC_A8R8G8B8, OnChangeFmt)
ON_BN_CLICKED(IDC_R5G6B5, OnChangeFmt)
ON_BN_CLICKED(IDC_R8G8B8, OnChangeFmt)
ON_BN_CLICKED(IDC_X8R8G8B8, OnChangeFmt)
ON_BN_CLICKED(IDC_X1R5G5B5, OnChangeFmt)
ON_BN_CLICKED(IDC_R3G3B2, OnChangeFmt)
ON_BN_CLICKED(IDC_A8R3G3B2, OnChangeFmt)
ON_BN_CLICKED(IDC_X4R4G4B4, OnChangeFmt)
ON_BN_CLICKED(IDC_DXT1, OnChangeFmt)
ON_BN_CLICKED(IDC_DXT2, OnChangeFmt)
ON_BN_CLICKED(IDC_DXT3, OnChangeFmt)
ON_BN_CLICKED(IDC_DXT4, OnChangeFmt)
ON_BN_CLICKED(IDC_DXT5, OnChangeFmt)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChangeFmtDlg message handlers
BOOL CChangeFmtDlg::OnInitDialog()
{
CDialog::OnInitDialog();
switch (m_fmt)
{
case D3DFMT_A8R8G8B8:
m_iFmt = 0;
break;
case D3DFMT_A1R5G5B5:
m_iFmt = 1;
break;
case D3DFMT_A4R4G4B4:
m_iFmt = 2;
break;
case D3DFMT_R8G8B8:
m_iFmt = 3;
break;
case D3DFMT_R5G6B5:
m_iFmt = 4;
break;
case D3DFMT_X8R8G8B8:
m_iFmt = 5;
break;
case D3DFMT_X1R5G5B5:
m_iFmt = 6;
break;
case D3DFMT_R3G3B2:
m_iFmt = 7;
break;
case D3DFMT_A8R3G3B2:
m_iFmt = 8;
break;
case D3DFMT_X4R4G4B4:
m_iFmt = 9;
break;
case D3DFMT_DXT1:
m_iFmt = 10;
break;
case D3DFMT_DXT2:
m_iFmt = 11;
break;
case D3DFMT_DXT3:
m_iFmt = 12;
break;
case D3DFMT_DXT4:
m_iFmt = 13;
break;
case D3DFMT_DXT5:
m_iFmt = 14;
break;
}
UpdateFmtDesc();
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CChangeFmtDlg::OnChangeFmt()
{
UpdateData(TRUE);
UpdateFmtDesc();
}
void CChangeFmtDlg::UpdateFmtDesc()
{
switch (m_iFmt)
{
case 0:
m_fmt = D3DFMT_A8R8G8B8;
m_strFmtDesc.LoadString(IDS_FMTDESC_A8R8G8B8);
break;
case 1:
m_fmt = D3DFMT_A1R5G5B5;
m_strFmtDesc.LoadString(IDS_FMTDESC_A1R5G5B5);
break;
case 2:
m_fmt = D3DFMT_A4R4G4B4;
m_strFmtDesc.LoadString(IDS_FMTDESC_A4R4G4B4);
break;
case 3:
m_fmt = D3DFMT_R8G8B8;
m_strFmtDesc.LoadString(IDS_FMTDESC_R8G8B8);
break;
case 4:
m_fmt = D3DFMT_R5G6B5;
m_strFmtDesc.LoadString(IDS_FMTDESC_R5G6B5);
break;
case 5:
m_fmt = D3DFMT_X8R8G8B8;
m_strFmtDesc.LoadString(IDS_FMTDESC_X8R8G8B8);
break;
case 6:
m_fmt = D3DFMT_X1R5G5B5;
m_strFmtDesc.LoadString(IDS_FMTDESC_X1R5G5B5);
break;
case 7:
m_fmt = D3DFMT_R3G3B2;
m_strFmtDesc.LoadString(IDS_FMTDESC_R3G3B2);
break;
case 8:
m_fmt = D3DFMT_A8R3G3B2;
m_strFmtDesc.LoadString(IDS_FMTDESC_A8R3G3B2);
break;
case 9:
m_fmt = D3DFMT_X4R4G4B4;
m_strFmtDesc.LoadString(IDS_FMTDESC_X4R4G4B4);
break;
case 10:
m_fmt = D3DFMT_DXT1;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT1);
break;
case 11:
m_fmt = D3DFMT_DXT2;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT2);
break;
case 12:
m_fmt = D3DFMT_DXT3;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT3);
break;
case 13:
m_fmt = D3DFMT_DXT4;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT4);
break;
case 14:
m_fmt = D3DFMT_DXT5;
m_strFmtDesc.LoadString(IDS_FMTDESC_DXT5);
break;
}
UpdateData(FALSE);
}

View File

@@ -0,0 +1,162 @@
// Dialogs.h : header file
//
#if !defined(AFX_DIALOGS_H__14A2C924_FB41_4BB7_92E4_DBA7CAF1FA06__INCLUDED_)
#define AFX_DIALOGS_H__14A2C924_FB41_4BB7_92E4_DBA7CAF1FA06__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CNewTextureDlg dialog
class CNewTextureDlg : public CDialog
{
// Construction
public:
CNewTextureDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CNewTextureDlg)
enum { IDD = IDD_NEWTEXTURE };
int m_iTexType;
int m_dwWidth;
int m_dwHeight;
int m_dwDepth;
int m_iFmt;
CString m_strFmtDesc;
int m_numMips;
D3DFORMAT m_fmt;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewTextureDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CNewTextureDlg)
virtual BOOL OnInitDialog();
afx_msg void OnChangeTextureType();
afx_msg void OnChangeFormat();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CCubeMapDlg dialog
class CCubeMapDlg : public CDialog
{
// Construction
public:
CCubeMapDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CCubeMapDlg)
enum { IDD = IDD_CUBEMAP };
INT m_iFace;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCubeMapDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CCubeMapDlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CVolumeMapDlg dialog
class CVolumeMapDlg : public CDialog
{
// Construction
public:
CVolumeMapDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CVolumeMapDlg)
enum { IDD = IDD_VOLUMEMAP };
int m_powLayers;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CVolumeMapDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CVolumeMapDlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CChangeFmtDlg dialog
class CChangeFmtDlg : public CDialog
{
// Construction
public:
CChangeFmtDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CChangeFmtDlg)
enum { IDD = IDD_CHANGEFORMAT };
int m_iFmt;
CString m_strFmtDesc;
//}}AFX_DATA
BOOL m_bVolume;
D3DFORMAT m_fmt;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChangeFmtDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CChangeFmtDlg)
virtual BOOL OnInitDialog();
afx_msg void OnChangeFmt();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void UpdateFmtDesc();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DIALOGS_H__14A2C924_FB41_4BB7_92E4_DBA7CAF1FA06__INCLUDED_)

View File

@@ -0,0 +1,373 @@
// dxtex.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "dxtex.h"
#include "MainFrm.h"
#include "ChildFrm.h"
#include "dxtexDoc.h"
#include "dxtexView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDxtexDocManager::DoPromptFileName - overridden to allow importing of
// BMPs as well as DDSs into CDxtexDocs.
BOOL CDxtexDocManager::DoPromptFileName(CString& fileName, UINT nIDSTitle,
DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate)
{
CFileDialog dlgFile(bOpenFileDialog);
CString title;
VERIFY(title.LoadString(nIDSTitle));
dlgFile.m_ofn.Flags |= lFlags;
CString strFilter;
CString strDefault;
if (bOpenFileDialog)
{
strFilter += "Image Files (*.dds, *.bmp, *.tga, *.jpg, *.png, *.dib)";
strFilter += (TCHAR)'\0'; // next string please
strFilter += _T("*.dds;*.bmp;*.tga;*.jpg;*.png;*.dib");
strFilter += (TCHAR)'\0'; // last string
dlgFile.m_ofn.nMaxCustFilter++;
}
else
{
strFilter += "Image Files (*.dds)";
strFilter += (TCHAR)'\0'; // next string please
strFilter += _T("*.dds");
strFilter += (TCHAR)'\0'; // last string
dlgFile.m_ofn.nMaxCustFilter++;
}
// append the "*.*" all files filter
CString allFilter;
VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));
strFilter += allFilter;
strFilter += (TCHAR)'\0'; // next string please
strFilter += _T("*.*");
strFilter += (TCHAR)'\0'; // last string
dlgFile.m_ofn.nMaxCustFilter++;
dlgFile.m_ofn.lpstrFilter = strFilter;
dlgFile.m_ofn.lpstrTitle = title;
dlgFile.m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH);
INT_PTR nResult = dlgFile.DoModal();
fileName.ReleaseBuffer();
return nResult == IDOK;
};
/////////////////////////////////////////////////////////////////////////////
// CDxTxCommandLineInfo
CDxtexCommandLineInfo::CDxtexCommandLineInfo(VOID)
{
m_fmt = D3DFMT_UNKNOWN;
m_bAlphaComing = FALSE;
m_bMipMap = FALSE;
}
void CDxtexCommandLineInfo::ParseParam(const TCHAR* pszParam,BOOL bFlag,BOOL bLast)
{
if (lstrcmpiA(pszParam, "DXT1") == 0)
{
m_fmt = D3DFMT_DXT1;
}
else if (lstrcmpiA(pszParam, "DXT2") == 0)
{
m_fmt = D3DFMT_DXT2;
}
else if (lstrcmpiA(pszParam, "DXT3") == 0)
{
m_fmt = D3DFMT_DXT3;
}
else if (lstrcmpiA(pszParam, "DXT4") == 0)
{
m_fmt = D3DFMT_DXT4;
}
else if (lstrcmpiA(pszParam, "DXT5") == 0)
{
m_fmt = D3DFMT_DXT5;
}
else if (bFlag && tolower(pszParam[0]) == 'a')
{
m_bAlphaComing = TRUE;
}
else if (!bFlag && m_bAlphaComing)
{
m_strFileNameAlpha = pszParam;
m_bAlphaComing = FALSE;
}
else if (bFlag && tolower(pszParam[0]) == 'm')
{
m_bMipMap = TRUE;
}
else if (!bFlag && !m_strFileName.IsEmpty())
{
m_strFileNameSave = pszParam;
}
CCommandLineInfo::ParseParam(pszParam, bFlag, bLast);
}
/////////////////////////////////////////////////////////////////////////////
// CDxtexApp
BEGIN_MESSAGE_MAP(CDxtexApp, CWinApp)
//{{AFX_MSG_MAP(CDxtexApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDxtexApp construction
CDxtexApp::CDxtexApp()
{
// Place all significant initialization in InitInstance
m_pd3d = NULL;
}
/////////////////////////////////////////////////////////////////////////////
// CDxtexApp destruction
CDxtexApp::~CDxtexApp()
{
ReleasePpo(&m_pd3ddev);
ReleasePpo(&m_pd3d);
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDxtexApp object
CDxtexApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CDxtexApp initialization
BOOL CDxtexApp::InitInstance()
{
// Change the registry key under which our settings are stored.
SetRegistryKey(_T("Microsoft"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
m_pDocManager = new CDxtexDocManager;
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_DXTXTYPE,
RUNTIME_CLASS(CDxtexDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CDxtexView));
AddDocTemplate(pDocTemplate);
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
// Initialize DirectDraw
m_pd3d = Direct3DCreate8(D3D_SDK_VERSION);
if (m_pd3d == NULL)
{
AfxMessageBox(ID_ERROR_D3DCREATEFAILED, MB_OK, 0);
return FALSE;
}
HRESULT hr;
D3DDISPLAYMODE dispMode;
D3DPRESENT_PARAMETERS presentParams;
D3DDEVTYPE devType;
m_pd3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &dispMode);
ZeroMemory(&presentParams, sizeof(presentParams));
presentParams.Windowed = TRUE;
presentParams.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
presentParams.BackBufferWidth = 8;
presentParams.BackBufferHeight = 8;
presentParams.BackBufferFormat = dispMode.Format;
devType = D3DDEVTYPE_REF;
hr = m_pd3d->CreateDevice(D3DADAPTER_DEFAULT, devType, m_pMainWnd->GetSafeHwnd(),
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParams, &m_pd3ddev);
if (FAILED(hr))
{
AfxMessageBox(ID_ERROR_CANTCREATEDEVICE);
return FALSE;
}
D3DCAPS8 Caps;
m_pd3ddev->GetDeviceCaps(&Caps);
if (Caps.PrimitiveMiscCaps & D3DPMISCCAPS_NULLREFERENCE)
{
AfxMessageBox(ID_ERROR_NULLREF);
}
// Parse command line for standard shell commands, DDE, file open
CDxtexCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Prevent automatic "New" at startup:
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// See if we loaded a document
POSITION posTemp = GetFirstDocTemplatePosition();
CDxtexDoc* pdoc = NULL;
POSITION pos = pDocTemplate->GetFirstDocPosition();
if (pos != NULL)
pdoc = (CDxtexDoc*)pDocTemplate->GetNextDoc(pos);
if (!cmdInfo.m_strFileNameAlpha.IsEmpty())
{
if (pdoc != NULL)
{
pdoc->LoadAlphaBmp(cmdInfo.m_strFileNameAlpha);
}
}
if (cmdInfo.m_bMipMap)
{
if (pdoc != NULL)
{
pdoc->GenerateMipMaps();
}
}
if (cmdInfo.m_fmt != 0)
{
if (pdoc != NULL)
{
pdoc->Compress(cmdInfo.m_fmt, TRUE);
}
}
if (!cmdInfo.m_strFileNameSave.IsEmpty())
{
if (pdoc != NULL)
{
pdoc->OnSaveDocument(cmdInfo.m_strFileNameSave);
}
return FALSE; // Prevent UI from coming up
}
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CString m_strVersion;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
TCHAR szFile[MAX_PATH];
CString strVersion;
UINT cb;
DWORD dwHandle;
BYTE FileVersionBuffer[1024];
VS_FIXEDFILEINFO* pVersion = NULL;
GetModuleFileName(NULL, szFile, MAX_PATH);
cb = GetFileVersionInfoSize(szFile, &dwHandle/*ignored*/);
if (cb > 0)
{
if (cb > sizeof(FileVersionBuffer))
cb = sizeof(FileVersionBuffer);
if (GetFileVersionInfo(szFile, 0, cb, &FileVersionBuffer))
{
pVersion = NULL;
if (VerQueryValue(&FileVersionBuffer, "\\", (VOID**)&pVersion, &cb)
&& pVersion != NULL)
{
strVersion.Format("Version %d.%02d.%02d.%04d",
HIWORD(pVersion->dwFileVersionMS),
LOWORD(pVersion->dwFileVersionMS),
HIWORD(pVersion->dwFileVersionLS),
LOWORD(pVersion->dwFileVersionLS));
}
}
}
//{{AFX_DATA_INIT(CAboutDlg)
m_strVersion = strVersion;
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Text(pDX, IDC_VERSION, m_strVersion);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CDxtexApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}

View File

@@ -0,0 +1,187 @@
# Microsoft Developer Studio Project File - Name="dxtex" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=dxtex - 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 "dxtex.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 "dxtex.mak" CFG="dxtex - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "dxtex - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "dxtex - 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)" == "dxtex - 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 1
# 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 /MT /W3 /GX /O2 /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 ddraw.lib d3d8.lib d3dx8.lib dxguid.lib version.lib /nologo /subsystem:windows /machine:I386 /stack:0x200000,0x200000
!ELSEIF "$(CFG)" == "dxtex - 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 1
# 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 /MTd /W3 /Gm /GX /Zi /Od /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 d3d8.lib d3dx8dt.lib dxguid.lib version.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /stack:0x200000,0x200000
!ENDIF
# Begin Target
# Name "dxtex - Win32 Release"
# Name "dxtex - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ChildFrm.cpp
# End Source File
# Begin Source File
SOURCE=.\dialogs.cpp
# End Source File
# Begin Source File
SOURCE=.\Dxtex.cpp
# End Source File
# Begin Source File
SOURCE=.\Dxtex.rc
# End Source File
# Begin Source File
SOURCE=.\DxtexDoc.cpp
# End Source File
# Begin Source File
SOURCE=.\DxtexView.cpp
# End Source File
# Begin Source File
SOURCE=.\MainFrm.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\ChildFrm.h
# End Source File
# Begin Source File
SOURCE=.\dds.h
# End Source File
# Begin Source File
SOURCE=.\dialogs.h
# End Source File
# Begin Source File
SOURCE=.\Dxtex.h
# End Source File
# Begin Source File
SOURCE=.\DxtexDoc.h
# End Source File
# Begin Source File
SOURCE=.\DxtexView.h
# End Source File
# Begin Source File
SOURCE=.\MainFrm.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\Dxtex.ico
# End Source File
# Begin Source File
SOURCE=.\DxtexDoc.ico
# End Source File
# Begin Source File
SOURCE=.\Toolbar.bmp
# End Source File
# End Group
# Begin Source File
SOURCE=.\readme.txt
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "dxtex"=.\dxtex.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,95 @@
// dxtex.h : main header file for the DXTEX application
//
#if !defined(AFX_DXTX_H__712C53C7_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
#define AFX_DXTX_H__712C53C7_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#ifndef ReleasePpo
#define ReleasePpo(ppo) \
if (*(ppo) != NULL) \
{ \
(*(ppo))->Release(); \
*(ppo) = NULL; \
} \
else (VOID)0
#endif
/////////////////////////////////////////////////////////////////////////////
// CDxtexDocManager:
// I override this class to customize DoPromptFileName to allow importing of
// BMPs as well as DDSs into CDxtexDocs.
//
class CDxtexDocManager : public CDocManager
{
public:
virtual BOOL DoPromptFileName(CString& fileName, UINT nIDSTitle,
DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate);
};
/////////////////////////////////////////////////////////////////////////////
// CDxtexCommandLineInfo:
// I override this class to handle custom command-line options
//
class CDxtexCommandLineInfo : public CCommandLineInfo
{
public:
CString m_strFileNameAlpha;
CString m_strFileNameSave;
D3DFORMAT m_fmt;
BOOL m_bAlphaComing;
BOOL m_bMipMap;
CDxtexCommandLineInfo::CDxtexCommandLineInfo(VOID);
virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);
};
/////////////////////////////////////////////////////////////////////////////
// CDxtexApp:
// See dxtex.cpp for the implementation of this class
//
class CDxtexApp : public CWinApp
{
public:
CDxtexApp();
virtual ~CDxtexApp();
LPDIRECT3D8 Pd3d(VOID) { return m_pd3d; }
LPDIRECT3DDEVICE8 Pd3ddev(VOID) { return m_pd3ddev; }
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDxtexApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CDxtexApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
LPDIRECT3D8 m_pd3d;
LPDIRECT3DDEVICE8 m_pd3ddev;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DXTX_H__712C53C7_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,352 @@
# Microsoft Developer Studio Generated NMAKE File, Based on dxtex.dsp
!IF "$(CFG)" == ""
CFG=dxtex - Win32 Debug
!MESSAGE No configuration specified. Defaulting to dxtex - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "dxtex - Win32 Release" && "$(CFG)" != "dxtex - 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 "dxtex.mak" CFG="dxtex - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "dxtex - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "dxtex - 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)" == "dxtex - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\dxtex.exe"
CLEAN :
-@erase "$(INTDIR)\ChildFrm.obj"
-@erase "$(INTDIR)\dialogs.obj"
-@erase "$(INTDIR)\Dxtex.obj"
-@erase "$(INTDIR)\Dxtex.res"
-@erase "$(INTDIR)\DxtexDoc.obj"
-@erase "$(INTDIR)\DxtexView.obj"
-@erase "$(INTDIR)\MainFrm.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\dxtex.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\dxtex.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)\Dxtex.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dxtex.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=ddraw.lib d3d8.lib d3dx8.lib dxguid.lib version.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\dxtex.pdb" /machine:I386 /out:"$(OUTDIR)\dxtex.exe" /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\ChildFrm.obj" \
"$(INTDIR)\dialogs.obj" \
"$(INTDIR)\Dxtex.obj" \
"$(INTDIR)\DxtexDoc.obj" \
"$(INTDIR)\DxtexView.obj" \
"$(INTDIR)\MainFrm.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\Dxtex.res"
"$(OUTDIR)\dxtex.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "dxtex - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\dxtex.exe" "$(OUTDIR)\dxtex.bsc"
CLEAN :
-@erase "$(INTDIR)\ChildFrm.obj"
-@erase "$(INTDIR)\ChildFrm.sbr"
-@erase "$(INTDIR)\dialogs.obj"
-@erase "$(INTDIR)\dialogs.sbr"
-@erase "$(INTDIR)\Dxtex.obj"
-@erase "$(INTDIR)\Dxtex.res"
-@erase "$(INTDIR)\Dxtex.sbr"
-@erase "$(INTDIR)\DxtexDoc.obj"
-@erase "$(INTDIR)\DxtexDoc.sbr"
-@erase "$(INTDIR)\DxtexView.obj"
-@erase "$(INTDIR)\DxtexView.sbr"
-@erase "$(INTDIR)\MainFrm.obj"
-@erase "$(INTDIR)\MainFrm.sbr"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\StdAfx.sbr"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\dxtex.bsc"
-@erase "$(OUTDIR)\dxtex.exe"
-@erase "$(OUTDIR)\dxtex.ilk"
-@erase "$(OUTDIR)\dxtex.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\dxtex.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)\Dxtex.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dxtex.bsc"
BSC32_SBRS= \
"$(INTDIR)\ChildFrm.sbr" \
"$(INTDIR)\dialogs.sbr" \
"$(INTDIR)\Dxtex.sbr" \
"$(INTDIR)\DxtexDoc.sbr" \
"$(INTDIR)\DxtexView.sbr" \
"$(INTDIR)\MainFrm.sbr" \
"$(INTDIR)\StdAfx.sbr"
"$(OUTDIR)\dxtex.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
$(BSC32_FLAGS) $(BSC32_SBRS)
<<
LINK32=link.exe
LINK32_FLAGS=d3d8.lib d3dx8dt.lib dxguid.lib version.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\dxtex.pdb" /debug /machine:I386 /out:"$(OUTDIR)\dxtex.exe" /pdbtype:sept /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\ChildFrm.obj" \
"$(INTDIR)\dialogs.obj" \
"$(INTDIR)\Dxtex.obj" \
"$(INTDIR)\DxtexDoc.obj" \
"$(INTDIR)\DxtexView.obj" \
"$(INTDIR)\MainFrm.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\Dxtex.res"
"$(OUTDIR)\dxtex.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("dxtex.dep")
!INCLUDE "dxtex.dep"
!ELSE
!MESSAGE Warning: cannot find "dxtex.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "dxtex - Win32 Release" || "$(CFG)" == "dxtex - Win32 Debug"
SOURCE=.\ChildFrm.cpp
!IF "$(CFG)" == "dxtex - Win32 Release"
"$(INTDIR)\ChildFrm.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "dxtex - Win32 Debug"
"$(INTDIR)\ChildFrm.obj" "$(INTDIR)\ChildFrm.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\dialogs.cpp
!IF "$(CFG)" == "dxtex - Win32 Release"
"$(INTDIR)\dialogs.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "dxtex - Win32 Debug"
"$(INTDIR)\dialogs.obj" "$(INTDIR)\dialogs.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\Dxtex.cpp
!IF "$(CFG)" == "dxtex - Win32 Release"
"$(INTDIR)\Dxtex.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "dxtex - Win32 Debug"
"$(INTDIR)\Dxtex.obj" "$(INTDIR)\Dxtex.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\Dxtex.rc
"$(INTDIR)\Dxtex.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
SOURCE=.\DxtexDoc.cpp
!IF "$(CFG)" == "dxtex - Win32 Release"
"$(INTDIR)\DxtexDoc.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "dxtex - Win32 Debug"
"$(INTDIR)\DxtexDoc.obj" "$(INTDIR)\DxtexDoc.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\DxtexView.cpp
!IF "$(CFG)" == "dxtex - Win32 Release"
"$(INTDIR)\DxtexView.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "dxtex - Win32 Debug"
"$(INTDIR)\DxtexView.obj" "$(INTDIR)\DxtexView.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\MainFrm.cpp
!IF "$(CFG)" == "dxtex - Win32 Release"
"$(INTDIR)\MainFrm.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "dxtex - Win32 Debug"
"$(INTDIR)\MainFrm.obj" "$(INTDIR)\MainFrm.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\StdAfx.cpp
!IF "$(CFG)" == "dxtex - Win32 Release"
"$(INTDIR)\StdAfx.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "dxtex - Win32 Debug"
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\StdAfx.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
!ENDIF

View File

@@ -0,0 +1,667 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.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
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "dxtex.ico"
IDR_DXTXTYPE ICON DISCARDABLE "dxtexDoc.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_MAINFRAME BITMAP MOVEABLE PURE "Toolbar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
BEGIN
BUTTON ID_FILE_NEW
BUTTON ID_FILE_OPEN
BUTTON ID_FILE_SAVE
SEPARATOR
BUTTON ID_APP_ABOUT
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New Texture...\tCtrl+N", ID_FILE_NEW
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
MENUITEM SEPARATOR
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
END
POPUP "&Help"
BEGIN
MENUITEM "&About DxTex...", ID_APP_ABOUT
END
END
IDR_DXTXTYPE MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New Texture...", ID_FILE_NEW
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
MENUITEM "O&pen Onto Alpha Channel Of This Texture...",
ID_FILE_OPENALPHA
MENUITEM SEPARATOR
MENUITEM "Open Onto &This Surface...", ID_FILE_OPENSUBSURFACE
MENUITEM "Open Onto Alpha Channel Of T&his Surface...",
ID_FILE_OPENALPHASUBSURFACE
MENUITEM SEPARATOR
MENUITEM "Open Onto Th&is Cubemap Face...", ID_FILE_OPENFACE
MENUITEM "Open Onto Alpha Channel Of This C&ubemap Face...",
ID_FILE_OPENALPHAFACE
MENUITEM SEPARATOR
MENUITEM "&Close", ID_FILE_CLOSE
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
MENUITEM "Save &As...", ID_FILE_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
MENUITEM SEPARATOR
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
END
POPUP "&View"
BEGIN
MENUITEM "&Original Format\t1", ID_VIEW_ORIGINAL
MENUITEM "&New Format\t2", ID_VIEW_COMPRESSED
MENUITEM SEPARATOR
POPUP "&Cube Map Face"
BEGIN
MENUITEM "Positive X\tX", ID_VIEW_POSX
MENUITEM "Negative X\tx", ID_VIEW_NEGX
MENUITEM "Positive Y\tY", ID_VIEW_POSY
MENUITEM "Negative Y\ty", ID_VIEW_NEGY
MENUITEM "Positive Z\tZ", ID_VIEW_POSZ
MENUITEM "Negative Z\tz", ID_VIEW_NEGZ
END
MENUITEM "&Alpha Channel Only", ID_VIEW_ALPHACHANNEL
MENUITEM "Change &Background Color...", ID_VIEW_CHANGEBACKGROUNDCOLOR
MENUITEM SEPARATOR
MENUITEM "&Higher Volume Slice\t>", ID_VIEW_HIGHERVOLUMESLICE
MENUITEM "Lo&wer Volume Slice\t<", ID_VIEW_LOWERVOLUMESLICE
MENUITEM SEPARATOR
MENUITEM "S&maller Mip Level\tPgDn", ID_VIEW_SMALLERMIPLEVEL
MENUITEM "&Larger Mip Level\tPgUp", ID_VIEW_LARGERMIPLEVEL
MENUITEM SEPARATOR
MENUITEM "Zoom I&n\t+", ID_VIEW_ZOOMIN
MENUITEM "Zoom O&ut\t-", ID_VIEW_ZOOMOUT
MENUITEM SEPARATOR
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
END
POPUP "F&ormat"
BEGIN
MENUITEM "&Generate Mip Maps", ID_FORMAT_GENERATEMIPMAPS
MENUITEM "&Change Surface Format...", ID_FORMAT_CHANGESURFACEFMT
MENUITEM "&Make Into Cube Map...", ID_FORMAT_CHANGECUBEMAPFACES
MENUITEM "M&ake Into Volume Map...", ID_FORMAT_MAKEINTOVOLUMEMAP
END
POPUP "&Window"
BEGIN
MENUITEM "&New Window", ID_WINDOW_NEW
MENUITEM "&Cascade", ID_WINDOW_CASCADE
MENUITEM "&Tile", ID_WINDOW_TILE_HORZ
MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE
END
POPUP "&Help"
BEGIN
MENUITEM "&About DxTex...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"+", ID_VIEW_ZOOMIN, ASCII, NOINVERT
"-", ID_VIEW_ZOOMOUT, ASCII, NOINVERT
"1", ID_VIEW_ORIGINAL, VIRTKEY, NOINVERT
"2", ID_VIEW_COMPRESSED, VIRTKEY, NOINVERT
"<", ID_VIEW_LOWERVOLUMESLICE, ASCII, NOINVERT
">", ID_VIEW_HIGHERVOLUMESLICE, ASCII, NOINVERT
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
VK_ADD, ID_VIEW_ZOOMIN, VIRTKEY, NOINVERT
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
VK_NEXT, ID_VIEW_SMALLERMIPLEVEL, VIRTKEY, NOINVERT
VK_PRIOR, ID_VIEW_LARGERMIPLEVEL, VIRTKEY, NOINVERT
VK_SUBTRACT, ID_VIEW_ZOOMOUT, VIRTKEY, NOINVERT
"X", ID_VIEW_NEGX, VIRTKEY, NOINVERT
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
"X", ID_VIEW_POSX, VIRTKEY, SHIFT, NOINVERT
"Y", ID_VIEW_NEGY, VIRTKEY, NOINVERT
"Y", ID_VIEW_POSY, VIRTKEY, SHIFT, NOINVERT
"Z", ID_VIEW_NEGZ, VIRTKEY, NOINVERT
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
"Z", ID_VIEW_POSZ, VIRTKEY, SHIFT, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 286, 82
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About DirectX Texture Tool"
FONT 8, "MS Shell Dlg"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "DirectX Texture Tool",IDC_STATIC,40,10,239,8,
SS_NOPREFIX
LTEXT "Copyright <20> 1999-2000 Microsoft Corporation. All rights reserved.",
IDC_STATIC,40,35,239,8
DEFPUSHBUTTON "OK",IDOK,121,61,43,14,WS_GROUP
LTEXT "",IDC_VERSION,40,22,239,8
LTEXT "See dxtex.txt for help with using this program.",
IDC_STATIC,40,48,142,8
END
IDD_CUBEMAP DIALOG DISCARDABLE 0, 0, 186, 133
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Create Cube Map"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK",IDOK,35,112,50,14
PUSHBUTTON "Cancel",IDCANCEL,101,112,50,14
LTEXT "Select which face you would like the current image moved to:",
IDC_STATIC,7,7,172,20
CONTROL "Positive X",IDC_POSX,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,7,30,172,10
CONTROL "Negative X",IDC_NEGX,"Button",BS_AUTORADIOBUTTON,7,41,
172,10
CONTROL "Positive Y",IDC_POSY,"Button",BS_AUTORADIOBUTTON,7,52,
172,10
CONTROL "Negative Y",IDC_NEGY,"Button",BS_AUTORADIOBUTTON,7,63,
172,10
CONTROL "Positive Z",IDC_POSZ,"Button",BS_AUTORADIOBUTTON,7,74,
172,10
CONTROL "Negative Z",IDC_NEGZ,"Button",BS_AUTORADIOBUTTON,7,85,
172,10
END
IDD_VOLUMEMAP DIALOG DISCARDABLE 0, 0, 158, 122
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Create Volume Map"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "How many slices (layers) do you want to have in the volume map?",
IDC_STATIC,7,7,144,20
DEFPUSHBUTTON "OK",IDOK,21,101,50,14
PUSHBUTTON "Cancel",IDCANCEL,87,101,50,14
CONTROL "2",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON | WS_GROUP,31,
32,20,10
CONTROL "4",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,31,44,20,10
CONTROL "8",IDC_RADIO8,"Button",BS_AUTORADIOBUTTON,31,56,20,10
CONTROL "16",IDC_RADIO16,"Button",BS_AUTORADIOBUTTON,31,68,24,10
CONTROL "32",IDC_RADIO32,"Button",BS_AUTORADIOBUTTON,31,80,24,10
CONTROL "64",IDC_RADIO64,"Button",BS_AUTORADIOBUTTON,85,32,24,10
CONTROL "128",IDC_RADIO128,"Button",BS_AUTORADIOBUTTON,85,44,28,
10
CONTROL "256",IDC_RADIO256,"Button",BS_AUTORADIOBUTTON,85,56,28,
10
CONTROL "512",IDC_RADIO512,"Button",BS_AUTORADIOBUTTON,85,68,28,
10
CONTROL "1024",IDC_RADIO1024,"Button",BS_AUTORADIOBUTTON,85,80,
32,10
END
IDD_CHANGEFORMAT DIALOG DISCARDABLE 0, 0, 200, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Change Surface Format"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Select the surface format for this texture:",IDC_STATIC,
7,7,186,15
CONTROL "A8 R8 G8 B8",IDC_A8R8G8B8,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,7,30,58,10
CONTROL "A1 R5 G5 B5",IDC_A1R5G5B5,"Button",BS_AUTORADIOBUTTON,7,
41,58,10
CONTROL "A4 R4 G4 B4",IDC_A4R4G4B4,"Button",BS_AUTORADIOBUTTON,7,
52,58,10
CONTROL "R8 G8 B8",IDC_R8G8B8,"Button",BS_AUTORADIOBUTTON,7,63,
58,10
CONTROL "R5 G6 B5",IDC_R5G6B5,"Button",BS_AUTORADIOBUTTON,7,74,
58,10
CONTROL "X8 R8 G8 B8",IDC_X8R8G8B8,"Button",BS_AUTORADIOBUTTON,
64,30,58,10
CONTROL "X1 R5 G5 B5",IDC_X1R5G5B5,"Button",BS_AUTORADIOBUTTON,
64,41,58,10
CONTROL "R3 G3 B2",IDC_R3G3B2,"Button",BS_AUTORADIOBUTTON,64,52,
58,10
CONTROL "A8 R3 G3 B2",IDC_A8R3G3B2,"Button",BS_AUTORADIOBUTTON,
64,63,58,10
CONTROL "X4 R4 G4 B4",IDC_X4R4G4B4,"Button",BS_AUTORADIOBUTTON,
64,74,58,10
CONTROL "DXT1",IDC_DXT1,"Button",BS_AUTORADIOBUTTON,132,30,58,10
CONTROL "DXT2",IDC_DXT2,"Button",BS_AUTORADIOBUTTON,132,41,58,10
CONTROL "DXT3",IDC_DXT3,"Button",BS_AUTORADIOBUTTON,132,52,58,10
CONTROL "DXT4",IDC_DXT4,"Button",BS_AUTORADIOBUTTON,132,63,58,10
CONTROL "DXT5",IDC_DXT5,"Button",BS_AUTORADIOBUTTON,132,74,58,10
LTEXT "",IDC_FMTDESC,7,98,186,22
DEFPUSHBUTTON "OK",IDOK,42,133,50,14
PUSHBUTTON "Cancel",IDCANCEL,108,133,50,14
END
IDD_NEWTEXTURE DIALOG DISCARDABLE 0, 0, 231, 287
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New Texture"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK",IDOK,57,266,50,14
PUSHBUTTON "Cancel",IDCANCEL,123,266,50,14
GROUPBOX "Texture Type",IDC_STATIC,7,7,217,58
CONTROL "Standard Texture",IDC_TEXTURE,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,18,20,193,10
CONTROL "Cubemap Texture",IDC_CUBEMAP,"Button",
BS_AUTORADIOBUTTON,18,33,193,10
CONTROL "Volume Texture",IDC_VOLUMETEXTURE,"Button",
BS_AUTORADIOBUTTON,18,46,193,10
GROUPBOX "Dimensions",IDC_STATIC,7,70,217,62
LTEXT "Width:",IDC_STATIC,18,86,22,8
EDITTEXT IDC_WIDTH,53,83,40,14,ES_AUTOHSCROLL
LTEXT "Height:",IDC_STATIC,18,106,24,8
EDITTEXT IDC_HEIGHT,53,104,40,14,ES_AUTOHSCROLL
LTEXT "Volume Depth:",IDC_VOLUMEDEPTHLABEL,106,86,48,8
EDITTEXT IDC_DEPTH,164,83,40,14,ES_AUTOHSCROLL
LTEXT "MipMap Levels:",IDC_STATIC,106,106,51,8
EDITTEXT IDC_MIPCOUNT,164,104,40,14,ES_AUTOHSCROLL
GROUPBOX "Surface/Volume Format",IDC_STATIC,7,139,217,112
CONTROL "A8 R8 G8 B8",IDC_A8R8G8B8,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,18,159,58,10
CONTROL "A1 R5 G5 B5",IDC_A1R5G5B5,"Button",BS_AUTORADIOBUTTON,
18,170,58,10
CONTROL "A4 R4 G4 B4",IDC_A4R4G4B4,"Button",BS_AUTORADIOBUTTON,
18,181,58,10
CONTROL "R8 G8 B8",IDC_R8G8B8,"Button",BS_AUTORADIOBUTTON,18,192,
58,10
CONTROL "R5 G6 B5",IDC_R5G6B5,"Button",BS_AUTORADIOBUTTON,18,203,
58,10
CONTROL "X8 R8 G8 B8",IDC_X8R8G8B8,"Button",BS_AUTORADIOBUTTON,
87,159,58,10
CONTROL "X1 R5 G5 B5",IDC_X1R5G5B5,"Button",BS_AUTORADIOBUTTON,
87,170,58,10
CONTROL "R3 G3 B2",IDC_R3G3B2,"Button",BS_AUTORADIOBUTTON,87,181,
58,10
CONTROL "A8 R3 G3 B2",IDC_A8R3G3B2,"Button",BS_AUTORADIOBUTTON,
87,192,58,10
CONTROL "X4 R4 G4 B4",IDC_X4R4G4B4,"Button",BS_AUTORADIOBUTTON,
87,203,58,10
CONTROL "DXT1",IDC_DXT1,"Button",BS_AUTORADIOBUTTON,158,159,58,
10
CONTROL "DXT2",IDC_DXT2,"Button",BS_AUTORADIOBUTTON,158,170,58,
10
CONTROL "DXT3",IDC_DXT3,"Button",BS_AUTORADIOBUTTON,158,181,58,
10
CONTROL "DXT4",IDC_DXT4,"Button",BS_AUTORADIOBUTTON,158,192,58,
10
CONTROL "DXT5",IDC_DXT5,"Button",BS_AUTORADIOBUTTON,158,203,58,
10
LTEXT "",IDC_FMTDESC,16,216,202,27
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 279
TOPMARGIN, 7
BOTTOMMARGIN, 75
END
IDD_CUBEMAP, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 126
END
IDD_VOLUMEMAP, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 151
TOPMARGIN, 7
BOTTOMMARGIN, 115
END
IDD_CHANGEFORMAT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 193
TOPMARGIN, 7
BOTTOMMARGIN, 147
END
IDD_NEWTEXTURE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 224
TOPMARGIN, 7
BOTTOMMARGIN, 280
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "DirectX Texture Tool"
IDR_DXTXTYPE "\nTexture\nDDS\nDDS Files (*.dds)\n.dds\nDDS.Document\nDDS Document"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "DirectX Texture Tool"
AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INDICATOR_EXT "EXT"
ID_INDICATOR_CAPS "CAP"
ID_INDICATOR_NUM "NUM"
ID_INDICATOR_SCRL "SCRL"
ID_INDICATOR_OVR "OVR"
ID_INDICATOR_REC "REC"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_NEW "Create a new document\nNew"
ID_FILE_OPEN "Open an existing texture document\nOpen"
ID_FILE_CLOSE "Close the active document\nClose"
ID_FILE_SAVE "Save the active document\nSave"
ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_MRU_FILE1 "Open this document"
ID_FILE_MRU_FILE2 "Open this document"
ID_FILE_MRU_FILE3 "Open this document"
ID_FILE_MRU_FILE4 "Open this document"
ID_FILE_MRU_FILE5 "Open this document"
ID_FILE_MRU_FILE6 "Open this document"
ID_FILE_MRU_FILE7 "Open this document"
ID_FILE_MRU_FILE8 "Open this document"
ID_FILE_MRU_FILE9 "Open this document"
ID_FILE_MRU_FILE10 "Open this document"
ID_FILE_MRU_FILE11 "Open this document"
ID_FILE_MRU_FILE12 "Open this document"
ID_FILE_MRU_FILE13 "Open this document"
ID_FILE_MRU_FILE14 "Open this document"
ID_FILE_MRU_FILE15 "Open this document"
ID_FILE_MRU_FILE16 "Open this document"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_WINDOW_NEW "Open another window for the active document\nNew Window"
ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons"
ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows"
ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows"
ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows"
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_CLEAR "Erase the selection\nErase"
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
ID_EDIT_FIND "Find the specified text\nFind"
ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
ID_EDIT_REPEAT "Repeat the last action\nRepeat"
ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
ID_EDIT_UNDO "Undo the last action\nUndo"
ID_EDIT_REDO "Redo the previously undone action\nRedo"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCSIZE "Change the window size"
AFX_IDS_SCMOVE "Change the window position"
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCRESTORE "Restore the window to normal size"
AFX_IDS_SCTASKLIST "Activate Task List"
AFX_IDS_MDICHILD "Activate this window"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INDICATOR_IMAGEINFO " "
ID_ERROR_ODDDIMENSIONS "Texture maps must have even (multiple of 2) width and height."
ID_ERROR_NOTPOW2 "Source image width and height must be powers of 2."
ID_ERROR_WRONGDIMENSIONS
"This image does not have the same dimensions as the source image. Is it okay to resize it?"
ID_ERROR_GENERATEALPHAFAILED
"Generation of the alpha image unexpectedly failed."
ID_ERROR_PREMULTALPHA "This operation cannot be performed because the source image uses premultiplied alpha."
ID_ERROR_PREMULTTODXT1 "Warning: The source image contains premultiplied alpha, and the RGB values will be copied to the destination without ""unpremultiplying"" them, so the resulting colors may be affected."
ID_ERROR_CANTCREATEDEVICE
"Unable to create Direct3D Device. Please make sure your desktop color depth is 16 or 32 bit."
IDS_FMTDESC_A8R8G8B8 "(A8R8G8B8: 32 bits per pixel, 8 bits per component for alpha, red, green, and blue)"
IDS_FMTDESC_A1R5G5B5 "(A1R5G5B5: 16 bits per pixel, 1 bit of alpha, 5 bits per component for red, green, and blue)"
IDS_FMTDESC_A4R4G4B4 "(A4R4G4B4: 16 bits per pixel, 4 bits per component for alpha, red, green, and blue)"
IDS_FMTDESC_R8G8B8 "(R8G8B8: 24 bits per pixel, 8 bits per component for red, green, and blue)"
IDS_FMTDESC_R5G6B5 "(R5G6B5: 16 bits per pixel, 6 bits per component for green, 5 bits per component for red and blue)"
IDS_FMTDESC_DXT1 "(DXT1: compressed, 1-bit alpha)"
IDS_FMTDESC_DXT2 "(DXT2: compressed, 4-bit premultiplied alpha)"
IDS_FMTDESC_DXT3 "(DXT3: compressed, 4-bit nonpremultiplied alpha)"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FORMAT_GENERATEMIPMAPS "Generate Mip Maps"
ID_FORMAT_CHANGEIMAGEFORMAT "Convert to a different image format"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_OPENALPHA "Loads an alpha channel onto the current texture"
ID_FILE_OPENSUBSURFACE "Loads RGB data onto this surface of the texture"
ID_FILE_OPENALPHASUBSURFACE
"Loads Alpha data onto this surface of the texture"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_OPENFACE "Loads RGB data onto this face of the cubemap texture"
ID_FILE_OPENALPHAFACE "Loads Alpha data onto this face of the cubemap texture"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_FMTDESC_DXT4 "(DXT4: compressed, interpolated premultiplied alpha)"
IDS_FMTDESC_DXT5 "(DXT5: compressed, interpolated nonpremultiplied alpha)"
ID_ERROR_CANTCREATETEXTURE
"A texture could not be created with those settings."
ID_ERROR_D3DCREATEFAILED
"Could not initialize Direct3D. Please ensure that this program was compiled with header files matching the installed version of DirectX."
ID_ERROR_COULDNTLOADFILE "An error occurred trying to open that file."
ID_ERROR_COULDNTSAVEFILE "An error occurred trying to save that file."
IDS_FMTDESC_X8R8G8B8 "(X8R8G8B8: 32 bits per pixel, 8 bits per component for red, green, and blue)"
IDS_FMTDESC_X1R5G5B5 "(X1R5G5B5: 16 bits per pixel, 5 bits per component for red, green, and blue)"
IDS_FMTDESC_R3G3B2 "(R3G3B2: 8 bits per pixel, 3 bits of red and green, 2 bits for blue)"
IDS_FMTDESC_A8R3G3B2 "(A8R3G3B2: 16 bits per pixel, 8 bits of alpha, 3 bits of red and green, 2 bits for blue)"
IDS_FMTDESC_X4R4G4B4 "(X4R4G4B4: 16 bits per pixel, 4 bits per component for red, green, and blue)"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_ERROR_NULLREF "This program uses the reference rendering device. Your computer has a reduced-functionality reference device installed. You can still use this program to manipulate textures, but the textures will not be visible in this program. Install the DirectX SDK to install the full reference device."
ID_ERROR_NEEDALPHA "Alpha channel needed for this operation."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,104 @@
// dxtexDoc.h : interface of the CDxtexDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_DXTXDOC_H__712C53CF_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
#define AFX_DXtxDOC_H__712C53CF_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CDxtexDoc : public CDocument
{
protected: // create from serialization only
CDxtexDoc();
DECLARE_DYNCREATE(CDxtexDoc)
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDxtexDoc)
public:
virtual BOOL OnNewDocument();
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
virtual void SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU = TRUE);
//}}AFX_VIRTUAL
// Implementation
public:
HRESULT LoadAlphaBmp(CString& strPath);
VOID GenerateMipMaps(VOID);
HRESULT ChangeFormat(LPDIRECT3DBASETEXTURE8 ptexCur, D3DFORMAT fmt,
LPDIRECT3DBASETEXTURE8* pptexNew);
HRESULT Compress(D3DFORMAT fmt, BOOL bSwitchView);
DWORD NumMips(VOID);
LPDIRECT3DBASETEXTURE8 PtexOrig(VOID) { return m_ptexOrig; }
LPDIRECT3DBASETEXTURE8 PtexNew(VOID) { return m_ptexNew; }
DWORD DwWidth(VOID) { return m_dwWidth; }
DWORD DwHeight(VOID) { return m_dwHeight; }
DWORD DwDepth(VOID) { return m_dwDepth; }
DWORD DwDepthAt(LONG lwMip);
BOOL TitleModsChanged(VOID) { return m_bTitleModsChanged; }
VOID ClearTitleModsChanged(VOID) { m_bTitleModsChanged = FALSE; }
virtual ~CDxtexDoc();
void OpenSubsurface(D3DCUBEMAP_FACES FaceType, LONG lwMip, LONG lwSlice);
void OpenAlphaSubsurface(D3DCUBEMAP_FACES FaceType, LONG lwMip, LONG lwSlice);
void OpenCubeFace(D3DCUBEMAP_FACES FaceType);
void OpenAlphaCubeFace(D3DCUBEMAP_FACES FaceType);
BOOL IsCubeMap(VOID) { return (m_dwCubeMapFlags > 0); }
BOOL IsVolumeMap(VOID) { return (m_dwDepth > 0); }
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CDxtexDoc)
afx_msg void OnFileOpenAlpha();
afx_msg void OnGenerateMipMaps();
afx_msg void OnFormatDxt1();
afx_msg void OnFormatDxt2();
afx_msg void OnFormatDxt3();
afx_msg void OnFormatDxt4();
afx_msg void OnFormatDxt5();
afx_msg void OnFormatChangeCubeMapFaces();
afx_msg void OnUpdateFileOpenAlpha(CCmdUI* pCmdUI);
afx_msg void OnUpdateFormatGenerateMipmaps(CCmdUI* pCmdUI);
afx_msg void OnUpdateFormatChangeCubeMapFaces(CCmdUI* pCmdUI);
afx_msg void OnFormatMakeIntoVolumeMap();
afx_msg void OnUpdateFormatMakeIntoVolumeMap(CCmdUI* pCmdUI);
afx_msg void OnFormatChangeSurfaceFmt();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
LPDIRECT3DBASETEXTURE8 m_ptexOrig;
LPDIRECT3DBASETEXTURE8 m_ptexNew;
DWORD m_dwWidth;
DWORD m_dwHeight;
DWORD m_dwDepth; // For volume textures
DWORD m_numMips;
DWORD m_dwCubeMapFlags;
BOOL m_bTitleModsChanged;
CDxtexApp* PDxtexApp(VOID) { return (CDxtexApp*)AfxGetApp(); }
HRESULT LoadAlphaIntoSurface(CString& strPath, LPDIRECT3DSURFACE8 psurf);
HRESULT LoadVolumeSliceFromSurface(LPDIRECT3DVOLUME8 pVolume, UINT iSlice, LPDIRECT3DSURFACE8 pSurf);
HRESULT LoadSurfaceFromVolumeSlice(LPDIRECT3DVOLUME8 pVolume, UINT iSlice, LPDIRECT3DSURFACE8 psurf);
HRESULT BltAllLevels(D3DCUBEMAP_FACES FaceType, LPDIRECT3DBASETEXTURE8 ptexSrc,
LPDIRECT3DBASETEXTURE8 ptexDest);
BOOL PromptForBmp(CString* pstrPath);
D3DFORMAT GetFormat(LPDIRECT3DBASETEXTURE8 ptex);
HRESULT EnsureAlpha(LPDIRECT3DBASETEXTURE8* pptex);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DXTXDOC_H__712C53CF_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,127 @@
// dxtexView.h : interface of the CDxtexView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_DXTXVIEW_H__712C53D1_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
#define AFX_DXTXVIEW_H__712C53D1_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CDxtexView : public CScrollView
{
protected: // create from serialization only
CDxtexView();
DECLARE_DYNCREATE(CDxtexView)
CDxtexDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDxtexView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual void OnInitialUpdate();
protected:
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CDxtexView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
BOOL TitleModsChanged(VOID) { return m_bTitleModsChanged; }
VOID ClearTitleModsChanged(VOID) { m_bTitleModsChanged = FALSE; }
CString GetStrTitleMods(VOID);
VOID GetImageInfo(CString& strInfo);
// Generated message map functions
protected:
//{{AFX_MSG(CDxtexView)
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnFileOpenSubsurface();
afx_msg void OnFileOpenAlphaSubsurface();
afx_msg void OnFileOpenFace();
afx_msg void OnFileOpenAlphaFace();
afx_msg void OnViewOriginal();
afx_msg void OnViewCompressed();
afx_msg void OnViewAlphaChannel();
afx_msg void OnViewLargerMipLevel();
afx_msg void OnViewSmallerMipLevel();
afx_msg void OnViewZoomIn();
afx_msg void OnViewZoomOut();
afx_msg void OnViewChangeBackgroundColor();
afx_msg void OnViewNegX();
afx_msg void OnViewPosX();
afx_msg void OnViewNegY();
afx_msg void OnViewPosY();
afx_msg void OnViewNegZ();
afx_msg void OnViewPosZ();
afx_msg void OnViewHigherVolumeSlice();
afx_msg void OnViewLowerVolumeSlice();
afx_msg void OnUpdateFileOpenSubsurface(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileOpenAlphaSubsurface(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileOpenFace(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileOpenAlphaFace(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewOriginal(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewCompressed(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewAlphaChannel(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewLargerMipLevel(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewSmallerMipLevel(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewZoomIn(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewZoomOut(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewNegX(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewPosX(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewNegY(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewPosY(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewNegZ(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewPosZ(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewHigherVolumeSlice(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewLowerVolumeSlice(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
HRESULT UpdateDevice(VOID);
HRESULT RenderScene(VOID);
CDxtexApp* PDxtexApp(VOID) { return (CDxtexApp*)AfxGetApp(); }
HRESULT BuildViewSurface(BOOL bOrig, D3DCUBEMAP_FACES FaceType, LONG lwSlice, LONG lwMip, BOOL bViewAlpha);
HRESULT LoadSurfaceFromVolumeSlice(LPDIRECT3DVOLUME8 pVolume, UINT iSlice, LPDIRECT3DSURFACE8 psurf);
DWORD NumBytesInSurfaces(D3DCUBEMAP_FACES FaceType, LPDIRECT3DBASETEXTURE8 ptex);
HRESULT CreateVertexBuffer(VOID);
CString FormatName(D3DFORMAT fmt);
LPDIRECT3DVERTEXBUFFER8 m_pVB;
LPDIRECT3DTEXTURE8 m_ptexCur; // Currently-viewed texture surface
LPDIRECT3DSWAPCHAIN8 m_pSwapChain;
CRect m_rcSrc; // Size of m_pddsCur and m_pddsBack
CRect m_rcDest; // m_rcDest scaled by m_fZoom
FLOAT m_fZoom; // Zoom factor
BOOL m_bViewOrig; // View "original" vs. "new" surface
BOOL m_bViewAlpha; // View alpha channel alone vs. normal image
BOOL m_bTitleModsChanged; // Whether title bar text modifiers need to be updated
LONG m_lwMipCur; // Currently-viewed mip. 0 = top, 1 = next one down, etc.
D3DCUBEMAP_FACES m_CubeFaceCur; // D3DCUBEMAP_FACE_FORCE_DWORD = no cube map, or D3DCUBEMAP_FACE_POSITIVE_X, etc.
LONG m_lwSliceCur; // For volume maps
DWORD m_dwClearColor; // Background color that will show through where alpha is non-opaque
};
#ifndef _DEBUG // debug version in dxtexView.cpp
inline CDxtexDoc* CDxtexView::GetDocument()
{ return (CDxtexDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DXTXVIEW_H__712C53D1_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)

View File

@@ -0,0 +1,182 @@
//-------------------------------------------------------------------------
//
// Sample Name: DxTex
//
// Copyright (c) 1998-2001 Microsoft Corporation. All rights reserved.
//
//-------------------------------------------------------------------------
Description
===========
The purpose of this tool is to allow DXSDK users to easily create texture
maps that use the new DXTn compression formats. Creating a DXTn-compressed
texture is actually not that difficult to do: DirectDraw's Blt function can
do the conversion for you. Advanced developers will probably want to write
their own tools that meet their specific needs. But this tool provides useful
basic functionality.
DxTex Functionality
===================
Opens BMP and DDS files (See below for a description of the DDS file format)
Opens BMP files as alpha channel, either explicitly or implicitly (via
foo_a.bmp naming)
Saves textures in DDS format
Supports conversion to all five DXTn compression formats
Supports generation of mip maps (using a box filter)
Supports visualization of alpha channel as a greyscale image or via a user-
selectable background color
Supports easy visual comparison of image quality between formats
Note: DxTex does not currently support textures with surface formats that
do not contain at least an R, G, and B texture (such as D3DFMT_G16R16 and
D3DFMT_A8), although D3DX can load and save such textures in DDS format.
User Interface
==============
DxTex uses a pretty traditional user interface. Each texture map is a
document, and several documents can be open at a time. The one thing that
is a bit unusual about the UI is that each document can hold the texture
in either one or two formats at once while the document is open in DxTex.
For instance, one could import a BMP file, which would automatically create
a 32-bit ARGB texture. One could then choose to convert the texture to
DXT1 format. The document now remembers the image in *both* formats, and
the user can flip between the formats by clicking in the window or by
choosing "Original" and "New" in the View menu. This makes it easy for
the user to observe any artifacts introduced by image compression, and to
try several different compression formats without progressive degradation
of the image For instance, if this technique were not used and the user
converted an image from ARGB to DXT1, all but one bit of alpha would be lost.
If the user then decided to convert to DXT2, there would still be only two
alpha levels. With DxTex's system, the second conversion is done from the
original ARGB format, and the DXT2 image will contain all 16 levels of alpha
supported by DXT2. When the image is saved, the "original" format is
discarded, and only the "new" format is stored.
There are a few consequences of this system that one must remember:
- If no format conversion has been requested since the document was opened,
the one format is the "original" format and that is the format in which
the image will be written when the document is saved.
- If format conversion has been requested since the document was opened, the
converted format is the "new" format and that is the format in which the
image will be written when the document is saved.
- If a second format conversion is requested, the "new" format from the first
conversion is replaced with the second format. The "original" format will
be unchanged.
- Generating of mip maps applies to both formats simultaneously.
- If the original format has multiple mip maps, and conversion to a new format
is requested, the new format will automatically have multiple mip maps as
well.
It's not as complicated as it sounds: with time, this two-format system
becomes natural and efficient to use.
DxTex Performance
=================
DxTex uses the Direct3D Reference Rasterizer to draw the textures,
regardless of what 3D hardware is available. So with larger textures
(greater than 256x256), the program may be somewhat slow, depending on your
CPU speed.
DDS File Format
===============
DxTex's native file format is called "DDS" file format, because it
encapsulates the information in a DirectDrawSurface. It has the following
format:
DWORD dwMagic (0x20534444, or "DDS ")
DDSURFACEDESC2 ddsd (this provides information about the surface format)
BYTE bData1[] (this is the surface data for the main surface)
[BYTE bData2[]...] (surface data for attached surfaces, if any, follow)
This format is easy to read and write, and supports features such as alpha
and multiple mip levels, as well as DXTn compression. The "Compress" sample
application on the DXSDK demonstrates how to properly import a DDS file.
The user should note that it is not necessary to use the DDS format in order
to use DXTn-compressed textures, or vice-versa. But the two work well
together.
Mip Maps
========
Mip mapping is a technique that improves image quality and reduces texture
memory bandwidth by providing prefiltered versions of the texture image at
multiple resolutions.
To generate mip maps in DxTex, the width and height of the source image must
both be powers of 2. Choose "Generate Mip Maps" from the Format menu.
Filtering is done via a simple box filter, i.e., the four nearest pixels are
averaged to produce each destination pixel. More sophisticated filtering can
be found in other image processing programs.
Alpha
=====
Many texture formats include an alpha channel, which provides opacity
information at each pixel. DxTex fully supports alpha in textures. When
importing a BMP file, if a file exists of the same size with "_a" at the end
(e.g., foo.bmp and foo_a.bmp), the second file will be loaded as an alpha
channel. The blue channel of the second BMP is stored in the alpha channel.
Once a document is open, the user can explicitly load a BMP file as the alpha
channel via the "Open As Alpha Channel" command on the File menu.
To view the alpha channel directly without the RGB channels, choose "Alpha
Channel Only" from the View menu. The alpha channel will appear as a
greyscale image. Note that if no alpha channel has been loaded, the alpha
channel will be 100% everywhere and the image will appear solid white when
viewing "Alpha Channel Only". To turn off "Alpha Channel Only", just choose
that menu item a second time.
In the usual view, the effect of the alpha channel is visible because the
window has a solid background color which shows through the texture where the
alpha channel is less than 100%. The user can change this background color
by choosing "Change Background Color" from the View menu. This choice does
not affect the texture itself or the data that is written when the file is
saved.
The DXT2 and DXT4 formats use premultiplied alpha, which means that the
red, green, and blue values stored in the surface are already multiplied
by the corresponding alpha value. DirectDraw cannot blit from a surface
containing premultiplied alpha to one containing non-premultiplied alpha,
so some DxTex operations (Open as Alpha Channel, conversion to DXT3, and
conversion to DXT5) are not possible on DXT2 and DXT4 formats. Supporting
textures using these formats is difficult on Direct3D devices which do
not support DXTn textures, because DirectDraw cannot handle blitting them
to a traditional ARGB surface either (unless that ARGB surface uses
premultiplied alpha as well, which is rare). So you may find it easier to
use DXT3 rather than DXT2 and DXT5 rather than DXT4 when possible.
Command-Line Options
====================
Command-line options can be used to pass input files, an output file name, and
processing options to DxTex. If an output file name is specified, the program
exits automatically after writing the output file, and no user interface is
presented.
dxtex [infilename] [-a alphaname] [-m] [DXT1|DXT2|DXT3|DXT4|DXT5] [outfilename]
infilename: The name of the file to load. This can be a BMP or
DDS file.
-a alphaname: If "-a" is specified, the next parameter is the name
of a BMP file to load as the alpha channel. Note:
if no alpha filename is specified, DxTex will still
look for a file named infilename_a.bmp and, if it
exists, use that as the alpha channel.
-m: If this option is specified, mipmaps are generated.
DXT1|DXT2|DXT3|DXT4|DXT5: Specifies compression format. If no format is
specified, the image will be in ARGB-8888.
outfilename: Specifies the name of the destination file. If this
is not specified, the user interface will show the
current file and all requested operations. If an
outfilename is specified, the app will exit after
saving the processed file without presenting a user
interface.