Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1391 lines
41 KiB
C++
1391 lines
41 KiB
C++
// SpherePage.cpp : implementation file
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "effectEditor.h"
|
||
#include "SpherePage.h"
|
||
|
||
#include "MainFrm.h"
|
||
#include "EffectEditorDoc.h"
|
||
#include "EffectEditorView.h"
|
||
|
||
#include "Z3DMath.h"
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
IMPLEMENT_DYNCREATE(CSpherePage, CPropertyPage)
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CSpherePage dialog
|
||
|
||
|
||
CSpherePage::CSpherePage() : CPropertyPage(CSpherePage::IDD)
|
||
{
|
||
//{{AFX_DATA_INIT(CSpherePage)
|
||
m_dwEndFrame = 30;
|
||
m_bLowerVis = FALSE;
|
||
m_dwSegment = 5;
|
||
m_dwSidePlane = 5;
|
||
m_dwStartFrame = 1;
|
||
m_strTexture = _T("");
|
||
m_bUpperVis = FALSE;
|
||
m_bUpperTex = FALSE;
|
||
m_bLowerTex = FALSE;
|
||
//}}AFX_DATA_INIT
|
||
}
|
||
|
||
CSpherePage::~CSpherePage()
|
||
{
|
||
}
|
||
|
||
void CSpherePage::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CPropertyPage::DoDataExchange(pDX);
|
||
//{{AFX_DATA_MAP(CSpherePage)
|
||
DDX_Control(pDX, IDC_CBSRC, m_cbSrc);
|
||
DDX_Control(pDX, IDC_CBDEST, m_cbDest);
|
||
DDX_Control(pDX, IDC_CBADDRESSV, m_cbAddressV);
|
||
DDX_Control(pDX, IDC_CBADDRESSU, m_cbAddressU);
|
||
DDX_Control(pDX, IDC_UPPERFACTOR, m_edtUpperFactor);
|
||
DDX_Control(pDX, IDC_TILEV, m_edtTileV);
|
||
DDX_Control(pDX, IDC_TILEU, m_edtTileU);
|
||
DDX_Control(pDX, IDC_TEXFRAME, m_edtTexFrame);
|
||
DDX_Control(pDX, IDC_STARTV, m_edtStartV);
|
||
DDX_Control(pDX, IDC_STARTU, m_edtStartU);
|
||
DDX_Control(pDX, IDC_RADIUS, m_edtRadius);
|
||
DDX_Control(pDX, IDC_LOWERFACTOR, m_edtLowerFactor);
|
||
DDX_Control(pDX, IDC_HEIGHTFACTOR, m_edtHeightFactor);
|
||
DDX_Control(pDX, IDC_COLR, m_edtColR);
|
||
DDX_Control(pDX, IDC_COLG, m_edtColG);
|
||
DDX_Control(pDX, IDC_COLB, m_edtColB);
|
||
DDX_Control(pDX, IDC_CENZ, m_edtCenZ);
|
||
DDX_Control(pDX, IDC_CENY, m_edtCenY);
|
||
DDX_Control(pDX, IDC_CENX, m_edtCenX);
|
||
DDX_Control(pDX, IDC_AXISZ, m_edtAxisZ);
|
||
DDX_Control(pDX, IDC_AXISY, m_edtAxisY);
|
||
DDX_Control(pDX, IDC_AXISX, m_edtAxisX);
|
||
DDX_Control(pDX, IDC_ALPHA, m_edtAlpha);
|
||
DDX_Text(pDX, IDC_ENDFRAME, m_dwEndFrame);
|
||
DDX_Check(pDX, IDC_LOWERVIS, m_bLowerVis);
|
||
DDX_Text(pDX, IDC_SEGMENT, m_dwSegment);
|
||
DDX_Text(pDX, IDC_SIDEPLANE, m_dwSidePlane);
|
||
DDX_Text(pDX, IDC_STARTFRAME, m_dwStartFrame);
|
||
DDX_Text(pDX, IDC_TEXTURE, m_strTexture);
|
||
DDX_Check(pDX, IDC_UPPERVIS, m_bUpperVis);
|
||
DDX_Check(pDX, IDC_UPPERTEX, m_bUpperTex);
|
||
DDX_Check(pDX, IDC_LOWERTEX, m_bLowerTex);
|
||
//}}AFX_DATA_MAP
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(CSpherePage, CPropertyPage)
|
||
//{{AFX_MSG_MAP(CSpherePage)
|
||
ON_BN_CLICKED(IDC_CREATE, OnCreate)
|
||
ON_BN_CLICKED(IDC_DELETE, OnDelete)
|
||
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
|
||
ON_BN_CLICKED(IDC_TEXSTATIC, OnTexstatic)
|
||
ON_BN_CLICKED(IDC_TEXANI, OnTexani)
|
||
ON_BN_CLICKED(IDC_UPPERVIS, OnUppervis)
|
||
ON_BN_CLICKED(IDC_LOWERVIS, OnLowervis)
|
||
ON_BN_CLICKED(IDC_UPPERUP, OnUpperup)
|
||
ON_BN_CLICKED(IDC_LOWERUP, OnLowerup)
|
||
ON_BN_CLICKED(IDC_UPPERTEX, OnUppertex)
|
||
ON_BN_CLICKED(IDC_LOWERTEX, OnLowertex)
|
||
ON_CBN_SELCHANGE(IDC_CBSRC, OnSelchangeCbsrc)
|
||
ON_CBN_SELCHANGE(IDC_CBDEST, OnSelchangeCbdest)
|
||
ON_CBN_SELCHANGE(IDC_CBADDRESSU, OnSelchangeCbaddressu)
|
||
ON_CBN_SELCHANGE(IDC_CBADDRESSV, OnSelchangeCbaddressv)
|
||
//}}AFX_MSG_MAP
|
||
END_MESSAGE_MAP()
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CSpherePage message handlers
|
||
|
||
void CSpherePage::OnCreate()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
UpdateData();
|
||
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
if(((CEffectEditorView*)mf->GetActiveView())->m_dwPreFrame > m_dwStartFrame)
|
||
{
|
||
m_dwStartFrame = ((CEffectEditorView*)mf->GetActiveView())->m_dwPreFrame;
|
||
}
|
||
if(((CEffectEditorView*)mf->GetActiveView())->m_dwPreFrame > m_dwEndFrame)
|
||
{
|
||
m_dwEndFrame = ((CEffectEditorView*)mf->GetActiveView())->m_dwPreFrame;
|
||
}
|
||
if(((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetMaxFrame() < m_dwStartFrame)
|
||
{
|
||
m_dwStartFrame = ((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetMaxFrame() + 1;
|
||
}
|
||
if(((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetMaxFrame() < m_dwEndFrame)
|
||
{
|
||
m_dwEndFrame = ((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetMaxFrame() + 1;
|
||
}
|
||
|
||
CX3DEffectEditSphere *pSphere;
|
||
pSphere = new CX3DEffectEditSphere;
|
||
unsigned long dwStartFrame = m_dwStartFrame - 1;
|
||
unsigned long dwEndFrame = m_dwEndFrame - 1;
|
||
|
||
pSphere->Create(dwStartFrame, dwEndFrame);
|
||
((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->AddEffect(pSphere);
|
||
((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect = ((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->AddEditObject(pSphere);
|
||
{
|
||
quaternion quatAxis;
|
||
quatAxis.Identity();
|
||
|
||
// m_fAxisX = m_fAxisX - (((unsigned long)(m_fAxisX / 360)) * 360.0f);
|
||
// m_fAxisY = m_fAxisY - (((unsigned long)(m_fAxisY / 360)) * 360.0f);
|
||
// m_fAxisZ = m_fAxisZ - (((unsigned long)(m_fAxisZ / 360)) * 360.0f);
|
||
quatAxis.Pitch(FLOAT_DEG((float)m_edtAxisX));
|
||
quatAxis.Yaw(FLOAT_DEG((float)m_edtAxisY));
|
||
quatAxis.Roll(FLOAT_DEG((float)m_edtAxisZ));
|
||
|
||
pSphere->LoadTexture(m_strTexture.GetBuffer(m_strTexture.GetLength()));
|
||
SetKey(dwStartFrame, pSphere->m_lstColor, color(m_edtColR, m_edtColG, m_edtColB, m_edtAlpha));
|
||
SetKey(dwStartFrame, pSphere->m_lstCenter, vector3(m_edtCenX, m_edtCenY, m_edtCenZ));
|
||
SetKey(dwStartFrame, pSphere->m_lstAxis, quatAxis);
|
||
SetKey(dwStartFrame, pSphere->m_lstStartU, (float)m_edtStartU);
|
||
SetKey(dwStartFrame, pSphere->m_lstStartV, (float)m_edtStartV);
|
||
SetKey(dwStartFrame, pSphere->m_lstTileU, (float)m_edtTileU);
|
||
SetKey(dwStartFrame, pSphere->m_lstTileV, (float)m_edtTileV);
|
||
SetKey(dwStartFrame, pSphere->m_lstTexFrame, (float)m_edtTexFrame);
|
||
|
||
SetKey(dwStartFrame, pSphere->m_lstHeightFactor, (float)m_edtHeightFactor);
|
||
SetKey(dwStartFrame, pSphere->m_lstRadius, (float)m_edtRadius);
|
||
SetKey(dwStartFrame, pSphere->m_lstUpperFactor, (float)m_edtUpperFactor);
|
||
SetKey(dwStartFrame, pSphere->m_lstLowerFactor, (float)m_edtLowerFactor);
|
||
|
||
pSphere->SetSegment(m_dwSegment);
|
||
pSphere->SetSidePlane(m_dwSidePlane);
|
||
pSphere->SetUpperVis(m_bUpperVis);
|
||
pSphere->SetUpperUp(m_bUpperUp);
|
||
pSphere->SetUpperTex(m_bUpperTex);
|
||
pSphere->SetLowerVis(m_bLowerVis);
|
||
pSphere->SetLowerUp(m_bLowerUp);
|
||
pSphere->SetLowerTex(m_bLowerTex);
|
||
|
||
pSphere->CreateBuffer();
|
||
|
||
pSphere->SetSrcBlending(D3DBLEND_ZERO + m_cbSrc.GetCurSel());
|
||
pSphere->SetDestBlending(D3DBLEND_ZERO + m_cbDest.GetCurSel());
|
||
pSphere->SetEffectKind(EFFECT_SPHERE);
|
||
// mf->m_KeyBar.m_lpKeySheet->m_Page1.m_sldKeyFrame.SetTic(((CEffectEditorView*)mf->GetActiveView())->m_dwPreFrame);
|
||
}
|
||
}
|
||
|
||
void CSpherePage::OnDelete()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
if(((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect != 0xFFFFFFFF)
|
||
{
|
||
((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->DeleteEffect(((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->DeleteEditObject(((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
}
|
||
((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect = 0xFFFFFFFF;
|
||
|
||
InitValue();
|
||
UpdateData(FALSE);
|
||
}
|
||
|
||
void CSpherePage::OnBrowse()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
char strFilter[50] = "DDS <20><><EFBFBD><EFBFBD>(*.dds)|*.dds||";
|
||
|
||
CFileDialog dlg(TRUE, "*.dds", "", OFN_HIDEREADONLY | OFN_LONGNAMES, strFilter);
|
||
if(dlg.DoModal() == IDOK)
|
||
{
|
||
m_strTexture = dlg.GetPathName();
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
if(pSphere) pSphere->LoadTexture(m_strTexture);
|
||
|
||
UpdateData(FALSE);
|
||
}
|
||
}
|
||
|
||
void CSpherePage::OnTexstatic()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
m_bTexStatic = TRUE;
|
||
m_bTexAni = FALSE;
|
||
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetTexAni(m_bTexAni);
|
||
// pSphere->SetFrame(FLT_MAX);
|
||
}
|
||
|
||
GetDlgItem(IDC_STARTU)->EnableWindow(m_bTexStatic);
|
||
GetDlgItem(IDC_STARTV)->EnableWindow(m_bTexStatic);
|
||
GetDlgItem(IDC_TILEU)->EnableWindow(m_bTexStatic);
|
||
GetDlgItem(IDC_TILEV)->EnableWindow(m_bTexStatic);
|
||
|
||
GetDlgItem(IDC_TEXFRAME)->EnableWindow(m_bTexAni);
|
||
}
|
||
|
||
void CSpherePage::OnTexani()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
m_bTexStatic = FALSE;
|
||
m_bTexAni = TRUE;
|
||
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetTexAni(m_bTexAni);
|
||
// pSphere->SetFrame(FLT_MAX);
|
||
}
|
||
|
||
GetDlgItem(IDC_STARTU)->EnableWindow(m_bTexStatic);
|
||
GetDlgItem(IDC_STARTV)->EnableWindow(m_bTexStatic);
|
||
GetDlgItem(IDC_TILEU)->EnableWindow(m_bTexStatic);
|
||
GetDlgItem(IDC_TILEV)->EnableWindow(m_bTexStatic);
|
||
|
||
GetDlgItem(IDC_TEXFRAME)->EnableWindow(m_bTexAni);
|
||
}
|
||
|
||
void CSpherePage::OnUppervis()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
UpdateData();
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetUpperVis(m_bUpperVis);
|
||
|
||
pSphere->CreateBuffer();
|
||
}
|
||
}
|
||
|
||
void CSpherePage::OnLowervis()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
UpdateData();
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetLowerVis(m_bLowerVis);
|
||
|
||
pSphere->CreateBuffer();
|
||
}
|
||
}
|
||
|
||
BOOL CSpherePage::OnInitDialog()
|
||
{
|
||
CPropertyPage::OnInitDialog();
|
||
|
||
// TODO: Add extra initialization here
|
||
m_cbSrc.AddString("ZERO");
|
||
m_cbSrc.AddString("ONE");
|
||
m_cbSrc.AddString("SRCCOLOR");
|
||
m_cbSrc.AddString("INVSRCCOLOR");
|
||
m_cbSrc.AddString("SRCALPHA");
|
||
m_cbSrc.AddString("INVSRCALPHA");
|
||
m_cbSrc.AddString("DESTALPHA");
|
||
m_cbSrc.AddString("INVDESTALPHA");
|
||
m_cbSrc.AddString("DESTCOLOR");
|
||
m_cbSrc.AddString("INVDESTCOLOR");
|
||
m_cbSrc.AddString("SRCALPHASAT");
|
||
m_cbSrc.AddString("BOTHSRCALPHA");
|
||
m_cbSrc.AddString("BOTHINVSRCALPHA");
|
||
m_cbSrc.SetCurSel(4);
|
||
|
||
m_cbDest.AddString("ZERO");
|
||
m_cbDest.AddString("ONE");
|
||
m_cbDest.AddString("SRCCOLOR");
|
||
m_cbDest.AddString("INVSRCCOLOR");
|
||
m_cbDest.AddString("SRCALPHA");
|
||
m_cbDest.AddString("INVSRCALPHA");
|
||
m_cbDest.AddString("DESTALPHA");
|
||
m_cbDest.AddString("INVDESTALPHA");
|
||
m_cbDest.AddString("DESTCOLOR");
|
||
m_cbDest.AddString("INVDESTCOLOR");
|
||
m_cbDest.AddString("SRCALPHASAT");
|
||
m_cbDest.AddString("BOTHSRCALPHA");
|
||
m_cbDest.AddString("BOTHINVSRCALPHA");
|
||
m_cbDest.SetCurSel(1);
|
||
|
||
InitValue();
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// EXCEPTION: OCX Property Pages should return FALSE
|
||
}
|
||
|
||
void CSpherePage::OnUpperup()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
if(m_bUpperUp)
|
||
{
|
||
m_bUpperUp = FALSE;
|
||
((CButton *)(GetDlgItem(IDC_UPPERUP)))->SetWindowText("Down");
|
||
} else
|
||
{
|
||
m_bUpperUp = TRUE;
|
||
((CButton *)(GetDlgItem(IDC_UPPERUP)))->SetWindowText("Up");
|
||
}
|
||
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetUpperUp(m_bUpperUp);
|
||
}
|
||
}
|
||
|
||
void CSpherePage::OnLowerup()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
if(m_bLowerUp)
|
||
{
|
||
m_bLowerUp = FALSE;
|
||
((CButton *)(GetDlgItem(IDC_LOWERUP)))->SetWindowText("Down");
|
||
} else
|
||
{
|
||
m_bLowerUp = TRUE;
|
||
((CButton *)(GetDlgItem(IDC_LOWERUP)))->SetWindowText("Up");
|
||
}
|
||
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetLowerUp(m_bLowerUp);
|
||
}
|
||
}
|
||
|
||
void CSpherePage::SetKeyInfo()
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
unsigned long dwFrame = mf->m_KeyBar.m_lpKeySheet->m_Page1.m_dwPreFrame - 1;
|
||
quaternion quatTemp;
|
||
|
||
if(pSphere)
|
||
{
|
||
pSphere->Interpolation(dwFrame);
|
||
|
||
m_strTexture = pSphere->GetTextureFileName();
|
||
|
||
m_edtAlpha = pSphere->GetAlpha();
|
||
m_edtColB = pSphere->GetBColor();
|
||
m_edtColG = pSphere->GetGColor();
|
||
m_edtColR = pSphere->GetRColor();
|
||
if(pSphere->m_lstColor.Find(dwFrame))
|
||
{
|
||
m_edtAlpha.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
m_edtColB.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
m_edtColG.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
m_edtColR.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtAlpha.DisableBkColor();
|
||
m_edtColB.DisableBkColor();
|
||
m_edtColG.DisableBkColor();
|
||
m_edtColR.DisableBkColor();
|
||
}
|
||
m_dwEndFrame = pSphere->GetEndFrame();
|
||
m_dwStartFrame = pSphere->GetStartFrame();
|
||
m_edtCenX = pSphere->GetCenter().x;
|
||
m_edtCenY = pSphere->GetCenter().y;
|
||
m_edtCenZ = pSphere->GetCenter().z;
|
||
if(pSphere->m_lstCenter.Find(dwFrame))
|
||
{
|
||
m_edtCenX.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
m_edtCenY.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
m_edtCenZ.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtCenX.DisableBkColor();
|
||
m_edtCenY.DisableBkColor();
|
||
m_edtCenZ.DisableBkColor();
|
||
}
|
||
quatTemp = Eul_FromQuat(pSphere->GetAxis(), EulOrdXZYs);
|
||
m_edtAxisX = (quatTemp.x * 180.0f) / FLOAT_PHI;
|
||
m_edtAxisY = (-quatTemp.z * 180.0f) / FLOAT_PHI;
|
||
m_edtAxisZ = (-quatTemp.y * 180.0f) / FLOAT_PHI;
|
||
if(pSphere->m_lstAxis.Find(dwFrame))
|
||
{
|
||
m_edtAxisX.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
m_edtAxisY.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
m_edtAxisZ.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtAxisX.DisableBkColor();
|
||
m_edtAxisY.DisableBkColor();
|
||
m_edtAxisZ.DisableBkColor();
|
||
}
|
||
|
||
m_edtRadius = pSphere->GetRadius();
|
||
if(pSphere->m_lstRadius.Find(dwFrame))
|
||
{
|
||
m_edtRadius.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtRadius.DisableBkColor();
|
||
}
|
||
m_dwSegment = pSphere->GetSegment();
|
||
m_dwSidePlane = pSphere->GetSidePlane();
|
||
m_edtHeightFactor = pSphere->GetHeightFactor();
|
||
if(pSphere->m_lstHeightFactor.Find(dwFrame))
|
||
{
|
||
m_edtHeightFactor.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtHeightFactor.DisableBkColor();
|
||
}
|
||
m_edtUpperFactor = pSphere->GetUpperFactor();
|
||
if(pSphere->m_lstUpperFactor.Find(dwFrame))
|
||
{
|
||
m_edtUpperFactor.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtUpperFactor.DisableBkColor();
|
||
}
|
||
m_edtLowerFactor = pSphere->GetLowerFactor();
|
||
if(pSphere->m_lstLowerFactor.Find(dwFrame))
|
||
{
|
||
m_edtLowerFactor.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtLowerFactor.DisableBkColor();
|
||
}
|
||
|
||
if(m_bTexStatic)
|
||
{
|
||
m_edtStartU = pSphere->GetStartU();
|
||
if(pSphere->m_lstStartU.Find(dwFrame))
|
||
{
|
||
m_edtStartU.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtStartU.DisableBkColor();
|
||
}
|
||
m_edtStartV = pSphere->GetStartV();
|
||
if(pSphere->m_lstStartV.Find(dwFrame))
|
||
{
|
||
m_edtStartV.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtStartV.DisableBkColor();
|
||
}
|
||
m_edtTileU = pSphere->GetTileU();
|
||
if(pSphere->m_lstTileU.Find(dwFrame))
|
||
{
|
||
m_edtTileU.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtTileU.DisableBkColor();
|
||
}
|
||
m_edtTileV = pSphere->GetTileV();
|
||
if(pSphere->m_lstTileV.Find(dwFrame))
|
||
{
|
||
m_edtTileV.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtTileV.DisableBkColor();
|
||
}
|
||
}
|
||
if(m_bTexAni)
|
||
{
|
||
m_edtTexFrame = pSphere->GetTexFrame();
|
||
if(pSphere->m_lstTexFrame.Find(dwFrame))
|
||
{
|
||
m_edtTexFrame.SetBkColor(0x000000FF, 0x00FFFFFF);
|
||
} else
|
||
{
|
||
m_edtTexFrame.DisableBkColor();
|
||
}
|
||
}
|
||
|
||
m_cbSrc.SetCurSel(pSphere->GetSrcBlending() - D3DBLEND_ZERO);
|
||
m_cbDest.SetCurSel(pSphere->GetDestBlending() - D3DBLEND_ZERO);
|
||
|
||
UpdateData(FALSE);
|
||
Invalidate(FALSE);
|
||
}
|
||
}
|
||
|
||
BOOL CSpherePage::PreTranslateMessage(MSG* pMsg)
|
||
{
|
||
// TODO: Add your specialized code here and/or call the base class
|
||
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
|
||
{
|
||
UpdateData();
|
||
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
unsigned long dwFrame = mf->m_KeyBar.m_lpKeySheet->m_Page1.m_dwPreFrame - 1;
|
||
|
||
switch(::GetDlgCtrlID(pMsg->hwnd))
|
||
{
|
||
case IDC_TEXTURE:
|
||
if(pSphere)
|
||
{
|
||
pSphere->LoadTexture(m_strTexture);
|
||
}
|
||
break;
|
||
|
||
case IDC_CENX:
|
||
case IDC_CENY:
|
||
case IDC_CENZ:
|
||
if(pSphere)
|
||
{
|
||
vector3 vecData;
|
||
if(!strcmp(m_edtCenX, "") || !strcmp(m_edtCenY, "") || !strcmp(m_edtCenZ, ""))
|
||
{
|
||
if(pSphere->m_lstCenter.Find(dwFrame, vecData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 0, vecData);
|
||
pSphere->m_lstCenter.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstCenter.Find(dwFrame, vecData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 0, vecData);
|
||
SetKey(dwFrame, pSphere->m_lstCenter, vector3(m_edtCenX, m_edtCenY, m_edtCenZ));
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 0, vector3(m_edtCenX, m_edtCenY, m_edtCenZ));
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstCenter, vector3(m_edtCenX, m_edtCenY, m_edtCenZ));
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 0, vector3(m_edtCenX, m_edtCenY, m_edtCenZ));
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_AXISX:
|
||
case IDC_AXISY:
|
||
case IDC_AXISZ:
|
||
if(pSphere)
|
||
{
|
||
// m_fAxisX = m_fAxisX - (((unsigned long)(m_fAxisX / 360)) * 360.0f);
|
||
// m_fAxisY = m_fAxisY - (((unsigned long)(m_fAxisY / 360)) * 360.0f);
|
||
// m_fAxisZ = m_fAxisZ - (((unsigned long)(m_fAxisZ / 360)) * 360.0f);
|
||
quaternion quatAxis;
|
||
quatAxis.Identity();
|
||
quatAxis.Pitch(FLOAT_DEG((float)m_edtAxisX));
|
||
quatAxis.Yaw(FLOAT_DEG((float)m_edtAxisY));
|
||
quatAxis.Roll(FLOAT_DEG((float)m_edtAxisZ));
|
||
|
||
/* quaternion quatTemp, quatTemp1;
|
||
quatTemp1.x = FLOAT_DEG((float)m_edtAxisX);
|
||
quatTemp1.y = FLOAT_DEG((float)m_edtAxisY);
|
||
quatTemp1.z = FLOAT_DEG((float)m_edtAxisZ);
|
||
quatTemp1.w = EulOrdXYZr;
|
||
quatTemp = Eul_ToQuat(quatTemp1);
|
||
|
||
quatTemp = Eul_FromQuat(quatTemp, EulOrdXZYs);
|
||
|
||
#define EulOrdXYZs EulOrd(0,EulParEven,EulRepNo,EulFrmS)
|
||
#define EulOrdXZYs EulOrd(0,EulParOdd,EulRepNo,EulFrmS)
|
||
#define EulOrdYZXs EulOrd(1,EulParEven,EulRepNo,EulFrmS)
|
||
#define EulOrdYXZs EulOrd(1,EulParOdd,EulRepNo,EulFrmS)
|
||
#define EulOrdZXYs EulOrd(2,EulParEven,EulRepNo,EulFrmS)
|
||
#define EulOrdZYXs EulOrd(2,EulParOdd,EulRepNo,EulFrmS)
|
||
*/
|
||
quaternion quatData;
|
||
if(!strcmp(m_edtAxisX, "") || !strcmp(m_edtAxisY, "") || !strcmp(m_edtAxisZ, ""))
|
||
{
|
||
if(pSphere->m_lstAxis.Find(dwFrame, quatData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 1, quatData);
|
||
pSphere->m_lstAxis.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstAxis.Find(dwFrame, quatData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 1, quatData);
|
||
SetKey(dwFrame, pSphere->m_lstAxis, quatAxis);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 1, quatAxis);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstAxis, quatAxis);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 1, quatAxis);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_ALPHA:
|
||
case IDC_COLR:
|
||
case IDC_COLG:
|
||
case IDC_COLB:
|
||
if(pSphere)
|
||
{
|
||
color lData;
|
||
if(!strcmp(m_edtColR, "") || !strcmp(m_edtColG, "") || !strcmp(m_edtColB, "") || !strcmp(m_edtAlpha, ""))
|
||
{
|
||
if(pSphere->m_lstColor.Find(dwFrame, lData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 2, lData);
|
||
pSphere->m_lstColor.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstColor.Find(dwFrame, lData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 2, lData);
|
||
SetKey(dwFrame, pSphere->m_lstColor, color(m_edtColR, m_edtColG, m_edtColB, m_edtAlpha));
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 2, color(m_edtColR, m_edtColG, m_edtColB, m_edtAlpha));
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstColor, color(m_edtColR, m_edtColG, m_edtColB, m_edtAlpha));
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 2, color(m_edtColR, m_edtColG, m_edtColB, m_edtAlpha));
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_SEGMENT:
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetSegment(m_dwSegment);
|
||
pSphere->CreateBuffer();
|
||
}
|
||
break;
|
||
|
||
case IDC_SIDEPLANE:
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetSidePlane(m_dwSidePlane);
|
||
pSphere->CreateBuffer();
|
||
}
|
||
break;
|
||
|
||
case IDC_RADIUS:
|
||
if(pSphere)
|
||
{
|
||
float fData;
|
||
if(!strcmp(m_edtRadius, ""))
|
||
{
|
||
if(pSphere->m_lstRadius.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 4, fData);
|
||
pSphere->m_lstRadius.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstRadius.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 4, fData);
|
||
SetKey(dwFrame, pSphere->m_lstRadius, (float)m_edtRadius);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 4, (float)m_edtRadius);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstRadius, (float)m_edtRadius);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 4, (float)m_edtRadius);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_HEIGHTFACTOR:
|
||
if(pSphere)
|
||
{
|
||
float fData;
|
||
if(!strcmp(m_edtHeightFactor, ""))
|
||
{
|
||
if(pSphere->m_lstHeightFactor.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 3, fData);
|
||
pSphere->m_lstHeightFactor.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstHeightFactor.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 3, fData);
|
||
SetKey(dwFrame, pSphere->m_lstHeightFactor, (float)m_edtHeightFactor);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 3, (float)m_edtHeightFactor);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstHeightFactor, (float)m_edtHeightFactor);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 3, (float)m_edtHeightFactor);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_UPPERFACTOR:
|
||
if(pSphere)
|
||
{
|
||
float fData;
|
||
if(!strcmp(m_edtUpperFactor, ""))
|
||
{
|
||
if(pSphere->m_lstUpperFactor.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 5, fData);
|
||
pSphere->m_lstUpperFactor.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstUpperFactor.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 5, fData);
|
||
SetKey(dwFrame, pSphere->m_lstUpperFactor, (float)m_edtUpperFactor);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 5, (float)m_edtUpperFactor);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstUpperFactor, (float)m_edtUpperFactor);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 5, (float)m_edtUpperFactor);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_LOWERFACTOR:
|
||
if(pSphere)
|
||
{
|
||
float fData;
|
||
if(!strcmp(m_edtLowerFactor, ""))
|
||
{
|
||
if(pSphere->m_lstLowerFactor.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 6, fData);
|
||
pSphere->m_lstLowerFactor.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstLowerFactor.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 6, fData);
|
||
SetKey(dwFrame, pSphere->m_lstLowerFactor, (float)m_edtLowerFactor);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 6, (float)m_edtLowerFactor);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstLowerFactor, (float)m_edtLowerFactor);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 6, (float)m_edtLowerFactor);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_UPPERTEX:
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetUpperTex(m_bUpperTex);
|
||
}
|
||
break;
|
||
|
||
case IDC_LOWERTEX:
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetLowerTex(m_bLowerTex);
|
||
}
|
||
break;
|
||
|
||
case IDC_TEXFRAME:
|
||
if(pSphere)
|
||
{
|
||
float fData;
|
||
if(!strcmp(m_edtTexFrame, ""))
|
||
{
|
||
if(pSphere->m_lstTexFrame.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 11, fData);
|
||
pSphere->m_lstTexFrame.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstTexFrame.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 11, fData);
|
||
SetKey(dwFrame, pSphere->m_lstTexFrame, (float)m_edtTexFrame);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 11, (float)m_edtTexFrame);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstTexFrame, (float)m_edtTexFrame);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 11, (float)m_edtTexFrame);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_STARTU:
|
||
if(pSphere)
|
||
{
|
||
float fData;
|
||
if(!strcmp(m_edtStartU, ""))
|
||
{
|
||
if(pSphere->m_lstStartU.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 9, fData);
|
||
pSphere->m_lstStartU.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstStartU.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 9, fData);
|
||
SetKey(dwFrame, pSphere->m_lstStartU, (float)m_edtStartU);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 9, (float)m_edtStartU);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstStartU, (float)m_edtStartU);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 9, (float)m_edtStartU);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_STARTV:
|
||
if(pSphere)
|
||
{
|
||
float fData;
|
||
if(!strcmp(m_edtStartV, ""))
|
||
{
|
||
if(pSphere->m_lstStartV.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 10, fData);
|
||
pSphere->m_lstStartV.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstStartV.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 10, fData);
|
||
SetKey(dwFrame, pSphere->m_lstStartV, (float)m_edtStartV);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 10, (float)m_edtStartV);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstStartV, (float)m_edtStartV);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 10, (float)m_edtStartV);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_TILEU:
|
||
if(pSphere)
|
||
{
|
||
float fData;
|
||
if(!strcmp(m_edtTileU, ""))
|
||
{
|
||
if(pSphere->m_lstTileU.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 7, fData);
|
||
pSphere->m_lstTileU.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstTileU.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 7, fData);
|
||
SetKey(dwFrame, pSphere->m_lstTileU, (float)m_edtTileU);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 7, (float)m_edtTileU);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstTileU, (float)m_edtTileU);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 7, (float)m_edtTileU);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_TILEV:
|
||
if(pSphere)
|
||
{
|
||
float fData;
|
||
if(!strcmp(m_edtTileV, ""))
|
||
{
|
||
if(pSphere->m_lstTileV.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_DELKEY, 8, fData);
|
||
pSphere->m_lstTileV.Erase(dwFrame);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(pSphere->m_lstTileV.Find(dwFrame, fData))
|
||
{
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_OLDDATA, 8, fData);
|
||
SetKey(dwFrame, pSphere->m_lstTileV, (float)m_edtTileV);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_NEWDATA, 8, (float)m_edtTileV);
|
||
} else
|
||
{
|
||
SetKey(dwFrame, pSphere->m_lstTileV, (float)m_edtTileV);
|
||
g_CommandManager.AddCommand(4, pSphere->GetUID(), dwFrame, COMMAND_INSERT, 8, (float)m_edtTileV);
|
||
}
|
||
// pPlane->SetFrame(FLT_MAX);
|
||
}
|
||
break;
|
||
|
||
case IDC_STARTFRAME:
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetStartFrame(m_dwStartFrame);
|
||
if(pSphere->GetEndFrame() < m_dwStartFrame)
|
||
{
|
||
pSphere->SetEndFrame(m_dwStartFrame);
|
||
m_dwEndFrame = m_dwStartFrame;
|
||
UpdateData(FALSE);
|
||
}
|
||
}
|
||
break;
|
||
|
||
case IDC_ENDFRAME:
|
||
if(pSphere)
|
||
{
|
||
if(pSphere->GetStartFrame() > m_dwEndFrame)
|
||
{
|
||
m_dwEndFrame = pSphere->GetStartFrame();
|
||
UpdateData(FALSE);
|
||
}
|
||
pSphere->SetEndFrame(m_dwEndFrame);
|
||
}
|
||
break;
|
||
}
|
||
SetKeyInfo();
|
||
}
|
||
return CPropertyPage::PreTranslateMessage(pMsg);
|
||
}
|
||
|
||
|
||
void CSpherePage::OnUppertex()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
UpdateData();
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetUpperTex(m_bUpperTex);
|
||
}
|
||
}
|
||
|
||
void CSpherePage::OnLowertex()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
UpdateData();
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetLowerTex(m_bLowerTex);
|
||
}
|
||
}
|
||
|
||
void CSpherePage::Undo(CCommand *UndoCommand)
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetFindEditObject(UndoCommand->GetUID());
|
||
if(!pSphere) return;
|
||
|
||
vector3 vecData;
|
||
quaternion quatData;
|
||
color lData;
|
||
float fData;
|
||
|
||
switch(UndoCommand->GetListKind())
|
||
{
|
||
case 0:
|
||
UndoCommand->GetData(vecData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstCenter, vecData);
|
||
} else
|
||
{
|
||
pSphere->m_lstCenter.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 1:
|
||
UndoCommand->GetData(quatData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstAxis, quatData);
|
||
} else
|
||
{
|
||
pSphere->m_lstAxis.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
UndoCommand->GetData(lData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstColor, lData);
|
||
} else
|
||
{
|
||
pSphere->m_lstColor.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 3:
|
||
UndoCommand->GetData(fData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstHeightFactor, fData);
|
||
} else
|
||
{
|
||
pSphere->m_lstHeightFactor.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 4:
|
||
UndoCommand->GetData(fData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstRadius, fData);
|
||
} else
|
||
{
|
||
pSphere->m_lstRadius.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 5:
|
||
UndoCommand->GetData(fData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstUpperFactor, fData);
|
||
} else
|
||
{
|
||
pSphere->m_lstUpperFactor.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 6:
|
||
UndoCommand->GetData(fData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstLowerFactor, fData);
|
||
} else
|
||
{
|
||
pSphere->m_lstLowerFactor.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 7:
|
||
UndoCommand->GetData(fData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstTileU, fData);
|
||
} else
|
||
{
|
||
pSphere->m_lstTileU.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 8:
|
||
UndoCommand->GetData(fData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstTileV, fData);
|
||
} else
|
||
{
|
||
pSphere->m_lstTileV.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 9:
|
||
UndoCommand->GetData(fData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstStartU, fData);
|
||
} else
|
||
{
|
||
pSphere->m_lstStartU.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 10:
|
||
UndoCommand->GetData(fData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstStartV, fData);
|
||
} else
|
||
{
|
||
pSphere->m_lstStartV.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
|
||
case 11:
|
||
UndoCommand->GetData(fData);
|
||
if(UndoCommand->GetCommand() == COMMAND_NEWDATA || UndoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
SetKey(UndoCommand->GetFrame(), pSphere->m_lstTexFrame, fData);
|
||
} else
|
||
{
|
||
pSphere->m_lstTexFrame.Erase(UndoCommand->GetFrame());
|
||
}
|
||
break;
|
||
}
|
||
|
||
SetKeyInfo();
|
||
}
|
||
|
||
void CSpherePage::InitValue()
|
||
{
|
||
m_dwEndFrame = 30;
|
||
m_bLowerVis = FALSE;
|
||
m_dwSegment = 5;
|
||
m_dwSidePlane = 5;
|
||
m_dwStartFrame = 1;
|
||
m_strTexture = _T("");
|
||
m_bUpperVis = FALSE;
|
||
m_bUpperTex = FALSE;
|
||
m_bLowerTex = FALSE;
|
||
|
||
((CButton *)(GetDlgItem(IDC_UPPERVIS)))->SetCheck(1);
|
||
OnUppervis();
|
||
((CButton *)(GetDlgItem(IDC_LOWERVIS)))->SetCheck(1);
|
||
OnLowervis();
|
||
m_bUpperUp = FALSE;
|
||
m_bLowerUp = FALSE;
|
||
|
||
((CButton *)(GetDlgItem(IDC_TEXSTATIC)))->SetCheck(1);
|
||
OnTexstatic();
|
||
|
||
m_edtAxisX.SetValue(0.0f);
|
||
m_edtAxisX.DisableBkColor();
|
||
m_edtAxisY.SetValue(0.0f);
|
||
m_edtAxisY.DisableBkColor();
|
||
m_edtAxisZ.SetValue(0.0f);
|
||
m_edtAxisZ.DisableBkColor();
|
||
m_edtCenX.SetValue(0.0f);
|
||
m_edtCenX.DisableBkColor();
|
||
m_edtCenY.SetValue(0.0f);
|
||
m_edtCenY.DisableBkColor();
|
||
m_edtCenZ.SetValue(0.0f);
|
||
m_edtCenZ.DisableBkColor();
|
||
m_edtHeightFactor.SetValue(1.0f);
|
||
m_edtHeightFactor.DisableBkColor();
|
||
m_edtRadius.SetValue(3.0f);
|
||
m_edtRadius.DisableBkColor();
|
||
m_edtUpperFactor.SetValue(1.0f);
|
||
m_edtUpperFactor.DisableBkColor();
|
||
m_edtLowerFactor.SetValue(1.0f);
|
||
m_edtLowerFactor.DisableBkColor();
|
||
m_edtStartU.SetValue(0.0f);
|
||
m_edtStartU.DisableBkColor();
|
||
m_edtStartV.SetValue(0.0f);
|
||
m_edtStartV.DisableBkColor();
|
||
m_edtTileU.SetValue(1.0f);
|
||
m_edtTileU.DisableBkColor();
|
||
m_edtTileV.SetValue(1.0f);
|
||
m_edtTileV.DisableBkColor();
|
||
|
||
m_edtAlpha.SetValue((unsigned char)255);
|
||
m_edtAlpha.DisableBkColor();
|
||
m_edtColB.SetValue((unsigned char)255);
|
||
m_edtColB.DisableBkColor();
|
||
m_edtColG.SetValue((unsigned char)255);
|
||
m_edtColG.DisableBkColor();
|
||
m_edtColR.SetValue((unsigned char)255);
|
||
m_edtColR.DisableBkColor();
|
||
m_edtTexFrame.SetValue((unsigned long)0);
|
||
m_edtTexFrame.DisableBkColor();
|
||
}
|
||
|
||
void CSpherePage::Redo(CCommand *RedoCommand)
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetFindEditObject(RedoCommand->GetUID());
|
||
if(!pSphere) return;
|
||
|
||
vector3 vecData;
|
||
quaternion quatData;
|
||
color lData;
|
||
float fData;
|
||
|
||
switch(RedoCommand->GetListKind())
|
||
{
|
||
case 0:
|
||
RedoCommand->GetData(vecData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstCenter.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstCenter, vecData);
|
||
}
|
||
break;
|
||
|
||
case 1:
|
||
RedoCommand->GetData(quatData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstAxis.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstAxis, quatData);
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
RedoCommand->GetData(lData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstColor.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstColor, lData);
|
||
}
|
||
break;
|
||
|
||
case 3:
|
||
RedoCommand->GetData(fData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstHeightFactor.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstHeightFactor, fData);
|
||
}
|
||
break;
|
||
|
||
case 4:
|
||
RedoCommand->GetData(fData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstRadius.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstRadius, fData);
|
||
}
|
||
break;
|
||
|
||
case 5:
|
||
RedoCommand->GetData(fData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstUpperFactor.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstUpperFactor, fData);
|
||
}
|
||
break;
|
||
|
||
case 6:
|
||
RedoCommand->GetData(fData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstLowerFactor.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstLowerFactor, fData);
|
||
}
|
||
break;
|
||
|
||
case 7:
|
||
RedoCommand->GetData(fData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstTileU.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstTileU, fData);
|
||
}
|
||
break;
|
||
|
||
case 8:
|
||
RedoCommand->GetData(fData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstTileV.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstTileV, fData);
|
||
}
|
||
break;
|
||
|
||
case 9:
|
||
RedoCommand->GetData(fData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstStartU.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstStartU, fData);
|
||
}
|
||
break;
|
||
|
||
case 10:
|
||
RedoCommand->GetData(fData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstStartV.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstStartV, fData);
|
||
}
|
||
break;
|
||
|
||
case 11:
|
||
RedoCommand->GetData(fData);
|
||
if(RedoCommand->GetCommand() == COMMAND_DELKEY)
|
||
{
|
||
pSphere->m_lstTexFrame.Erase(RedoCommand->GetFrame());
|
||
} else
|
||
{
|
||
SetKey(RedoCommand->GetFrame(), pSphere->m_lstTexFrame, fData);
|
||
}
|
||
break;
|
||
}
|
||
|
||
SetKeyInfo();
|
||
}
|
||
|
||
void CSpherePage::OnSelchangeCbsrc()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetSrcBlending(D3DBLEND_ZERO + m_cbSrc.GetCurSel());
|
||
}
|
||
}
|
||
|
||
void CSpherePage::OnSelchangeCbdest()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectEditSphere *pSphere = (CX3DEffectEditSphere *)((CEffectEditorView*)mf->GetActiveView())->m_lpEffect->GetEffect(4, ((CEffectEditorView*)mf->GetActiveView())->m_dwPickEffect);
|
||
|
||
if(pSphere)
|
||
{
|
||
pSphere->SetDestBlending(D3DBLEND_ZERO + m_cbDest.GetCurSel());
|
||
}
|
||
}
|
||
|
||
void CSpherePage::OnSelchangeCbaddressu()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
|
||
}
|
||
|
||
void CSpherePage::OnSelchangeCbaddressv()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
|
||
}
|