mirror of
https://github.com/electronicarts/CnC_Renegade.git
synced 2025-12-16 15:41:39 -05:00
Initial commit of Command & Conquer Renegade source code.
This commit is contained in:
97
Code/Tests/SplineTest/CardinalDialog.cpp
Normal file
97
Code/Tests/SplineTest/CardinalDialog.cpp
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// CardinalDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "SplineTest.h"
|
||||
#include "CardinalDialog.h"
|
||||
#include "curve.h"
|
||||
#include "hermitespline.h"
|
||||
#include "catmullromspline.h"
|
||||
#include "cardinalspline.h"
|
||||
#include "tcbspline.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCardinalDialog dialog
|
||||
|
||||
|
||||
CCardinalDialog::CCardinalDialog(CWnd* pParent /*=NULL*/,CardinalSpline3DClass * curve,int key)
|
||||
: CDialog(CCardinalDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CCardinalDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
Curve = curve;
|
||||
Key = key;
|
||||
}
|
||||
|
||||
|
||||
void CCardinalDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CCardinalDialog)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CCardinalDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CCardinalDialog)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCardinalDialog message handlers
|
||||
|
||||
BOOL CCardinalDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
SetDlgItemFloat(IDC_TIGHTNESS_EDIT,Curve->Get_Tightness(Key));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CCardinalDialog::OnOK()
|
||||
{
|
||||
Curve->Set_Tightness(Key,GetDlgItemFloat(IDC_TIGHTNESS_EDIT));
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
float CCardinalDialog::GetDlgItemFloat(int controlid)
|
||||
{
|
||||
CString string;
|
||||
GetDlgItemText(controlid,string);
|
||||
return atof(string);
|
||||
}
|
||||
|
||||
void CCardinalDialog::SetDlgItemFloat(int controlid,float val)
|
||||
{
|
||||
CString string;
|
||||
string.Format("%.2f",val);
|
||||
SetDlgItemText(controlid,string);
|
||||
}
|
||||
73
Code/Tests/SplineTest/CardinalDialog.h
Normal file
73
Code/Tests/SplineTest/CardinalDialog.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_CARDINALDIALOG_H__2AE09FE7_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
#define AFX_CARDINALDIALOG_H__2AE09FE7_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// CardinalDialog.h : header file
|
||||
//
|
||||
|
||||
class CardinalSpline3DClass;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCardinalDialog dialog
|
||||
|
||||
class CCardinalDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CCardinalDialog(CWnd* pParent,CardinalSpline3DClass * curve,int key);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CCardinalDialog)
|
||||
enum { IDD = IDD_CARDINAL_DIALOG };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CCardinalDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
CardinalSpline3DClass * Curve;
|
||||
int Key;
|
||||
|
||||
float GetDlgItemFloat(int controlid);
|
||||
void SetDlgItemFloat(int controlid,float val);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CCardinalDialog)
|
||||
virtual void OnOK();
|
||||
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_CARDINALDIALOG_H__2AE09FE7_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
39
Code/Tests/SplineTest/CurvePoints.cpp
Normal file
39
Code/Tests/SplineTest/CurvePoints.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CurvePoints.h"
|
||||
|
||||
|
||||
float _ControlPoints[CONTROL_POINT_COUNT][4] =
|
||||
{
|
||||
{ 0.0f,0.0f,0.0f,0.0f },
|
||||
{ 2.0f,1.0f,0.0f,1.0f },
|
||||
{ 4.0f,3.0f,0.0f,2.0f },
|
||||
{ 5.0f,5.0f,0.0f,3.0f },
|
||||
{ 7.0f,2.0f,0.0f,4.0f },
|
||||
};
|
||||
|
||||
float _TCBParams[CONTROL_POINT_COUNT][3] =
|
||||
{
|
||||
{ 0.0f,1.0f,0.0f },
|
||||
{ 0.0f,1.0f,0.0f },
|
||||
{ 0.0f,1.0f,0.0f },
|
||||
{ 0.0f,1.0f,0.0f },
|
||||
{ 0.0f,1.0f,0.0f },
|
||||
};
|
||||
25
Code/Tests/SplineTest/CurvePoints.h
Normal file
25
Code/Tests/SplineTest/CurvePoints.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
#ifndef CURVEPOINTS_H
|
||||
|
||||
const int CONTROL_POINT_COUNT = 5;
|
||||
extern float _ControlPoints[CONTROL_POINT_COUNT][4];
|
||||
extern float _TCBParams[CONTROL_POINT_COUNT][3];
|
||||
|
||||
#endif
|
||||
272
Code/Tests/SplineTest/MainFrm.cpp
Normal file
272
Code/Tests/SplineTest/MainFrm.cpp
Normal file
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// MainFrm.cpp : implementation of the CMainFrame class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "SplineTest.h"
|
||||
|
||||
#include "MainFrm.h"
|
||||
#include "SplineTestDoc.h"
|
||||
#include "SplineTestView.h"
|
||||
#include "curve.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame
|
||||
|
||||
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
|
||||
//{{AFX_MSG_MAP(CMainFrame)
|
||||
ON_WM_CREATE()
|
||||
ON_COMMAND(ID_CURVE_CARDINAL, OnCurveCardinal)
|
||||
ON_UPDATE_COMMAND_UI(ID_CURVE_CARDINAL, OnUpdateCurveCardinal)
|
||||
ON_COMMAND(ID_CURVE_CATMULL_ROM, OnCurveCatmullRom)
|
||||
ON_UPDATE_COMMAND_UI(ID_CURVE_CATMULL_ROM, OnUpdateCurveCatmullRom)
|
||||
ON_COMMAND(ID_CURVE_LINEAR, OnCurveLinear)
|
||||
ON_UPDATE_COMMAND_UI(ID_CURVE_LINEAR, OnUpdateCurveLinear)
|
||||
ON_COMMAND(ID_CURVE_TCB, OnCurveTcb)
|
||||
ON_UPDATE_COMMAND_UI(ID_CURVE_TCB, OnUpdateCurveTcb)
|
||||
ON_COMMAND(ID_CURVE_RESET, OnCurveReset)
|
||||
ON_COMMAND(ID_CURVE_DRAW_TANGENTS, OnCurveDrawTangents)
|
||||
ON_UPDATE_COMMAND_UI(ID_CURVE_DRAW_TANGENTS, OnUpdateCurveDrawTangents)
|
||||
ON_COMMAND(ID_CURVE_LOOP, OnCurveLoop)
|
||||
ON_UPDATE_COMMAND_UI(ID_CURVE_LOOP, OnUpdateCurveLoop)
|
||||
ON_COMMAND(IDM_VEHICLE_CURVE, OnVehicleCurve)
|
||||
ON_UPDATE_COMMAND_UI(IDM_VEHICLE_CURVE, OnUpdateVehicleCurve)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
static UINT indicators[] =
|
||||
{
|
||||
ID_SEPARATOR, // status line indicator
|
||||
ID_INDICATOR_CAPS,
|
||||
ID_INDICATOR_NUM,
|
||||
ID_INDICATOR_SCRL,
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame construction/destruction
|
||||
|
||||
CMainFrame::CMainFrame()
|
||||
{
|
||||
// TODO: add member initialization code here
|
||||
|
||||
}
|
||||
|
||||
CMainFrame::~CMainFrame()
|
||||
{
|
||||
}
|
||||
|
||||
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
#if 0
|
||||
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
|
||||
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
||||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
||||
{
|
||||
TRACE0("Failed to create toolbar\n");
|
||||
return -1; // fail to create
|
||||
}
|
||||
#endif
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// TODO: Delete these three lines if you don't want the toolbar to
|
||||
// be dockable
|
||||
#if 0
|
||||
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
||||
EnableDocking(CBRS_ALIGN_ANY);
|
||||
DockControlBar(&m_wndToolBar);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
if( !CFrameWnd::PreCreateWindow(cs) )
|
||||
return FALSE;
|
||||
// TODO: Modify the Window class or styles here by modifying
|
||||
// the CREATESTRUCT cs
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CMainFrame::AssertValid() const
|
||||
{
|
||||
CFrameWnd::AssertValid();
|
||||
}
|
||||
|
||||
void CMainFrame::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CFrameWnd::Dump(dc);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame message handlers
|
||||
|
||||
void CMainFrame::OnCurveCardinal()
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc) {
|
||||
doc->Set_Curve_Type(CSplineTestDoc::CARDINAL);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateCurveCardinal(CCmdUI* pCmdUI)
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc != NULL) {
|
||||
pCmdUI->SetCheck(doc->Get_Curve_Type() == CSplineTestDoc::CARDINAL);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnCurveCatmullRom()
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc) {
|
||||
doc->Set_Curve_Type(CSplineTestDoc::CATMULL_ROM);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateCurveCatmullRom(CCmdUI* pCmdUI)
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc != NULL) {
|
||||
pCmdUI->SetCheck(doc->Get_Curve_Type() == CSplineTestDoc::CATMULL_ROM);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnCurveLinear()
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc) {
|
||||
doc->Set_Curve_Type(CSplineTestDoc::LINEAR);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateCurveLinear(CCmdUI* pCmdUI)
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc != NULL) {
|
||||
pCmdUI->SetCheck(doc->Get_Curve_Type() == CSplineTestDoc::LINEAR);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnCurveTcb()
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc) {
|
||||
doc->Set_Curve_Type(CSplineTestDoc::TCB);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateCurveTcb(CCmdUI* pCmdUI)
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc != NULL) {
|
||||
pCmdUI->SetCheck(doc->Get_Curve_Type() == CSplineTestDoc::TCB);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnCurveReset()
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc != NULL) {
|
||||
doc->Reset_Curve();
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnCurveDrawTangents()
|
||||
{
|
||||
CSplineTestView * view = (CSplineTestView *)GetActiveView();
|
||||
if (view) {
|
||||
view->Enable_Draw_Tangents(!view->Is_Draw_Tangents_Enabled());
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateCurveDrawTangents(CCmdUI* pCmdUI)
|
||||
{
|
||||
CSplineTestView * view = (CSplineTestView *)GetActiveView();
|
||||
if (view) {
|
||||
pCmdUI->SetCheck(view->Is_Draw_Tangents_Enabled());
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnCurveLoop()
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc != NULL) {
|
||||
Curve3DClass * curve = doc->Get_Curve();
|
||||
if (curve) {
|
||||
curve->Set_Looping(!curve->Is_Looping());
|
||||
}
|
||||
doc->UpdateAllViews(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateCurveLoop(CCmdUI* pCmdUI)
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc != NULL) {
|
||||
Curve3DClass * curve = doc->Get_Curve();
|
||||
if (curve) {
|
||||
pCmdUI->SetCheck(curve->Is_Looping());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnVehicleCurve()
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc) {
|
||||
doc->Set_Curve_Type(CSplineTestDoc::VEHICLE );
|
||||
}
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateVehicleCurve(CCmdUI* pCmdUI)
|
||||
{
|
||||
CSplineTestDoc * doc = (CSplineTestDoc *)GetActiveDocument();
|
||||
if (doc != NULL) {
|
||||
pCmdUI->SetCheck(doc->Get_Curve_Type() == CSplineTestDoc::VEHICLE);
|
||||
}
|
||||
}
|
||||
89
Code/Tests/SplineTest/MainFrm.h
Normal file
89
Code/Tests/SplineTest/MainFrm.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// MainFrm.h : interface of the CMainFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_MAINFRM_H__2AE09FD9_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
#define AFX_MAINFRM_H__2AE09FD9_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
class CMainFrame : public CFrameWnd
|
||||
{
|
||||
|
||||
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
|
||||
|
||||
protected: // control bar embedded members
|
||||
CStatusBar m_wndStatusBar;
|
||||
// CToolBar m_wndToolBar;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMainFrame)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnCurveCardinal();
|
||||
afx_msg void OnUpdateCurveCardinal(CCmdUI* pCmdUI);
|
||||
afx_msg void OnCurveCatmullRom();
|
||||
afx_msg void OnUpdateCurveCatmullRom(CCmdUI* pCmdUI);
|
||||
afx_msg void OnCurveLinear();
|
||||
afx_msg void OnUpdateCurveLinear(CCmdUI* pCmdUI);
|
||||
afx_msg void OnCurveTcb();
|
||||
afx_msg void OnUpdateCurveTcb(CCmdUI* pCmdUI);
|
||||
afx_msg void OnCurveReset();
|
||||
afx_msg void OnCurveDrawTangents();
|
||||
afx_msg void OnUpdateCurveDrawTangents(CCmdUI* pCmdUI);
|
||||
afx_msg void OnCurveLoop();
|
||||
afx_msg void OnUpdateCurveLoop(CCmdUI* pCmdUI);
|
||||
afx_msg void OnVehicleCurve();
|
||||
afx_msg void OnUpdateVehicleCurve(CCmdUI* pCmdUI);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MAINFRM_H__2AE09FD9_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
170
Code/Tests/SplineTest/SplineTest.cpp
Normal file
170
Code/Tests/SplineTest/SplineTest.cpp
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// SplineTest.cpp : Defines the class behaviors for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "SplineTest.h"
|
||||
|
||||
#include "MainFrm.h"
|
||||
#include "SplineTestDoc.h"
|
||||
#include "SplineTestView.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSplineTestApp, CWinApp)
|
||||
//{{AFX_MSG_MAP(CSplineTestApp)
|
||||
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
// Standard file based document commands
|
||||
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
|
||||
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestApp construction
|
||||
|
||||
CSplineTestApp::CSplineTestApp()
|
||||
{
|
||||
// TODO: add construction code here,
|
||||
// Place all significant initialization in InitInstance
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// The one and only CSplineTestApp object
|
||||
|
||||
CSplineTestApp theApp;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestApp initialization
|
||||
|
||||
BOOL CSplineTestApp::InitInstance()
|
||||
{
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// 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
|
||||
// the 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
|
||||
|
||||
// Change the registry key under which our settings are stored.
|
||||
// TODO: You should modify this string to be something appropriate
|
||||
// such as the name of your company or organization.
|
||||
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
|
||||
|
||||
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(CSplineTestDoc),
|
||||
RUNTIME_CLASS(CMainFrame), // main SDI frame window
|
||||
RUNTIME_CLASS(CSplineTestView));
|
||||
AddDocTemplate(pDocTemplate);
|
||||
|
||||
// Parse command line for standard shell commands, DDE, file open
|
||||
CCommandLineInfo cmdInfo;
|
||||
ParseCommandLine(cmdInfo);
|
||||
|
||||
// Dispatch commands specified on the command line
|
||||
if (!ProcessShellCommand(cmdInfo))
|
||||
return FALSE;
|
||||
|
||||
// The one and only window has been initialized, so show and update it.
|
||||
m_pMainWnd->ShowWindow(SW_SHOW);
|
||||
m_pMainWnd->UpdateWindow();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAboutDlg dialog used for App About
|
||||
|
||||
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)
|
||||
// No message handlers
|
||||
//}}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)
|
||||
// No message handlers
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
// App command to run the dialog
|
||||
void CSplineTestApp::OnAppAbout()
|
||||
{
|
||||
CAboutDlg aboutDlg;
|
||||
aboutDlg.DoModal();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestApp message handlers
|
||||
|
||||
196
Code/Tests/SplineTest/SplineTest.dsp
Normal file
196
Code/Tests/SplineTest/SplineTest.dsp
Normal file
@@ -0,0 +1,196 @@
|
||||
# Microsoft Developer Studio Project File - Name="SplineTest" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=SplineTest - 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 "SplineTest.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 "SplineTest.mak" CFG="SplineTest - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "SplineTest - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "SplineTest - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""$/Commando/Code/Tests/SplineTest", KGQBAAAA"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "SplineTest - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 6
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 6
|
||||
# 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 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\wwmath" /I "..\..\wwlib" /I "..\..\wwdebug" /I "..\..\wwsaveload" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /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 /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 wwmath.lib wwdebug.lib wwlib.lib wwsaveload.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\Libs\release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SplineTest - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 6
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 6
|
||||
# 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 /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\wwsaveload" /I "..\..\wwmath" /I "..\..\wwlib" /I "..\..\wwdebug" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /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" /d "_AFXDLL"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
|
||||
# ADD LINK32 wwmath.lib wwdebug.lib wwlib.lib wwsaveload.lib /nologo /subsystem:windows /debug /machine:I386 /libpath:"..\..\Libs\debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "SplineTest - Win32 Release"
|
||||
# Name "SplineTest - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CardinalDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CurvePoints.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MainFrm.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SplineTest.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SplineTest.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SplineTestDoc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SplineTestView.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"stdafx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TCBDialog.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CardinalDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CurvePoints.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MainFrm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SplineTest.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SplineTestDoc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SplineTestView.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TCBDialog.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\SplineTest.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\SplineTest.rc2
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\SplineTestDoc.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\Toolbar.bmp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ReadMe.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
67
Code/Tests/SplineTest/SplineTest.h
Normal file
67
Code/Tests/SplineTest/SplineTest.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// SplineTest.h : main header file for the SPLINETEST application
|
||||
//
|
||||
|
||||
#if !defined(AFX_SPLINETEST_H__2AE09FD5_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
#define AFX_SPLINETEST_H__2AE09FD5_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestApp:
|
||||
// See SplineTest.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CSplineTestApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CSplineTestApp();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSplineTestApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
//{{AFX_MSG(CSplineTestApp)
|
||||
afx_msg void OnAppAbout();
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_SPLINETEST_H__2AE09FD5_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
408
Code/Tests/SplineTest/SplineTest.rc
Normal file
408
Code/Tests/SplineTest/SplineTest.rc
Normal file
@@ -0,0 +1,408 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||
"\r\n"
|
||||
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
|
||||
"#ifdef _WIN32\r\n"
|
||||
"LANGUAGE 9, 1\r\n"
|
||||
"#pragma code_page(1252)\r\n"
|
||||
"#endif //_WIN32\r\n"
|
||||
"#include ""res\\SplineTest.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||
"#include ""afxres.rc"" // Standard components\r\n"
|
||||
"#endif\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON DISCARDABLE "res\\SplineTest.ico"
|
||||
IDR_SPLINETYPE ICON DISCARDABLE "res\\SplineTestDoc.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&New\tCtrl+N", ID_FILE_NEW
|
||||
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
|
||||
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
|
||||
MENUITEM "Save &As...", ID_FILE_SAVE_AS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", ID_APP_EXIT
|
||||
END
|
||||
POPUP "&View"
|
||||
BEGIN
|
||||
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
|
||||
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About SplineTest...", ID_APP_ABOUT
|
||||
END
|
||||
POPUP "Curve"
|
||||
BEGIN
|
||||
MENUITEM "Reset", ID_CURVE_RESET
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Linear", ID_CURVE_LINEAR
|
||||
MENUITEM "Catmull Rom", ID_CURVE_CATMULL_ROM
|
||||
MENUITEM "Cardinal", ID_CURVE_CARDINAL
|
||||
MENUITEM "TCB", ID_CURVE_TCB
|
||||
MENUITEM "Vehicle Curve", IDM_VEHICLE_CURVE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Draw Tangents", ID_CURVE_DRAW_TANGENTS
|
||||
MENUITEM "Loop", ID_CURVE_LOOP
|
||||
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, 235, 55
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About SplineTest"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
|
||||
LTEXT "SplineTest Version 1.0",IDC_STATIC,40,10,119,8,
|
||||
SS_NOPREFIX
|
||||
LTEXT "Copyright (C) 1999",IDC_STATIC,40,25,119,8
|
||||
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
|
||||
END
|
||||
|
||||
IDD_CARDINAL_DIALOG DIALOG DISCARDABLE 0, 0, 186, 50
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Cardinal Spline Key Properties"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
|
||||
EDITTEXT IDC_TIGHTNESS_EDIT,61,15,40,14,ES_AUTOHSCROLL
|
||||
LTEXT "Tightness:",IDC_STATIC,7,18,34,8
|
||||
END
|
||||
|
||||
IDD_TCB_DIALOG DIALOG DISCARDABLE 0, 0, 157, 66
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "TCB Parameters Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,100,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,100,24,50,14
|
||||
EDITTEXT IDC_TENSION_EDIT,50,7,40,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_CONTINUITY_EDIT,50,25,40,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_BIAS_EDIT,50,44,40,14,ES_AUTOHSCROLL
|
||||
LTEXT "Tension:",IDC_STATIC,7,11,28,8
|
||||
LTEXT "Continuity:",IDC_STATIC,7,29,34,8
|
||||
LTEXT "Bias:",IDC_STATIC,7,48,16,8
|
||||
END
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SplineTest MFC Application\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 1\0"
|
||||
VALUE "InternalName", "SplineTest\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 1999\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "SplineTest.EXE\0"
|
||||
VALUE "ProductName", "SplineTest Application\0"
|
||||
VALUE "ProductVersion", "1, 0, 0, 1\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, 228
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 48
|
||||
END
|
||||
|
||||
IDD_CARDINAL_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 43
|
||||
END
|
||||
|
||||
IDD_TCB_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 150
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 59
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "SplineTest\n\nSpline\n\n\nSplineTest.Document\nSpline Document"
|
||||
END
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
AFX_IDS_APP_TITLE "SplineTest"
|
||||
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_CURVE_LINEAR "Use linear interpolation"
|
||||
ID_CURVE_CATMULL_ROM "Use a Catmull-Rom spline"
|
||||
ID_CURVE_CARDINAL "Use a cardinal spline"
|
||||
ID_CURVE_TCB "Use a Tension-Continuity-Bias spline (Konachek-Bartels)"
|
||||
ID_CURVE_RESET "Reset the curve"
|
||||
ID_CURVE_DRAW_TANGENTS "Display the tangent vectors"
|
||||
ID_CURVE_LOOP "Make the curve a loop"
|
||||
IDM_VEHICLE_CURVE "Test a simulated vehicle path"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#define _AFX_NO_SPLITTER_RESOURCES
|
||||
#define _AFX_NO_OLE_RESOURCES
|
||||
#define _AFX_NO_TRACKER_RESOURCES
|
||||
#define _AFX_NO_PROPERTY_RESOURCES
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE 9, 1
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
#include "res\SplineTest.rc2" // non-Microsoft Visual C++ edited resources
|
||||
#include "afxres.rc" // Standard components
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
279
Code/Tests/SplineTest/SplineTestDoc.cpp
Normal file
279
Code/Tests/SplineTest/SplineTestDoc.cpp
Normal file
@@ -0,0 +1,279 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// SplineTestDoc.cpp : implementation of the CSplineTestDoc class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "SplineTest.h"
|
||||
|
||||
#include "SplineTestDoc.h"
|
||||
#include "CurvePoints.h"
|
||||
#include "curve.h"
|
||||
#include "hermitespline.h"
|
||||
#include "catmullromspline.h"
|
||||
#include "cardinalspline.h"
|
||||
#include "tcbspline.h"
|
||||
#include "wwmath.h"
|
||||
#include "CardinalDialog.h"
|
||||
#include "TCBDialog.h"
|
||||
#include "Matrix3D.h"
|
||||
#include "vehiclecurve.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
const float GRAB_DIST = 0.25f;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestDoc
|
||||
|
||||
IMPLEMENT_DYNCREATE(CSplineTestDoc, CDocument)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSplineTestDoc, CDocument)
|
||||
//{{AFX_MSG_MAP(CSplineTestDoc)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestDoc construction/destruction
|
||||
CSplineTestDoc::CSplineTestDoc()
|
||||
{
|
||||
CurveType = LINEAR;
|
||||
Curve = new LinearCurve3DClass;
|
||||
DragIndex = -1;
|
||||
}
|
||||
|
||||
CSplineTestDoc::~CSplineTestDoc()
|
||||
{
|
||||
if (Curve != NULL) {
|
||||
delete Curve;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CSplineTestDoc::OnNewDocument()
|
||||
{
|
||||
if (!CDocument::OnNewDocument())
|
||||
return FALSE;
|
||||
|
||||
// TODO: add reinitialization code here
|
||||
// (SDI documents will reuse this document)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestDoc serialization
|
||||
|
||||
void CSplineTestDoc::Serialize(CArchive& ar)
|
||||
{
|
||||
if (ar.IsStoring())
|
||||
{
|
||||
// TODO: add storing code here
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: add loading code here
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestDoc diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CSplineTestDoc::AssertValid() const
|
||||
{
|
||||
CDocument::AssertValid();
|
||||
}
|
||||
|
||||
void CSplineTestDoc::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CDocument::Dump(dc);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestDoc commands
|
||||
|
||||
void CSplineTestDoc::Reset_Curve(void)
|
||||
{
|
||||
if (Curve != NULL) {
|
||||
delete Curve;
|
||||
}
|
||||
Curve = Create_Curve(CurveType);
|
||||
DragIndex = -1;
|
||||
UpdateAllViews(NULL);
|
||||
}
|
||||
|
||||
void CSplineTestDoc::Set_Curve_Type(int type)
|
||||
{
|
||||
assert (Curve != NULL);
|
||||
|
||||
if (type != CurveType) {
|
||||
Curve3DClass * new_curve = NULL;
|
||||
new_curve = Create_Curve(type);
|
||||
|
||||
for (int i=0; i<Curve->Key_Count(); i++) {
|
||||
Vector3 pt;
|
||||
float t;
|
||||
Curve->Get_Key(i,&pt,&t);
|
||||
new_curve->Add_Key(pt,t);
|
||||
|
||||
UpdateAllViews(NULL);
|
||||
}
|
||||
|
||||
delete Curve;
|
||||
Curve = new_curve;
|
||||
|
||||
CurveType = type;
|
||||
}
|
||||
}
|
||||
|
||||
int CSplineTestDoc::Get_Curve_Type(void)
|
||||
{
|
||||
return CurveType;
|
||||
}
|
||||
|
||||
Curve3DClass * CSplineTestDoc::Get_Curve(void)
|
||||
{
|
||||
return Curve;
|
||||
}
|
||||
|
||||
Curve3DClass * CSplineTestDoc::Create_Curve(int type)
|
||||
{
|
||||
Curve3DClass * new_curve = NULL;
|
||||
switch (type) {
|
||||
case LINEAR:
|
||||
new_curve = new LinearCurve3DClass;
|
||||
break;
|
||||
case VEHICLE:
|
||||
new_curve = new VehicleCurveClass (1.0F);
|
||||
break;
|
||||
case CATMULL_ROM:
|
||||
new_curve = new CatmullRomSpline3DClass;
|
||||
break;
|
||||
case CARDINAL:
|
||||
new_curve = new CardinalSpline3DClass;
|
||||
break;
|
||||
case TCB:
|
||||
new_curve = new TCBSpline3DClass;
|
||||
break;
|
||||
}
|
||||
return new_curve;
|
||||
}
|
||||
|
||||
bool CSplineTestDoc::Grab_Point(const Vector3 & pos)
|
||||
{
|
||||
DragIndex = -1;
|
||||
if (Curve) {
|
||||
DragIndex = Pick(pos);
|
||||
}
|
||||
|
||||
return (DragIndex != -1);
|
||||
}
|
||||
|
||||
bool CSplineTestDoc::Drag_Point(const Vector3 & pos)
|
||||
{
|
||||
if (DragIndex == -1) {
|
||||
return false;
|
||||
} else {
|
||||
if (Curve) {
|
||||
Curve->Set_Key(DragIndex,pos);
|
||||
UpdateAllViews(NULL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CSplineTestDoc::Release_Point(void)
|
||||
{
|
||||
DragIndex = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSplineTestDoc::Is_Dragging(void)
|
||||
{
|
||||
return (DragIndex != -1);
|
||||
}
|
||||
|
||||
bool CSplineTestDoc::Add_Point(const Vector3 & pos)
|
||||
{
|
||||
if (Curve == NULL) return false;
|
||||
if (Curve->Key_Count() == 0) {
|
||||
Curve->Add_Key(pos,0.0f);
|
||||
} else {
|
||||
// make dt random for testing
|
||||
Curve->Add_Key(pos,Curve->Get_End_Time() + 1.0f); //WWMath::Random_Float(0.1f,5.0f));
|
||||
}
|
||||
UpdateAllViews(NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
int CSplineTestDoc::Pick(const Vector3 & pos)
|
||||
{
|
||||
int index = -1;
|
||||
for (int pi=0; pi<Curve->Key_Count(); pi++) {
|
||||
Vector3 keypt;
|
||||
Curve->Get_Key(pi,&keypt,NULL);
|
||||
if ((keypt - pos).Length() < GRAB_DIST) {
|
||||
index = pi;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
void CSplineTestDoc::Edit_Point(const Vector3 & pos)
|
||||
{
|
||||
int index = Pick(pos);
|
||||
if (index == -1) return;
|
||||
|
||||
switch (CurveType) {
|
||||
case LINEAR:
|
||||
case CATMULL_ROM:
|
||||
case VEHICLE:
|
||||
break;
|
||||
case CARDINAL:
|
||||
{
|
||||
CCardinalDialog dlg(::AfxGetMainWnd(),(CardinalSpline3DClass *)Curve,index);
|
||||
dlg.DoModal();
|
||||
break;
|
||||
}
|
||||
case TCB:
|
||||
{
|
||||
CTCBDialog dlg(::AfxGetMainWnd(),(TCBSpline3DClass *)Curve,index);
|
||||
dlg.DoModal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAllViews(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void CSplineTestDoc::Simulate_Turn_Radius (void)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
103
Code/Tests/SplineTest/SplineTestDoc.h
Normal file
103
Code/Tests/SplineTest/SplineTestDoc.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// SplineTestDoc.h : interface of the CSplineTestDoc class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_SPLINETESTDOC_H__2AE09FDB_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
#define AFX_SPLINETESTDOC_H__2AE09FDB_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "vector.h"
|
||||
|
||||
class Curve3DClass;
|
||||
class Vector3;
|
||||
|
||||
|
||||
class CSplineTestDoc : public CDocument
|
||||
{
|
||||
protected: // create from serialization only
|
||||
CSplineTestDoc();
|
||||
DECLARE_DYNCREATE(CSplineTestDoc)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSplineTestDoc)
|
||||
public:
|
||||
virtual BOOL OnNewDocument();
|
||||
virtual void Serialize(CArchive& ar);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CSplineTestDoc();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
enum { LINEAR=0,CATMULL_ROM,CARDINAL,TCB,VEHICLE };
|
||||
|
||||
void Reset_Curve(void);
|
||||
void Set_Curve_Type(int type);
|
||||
int Get_Curve_Type(void);
|
||||
Curve3DClass * Get_Curve(void);
|
||||
|
||||
bool Grab_Point(const Vector3 & pos);
|
||||
bool Drag_Point(const Vector3 & pos);
|
||||
bool Release_Point(void);
|
||||
bool Is_Dragging(void);
|
||||
bool Add_Point(const Vector3 & pos);
|
||||
void Edit_Point(const Vector3 & pos);
|
||||
|
||||
void Simulate_Turn_Radius (void);
|
||||
|
||||
protected:
|
||||
|
||||
int Pick(const Vector3 & pos);
|
||||
Curve3DClass * Create_Curve(int type);
|
||||
|
||||
int CurveType;
|
||||
Curve3DClass * Curve;
|
||||
int DragIndex;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CSplineTestDoc)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_SPLINETESTDOC_H__2AE09FDB_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
317
Code/Tests/SplineTest/SplineTestView.cpp
Normal file
317
Code/Tests/SplineTest/SplineTestView.cpp
Normal file
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// SplineTestView.cpp : implementation of the CSplineTestView class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "SplineTest.h"
|
||||
|
||||
#include "SplineTestDoc.h"
|
||||
#include "SplineTestView.h"
|
||||
#include "curve.h"
|
||||
#include "hermitespline.h"
|
||||
#include "catmullromspline.h"
|
||||
#include "cardinalspline.h"
|
||||
#include "tcbspline.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
const float MIN_X = -10.0f;
|
||||
const float MIN_Y = -10.0f;
|
||||
const float MIN_Z = -10.0f;
|
||||
const float MAX_X = 10.0f;
|
||||
const float MAX_Y = 10.0f;
|
||||
const float MAX_Z = 10.0f;
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestView
|
||||
|
||||
IMPLEMENT_DYNCREATE(CSplineTestView, CView)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSplineTestView, CView)
|
||||
//{{AFX_MSG_MAP(CSplineTestView)
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_RBUTTONUP()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestView construction/destruction
|
||||
|
||||
CSplineTestView::CSplineTestView()
|
||||
{
|
||||
DrawTangents = false;
|
||||
}
|
||||
|
||||
CSplineTestView::~CSplineTestView()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL CSplineTestView::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
// TODO: Modify the Window class or styles here by modifying
|
||||
// the CREATESTRUCT cs
|
||||
|
||||
return CView::PreCreateWindow(cs);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestView drawing
|
||||
|
||||
void CSplineTestView::OnDraw(CDC* pDC)
|
||||
{
|
||||
CSplineTestDoc* pDoc = GetDocument();
|
||||
ASSERT_VALID(pDoc);
|
||||
|
||||
Curve3DClass * curve = pDoc->Get_Curve();
|
||||
if (curve == NULL) return;
|
||||
|
||||
Vector3 pt;
|
||||
int x,y;
|
||||
|
||||
// draw coordinate axes
|
||||
CPen blackpen;
|
||||
blackpen.CreatePen(PS_DASH,1,RGB(0,0,0));
|
||||
pDC->SelectObject(&blackpen);
|
||||
|
||||
Map_Point(Vector3(0,10,0),&x,&y);
|
||||
pDC->MoveTo(x,y);
|
||||
Map_Point(Vector3(0,-10,0),&x,&y);
|
||||
pDC->LineTo(x,y);
|
||||
Map_Point(Vector3(10,0,0),&x,&y);
|
||||
pDC->MoveTo(x,y);
|
||||
Map_Point(Vector3(-10,0,0),&x,&y);
|
||||
pDC->LineTo(x,y);
|
||||
|
||||
// draw the spline
|
||||
CPen greenpen;
|
||||
greenpen.CreatePen(PS_SOLID,2,RGB(0,255,0));
|
||||
pDC->SelectObject(&greenpen);
|
||||
|
||||
if (curve->Key_Count() >= 2) {
|
||||
float t0 = curve->Get_Start_Time();
|
||||
float t1 = curve->Get_End_Time();
|
||||
float dt = (t1 - t0) / 500.0f;
|
||||
|
||||
curve->Evaluate(t0,&pt);
|
||||
Map_Point(pt,&x,&y);
|
||||
pDC->MoveTo(x,y);
|
||||
|
||||
for (float t=t0; t<t1; t+=dt) {
|
||||
curve->Evaluate(t,&pt);
|
||||
Map_Point(pt,&x,&y);
|
||||
pDC->LineTo(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
// draw the control points
|
||||
for (int pi=0; pi<curve->Key_Count(); pi++) {
|
||||
curve->Get_Key(pi,&pt,NULL);
|
||||
Map_Point(pt,&x,&y);
|
||||
pDC->FillSolidRect(x-2,y-2,4,4, RGB(255,0,0));
|
||||
}
|
||||
|
||||
// draw the tangents
|
||||
if ((DrawTangents) && (pDoc->Get_Curve_Type() > CSplineTestDoc::LINEAR)) {
|
||||
|
||||
HermiteSpline3DClass * spline = (HermiteSpline3DClass *)curve;
|
||||
|
||||
CPen blackpen;
|
||||
blackpen.CreatePen(PS_SOLID,1,RGB(0,0,0));
|
||||
pDC->SelectObject(&blackpen);
|
||||
|
||||
for (int pi=0; pi<spline->Key_Count(); pi++) {
|
||||
|
||||
int cx,cy;
|
||||
spline->Get_Key(pi,&pt,NULL);
|
||||
Map_Point(pt,&cx,&cy);
|
||||
|
||||
Vector3 in,out;
|
||||
spline->Get_Tangents(pi,&in,&out);
|
||||
|
||||
Map_Point(pt-in,&x,&y);
|
||||
pDC->MoveTo(cx,cy);
|
||||
pDC->LineTo(x,y);
|
||||
|
||||
Map_Point(pt+out,&x,&y);
|
||||
pDC->MoveTo(cx,cy);
|
||||
pDC->LineTo(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CSplineTestView::Map_Point(const Vector3 & point,int * set_x,int * set_y)
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(&rect);
|
||||
|
||||
float nx,ny;
|
||||
|
||||
nx = (point.X - MIN_X) / (MAX_X - MIN_X);
|
||||
ny = (point.Y - MIN_Y) / (MAX_Y - MIN_Y);
|
||||
|
||||
*set_x = (float)(rect.right - rect.left) * nx + rect.left;
|
||||
*set_y = (float)(rect.top - rect.bottom) * ny + rect.bottom;
|
||||
}
|
||||
|
||||
|
||||
void CSplineTestView::Un_Map_Point(int x,int y,Vector3 * set_point)
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(&rect);
|
||||
|
||||
float nx,ny;
|
||||
nx = (float)(x - rect.left) / (float)(rect.right - rect.left);
|
||||
ny = (float)(y - rect.bottom) / (float)(rect.top - rect.bottom);
|
||||
|
||||
set_point->X = MIN_X + (MAX_X - MIN_X) * nx;
|
||||
set_point->Y = MIN_Y + (MAX_Y - MIN_Y) * ny;
|
||||
set_point->Z = 0.0f;
|
||||
|
||||
*set_point = Clamp_Point(*set_point);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestView diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CSplineTestView::AssertValid() const
|
||||
{
|
||||
CView::AssertValid();
|
||||
}
|
||||
|
||||
void CSplineTestView::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CView::Dump(dc);
|
||||
}
|
||||
|
||||
CSplineTestDoc* CSplineTestView::GetDocument() // non-debug version is inline
|
||||
{
|
||||
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSplineTestDoc)));
|
||||
return (CSplineTestDoc*)m_pDocument;
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSplineTestView message handlers
|
||||
|
||||
void CSplineTestView::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
CSplineTestDoc* pDoc = GetDocument();
|
||||
if (pDoc) {
|
||||
// map the point
|
||||
Vector3 pt;
|
||||
Un_Map_Point(point.x,point.y,&pt);
|
||||
|
||||
// try to go into drag mode
|
||||
bool gotone = pDoc->Grab_Point(pt);
|
||||
if (gotone) {
|
||||
::SetCapture(m_hWnd);
|
||||
}
|
||||
}
|
||||
|
||||
CView::OnLButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
void CSplineTestView::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
// were we dragging something? if so release it
|
||||
// otherwise add a point to the curve
|
||||
CSplineTestDoc* pDoc = GetDocument();
|
||||
if (pDoc != NULL) {
|
||||
if (pDoc->Is_Dragging()) {
|
||||
pDoc->Release_Point();
|
||||
::ReleaseCapture();
|
||||
} else {
|
||||
Vector3 pt;
|
||||
Un_Map_Point(point.x,point.y,&pt);
|
||||
pDoc->Add_Point(pt);
|
||||
}
|
||||
}
|
||||
|
||||
CView::OnLButtonUp(nFlags, point);
|
||||
}
|
||||
|
||||
void CSplineTestView::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
CSplineTestDoc* pDoc = GetDocument();
|
||||
|
||||
// are we dragging?
|
||||
// if so tell the doc where the point should go
|
||||
if (pDoc && pDoc->Is_Dragging()) {
|
||||
Vector3 pt;
|
||||
Un_Map_Point(point.x,point.y,&pt);
|
||||
pDoc->Drag_Point(pt);
|
||||
}
|
||||
|
||||
CView::OnMouseMove(nFlags, point);
|
||||
}
|
||||
|
||||
void CSplineTestView::OnRButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
Vector3 pt;
|
||||
Un_Map_Point(point.x,point.y,&pt);
|
||||
CSplineTestDoc* pDoc = GetDocument();
|
||||
if (pDoc) {
|
||||
pDoc->Edit_Point(pt);
|
||||
}
|
||||
|
||||
CView::OnRButtonUp(nFlags, point);
|
||||
}
|
||||
|
||||
|
||||
Vector3 CSplineTestView::Clamp_Point(const Vector3 & input)
|
||||
{
|
||||
Vector3 output = input;
|
||||
if (output.X < MIN_X) output.X = MIN_X;
|
||||
if (output.Y < MIN_Y) output.Y = MIN_Y;
|
||||
if (output.Z < MIN_Z) output.Z = MIN_Z;
|
||||
|
||||
if (output.X > MAX_X) output.X = MAX_X;
|
||||
if (output.Y > MAX_Y) output.Y = MAX_Y;
|
||||
if (output.Z > MAX_Z) output.Z = MAX_Z;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void CSplineTestView::Enable_Draw_Tangents(bool onoff)
|
||||
{
|
||||
DrawTangents = onoff;
|
||||
CSplineTestDoc* pDoc = GetDocument();
|
||||
if (pDoc) {
|
||||
pDoc->UpdateAllViews(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
bool CSplineTestView::Is_Draw_Tangents_Enabled(void)
|
||||
{
|
||||
return DrawTangents;
|
||||
}
|
||||
93
Code/Tests/SplineTest/SplineTestView.h
Normal file
93
Code/Tests/SplineTest/SplineTestView.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// SplineTestView.h : interface of the CSplineTestView class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_SPLINETESTVIEW_H__2AE09FDD_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
#define AFX_SPLINETESTVIEW_H__2AE09FDD_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
class Vector3;
|
||||
|
||||
class CSplineTestView : public CView
|
||||
{
|
||||
protected: // create from serialization only
|
||||
CSplineTestView();
|
||||
DECLARE_DYNCREATE(CSplineTestView)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
CSplineTestDoc* GetDocument();
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSplineTestView)
|
||||
public:
|
||||
virtual void OnDraw(CDC* pDC); // overridden to draw this view
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
protected:
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CSplineTestView();
|
||||
void Map_Point(const Vector3 & point,int * set_x,int * set_y);
|
||||
void Un_Map_Point(int x,int y,Vector3 * set_point);
|
||||
Vector3 Clamp_Point(const Vector3 & input);
|
||||
void Enable_Draw_Tangents(bool onoff);
|
||||
bool Is_Draw_Tangents_Enabled(void);
|
||||
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
bool DrawTangents;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CSplineTestView)
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#ifndef _DEBUG // debug version in SplineTestView.cpp
|
||||
inline CSplineTestDoc* CSplineTestView::GetDocument()
|
||||
{ return (CSplineTestDoc*)m_pDocument; }
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_SPLINETESTVIEW_H__2AE09FDD_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
26
Code/Tests/SplineTest/StdAfx.cpp
Normal file
26
Code/Tests/SplineTest/StdAfx.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
** 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
|
||||
// SplineTest.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
|
||||
45
Code/Tests/SplineTest/StdAfx.h
Normal file
45
Code/Tests/SplineTest/StdAfx.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
** 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
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__2AE09FD7_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
#define AFX_STDAFX_H__2AE09FD7_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxdisp.h> // MFC Automation classes
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__2AE09FD7_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
105
Code/Tests/SplineTest/TCBDialog.cpp
Normal file
105
Code/Tests/SplineTest/TCBDialog.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// TCBDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "SplineTest.h"
|
||||
#include "TCBDialog.h"
|
||||
#include "curve.h"
|
||||
#include "hermitespline.h"
|
||||
#include "catmullromspline.h"
|
||||
#include "cardinalspline.h"
|
||||
#include "tcbspline.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTCBDialog dialog
|
||||
|
||||
|
||||
CTCBDialog::CTCBDialog(CWnd* pParent,TCBSpline3DClass * curve,int key)
|
||||
: CDialog(CTCBDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CTCBDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
Curve = curve;
|
||||
Key = key;
|
||||
}
|
||||
|
||||
|
||||
void CTCBDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CTCBDialog)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTCBDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CTCBDialog)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTCBDialog message handlers
|
||||
|
||||
BOOL CTCBDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
float t,c,b;
|
||||
Curve->Get_TCB_Params(Key,&t,&c,&b);
|
||||
SetDlgItemFloat(IDC_TENSION_EDIT,t);
|
||||
SetDlgItemFloat(IDC_CONTINUITY_EDIT,c);
|
||||
SetDlgItemFloat(IDC_BIAS_EDIT,b);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CTCBDialog::OnOK()
|
||||
{
|
||||
float t,c,b;
|
||||
t = GetDlgItemFloat(IDC_TENSION_EDIT);
|
||||
c = GetDlgItemFloat(IDC_CONTINUITY_EDIT);
|
||||
b = GetDlgItemFloat(IDC_BIAS_EDIT);
|
||||
Curve->Set_TCB_Params(Key,t,c,b);
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
float CTCBDialog::GetDlgItemFloat(int controlid)
|
||||
{
|
||||
CString string;
|
||||
GetDlgItemText(controlid,string);
|
||||
return atof(string);
|
||||
}
|
||||
|
||||
void CTCBDialog::SetDlgItemFloat(int controlid,float val)
|
||||
{
|
||||
CString string;
|
||||
string.Format("%.2f",val);
|
||||
SetDlgItemText(controlid,string);
|
||||
}
|
||||
74
Code/Tests/SplineTest/TCBDialog.h
Normal file
74
Code/Tests/SplineTest/TCBDialog.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_TCBDIALOG_H__2AE09FE8_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
#define AFX_TCBDIALOG_H__2AE09FE8_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// TCBDialog.h : header file
|
||||
//
|
||||
|
||||
class TCBSpline3DClass;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTCBDialog dialog
|
||||
|
||||
class CTCBDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CTCBDialog(CWnd* pParent,TCBSpline3DClass * curve,int key);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CTCBDialog)
|
||||
enum { IDD = IDD_TCB_DIALOG };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CTCBDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
TCBSpline3DClass * Curve;
|
||||
int Key;
|
||||
|
||||
float GetDlgItemFloat(int controlid);
|
||||
void SetDlgItemFloat(int controlid,float val);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CTCBDialog)
|
||||
virtual void OnOK();
|
||||
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_TCBDIALOG_H__2AE09FE8_FBEF_11D2_9BD9_00A0C9988171__INCLUDED_)
|
||||
BIN
Code/Tests/SplineTest/res/SplineTest.ico
Normal file
BIN
Code/Tests/SplineTest/res/SplineTest.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
13
Code/Tests/SplineTest/res/SplineTest.rc2
Normal file
13
Code/Tests/SplineTest/res/SplineTest.rc2
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// SPLINETEST.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/Tests/SplineTest/res/SplineTestDoc.ico
Normal file
BIN
Code/Tests/SplineTest/res/SplineTestDoc.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Code/Tests/SplineTest/res/Toolbar.bmp
Normal file
BIN
Code/Tests/SplineTest/res/Toolbar.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
33
Code/Tests/SplineTest/resource.h
Normal file
33
Code/Tests/SplineTest/resource.h
Normal file
@@ -0,0 +1,33 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by SplineTest.rc
|
||||
//
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDR_SPLINETYPE 129
|
||||
#define IDD_CARDINAL_DIALOG 130
|
||||
#define IDD_TCB_DIALOG 131
|
||||
#define IDC_TIGHTNESS_EDIT 1000
|
||||
#define IDC_TENSION_EDIT 1001
|
||||
#define IDC_CONTINUITY_EDIT 1002
|
||||
#define IDC_BIAS_EDIT 1003
|
||||
#define ID_CURVE_LINEAR 32772
|
||||
#define ID_CURVE_CATMULL_ROM 32773
|
||||
#define ID_CURVE_CARDINAL 32774
|
||||
#define ID_CURVE_TCB 32775
|
||||
#define ID_CURVE_RESET 32776
|
||||
#define ID_CURVE_DRAW_TANGENTS 32777
|
||||
#define ID_CURVE_LOOP 32778
|
||||
#define IDM_VEHICLE_CURVE 32780
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 132
|
||||
#define _APS_NEXT_COMMAND_VALUE 32781
|
||||
#define _APS_NEXT_CONTROL_VALUE 1002
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user