28 #include "../../idlib/precompiled.h"
42 materialPreview =
NULL;
55 int i,
count, lightShaderIndex = 0;
69 pRoot->
SetInfoText(_T(
va(
"Parameters for light number %d.", numLights)));
81 for (i = 0; i <
count; i++) {
87 if ( materialName.
Left(7) ==
"lights/" || materialName.
Left(5) ==
"fogs/" ) {
88 pCombo->InsertString( lightShaderIndex, materialName );
89 pCombo->SetItemData( lightShaderIndex, lightShaderIndex );
91 if ( materialName ==
"lights/defaultpointlight" ) {
92 pCombo->SetCurSel( lightShaderIndex );
111 pCheck->
SetInfoText(_T(
"When checked, allow light to move."));
115 if ( materialPreview ) {
116 materialPreview->OnAddLight();
130 pRoot->
SetInfoText(_T(
"Properties for the preview window."));
136 pCombo->
SetInfoText(_T(
"Select the type of model on which to preview the material."));
138 pCombo->InsertString( 0,
"Cube" );
139 pCombo->InsertString( 1,
"Box - 2:1");
140 pCombo->InsertString( 2,
"Box - 4:1");
141 pCombo->InsertString( 3,
"Box - 1:2");
142 pCombo->InsertString( 4,
"Box - 1:4");
143 pCombo->InsertString( 5,
"Cylinder - V");
144 pCombo->InsertString( 6,
"Cylinder - H");
145 pCombo->InsertString( 7,
"Sphere");
146 pCombo->SetItemData( 0, 0 );
147 pCombo->SetItemData( 1, 1 );
148 pCombo->SetItemData( 2, 2 );
149 pCombo->SetItemData( 3, 3 );
150 pCombo->SetItemData( 4, 4 );
151 pCombo->SetItemData( 5, 5 );
152 pCombo->SetItemData( 6, 6 );
153 pCombo->SetItemData( 7, 7 );
155 pCombo->SetCurSel( 0 );
166 pCutomButton->
SetInfoText(_T(
"Specify any model to display the current material."));
172 pCheck->
SetInfoText(_T(
"Show the light origin sphere and number in the preview."));
179 pParmRoot->
SetInfoText(_T(
"Local shaderparms for the model being displayed."));
185 pEdit->
SetInfoText(_T(
"Set the local shaderparm for the model"));
195 pParmRoot->
SetInfoText(_T(
"Global shaderparms for the renderworld being displayed."));
201 pEdit->
SetInfoText(_T(
"Set the global shaderparm for the renderworld"));
238 void MaterialPreviewPropView::AssertValid()
const
240 CPropTreeView::AssertValid();
243 void MaterialPreviewPropView::Dump(CDumpContext& dc)
const
245 CPropTreeView::Dump(dc);
265 item = nmProp->
pItem;
275 if ( itemLabel ==
"Model Type" ) {
278 }
else if ( itemLabel ==
"Custom Model" ) {
281 }
else if ( itemLabel ==
"Show Lights" ) {
284 }
else if ( itemLabel ==
"Shader" ) {
286 CString materialName;
288 combo->GetLBText( combo->GetCurSel(), materialName );
292 }
else if ( itemLabel ==
"Radius" ) {
295 }
else if ( itemLabel ==
"Color" ) {
298 testColor.
x = (
float)GetRValue( color ) * (
float)( 1.
f/255.
f );
299 testColor.
y = (
float)GetGValue( color ) * (
float)( 1.
f/255.
f );
300 testColor.
z = (
float)GetBValue( color ) * (
float)( 1.
f/255.
f );
304 }
else if ( itemLabel ==
"Move light" ) {
307 }
else if ( itemLabel.
Left(4) ==
"parm" ) {
310 itemLabel.
Strip(
"parm" );
311 index = atoi( itemLabel.
c_str() );
315 }
else if ( itemLabel.
Left(6) ==
"global" ) {
318 itemLabel.
Strip(
"global" );
319 index = atoi( itemLabel.
c_str() );
330 item = nmProp->
pItem;
334 if ( itemLabel ==
"Preview Lights" ) {
337 }
else if ( itemLabel.
Left(5) ==
"Light" ) {
340 int testLightNum = 0;
347 if ( label.
Left(5) ==
"Light" ) {
350 light->
SetInfoText(_T(
va(
"Parameters for light number %d.", testLightNum)));
358 }
else if ( itemLabel ==
"Custom Model" ) {
359 CFileDialog dlg(
TRUE);
360 dlg.m_ofn.Flags |= OFN_FILEMUSTEXIST;
362 if( dlg.DoModal()== IDOK) {
void Check(BOOL bCheck=TRUE)
const int MAX_GLOBAL_SHADER_PARMS
void InitializePropTree(void)
void OnModelChange(int modelId)
void DeleteItem(CPropTreeItem *pItem)
idFileSystem * fileSystem
void OnDeleteLight(int lightId)
const char * GetName(void) const
const char * Left(int len, idStr &result) const
void SetLabelText(LPCTSTR sLabel)
virtual LPARAM GetItemValue()
const int MAX_ENTITY_SHADER_PARMS
LRESULT SendNotify(UINT nNotifyCode, CPropTreeItem *pItem=NULL)
virtual void OnDraw(CDC *pDC)
afx_msg void OnPropertyButtonClick(NMHDR *nmhdr, LRESULT *lresult)
void RegisterPreviewView(MaterialPreviewView *view)
void OnLightRadiusChange(int lightId, float radius)
GLuint GLuint GLsizei count
void SetDropDownHeight(LONG nDropHeight)
void OnCustomModelChange(idStr modelName)
void OnShowLightsChange(bool showLights)
CPropTreeItem * GetSibling()
void OnLightAllowMoveChange(int lightId, bool move)
CPropTreeItem * GetChild()
void OnGlobalParmChange(int parmNum, float value)
virtual void SetItemValue(LPARAM lParam)
CPropTreeItem * GetRootItem()
#define PTN_ITEMBUTTONCLICK
MaterialPreviewView * materialPreview
void SetCtrlID(UINT nCtrlID)
void Expand(BOOL bExpand=TRUE)
BOOL CreateComboBox(DWORD dwStyle=WS_CHILD|WS_VSCROLL|CBS_SORT|CBS_DROPDOWNLIST)
idDeclManager * declManager
virtual int GetNumDecls(declType_t type)=0
void SetInfoText(LPCTSTR sInfo)
IMPLEMENT_DYNCREATE(CCamWnd, CWnd)
virtual const idMaterial * MaterialByIndex(int index, bool forceParse=true)=0
virtual void SetItemValue(LPARAM lParam)
void OnLocalParmChange(int parmNum, float value)
void OnLightShaderChange(int lightId, idStr shaderName)
const char * c_str(void) const
virtual ~MaterialPreviewPropView()
virtual void SetItemValue(LPARAM lParam)
afx_msg void OnPropertyChangeNotification(NMHDR *nmhdr, LRESULT *lresult)
CPropTreeItem * InsertItem(CPropTreeItem *pItem, CPropTreeItem *pParent=NULL)
char * va(const char *fmt,...)
virtual const char * OSPathToRelativePath(const char *OSPath)=0
void OnLightColorChange(int lightId, idVec3 &color)
void SetCheckState(BOOL state)
CPropTreeItem * GetParent()