mirror of
https://github.com/electronicarts/CnC_Renegade.git
synced 2025-12-16 07:31:40 -05:00
Initial commit of Command & Conquer Renegade source code.
This commit is contained in:
59
Code/Tools/LightMap/Chunk.h
Normal file
59
Code/Tools/LightMap/Chunk.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 8/17/99 2:44p $*
|
||||
* *
|
||||
* $Revision:: 1 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef CHUNK_H
|
||||
#define CHUNK_H
|
||||
|
||||
// Includes.
|
||||
#include "Chunkio.h"
|
||||
|
||||
|
||||
class ChunkClass : public ChunkHeader
|
||||
{
|
||||
public:
|
||||
|
||||
ChunkClass (ChunkLoadClass &loadchunk);
|
||||
~ChunkClass() {if (Data != NULL) delete [] Data;}
|
||||
|
||||
void *Get_Data() const {return (Data);}
|
||||
|
||||
private:
|
||||
|
||||
char *Data;
|
||||
};
|
||||
|
||||
|
||||
#endif // CHUNK_H
|
||||
340
Code/Tools/LightMap/InsertSolveDialog.cpp
Normal file
340
Code/Tools/LightMap/InsertSolveDialog.cpp
Normal file
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 1/24/01 3:40p $*
|
||||
* *
|
||||
* $Revision:: 3 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
// Includes.
|
||||
#include "StdAfx.h"
|
||||
#include "LightMap.h"
|
||||
#include "InsertSolveDialog.h"
|
||||
#include "OptionsDialog.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
InsertSolveDialog::InsertSolveDialog (const char *initialpathname, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(InsertSolveDialog::IDD, pParent)
|
||||
{
|
||||
InitialPathname = initialpathname;
|
||||
*DirectoryName = '\0';
|
||||
FileListBuffer = NULL;
|
||||
FilenameList = NULL;
|
||||
ApplySelective = false;
|
||||
InvertSelection = false;
|
||||
BlendNoise = false;
|
||||
InclusionString = NULL;
|
||||
|
||||
//{{AFX_DATA_INIT(InsertSolveDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void InsertSolveDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(InsertSolveDialog)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(InsertSolveDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(InsertSolveDialog)
|
||||
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
|
||||
ON_BN_CLICKED(IDC_APPLY_SELECTIVE, OnApplySelective)
|
||||
ON_BN_CLICKED(IDC_BLEND_NOISE, OnBlendNoise)
|
||||
ON_EN_CHANGE(IDC_INCLUSION_STRING, OnChangeInclusionString)
|
||||
ON_BN_CLICKED(IDC_MORE_OPTIONS, OnMoreOptions)
|
||||
ON_BN_CLICKED(IDC_CONTAINING, OnContaining)
|
||||
ON_BN_CLICKED(IDC_NOT_CONTAINING, OnNotContaining)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* InsertSolveDialog::OnMoreOptions -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/06/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL InsertSolveDialog::OnInitDialog()
|
||||
{
|
||||
char inclusionstring [2] = "^";
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CheckDlgButton (IDC_APPLY_SELECTIVE, ApplySelective);
|
||||
CheckDlgButton (IDC_CONTAINING, true);
|
||||
CheckDlgButton (IDC_NOT_CONTAINING, false);
|
||||
CheckDlgButton (IDC_BLEND_NOISE, BlendNoise);
|
||||
GetDlgItem (IDC_INCLUSION_STRING)->SetWindowText (inclusionstring);
|
||||
GetDlgItem (IDC_INCLUSION_STRING)->EnableWindow (ApplySelective);
|
||||
GetDlgItem (IDC_CONTAINING)->EnableWindow (ApplySelective);
|
||||
GetDlgItem (IDC_NOT_CONTAINING)->EnableWindow (ApplySelective);
|
||||
|
||||
return (TRUE); // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* InsertSolveDialog::OnBrowse -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/06/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void InsertSolveDialog::OnBrowse()
|
||||
{
|
||||
const char *filefilter = "Lightscape Solution Files (*.ls)|*.ls|All Files (*.*)|*.*||"; // Filter for supported solve file formats.
|
||||
const unsigned filelistbuffersize = 4096;
|
||||
|
||||
char initialdrivename [_MAX_DRIVE];
|
||||
char initialdirectoryname [_MAX_DIR];
|
||||
char initialpath [_MAX_PATH];
|
||||
|
||||
// Select one or more solve files.
|
||||
CFileDialog dialog (TRUE, NULL, NULL, LightMapApp::File_Dialog_Flags() | OFN_ALLOWMULTISELECT, filefilter);
|
||||
|
||||
// Allocate a buffer to contain the list of files selected.
|
||||
// NOTE: Add one to buffer size in case an extra null must be added (see below).
|
||||
FileListBuffer = new char [filelistbuffersize + 1];
|
||||
ASSERT (FileListBuffer != NULL);
|
||||
*FileListBuffer = '\0';
|
||||
dialog.m_ofn.lpstrFile = FileListBuffer;
|
||||
dialog.m_ofn.nMaxFile = filelistbuffersize;
|
||||
|
||||
// Specify initial path.
|
||||
_splitpath (InitialPathname, initialdrivename, initialdirectoryname, NULL, NULL);
|
||||
_makepath (initialpath, initialdrivename, initialdirectoryname, NULL, NULL);
|
||||
dialog.m_ofn.lpstrInitialDir = initialpath;
|
||||
|
||||
if (dialog.DoModal() == IDOK) {
|
||||
|
||||
char *cptr;
|
||||
char *windowtext, *windowtextptr;
|
||||
|
||||
// NOTE: Old style (not Explorer style) dialog boxes separate strings in the file list buffer
|
||||
// with spaces rather than null terminators.
|
||||
if (!LightMapApp::Explorer_Style()) {
|
||||
|
||||
// Replace all spaces in the string with null terminators.
|
||||
cptr = FileListBuffer;
|
||||
while (*cptr != '\0') {
|
||||
if (*cptr == ' ') *cptr = '\0';
|
||||
cptr++;
|
||||
}
|
||||
|
||||
// Append an extra null to indicate end of list.
|
||||
*(cptr + 1) = '\0';
|
||||
}
|
||||
|
||||
// Must be room for directory name (including null terminator).
|
||||
ASSERT (dialog.m_ofn.nFileOffset < sizeof (DirectoryName));
|
||||
|
||||
// Copy directory name from file list buffer and append a backslash.
|
||||
if (dialog.m_ofn.nFileOffset > 0) {
|
||||
strncpy (DirectoryName, FileListBuffer, dialog.m_ofn.nFileOffset);
|
||||
DirectoryName [dialog.m_ofn.nFileOffset - 1] = '\0';
|
||||
strcat (DirectoryName, "\\");
|
||||
} else {
|
||||
strcpy (DirectoryName, "");
|
||||
}
|
||||
|
||||
FilenameList = FileListBuffer + dialog.m_ofn.nFileOffset;
|
||||
|
||||
// Set the solve file list edit control.
|
||||
windowtext = new char [filelistbuffersize];
|
||||
ASSERT (windowtext != NULL);
|
||||
cptr = FilenameList;
|
||||
windowtextptr = windowtext;
|
||||
while (true) {
|
||||
if (*cptr != '\0') {
|
||||
*windowtextptr = *cptr;
|
||||
} else {
|
||||
if (*(cptr + 1) == '\0') {
|
||||
*windowtextptr = '\0';
|
||||
break;
|
||||
} else {
|
||||
*windowtextptr = ';';
|
||||
}
|
||||
}
|
||||
cptr++;
|
||||
windowtextptr++;
|
||||
}
|
||||
GetDlgItem (IDC_SOLVE_FILE_LIST)->SetWindowText (windowtext);
|
||||
|
||||
// Clean-up.
|
||||
delete [] windowtext;
|
||||
|
||||
GetDlgItem (IDOK)->EnableWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* InsertSolveDialog::OnApplySelective -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/06/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void InsertSolveDialog::OnApplySelective()
|
||||
{
|
||||
ApplySelective = !ApplySelective;
|
||||
GetDlgItem (IDC_INCLUSION_STRING)->EnableWindow (ApplySelective);
|
||||
GetDlgItem (IDC_CONTAINING)->EnableWindow (ApplySelective);
|
||||
GetDlgItem (IDC_NOT_CONTAINING)->EnableWindow (ApplySelective);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* InsertSolveDialog::OnContaining -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/06/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void InsertSolveDialog::OnContaining()
|
||||
{
|
||||
InvertSelection = false;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* InsertSolveDialog::OnNotContaining -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/06/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void InsertSolveDialog::OnNotContaining()
|
||||
{
|
||||
InvertSelection = true;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* InsertSolveDialog::OnBlendNoise -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/06/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void InsertSolveDialog::OnBlendNoise()
|
||||
{
|
||||
BlendNoise = !BlendNoise;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* InsertSolveDialog::OnChangeInclusionString -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/06/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void InsertSolveDialog::OnChangeInclusionString()
|
||||
{
|
||||
int textlength;
|
||||
|
||||
if (InclusionString != NULL) delete [] InclusionString;
|
||||
textlength = GetDlgItem (IDC_INCLUSION_STRING)->GetWindowTextLength() + 1;
|
||||
InclusionString = new char [textlength];
|
||||
ASSERT (InclusionString != NULL);
|
||||
GetDlgItem (IDC_INCLUSION_STRING)->GetWindowText (InclusionString, textlength);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* InsertSolveDialog::OnMoreOptions -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/06/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void InsertSolveDialog::OnMoreOptions()
|
||||
{
|
||||
OptionsDialog options;
|
||||
|
||||
options.DoModal();
|
||||
}
|
||||
|
||||
|
||||
106
Code/Tools/LightMap/InsertSolveDialog.h
Normal file
106
Code/Tools/LightMap/InsertSolveDialog.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 1/24/01 3:29p $*
|
||||
* *
|
||||
* $Revision:: 3 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#if !defined(AFX_INSERTSOLVEDIALOG_H__6F280B62_836D_11D4_A3D2_009027447394__INCLUDED_)
|
||||
#define AFX_INSERTSOLVEDIALOG_H__6F280B62_836D_11D4_A3D2_009027447394__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
class InsertSolveDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
InsertSolveDialog (const char *initialpathname, CWnd* pParent = NULL);
|
||||
|
||||
~InsertSolveDialog() {
|
||||
if (FileListBuffer != NULL) delete [] FileListBuffer;
|
||||
if (InclusionString != NULL) delete [] InclusionString;
|
||||
}
|
||||
|
||||
char *Directory_Name() {return (DirectoryName);}
|
||||
char *Filename_List() {return (FilenameList);}
|
||||
bool Apply_Selective() {return (ApplySelective);}
|
||||
bool Invert_Selection() {return (InvertSelection);}
|
||||
bool Blend_Noise() {return (BlendNoise);}
|
||||
char *Inclusion_String() {return (InclusionString);}
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(InsertSolveDialog)
|
||||
enum { IDD = IDD_INSERT_SOLVE };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(InsertSolveDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(InsertSolveDialog)
|
||||
afx_msg void OnBrowse();
|
||||
afx_msg void OnApplySelective();
|
||||
afx_msg void OnBlendNoise();
|
||||
afx_msg void OnChangeInclusionString();
|
||||
afx_msg void OnMoreOptions();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnContaining();
|
||||
afx_msg void OnNotContaining();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
const char *InitialPathname; // Pathname used to indicate default browsing directory.
|
||||
char DirectoryName [_MAX_DIR]; // Directory containing solve files.
|
||||
char *FileListBuffer; // Buffer to store list of solve filenames.
|
||||
char *FilenameList; // Ptr to list of solve filenames (separated by null terminating character).
|
||||
bool ApplySelective;
|
||||
bool InvertSelection;
|
||||
bool BlendNoise;
|
||||
char *InclusionString;
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_INSERTSOLVEDIALOG_H__6F280B62_836D_11D4_A3D2_009027447394__INCLUDED_)
|
||||
428
Code/Tools/LightMap/LightMap.cpp
Normal file
428
Code/Tools/LightMap/LightMap.cpp
Normal file
@@ -0,0 +1,428 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 7/19/01 8:13p $*
|
||||
* *
|
||||
* $Revision:: 11 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
// Includes.
|
||||
#include "StdAfx.h"
|
||||
#include "LightMap.h"
|
||||
#include "LightMapView.h"
|
||||
#include "MainFrm.h"
|
||||
#include "verchk.h"
|
||||
#include <stdlib.h>
|
||||
#include <direct.h>
|
||||
|
||||
// Static functions.
|
||||
BOOL CALLBACK TopLevelWindowSearch (HWND hwnd, LPARAM lParam);
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
BEGIN_MESSAGE_MAP(LightMapApp, CWinApp)
|
||||
//{{AFX_MSG_MAP(LightMapApp)
|
||||
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
|
||||
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
|
||||
//}}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()
|
||||
|
||||
// The one and only LightMapApp object
|
||||
LightMapApp theApp;
|
||||
|
||||
|
||||
class CAboutDlg : public CDialog
|
||||
{
|
||||
public:
|
||||
CAboutDlg();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CAboutDlg)
|
||||
enum { IDD = IDD_ABOUTBOX };
|
||||
//}}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)
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CAboutDlg)
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CAboutDlg)
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CAboutDlg)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapApp:: -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
LightMapApp::LightMapApp()
|
||||
{
|
||||
// NOTE: Place all significant initialization in InitInstance
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapApp:: -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL LightMapApp::InitInstance()
|
||||
{
|
||||
char computername [MAX_COMPUTERNAME_LENGTH + 1];
|
||||
char processidname [33];
|
||||
|
||||
DWORD computernamesize;
|
||||
|
||||
// Standard initialization
|
||||
// If you are not using these features and wish to reduce the size
|
||||
// of your final executable, you should remove from the following
|
||||
// specific initialization routines you do not need.
|
||||
|
||||
#ifdef _AFXDLL
|
||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||
#else
|
||||
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||
#endif
|
||||
|
||||
Do_Version_Check();
|
||||
|
||||
// Set the working path.
|
||||
_getdcwd (0, WorkingPath, sizeof (WorkingPath));
|
||||
strcat (WorkingPath, "\\");
|
||||
|
||||
// Set the instance name.
|
||||
computernamesize = sizeof (computername);
|
||||
GetComputerName (computername, &computernamesize);
|
||||
itoa (GetCurrentProcessId(), processidname, 16);
|
||||
strcpy (InstanceName, computername);
|
||||
strcat (InstanceName, processidname);
|
||||
|
||||
// Version 0.1 by default.
|
||||
ApplicationVersion = 1;
|
||||
|
||||
// Get the name and path of the currently executing application.
|
||||
TCHAR filename [MAX_PATH];
|
||||
::GetModuleFileName (NULL, filename, sizeof (filename));
|
||||
|
||||
// Get the version information for this application.
|
||||
DWORD dummy_var = 0;
|
||||
DWORD version_size = ::GetFileVersionInfoSize (filename, &dummy_var);
|
||||
if (version_size > 0) {
|
||||
|
||||
// Get the file version block
|
||||
LPBYTE pblock = new BYTE [version_size];
|
||||
if (::GetFileVersionInfo (filename, 0L, version_size, pblock)) {
|
||||
|
||||
// Query the block for the file version information.
|
||||
UINT version_len = 0;
|
||||
VS_FIXEDFILEINFO *pversion_info = NULL;
|
||||
if (::VerQueryValue (pblock, "\\", (LPVOID*) &pversion_info, &version_len)) {
|
||||
ApplicationVersion = pversion_info->dwFileVersionMS;
|
||||
}
|
||||
}
|
||||
delete [] pblock;
|
||||
}
|
||||
|
||||
SetRegistryKey ("Westwood Studios");
|
||||
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.
|
||||
CSingleDocTemplate* pDocTemplate;
|
||||
pDocTemplate = new CSingleDocTemplate(
|
||||
IDR_MAINFRAME,
|
||||
RUNTIME_CLASS(LightMapDoc),
|
||||
RUNTIME_CLASS(CMainFrame),
|
||||
RUNTIME_CLASS(LightMapView));
|
||||
AddDocTemplate(pDocTemplate);
|
||||
|
||||
// Parse command line for standard shell commands, DDE, file open.
|
||||
CCommandLineInfo cmdInfo;
|
||||
|
||||
ParseCommandLine (cmdInfo);
|
||||
|
||||
EnableShellOpen();
|
||||
RegisterShellFileTypes (TRUE);
|
||||
|
||||
// Dispatch commands specified on the command line.
|
||||
if (!ProcessShellCommand (cmdInfo)) return (FALSE);
|
||||
|
||||
m_pMainWnd->DragAcceptFiles();
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapApp::Do_Version_Check -- Check if this version of lightmap is newer or older than *
|
||||
* a version at a designated location on the network and if *
|
||||
* older then report this fact to user. *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/15/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapApp::Do_Version_Check()
|
||||
{
|
||||
const char *networkpath = "\\\\Mobius\\Project7\\Projects\\Renegade\\Programming\\Tools\\Lightmap";
|
||||
const char *newversiontext = "There is a newer version of the Lightmap tool. Please run 'Renegade Update' to update your local copy.";
|
||||
|
||||
char pathname [_MAX_PATH];
|
||||
char filename [_MAX_FNAME];
|
||||
char extension [_MAX_EXT];
|
||||
|
||||
::GetModuleFileName (NULL, pathname, MAX_PATH);
|
||||
_splitpath (pathname, NULL, NULL, filename, extension);
|
||||
strcpy (pathname, "\\\\Mobius\\Project7\\Projects\\Renegade\\Programming\\Tools\\Lightmap\\");
|
||||
strcat (pathname, filename);
|
||||
strcat (pathname, extension);
|
||||
|
||||
if (Compare_EXE_Version ((int)::AfxGetInstanceHandle(), pathname) < 0) {
|
||||
::MessageBox (NULL, newversiontext, "Version Information", MB_ICONEXCLAMATION | MB_OK | MB_SETFOREGROUND | MB_SYSTEMMODAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapApp::TopLevelWindowSearch -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/15/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL CALLBACK TopLevelWindowSearch (HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
BOOL bcontinue = TRUE;
|
||||
|
||||
// Is this a viewer window?
|
||||
if (::GetProp (hwnd, "LIGHTMAP") != 0) {
|
||||
bcontinue = FALSE;
|
||||
(*((HWND*)lParam)) = hwnd;
|
||||
}
|
||||
|
||||
return (bcontinue);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapApp:: -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
LightMapDoc* LightMapApp::GetDoc()
|
||||
{
|
||||
POSITION pos = GetFirstDocTemplatePosition();
|
||||
CDocTemplate *pDocTemplate = GetNextDocTemplate (pos);
|
||||
|
||||
pos = pDocTemplate->GetFirstDocPosition();
|
||||
LightMapDoc* pDoc = (LightMapDoc*)pDocTemplate->GetNextDoc (pos);
|
||||
ASSERT (pDoc->IsKindOf(RUNTIME_CLASS(LightMapDoc)));
|
||||
|
||||
return (pDoc);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapApp:: -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapApp::OnAppAbout()
|
||||
{
|
||||
CAboutDlg aboutDlg;
|
||||
|
||||
aboutDlg.DoModal();
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapApp::OnFileOpen -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapApp::OnFileOpen()
|
||||
{
|
||||
CFileDialog dialog (TRUE, NULL, NULL, File_Dialog_Flags(), File_Dialog_Filter());
|
||||
|
||||
if (dialog.DoModal() == IDOK) {
|
||||
if (GetDoc()->OnOpenDocument (dialog.GetPathName())) {
|
||||
GetDoc()->SetPathName (dialog.GetPathName());
|
||||
GetDoc()->UpdateAllViews (NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapApp::Explorer_Style -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
bool LightMapApp::Explorer_Style()
|
||||
{
|
||||
OSVERSIONINFO info;
|
||||
|
||||
info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
|
||||
::GetVersionEx (&info);
|
||||
return ((info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) || ((info.dwPlatformId == VER_PLATFORM_WIN32_NT) && (info.dwMajorVersion >= 4)));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapApp::File_Dialog_Flags -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
DWORD LightMapApp::File_Dialog_Flags()
|
||||
{
|
||||
DWORD flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
|
||||
|
||||
if (Explorer_Style()) flags |= OFN_EXPLORER;
|
||||
return (flags);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* CAboutDlg::OnInitDialog -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL CAboutDlg::OnInitDialog()
|
||||
{
|
||||
// Allow the base class to process this message.
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// Put the version string into the dialog.
|
||||
CString version_string;
|
||||
version_string.Format ("Version %d.%d", (theApp.Application_Version() >> 16), (theApp.Application_Version() & 0xffff));
|
||||
GetDlgItem (IDC_VERSION_TEXT)->SetWindowText (version_string);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
271
Code/Tools/LightMap/LightMap.dsp
Normal file
271
Code/Tools/LightMap/LightMap.dsp
Normal file
@@ -0,0 +1,271 @@
|
||||
# Microsoft Developer Studio Project File - Name="LightMap" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=LightMap - 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 "LightMap.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 "LightMap.mak" CFG="LightMap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "LightMap - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "LightMap - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "LightMap - Win32 Profile" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""$/Commando/Code/Tools/LightMap", CXCCAAAA"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "LightMap - 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 2
|
||||
# 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 /MD /W3 /GX /Ot /Op /Ob2 /I "..\..\Lightscape\Inc" /I "..\..\srsdk1x\include" /I "..\..\wwdebug" /I "..\..\Wwlib" /I "..\..\Ww3d2" /I "..\..\wwmath" /I "..\..\wwsaveload" /I "..\..\wwphys" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /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" /d "_AFXDLL"
|
||||
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 lvsio.lib wwlib.lib wwmath.lib ww3d2.lib wwdebug.lib wwsaveload.lib vfw32.lib sr.lib version.lib winmm.lib d3dx8.lib d3d8.lib /nologo /subsystem:windows /map /machine:I386 /out:"Run\LightMap.exe" /libpath:"..\..\Lightscape\Lib" /libpath:"..\..\Libs\Release" /libpath:"..\..\srsdk1x\msvc6\lib\release"
|
||||
# SUBTRACT LINK32 /profile
|
||||
|
||||
!ELSEIF "$(CFG)" == "LightMap - 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 2
|
||||
# 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 /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\Lightscape\Inc" /I "..\..\srsdk1x\include" /I "..\..\wwdebug" /I "..\..\Wwlib" /I "..\..\Ww3d2" /I "..\..\wwmath" /I "..\..\wwsaveload" /I "..\..\wwphys" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /FR /YX /FD /GZ /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" /d "_AFXDLL"
|
||||
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
|
||||
# ADD LINK32 lvsiod.lib wwlib.lib wwmath.lib ww3d2.lib wwdebug.lib wwsaveload.lib vfw32.lib srdb.lib version.lib winmm.lib d3dx8.lib d3d8.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"Run\LightMapD.exe" /libpath:"..\..\Lightscape\Lib" /libpath:"..\..\Libs\Debug" /libpath:"..\..\srsdk1x\msvc6\lib\debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "LightMap - Win32 Profile"
|
||||
|
||||
# PROP BASE Use_MFC 2
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Profile"
|
||||
# PROP BASE Intermediate_Dir "Profile"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 2
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Profile"
|
||||
# PROP Intermediate_Dir "Profile"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /Ot /Op /Ob2 /I "..\..\Lightscape\Inc" /I "..\..\srsdk1x\include" /I "..\..\wwdebug" /I "..\..\Wwlib" /I "..\..\Ww3d2" /I "..\..\wwmath" /I "..\..\wwsaveload" /I "..\..\wwphys" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /Zi /O2 /Op /Ob2 /I "..\..\Lightscape\Inc" /I "..\..\srsdk1x\include" /I "..\..\wwdebug" /I "..\..\Wwlib" /I "..\..\Ww3d2" /I "..\..\wwmath" /I "..\..\wwsaveload" /I "..\..\wwphys" /D "WIN32" /D "WWDEBUG" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /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" /d "_AFXDLL"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 lvsio.lib wwlib.lib wwmath.lib ww3d2.lib wwdebug.lib wwsaveload.lib vfw32.lib sr.lib version.lib winmm.lib d3dx8.lib d3d8.lib /nologo /subsystem:windows /map /machine:I386 /out:"Run\LightMap.exe" /libpath:"..\..\Lightscape\Lib" /libpath:"..\..\Libs\Release" /libpath:"..\..\srsdk1x\msvc6\lib\release"
|
||||
# SUBTRACT BASE LINK32 /profile
|
||||
# ADD LINK32 lvsio.lib wwlib.lib wwmath.lib ww3d2.lib wwdebug.lib wwsaveload.lib vfw32.lib sr.lib version.lib winmm.lib d3dx8.lib d3d8.lib /nologo /subsystem:windows /incremental:yes /debug /machine:I386 /out:"Run\LightMap.exe" /libpath:"..\..\Lightscape\Lib" /libpath:"..\..\Libs\Profile" /libpath:"..\..\srsdk1x\msvc6\lib\release"
|
||||
# SUBTRACT LINK32 /profile /map
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "LightMap - Win32 Release"
|
||||
# Name "LightMap - Win32 Debug"
|
||||
# Name "LightMap - Win32 Profile"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\InsertSolveDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LightMap.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LightMap.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LightMapDoc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LightMapPacker.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LightMapView.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Lightscape.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MainFrm.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\OptionsDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PackingDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PerlinNoise.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SelectionDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StringBuilder.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Chunk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\InsertSolveDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LightMap.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LightMapDoc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LightMapPacker.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LightMapView.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Lightscape.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MainFrm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\OptionsDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PackingDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PerlinNoise.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ProceduralTexture.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SelectionDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StringBuilder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TextureNameNode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Triangle.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resources"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Res\LightMap.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Res\Toolbar.bmp
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
107
Code/Tools/LightMap/LightMap.h
Normal file
107
Code/Tools/LightMap/LightMap.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 7/19/01 7:32p $*
|
||||
* *
|
||||
* $Revision:: 8 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#endif
|
||||
|
||||
// Includes.
|
||||
#include "resource.h"
|
||||
#include "LightMapDoc.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
class LightMapApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
|
||||
// Functions.
|
||||
char *Working_Path() {return (WorkingPath);}
|
||||
char *Instance_Name() {return (InstanceName);}
|
||||
DWORD Application_Version() {return (ApplicationVersion);}
|
||||
|
||||
static bool Explorer_Style();
|
||||
static DWORD File_Dialog_Flags();
|
||||
|
||||
static const char *File_Dialog_Filter()
|
||||
{
|
||||
return ("Westwood 3D Files (*.w3d)|*.w3d|All Files (*.*)|*.*||");
|
||||
}
|
||||
|
||||
static const char *Document_File_Extension()
|
||||
{
|
||||
return (".w3d");
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// Functions.
|
||||
LightMapDoc* GetDoc();
|
||||
|
||||
private:
|
||||
|
||||
void Do_Version_Check();
|
||||
|
||||
char WorkingPath [_MAX_PATH]; // Path of executing application.
|
||||
char InstanceName [_MAX_PATH]; // Name unique to this instance of the application.
|
||||
|
||||
DWORD ApplicationVersion; // Version no. of this application.
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
public:
|
||||
LightMapApp();
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(LightMapApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
//{{AFX_MSG(LightMapApp)
|
||||
afx_msg void OnAppAbout();
|
||||
afx_msg void OnFileOpen();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
// Externals.
|
||||
extern LightMapApp theApp;
|
||||
|
||||
|
||||
|
||||
546
Code/Tools/LightMap/LightMap.rc
Normal file
546
Code/Tools/LightMap/LightMap.rc
Normal file
@@ -0,0 +1,546 @@
|
||||
//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\r\n"
|
||||
"#include ""res\\LightMap.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||
"#include ""afxres.rc"" // Standard components\r\n"
|
||||
"#endif\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\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_EDIT_CUT
|
||||
BUTTON ID_EDIT_COPY
|
||||
BUTTON ID_EDIT_PASTE
|
||||
SEPARATOR
|
||||
BUTTON ID_FILE_PRINT
|
||||
BUTTON ID_APP_ABOUT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Save", ID_FILE_SAVE
|
||||
MENUITEM "Save &As...", ID_FILE_SAVE_AS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", ID_APP_EXIT
|
||||
END
|
||||
POPUP "&Insert"
|
||||
BEGIN
|
||||
MENUITEM "Solve...", ID_INSERT_SOLVE
|
||||
END
|
||||
POPUP "&Tools"
|
||||
BEGIN
|
||||
MENUITEM "&Options...", ID_TOOLS_OPTIONS
|
||||
MENUITEM "Lightmap Packing...", ID_TOOLS_PACKING
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About LightMap...", ID_APP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
|
||||
BEGIN
|
||||
"N", ID_FILE_NEW, VIRTKEY, CONTROL
|
||||
"O", ID_FILE_OPEN, VIRTKEY, CONTROL
|
||||
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
|
||||
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL
|
||||
"X", ID_EDIT_CUT, VIRTKEY, CONTROL
|
||||
"C", ID_EDIT_COPY, VIRTKEY, CONTROL
|
||||
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL
|
||||
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT
|
||||
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT
|
||||
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL
|
||||
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT
|
||||
VK_F6, ID_NEXT_PANE, VIRTKEY
|
||||
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 222, 54
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About LightMap"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,11,17,21,20
|
||||
LTEXT "Copyright <20> 1999 Westwood Studios",IDC_STATIC,40,33,119,
|
||||
8
|
||||
DEFPUSHBUTTON "OK",IDOK,183,7,32,14,WS_GROUP
|
||||
LTEXT "LightMap",IDC_STATIC,40,14,30,8
|
||||
LTEXT "Version 1.0",IDC_VERSION_TEXT,73,14,51,8
|
||||
END
|
||||
|
||||
IDD_OPTIONS DIALOGEX 0, 0, 279, 348
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Options"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,222,298,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,222,327,50,14
|
||||
LTEXT "100%",IDC_STATIC,167,233,18,8
|
||||
LTEXT "0%",IDC_STATIC,87,234,10,8
|
||||
GROUPBOX "Lightmap pixel format",IDC_STATIC,7,255,265,33
|
||||
GROUPBOX "Lightmap sampling",IDC_STATIC,7,173,265,75
|
||||
CONTROL "16 bits per pixel",IDC_16_BITS_PER_PIXEL,"Button",
|
||||
BS_AUTORADIOBUTTON,17,269,65,10
|
||||
CONTROL "24 bits per pixel",IDC_24_BITS_PER_PIXEL,"Button",
|
||||
BS_AUTORADIOBUTTON,93,269,65,10
|
||||
CONTROL "8 bits per pixel (paletted)",IDC_8_BITS_PER_PIXEL,
|
||||
"Button",BS_AUTORADIOBUTTON | WS_DISABLED,172,269,92,10
|
||||
EDITTEXT IDC_SAMPLE_RATE_VALUE,90,188,49,12,ES_RIGHT |
|
||||
ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER | NOT WS_BORDER,
|
||||
WS_EX_STATICEDGE
|
||||
CONTROL "Spin1",IDC_SAMPLE_RATE,"msctls_updown32",UDS_ALIGNLEFT |
|
||||
UDS_AUTOBUDDY | UDS_ARROWKEYS,77,187,11,14
|
||||
GROUPBOX "Lightmap fill color",IDC_STATIC,7,128,265,40
|
||||
EDITTEXT IDC_FILL_COLOR_RED,53,144,26,14,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
LTEXT "Red",IDC_STATIC,35,147,14,8
|
||||
LTEXT "Green",IDC_STATIC,101,147,20,8
|
||||
LTEXT "Blue",IDC_STATIC,175,147,15,8
|
||||
EDITTEXT IDC_FILL_COLOR_GREEN,125,144,27,14,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
EDITTEXT IDC_FILL_COLOR_BLUE,193,144,26,14,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
LTEXT "Sample rate",IDC_STATIC,37,190,38,8
|
||||
CONTROL "Slider1",IDC_FILTER_ERROR,"msctls_trackbar32",
|
||||
TBS_NOTICKS | WS_TABSTOP,84,216,100,15
|
||||
LTEXT "Filter error",IDC_STATIC,43,219,32,8
|
||||
EDITTEXT IDC_FILTER_ERROR_VALUE,193,217,22,12,ES_RIGHT |
|
||||
ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,
|
||||
WS_EX_STATICEDGE
|
||||
GROUPBOX "Tolerances",IDC_STATIC,7,7,265,71
|
||||
CONTROL "Slider1",IDC_FILTER_SHARPNESS,"msctls_trackbar32",
|
||||
TBS_NOTICKS | WS_TABSTOP,82,92,100,15
|
||||
CONTROL "Slider2",IDC_SMOOTHING_ANGLE,"msctls_trackbar32",
|
||||
TBS_NOTICKS | WS_TABSTOP,82,46,100,15
|
||||
EDITTEXT IDC_SPATIAL_TOLERANCE,87,20,40,14,ES_RIGHT |
|
||||
ES_AUTOHSCROLL
|
||||
LTEXT "Smoothing angle",IDC_STATIC,22,49,54,8
|
||||
LTEXT "Filter sharpness",IDC_STATIC,24,97,50,8
|
||||
LTEXT "Spatial tolerance",IDC_STATIC,21,24,54,8
|
||||
LTEXT "0",IDC_STATIC,88,63,8,8
|
||||
LTEXT "180",IDC_STATIC,169,62,13,8
|
||||
LTEXT "0%",IDC_STATIC,87,109,10,8
|
||||
LTEXT "100%",IDC_STATIC,167,108,18,8
|
||||
EDITTEXT IDC_SMOOTHING_ANGLE_VALUE,193,48,20,12,ES_RIGHT |
|
||||
ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER | NOT WS_BORDER,
|
||||
WS_EX_STATICEDGE
|
||||
EDITTEXT IDC_FILTER_SHARPNESS_VALUE,193,93,20,12,ES_RIGHT |
|
||||
ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER | NOT WS_BORDER,
|
||||
WS_EX_STATICEDGE
|
||||
LTEXT "x 0.0001 units (1-10 recommended)",IDC_STATIC,131,23,
|
||||
112,8
|
||||
LTEXT "degrees",IDC_STATIC,214,48,26,8
|
||||
LTEXT "%",IDC_STATIC,214,93,8,8
|
||||
LTEXT "%",IDC_STATIC,215,219,8,8
|
||||
LTEXT "texels / unit length",IDC_STATIC,141,190,59,8
|
||||
GROUPBOX "Vertex lighting",IDC_STATIC,7,83,265,40
|
||||
GROUPBOX "Light export",IDC_STATIC,7,295,198,46
|
||||
CONTROL "Do not export light names containing:",
|
||||
IDC_LIGHT_EXPORT_SELECTIVE,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,17,316,133,10
|
||||
EDITTEXT IDC_LIGHT_EXCLUSION_STRING,155,314,40,14,ES_AUTOHSCROLL
|
||||
END
|
||||
|
||||
IDD_PACKING DIALOGEX 0, 0, 241, 214
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Lightmap Packing Statistics"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Close",IDOK,184,185,50,14
|
||||
CONTROL "List1",IDC_PACKING_LIST,"SysListView32",LVS_REPORT |
|
||||
WS_BORDER | WS_TABSTOP,7,7,227,158,WS_EX_STATICEDGE
|
||||
END
|
||||
|
||||
IDD_MESH_STATUS DIALOG DISCARDABLE 0, 0, 278, 133
|
||||
STYLE WS_POPUP | WS_CAPTION
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Close",IDOK,221,111,50,14
|
||||
EDITTEXT IDC_MESH_STATUS_TEXT,7,7,264,88,ES_MULTILINE |
|
||||
ES_READONLY | WS_VSCROLL
|
||||
END
|
||||
|
||||
IDD_SELECTION DIALOG DISCARDABLE 0, 0, 186, 71
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Select"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,129,28,50,14
|
||||
LISTBOX IDC_SELECTION_LIST,7,7,113,57,LBS_NOINTEGRALHEIGHT |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_INSERT_SOLVE DIALOGEX 0, 0, 368, 95
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Insert Solve"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "GO",IDOK,300,7,61,14,WS_DISABLED
|
||||
PUSHBUTTON "Cancel",IDCANCEL,300,28,61,14
|
||||
PUSHBUTTON "More Options...",IDC_MORE_OPTIONS,300,74,61,14
|
||||
EDITTEXT IDC_SOLVE_FILE_LIST,61,17,149,17,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse...",IDC_BROWSE,216,19,50,14
|
||||
CONTROL "Only apply solve to mesh names",IDC_APPLY_SELECTIVE,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,49,118,10
|
||||
CONTROL "Blend procedural noise",IDC_BLEND_NOISE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,19,68,88,10
|
||||
EDITTEXT IDC_INCLUSION_STRING,205,47,20,18,ES_AUTOHSCROLL,
|
||||
WS_EX_STATICEDGE
|
||||
LTEXT "Solve file(s):",IDC_STATIC,19,22,39,8
|
||||
CONTROL "containing:",IDC_CONTAINING,"Button",BS_AUTORADIOBUTTON,
|
||||
140,46,51,10
|
||||
CONTROL "not containing:",IDC_NOT_CONTAINING,"Button",
|
||||
BS_AUTORADIOBUTTON,140,55,63,10
|
||||
END
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,6,0,0
|
||||
PRODUCTVERSION 3,6,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "LIGHTMAP MFC Application\0"
|
||||
VALUE "FileVersion", "3, 6, 0, 0\0"
|
||||
VALUE "InternalName", "LIGHTMAP\0"
|
||||
VALUE "LegalCopyright", "Copyright <20> 1999\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "LIGHTMAP.EXE\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "LIGHTMAP Application\0"
|
||||
VALUE "ProductVersion", "3, 6, 0, 0\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_ABOUTBOX, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 215
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 47
|
||||
END
|
||||
|
||||
IDD_OPTIONS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 272
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 341
|
||||
END
|
||||
|
||||
IDD_PACKING, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 234
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 199
|
||||
END
|
||||
|
||||
IDD_MESH_STATUS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 271
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 126
|
||||
END
|
||||
|
||||
IDD_SELECTION, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 64
|
||||
END
|
||||
|
||||
IDD_INSERT_SOLVE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 361
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 88
|
||||
END
|
||||
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 "Res\\LightMap.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "LightMap\n\nLightMap\n\n\nLightMap.Document\nLightMap Document"
|
||||
END
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
AFX_IDS_APP_TITLE "LightMap"
|
||||
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 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_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"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_INSERT_SOLVE "Insert one or more solve files into the active document"
|
||||
ID_TOOLS_OPTIONS "Specify how solve files are processed"
|
||||
ID_TOOLS_PACKING "View lightmap packing statistics"
|
||||
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
|
||||
#include "res\LightMap.rc2" // non-Microsoft Visual C++ edited resources
|
||||
#include "afxres.rc" // Standard components
|
||||
#endif
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
4032
Code/Tools/LightMap/LightMapDoc.cpp
Normal file
4032
Code/Tools/LightMap/LightMapDoc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
385
Code/Tools/LightMap/LightMapDoc.h
Normal file
385
Code/Tools/LightMap/LightMapDoc.h
Normal file
@@ -0,0 +1,385 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 7/24/01 4:53p $*
|
||||
* *
|
||||
* $Revision:: 39 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef LIGHTMAPDOC_H
|
||||
#define LIGHTMAPDOC_H
|
||||
|
||||
// Includes.
|
||||
#include "Rawfile.h"
|
||||
#include "w3d_file.h"
|
||||
#include "Chunk.h"
|
||||
#include "Lightscape.h"
|
||||
#include "meshmdl.h"
|
||||
|
||||
// Defines.
|
||||
#define MAX_SOLVE_COUNT 2
|
||||
#define TEMPORARY_SOLVE_FILENAME_COUNT 2
|
||||
|
||||
class LightMapDoc : public CDocument
|
||||
{
|
||||
public:
|
||||
|
||||
enum PrelitModeEnum {
|
||||
UNLIT,
|
||||
VERTEX,
|
||||
MULTI_PASS,
|
||||
MULTI_TEXTURE,
|
||||
COUNT
|
||||
};
|
||||
|
||||
// Flags for anomalies in a W3D model.
|
||||
// WARNING: Do not exceed no. of bits in unsigned long.
|
||||
enum MeshFlagsEnum {
|
||||
|
||||
// Unconditional errors.
|
||||
MESH_HIDDEN,
|
||||
MESH_PRELIT,
|
||||
MESH_NO_VERTEX_MATERIALS,
|
||||
MESH_NO_SHADERS,
|
||||
MESH_HAS_HIERARCHY,
|
||||
MESH_NOT_MODULATED_PRIMARY,
|
||||
MESH_HAS_SPECULAR,
|
||||
MESH_SPECULAR_TO_DIFFUSE,
|
||||
MESH_W3D_CHUNK_DEFORM,
|
||||
MESH_TWO_SIDED,
|
||||
MESH_HAS_EMISSIVE,
|
||||
MESH_HAS_SCG,
|
||||
|
||||
// Vertex specific errors.
|
||||
MESH_HAS_DIG,
|
||||
|
||||
// Lightmap multi-pass specific errors.
|
||||
MESH_TOO_MANY_PASSES,
|
||||
MESH_ALPHATEST,
|
||||
MESH_PASS_ZERO_DESTBLEND,
|
||||
|
||||
// Lightmap multi-texture specific errors.
|
||||
MESH_TOO_MANY_STAGES,
|
||||
|
||||
// General warnings.
|
||||
MESH_VERTEX_COLORING,
|
||||
|
||||
MESH_FLAG_COUNT,
|
||||
|
||||
// Unconditional errors.
|
||||
MESH_ERROR_MASK = (1 << MESH_HIDDEN) |
|
||||
(1 << MESH_PRELIT) |
|
||||
(1 << MESH_NO_VERTEX_MATERIALS) |
|
||||
(1 << MESH_NO_SHADERS) |
|
||||
(1 << MESH_HAS_HIERARCHY) |
|
||||
(1 << MESH_NOT_MODULATED_PRIMARY) |
|
||||
(1 << MESH_HAS_SPECULAR) |
|
||||
(1 << MESH_SPECULAR_TO_DIFFUSE) |
|
||||
(1 << MESH_W3D_CHUNK_DEFORM) |
|
||||
(1 << MESH_TWO_SIDED) |
|
||||
(1 << MESH_HAS_EMISSIVE) |
|
||||
(1 << MESH_HAS_SCG),
|
||||
|
||||
// Anomalies that will prevent a vertex solve from being inserted.
|
||||
MESH_VERTEX_ERROR_MASK = MESH_ERROR_MASK |
|
||||
(1 << MESH_HAS_DIG),
|
||||
|
||||
// Anomalies that will prevent a multi-pass lightmap solve from being inserted.
|
||||
MESH_MULTI_PASS_ERROR_MASK = MESH_ERROR_MASK |
|
||||
(1 << MESH_TOO_MANY_PASSES) |
|
||||
(1 << MESH_ALPHATEST) |
|
||||
(1 << MESH_PASS_ZERO_DESTBLEND),
|
||||
|
||||
// Anomalies that will prevent a multi-texture lightmap solve from being inserted.
|
||||
MESH_MULTI_TEXTURE_ERROR_MASK = MESH_ERROR_MASK |
|
||||
(1 << MESH_TOO_MANY_STAGES)
|
||||
|
||||
};
|
||||
|
||||
// Functions.
|
||||
bool Is_Open() {return (W3dFile != NULL);}
|
||||
bool Can_Insert_Solve() {return (CanInsertSolve && SolveCount < MAX_SOLVE_COUNT);}
|
||||
|
||||
void Insert_Solve (const char *solvedirectoryname, const char *solvefilenamelist, const char *inclusionstring, bool invertselection, bool blendnoise);
|
||||
|
||||
bool Solve_Inserted() {return (SolveCount > 0);}
|
||||
unsigned Mesh_Count() {return (MeshStatus.Count());}
|
||||
const char *Mesh_Name (unsigned index) {return (MeshStatus [index].Name);}
|
||||
|
||||
const char *Mesh_Anomalies_String (unsigned meshindex, bool verbose, StringBuilder &string);
|
||||
const char *Solve_Anomalies_String (unsigned meshindex, bool verbose, StringBuilder &string);
|
||||
const char *Vertex_Solve_Status_String (unsigned meshindex, StringBuilder &string);
|
||||
const char *Lightmap_Solve_Status_String (unsigned meshindex, StringBuilder &string);
|
||||
|
||||
private:
|
||||
|
||||
struct MeshInfoStruct {
|
||||
|
||||
public:
|
||||
|
||||
MeshInfoStruct (FileClass &meshfile);
|
||||
~MeshInfoStruct ();
|
||||
|
||||
unsigned Lightmap_Vertex_Material_Count() const {return (1);}
|
||||
unsigned Lightmap_Shader_Count() const {return (1);}
|
||||
|
||||
W3dMeshHeader3Struct Header;
|
||||
W3dMaterialInfoStruct MaterialInfo [PrelitModeEnum::COUNT];
|
||||
ChunkClass *TriangleChunk;
|
||||
ChunkClass *VertexChunk;
|
||||
DynamicVectorClass <W3dVertexMaterialStruct> *VertexMaterials [PrelitModeEnum::COUNT];
|
||||
ChunkClass *ShaderChunk [PrelitModeEnum::COUNT];
|
||||
ChunkClass *ShaderIdChunk [PrelitModeEnum::COUNT][MeshMatDescClass::MAX_PASSES];
|
||||
ChunkClass *SCGChunk [PrelitModeEnum::COUNT][MeshMatDescClass::MAX_PASSES];
|
||||
bool SCGsExist;
|
||||
bool DIGsExist;
|
||||
bool DeformExists;
|
||||
bool IsMultiStage;
|
||||
bool VertexColorsExist;
|
||||
|
||||
private:
|
||||
|
||||
void Parse_Vertex_Materials (ChunkLoadClass &w3dchunk, unsigned prelitmode);
|
||||
void Parse_Material_Pass (ChunkLoadClass &w3dchunk, unsigned prelitmode, unsigned materialpass);
|
||||
void Parse_Prelit_Chunk (ChunkLoadClass &w3dchunk, unsigned prelitmode);
|
||||
};
|
||||
|
||||
struct MeshAnomalyStruct {
|
||||
|
||||
public:
|
||||
|
||||
MeshAnomalyStruct (const MeshInfoStruct &meshinfo);
|
||||
|
||||
unsigned long MeshAnomalies;
|
||||
};
|
||||
|
||||
struct MeshStatusStruct {
|
||||
|
||||
// Equality operator.
|
||||
bool operator == (const MeshStatusStruct &m) {
|
||||
return (strcmp (Name, m.Name) == 0);
|
||||
}
|
||||
|
||||
// Inequality operator.
|
||||
bool operator != (const MeshStatusStruct &m) {
|
||||
return (!(*this == m));
|
||||
}
|
||||
|
||||
MeshStatusStruct() {}
|
||||
|
||||
MeshStatusStruct (const char *name, unsigned trianglecount, unsigned long meshanomalies)
|
||||
{
|
||||
strcpy (Name, name);
|
||||
TriangleCount = trianglecount;
|
||||
MeshAnomalies = meshanomalies;
|
||||
InsertedFlags = 0;
|
||||
}
|
||||
|
||||
bool Can_Insert_Vertex_Solve() {
|
||||
return (((MeshAnomalies & MESH_VERTEX_ERROR_MASK) == 0) && SolveStatistics.Valid_Vertex_Solve());
|
||||
}
|
||||
|
||||
bool Can_Insert_Multi_Pass_Solve() {
|
||||
return (((MeshAnomalies & MESH_MULTI_PASS_ERROR_MASK) == 0) && SolveStatistics.Valid_Lightmap_Solve());
|
||||
}
|
||||
|
||||
bool Can_Insert_Multi_Texture_Solve() {
|
||||
return (((MeshAnomalies & MESH_MULTI_TEXTURE_ERROR_MASK) == 0) && SolveStatistics.Valid_Lightmap_Solve());
|
||||
}
|
||||
|
||||
bool Inserted_Vertex_Solve() {return ((InsertedFlags & W3D_MESH_FLAG_PRELIT_VERTEX) != 0);}
|
||||
bool Inserted_Multi_Pass_Solve() {return ((InsertedFlags & W3D_MESH_FLAG_PRELIT_LIGHTMAP_MULTI_PASS) != 0);}
|
||||
bool Inserted_Multi_Texture_Solve() {return ((InsertedFlags & W3D_MESH_FLAG_PRELIT_LIGHTMAP_MULTI_TEXTURE) != 0);}
|
||||
|
||||
unsigned long Prelit_Flags() {
|
||||
|
||||
unsigned long prelitflags;
|
||||
|
||||
// If a vertex solve cannot be inserted substitute an unlit solve.
|
||||
if (Can_Insert_Vertex_Solve()) {
|
||||
prelitflags = W3D_MESH_FLAG_PRELIT_VERTEX;
|
||||
} else {
|
||||
prelitflags = W3D_MESH_FLAG_PRELIT_UNLIT;
|
||||
}
|
||||
if (Can_Insert_Multi_Pass_Solve()) prelitflags |= W3D_MESH_FLAG_PRELIT_LIGHTMAP_MULTI_PASS;
|
||||
if (Can_Insert_Multi_Texture_Solve()) prelitflags |= W3D_MESH_FLAG_PRELIT_LIGHTMAP_MULTI_TEXTURE;
|
||||
return (prelitflags);
|
||||
}
|
||||
|
||||
char Name [W3D_NAME_LEN];
|
||||
unsigned TriangleCount;
|
||||
unsigned long MeshAnomalies;
|
||||
unsigned long InsertedFlags; // Which prelit mode types were inserted with the most recent solve?
|
||||
SolveStatistics SolveStatistics;
|
||||
};
|
||||
|
||||
struct SplitVertexInfoStruct {
|
||||
|
||||
public:
|
||||
SplitVertexInfoStruct (const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve);
|
||||
~SplitVertexInfoStruct();
|
||||
|
||||
unsigned Vertex_Count() const {return (VertexCount);}
|
||||
uint32 Remap (unsigned v) const {ASSERT (v < Vertex_Count()); return (RemapTable [v]);}
|
||||
uint32 Index (unsigned v) const {ASSERT (v < FaceVertexCount); return (IndexTable [v]);}
|
||||
W3dTexCoordStruct *UV (unsigned v) const {ASSERT (v < Vertex_Count()); return (UVPtrTable [v]);}
|
||||
|
||||
private:
|
||||
SplitVertexInfoStruct() {ASSERT (false);}
|
||||
|
||||
unsigned VertexCount;
|
||||
unsigned FaceVertexCount;
|
||||
uint32 *RemapTable;
|
||||
uint32 *IndexTable;
|
||||
W3dTexCoordStruct *UVTable;
|
||||
W3dTexCoordStruct **UVPtrTable;
|
||||
};
|
||||
|
||||
struct MeshReorderStruct {
|
||||
|
||||
// Equality operator.
|
||||
bool operator == (const MeshReorderStruct &m) {
|
||||
return ((Chunk == m.Chunk) && (Position == m.Position));
|
||||
}
|
||||
|
||||
// Inequality operator.
|
||||
bool operator != (const MeshReorderStruct &m) {
|
||||
return (!(*this == m));
|
||||
}
|
||||
|
||||
public:
|
||||
ChunkClass *Chunk;
|
||||
Vector3 Position;
|
||||
};
|
||||
|
||||
// Functions.
|
||||
bool Check_Document();
|
||||
|
||||
void Reorder();
|
||||
|
||||
void Optimize();
|
||||
void Optimize_Prelit_Vertex_Material_Pass (ChunkLoadClass &w3dchunk, ChunkSaveClass &optimizechunk);
|
||||
|
||||
void Rename_Mesh (ChunkLoadClass &loadchunk, ChunkSaveClass &savechunk, const char *filename, const char *lightmapdirectory);
|
||||
void Rename_Mesh_Header (ChunkLoadClass &loadchunk, ChunkSaveClass &savechunk, const char *filename);
|
||||
void Rename_Prelit_Chunks (ChunkLoadClass &loadchunk, ChunkSaveClass &savechunk, const char *lightmapdirectory);
|
||||
void Rename_Lightmaps (ChunkLoadClass &loadchunk, ChunkSaveClass &savechunk, const char *lightmapdirectory);
|
||||
void Rename_Collection (ChunkLoadClass &loadchunk, ChunkSaveClass &savechunk, const char *filename);
|
||||
void Rename_HLOD (ChunkLoadClass &loadchunk, ChunkSaveClass &savechunk, const char *filename);
|
||||
void Rename_Dazzle (ChunkLoadClass &loadchunk, ChunkSaveClass &savechunk, const char *filename);
|
||||
|
||||
void Save_Lights (const char *pathname);
|
||||
|
||||
void Translate_Mesh_Header3 (ChunkLoadClass &w3dchunk, unsigned long prelitflags, ChunkSaveClass &solvechunk, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Vertices (ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Vertex_Normals (ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Vertex_Influences (ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Triangles (ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Vertex_Shade_Indices (ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Insert_Solve (PrelitModeEnum inputmode, FileClass &meshfile, PrelitModeEnum outputmode, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Insert_Solve (PrelitModeEnum inputmode, ChunkLoadClass &w3dchunk, PrelitModeEnum outputmode, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Material_Info (PrelitModeEnum inputmode, ChunkLoadClass &w3dchunk, PrelitModeEnum outputmode, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve);
|
||||
void Translate_Vertex_Materials (PrelitModeEnum inputmode, ChunkLoadClass &w3dchunk, PrelitModeEnum outputmode, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo);
|
||||
void Translate_Shaders (PrelitModeEnum inputmode, ChunkLoadClass &w3dchunk, PrelitModeEnum outputmode, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo);
|
||||
void Translate_Textures (ChunkLoadClass &w3dchunk, PrelitModeEnum outputmode, ChunkSaveClass &solvechunk, const LightscapeMeshSolve &meshsolve);
|
||||
void Add_Lightmap_Textures (ChunkSaveClass &solvechunk, const LightscapeMeshSolve &meshsolve);
|
||||
void Translate_Material_Pass (PrelitModeEnum inputmode, ChunkLoadClass &w3dchunk, unsigned materialpass, PrelitModeEnum outputmode, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_DCGs (ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_DIGs (PrelitModeEnum inputmode, ChunkLoadClass &w3dchunk, unsigned materialpass, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Add_DIGs (PrelitModeEnum inputmode, unsigned materialpass, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Vertex_Material_IDs (PrelitModeEnum inputmode, ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Texture_Stage (ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Stage_Texcoords (ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Add_Lightmap_Material_Pass (PrelitModeEnum inputmode, unsigned materialpass, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Add_Lightmap_Stage (PrelitModeEnum inputmode, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Translate_Lightmap_Stage (PrelitModeEnum inputmode, ChunkLoadClass &w3dchunk, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Add_Lightmap_Stage_Chunks (PrelitModeEnum inputmode, ChunkSaveClass &solvechunk, const MeshInfoStruct &meshinfo, const LightscapeMeshSolve &meshsolve, const SplitVertexInfoStruct &splitvertexinfo);
|
||||
void Copy_Chunk (ChunkLoadClass &loadchunk, ChunkSaveClass &savechunk);
|
||||
|
||||
// Member data.
|
||||
char DocumentName [_MAX_FNAME]; // Name of this document.
|
||||
RawFileClass *W3dFile; // Ptr to current open w3d document.
|
||||
unsigned MeshCount; // Total no. of meshes in this w3d document.
|
||||
unsigned TriangleCount; // Total no. of triangles in this w3d document.
|
||||
bool CanInsertSolve; // Can a solve be inserted?
|
||||
unsigned SolveCount; // No. of solves inserted so far.
|
||||
DynamicVectorClass <MeshStatusStruct> MeshStatus; // Mesh information database.
|
||||
DynamicVectorClass <LightClass*> Lights [MAX_SOLVE_COUNT]; // All active lights in the solves.
|
||||
|
||||
// Static data.
|
||||
static const char *_TemporarySolveFilename [TEMPORARY_SOLVE_FILENAME_COUNT];
|
||||
static const char *_TemporaryOptimizeFilename;
|
||||
static const char *_TemporaryReorderFilename;
|
||||
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
protected: // create from serialization only
|
||||
LightMapDoc();
|
||||
DECLARE_DYNCREATE(LightMapDoc)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(LightMapDoc)
|
||||
public:
|
||||
virtual BOOL OnNewDocument();
|
||||
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
|
||||
virtual void Serialize(CArchive& ar);
|
||||
virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
|
||||
virtual void DeleteContents();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~LightMapDoc();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(LightMapDoc)
|
||||
afx_msg void OnFileSave();
|
||||
afx_msg void OnFileSaveAs();
|
||||
afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateFileSaveAs(CCmdUI* pCmdUI);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
||||
#endif // LIGHTMAPDOC_H
|
||||
3387
Code/Tools/LightMap/LightMapPacker.cpp
Normal file
3387
Code/Tools/LightMap/LightMapPacker.cpp
Normal file
File diff suppressed because it is too large
Load Diff
749
Code/Tools/LightMap/LightMapPacker.h
Normal file
749
Code/Tools/LightMap/LightMapPacker.h
Normal file
@@ -0,0 +1,749 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 6/06/01 5:40p $*
|
||||
* *
|
||||
* $Revision:: 35 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef _LIGHTMAPPACKER_H
|
||||
#define _LIGHTMAPPACKER_H
|
||||
|
||||
// Includes.
|
||||
#include "ProceduralTexture.h"
|
||||
#include "StringBuilder.h"
|
||||
#include "Triangle.h"
|
||||
#include "vector.h"
|
||||
#include "vector2.h"
|
||||
#include "matrix3.h"
|
||||
#include "listnode.h"
|
||||
#include "Targa.h"
|
||||
#include "w3d_file.h"
|
||||
#include <srPixelConvert.hpp>
|
||||
#include <srColorSurface.hpp>
|
||||
|
||||
|
||||
// Defines.
|
||||
#define UNPACKED_TEXEL_BYTE_COUNT 4 // No. of bytes for internal unpacked texel format (ARGB).
|
||||
|
||||
|
||||
class ColorSurface : public srColorSurface
|
||||
{
|
||||
public:
|
||||
ColorSurface (srPixelConvert::e_surfaceType pixelformat, short width, short height)
|
||||
: srColorSurface (pixelformat, width, height)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
class TrueColorTarga : public Targa
|
||||
{
|
||||
public:
|
||||
|
||||
// Public functions.
|
||||
TrueColorTarga();
|
||||
TrueColorTarga (unsigned width, unsigned height, unsigned pixeldepth);
|
||||
TrueColorTarga (unsigned width, unsigned height, unsigned pixeldepth, const W3dRGBStruct &clearcolor);
|
||||
|
||||
void Reformat (unsigned width, unsigned height, unsigned pixeldepth);
|
||||
void Reformat (unsigned width, unsigned height, unsigned pixeldepth, const W3dRGBStruct &clearcolor);
|
||||
|
||||
unsigned Width() const {return (Header.Width);}
|
||||
unsigned Height() const {return (Header.Height);}
|
||||
unsigned Pixel_Depth() const {return (Header.PixelDepth);}
|
||||
void Scale (unsigned width, unsigned height) {Scale (*this, width, height);}
|
||||
void Scale (TrueColorTarga &destination) {Scale (destination, destination.Width(), destination.Height());}
|
||||
void Scale (float filtererror) {Scale (*this, filtererror);}
|
||||
void Transpose() {Transpose (*this);}
|
||||
|
||||
void Pad (unsigned padwidth, unsigned padheight, const W3dRGBStruct &padcolor, DynamicVectorClass <PackingTriangle*> &triangleptrs)
|
||||
{
|
||||
Pad (*this, padwidth, padheight, padcolor, triangleptrs);
|
||||
}
|
||||
|
||||
char *Load (const char *pathname);
|
||||
char *Save (const char *pathname);
|
||||
void Blit (TrueColorTarga &destination, unsigned x, unsigned y);
|
||||
void Scale (TrueColorTarga &destination, unsigned width, unsigned height);
|
||||
int Compare (TrueColorTarga &comparison, float epsilon);
|
||||
int Compare (TrueColorTarga &comparison, unsigned x, unsigned y, float epsilon);
|
||||
bool Fill (const W3dRGBStruct &fillcolor);
|
||||
void Add (TrueColorTarga &targa);
|
||||
void Rasterize (TrueColorTarga &destination, const W3dRGBStruct &fillcolor, unsigned vertexcount, const W3dRGBStruct *vertexcolors, Vector2 *uvs);
|
||||
|
||||
bool Get_Color (const Vector2 &t, W3dRGBStruct &color) const;
|
||||
bool Set_Color (unsigned x, unsigned y, const W3dRGBStruct &color);
|
||||
|
||||
protected:
|
||||
|
||||
enum TransposeEnum {
|
||||
UNTRANSPOSED,
|
||||
TRANSPOSED,
|
||||
TRANSPOSE_COUNT
|
||||
};
|
||||
|
||||
struct UnpackedTexelStruct {
|
||||
|
||||
UnpackedTexelStruct () {}
|
||||
UnpackedTexelStruct (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||
{
|
||||
Set (r, g, b, a);
|
||||
}
|
||||
|
||||
void Set (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||
{
|
||||
Byte [0] = a;
|
||||
Byte [1] = r;
|
||||
Byte [2] = g;
|
||||
Byte [3] = b;
|
||||
}
|
||||
|
||||
unsigned char Alpha() const {return (Byte [0]);}
|
||||
unsigned char Red() const {return (Byte [1]);}
|
||||
unsigned char Green() const {return (Byte [2]);}
|
||||
unsigned char Blue() const {return (Byte [3]);}
|
||||
|
||||
// Equality operator.
|
||||
bool operator == (const UnpackedTexelStruct &t) {
|
||||
ASSERT (sizeof (unsigned long) == sizeof (Byte));
|
||||
return (*((unsigned long*) Byte) == *((unsigned long*) t.Byte));
|
||||
}
|
||||
|
||||
// Inequality operator.
|
||||
bool operator != (const UnpackedTexelStruct &t) {
|
||||
return (!(*this == t));
|
||||
}
|
||||
|
||||
// Addition operator.
|
||||
UnpackedTexelStruct operator += (UnpackedTexelStruct t)
|
||||
{
|
||||
Byte [0] = MIN (((unsigned) Byte [0]) + ((unsigned) t.Byte [0]), (unsigned) UCHAR_MAX);
|
||||
Byte [1] = MIN (((unsigned) Byte [1]) + ((unsigned) t.Byte [1]), (unsigned) UCHAR_MAX);
|
||||
Byte [2] = MIN (((unsigned) Byte [2]) + ((unsigned) t.Byte [2]), (unsigned) UCHAR_MAX);
|
||||
Byte [3] = MIN (((unsigned) Byte [3]) + ((unsigned) t.Byte [3]), (unsigned) UCHAR_MAX);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
// Public data.
|
||||
unsigned char Byte [UNPACKED_TEXEL_BYTE_COUNT];
|
||||
};
|
||||
|
||||
struct PointStruct {
|
||||
|
||||
// Equality operator.
|
||||
bool operator == (const PointStruct &p) {
|
||||
return ((X == p.X) && (Y == p.Y));
|
||||
}
|
||||
|
||||
// Inequality operator.
|
||||
bool operator != (const PointStruct &p) {
|
||||
return (!(*this == p));
|
||||
}
|
||||
|
||||
// Public data.
|
||||
int X;
|
||||
int Y;
|
||||
};
|
||||
|
||||
void Clear (const UnpackedTexelStruct &cleartexel);
|
||||
|
||||
private:
|
||||
|
||||
// Inlines.
|
||||
unsigned char *Get_Texel (int x, int y) const;
|
||||
UnpackedTexelStruct *Unpack_Texel (unsigned char *packedtexelptr, unsigned packedbytespertexel, UnpackedTexelStruct &unpackedtexel) const;
|
||||
void Pack_Texel (const UnpackedTexelStruct &unpackedtexel, unsigned char *packedtexelptr, unsigned packedbytespertexel);
|
||||
|
||||
// Static functions.
|
||||
static srPixelConvert::e_surfaceType Pixel_Format (unsigned pixeldepth);
|
||||
|
||||
void Scale (TrueColorTarga &destination, float filtererror);
|
||||
void Transpose (TrueColorTarga &destination);
|
||||
bool Fill_Four_Connected (unsigned x, unsigned y, const UnpackedTexelStruct &filltexel, DynamicVectorClass <PointStruct> &fourconnectedarray);
|
||||
void Pad (TrueColorTarga &destination, unsigned verticalpadthickness, unsigned horizontalpadthickness, const W3dRGBStruct &padcolor, DynamicVectorClass <PackingTriangle*> &triangleptrs);
|
||||
};
|
||||
|
||||
|
||||
class Page : public TrueColorTarga
|
||||
{
|
||||
public:
|
||||
|
||||
// Public functions.
|
||||
Page (unsigned bitdepth, const W3dRGBStruct &clearcolor);
|
||||
~Page ();
|
||||
|
||||
bool Pack (TrueColorTarga &targa, float epsilon, DynamicVectorClass <PackingTriangle*> &triangleptrs);
|
||||
|
||||
|
||||
float Packing_Efficiency() const
|
||||
{
|
||||
return (((float) UsedTexelCount) / (((unsigned) Width()) * ((unsigned) Height())));
|
||||
}
|
||||
|
||||
float Replica_Efficiency() const
|
||||
{
|
||||
return (((float) ReplicaTexelCount) / (((unsigned) Width()) * ((unsigned) Height())));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
class Region : public GenericNode {
|
||||
|
||||
public:
|
||||
|
||||
// Public functions.
|
||||
Region () {}
|
||||
Region (const Region ®ion)
|
||||
{
|
||||
Set (region.X0, region.Y0, region.X1, region.Y1);
|
||||
}
|
||||
|
||||
unsigned Width () {return (X1 - X0 + 1);}
|
||||
unsigned Height() {return (Y1 - Y0 + 1);}
|
||||
|
||||
void Set (unsigned x0, unsigned y0, unsigned x1, unsigned y1)
|
||||
{
|
||||
X0 = x0; Y0 = y0; X1 = x1; Y1 = y1;
|
||||
}
|
||||
|
||||
bool Accomodates (unsigned width, unsigned height, Region &targetregion);
|
||||
bool Intersects (const Region &targetregion, unsigned &subregioncount, Region **subregions);
|
||||
|
||||
// Public data.
|
||||
unsigned X0, Y0;
|
||||
unsigned X1, Y1;
|
||||
};
|
||||
|
||||
// Private functions.
|
||||
bool Replica_Region (TrueColorTarga &targa, float epsilon, Region &replicaregion);
|
||||
bool Lowest_Cost_Region (TrueColorTarga &targa, unsigned &lowestcost, Region &lowestcostregion);
|
||||
void Insert_Region (const Region &insertionregion);
|
||||
bool Contains (const Region &testregion);
|
||||
|
||||
// Statistics functions.
|
||||
void Reset_Statistics();
|
||||
|
||||
// Private data.
|
||||
GenericList VacantRegionList;
|
||||
GenericList UsedRegionList;
|
||||
|
||||
// Statistics counters.
|
||||
unsigned AssetCount;
|
||||
unsigned UsedTexelCount;
|
||||
unsigned ReplicaTexelCount;
|
||||
};
|
||||
|
||||
|
||||
class TargaLoader {
|
||||
|
||||
public:
|
||||
|
||||
// Public functions.
|
||||
TargaLoader (float samplerate, W3dRGBStruct fillcolor);
|
||||
~TargaLoader();
|
||||
|
||||
TrueColorTarga *Load (const Triangle &triangle);
|
||||
|
||||
private:
|
||||
|
||||
struct TargaCacheStruct {
|
||||
|
||||
TargaCacheStruct()
|
||||
{
|
||||
Ptr = NULL;
|
||||
}
|
||||
|
||||
~TargaCacheStruct()
|
||||
{
|
||||
if (Ptr != NULL) delete Ptr;
|
||||
}
|
||||
|
||||
// Equality operator.
|
||||
bool operator == (const TargaCacheStruct &t) {
|
||||
return ((ID == t.ID) && (Ptr == t.Ptr));
|
||||
}
|
||||
|
||||
// Inequality operator.
|
||||
bool operator != (const TargaCacheStruct &t) {
|
||||
return (!(*this == t));
|
||||
}
|
||||
|
||||
// Data.
|
||||
unsigned ID;
|
||||
TrueColorTarga *Ptr;
|
||||
};
|
||||
|
||||
// Private functions.
|
||||
TargaLoader() {}
|
||||
|
||||
unsigned Index (unsigned id)
|
||||
{
|
||||
return (id % ((unsigned) Cache.Length()));
|
||||
}
|
||||
|
||||
// Private data.
|
||||
VectorClass <TargaCacheStruct> Cache; // A simple array of targacache objects.
|
||||
DynamicVectorClass <TrueColorTarga*> CleanupList; // List of targas that have been displaced from the cache but cannot
|
||||
// yet be deleted because they may still be referenced.
|
||||
float SampleRate; // No. of texels per unit length.
|
||||
W3dRGBStruct FillColor; // Color to replace during fill operations.
|
||||
};
|
||||
|
||||
|
||||
class TrianglePacker {
|
||||
|
||||
public:
|
||||
|
||||
TrianglePacker (const PackingTriangle *principaltriangleptr, const DynamicVectorClass <Triangle> &adjtriangles, unsigned groupid, unsigned edgeblendthickness, float samplerate, W3dRGBStruct fillcolor);
|
||||
|
||||
DynamicVectorClass <PackingTriangle*> &Principal_Triangles() {return (PrincipalTriangles);}
|
||||
|
||||
// Query functions.
|
||||
unsigned Width() const {return (UpperBound.U - LowerBound.U);}
|
||||
unsigned Height() const {return (UpperBound.V - LowerBound.V);}
|
||||
|
||||
// Operations.
|
||||
TrianglePacker *Merge (const TrianglePacker &trianglepacker);
|
||||
void Rasterize (TargaLoader &targaloader, ProceduralTexture *proceduraltexture, TrueColorTarga &rasterizedtarga);
|
||||
|
||||
// Statistics.
|
||||
unsigned Adjacent_Face_Count() const
|
||||
{
|
||||
return (AdjacentTriangles [ADJACENT_PROJECTION_COMMON].Count() +
|
||||
AdjacentTriangles [ADJACENT_PROJECTION_VALID].Count() +
|
||||
AdjacentTriangles [ADJACENT_PROJECTION_NONE].Count());
|
||||
}
|
||||
|
||||
unsigned Blended_Face_Count() const
|
||||
{
|
||||
return (AdjacentTriangles [ADJACENT_PROJECTION_COMMON].Count() +
|
||||
AdjacentTriangles [ADJACENT_PROJECTION_VALID].Count());
|
||||
}
|
||||
|
||||
float Edge_Blend_Area() const;
|
||||
|
||||
private:
|
||||
|
||||
enum ProjectionEnum {
|
||||
PROJECTION_Y_POSITIVE,
|
||||
PROJECTION_Y_NEGATIVE,
|
||||
PROJECTION_Z_POSITIVE,
|
||||
PROJECTION_Z_NEGATIVE,
|
||||
PROJECTION_X_POSITIVE,
|
||||
PROJECTION_X_NEGATIVE,
|
||||
PROJECTION_COUNT
|
||||
};
|
||||
|
||||
enum AdjacentProjectionEnum {
|
||||
ADJACENT_PROJECTION_COMMON, // Adjacent triangles that use the same projection as this object.
|
||||
ADJACENT_PROJECTION_VALID, // Adjacent triangles that map to a different projection but have non-zero area if object's projection is used.
|
||||
ADJACENT_PROJECTION_NONE, // Adjacent triangles that cannot be projected using object's projection.
|
||||
ADJACENT_PROJECTION_COUNT
|
||||
};
|
||||
|
||||
class ProjectionTriangle {
|
||||
|
||||
public:
|
||||
|
||||
// Public functions.
|
||||
ProjectionTriangle() {}
|
||||
ProjectionTriangle (const Vector3 *points, const Vector2 *sourceuvs, const TrueColorTarga *sourcetargaptr, const Vector2 *projectionuvs);
|
||||
|
||||
// Public data.
|
||||
Vector3 Points [Triangle::VERTICES_COUNT];
|
||||
Vector2 SourceUVs [Triangle::VERTICES_COUNT];
|
||||
TrueColorTarga *SourceTargaPtr;
|
||||
Vector2 ProjectionUVs [Triangle::VERTICES_COUNT];
|
||||
};
|
||||
|
||||
class SampleSurface {
|
||||
|
||||
public:
|
||||
|
||||
// Public functions.
|
||||
SampleSurface (unsigned width, unsigned height, ProceduralTexture *blendtexture = NULL);
|
||||
|
||||
bool Sample (const Vector2 &samplepoint, const ProjectionTriangle &projectiontriangle, unsigned priority);
|
||||
bool Sample (float alpha, float beta, const ProjectionTriangle &projectiontriangle, unsigned priority);
|
||||
|
||||
bool Get_Color (unsigned x, unsigned y, W3dRGBStruct &color)
|
||||
{
|
||||
SampleStruct *sampleptr;
|
||||
|
||||
ASSERT ((x < Width) && (y < Height));
|
||||
sampleptr = Surface + (y * Width + x);
|
||||
if (sampleptr->Count > 0) {
|
||||
|
||||
float oocount;
|
||||
unsigned r, g, b;
|
||||
|
||||
oocount = 1.0f / sampleptr->Count;
|
||||
r = sampleptr->Red * oocount;
|
||||
g = sampleptr->Green * oocount;
|
||||
b = sampleptr->Blue * oocount;
|
||||
color.Set ((uint8) MIN (r, UCHAR_MAX), (uint8) MIN (g, UCHAR_MAX), (uint8) MIN (b, UCHAR_MAX));
|
||||
return (true);
|
||||
} else {
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned Priority (unsigned x, unsigned y)
|
||||
{
|
||||
SampleStruct *sampleptr;
|
||||
|
||||
ASSERT ((x < Width) && (y < Height));
|
||||
sampleptr = Surface + (y * Width + x);
|
||||
return (sampleptr->Priority);
|
||||
}
|
||||
|
||||
float Sampling_Ratio() {return (((float) SampledTexelCount) / ((float) (Width * Height)));}
|
||||
|
||||
private:
|
||||
|
||||
struct SampleStruct {
|
||||
unsigned Red;
|
||||
unsigned Green;
|
||||
unsigned Blue;
|
||||
unsigned Count;
|
||||
unsigned Priority;
|
||||
};
|
||||
|
||||
SampleSurface() {}
|
||||
|
||||
unsigned Width;
|
||||
unsigned Height;
|
||||
unsigned SampledTexelCount;
|
||||
SampleStruct *Surface;
|
||||
ProceduralTexture *BlendTexture;
|
||||
};
|
||||
|
||||
// Private functions.
|
||||
TrianglePacker() {}
|
||||
TrianglePacker (const TrianglePacker &trianglepacker); // Copy constructor.
|
||||
void Set_Bounds();
|
||||
bool Can_Project (const Vector3 &normal);
|
||||
Vector2 Project (const Vector3 &point) const;
|
||||
// void Get_Projection_Triangle (const Triangle &triangle, ProjectionTriangleStruct &projectiontriangle);
|
||||
bool Sample (const Vector2 &samplepoint, const ProjectionTriangle &projectiontriangle, W3dRGBStruct &color);
|
||||
|
||||
static ProjectionEnum Get_Projection (const Vector3 &normal);
|
||||
|
||||
// Private data.
|
||||
ProjectionEnum Projection; // Texture projection to be used for rasterization.
|
||||
unsigned GroupID;
|
||||
unsigned EdgeBlendThickness;
|
||||
float SampleRate; // No. of texels per unit length.
|
||||
W3dRGBStruct FillColor; // Color to replace during fill operations.
|
||||
DynamicVectorClass <PackingTriangle*> PrincipalTriangles; // Set of triangles that will be rasterized in their entirety (ie. not edge blended).
|
||||
DynamicVectorClass <Triangle> AdjacentTriangles [ADJACENT_PROJECTION_COUNT]; // Set of triangles that will be edge-blended.
|
||||
Vector2 LowerBound; // Lower bound of all principal triangle points projected onto the texel plane.
|
||||
Vector2 UpperBound; // Upper bound of all principal triangle points projected onto the texel plane.
|
||||
};
|
||||
|
||||
|
||||
class LightmapPacker {
|
||||
|
||||
public:
|
||||
|
||||
enum ThicknessEnum {
|
||||
EDGE_BLEND_THICKNESS = 2 // No. of texels to pad around every packed map.
|
||||
// NOTE: The edge blend thickness is designed to prevent
|
||||
// bleeding between adjacent maps under mip-mapping. The
|
||||
// no, of allowable mip-maps is dependant upon this
|
||||
// thickness value.
|
||||
};
|
||||
|
||||
enum StatisticsEnum {
|
||||
|
||||
STATISTICS_PAGE_FORMAT,
|
||||
STATISTICS_LIGHTMAPS_PROCESSED,
|
||||
STATISTICS_ADJACENT_FACE_BLEND_PERCENTAGE,
|
||||
STATISTICS_EDGE_BLEND_EFFICIENCY,
|
||||
STATISTICS_SCALING_EFFICIENCY,
|
||||
STATISTICS_PAGES_CREATED,
|
||||
STATISTICS_PACKING_EFFICIENCY,
|
||||
STATISTICS_CULLING_EFFICIENCY,
|
||||
STATISTICS_TEXTURE_SWAP_EFFICIENCY,
|
||||
STATISTICS_OVERSIZE_LIGHTMAPS,
|
||||
STATISTICS_COUNT,
|
||||
|
||||
STATISTICS_STRING_SIZE = 32 // Size of statistic string in bytes.
|
||||
};
|
||||
|
||||
LightmapPacker();
|
||||
Finish();
|
||||
~LightmapPacker();
|
||||
|
||||
void Submit (PackingTriangle *principaltriangleptr, const DynamicVectorClass <Triangle> &adjtriangles);
|
||||
TrianglePacker *Merge (TrianglePacker *trianglepackerptr);
|
||||
void Pack (ProceduralTexture *proceduraltexture = NULL);
|
||||
void Pack (TrueColorTarga &targa, DynamicVectorClass <PackingTriangle*> &triangleptrs);
|
||||
|
||||
static const char *Lightmap_Pathname (unsigned pageindex);
|
||||
static const char *Asset_Directory();
|
||||
static const char *Asset_Directory (const char *filename);
|
||||
static void Delete_Assets();
|
||||
static void Copy_Assets (const char *pathname);
|
||||
static const char *Get_Statistic (unsigned index) {ASSERT (index < STATISTICS_COUNT); return (_Statistics [index]);}
|
||||
|
||||
private:
|
||||
|
||||
// Statistics functions.
|
||||
void Reset_Statistics();
|
||||
void Update_Statistics (const Page &page);
|
||||
void Update_Statistics (const TrianglePacker &trianglepacker);
|
||||
void Collate_Statistics();
|
||||
|
||||
W3dRGBStruct FillColor; // Color used to pad unused texels in lightmaps.
|
||||
float ScaleFactor; // Global lightmap scaling factor (0.0...1.0).
|
||||
float FilterError; // Maximum allowed variance between a color component of original
|
||||
// lightmap and that of packed lightmap, expressed as a fraction
|
||||
// of color component's total range ie. a setting of 0.0 will
|
||||
// allow no variance (packed lightmap must match original) and
|
||||
// a setting of 1.0 allows complete variance.
|
||||
float SampleRate; // Sample rate used by rasterizers (such as Edge_Blend()) in texels per unit length.
|
||||
unsigned PageBitDepth; // Bit depth of page texels.
|
||||
|
||||
|
||||
int CurrentPageIndex; // Current page (-1 indicates no page exists).
|
||||
|
||||
DynamicVectorClass <TrianglePacker*> TrianglePackerPtrs;
|
||||
DynamicVectorClass <Page*> PagePtrs;
|
||||
TextureNameNode *PlaceholderTextureNameNodePtr;
|
||||
|
||||
// Statistics counters.
|
||||
unsigned FaceCount;
|
||||
unsigned LightmapCount;
|
||||
unsigned AdjacentFaceCount;
|
||||
unsigned BlendedFaceCount;
|
||||
double EdgeBlendAreaSum;
|
||||
__int64 UnscaledTexelCount;
|
||||
__int64 ScaledTexelCount;
|
||||
double PackingEfficiencySum;
|
||||
double ReplicaEfficiencySum;
|
||||
unsigned TextureSwapCount;
|
||||
unsigned OversizeCount;
|
||||
unsigned AllFillColorCount;
|
||||
|
||||
static unsigned _BasePageIndex;
|
||||
static char _Statistics [STATISTICS_COUNT][STATISTICS_STRING_SIZE];
|
||||
};
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* TrueColorTarga::Get_Color -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/27/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
inline bool TrueColorTarga::Get_Color (const Vector2 &t, W3dRGBStruct &color) const
|
||||
{
|
||||
int x, y;
|
||||
unsigned char *texelptr;
|
||||
UnpackedTexelStruct unpackedtexel;
|
||||
|
||||
x = t.U * Width();
|
||||
y = t.V * Height();
|
||||
texelptr = Get_Texel (x, y);
|
||||
if (texelptr == NULL) return (false);
|
||||
Unpack_Texel (texelptr, TGA_BytesPerPixel (Pixel_Depth()), unpackedtexel);
|
||||
color.Set (unpackedtexel.Red(), unpackedtexel.Green(), unpackedtexel.Blue());
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* TrueColorTarga::Set_Color -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/27/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
inline bool TrueColorTarga::Set_Color (unsigned x, unsigned y, const W3dRGBStruct &color)
|
||||
{
|
||||
UnpackedTexelStruct unpackedtexel (color.R, color.G, color.B, 0);
|
||||
|
||||
unsigned char *texelptr;
|
||||
|
||||
texelptr = Get_Texel (x, y);
|
||||
if (texelptr != NULL) {
|
||||
Pack_Texel (unpackedtexel, texelptr, TGA_BytesPerPixel (Pixel_Depth()));
|
||||
return (true);
|
||||
} else {
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* TrueColorTarga::Get_Texel -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 9/27/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
inline unsigned char *TrueColorTarga::Get_Texel (int x, int y) const
|
||||
{
|
||||
// Check for (x, y) out of range.
|
||||
if ((x < 0) || (x >= ((int) Width ()))) return (NULL);
|
||||
if ((y < 0) || (y >= ((int) Height()))) return (NULL);
|
||||
|
||||
return ((unsigned char*) GetImage()) + (((Width() * y) + x) * TGA_BytesPerPixel (Pixel_Depth()));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* TrueColorTarga::Unpack_Texel -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 9/27/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
inline TrueColorTarga::UnpackedTexelStruct *TrueColorTarga::Unpack_Texel (unsigned char *packedtexelptr, unsigned packedbytespertexel, UnpackedTexelStruct &unpackedtexel) const
|
||||
{
|
||||
switch (packedbytespertexel) {
|
||||
|
||||
case 4:
|
||||
|
||||
// Packed format same as unpacked format.
|
||||
ASSERT (sizeof (UnpackedTexelStruct) == 4);
|
||||
unpackedtexel = *((UnpackedTexelStruct*) packedtexelptr);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
// Unpack to ordering ARGB. Set Alpha to zero.
|
||||
unpackedtexel.Byte [0] = 0; // Alpha
|
||||
unpackedtexel.Byte [1] = *(packedtexelptr + 0); // Red
|
||||
unpackedtexel.Byte [2] = *(packedtexelptr + 1); // Green
|
||||
unpackedtexel.Byte [3] = *(packedtexelptr + 2); // Blue
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
static unsigned char _alpha [2] = {0x00, 0xff};
|
||||
|
||||
unsigned short packedtexel = *((unsigned short*) packedtexelptr);
|
||||
|
||||
// Unpack to ordering ARGB. Bit replicate Alpha.
|
||||
unpackedtexel.Byte [0] = _alpha [packedtexel >> 15]; // Alpha
|
||||
unpackedtexel.Byte [1] = ((packedtexel & 0x7c00) >> 7) | 0x3; // Red
|
||||
unpackedtexel.Byte [2] = ((packedtexel & 0x03e0) >> 2) | 0x3; // Green
|
||||
unpackedtexel.Byte [3] = ((packedtexel & 0x001f) << 3) | 0x3; // Blue
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// Unrecognized byte count.
|
||||
ASSERT (0);
|
||||
break;
|
||||
}
|
||||
return (&unpackedtexel);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* TrueColorTarga::Pack_Texel -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 9/27/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
inline void TrueColorTarga::Pack_Texel (const UnpackedTexelStruct &unpackedtexel, unsigned char *packedtexelptr, unsigned packedbytespertexel)
|
||||
{
|
||||
switch (packedbytespertexel) {
|
||||
|
||||
case 4:
|
||||
*(packedtexelptr + 0) = unpackedtexel.Byte [0];
|
||||
*(packedtexelptr + 1) = unpackedtexel.Byte [1];
|
||||
*(packedtexelptr + 2) = unpackedtexel.Byte [2];
|
||||
*(packedtexelptr + 3) = unpackedtexel.Byte [3];
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
// Pack to ordering RGB. Lose Alpha.
|
||||
*(packedtexelptr + 0) = unpackedtexel.Byte [1];
|
||||
*(packedtexelptr + 1) = unpackedtexel.Byte [2];
|
||||
*(packedtexelptr + 2) = unpackedtexel.Byte [3];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
unsigned a, r, g, b;
|
||||
|
||||
// Pack to ordering ARGB. Round Alpha, Red, Green, Blue.
|
||||
a = unpackedtexel.Byte [0] >> 7;
|
||||
r = MIN (0x1f, (unpackedtexel.Byte [1] >> 3) + ((unpackedtexel.Byte [1] & 0x4) >> 2));
|
||||
g = MIN (0x1f, (unpackedtexel.Byte [2] >> 3) + ((unpackedtexel.Byte [2] & 0x4) >> 2));
|
||||
b = MIN (0x1f, (unpackedtexel.Byte [3] >> 3) + ((unpackedtexel.Byte [3] & 0x4) >> 2));
|
||||
*((unsigned short*) packedtexelptr) = ((a << 15) | (r << 10) | (g << 5) | b);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// Unrecognized byte count.
|
||||
ASSERT (0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // LIGHTMAPPACKER_H
|
||||
465
Code/Tools/LightMap/LightMapView.cpp
Normal file
465
Code/Tools/LightMap/LightMapView.cpp
Normal file
@@ -0,0 +1,465 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 7/17/01 3:17p $*
|
||||
* *
|
||||
* $Revision:: 27 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
// Includes.
|
||||
#include "StdAfx.h"
|
||||
#include "LightMap.h"
|
||||
#include "InsertSolveDialog.h"
|
||||
#include "LightMapDoc.h"
|
||||
#include "LightMapView.h"
|
||||
#include "OptionsDialog.h"
|
||||
#include "PackingDialog.h"
|
||||
#include "SelectionDialog.h"
|
||||
#include "StringBuilder.h"
|
||||
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
IMPLEMENT_DYNCREATE(LightMapView, CListView)
|
||||
|
||||
BEGIN_MESSAGE_MAP(LightMapView, CListView)
|
||||
//{{AFX_MSG_MAP(LightMapView)
|
||||
ON_WM_CREATE()
|
||||
ON_COMMAND(ID_INSERT_SOLVE, OnInsertSolve)
|
||||
ON_UPDATE_COMMAND_UI(ID_INSERT_SOLVE, OnUpdateInsertSolve)
|
||||
ON_COMMAND(ID_TOOLS_OPTIONS, OnToolsOptions)
|
||||
ON_COMMAND(ID_TOOLS_PACKING, OnToolsPacking)
|
||||
ON_UPDATE_COMMAND_UI(ID_TOOLS_PACKING, OnUpdateToolsPacking)
|
||||
ON_WM_LBUTTONDOWN()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
class MeshDialog : public CDialog
|
||||
{
|
||||
public:
|
||||
MeshDialog (UINT nIDTemplate, CWnd* pParentWnd, const char *meshname, const char *anomalies)
|
||||
: CDialog (nIDTemplate, pParentWnd)
|
||||
{
|
||||
MeshName = meshname;
|
||||
Anomalies = anomalies;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual BOOL OnInitDialog();
|
||||
|
||||
private:
|
||||
const char *MeshName;
|
||||
const char *Anomalies;
|
||||
};
|
||||
|
||||
|
||||
// Static data.
|
||||
LightMapDoc *LightMapView::_Document = NULL;
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::LightMapView -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
LightMapView::LightMapView()
|
||||
{
|
||||
MeshIndexTable = NULL;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::~LightMapView -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
LightMapView::~LightMapView()
|
||||
{
|
||||
if (MeshIndexTable != NULL) delete [] MeshIndexTable;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::OnInsertSolve -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapView::OnInsertSolve()
|
||||
{
|
||||
// NOTE: Specify initial path to be that of current open document.
|
||||
InsertSolveDialog insertsolvedialog (GetDocument()->GetPathName());
|
||||
|
||||
if (insertsolvedialog.DoModal() == IDOK) {
|
||||
|
||||
char *inclusionstring;
|
||||
|
||||
if (!insertsolvedialog.Apply_Selective()) {
|
||||
inclusionstring = NULL;
|
||||
} else {
|
||||
inclusionstring = insertsolvedialog.Inclusion_String();
|
||||
}
|
||||
GetDocument()->Insert_Solve (insertsolvedialog.Directory_Name(), insertsolvedialog.Filename_List(), inclusionstring, insertsolvedialog.Invert_Selection(), insertsolvedialog.Blend_Noise());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::OnUpdateInsertSolve -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapView::OnUpdateInsertSolve (CCmdUI *cmdui)
|
||||
{
|
||||
cmdui->Enable (GetDocument()->Can_Insert_Solve());
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::OnCreate -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
int LightMapView::OnCreate (LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
static LV_COLUMN _meshname = {LVCF_TEXT | LVCF_FMT, LVCFMT_LEFT, 0, "Mesh Name", 0, 0};
|
||||
static LV_COLUMN _meshanomalies = {LVCF_TEXT | LVCF_FMT, LVCFMT_LEFT, 0, "Mesh Anomalies", 0, 0};
|
||||
static LV_COLUMN _solveanomalies = {LVCF_TEXT | LVCF_FMT, LVCFMT_LEFT, 0, "Solve Anomalies", 0, 0};
|
||||
static LV_COLUMN _vertexsolve = {LVCF_TEXT | LVCF_FMT, LVCFMT_LEFT, 0, "Vertex Solve", 0, 0};
|
||||
static LV_COLUMN _lightmapsolve = {LVCF_TEXT | LVCF_FMT, LVCFMT_LEFT, 0, "Lightmap Solve", 0, 0};
|
||||
|
||||
CListCtrl &list = GetListCtrl();
|
||||
long flags = list.GetStyle();
|
||||
|
||||
if (CListView::OnCreate(lpCreateStruct) == -1) return (-1);
|
||||
|
||||
// Enable report style for the list view.
|
||||
flags |= LVS_REPORT | LVS_NOSORTHEADER;
|
||||
SetWindowLong (list.GetSafeHwnd(), GWL_STYLE, flags);
|
||||
list.SetExtendedStyle (LVS_EX_ONECLICKACTIVATE | LVS_EX_UNDERLINEHOT | LVS_EX_GRIDLINES);
|
||||
|
||||
list.InsertColumn (0, &_meshname);
|
||||
list.InsertColumn (1, &_meshanomalies);
|
||||
list.InsertColumn (2, &_solveanomalies);
|
||||
list.InsertColumn (3, &_vertexsolve);
|
||||
list.InsertColumn (4, &_lightmapsolve);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::OnUpdate -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapView::OnUpdate (CView* pSender, LPARAM lHint, CObject* pHint)
|
||||
{
|
||||
static float _widthratio [] = {0.18f, 0.25f, 0.25f, 0.16f, 0.16f};
|
||||
static LV_COLUMN _column = {LVCF_WIDTH, 0, 0, 0, 0, 0};
|
||||
|
||||
unsigned meshindex;
|
||||
RECT rect;
|
||||
float w;
|
||||
CListCtrl &list = GetListCtrl();
|
||||
LightMapDoc *document;
|
||||
LVITEM item;
|
||||
StringBuilder text (256);
|
||||
|
||||
document = GetDocument();
|
||||
|
||||
// If there are meshes to display...
|
||||
if (document->Mesh_Count() > 0) {
|
||||
|
||||
// Create a mesh index table that will place the mesh indices in alphabetical order of mesh name.
|
||||
if (MeshIndexTable != NULL) delete [] MeshIndexTable;
|
||||
MeshIndexTable = new unsigned [document->Mesh_Count()];
|
||||
ASSERT (MeshIndexTable != NULL);
|
||||
for (meshindex = 0; meshindex < document->Mesh_Count(); meshindex++) {
|
||||
MeshIndexTable [meshindex] = meshindex;
|
||||
}
|
||||
_Document = document;
|
||||
qsort (MeshIndexTable, document->Mesh_Count(), sizeof (unsigned), Compare_Names);
|
||||
_Document = NULL;
|
||||
|
||||
list.DeleteAllItems();
|
||||
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iSubItem = 0;
|
||||
for (meshindex = 0; meshindex < document->Mesh_Count(); meshindex++) {
|
||||
|
||||
unsigned remappedmeshindex;
|
||||
|
||||
item.iItem = meshindex;
|
||||
remappedmeshindex = MeshIndexTable [meshindex];
|
||||
|
||||
item.pszText = (char*) document->Mesh_Name (remappedmeshindex);
|
||||
|
||||
list.InsertItem (&item);
|
||||
list.SetItemText (meshindex, 1, document->Mesh_Anomalies_String (remappedmeshindex, false, text));
|
||||
list.SetItemText (meshindex, 2, document->Solve_Anomalies_String (remappedmeshindex, false, text));
|
||||
list.SetItemText (meshindex, 3, document->Vertex_Solve_Status_String (remappedmeshindex, text));
|
||||
list.SetItemText (meshindex, 4, document->Lightmap_Solve_Status_String (remappedmeshindex, text));
|
||||
}
|
||||
}
|
||||
|
||||
// Set the column widths.
|
||||
GetClientRect (&rect);
|
||||
w = (float) rect.right;
|
||||
for (unsigned c = 0; c < sizeof (_widthratio) / sizeof (float); c++) {
|
||||
|
||||
float columnwidth;
|
||||
|
||||
columnwidth = w * _widthratio [c];
|
||||
_column.cx = columnwidth;
|
||||
if (columnwidth - _column.cx > 0.5f) _column.cx++;
|
||||
list.SetColumn (c, &_column);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::OnToolsOptions -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapView::OnToolsOptions()
|
||||
{
|
||||
OptionsDialog options;
|
||||
|
||||
options.DoModal();
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::OnToolsPacking -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 02/03/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapView::OnToolsPacking()
|
||||
{
|
||||
PackingDialog packing;
|
||||
|
||||
packing.DoModal();
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::OnToolsPacking -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 02/03/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapView::OnUpdateToolsPacking (CCmdUI *cmdui)
|
||||
{
|
||||
cmdui->Enable (GetDocument()->Solve_Inserted());
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::OnLButtonDown -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 02/03/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void LightMapView::OnLButtonDown (UINT flags, CPoint point)
|
||||
{
|
||||
LVHITTESTINFO hittest;
|
||||
|
||||
// Call default handler.
|
||||
CListView::OnLButtonDown (flags, point);
|
||||
|
||||
if (MeshIndexTable != NULL) {
|
||||
|
||||
hittest.pt = point;
|
||||
GetListCtrl().SubItemHitTest (&hittest);
|
||||
if ((hittest.iItem >= 0) && (hittest.iSubItem == 0)) {
|
||||
|
||||
unsigned meshindex = MeshIndexTable [hittest.iItem];
|
||||
LightMapDoc *document = GetDocument();
|
||||
StringBuilder string (16384), substring (8192);
|
||||
|
||||
string.Copy (document->Mesh_Anomalies_String (meshindex, true, substring));
|
||||
string.Concatenate (document->Solve_Anomalies_String (meshindex, true, substring));
|
||||
|
||||
MeshDialog mesh (IDD_MESH_STATUS, this, document->Mesh_Name (meshindex), string.String());
|
||||
|
||||
mesh.DoModal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* LightMapView::CompareNames -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 02/03/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
int LightMapView::Compare_Names (const void *index0, const void *index1)
|
||||
{
|
||||
ASSERT (_Document != NULL);
|
||||
return (strcmp (_Document->Mesh_Name (*((unsigned*) index0)), _Document->Mesh_Name (*((unsigned*) index1))));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* MeshDialog::OnInitDialog -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 02/03/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL MeshDialog::OnInitDialog()
|
||||
{
|
||||
StringBuilder string (256);
|
||||
|
||||
// Allow the base class to process this message.
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
string.Copy (MeshName);
|
||||
string.Concatenate (" - Anomalies");
|
||||
SetWindowText (string.String());
|
||||
GetDlgItem (IDC_MESH_STATUS_TEXT)->SetWindowText (Anomalies);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
BOOL LightMapView::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
// TODO: Modify the Window class or styles here by modifying
|
||||
// the CREATESTRUCT cs
|
||||
return CListView::PreCreateWindow(cs);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
void LightMapView::AssertValid() const
|
||||
{
|
||||
CListView::AssertValid();
|
||||
}
|
||||
|
||||
void LightMapView::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CListView::Dump(dc);
|
||||
}
|
||||
|
||||
LightMapDoc* LightMapView::GetDocument() // non-debug version is inline
|
||||
{
|
||||
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(LightMapDoc)));
|
||||
return (LightMapDoc*)m_pDocument;
|
||||
}
|
||||
#endif //_DEBUG
|
||||
108
Code/Tools/LightMap/LightMapView.h
Normal file
108
Code/Tools/LightMap/LightMapView.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 7/09/01 2:42p $*
|
||||
* *
|
||||
* $Revision:: 15 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef LIGHTMAPVIEW_H
|
||||
#define LIGHTMAPVIEW_H
|
||||
|
||||
#include <afxcview.h>
|
||||
#include "LightMapDoc.h"
|
||||
#include "Lightscape.h"
|
||||
|
||||
class StringBuilder;
|
||||
|
||||
class LightMapView : public CListView
|
||||
{
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
// Static functions.
|
||||
static int Compare_Names (const void *index0, const void *index1);
|
||||
|
||||
// Member data.
|
||||
unsigned *MeshIndexTable;
|
||||
|
||||
// Static data.
|
||||
static LightMapDoc *_Document;
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
protected: // create from serialization only
|
||||
LightMapView();
|
||||
DECLARE_DYNCREATE(LightMapView)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(LightMapView)
|
||||
public:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
virtual void OnUpdate (CView* pSender, LPARAM lHint, CObject* pHint);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~LightMapView();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
LightMapDoc* GetDocument();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(LightMapView)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnInsertSolve();
|
||||
afx_msg void OnUpdateInsertSolve(CCmdUI* pCmdUI);
|
||||
afx_msg void OnToolsOptions();
|
||||
afx_msg void OnToolsPacking();
|
||||
afx_msg void OnUpdateToolsPacking(CCmdUI* pCmdUI);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#ifndef _DEBUG // debug version in LightMapView.cpp
|
||||
inline LightMapDoc* LightMapView::GetDocument() {return (LightMapDoc*)m_pDocument;}
|
||||
#endif
|
||||
|
||||
#endif // LIGHTMAPVIEW_H
|
||||
2681
Code/Tools/LightMap/Lightscape.cpp
Normal file
2681
Code/Tools/LightMap/Lightscape.cpp
Normal file
File diff suppressed because it is too large
Load Diff
524
Code/Tools/LightMap/Lightscape.h
Normal file
524
Code/Tools/LightMap/Lightscape.h
Normal file
@@ -0,0 +1,524 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 7/03/01 3:07p $*
|
||||
* *
|
||||
* $Revision:: 38 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef _LIGHTSCAPE_H
|
||||
#define _LIGHTSCAPE_H
|
||||
|
||||
// Includes.
|
||||
#include "Chunk.h"
|
||||
#include "LightMapPacker.h"
|
||||
#include "Triangle.h"
|
||||
#include "arraylistof.h"
|
||||
#include "light.h"
|
||||
#include "lsbasebuilders.h"
|
||||
#include "ltttypes.h"
|
||||
#include "rmap.h"
|
||||
#include "vector.h"
|
||||
#include "vector2.h"
|
||||
#include "vector3.h"
|
||||
#include "vector3i.h"
|
||||
#include "wwmath.h"
|
||||
#include "w3d_file.h"
|
||||
|
||||
|
||||
class TextureNameNode;
|
||||
|
||||
class SolveStatistics {
|
||||
|
||||
public:
|
||||
|
||||
enum SolveStatisticEnum {
|
||||
VERTEX_NOT_FOUND,
|
||||
VERTEX_NO_COLOR,
|
||||
FACE_NOT_FOUND,
|
||||
FACE_NO_LIGHTMAP,
|
||||
VERTEX_NOT_SMOOTH,
|
||||
FACE_AMBIGUOUS,
|
||||
FACE_DEGENERATE,
|
||||
FACE_UNDERSIZED,
|
||||
EDGE_MATCH,
|
||||
ALL_FILL_COLOR,
|
||||
NULL_TEXTURE,
|
||||
SOLVE_STATISTIC_COUNT
|
||||
};
|
||||
|
||||
SolveStatistics ()
|
||||
{
|
||||
VertexCount = 0;
|
||||
FaceCount = 0;
|
||||
for (unsigned s = 0; s < SOLVE_STATISTIC_COUNT; s++) Count [s] = 0;
|
||||
}
|
||||
|
||||
SolveStatistics (unsigned vertexcount, unsigned facecount)
|
||||
{
|
||||
VertexCount = vertexcount;
|
||||
FaceCount = facecount;
|
||||
for (unsigned s = 0; s < SOLVE_STATISTIC_COUNT; s++) Count [s] = 0;
|
||||
}
|
||||
|
||||
bool Valid_Vertex_Solve() const {
|
||||
return (((Count [VERTEX_NOT_FOUND] == 0) || (Count [VERTEX_NOT_FOUND] < VertexCount)) && (Count [VERTEX_NO_COLOR] == 0));
|
||||
}
|
||||
|
||||
bool Valid_Lightmap_Solve() const {
|
||||
return (((Count [FACE_NOT_FOUND] == 0) || (Count [FACE_NOT_FOUND] < FaceCount)) && (Count [FACE_NO_LIGHTMAP] == 0));
|
||||
}
|
||||
|
||||
bool operator == (unsigned c) {
|
||||
|
||||
unsigned sum;
|
||||
|
||||
sum = 0;
|
||||
for (unsigned s = 0; s < SOLVE_STATISTIC_COUNT; s++) sum += Count [s];
|
||||
return (sum == c);
|
||||
}
|
||||
|
||||
unsigned VertexCount;
|
||||
unsigned FaceCount;
|
||||
unsigned Count [SOLVE_STATISTIC_COUNT];
|
||||
};
|
||||
|
||||
|
||||
// Class wrapper for floating point color vectors.
|
||||
class ColorVector : public Vector3
|
||||
{
|
||||
public:
|
||||
|
||||
ColorVector () : Vector3() {}
|
||||
ColorVector (float r, float g, float b) : Vector3 (r, g, b) {}
|
||||
|
||||
void Set (float r, float g, float b)
|
||||
{
|
||||
Vector3::Set (r, g, b);
|
||||
}
|
||||
|
||||
void Set (const LtTRGBColor &irradiance, const RadianceMap &radiancemap)
|
||||
{
|
||||
const double oopi = 1.0 / M_PI;
|
||||
|
||||
X = irradiance.GetR() * oopi;
|
||||
Y = irradiance.GetG() * oopi;
|
||||
Z = irradiance.GetB() * oopi;
|
||||
radiancemap.ToColor (X, Y, Z);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class LightscapeSolve : public LightmapPacker
|
||||
{
|
||||
public:
|
||||
|
||||
// Member functions.
|
||||
LightscapeSolve (const char *solvedirectoryname, const char *solvefilenamelist, CStatusBar* statusptr, const char *statusbarmessage, bool blendnoise = false);
|
||||
Finish();
|
||||
~LightscapeSolve ();
|
||||
|
||||
// Database ammendment functions.
|
||||
void Set_Is_Solution (bool issolution) {IsSolution = issolution;}
|
||||
void Set_Brightness (float brightness) {Brightness = brightness;}
|
||||
void Set_Contrast (float contrast) {Contrast = contrast;}
|
||||
void Set_Is_Daylight (bool isdaylight) {IsDaylight = isdaylight;}
|
||||
void Set_Is_Exterior (bool isexterior) {IsExterior = isexterior;}
|
||||
void Set_Patch_Cluster_Count (int count) {PatchClusterCount = count;}
|
||||
void Set_Is_M2T_Solve (bool ism2tsolve) {IsM2TSolve = ism2tsolve;}
|
||||
void Add_Material_Texture_Name (const char *materialname, const char *texturename);
|
||||
void Add_Texture_Name (unsigned patchindex, const char *materialname);
|
||||
void Add_Light (LightClass *light);
|
||||
bool Add_Vertex (unsigned vertexindex, const Vector3 &p, const Vector3 &n, unsigned patchindex, const Vector2 &t);
|
||||
bool Add_Vertex (unsigned vertexindex, const Vector3 &p, const Vector3 &n, unsigned patchindex, const ColorVector &c);
|
||||
bool Add_Patch_Face (unsigned patchfaceindex, unsigned patchindex, unsigned vertexindexcount, unsigned *vertexindices);
|
||||
|
||||
// Database query functions.
|
||||
float Get_Brightness() {return (Brightness);}
|
||||
float Get_Contrast() {return (Contrast);}
|
||||
bool Is_Daylight() {return (IsDaylight);}
|
||||
bool Is_Exterior() {return (IsExterior);}
|
||||
bool Is_M2T_Solve() {return (IsM2TSolve);}
|
||||
float Filter_Sharpness() {return (FilterSharpness);}
|
||||
ProceduralTexture *Procedural_Texture() {return (ProceduralTexture);}
|
||||
unsigned Light_Count() {return (Lights.Count());}
|
||||
LightClass *Get_Light (unsigned l) {return (Lights [l]);}
|
||||
const char *Light_Exclusion_String() {return (LightExclusionString);}
|
||||
|
||||
void Find_Vertex (const Vector3 &point, const Vector3 *smoothingnormalptr, W3dRGBStruct &vertexcolor, SolveStatistics &solvestatistics);
|
||||
void Find_Triangle (const Vector3 *points, const Vector3 &normal, PackingTriangle &triangle, SolveStatistics &solvestatistics);
|
||||
void Submit_Triangle (PackingTriangle &triangle);
|
||||
|
||||
const TextureNameNode *Texture_Name (unsigned patchindex);
|
||||
|
||||
void Pack();
|
||||
|
||||
// Update the progress bar.
|
||||
void Step_It() {ProgressBar->StepIt();}
|
||||
|
||||
// Static functions.
|
||||
static LightscapeSolve *Importer() {return (_ActiveImporter);}
|
||||
static const char *Asset_Directory() {return (LightmapPacker::Asset_Directory());}
|
||||
static const char *Asset_Directory (const char *filename) {return (LightmapPacker::Asset_Directory (filename));}
|
||||
static void Copy_Assets (const char *pathname) {LightmapPacker::Copy_Assets (pathname);}
|
||||
|
||||
private:
|
||||
|
||||
// Result of finding a face.
|
||||
enum FaceResultEnum {
|
||||
FACE_NOT_FOUND,
|
||||
FACE_AMBIGUOUS,
|
||||
FACE_FOUND
|
||||
};
|
||||
|
||||
// Area of the face.
|
||||
enum FaceSizeEnum {
|
||||
FACE_DEGENERATE,
|
||||
FACE_UNDERSIZED,
|
||||
FACE_NOT_UNDERSIZED
|
||||
};
|
||||
|
||||
struct VerticesStruct {
|
||||
|
||||
// Equality operator.
|
||||
bool operator == (const VerticesStruct &v) {
|
||||
return ((Point == v.Point) &&
|
||||
(FaceNormal == v.FaceNormal) &&
|
||||
(PatchIndex == v.PatchIndex) &&
|
||||
(ValidColor == v.ValidColor) &&
|
||||
(Color == v.Color) &&
|
||||
(ValidUV == v.ValidUV) &&
|
||||
(UV == v.UV));
|
||||
}
|
||||
|
||||
// Inequality operator.
|
||||
bool operator != (const VerticesStruct &v) {
|
||||
return (!(*this == v));
|
||||
}
|
||||
|
||||
Vector3 Point;
|
||||
Vector3 FaceNormal;
|
||||
unsigned PatchIndex;
|
||||
bool ValidColor;
|
||||
ColorVector Color;
|
||||
bool ValidUV;
|
||||
Vector2 UV;
|
||||
};
|
||||
|
||||
struct PatchFaceStruct {
|
||||
|
||||
enum VerticesPerPatchFace {
|
||||
VERTICES_PER_PATCH_FACE = 4
|
||||
};
|
||||
|
||||
// To indicate whether a patch face vertex index is valid.
|
||||
enum VertexIndexValidity {
|
||||
VERTEX_INDEX_INVALID = -1
|
||||
};
|
||||
|
||||
// Equality operator.
|
||||
bool operator == (const PatchFaceStruct &p) {
|
||||
return ((PatchIndex == p.PatchIndex) &&
|
||||
(VertexIndices [0] == p.VertexIndices [0]) &&
|
||||
(VertexIndices [1] == p.VertexIndices [1]) &&
|
||||
(VertexIndices [2] == p.VertexIndices [2]) &&
|
||||
(VertexIndices [3] == p.VertexIndices [3]));
|
||||
}
|
||||
|
||||
// Inequality operator.
|
||||
bool operator != (const PatchFaceStruct &p) {
|
||||
return (!(*this == p));
|
||||
}
|
||||
|
||||
unsigned PatchIndex;
|
||||
unsigned VertexIndices [VERTICES_PER_PATCH_FACE];
|
||||
};
|
||||
|
||||
// Member functions.
|
||||
void Find_Adjacent_Triangles (const PackingTriangle &principaltriangle, DynamicVectorClass <Triangle> &adjtriangles);
|
||||
void Find_Triangle (const Vector3 *points, const Vector3 &facenormal, VerticesStruct *vertices, FaceResultEnum &faceresult);
|
||||
void Find_Triangle (const Vector3 *points, float tolerance, bool centroidtest, const Vector3 *facenormal, VerticesStruct *vertices, FaceResultEnum &faceresult);
|
||||
void Find_Vertices (const Vector3 &point, float tolerance, DynamicVectorClass <VerticesStruct*> &vertices);
|
||||
|
||||
// Miscellaneous convenience functions.
|
||||
FaceSizeEnum Face_Size (const Vector3 *points, unsigned count);
|
||||
unsigned Longest_Edge (const Vector3 *points, unsigned count, bool *usededges);
|
||||
|
||||
float Manhatten_Distance (const Vector3 &v)
|
||||
{
|
||||
return (WWMath::Fabs (v.X) + WWMath::Fabs (v.Y) + WWMath::Fabs (v.Z));
|
||||
}
|
||||
|
||||
// Comparison functions.
|
||||
static int Compare_Material_Texture_Names (const void *materialname0, const void *materialname1);
|
||||
static int Compare_Vertices (const void *vertexindexptr0, const void *vertexindexptr1);
|
||||
static int Compare_Patch_Faces (const void *patchface0, const void *patchface1);
|
||||
|
||||
// Member data.
|
||||
float SmoothingAngle;
|
||||
float SpatialTolerance;
|
||||
float FilterSharpness;
|
||||
bool IsSolution; // Is the currently imported file a valid solve file?
|
||||
int PatchClusterCount; // Total patch cluster count over all parsed solve files.
|
||||
float Brightness;
|
||||
float Contrast;
|
||||
bool IsDaylight;
|
||||
bool IsExterior;
|
||||
bool IsM2TSolve;
|
||||
ProceduralTexture *ProceduralTexture;
|
||||
CProgressCtrl *ProgressBar;
|
||||
DynamicVectorClass <char *> MaterialTextureNames; // <material name, texture pathname> pairs for all materials in the solve.
|
||||
DynamicVectorClass <TextureNameNode*> TextureNames; // <texture pathname> for all patches in the solve.
|
||||
DynamicVectorClass <VerticesStruct> Vertices; // <point, uv coordinate, normal, material index> tuples for all vertices in the solve.
|
||||
DynamicVectorClass <unsigned> VertexIndices; // Indices into Vertices.
|
||||
DynamicVectorClass <PatchFaceStruct> PatchFaces; // <patch index, face> pairs for all faces in the solve.
|
||||
DynamicVectorClass <LightClass*> Lights; // All active lights in the solve.
|
||||
const char *LightExclusionString; // Do not add lights that contain this string.
|
||||
|
||||
// Static data.
|
||||
static LightscapeSolve *_ActiveImporter; // Object currently importing (reading a solution file) (otherwise NULL).
|
||||
};
|
||||
|
||||
|
||||
class LsInformationFactory : public LtTBuilderFactory
|
||||
{
|
||||
protected:
|
||||
virtual LtTInfoBuilderApi *OnGetInfoBuilder();
|
||||
virtual LtTParameterBuilderApi *OnGetParameterBuilder();
|
||||
};
|
||||
|
||||
|
||||
class LsPreparationFactory : public LtTBuilderFactory
|
||||
{
|
||||
protected:
|
||||
virtual LtTInfoBuilderApi *OnGetInfoBuilder();
|
||||
virtual LtTParameterBuilderApi *OnGetParameterBuilder();
|
||||
virtual LtTMaterialBuilderApi *OnGetMaterialBuilder();
|
||||
virtual LtTLampBuilderApi *OnGetLampBuilder();
|
||||
virtual LtTMeshBuilderApi *OnGetMeshBuilder();
|
||||
};
|
||||
|
||||
|
||||
class LsMainFactory : public LtTBuilderFactory
|
||||
{
|
||||
public:
|
||||
|
||||
LsMainFactory();
|
||||
|
||||
unsigned Patch_Face_Count() {return (PatchFaceIndex);}
|
||||
void Patch_Face_Increment() {PatchFaceIndex++;}
|
||||
unsigned Vertex_Count() {return (VertexIndex);}
|
||||
void Vertex_Increment() {VertexIndex++;}
|
||||
unsigned Patch_Count() {return (PatchIndex);}
|
||||
void Patch_Increment() {PatchIndex++; LightscapeSolve::Importer()->Step_It();}
|
||||
|
||||
protected:
|
||||
|
||||
virtual LtTInfoBuilderApi *OnGetInfoBuilder();
|
||||
virtual LtTParameterBuilderApi *OnGetParameterBuilder();
|
||||
virtual LtTMeshBuilderApi *OnGetMeshBuilder();
|
||||
|
||||
private:
|
||||
|
||||
unsigned PatchFaceIndex;
|
||||
unsigned VertexIndex;
|
||||
unsigned PatchIndex;
|
||||
};
|
||||
|
||||
|
||||
class LsInfoBuilder : public LtTBaseInfoBuilder
|
||||
{
|
||||
protected:
|
||||
LsInfoBuilder (LtTBuilderFactory *factory);
|
||||
LtTBool Finish();
|
||||
|
||||
friend class LsInformationFactory;
|
||||
friend class LsPreparationFactory;
|
||||
friend class LsMainFactory;
|
||||
};
|
||||
|
||||
|
||||
class LsParameterBuilder : public LtTBaseParameterBuilder
|
||||
{
|
||||
protected:
|
||||
LsParameterBuilder (LtTBuilderFactory *factory);
|
||||
LtTBool Finish();
|
||||
|
||||
friend class LsInformationFactory;
|
||||
friend class LsPreparationFactory;
|
||||
friend class LsMainFactory;
|
||||
};
|
||||
|
||||
|
||||
class LsMaterialBuilder : public LtTBaseMaterialBuilder
|
||||
{
|
||||
protected:
|
||||
LsMaterialBuilder (LtTBuilderFactory *factory);
|
||||
LtTBool Finish();
|
||||
|
||||
friend class LsPreparationFactory;
|
||||
};
|
||||
|
||||
|
||||
class LsLampBuilder : public LtTBaseLampBuilder
|
||||
{
|
||||
protected:
|
||||
LsLampBuilder (LtTBuilderFactory *factory);
|
||||
LtTBool Finish();
|
||||
|
||||
friend class LsPreparationFactory;
|
||||
};
|
||||
|
||||
|
||||
class LsMeshInquirer : public LtTBaseMeshBuilder
|
||||
{
|
||||
protected:
|
||||
LsMeshInquirer (LtTBuilderFactory *factory);
|
||||
LtTBool Finish();
|
||||
|
||||
friend class LsPreparationFactory;
|
||||
};
|
||||
|
||||
|
||||
class LsMeshBuilder : public LtTBaseMeshBuilder
|
||||
{
|
||||
protected:
|
||||
LsMeshBuilder (LtTBuilderFactory *factory);
|
||||
~LsMeshBuilder();
|
||||
|
||||
LtTBool Finish();
|
||||
void SetFaces (const int facecount, const LtTFace *v);
|
||||
int GetFaceCount() const;
|
||||
const LtTFace *GetFaces() const;
|
||||
|
||||
LsMainFactory *FactoryPtr;
|
||||
|
||||
private:
|
||||
|
||||
struct FaceVertexStruct {
|
||||
|
||||
// Equality operator.
|
||||
bool operator == (const FaceVertexStruct &fv) {
|
||||
return ((Point == fv.Point) && (Color == fv.Color) && (Weight == fv.Weight));
|
||||
}
|
||||
|
||||
// Inequality operator.
|
||||
bool operator != (const FaceVertexStruct &fv) {
|
||||
return (!(*this == fv));
|
||||
}
|
||||
|
||||
Vector3 Point;
|
||||
ColorVector Color;
|
||||
float Weight;
|
||||
};
|
||||
|
||||
LtTFace *Faces;
|
||||
int FaceCount;
|
||||
int AllocatedCount;
|
||||
|
||||
friend class LsMainFactory;
|
||||
friend class VertexUser;
|
||||
};
|
||||
|
||||
|
||||
class VertexUser
|
||||
{
|
||||
public:
|
||||
VertexUser (const LsMeshBuilder &meshbuilder);
|
||||
~VertexUser () {delete [] UsedVertexIndices;}
|
||||
|
||||
bool Is_Used (unsigned vertexindex)
|
||||
{
|
||||
ASSERT (vertexindex < Count);
|
||||
return (UsedVertexIndices [vertexindex] != UNUSED);
|
||||
}
|
||||
|
||||
void Set_Index (unsigned vertexindex, unsigned usedvertexindex)
|
||||
{
|
||||
ASSERT (Is_Used (vertexindex));
|
||||
UsedVertexIndices [vertexindex] = usedvertexindex;
|
||||
}
|
||||
|
||||
unsigned Get_Index (unsigned vertexindex)
|
||||
{
|
||||
ASSERT (vertexindex < Count);
|
||||
|
||||
// This vertex must have previously been set.
|
||||
ASSERT (UsedVertexIndices [vertexindex] >= 0);
|
||||
|
||||
return (UsedVertexIndices [vertexindex]);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
enum VertexUsage {
|
||||
UNUSED = -2,
|
||||
USED = -1
|
||||
};
|
||||
|
||||
VertexUser() {}
|
||||
|
||||
unsigned Count;
|
||||
int *UsedVertexIndices;
|
||||
};
|
||||
|
||||
|
||||
class LightscapeMeshSolve
|
||||
{
|
||||
public:
|
||||
LightscapeMeshSolve (LightscapeSolve &solve, ChunkClass &trianglechunk, ChunkClass &vertexchunk);
|
||||
~LightscapeMeshSolve();
|
||||
|
||||
W3dRGBStruct Vertex_Color (unsigned vertexindex) const;
|
||||
unsigned Vertex_Color_Count() const {return (VertexCount);}
|
||||
const char *Lightmap_Pathname (unsigned lightmapindex) const;
|
||||
unsigned Lightmap_Index (unsigned faceindex) const;
|
||||
W3dTexCoordStruct Lightmap_UV (unsigned facevertexindex) const;
|
||||
unsigned Lightmap_Count() const {return (LightmapCount);}
|
||||
const SolveStatistics *Get_Statistics() const {return (&Statistics);}
|
||||
|
||||
private:
|
||||
|
||||
unsigned VertexCount; // No. of vertices in mesh.
|
||||
unsigned FaceCount; // No. of faces in mesh.
|
||||
unsigned FaceVertexCount; // No. of face-vertices in mesh.
|
||||
unsigned LightmapCount; // No. of lightmaps used by mesh.
|
||||
|
||||
W3dRGBStruct *VertexColors; // Array of vertex colors.
|
||||
Vector2 *FaceVertexUVs; // Array to map a face-vertex index to a UV coordinate.
|
||||
unsigned *FaceRemapLightmapIndices; // Array to map a face to a zero-based lightmap index.
|
||||
unsigned *LightmapIndices; // Array to map a zero-based lightmap index to a 'real' lightmap index.
|
||||
|
||||
SolveStatistics Statistics; // Statistics counters.
|
||||
};
|
||||
|
||||
|
||||
#endif // LIGHTSCAPE_H
|
||||
136
Code/Tools/LightMap/MainFrm.cpp
Normal file
136
Code/Tools/LightMap/MainFrm.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 8/18/99 6:58p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
// Includes.
|
||||
#include "StdAfx.h"
|
||||
#include "LightMap.h"
|
||||
#include "MainFrm.h"
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
|
||||
//{{AFX_MSG_MAP(CMainFrame)
|
||||
ON_WM_CREATE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
static UINT indicators[] =
|
||||
{
|
||||
ID_SEPARATOR, // status line indicator
|
||||
ID_INDICATOR_CAPS,
|
||||
ID_INDICATOR_NUM,
|
||||
ID_INDICATOR_SCRL,
|
||||
};
|
||||
|
||||
|
||||
CMainFrame::CMainFrame()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CMainFrame::~CMainFrame()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
/* No tool bar
|
||||
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
|
||||
}
|
||||
|
||||
/* No Toolbar
|
||||
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
|
||||
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
|
||||
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
|
||||
|
||||
// TODO: Delete these three lines if you don't want the toolbar to
|
||||
// be dockable
|
||||
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
||||
EnableDocking(CBRS_ALIGN_ANY);
|
||||
DockControlBar(&m_wndToolBar);
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
// TODO: Modify the Window class or styles here by modifying
|
||||
// the CREATESTRUCT cs
|
||||
|
||||
return CFrameWnd::PreCreateWindow(cs);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CMainFrame::AssertValid() const
|
||||
{
|
||||
CFrameWnd::AssertValid();
|
||||
}
|
||||
|
||||
void CMainFrame::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CFrameWnd::Dump(dc);
|
||||
}
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
|
||||
77
Code/Tools/LightMap/MainFrm.h
Normal file
77
Code/Tools/LightMap/MainFrm.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 7/06/99 9:00a $*
|
||||
* *
|
||||
* $Revision:: 1 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
class CMainFrame : public CFrameWnd
|
||||
{
|
||||
// The following is maintained by MFC tools.
|
||||
protected: // create from serialization only
|
||||
CMainFrame();
|
||||
DECLARE_DYNCREATE(CMainFrame)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMainFrame)
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CMainFrame();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
CStatusBar m_wndStatusBar;
|
||||
|
||||
protected: // control bar embedded members
|
||||
CToolBar m_wndToolBar;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMainFrame)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
550
Code/Tools/LightMap/OptionsDialog.cpp
Normal file
550
Code/Tools/LightMap/OptionsDialog.cpp
Normal file
@@ -0,0 +1,550 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 9/08/00 6:37p $*
|
||||
* *
|
||||
* $Revision:: 7 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
// Includes.
|
||||
#include "StdAfx.h"
|
||||
#include "LightMap.h"
|
||||
#include "OptionsDialog.h"
|
||||
#include "StringBuilder.h"
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// Defines.
|
||||
#define OPTIONS_SECTION_NAME "Options"
|
||||
#define SPATIAL_TOLERANCE_NAME "Spatial Tolerance"
|
||||
#define SMOOTHING_ANGLE_NAME "Smoothing Angle"
|
||||
#define FILTER_SHARPNESS_NAME "Filter Sharpness"
|
||||
#define FILL_COLOR_RED_NAME "Fill Color Red"
|
||||
#define FILL_COLOR_GREEN_NAME "Fill Color Green"
|
||||
#define FILL_COLOR_BLUE_NAME "Fill Color Blue"
|
||||
#define SCALE_FACTOR_NAME "Scale Factor"
|
||||
#define SAMPLE_RATE_NAME "Sample Rate"
|
||||
#define FILTER_ERROR_NAME "Filter Error"
|
||||
#define BIT_DEPTH_NAME "Bit Depth"
|
||||
#define LIGHT_EXPORT_SELECTIVE_NAME "Light Export Selective"
|
||||
#define LIGHT_EXCLUSION_STRING_NAME "Light Exclusion String"
|
||||
#define PERCENT_SLIDER_TICK_COUNT 101
|
||||
#define SMOOTHING_ANGLE_TICK_COUNT 181
|
||||
#define MIN_SAMPLE_RATE 1
|
||||
#define MAX_SAMPLE_RATE 9999
|
||||
#define SAMPLE_RATE_VALUE_CONTROL_STRING "%4.1f"
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OptionsDialog -- Constructor *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 6/1/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
OptionsDialog::OptionsDialog (CWnd *parent)
|
||||
: CDialog (OptionsDialog::IDD, parent)
|
||||
{
|
||||
SpatialTolerance = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, SPATIAL_TOLERANCE_NAME, 1);
|
||||
SmoothingAngle = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, SMOOTHING_ANGLE_NAME, 89);
|
||||
FilterSharpness = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, FILTER_SHARPNESS_NAME, 50);
|
||||
FillColor.R = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, FILL_COLOR_RED_NAME, 0);
|
||||
FillColor.G = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, FILL_COLOR_GREEN_NAME, _UI8_MAX);
|
||||
FillColor.B = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, FILL_COLOR_BLUE_NAME, 0);
|
||||
SampleRate = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, SAMPLE_RATE_NAME, 50);
|
||||
FilterError = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, FILTER_ERROR_NAME, 50);
|
||||
BitDepth = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, BIT_DEPTH_NAME, 16);
|
||||
LightExportSelective = AfxGetApp()->GetProfileInt (OPTIONS_SECTION_NAME, LIGHT_EXPORT_SELECTIVE_NAME, 1) > 0 ? true : false;
|
||||
LightExclusionString = AfxGetApp()->GetProfileString (OPTIONS_SECTION_NAME, LIGHT_EXCLUSION_STRING_NAME, "@");
|
||||
}
|
||||
|
||||
|
||||
void OptionsDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(OptionsDialog)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(OptionsDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(OptionsDialog)
|
||||
ON_WM_HSCROLL()
|
||||
ON_EN_CHANGE(IDC_SPATIAL_TOLERANCE, OnChangeSpatialTolerance)
|
||||
ON_EN_UPDATE(IDC_SPATIAL_TOLERANCE, OnUpdateSpatialTolerance)
|
||||
ON_EN_CHANGE(IDC_FILL_COLOR_RED, OnChangeFillColorRed)
|
||||
ON_EN_CHANGE(IDC_FILL_COLOR_GREEN, OnChangeFillColorGreen)
|
||||
ON_EN_CHANGE(IDC_FILL_COLOR_BLUE, OnChangeFillColorBlue)
|
||||
ON_EN_UPDATE(IDC_FILL_COLOR_RED, OnUpdateFillColorRed)
|
||||
ON_EN_UPDATE(IDC_FILL_COLOR_GREEN, OnUpdateFillColorGreen)
|
||||
ON_EN_UPDATE(IDC_FILL_COLOR_BLUE, OnUpdateFillColorBlue)
|
||||
ON_BN_CLICKED(IDC_16_BITS_PER_PIXEL, On16BitsPerPixel)
|
||||
ON_BN_CLICKED(IDC_24_BITS_PER_PIXEL, On24BitsPerPixel)
|
||||
ON_WM_VSCROLL()
|
||||
ON_BN_CLICKED(IDC_LIGHT_EXPORT_SELECTIVE, OnLightExportSelective)
|
||||
ON_EN_CHANGE(IDC_LIGHT_EXCLUSION_STRING, OnChangeLightExclusionString)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OnInitDialog -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/2/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL OptionsDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// Initialize.
|
||||
SetDlgItemInt (IDC_SPATIAL_TOLERANCE, SpatialTolerance, FALSE);
|
||||
Initialize_Slider (IDC_SMOOTHING_ANGLE, 0, SMOOTHING_ANGLE_TICK_COUNT - 1, SmoothingAngle);
|
||||
Set_Text (IDC_SMOOTHING_ANGLE_VALUE, "%d", (int) SmoothingAngle);
|
||||
Initialize_Slider (IDC_FILTER_SHARPNESS, 0, PERCENT_SLIDER_TICK_COUNT - 1, FilterSharpness);
|
||||
Set_Text (IDC_FILTER_SHARPNESS_VALUE, "%d", (int) FilterSharpness);
|
||||
SetDlgItemInt (IDC_FILL_COLOR_RED, FillColor.R, FALSE);
|
||||
SetDlgItemInt (IDC_FILL_COLOR_GREEN, FillColor.G, FALSE);
|
||||
SetDlgItemInt (IDC_FILL_COLOR_BLUE, FillColor.B, FALSE);
|
||||
Initialize_Spinner (IDC_SAMPLE_RATE, MIN_SAMPLE_RATE, MAX_SAMPLE_RATE, SampleRate);
|
||||
Set_Text (IDC_SAMPLE_RATE_VALUE, SAMPLE_RATE_VALUE_CONTROL_STRING, Get_Sample_Rate());
|
||||
Initialize_Slider (IDC_FILTER_ERROR, 0, PERCENT_SLIDER_TICK_COUNT - 1, FilterError);
|
||||
Set_Text (IDC_FILTER_ERROR_VALUE, "%d", (int) FilterError);
|
||||
|
||||
// Initialize bit depth option.
|
||||
switch (BitDepth) {
|
||||
|
||||
case 16:
|
||||
CheckDlgButton (IDC_16_BITS_PER_PIXEL, 1);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
CheckDlgButton (IDC_24_BITS_PER_PIXEL, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
break;
|
||||
}
|
||||
CheckDlgButton (IDC_LIGHT_EXPORT_SELECTIVE, LightExportSelective);
|
||||
GetDlgItem (IDC_LIGHT_EXCLUSION_STRING)->SetWindowText (LightExclusionString);
|
||||
GetDlgItem (IDC_LIGHT_EXCLUSION_STRING)->EnableWindow (LightExportSelective);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::DoModal -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/2/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
int OptionsDialog::DoModal()
|
||||
{
|
||||
int result;
|
||||
|
||||
result = CDialog::DoModal();
|
||||
if (result == IDOK) {
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, SPATIAL_TOLERANCE_NAME, SpatialTolerance);
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, SMOOTHING_ANGLE_NAME, SmoothingAngle);
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, FILTER_SHARPNESS_NAME, FilterSharpness);
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, FILL_COLOR_RED_NAME, FillColor.R);
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, FILL_COLOR_GREEN_NAME, FillColor.G);
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, FILL_COLOR_BLUE_NAME, FillColor.B);
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, SAMPLE_RATE_NAME, SampleRate);
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, FILTER_ERROR_NAME, FilterError);
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, BIT_DEPTH_NAME, BitDepth);
|
||||
AfxGetApp()->WriteProfileInt (OPTIONS_SECTION_NAME, LIGHT_EXPORT_SELECTIVE_NAME, LightExportSelective);
|
||||
AfxGetApp()->WriteProfileString (OPTIONS_SECTION_NAME, LIGHT_EXCLUSION_STRING_NAME, LightExclusionString);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OnChangeSpatialTolerance -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 02/03/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::OnChangeSpatialTolerance()
|
||||
{
|
||||
SpatialTolerance = GetDlgItemInt (IDC_SPATIAL_TOLERANCE, NULL, FALSE);
|
||||
}
|
||||
|
||||
void OptionsDialog::OnUpdateSpatialTolerance()
|
||||
{
|
||||
const unsigned maxtolerance = 10000;
|
||||
|
||||
unsigned v = GetDlgItemInt (IDC_SPATIAL_TOLERANCE, NULL, FALSE);
|
||||
if (v > maxtolerance) SetDlgItemInt (IDC_SPATIAL_TOLERANCE, maxtolerance, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OnChangeFillColorRed -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/16/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::OnChangeFillColorRed()
|
||||
{
|
||||
FillColor.R = GetDlgItemInt (IDC_FILL_COLOR_RED, NULL, FALSE);
|
||||
}
|
||||
|
||||
void OptionsDialog::OnUpdateFillColorRed()
|
||||
{
|
||||
unsigned v = GetDlgItemInt (IDC_FILL_COLOR_RED, NULL, FALSE);
|
||||
if (v > _UI8_MAX) SetDlgItemInt (IDC_FILL_COLOR_RED, _UI8_MAX, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OnChangeFillColorGreen -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/16/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::OnChangeFillColorGreen()
|
||||
{
|
||||
FillColor.G = GetDlgItemInt (IDC_FILL_COLOR_GREEN, NULL, FALSE);
|
||||
}
|
||||
|
||||
void OptionsDialog::OnUpdateFillColorGreen()
|
||||
{
|
||||
unsigned v = GetDlgItemInt (IDC_FILL_COLOR_GREEN, NULL, FALSE);
|
||||
if (v > _UI8_MAX) SetDlgItemInt (IDC_FILL_COLOR_GREEN, _UI8_MAX, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OnChangeFillColorBlue -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/16/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::OnChangeFillColorBlue()
|
||||
{
|
||||
FillColor.B = GetDlgItemInt (IDC_FILL_COLOR_BLUE, NULL, FALSE);
|
||||
}
|
||||
|
||||
void OptionsDialog::OnUpdateFillColorBlue()
|
||||
{
|
||||
unsigned v = GetDlgItemInt (IDC_FILL_COLOR_BLUE, NULL, FALSE);
|
||||
if (v > _UI8_MAX) SetDlgItemInt (IDC_FILL_COLOR_BLUE, _UI8_MAX, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::On16BitsPerPixel -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/2/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::On16BitsPerPixel()
|
||||
{
|
||||
BitDepth = 16;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::On24BitsPerPixel -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/2/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::On24BitsPerPixel()
|
||||
{
|
||||
BitDepth = 24;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OnHScroll -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/2/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::OnHScroll (UINT sbcode, UINT pos, CScrollBar *scrollbar)
|
||||
{
|
||||
int controlid = scrollbar->GetDlgCtrlID();
|
||||
|
||||
CSliderCtrl *slider = (CSliderCtrl*) GetDlgItem (controlid);
|
||||
ASSERT (slider != NULL);
|
||||
switch (controlid) {
|
||||
|
||||
case IDC_SMOOTHING_ANGLE:
|
||||
SmoothingAngle = slider->GetPos();
|
||||
Set_Text (IDC_SMOOTHING_ANGLE_VALUE, "%d", (int) SmoothingAngle);
|
||||
break;
|
||||
|
||||
case IDC_FILTER_SHARPNESS:
|
||||
FilterSharpness = slider->GetPos();
|
||||
Set_Text (IDC_FILTER_SHARPNESS_VALUE, "%d", (int) FilterSharpness);
|
||||
break;
|
||||
|
||||
case IDC_FILTER_ERROR:
|
||||
FilterError = slider->GetPos();
|
||||
Set_Text (IDC_FILTER_ERROR_VALUE, "%d", (int) FilterError);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CDialog::OnHScroll (sbcode, pos, scrollbar);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OnVScroll -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 08/16/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::OnVScroll (UINT sbcode, UINT pos, CScrollBar *scrollbar)
|
||||
{
|
||||
int controlid = scrollbar->GetDlgCtrlID();
|
||||
|
||||
CSpinButtonCtrl *spinner = (CSpinButtonCtrl*) GetDlgItem (controlid);
|
||||
ASSERT (spinner != NULL);
|
||||
switch (controlid) {
|
||||
|
||||
case IDC_SAMPLE_RATE:
|
||||
SampleRate = spinner->GetPos() & 0xffff;
|
||||
Set_Text (IDC_SAMPLE_RATE_VALUE, SAMPLE_RATE_VALUE_CONTROL_STRING, Get_Sample_Rate());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CDialog::OnVScroll (sbcode, pos, scrollbar);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OnLightExportSelective -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 08/16/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::OnLightExportSelective()
|
||||
{
|
||||
LightExportSelective = !LightExportSelective;
|
||||
GetDlgItem (IDC_LIGHT_EXCLUSION_STRING)->EnableWindow (LightExportSelective);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::OnChangeLightExclusionString -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 08/16/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::OnChangeLightExclusionString()
|
||||
{
|
||||
GetDlgItem (IDC_LIGHT_EXCLUSION_STRING)->GetWindowText (LightExclusionString);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::Initialize_Slider -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/2/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::Initialize_Slider (int sliderid, int start, int end, int value)
|
||||
{
|
||||
CSliderCtrl *slider;
|
||||
|
||||
slider = (CSliderCtrl*) GetDlgItem (sliderid);
|
||||
ASSERT (slider != NULL);
|
||||
slider->SetRange (start, end);
|
||||
slider->SetPos (value);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::Initialize_Spinner -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/2/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::Initialize_Spinner (int spinnerid, int start, int end, int value)
|
||||
{
|
||||
CSpinButtonCtrl *spinner;
|
||||
|
||||
spinner = (CSpinButtonCtrl*) GetDlgItem (spinnerid);
|
||||
ASSERT (spinner != NULL);
|
||||
spinner->SetRange (start, end);
|
||||
spinner->SetPos (value);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::Set_Text -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/2/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::Set_Text (int textid, const char *controlstring, int value)
|
||||
{
|
||||
StringBuilder text (32);
|
||||
|
||||
text.Copy (controlstring, value);
|
||||
GetDlgItem (textid)->SetWindowText (text.String());
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* OptionsDialog::Set_Text -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/2/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
void OptionsDialog::Set_Text (int textid, const char *controlstring, float value)
|
||||
{
|
||||
StringBuilder text (32);
|
||||
|
||||
text.Copy (controlstring, value);
|
||||
GetDlgItem (textid)->SetWindowText (text.String());
|
||||
}
|
||||
125
Code/Tools/LightMap/OptionsDialog.h
Normal file
125
Code/Tools/LightMap/OptionsDialog.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 9/08/00 6:44p $*
|
||||
* *
|
||||
* $Revision:: 8 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#if !defined(AFX_OPTIONSDIALOG_H__23794761_9166_11D3_A321_009027447394__INCLUDED_)
|
||||
#define AFX_OPTIONSDIALOG_H__23794761_9166_11D3_A321_009027447394__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
// Includes.
|
||||
#include "w3d_file.h"
|
||||
|
||||
|
||||
class OptionsDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
OptionsDialog (CWnd *parent = NULL);
|
||||
|
||||
float Get_Spatial_Tolerance() {return (SpatialTolerance * 0.0001f);} // x 0.0001 metres.
|
||||
unsigned Get_Smoothing_Angle() {return (SmoothingAngle);}
|
||||
unsigned Get_Filter_Sharpness() {return (FilterSharpness);}
|
||||
W3dRGBStruct Get_Fill_Color() {return (FillColor);}
|
||||
float Get_Sample_Rate() {return (SampleRate / 10.0f);}
|
||||
unsigned Get_Filter_Error() {return (FilterError);}
|
||||
unsigned Get_Bit_Depth() {return (BitDepth);}
|
||||
bool Get_Light_Export_Selective() {return (LightExportSelective);}
|
||||
const char *Get_Light_Exclusion_String() {return (LPCTSTR (LightExclusionString));}
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(OptionsDialog)
|
||||
enum { IDD = IDD_OPTIONS };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(OptionsDialog)
|
||||
public:
|
||||
virtual int DoModal();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(OptionsDialog)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||
afx_msg void OnChangeSpatialTolerance();
|
||||
afx_msg void OnUpdateSpatialTolerance();
|
||||
afx_msg void OnChangeFillColorRed();
|
||||
afx_msg void OnChangeFillColorGreen();
|
||||
afx_msg void OnChangeFillColorBlue();
|
||||
afx_msg void OnUpdateFillColorRed();
|
||||
afx_msg void OnUpdateFillColorGreen();
|
||||
afx_msg void OnUpdateFillColorBlue();
|
||||
afx_msg void On16BitsPerPixel();
|
||||
afx_msg void On24BitsPerPixel();
|
||||
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||
afx_msg void OnLightExportSelective();
|
||||
afx_msg void OnChangeLightExclusionString();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
|
||||
void Initialize_Slider (int sliderid, int start, int end, int value);
|
||||
void Initialize_Spinner (int spinnerid, int start, int end, int value);
|
||||
void Set_Text (int textid, const char *controlstring, int value);
|
||||
void Set_Text (int textid, const char *controlstring, float value);
|
||||
|
||||
unsigned SpatialTolerance; // Vertex smoothing spatial tolerance.
|
||||
unsigned SmoothingAngle; // Vertex smoothing angle (in degrees).
|
||||
unsigned FilterSharpness; // Filter sharpness (or tightness).
|
||||
unsigned BitDepth; // Lightmap bit depth (pixel format).
|
||||
W3dRGBStruct FillColor; // Color used to pad unused texels in lightmaps.
|
||||
unsigned SampleRate;
|
||||
unsigned FilterError; // Scale lightmaps to maximum filter error.
|
||||
bool LightExportSelective;
|
||||
CString LightExclusionString;
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_OPTIONSDIALOG_H__23794761_9166_11D3_A321_009027447394__INCLUDED_)
|
||||
152
Code/Tools/LightMap/PackingDialog.cpp
Normal file
152
Code/Tools/LightMap/PackingDialog.cpp
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 7/20/00 4:47p $*
|
||||
* *
|
||||
* $Revision:: 3 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
// Includes.
|
||||
#include "StdAfx.h"
|
||||
#include "LightMap.h"
|
||||
#include "PackingDialog.h"
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* PackingDialog::OnInitDialog -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 02/03/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL PackingDialog::OnInitDialog()
|
||||
{
|
||||
static LV_COLUMN _column [2] = {
|
||||
{LVCF_FMT | LVCF_TEXT | LVCF_WIDTH, LVCFMT_LEFT, 0, "Statistic", 0, 0},
|
||||
{LVCF_FMT | LVCF_TEXT | LVCF_WIDTH, LVCFMT_RIGHT, 0, "Value", 0, 0}
|
||||
};
|
||||
|
||||
static float _widthratio [2] = {0.55f, 0.45f};
|
||||
|
||||
static char *_statisticlabels [LightmapPacker::STATISTICS_COUNT] = {
|
||||
"Page format",
|
||||
"No. of lightmaps processed",
|
||||
"Percentage adjacent faces blended", // No. adjacent faces edge blended / No. adjacent faces. NOTE: Some adjacent
|
||||
// faces cannot be edge blended because they do not have the same UV mapping
|
||||
// as the principal face.
|
||||
"Edge blend efficiency", // Percentage texel area not dedicated to edge blending.
|
||||
"Scaling efficiency", // Percentage texel area reduction due to low-pass filter scaling.
|
||||
"No. of pages created",
|
||||
"Packing efficiency", // Percentage texel area of page used (not padded).
|
||||
"Replica lightmap culling efficiency", // Percentage texel area saved due to lightmap reuse.
|
||||
"Estimated texture swapping efficiency", // Estimated likelihood that next face will not incur a texture swap.
|
||||
"No. of oversize lightmaps" // No. of lightmaps that exceeded the page size limit and had to be scaled.
|
||||
};
|
||||
|
||||
CListCtrl *list;
|
||||
LVITEM item;
|
||||
RECT rect;
|
||||
float w;
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
list = (CListCtrl*) GetDlgItem (IDC_PACKING_LIST);
|
||||
list->GetClientRect (&rect);
|
||||
w = (float) rect.right;
|
||||
for (unsigned c = 0; c < sizeof (_widthratio) / sizeof (float); c++) {
|
||||
|
||||
float columnwidth;
|
||||
|
||||
columnwidth = w * _widthratio [c];
|
||||
_column [c].cx = columnwidth;
|
||||
if (columnwidth - _column [c].cx > 0.5f) _column [c].cx++;
|
||||
list->InsertColumn (c, &_column [c]);
|
||||
}
|
||||
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iSubItem = 0;
|
||||
for (unsigned i = 0; i < LightmapPacker::STATISTICS_COUNT; i++) {
|
||||
item.iItem = i;
|
||||
item.pszText = _statisticlabels [i];
|
||||
list->InsertItem (&item);
|
||||
list->SetItemText (i, 1, LightmapPacker::Get_Statistic (i));
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
// The following is maintained by MFC tools.
|
||||
PackingDialog::PackingDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(PackingDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(PackingDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void PackingDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(PackingDialog)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(PackingDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(PackingDialog)
|
||||
ON_BN_CLICKED(IDCLOSE, OnClose)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
int PackingDialog::DoModal()
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
|
||||
return CDialog::DoModal();
|
||||
}
|
||||
|
||||
|
||||
80
Code/Tools/LightMap/PackingDialog.h
Normal file
80
Code/Tools/LightMap/PackingDialog.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 2/03/00 6:19p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#if !defined(AFX_PACKINGDIALOG_H__F120E798_DA72_11D3_A385_009027447394__INCLUDED_)
|
||||
#define AFX_PACKINGDIALOG_H__F120E798_DA72_11D3_A385_009027447394__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
class PackingDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
PackingDialog(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(PackingDialog)
|
||||
enum { IDD = IDD_PACKING };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(PackingDialog)
|
||||
public:
|
||||
virtual int DoModal();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(PackingDialog)
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_PACKINGDIALOG_H__F120E798_DA72_11D3_A385_009027447394__INCLUDED_)
|
||||
209
Code/Tools/LightMap/PerlinNoise.cpp
Normal file
209
Code/Tools/LightMap/PerlinNoise.cpp
Normal file
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 2/14/01 2:21p $*
|
||||
* *
|
||||
* $Revision:: 3 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include <limits.h>
|
||||
#include "PerlinNoise.h"
|
||||
#include "Random.h"
|
||||
#include "WWMath.h"
|
||||
|
||||
// Static data.
|
||||
float PerlinNoise::_NoiseTable [NOISE_TABLE_SIZE];
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* PerlinNoise::PerlinNoise -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/05/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
PerlinNoise::PerlinNoise()
|
||||
{
|
||||
static bool _initialized = false;
|
||||
|
||||
if (!_initialized) {
|
||||
|
||||
Random3Class randomnumber (0x3f198440, 0x92012324);
|
||||
float *noisetableptr;
|
||||
|
||||
// Initialize the noise table with random values.
|
||||
noisetableptr = &_NoiseTable [0];
|
||||
for (unsigned i = 0; i < NOISE_TABLE_SIZE; i++) {
|
||||
*noisetableptr = randomnumber (0, 10000) * 0.0001f;
|
||||
noisetableptr++;
|
||||
}
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* PerlinNoise::Value -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/05/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
float PerlinNoise::Noise (int x, int y, int z)
|
||||
{
|
||||
static unsigned char _permute [NOISE_TABLE_SIZE] = {
|
||||
225, 155, 210, 108, 175, 199, 221, 144, 203, 116, 70, 213, 69, 158, 33, 252,
|
||||
5, 82, 173, 133, 222, 139, 174, 27, 9, 71, 90, 246, 75, 130, 91, 191,
|
||||
169, 138, 2, 151, 194, 235, 81, 7, 25, 113, 228, 159, 205, 253, 134, 142,
|
||||
248, 65, 224, 217, 22, 121, 229, 63, 89, 103, 96, 104, 156, 17, 201, 129,
|
||||
36, 8, 165, 110, 237, 117, 231, 56, 132, 211, 152, 20, 181, 111, 239, 218,
|
||||
170, 163, 51, 172, 157, 47, 80, 212, 176, 250, 87, 49, 99, 242, 136, 189,
|
||||
162, 115, 44, 43, 124, 94, 150, 16, 141, 247, 32, 10, 198, 223, 255, 72,
|
||||
53, 131, 84, 57, 220, 197, 58, 50, 208, 11, 241, 28, 3, 192, 62, 202,
|
||||
18, 215, 153, 24, 76, 41, 15, 179, 39, 46, 55, 6, 128, 167, 23, 188,
|
||||
106, 34, 187, 140, 164, 73, 112, 182, 244, 195, 227, 13, 35, 77, 196, 185,
|
||||
26, 200, 226, 119, 31, 123, 168, 125, 249, 68, 183, 230, 177, 135, 160, 180,
|
||||
12, 1, 243, 148, 102, 166, 38, 238, 251, 37, 240, 126, 64, 74, 161, 40,
|
||||
184, 149, 171, 178, 101, 66, 29, 59, 146, 61, 254, 107, 42, 86, 154, 4,
|
||||
236, 232, 120, 21, 233, 209, 45, 98, 193, 114, 78, 19, 206, 14, 118, 127,
|
||||
48, 79, 147, 85, 30, 207, 219, 54, 88, 234, 190, 122, 95, 67, 143, 109,
|
||||
137, 214, 145, 93, 92, 100, 245, 0, 216, 186, 60, 83, 105, 97, 204, 52
|
||||
};
|
||||
|
||||
#define PERMUTE(x) _permute [(x) & (NOISE_TABLE_MASK)]
|
||||
|
||||
unsigned ux, uy, uz;
|
||||
|
||||
ux = x + INT_MAX + 1;
|
||||
uy = y + INT_MAX + 1;
|
||||
uz = z + INT_MAX + 1;
|
||||
|
||||
return (_NoiseTable [PERMUTE ((ux) + PERMUTE ((uy) + PERMUTE (uz)))]);
|
||||
|
||||
#undef PERMUTE
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* PerlinNoise::Noise -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/05/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
float PerlinNoise::Noise (const Vector3 &point)
|
||||
{
|
||||
int ix, iy, iz;
|
||||
float xf, yf, zf;
|
||||
float a, b, c, d, e, f, g, h;
|
||||
float x0, x1, x2, x3;
|
||||
float y0, y1;
|
||||
|
||||
ix = floorf (point.X);
|
||||
iy = floorf (point.Y);
|
||||
iz = floorf (point.Z);
|
||||
|
||||
xf = SmoothStep (point.X - ix);
|
||||
yf = SmoothStep (point.Y - iy);
|
||||
zf = SmoothStep (point.Z - iz);
|
||||
|
||||
a = Noise (ix, iy, iz);
|
||||
b = Noise (ix + 1, iy, iz);
|
||||
c = Noise (ix + 1, iy + 1, iz);
|
||||
d = Noise (ix, iy + 1, iz);
|
||||
e = Noise (ix, iy, iz + 1);
|
||||
f = Noise (ix + 1, iy, iz + 1);
|
||||
g = Noise (ix + 1, iy + 1, iz + 1);
|
||||
h = Noise (ix, iy + 1, iz + 1);
|
||||
|
||||
x0 = WWMath::Lerp (a, b, xf);
|
||||
x1 = WWMath::Lerp (d, c, xf);
|
||||
x2 = WWMath::Lerp (e, f, xf);
|
||||
x3 = WWMath::Lerp (h, g, xf);
|
||||
|
||||
y0 = WWMath::Lerp (x0, x1, yf);
|
||||
y1 = WWMath::Lerp (x2, x3, yf);
|
||||
|
||||
return (WWMath::Lerp (y0, y1, zf));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* PerlinNoise::Value -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/05/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
float PerlinNoise::Value (const Vector3 &point)
|
||||
{
|
||||
const unsigned octavecount = 5;
|
||||
|
||||
float value, amplitudesum, frequency;
|
||||
|
||||
value = 0.0f;
|
||||
amplitudesum = 0.0f;
|
||||
frequency = 0.5f;
|
||||
for (unsigned octave = 0; octave < octavecount; octave++) {
|
||||
|
||||
float oofrequency;
|
||||
|
||||
oofrequency = 1.0f / frequency;
|
||||
value += Noise (point * frequency) * oofrequency;
|
||||
amplitudesum += oofrequency;
|
||||
frequency *= 2.17f;
|
||||
}
|
||||
|
||||
// Normalize.
|
||||
return (value * (1.0f / amplitudesum));
|
||||
}
|
||||
|
||||
68
Code/Tools/LightMap/PerlinNoise.h
Normal file
68
Code/Tools/LightMap/PerlinNoise.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 9/08/00 5:09p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef PERLIN_NOISE_H
|
||||
#define PERLIN_NOISE_H
|
||||
|
||||
// Includes.
|
||||
#include "ProceduralTexture.h"
|
||||
#include "Vector3.h"
|
||||
|
||||
// Defines.
|
||||
#define NOISE_TABLE_SIZE 256 // NOTE: Must be a power of 2.
|
||||
#define NOISE_TABLE_MASK NOISE_TABLE_SIZE - 1
|
||||
|
||||
class PerlinNoise : public ProceduralTexture {
|
||||
|
||||
public:
|
||||
|
||||
PerlinNoise();
|
||||
float Value (const Vector3 &point);
|
||||
|
||||
protected:
|
||||
|
||||
float SmoothStep (float x) {return (x * x * (3.0f - (2.0f * x)));}
|
||||
float Noise (int x, int y, int z);
|
||||
float Noise (const Vector3 &point);
|
||||
|
||||
private:
|
||||
|
||||
static float _NoiseTable [NOISE_TABLE_SIZE];
|
||||
};
|
||||
|
||||
|
||||
#endif // PERLIN_NOISE_H
|
||||
|
||||
54
Code/Tools/LightMap/ProceduralTexture.h
Normal file
54
Code/Tools/LightMap/ProceduralTexture.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 9/08/00 5:17p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef PROCEDURAL_TEXTURE_H
|
||||
#define PROCEDURAL_TEXTURE_H
|
||||
|
||||
// Includes.
|
||||
#include "Vector3.h"
|
||||
|
||||
|
||||
// This is an interface class for all procedural textures. All procedural textures that
|
||||
// inherit this class must define the Value() function.
|
||||
|
||||
class ProceduralTexture {
|
||||
|
||||
public:
|
||||
virtual float Value (const Vector3 &point) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // PROCEDURAL_TEXTURE
|
||||
BIN
Code/Tools/LightMap/Res/LightMap.ico
Normal file
BIN
Code/Tools/LightMap/Res/LightMap.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
13
Code/Tools/LightMap/Res/LightMap.rc2
Normal file
13
Code/Tools/LightMap/Res/LightMap.rc2
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// LIGHTMAP.RC2 - resources Microsoft Visual C++ does not edit directly
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#error this file is not editable by Microsoft Visual C++
|
||||
#endif //APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Add manually edited resources here...
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
BIN
Code/Tools/LightMap/Res/Toolbar.bmp
Normal file
BIN
Code/Tools/LightMap/Res/Toolbar.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
106
Code/Tools/LightMap/SelectionDialog.cpp
Normal file
106
Code/Tools/LightMap/SelectionDialog.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 9/06/00 5:06p $*
|
||||
* *
|
||||
* $Revision:: 3 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
// Includes.
|
||||
#include "StdAfx.h"
|
||||
#include "LightMap.h"
|
||||
#include "SelectionDialog.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
SelectionDialog::SelectionDialog (DynamicVectorClass <char*> *listptr, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(SelectionDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(SelectionDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
ListPtr = listptr;
|
||||
Selection = -1; // NOTE: Indicates no current selection.
|
||||
}
|
||||
|
||||
void SelectionDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(SelectionDialog)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(SelectionDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(SelectionDialog)
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// SelectionDialog message handlers
|
||||
BOOL SelectionDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
if (ListPtr != NULL) {
|
||||
|
||||
CListBox *listboxptr = (CListBox*) GetDlgItem (IDC_SELECTION_LIST);
|
||||
|
||||
for (int i = 0; i < ListPtr->Count(); i++) {
|
||||
listboxptr->AddString ((*ListPtr) [i]);
|
||||
}
|
||||
|
||||
// Set the initial selection.
|
||||
listboxptr->SetCurSel (0);
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
void SelectionDialog::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
|
||||
CListBox *listboxptr = (CListBox*) GetDlgItem (IDC_SELECTION_LIST);
|
||||
|
||||
// Record the most recent list box selection.
|
||||
Selection = listboxptr->GetCurSel();
|
||||
}
|
||||
85
Code/Tools/LightMap/SelectionDialog.h
Normal file
85
Code/Tools/LightMap/SelectionDialog.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 9/06/00 4:51p $*
|
||||
* *
|
||||
* $Revision:: 3 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#if !defined(AFX_SELECTIONDIALOG_H__07D3067F_7262_11D4_A3CE_009027447394__INCLUDED_)
|
||||
#define AFX_SELECTIONDIALOG_H__07D3067F_7262_11D4_A3CE_009027447394__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
class SelectionDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
SelectionDialog (DynamicVectorClass <char*> *listptr = NULL, CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
int Get_Selection() {return (Selection);}
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(SelectionDialog)
|
||||
enum { IDD = IDD_SELECTION };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(SelectionDialog)
|
||||
public:
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(SelectionDialog)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
DynamicVectorClass <char*> *ListPtr;
|
||||
int Selection;
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_SELECTIONDIALOG_H__07D3067F_7262_11D4_A3CE_009027447394__INCLUDED_)
|
||||
24
Code/Tools/LightMap/StdAfx.cpp
Normal file
24
Code/Tools/LightMap/StdAfx.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// LightMap.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
34
Code/Tools/LightMap/StdAfx.h
Normal file
34
Code/Tools/LightMap/StdAfx.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
|
||||
|
||||
|
||||
182
Code/Tools/LightMap/StringBuilder.cpp
Normal file
182
Code/Tools/LightMap/StringBuilder.cpp
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 2/09/00 1:12p $*
|
||||
* *
|
||||
* $Revision:: 5 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
// Includes.
|
||||
#include "StdAfx.h"
|
||||
#include "StringBuilder.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* StringBuilder::StringBuilder -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 9/27/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
StringBuilder::StringBuilder (unsigned buffersize)
|
||||
{
|
||||
Buffer = new char [buffersize];
|
||||
ASSERT (Buffer != NULL);
|
||||
Buffer [0] = '\0';
|
||||
BufferAllocated = true;
|
||||
BufferSize = buffersize;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* StringBuilder::StringBuilder -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 9/27/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
StringBuilder::StringBuilder (char *buffer, unsigned buffersize)
|
||||
{
|
||||
Buffer = buffer;
|
||||
Buffer [0] = '\0';
|
||||
BufferAllocated = false;
|
||||
BufferSize = buffersize;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* StringBuilder::~StringBuilder -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 9/27/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
StringBuilder::~StringBuilder()
|
||||
{
|
||||
if (BufferAllocated) delete [] Buffer;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* StringBuilder::Copy -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 9/27/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
char *StringBuilder::Copy (const char *controlstring, ...)
|
||||
{
|
||||
unsigned messagebufferlength;
|
||||
char *messagebuffer;
|
||||
|
||||
// Allocate a workspace buffer.
|
||||
messagebufferlength = BufferSize;
|
||||
messagebuffer = new char [messagebufferlength];
|
||||
ASSERT (messagebuffer != NULL);
|
||||
|
||||
va_list args;
|
||||
|
||||
va_start (args, controlstring);
|
||||
|
||||
_vsnprintf (messagebuffer, messagebufferlength - 1, controlstring, args);
|
||||
messagebuffer [messagebufferlength - 1] = '\0';
|
||||
strncpy (Buffer, messagebuffer, BufferSize - 1);
|
||||
Buffer [BufferSize - 1] = '\0';
|
||||
|
||||
va_end (args);
|
||||
|
||||
// Clean-up.
|
||||
delete messagebuffer;
|
||||
|
||||
return (Buffer);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* StringBuilder::Concatenate -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 9/27/99 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
char *StringBuilder::Concatenate (const char *controlstring, ...)
|
||||
{
|
||||
unsigned messagebufferlength;
|
||||
char *messagebuffer;
|
||||
|
||||
// Allocate a workspace buffer.
|
||||
messagebufferlength = BufferSize;
|
||||
messagebuffer = new char [messagebufferlength];
|
||||
ASSERT (messagebuffer != NULL);
|
||||
|
||||
va_list args;
|
||||
|
||||
va_start (args, controlstring);
|
||||
|
||||
_vsnprintf (messagebuffer, messagebufferlength - 1, controlstring, args);
|
||||
messagebuffer [messagebufferlength - 1] = '\0';
|
||||
strncat (Buffer, messagebuffer, BufferSize - 1 - strlen (Buffer));
|
||||
Buffer [BufferSize - 1] = '\0';
|
||||
|
||||
va_end (args);
|
||||
|
||||
// Clean-up.
|
||||
delete messagebuffer;
|
||||
|
||||
return (Buffer);
|
||||
}
|
||||
62
Code/Tools/LightMap/StringBuilder.h
Normal file
62
Code/Tools/LightMap/StringBuilder.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 10/17/99 9:31p $*
|
||||
* *
|
||||
* $Revision:: 4 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef STRINGBUILDER_H
|
||||
#define STRINGBUILDER_H
|
||||
|
||||
class StringBuilder {
|
||||
|
||||
public:
|
||||
StringBuilder (unsigned buffersize);
|
||||
StringBuilder (char *buffer, unsigned buffersize);
|
||||
~StringBuilder ();
|
||||
|
||||
char *String() {return (Buffer);}
|
||||
char *Copy (const char *controlstring, ...);
|
||||
char *Concatenate (const char *controlstring, ...);
|
||||
|
||||
private:
|
||||
|
||||
StringBuilder ();
|
||||
|
||||
char *Buffer;
|
||||
unsigned BufferSize;
|
||||
bool BufferAllocated;
|
||||
};
|
||||
|
||||
|
||||
#endif // STRINGBUILDER_H
|
||||
|
||||
65
Code/Tools/LightMap/TextureNameNode.h
Normal file
65
Code/Tools/LightMap/TextureNameNode.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 11/13/99 10:26p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef _TEXTURENAMENODE_H
|
||||
#define _TEXTURENAMENODE_H
|
||||
|
||||
|
||||
class TextureNameNode
|
||||
{
|
||||
public:
|
||||
TextureNameNode() {TextureName = NULL; Next = NULL;}
|
||||
TextureNameNode (const char *texturename)
|
||||
{
|
||||
ASSERT (texturename != NULL);
|
||||
TextureName = new char [strlen (texturename) + 1];
|
||||
ASSERT (TextureName != NULL);
|
||||
strcpy (TextureName, texturename);
|
||||
Next = NULL;
|
||||
}
|
||||
|
||||
~TextureNameNode()
|
||||
{
|
||||
if (TextureName != NULL) delete [] TextureName;
|
||||
}
|
||||
|
||||
// Public data.
|
||||
char *TextureName;
|
||||
TextureNameNode *Next;
|
||||
};
|
||||
|
||||
|
||||
#endif // _TEXTURENAMENODE_H
|
||||
182
Code/Tools/LightMap/Triangle.h
Normal file
182
Code/Tools/LightMap/Triangle.h
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : LightMap *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tool $*
|
||||
* *
|
||||
* $Author:: Ian_l $*
|
||||
* *
|
||||
* $Modtime:: 8/10/00 4:10p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef _TRIANGLE_H
|
||||
#define _TRIANGLE_H
|
||||
|
||||
// Includes.
|
||||
#include "vector3.h"
|
||||
#include "vector2.h"
|
||||
|
||||
class TextureNameNode;
|
||||
|
||||
class Triangle
|
||||
{
|
||||
public:
|
||||
|
||||
enum VerticesCountEnum {
|
||||
VERTICES_COUNT = 3 // No. of vertices in a triangle. Fixed for this class.
|
||||
};
|
||||
|
||||
struct TriangleVertices
|
||||
{
|
||||
Vector3 Point;
|
||||
Vector2 UV;
|
||||
|
||||
bool operator == (const TriangleVertices &t) {
|
||||
return ((Point == t.Point) && (UV == t.UV));
|
||||
}
|
||||
};
|
||||
|
||||
// Equality operator.
|
||||
bool operator == (const Triangle &t) {
|
||||
return ((Normal == t.Normal) &&
|
||||
(Vertices [0] == t.Vertices [0]) &&
|
||||
(Vertices [1] == t.Vertices [1]) &&
|
||||
(Vertices [2] == t.Vertices [2]));
|
||||
}
|
||||
|
||||
// Inequality operator.
|
||||
bool operator != (const Triangle &t) {
|
||||
return (!(*this == t));
|
||||
}
|
||||
|
||||
bool Is_Equivalent (const Triangle &triangle) const;
|
||||
bool Abuts (const Triangle &triangle) const;
|
||||
|
||||
Vector3 Normal; // Face normal.
|
||||
TriangleVertices Vertices [VERTICES_COUNT]; // Location of triangle in object space and texture space.
|
||||
TextureNameNode *TextureNameNodePtr; // List of textures associated with this triangle.
|
||||
unsigned TextureID; // ID to uniquely identify the texture.
|
||||
};
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* Triangle::Is_Equivalent -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/13/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
inline bool Triangle::Is_Equivalent (const Triangle &triangle) const
|
||||
{
|
||||
bool foundequivalent;
|
||||
bool hasequivalent [VERTICES_COUNT];
|
||||
|
||||
// Rules for equivalence are:
|
||||
// (a) Normal vectors must match
|
||||
// (b) Points must match (but may not necessarily be in the same order).
|
||||
|
||||
if (Normal != triangle.Normal) return (false);
|
||||
|
||||
hasequivalent [0] = false;
|
||||
hasequivalent [1] = false;
|
||||
hasequivalent [2] = false;
|
||||
for (unsigned a = 0; a < VERTICES_COUNT; a++) {
|
||||
foundequivalent = false;
|
||||
for (unsigned b = 0; b < VERTICES_COUNT; b++) {
|
||||
if (!hasequivalent [b]) {
|
||||
if (Vertices [a].Point == triangle.Vertices [b].Point) {
|
||||
hasequivalent [b] = true;
|
||||
foundequivalent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundequivalent) return (false);
|
||||
}
|
||||
|
||||
// Triangles are equivalent.
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* Triangle::Abuts -- *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 08/03/00 IML : Created. *
|
||||
*=============================================================================================*/
|
||||
inline bool Triangle::Abuts (const Triangle &triangle) const
|
||||
{
|
||||
bool iscoincident [VERTICES_COUNT];
|
||||
unsigned coincidentcount;
|
||||
|
||||
// Rules for abutting are:
|
||||
// (1) Exactly two points must match.
|
||||
|
||||
iscoincident [0] = false;
|
||||
iscoincident [1] = false;
|
||||
iscoincident [2] = false;
|
||||
coincidentcount = 0;
|
||||
for (unsigned a = 0; a < VERTICES_COUNT; a++) {
|
||||
for (unsigned b = 0; b < VERTICES_COUNT; b++) {
|
||||
if (!iscoincident [b]) {
|
||||
if (Vertices [a].Point == triangle.Vertices [b].Point) {
|
||||
iscoincident [b] = true;
|
||||
coincidentcount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (coincidentcount == 2);
|
||||
}
|
||||
|
||||
|
||||
class PackingTriangle : public Triangle
|
||||
{
|
||||
public:
|
||||
|
||||
// Public data.
|
||||
Vector2 PackedUVs [Triangle::VERTICES_COUNT];
|
||||
unsigned PackedTextureID;
|
||||
};
|
||||
|
||||
|
||||
#endif // _TRIANGLE_H
|
||||
59
Code/Tools/LightMap/resource.h
Normal file
59
Code/Tools/LightMap/resource.h
Normal file
@@ -0,0 +1,59 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by LightMap.rc
|
||||
//
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDD_OPTIONS 139
|
||||
#define IDD_PACKING 142
|
||||
#define IDD_MESH_STATUS 143
|
||||
#define IDD_SELECTION 144
|
||||
#define IDD_INSERT_SOLVE 146
|
||||
#define IDC_PIXEL_FORMAT 1007
|
||||
#define IDC_16_BITS_PER_PIXEL 1008
|
||||
#define IDC_24_BITS_PER_PIXEL 1009
|
||||
#define IDC_8_BITS_PER_PIXEL 1010
|
||||
#define IDC_SCALE_FACTOR 1011
|
||||
#define IDC_SCALE_FACTOR_VALUE 1017
|
||||
#define IDC_SAMPLE_RATE_VALUE 1017
|
||||
#define IDC_VERSION_TEXT 1020
|
||||
#define IDC_FILL_COLOR_RED 1021
|
||||
#define IDC_FILL_COLOR_GREEN 1022
|
||||
#define IDC_FILL_COLOR_BLUE 1024
|
||||
#define IDC_FILTER_ERROR 1026
|
||||
#define IDC_FILTER_ERROR_VALUE 1028
|
||||
#define IDC_PACKING_LIST 1043
|
||||
#define IDC_FILTER_SHARPNESS 1048
|
||||
#define IDC_SMOOTHING_ANGLE 1049
|
||||
#define IDC_SPATIAL_TOLERANCE 1050
|
||||
#define IDC_SMOOTHING_ANGLE_VALUE 1051
|
||||
#define IDC_FILTER_SHARPNESS_VALUE 1052
|
||||
#define IDC_MESH_STATUS_TEXT 1056
|
||||
#define IDC_SELECTION_LIST 1057
|
||||
#define IDC_SAMPLE_RATE 1059
|
||||
#define IDC_MORE_OPTIONS 1062
|
||||
#define IDC_SOLVE_FILE_LIST 1063
|
||||
#define IDC_BROWSE 1064
|
||||
#define IDC_APPLY_SELECTIVE 1065
|
||||
#define IDC_BLEND_NOISE 1066
|
||||
#define IDC_INCLUSION_STRING 1067
|
||||
#define IDC_LIGHT_EXPORT_SELECTIVE 1068
|
||||
#define IDC_LIGHT_EXCLUSION_STRING 1069
|
||||
#define IDC_CONTAINING 1078
|
||||
#define IDC_NOT_CONTAINING 1079
|
||||
#define ID_INSERT_SOLVE 32773
|
||||
#define ID_TOOLS_OPTIONS 32777
|
||||
#define ID_TOOLS_PACKING 32779
|
||||
#define ID_FILE 32783
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 147
|
||||
#define _APS_NEXT_COMMAND_VALUE 32785
|
||||
#define _APS_NEXT_CONTROL_VALUE 1080
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user