Changed: Minor changes

--HG--
branch : develop
This commit is contained in:
kervala 2018-01-02 16:31:50 +01:00
parent 189ed246b1
commit 584621fe2f
3 changed files with 272 additions and 272 deletions

View file

@ -63,7 +63,7 @@ TCHAR *_EnvironmentNames[] =
_T("PSYCHOTIC"), _T("PSYCHOTIC"),
NULL NULL
}; };
TCHAR *_MaterialNames[] = TCHAR *_MaterialNames[] =
{ {
_T(""), _T(""),
_T("no occlusion"), _T("no occlusion"),
@ -85,7 +85,7 @@ const std::set<INode*> *listNodeCallBack;
// *************************************************************************** // ***************************************************************************
class addSubLodNodeHitCallBack : public HitByNameDlgCallback class addSubLodNodeHitCallBack : public HitByNameDlgCallback
{ {
public: public:
INodeTab NodeTab; INodeTab NodeTab;
@ -154,7 +154,7 @@ public:
((CRGBA*)this)->operator= (col); ((CRGBA*)this)->operator= (col);
return *this; return *this;
} }
void setDifferentValuesMode() void setDifferentValuesMode()
{ {
DifferentValues= true; DifferentValues= true;
@ -174,7 +174,7 @@ public:
SubDlg[i] = NULL; SubDlg[i] = NULL;
for (i=0; i<VP_COUNT; i++) for (i=0; i<VP_COUNT; i++)
SubVPDlg[i] = NULL; SubVPDlg[i] = NULL;
InterfaceThreshold = 0.1f; InterfaceThreshold = 0.1f;
GetInterfaceNormalsFromSceneObjects = 0; GetInterfaceNormalsFromSceneObjects = 0;
LMCEnabled= 0; LMCEnabled= 0;
} }
@ -224,7 +224,7 @@ public:
std::string InterfaceFileName; std::string InterfaceFileName;
int GetInterfaceNormalsFromSceneObjects; int GetInterfaceNormalsFromSceneObjects;
float InterfaceThreshold; float InterfaceThreshold;
int DontAddToScene; int DontAddToScene;
int DontExport; int DontExport;
// Lighting // Lighting
@ -235,7 +235,7 @@ public:
// VertexProgram. // VertexProgram.
int VertexProgramId; int VertexProgramId;
bool VertexProgramBypassed; bool VertexProgramBypassed;
// WindTree VertexProgram. // WindTree VertexProgram.
CVPWindTreeAppData VertexProgramWindTree; CVPWindTreeAppData VertexProgramWindTree;
@ -258,8 +258,8 @@ public:
// Compression term for 8Bits LightMap Compression // Compression term for 8Bits LightMap Compression
CRGBAProp LMCAmbient[NumLightGroup]; CRGBAProp LMCAmbient[NumLightGroup];
CRGBAProp LMCDiffuse[NumLightGroup]; CRGBAProp LMCDiffuse[NumLightGroup];
// Misc // Misc
int FloatingObject; int FloatingObject;
int SWT; int SWT;
@ -360,7 +360,7 @@ void LightingStateChanged (HWND hwndDlg, CLodDialogBoxParam *currentParam)
EnableWindow(GetDlgItem (hwndDlg, IDC_USE_LIGHT_LOCAL_ATTENUATION), currentParam->VertexProgramBypassed ? FALSE : TRUE); EnableWindow(GetDlgItem (hwndDlg, IDC_USE_LIGHT_LOCAL_ATTENUATION), currentParam->VertexProgramBypassed ? FALSE : TRUE);
// Enable AmbientAddSun for realTime Ambient only // Enable AmbientAddSun for realTime Ambient only
EnableWindow(GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), EnableWindow(GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN),
SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_GETCHECK, 0, 0)!=BST_UNCHECKED); SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_GETCHECK, 0, 0)!=BST_UNCHECKED);
} }
@ -382,14 +382,14 @@ void VegetableStateChanged (HWND hwndDlg)
{ {
// Vegetable ? // Vegetable ?
bool enable = ( SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE), BM_GETCHECK, 0, 0)!=BST_UNCHECKED ); bool enable = ( SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE), BM_GETCHECK, 0, 0)!=BST_UNCHECKED );
// Enable alpha blend button // Enable alpha blend button
EnableWindow (GetDlgItem (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_ON), enable); EnableWindow (GetDlgItem (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_ON), enable);
EnableWindow (GetDlgItem (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_OFF), enable); EnableWindow (GetDlgItem (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_OFF), enable);
EnableWindow (GetDlgItem (hwndDlg, IDC_CENTER_Z), enable); EnableWindow (GetDlgItem (hwndDlg, IDC_CENTER_Z), enable);
EnableWindow (GetDlgItem (hwndDlg, IDC_CENTER_NULL), enable); EnableWindow (GetDlgItem (hwndDlg, IDC_CENTER_NULL), enable);
EnableWindow (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), enable); EnableWindow (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), enable);
// Alpha blend ? // Alpha blend ?
bool alphaBlend = IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_ON)!=BST_UNCHECKED; bool alphaBlend = IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_ON)!=BST_UNCHECKED;
@ -407,7 +407,7 @@ void VegetableStateChanged (HWND hwndDlg)
precomputed= IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED)!=BST_UNCHECKED; precomputed= IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED)!=BST_UNCHECKED;
else else
precomputed= IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED)!=BST_UNCHECKED; precomputed= IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED)!=BST_UNCHECKED;
// Force Best Sided Lighting only if precomputed // Force Best Sided Lighting only if precomputed
EnableWindow (GetDlgItem (hwndDlg, IDC_VEGETABLE_FORCE_BEST_SIDED_LIGHTING), enable && precomputed); EnableWindow (GetDlgItem (hwndDlg, IDC_VEGETABLE_FORCE_BEST_SIDED_LIGHTING), enable && precomputed);
@ -456,7 +456,7 @@ void exploreNode(INode *node)
if (soundGroup != "no sound") if (soundGroup != "no sound")
_KnownSoundGroups.insert(soundGroup); _KnownSoundGroups.insert(soundGroup);
for (int i= 0; i<node->NumChildren(); ++i) for (int i= 0; i<node->NumChildren(); ++i)
{ {
exploreNode(node->GetChildNode(i)); exploreNode(node->GetChildNode(i));
@ -473,7 +473,7 @@ INT_PTR CALLBACK AccelDialogCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -543,7 +543,7 @@ INT_PTR CALLBACK AccelDialogCallback (
// nlassert(false); // nlassert(false);
} }
// SendMessage(GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_SETTEXT, 0, (LONG)(currentParam->SoundGroup.c_str())); // SendMessage(GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_SETTEXT, 0, (LONG)(currentParam->SoundGroup.c_str()));
bool accelerator = (currentParam->AcceleratorType != -1); bool accelerator = (currentParam->AcceleratorType != -1);
CheckRadioButton (hwndDlg, IDC_RADIOACCELNO, IDC_RADIOACCELCLUSTER, accelerator?(IDC_RADIOACCELNO+(currentParam->AcceleratorType&NEL3D_APPDATA_ACCEL_TYPE)):0); CheckRadioButton (hwndDlg, IDC_RADIOACCELNO, IDC_RADIOACCELCLUSTER, accelerator?(IDC_RADIOACCELNO+(currentParam->AcceleratorType&NEL3D_APPDATA_ACCEL_TYPE)):0);
AccelStateChanged (hwndDlg); AccelStateChanged (hwndDlg);
@ -554,7 +554,7 @@ INT_PTR CALLBACK AccelDialogCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -644,7 +644,7 @@ INT_PTR CALLBACK MRMDialogCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -668,7 +668,7 @@ INT_PTR CALLBACK MRMDialogCallback (
EnableWindow (GetDlgItem (hwndDlg, IDC_REMOVE), currentParam->ListActived); EnableWindow (GetDlgItem (hwndDlg, IDC_REMOVE), currentParam->ListActived);
EnableWindow (GetDlgItem (hwndDlg, IDC_UP), currentParam->ListActived); EnableWindow (GetDlgItem (hwndDlg, IDC_UP), currentParam->ListActived);
EnableWindow (GetDlgItem (hwndDlg, IDC_DOWN), currentParam->ListActived); EnableWindow (GetDlgItem (hwndDlg, IDC_DOWN), currentParam->ListActived);
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), utf8ToTStr(currentParam->DistMax)); SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), utf8ToTStr(currentParam->DistMax));
SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), utf8ToTStr(currentParam->BlendLength)); SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), utf8ToTStr(currentParam->BlendLength));
@ -704,7 +704,7 @@ INT_PTR CALLBACK MRMDialogCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -716,7 +716,7 @@ INT_PTR CALLBACK MRMDialogCallback (
currentParam->BlendOut=SendMessage (GetDlgItem (hwndDlg, IDC_BLEND_OUT), BM_GETCHECK, 0, 0); currentParam->BlendOut=SendMessage (GetDlgItem (hwndDlg, IDC_BLEND_OUT), BM_GETCHECK, 0, 0);
currentParam->CoarseMesh=SendMessage (GetDlgItem (hwndDlg, IDC_COARSE_MESH), BM_GETCHECK, 0, 0); currentParam->CoarseMesh=SendMessage (GetDlgItem (hwndDlg, IDC_COARSE_MESH), BM_GETCHECK, 0, 0);
currentParam->DynamicMesh=SendMessage (GetDlgItem (hwndDlg, IDC_DYNAMIC_MESH), BM_GETCHECK, 0, 0); currentParam->DynamicMesh=SendMessage (GetDlgItem (hwndDlg, IDC_DYNAMIC_MESH), BM_GETCHECK, 0, 0);
TCHAR tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), tmp, 512);
currentParam->DistMax = tStrToUtf8(tmp); currentParam->DistMax = tStrToUtf8(tmp);
@ -912,7 +912,7 @@ INT_PTR CALLBACK InstanceDialogCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -934,7 +934,7 @@ INT_PTR CALLBACK InstanceDialogCallback (
bool colOk = currentParam->CollisionMeshGeneration>=0 && currentParam->CollisionMeshGeneration<4; bool colOk = currentParam->CollisionMeshGeneration>=0 && currentParam->CollisionMeshGeneration<4;
CheckRadioButton (hwndDlg, IDC_CAMERA_COL_RADIO1, IDC_CAMERA_COL_RADIO4, colOk?(IDC_CAMERA_COL_RADIO1+(currentParam->CollisionMeshGeneration)):0); CheckRadioButton (hwndDlg, IDC_CAMERA_COL_RADIO1, IDC_CAMERA_COL_RADIO4, colOk?(IDC_CAMERA_COL_RADIO1+(currentParam->CollisionMeshGeneration)):0);
InstanceStateChanged(hwndDlg); InstanceStateChanged(hwndDlg);
} }
break; break;
@ -943,7 +943,7 @@ INT_PTR CALLBACK InstanceDialogCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -956,7 +956,7 @@ INT_PTR CALLBACK InstanceDialogCallback (
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), tmp, 512);
currentParam->InstanceName = tStrToUtf8(tmp); currentParam->InstanceName = tStrToUtf8(tmp);
currentParam->DontAddToScene=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_GETCHECK, 0, 0); currentParam->DontAddToScene=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), tmp, 512);
currentParam->InstanceGroupName = tStrToUtf8(tmp); currentParam->InstanceGroupName = tStrToUtf8(tmp);
@ -1028,7 +1028,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -1050,7 +1050,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowExterior, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowExterior, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), utf8ToTStr(currentParam->ExportLightMapName)); SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), utf8ToTStr(currentParam->ExportLightMapName));
SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_SETCHECK, currentParam->RealTimeAmbientLightAddSun, 0); SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_SETCHECK, currentParam->RealTimeAmbientLightAddSun, 0);
// Set enable disable // Set enable disable
LightingStateChanged (hwndDlg, currentParam); LightingStateChanged (hwndDlg, currentParam);
@ -1062,7 +1062,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_RESET_NAME: case IDC_RESET_NAME:
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), _T("GlobalLight")); SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), _T("GlobalLight"));
@ -1092,7 +1092,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), tmp, 512);
currentParam->ExportLightMapName = tStrToUtf8(tmp); currentParam->ExportLightMapName = tStrToUtf8(tmp);
currentParam->RealTimeAmbientLightAddSun= SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_GETCHECK, 0, 0); currentParam->RealTimeAmbientLightAddSun= SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_GETCHECK, 0, 0);
// Get the acceleration type // Get the acceleration type
if (IsDlgButtonChecked (hwndDlg, IDC_LIGHT_GROUP_ALWAYS) == BST_CHECKED) if (IsDlgButtonChecked (hwndDlg, IDC_LIGHT_GROUP_ALWAYS) == BST_CHECKED)
currentParam->LightGroup = 0; currentParam->LightGroup = 0;
@ -1154,7 +1154,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
EndDialog(hwndDlg,1); EndDialog(hwndDlg,1);
break; break;
case WM_DESTROY: case WM_DESTROY:
break; break;
@ -1180,7 +1180,7 @@ void Lightmap2StateChanged (HWND hwndDlg, CLodDialogBoxParam *currentParam)
EnableWindow (GetDlgItem(hwndDlg, IDC_LMC_AUTO_SETUP), enabled); EnableWindow (GetDlgItem(hwndDlg, IDC_LMC_AUTO_SETUP), enabled);
EnableWindow (GetDlgItem(hwndDlg, IDC_LMC_AUTO_SETUP_VISIBLEONLY), enabled); EnableWindow (GetDlgItem(hwndDlg, IDC_LMC_AUTO_SETUP_VISIBLEONLY), enabled);
EnableWindow (GetDlgItem(hwndDlg, IDC_LMC_COPY_FROM), enabled); EnableWindow (GetDlgItem(hwndDlg, IDC_LMC_COPY_FROM), enabled);
// MAX enable/disable // MAX enable/disable
uint i; uint i;
for(i=0;i<CLodDialogBoxParam::NumLightGroup;i++) for(i=0;i<CLodDialogBoxParam::NumLightGroup;i++)
@ -1190,14 +1190,14 @@ void Lightmap2StateChanged (HWND hwndDlg, CLodDialogBoxParam *currentParam)
} }
// Static Enable / Disable // Static Enable / Disable
uint staticItems[]= {IDC_LMC_STATIC0, IDC_LMC_STATIC1, IDC_LMC_STATIC2, IDC_LMC_STATIC3, uint staticItems[]= {IDC_LMC_STATIC0, IDC_LMC_STATIC1, IDC_LMC_STATIC2, IDC_LMC_STATIC3,
IDC_LMC_STATIC4, IDC_LMC_STATIC5, IDC_LMC_STATIC6, IDC_LMC_STATIC7, IDC_LMC_STATIC8, }; IDC_LMC_STATIC4, IDC_LMC_STATIC5, IDC_LMC_STATIC6, IDC_LMC_STATIC7, IDC_LMC_STATIC8, };
uint numStaticItems= sizeof(staticItems) / sizeof(staticItems[0]); uint numStaticItems= sizeof(staticItems) / sizeof(staticItems[0]);
for(i=0;i<numStaticItems;i++) for(i=0;i<numStaticItems;i++)
{ {
EnableWindow (GetDlgItem(hwndDlg, staticItems[i]), enabled); EnableWindow (GetDlgItem(hwndDlg, staticItems[i]), enabled);
} }
} }
// *************************************************************************** // ***************************************************************************
@ -1208,7 +1208,7 @@ void lmcAutoSetup(CLodDialogBoxParam *currentParam, bool visibleOnly)
// get all lightmap lights // get all lightmap lights
std::vector<SLightBuild> lights; std::vector<SLightBuild> lights;
getLightmapLightBuilds(lights, theCNelExport._Ip->GetTime(), *theCNelExport._Ip, visibleOnly); getLightmapLightBuilds(lights, theCNelExport._Ip->GetTime(), *theCNelExport._Ip, visibleOnly);
// mean all light, by lightgroup // mean all light, by lightgroup
CRGBAF sumAmbient[CLodDialogBoxParam::NumLightGroup]; CRGBAF sumAmbient[CLodDialogBoxParam::NumLightGroup];
CRGBAF sumDiffuse[CLodDialogBoxParam::NumLightGroup]; CRGBAF sumDiffuse[CLodDialogBoxParam::NumLightGroup];
@ -1258,7 +1258,7 @@ void lmcAutoSetup(CLodDialogBoxParam *currentParam, bool visibleOnly)
sumDiffuse[i]/= float(countDiffuse[i]); sumDiffuse[i]/= float(countDiffuse[i]);
diff= sumDiffuse[i]; diff= sumDiffuse[i];
} }
// change the control and value // change the control and value
currentParam->LMCAmbient[i]= amb; currentParam->LMCAmbient[i]= amb;
currentParam->LMCAmbient[i].Ctrl->SetColor(RGB(amb.R, amb.G, amb.B)); currentParam->LMCAmbient[i].Ctrl->SetColor(RGB(amb.R, amb.G, amb.B));
@ -1269,7 +1269,7 @@ void lmcAutoSetup(CLodDialogBoxParam *currentParam, bool visibleOnly)
// *************************************************************************** // ***************************************************************************
struct CLMCParamFrom struct CLMCParamFrom
{ {
bool AmbFilter[CLodDialogBoxParam::NumLightGroup]; bool AmbFilter[CLodDialogBoxParam::NumLightGroup];
bool DiffFilter[CLodDialogBoxParam::NumLightGroup]; bool DiffFilter[CLodDialogBoxParam::NumLightGroup];
@ -1278,7 +1278,7 @@ struct CLMCParamFrom
std::vector<INode*> Nodes; std::vector<INode*> Nodes;
// true if the user has clicked at least one item // true if the user has clicked at least one item
bool SelectionDone; bool SelectionDone;
CLMCParamFrom() CLMCParamFrom()
{ {
SelectionDone= false; SelectionDone= false;
@ -1311,8 +1311,8 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback(
{ {
CLMCParamFrom *lmcParam=(CLMCParamFrom *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLMCParamFrom *lmcParam=(CLMCParamFrom *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
uint i; uint i;
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -1336,7 +1336,7 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback(
lmcParam->AmbValue[i].Ctrl->SetColor(RGB(a.R, a.G, a.B)); lmcParam->AmbValue[i].Ctrl->SetColor(RGB(a.R, a.G, a.B));
lmcParam->DiffValue[i].Ctrl->SetColor(RGB(d.R, d.G, d.B)); lmcParam->DiffValue[i].Ctrl->SetColor(RGB(d.R, d.G, d.B));
} }
// init the filters. // init the filters.
nlctassert(CLodDialogBoxParam::NumLightGroup==3); nlctassert(CLodDialogBoxParam::NumLightGroup==3);
SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_ALWAYS_AMBIENT_FILTER), BM_SETCHECK, lmcParam->AmbFilter[0]?BST_CHECKED:BST_UNCHECKED, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_ALWAYS_AMBIENT_FILTER), BM_SETCHECK, lmcParam->AmbFilter[0]?BST_CHECKED:BST_UNCHECKED, 0);
@ -1345,7 +1345,7 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback(
SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_ALWAYS_DIFFUSE_FILTER), BM_SETCHECK, lmcParam->DiffFilter[0]?BST_CHECKED:BST_UNCHECKED, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_ALWAYS_DIFFUSE_FILTER), BM_SETCHECK, lmcParam->DiffFilter[0]?BST_CHECKED:BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_SUN_DIFFUSE_FILTER), BM_SETCHECK, lmcParam->DiffFilter[1]?BST_CHECKED:BST_UNCHECKED, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_SUN_DIFFUSE_FILTER), BM_SETCHECK, lmcParam->DiffFilter[1]?BST_CHECKED:BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_NIGHT_DIFFUSE_FILTER), BM_SETCHECK, lmcParam->DiffFilter[2]?BST_CHECKED:BST_UNCHECKED, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_NIGHT_DIFFUSE_FILTER), BM_SETCHECK, lmcParam->DiffFilter[2]?BST_CHECKED:BST_UNCHECKED, 0);
// init the list // init the list
HWND hwndList=GetDlgItem (hwndDlg, IDC_LMC_COPY_LIST); HWND hwndList=GetDlgItem (hwndDlg, IDC_LMC_COPY_LIST);
for(i=0;i<lmcParam->Nodes.size();i++) for(i=0;i<lmcParam->Nodes.size();i++)
@ -1355,7 +1355,7 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback(
// Insert string // Insert string
SendMessage (hwndList, LB_ADDSTRING, 0, (LPARAM) str.c_str()); SendMessage (hwndList, LB_ADDSTRING, 0, (LPARAM) str.c_str());
} }
// gray the OK button // gray the OK button
EnableWindow( GetDlgItem(hwndDlg, IDOK), FALSE); EnableWindow( GetDlgItem(hwndDlg, IDOK), FALSE);
} }
@ -1365,7 +1365,7 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback(
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -1380,7 +1380,7 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback(
lmcParam->DiffFilter[0]= SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_ALWAYS_DIFFUSE_FILTER), BM_GETCHECK, 0, 0) == BST_CHECKED; lmcParam->DiffFilter[0]= SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_ALWAYS_DIFFUSE_FILTER), BM_GETCHECK, 0, 0) == BST_CHECKED;
lmcParam->DiffFilter[1]= SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_SUN_DIFFUSE_FILTER), BM_GETCHECK, 0, 0) == BST_CHECKED; lmcParam->DiffFilter[1]= SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_SUN_DIFFUSE_FILTER), BM_GETCHECK, 0, 0) == BST_CHECKED;
lmcParam->DiffFilter[2]= SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_NIGHT_DIFFUSE_FILTER), BM_GETCHECK, 0, 0) == BST_CHECKED; lmcParam->DiffFilter[2]= SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_NIGHT_DIFFUSE_FILTER), BM_GETCHECK, 0, 0) == BST_CHECKED;
// get colors // get colors
for(i=0;i<CLodDialogBoxParam::NumLightGroup;i++) for(i=0;i<CLodDialogBoxParam::NumLightGroup;i++)
{ {
@ -1434,7 +1434,7 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback(
// Get the node name // Get the node name
TCHAR name[512]; TCHAR name[512];
SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_LIST), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name); SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_LIST), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name);
// Find the node // Find the node
INode *nodeClk=theCNelExport._Ip->GetINodeByName(name); INode *nodeClk=theCNelExport._Ip->GetINodeByName(name);
if (nodeClk) if (nodeClk)
@ -1454,17 +1454,17 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback(
// ungray the OK button // ungray the OK button
EnableWindow( GetDlgItem(hwndDlg, IDOK), TRUE); EnableWindow( GetDlgItem(hwndDlg, IDOK), TRUE);
} }
} }
break; break;
case WM_CLOSE: case WM_CLOSE:
EndDialog(hwndDlg,IDCANCEL); EndDialog(hwndDlg,IDCANCEL);
break; break;
case WM_DESTROY: case WM_DESTROY:
break; break;
default: default:
return FALSE; return FALSE;
} }
@ -1479,7 +1479,7 @@ void lmcCopyFrom(CLodDialogBoxParam *currentParam, HWND parentDlg)
// static to save filter between calls // static to save filter between calls
static CLMCParamFrom paramLMCFrom; static CLMCParamFrom paramLMCFrom;
// **** get all nodes // **** get all nodes
// get all nodes // get all nodes
std::vector<INode*> nodes; std::vector<INode*> nodes;
@ -1532,7 +1532,7 @@ INT_PTR CALLBACK Lightmap2DialogCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -1540,7 +1540,7 @@ INT_PTR CALLBACK Lightmap2DialogCallback (
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
// retrieve the color choosing Ctrl // retrieve the color choosing Ctrl
nlctassert(CLodDialogBoxParam::NumLightGroup==3); nlctassert(CLodDialogBoxParam::NumLightGroup==3);
nlverify(currentParam->LMCAmbient[0].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_ALWAYS_AMBIENT))); nlverify(currentParam->LMCAmbient[0].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_ALWAYS_AMBIENT)));
nlverify(currentParam->LMCAmbient[1].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_DAY_AMBIENT))); nlverify(currentParam->LMCAmbient[1].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_DAY_AMBIENT)));
@ -1548,7 +1548,7 @@ INT_PTR CALLBACK Lightmap2DialogCallback (
nlverify(currentParam->LMCDiffuse[0].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_ALWAYS_DIFFUSE))); nlverify(currentParam->LMCDiffuse[0].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_ALWAYS_DIFFUSE)));
nlverify(currentParam->LMCDiffuse[1].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_DAY_DIFFUSE))); nlverify(currentParam->LMCDiffuse[1].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_DAY_DIFFUSE)));
nlverify(currentParam->LMCDiffuse[2].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_NIGHT_DIFFUSE))); nlverify(currentParam->LMCDiffuse[2].Ctrl= GetIColorSwatch(GetDlgItem(hwndDlg, IDC_LM_NIGHT_DIFFUSE)));
// set color, and color state // set color, and color state
for(uint i=0;i<CLodDialogBoxParam::NumLightGroup;i++) for(uint i=0;i<CLodDialogBoxParam::NumLightGroup;i++)
{ {
@ -1560,7 +1560,7 @@ INT_PTR CALLBACK Lightmap2DialogCallback (
// the enable button // the enable button
SendMessage (GetDlgItem (hwndDlg, IDC_LM_COMPRESS_8BIT), BM_SETCHECK, currentParam->LMCEnabled, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LM_COMPRESS_8BIT), BM_SETCHECK, currentParam->LMCEnabled, 0);
// Set enable disable // Set enable disable
Lightmap2StateChanged (hwndDlg, currentParam); Lightmap2StateChanged (hwndDlg, currentParam);
} }
@ -1570,7 +1570,7 @@ INT_PTR CALLBACK Lightmap2DialogCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -1616,7 +1616,7 @@ INT_PTR CALLBACK Lightmap2DialogCallback (
{ {
nlctassert(CLodDialogBoxParam::NumLightGroup==3); nlctassert(CLodDialogBoxParam::NumLightGroup==3);
CRGBAProp *propEdited; CRGBAProp *propEdited;
switch(LOWORD(wParam)) switch(LOWORD(wParam))
{ {
case IDC_LM_ALWAYS_AMBIENT: propEdited= &currentParam->LMCAmbient[0]; break; case IDC_LM_ALWAYS_AMBIENT: propEdited= &currentParam->LMCAmbient[0]; break;
case IDC_LM_DAY_AMBIENT: propEdited= &currentParam->LMCAmbient[1]; break; case IDC_LM_DAY_AMBIENT: propEdited= &currentParam->LMCAmbient[1]; break;
@ -1635,7 +1635,7 @@ INT_PTR CALLBACK Lightmap2DialogCallback (
EndDialog(hwndDlg,1); EndDialog(hwndDlg,1);
break; break;
case WM_DESTROY: case WM_DESTROY:
break; break;
default: default:
@ -1655,7 +1655,7 @@ INT_PTR CALLBACK VegetableDialogCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -1664,19 +1664,19 @@ INT_PTR CALLBACK VegetableDialogCallback (
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE), BM_SETCHECK, currentParam->Vegetable, 0); SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE), BM_SETCHECK, currentParam->Vegetable, 0);
// Yoyo: enable like this. Crappy CheckRadioButton method... // Yoyo: enable like this. Crappy CheckRadioButton method...
SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_ON), BM_SETCHECK, currentParam->VegetableAlphaBlend==0, 0 ); SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_ON), BM_SETCHECK, currentParam->VegetableAlphaBlend==0, 0 );
SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_OFF), BM_SETCHECK, currentParam->VegetableAlphaBlend==1, 0 ); SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_OFF), BM_SETCHECK, currentParam->VegetableAlphaBlend==1, 0 );
CheckRadioButton(hwndDlg, IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED, IDC_VEGETABLE_AB_ON_UNLIGHTED, IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED+currentParam->VegetableAlphaBlendOnLighted); CheckRadioButton(hwndDlg, IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED, IDC_VEGETABLE_AB_ON_UNLIGHTED, IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED+currentParam->VegetableAlphaBlendOnLighted);
CheckRadioButton(hwndDlg, IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED, IDC_VEGETABLE_AB_OFF_UNLIGHTED, IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED+currentParam->VegetableAlphaBlendOffLighted); CheckRadioButton(hwndDlg, IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED, IDC_VEGETABLE_AB_OFF_UNLIGHTED, IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED+currentParam->VegetableAlphaBlendOffLighted);
SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_AB_OFF_DOUBLE_SIDED), BM_SETCHECK, currentParam->VegetableAlphaBlendOffDoubleSided, 0); SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_AB_OFF_DOUBLE_SIDED), BM_SETCHECK, currentParam->VegetableAlphaBlendOffDoubleSided, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_FORCE_BEST_SIDED_LIGHTING), BM_SETCHECK, currentParam->VegetableForceBestSidedLighting, 0); SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_FORCE_BEST_SIDED_LIGHTING), BM_SETCHECK, currentParam->VegetableForceBestSidedLighting, 0);
CheckRadioButton(hwndDlg, IDC_CENTER_NULL, IDC_CENTER_Z, IDC_CENTER_NULL+currentParam->VegetableBendCenter); CheckRadioButton(hwndDlg, IDC_CENTER_NULL, IDC_CENTER_Z, IDC_CENTER_NULL+currentParam->VegetableBendCenter);
SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), utf8ToTStr(currentParam->VegetableBendFactor)); SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), utf8ToTStr(currentParam->VegetableBendFactor));
@ -1689,7 +1689,7 @@ INT_PTR CALLBACK VegetableDialogCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -1702,25 +1702,25 @@ INT_PTR CALLBACK VegetableDialogCallback (
currentParam->VegetableAlphaBlend = 0; currentParam->VegetableAlphaBlend = 0;
else if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_OFF) == BST_CHECKED) else if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_ALPHA_BLEND_OFF) == BST_CHECKED)
currentParam->VegetableAlphaBlend = 1; currentParam->VegetableAlphaBlend = 1;
else else
currentParam->VegetableAlphaBlend = -1; currentParam->VegetableAlphaBlend = -1;
if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED) == BST_CHECKED) if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED) == BST_CHECKED)
currentParam->VegetableAlphaBlendOnLighted = 0; currentParam->VegetableAlphaBlendOnLighted = 0;
else if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_ON_UNLIGHTED) == BST_CHECKED) else if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_ON_UNLIGHTED) == BST_CHECKED)
currentParam->VegetableAlphaBlendOnLighted = 1; currentParam->VegetableAlphaBlendOnLighted = 1;
else else
currentParam->VegetableAlphaBlendOnLighted = -1; currentParam->VegetableAlphaBlendOnLighted = -1;
if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED) == BST_CHECKED) if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED) == BST_CHECKED)
currentParam->VegetableAlphaBlendOffLighted = 0; currentParam->VegetableAlphaBlendOffLighted = 0;
else if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_OFF_LIGHTED_DYNAMIC) == BST_CHECKED) else if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_OFF_LIGHTED_DYNAMIC) == BST_CHECKED)
currentParam->VegetableAlphaBlendOffLighted = 1; currentParam->VegetableAlphaBlendOffLighted = 1;
else if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_OFF_UNLIGHTED) == BST_CHECKED) else if (IsDlgButtonChecked (hwndDlg, IDC_VEGETABLE_AB_OFF_UNLIGHTED) == BST_CHECKED)
currentParam->VegetableAlphaBlendOffLighted = 2; currentParam->VegetableAlphaBlendOffLighted = 2;
else else
currentParam->VegetableAlphaBlendOffLighted = -1; currentParam->VegetableAlphaBlendOffLighted = -1;
currentParam->VegetableAlphaBlendOffDoubleSided = SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_AB_OFF_DOUBLE_SIDED), BM_GETCHECK, 0, 0); currentParam->VegetableAlphaBlendOffDoubleSided = SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_AB_OFF_DOUBLE_SIDED), BM_GETCHECK, 0, 0);
currentParam->VegetableForceBestSidedLighting= SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_FORCE_BEST_SIDED_LIGHTING), BM_GETCHECK, 0, 0); currentParam->VegetableForceBestSidedLighting= SendMessage (GetDlgItem (hwndDlg, IDC_VEGETABLE_FORCE_BEST_SIDED_LIGHTING), BM_GETCHECK, 0, 0);
@ -1729,9 +1729,9 @@ INT_PTR CALLBACK VegetableDialogCallback (
currentParam->VegetableBendCenter = 0; currentParam->VegetableBendCenter = 0;
else if (IsDlgButtonChecked (hwndDlg, IDC_CENTER_Z) == BST_CHECKED) else if (IsDlgButtonChecked (hwndDlg, IDC_CENTER_Z) == BST_CHECKED)
currentParam->VegetableBendCenter = 1; currentParam->VegetableBendCenter = 1;
else else
currentParam->VegetableBendCenter = -1; currentParam->VegetableBendCenter = -1;
TCHAR tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), tmp, 512);
currentParam->VegetableBendFactor = tStrToUtf8(tmp); currentParam->VegetableBendFactor = tStrToUtf8(tmp);
@ -1775,7 +1775,7 @@ INT_PTR CALLBACK VertexProgramDialogCallBack (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -1847,7 +1847,7 @@ INT_PTR CALLBACK VertexProgramDialogCallBack (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -1933,7 +1933,7 @@ void updateVPWTStatic(HWND hwndDlg, uint type, uint depth, const CVPWindTreeAppD
TCHAR stmp[256]; TCHAR stmp[256];
float nticks= CVPWindTreeAppData::NumTicks; float nticks= CVPWindTreeAppData::NumTicks;
float scale; float scale;
// which scale?? // which scale??
switch(type) switch(type)
{ {
@ -1951,27 +1951,27 @@ void updateVPWTStatic(HWND hwndDlg, uint type, uint depth, const CVPWindTreeAppD
// update static according to type. // update static according to type.
switch(type) switch(type)
{ {
case 0: case 0:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqSliderId[depth], TBM_GETPOS, 0, 0);
_stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks); _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks);
SetWindowText( GetDlgItem(hwndDlg, VPWTFreqStaticId[depth]), stmp ); SetWindowText( GetDlgItem(hwndDlg, VPWTFreqStaticId[depth]), stmp );
break; break;
case 1: case 1:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqWDSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqWDSliderId[depth], TBM_GETPOS, 0, 0);
_stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks); _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks);
SetWindowText( GetDlgItem(hwndDlg, VPWTFreqWDStaticId[depth]), stmp ); SetWindowText( GetDlgItem(hwndDlg, VPWTFreqWDStaticId[depth]), stmp );
break; break;
case 2: case 2:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistXYSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistXYSliderId[depth], TBM_GETPOS, 0, 0);
_stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks); _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks);
SetWindowText( GetDlgItem(hwndDlg, VPWTDistXYStaticId[depth]), stmp ); SetWindowText( GetDlgItem(hwndDlg, VPWTDistXYStaticId[depth]), stmp );
break; break;
case 3: case 3:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistZSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistZSliderId[depth], TBM_GETPOS, 0, 0);
_stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks); _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks);
SetWindowText( GetDlgItem(hwndDlg, VPWTDistZStaticId[depth]), stmp ); SetWindowText( GetDlgItem(hwndDlg, VPWTDistZStaticId[depth]), stmp );
break; break;
case 4: case 4:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTBiasSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTBiasSliderId[depth], TBM_GETPOS, 0, 0);
// expand to -2 to 2. // expand to -2 to 2.
float biasVal= 4 * float(sliderValue)/nticks - 2; float biasVal= 4 * float(sliderValue)/nticks - 2;
@ -2041,10 +2041,10 @@ INT_PTR CALLBACK VPWindTreeCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
// Param pointers // Param pointers
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@ -2108,7 +2108,7 @@ INT_PTR CALLBACK VPWindTreeCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -2175,9 +2175,9 @@ INT_PTR CALLBACK VPWindTreeCallback (
// EditBox change: ... // EditBox change: ...
if( HIWORD(wParam) == EN_KILLFOCUS || EnChangeReturn) if( HIWORD(wParam) == EN_KILLFOCUS || EnChangeReturn)
{ {
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_EDIT_VPWT_FREQ_SCALE: case IDC_EDIT_VPWT_FREQ_SCALE:
{ {
// Read FreqScale // Read FreqScale
@ -2220,7 +2220,7 @@ INT_PTR CALLBACK VPWindTreeCallback (
SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_DIST_SCALE), stmp ); SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_DIST_SCALE), stmp );
} }
break; break;
} }
} }
} }
break; break;
@ -2279,10 +2279,10 @@ INT_PTR CALLBACK MiscDialogCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
// Param pointers // Param pointers
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@ -2302,12 +2302,12 @@ INT_PTR CALLBACK MiscDialogCallback (
// Mesh interfaces // Mesh interfaces
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), utf8ToTStr(currentParam->InterfaceFileName)); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), utf8ToTStr(currentParam->InterfaceFileName));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD),
currentParam->InterfaceThreshold != -1.f ? utf8ToTStr(toStringMax(currentParam->InterfaceThreshold)) currentParam->InterfaceThreshold != -1.f ? utf8ToTStr(toStringMax(currentParam->InterfaceThreshold))
: _T("") : _T("")
); );
SendMessage(GetDlgItem(hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_SETCHECK, currentParam->GetInterfaceNormalsFromSceneObjects, 0); SendMessage(GetDlgItem(hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_SETCHECK, currentParam->GetInterfaceNormalsFromSceneObjects, 0);
// Skeleton Scale // Skeleton Scale
SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_SETCHECK, currentParam->ExportBoneScale, 0); SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_SETCHECK, currentParam->ExportBoneScale, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), utf8ToTStr(currentParam->ExportBoneScaleNameExt)); SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), utf8ToTStr(currentParam->ExportBoneScaleNameExt));
@ -2325,7 +2325,7 @@ INT_PTR CALLBACK MiscDialogCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -2358,10 +2358,10 @@ INT_PTR CALLBACK MiscDialogCallback (
currentParam->InterfaceFileName = tStrToUtf8(tmp); currentParam->InterfaceFileName = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), tmp, 512);
if (_tcslen(tmp) != 0) if (_tcslen(tmp) != 0)
currentParam->InterfaceThreshold = toFloatMax(tmp); currentParam->InterfaceThreshold = toFloatMax(tmp);
currentParam->GetInterfaceNormalsFromSceneObjects = SendMessage (GetDlgItem (hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_GETCHECK, 0, 0); currentParam->GetInterfaceNormalsFromSceneObjects = SendMessage (GetDlgItem (hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_GETCHECK, 0, 0);
// Skeleton Scale // Skeleton Scale
currentParam->ExportBoneScale= SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_GETCHECK, 0, 0); currentParam->ExportBoneScale= SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), tmp, 512);
@ -2414,10 +2414,10 @@ INT_PTR CALLBACK AnimationDialogCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
// Param pointers // Param pointers
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@ -2434,7 +2434,7 @@ INT_PTR CALLBACK AnimationDialogCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -2483,7 +2483,7 @@ INT_PTR CALLBACK LodDialogCallback (
{ {
CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CLodDialogBoxParam *currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -2551,7 +2551,7 @@ INT_PTR CALLBACK LodDialogCallback (
{ {
case TCN_SELCHANGE: case TCN_SELCHANGE:
{ {
uint curSel=SendMessage (pnmh->hwndFrom, TCM_GETCURSEL, 0, 0); uint curSel=SendMessage (pnmh->hwndFrom, TCM_GETCURSEL, 0, 0);
for (uint tab=0; tab<TAB_COUNT; tab++) for (uint tab=0; tab<TAB_COUNT; tab++)
{ {
@ -2568,7 +2568,7 @@ INT_PTR CALLBACK LodDialogCallback (
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
{ {
HWND hwndButton = (HWND) lParam; HWND hwndButton = (HWND) lParam;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -2593,9 +2593,9 @@ INT_PTR CALLBACK LodDialogCallback (
EndDialog(hwndDlg,1); EndDialog(hwndDlg,1);
break; break;
case WM_DESTROY: case WM_DESTROY:
break; break;
default: default:
return FALSE; return FALSE;
} }
@ -2607,7 +2607,7 @@ INT_PTR CALLBACK LodDialogCallback (
void CNelExport::OnNodeProperties (const std::set<INode*> &listNode) void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
{ {
// Get // Get
uint nNumSelNode=(uint)listNode.size(); uint nNumSelNode=(uint)listNode.size();
if (nNumSelNode) if (nNumSelNode)
@ -2780,13 +2780,13 @@ void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
param.LMCAmbient[i]= CExportNel::getScriptAppData (node, NEL3D_APPDATA_EXPORT_LMC_AMBIENT_START+i, CRGBA::Black); param.LMCAmbient[i]= CExportNel::getScriptAppData (node, NEL3D_APPDATA_EXPORT_LMC_AMBIENT_START+i, CRGBA::Black);
param.LMCDiffuse[i]= CExportNel::getScriptAppData (node, NEL3D_APPDATA_EXPORT_LMC_DIFFUSE_START+i, CRGBA::White); param.LMCDiffuse[i]= CExportNel::getScriptAppData (node, NEL3D_APPDATA_EXPORT_LMC_DIFFUSE_START+i, CRGBA::White);
} }
// CollisionMeshGeneration // CollisionMeshGeneration
param.CollisionMeshGeneration=CExportNel::getScriptAppData (node, NEL3D_APPDATA_CAMERA_COLLISION_MESH_GENERATION, 0); param.CollisionMeshGeneration=CExportNel::getScriptAppData (node, NEL3D_APPDATA_CAMERA_COLLISION_MESH_GENERATION, 0);
// RealTimeAmbientLightAddSun // RealTimeAmbientLightAddSun
param.RealTimeAmbientLightAddSun= CExportNel::getScriptAppData (node, NEL3D_APPDATA_REALTIME_AMBIENT_ADD_SUN, BST_UNCHECKED); param.RealTimeAmbientLightAddSun= CExportNel::getScriptAppData (node, NEL3D_APPDATA_REALTIME_AMBIENT_ADD_SUN, BST_UNCHECKED);
// Something selected ? // Something selected ?
std::set<INode*>::const_iterator ite=listNode.begin(); std::set<INode*>::const_iterator ite=listNode.begin();
ite++; ite++;
@ -2902,7 +2902,7 @@ void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
param.RemanenceRollupRatio = -1.f; param.RemanenceRollupRatio = -1.f;
if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_REMANENCE_SLICE_NUMBER, 64)!=param.RemanenceSliceNumber) if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_REMANENCE_SLICE_NUMBER, 64)!=param.RemanenceSliceNumber)
param.RemanenceSliceNumber = -1; param.RemanenceSliceNumber = -1;
// Radial normals // Radial normals
for (uint smoothGroup=0; smoothGroup<NEL3D_RADIAL_NORMAL_COUNT; smoothGroup++) for (uint smoothGroup=0; smoothGroup<NEL3D_RADIAL_NORMAL_COUNT; smoothGroup++)
@ -3004,9 +3004,9 @@ void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_LIGHT_DONT_CAST_SHADOW_EXTERIOR, BST_UNCHECKED) != param.LightDontCastShadowExterior) if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_LIGHT_DONT_CAST_SHADOW_EXTERIOR, BST_UNCHECKED) != param.LightDontCastShadowExterior)
param.LightDontCastShadowExterior= BST_INDETERMINATE; param.LightDontCastShadowExterior= BST_INDETERMINATE;
// VertexProgram // VertexProgram
// simply disable VertexProgram edition of multiple selection... // simply disable VertexProgram edition of multiple selection...
param.VertexProgramId= -1; param.VertexProgramId= -1;
// Collision // Collision
@ -3037,15 +3037,15 @@ void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
if(CExportNel::getScriptAppData (node, NEL3D_APPDATA_EXPORT_LMC_DIFFUSE_START+i, CRGBA::White) != param.LMCDiffuse[i]) if(CExportNel::getScriptAppData (node, NEL3D_APPDATA_EXPORT_LMC_DIFFUSE_START+i, CRGBA::White) != param.LMCDiffuse[i])
param.LMCDiffuse[i].setDifferentValuesMode(); param.LMCDiffuse[i].setDifferentValuesMode();
} }
// CollisionMeshGeneration // CollisionMeshGeneration
if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_CAMERA_COLLISION_MESH_GENERATION, 0)!=param.CollisionMeshGeneration) if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_CAMERA_COLLISION_MESH_GENERATION, 0)!=param.CollisionMeshGeneration)
param.CollisionMeshGeneration = -1; param.CollisionMeshGeneration = -1;
// RealTimeAmbientLightAddSun // RealTimeAmbientLightAddSun
if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_REALTIME_AMBIENT_ADD_SUN, BST_UNCHECKED) != param.RealTimeAmbientLightAddSun) if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_REALTIME_AMBIENT_ADD_SUN, BST_UNCHECKED) != param.RealTimeAmbientLightAddSun)
param.RealTimeAmbientLightAddSun= BST_INDETERMINATE; param.RealTimeAmbientLightAddSun= BST_INDETERMINATE;
// Next sel // Next sel
ite++; ite++;
} }
@ -3154,22 +3154,22 @@ void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
} }
if ( (param.InstanceShape != DIFFERENT_VALUE_STRING) || (listNode.size()==1)) if ( (param.InstanceShape != DIFFERENT_VALUE_STRING) || (listNode.size()==1))
CExportNel::setScriptAppData (node, NEL3D_APPDATA_INSTANCE_SHAPE, param.InstanceShape); CExportNel::setScriptAppData (node, NEL3D_APPDATA_INSTANCE_SHAPE, param.InstanceShape);
if (param.InstanceName != DIFFERENT_VALUE_STRING) if (param.InstanceName != DIFFERENT_VALUE_STRING)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_INSTANCE_NAME, param.InstanceName); CExportNel::setScriptAppData (node, NEL3D_APPDATA_INSTANCE_NAME, param.InstanceName);
if (param.DontAddToScene != BST_INDETERMINATE) if (param.DontAddToScene != BST_INDETERMINATE)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_DONT_ADD_TO_SCENE, param.DontAddToScene); CExportNel::setScriptAppData (node, NEL3D_APPDATA_DONT_ADD_TO_SCENE, param.DontAddToScene);
if (param.AutomaticAnimation != BST_INDETERMINATE) if (param.AutomaticAnimation != BST_INDETERMINATE)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_AUTOMATIC_ANIMATION, param.AutomaticAnimation); CExportNel::setScriptAppData (node, NEL3D_APPDATA_AUTOMATIC_ANIMATION, param.AutomaticAnimation);
if (param.InstanceGroupName != DIFFERENT_VALUE_STRING) if (param.InstanceGroupName != DIFFERENT_VALUE_STRING)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_IGNAME, param.InstanceGroupName); CExportNel::setScriptAppData (node, NEL3D_APPDATA_IGNAME, param.InstanceGroupName);
if (param.InterfaceFileName != "") if (param.InterfaceFileName != "")
CExportNel::setScriptAppData (node, NEL3D_APPDATA_INTERFACE_FILE, param.InterfaceFileName); CExportNel::setScriptAppData (node, NEL3D_APPDATA_INTERFACE_FILE, param.InterfaceFileName);
if (param.InterfaceThreshold != -1) if (param.InterfaceThreshold != -1)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_INTERFACE_THRESHOLD, param.InterfaceThreshold); CExportNel::setScriptAppData (node, NEL3D_APPDATA_INTERFACE_THRESHOLD, param.InterfaceThreshold);
if (param.GetInterfaceNormalsFromSceneObjects != BST_INDETERMINATE) if (param.GetInterfaceNormalsFromSceneObjects != BST_INDETERMINATE)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS, param.GetInterfaceNormalsFromSceneObjects); CExportNel::setScriptAppData (node, NEL3D_APPDATA_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS, param.GetInterfaceNormalsFromSceneObjects);
if (param.LightGroup != -1) if (param.LightGroup != -1)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_LM_LIGHT_GROUP, param.LightGroup); CExportNel::setScriptAppData (node, NEL3D_APPDATA_LM_LIGHT_GROUP, param.LightGroup);
@ -3195,7 +3195,7 @@ void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_RADIAL_NORMAL_SM+smoothGroup, param.RadialNormals[smoothGroup]); CExportNel::setScriptAppData (node, NEL3D_APPDATA_RADIAL_NORMAL_SM+smoothGroup, param.RadialNormals[smoothGroup]);
} }
if (param.LumelSizeMul != DIFFERENT_VALUE_STRING) if (param.LumelSizeMul != DIFFERENT_VALUE_STRING)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_LUMELSIZEMUL, param.LumelSizeMul); CExportNel::setScriptAppData (node, NEL3D_APPDATA_LUMELSIZEMUL, param.LumelSizeMul);
if (param.SoftShadowRadius != DIFFERENT_VALUE_STRING) if (param.SoftShadowRadius != DIFFERENT_VALUE_STRING)
@ -3228,7 +3228,7 @@ void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
// Write size of the list // Write size of the list
uint sizeList=std::min ((uint)param.ListLodName.size(), (uint)NEL3D_APPDATA_LOD_NAME_COUNT_MAX); uint sizeList=std::min ((uint)param.ListLodName.size(), (uint)NEL3D_APPDATA_LOD_NAME_COUNT_MAX);
CExportNel::setScriptAppData (node, NEL3D_APPDATA_LOD_NAME_COUNT, (int)sizeList); CExportNel::setScriptAppData (node, NEL3D_APPDATA_LOD_NAME_COUNT, (int)sizeList);
// Write the strings // Write the strings
uint stringIndex=0; uint stringIndex=0;
std::list<std::string>::iterator ite=param.ListLodName.begin(); std::list<std::string>::iterator ite=param.ListLodName.begin();
@ -3289,7 +3289,7 @@ void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
if (param.VertexProgramId!=-1) if (param.VertexProgramId!=-1)
{ {
CExportNel::setScriptAppData (node, NEL3D_APPDATA_VERTEXPROGRAM_ID, param.VertexProgramId); CExportNel::setScriptAppData (node, NEL3D_APPDATA_VERTEXPROGRAM_ID, param.VertexProgramId);
// according to VertexProgram, change setup // according to VertexProgram, change setup
if(param.VertexProgramId==1) if(param.VertexProgramId==1)
{ {
CExportNel::setScriptAppDataVPWT(node, param.VertexProgramWindTree); CExportNel::setScriptAppDataVPWT(node, param.VertexProgramWindTree);
@ -3346,15 +3346,15 @@ void CNelExport::OnNodeProperties (const std::set<INode*> &listNode)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_EXPORT_LMC_DIFFUSE_START+i, col); CExportNel::setScriptAppData (node, NEL3D_APPDATA_EXPORT_LMC_DIFFUSE_START+i, col);
} }
} }
// CollisionMeshGeneration // CollisionMeshGeneration
if (param.CollisionMeshGeneration != -1) if (param.CollisionMeshGeneration != -1)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_CAMERA_COLLISION_MESH_GENERATION, param.CollisionMeshGeneration); CExportNel::setScriptAppData (node, NEL3D_APPDATA_CAMERA_COLLISION_MESH_GENERATION, param.CollisionMeshGeneration);
// RealTimeAmbientLightAddSun. // RealTimeAmbientLightAddSun.
if (param.RealTimeAmbientLightAddSun != BST_INDETERMINATE) if (param.RealTimeAmbientLightAddSun != BST_INDETERMINATE)
CExportNel::setScriptAppData (node, NEL3D_APPDATA_REALTIME_AMBIENT_ADD_SUN, param.RealTimeAmbientLightAddSun); CExportNel::setScriptAppData (node, NEL3D_APPDATA_REALTIME_AMBIENT_ADD_SUN, param.RealTimeAmbientLightAddSun);
// Next node // Next node
ite++; ite++;
} }

View file

@ -95,9 +95,9 @@ Matrix3 CExportNel::viewMatrix2CameraMatrix (const Matrix3& viewMatrix)
// ConvertMatrix a 3dsmax vector in NeL matrix // ConvertMatrix a 3dsmax vector in NeL matrix
void CExportNel::convertVector (CVector& nelVector, const Point3& maxVector) void CExportNel::convertVector (CVector& nelVector, const Point3& maxVector)
{ {
nelVector.x = maxVector.x; nelVector.x = maxVector.x;
nelVector.y = maxVector.y; nelVector.y = maxVector.y;
nelVector.z = maxVector.z; nelVector.z = maxVector.z;
} }
@ -409,7 +409,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName
} }
else else
{ {
nlwarning("Invalid type specified for pblock2 value with name '%s', given type '%u', found '%u'", nlwarning("Invalid type specified for pblock2 value with name '%s', given type '%u', found '%u'",
sName, (uint32)type, (uint32)paramType); sName, (uint32)type, (uint32)paramType);
} }
} }
@ -476,12 +476,12 @@ Modifier* CExportNel::getModifier (INode* pNode, Class_ID modCID)
int m; int m;
int nNumMods = pDObj->NumModifiers(); int nNumMods = pDObj->NumModifiers();
// Step through all modififers and verify the class id // Step through all modififers and verify the class id
for (m=0; m<nNumMods; ++m) for (m=0; m<nNumMods; ++m)
{ {
Modifier* pMod = pDObj->GetModifier(m); Modifier* pMod = pDObj->GetModifier(m);
if (pMod) if (pMod)
{ {
if (pMod->ClassID() == modCID) if (pMod->ClassID() == modCID)
{ {
// Match! Return it // Match! Return it
return pMod; return pMod;
@ -528,22 +528,22 @@ std::string CExportNel::getNelObjectName (INode& node)
if (obj) if (obj)
{ {
Class_ID clid = obj->ClassID(); Class_ID clid = obj->ClassID();
// is the object a particle system ? (we do this defore meshs, because for now there is a mesh in max scenes to say where a particle system is...) // is the object a particle system ? (we do this defore meshs, because for now there is a mesh in max scenes to say where a particle system is...)
if (clid.PartA() == NEL_PARTICLE_SYSTEM_CLASS_ID) if (clid.PartA() == NEL_PARTICLE_SYSTEM_CLASS_ID)
{ {
std::string shapeName; std::string shapeName;
if (CExportNel::getValueByNameUsingParamBlock2(node, "ps_file_name", (ParamType2) TYPE_STRING, &shapeName, 0)) if (CExportNel::getValueByNameUsingParamBlock2(node, "ps_file_name", (ParamType2) TYPE_STRING, &shapeName, 0))
{ {
return NLMISC::CFile::getFilename(shapeName); return NLMISC::CFile::getFilename(shapeName);
} }
} }
} }
// Try to get an APPDATA for the name of the object // Try to get an APPDATA for the name of the object
AppDataChunk *ad = node.GetAppDataChunk (MAXSCRIPT_UTILITY_CLASS_ID, UTILITY_CLASS_ID, NEL3D_APPDATA_INSTANCE_SHAPE); AppDataChunk *ad = node.GetAppDataChunk (MAXSCRIPT_UTILITY_CLASS_ID, UTILITY_CLASS_ID, NEL3D_APPDATA_INSTANCE_SHAPE);
if (ad&&ad->data) if (ad&&ad->data)
{ {
if (::strlen((const char *) ad->data) != 0) if (::strlen((const char *) ad->data) != 0)
{ {
// Get the name of the object in the APP data // Get the name of the object in the APP data
return (const char*)ad->data; return (const char*)ad->data;
} }
@ -562,7 +562,7 @@ std::string CExportNel::getNelObjectName (INode& node)
if (ad&&ad->data) if (ad&&ad->data)
{ {
if (_tcslen((const TCHAR *) ad->data) != 0) if (_tcslen((const TCHAR *) ad->data) != 0)
{ {
// get file name only // get file name only
return NLMISC::CFile::getFilename(tStrToUtf8((const TCHAR*)ad->data)); return NLMISC::CFile::getFilename(tStrToUtf8((const TCHAR*)ad->data));
} }
@ -578,7 +578,7 @@ std::string CExportNel::getNelObjectName (INode& node)
} }
} }
else else
{ {
// Extract the node name // Extract the node name
return tStrToUtf8(node.GetName()); return tStrToUtf8(node.GetName());
} }
@ -587,7 +587,7 @@ std::string CExportNel::getNelObjectName (INode& node)
// -------------------------------------------------- // --------------------------------------------------
void CExportNel::decompMatrix (NLMISC::CVector& nelScale, NLMISC::CQuat& nelRot, NLMISC::CVector& nelPos, void CExportNel::decompMatrix (NLMISC::CVector& nelScale, NLMISC::CQuat& nelRot, NLMISC::CVector& nelPos,
const Matrix3& maxMatrix) const Matrix3& maxMatrix)
{ {
// Use decomp part of the max SDK // Use decomp part of the max SDK
@ -601,7 +601,7 @@ void CExportNel::decompMatrix (NLMISC::CVector& nelScale, NLMISC::CQuat& nelRot,
parts.q.MakeMatrix(rtm); parts.q.MakeMatrix(rtm);
parts.u.MakeMatrix(srtm); parts.u.MakeMatrix(srtm);
stm = ScaleMatrix(parts.k); stm = ScaleMatrix(parts.k);
ftm = ScaleMatrix(Point3(parts.f,parts.f,parts.f)); ftm = ScaleMatrix(Point3(parts.f,parts.f,parts.f));
Matrix3 mat = Inverse(srtm) * stm * srtm * rtm * ftm * ptm; Matrix3 mat = Inverse(srtm) * stm * srtm * rtm * ftm * ptm;
// Set the translation // Set the translation
@ -841,7 +841,7 @@ void CExportNel::addParentLodNode (INode &child, std::set<INode*> &lodListToExcl
if (parent == NULL) if (parent == NULL)
parent = _Ip->GetRootNode(); parent = _Ip->GetRootNode();
// Get its child lod // Get its child lod
uint lodCount = getScriptAppData (parent, NEL3D_APPDATA_LOD_NAME_COUNT, 0); uint lodCount = getScriptAppData (parent, NEL3D_APPDATA_LOD_NAME_COUNT, 0);
for (uint lod=0; lod<lodCount; lod++) for (uint lod=0; lod<lodCount; lod++)
{ {
@ -894,13 +894,13 @@ void CExportNel::uvMatrix2NelUVMatrix (const Matrix3& maxMatrix, NLMISC::CMatrix
dest.identity(); dest.identity();
// Set the rotation part // Set the rotation part
dest.setRot(I, J, K); dest.setRot(I, J, K);
// Set the position part // Set the position part
dest.setPos(P); dest.setPos(P);
// transfo matrix // transfo matrix
CMatrix convert; CMatrix convert;
convert.setRot(CVector::I, -CVector::J, CVector::K); convert.setRot(CVector::I, -CVector::J, CVector::K);
convert.setPos(CVector::J); convert.setPos(CVector::J);
@ -967,7 +967,7 @@ struct CMaxMeshSeg
uint V0, V1; uint V0, V1;
// for map insertion // for map insertion
bool operator<(const CMaxMeshSeg &other) const bool operator<(const CMaxMeshSeg &other) const
{ {
uint lv0 = std::min(V0, V1); uint lv0 = std::min(V0, V1);
uint lv1 = std::max(V0, V1); uint lv1 = std::max(V0, V1);
@ -983,8 +983,8 @@ struct CMaxMeshSeg
return !(*this < other) && !(other < *this); return !(*this < other) && !(other < *this);
} }
CMaxMeshSeg(uint v0, uint v1) : V0(v0), CMaxMeshSeg(uint v0, uint v1) : V0(v0),
V1(v1) V1(v1)
{ {
} }
}; };
@ -993,7 +993,7 @@ struct CPredNextSegOf
{ {
uint Prev; uint Prev;
CPredNextSegOf(uint prev) : Prev(prev) {} CPredNextSegOf(uint prev) : Prev(prev) {}
bool operator()(const CMaxMeshSeg &value) const { return value.V0 == Prev || value.V1 == Prev; } bool operator()(const CMaxMeshSeg &value) const { return value.V0 == Prev || value.V1 == Prev; }
}; };
/// Get normal of a max triangle in nel format /// Get normal of a max triangle in nel format
@ -1009,7 +1009,7 @@ static NLMISC::CVector getMaxFaceNormal(const Mesh &m, const NLMISC::CMatrix &ba
normal.normalize(); normal.normalize();
return normal; return normal;
} }
@ -1017,11 +1017,11 @@ static NLMISC::CVector getMaxFaceNormal(const Mesh &m, const NLMISC::CMatrix &ba
// This convert a polygon expressed as a max mesh into a list of ordered vectors // This convert a polygon expressed as a max mesh into a list of ordered vectors
void CExportNel::maxPolygonMeshToOrderedPoly(Mesh &mesh, std::vector<NLMISC::CVector> &dest, const NLMISC::CMatrix &basis, NLMISC::CVector &avgNormal) void CExportNel::maxPolygonMeshToOrderedPoly(Mesh &mesh, std::vector<NLMISC::CVector> &dest, const NLMISC::CMatrix &basis, NLMISC::CVector &avgNormal)
{ {
/// We use a very simple (but slow) algo : examine for each segment how many tris share it. If it is one then it is a border seg /// We use a very simple (but slow) algo : examine for each segment how many tris share it. If it is one then it is a border seg
/// Then, just order segments /// Then, just order segments
typedef std::map<CMaxMeshSeg, uint> TSegMap; typedef std::map<CMaxMeshSeg, uint> TSegMap;
avgNormal.set(0, 0, 0); avgNormal.set(0, 0, 0);
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
@ -1056,15 +1056,15 @@ void CExportNel::maxPolygonMeshToOrderedPoly(Mesh &mesh, std::vector<NLMISC::CVe
// keep segments for which nbref is 1 // // keep segments for which nbref is 1 //
//////////////////////////////////////// ////////////////////////////////////////
typedef std::list<CMaxMeshSeg> TSegList; typedef std::list<CMaxMeshSeg> TSegList;
TSegList borderSegs; TSegList borderSegs;
for(TSegMap::const_iterator it = segs.begin(); it != segs.end(); ++it) for(TSegMap::const_iterator it = segs.begin(); it != segs.end(); ++it)
{ {
if (it->second == 1) borderSegs.push_back(it->first); if (it->second == 1) borderSegs.push_back(it->first);
} }
dest.clear(); dest.clear();
if (borderSegs.empty()) return; if (borderSegs.empty()) return;
@ -1081,9 +1081,9 @@ void CExportNel::maxPolygonMeshToOrderedPoly(Mesh &mesh, std::vector<NLMISC::CVe
for(;;) for(;;)
{ {
TSegList::iterator nextSeg = std::find_if(borderSegs.begin(), borderSegs.end(), CPredNextSegOf(nextToFind)); TSegList::iterator nextSeg = std::find_if(borderSegs.begin(), borderSegs.end(), CPredNextSegOf(nextToFind));
if (nextSeg == borderSegs.end()) return; if (nextSeg == borderSegs.end()) return;
CExportNel::convertVector(pos, mesh.verts[nextSeg->V0 == nextToFind ? nextSeg->V0 : nextSeg->V1]); CExportNel::convertVector(pos, mesh.verts[nextSeg->V0 == nextToFind ? nextSeg->V0 : nextSeg->V1]);
dest.push_back(basis * pos); dest.push_back(basis * pos);
nextToFind = (nextSeg->V0 == nextToFind) ? nextSeg->V1 : nextSeg->V0; nextToFind = (nextSeg->V0 == nextToFind) ? nextSeg->V1 : nextSeg->V0;
borderSegs.erase(nextSeg); borderSegs.erase(nextSeg);
} }
@ -1096,14 +1096,14 @@ void CExportNel::maxPolygonMeshToOrderedPoly(Mesh &mesh, std::vector<NLMISC::CVe
static std::string OldDecimalSeparatorLocale; static std::string OldDecimalSeparatorLocale;
static void setDecimalSeparatorAsPoint() static void setDecimalSeparatorAsPoint()
{ {
OldDecimalSeparatorLocale = ::setlocale(LC_NUMERIC, NULL); OldDecimalSeparatorLocale = ::setlocale(LC_NUMERIC, NULL);
::setlocale(LC_NUMERIC, "C"); ::setlocale(LC_NUMERIC, "C");
} }
static void restoreDecimalSeparator() static void restoreDecimalSeparator()
{ {
::setlocale(LC_NUMERIC, OldDecimalSeparatorLocale.c_str()); ::setlocale(LC_NUMERIC, OldDecimalSeparatorLocale.c_str());
} }
@ -1128,7 +1128,7 @@ bool toFloatMax(const TCHAR *src, float &dest)
} }
bool toFloatMax(const std::string &src, float &dest) bool toFloatMax(const std::string &src, float &dest)
{ {
setDecimalSeparatorAsPoint(); setDecimalSeparatorAsPoint();
std::string str(src); std::string str(src);
std::string::size_type pointPos = str.find_first_of(","); std::string::size_type pointPos = str.find_first_of(",");
@ -1158,17 +1158,17 @@ bool toFloatMax(const std::string &src, float &dest)
result += (float) (*src - '0'); result += (float) (*src - '0');
++src; ++src;
} }
if (!(*src == '.' || *src == ',')) if (!(*src == '.' || *src == ','))
{ {
if (numberFound) if (numberFound)
{ {
dest = sgn * result; dest = sgn * result;
return true; return true;
} }
else else
return false; return false;
} }
++src; ++src;
if (!::isdigit(*src)) if (!::isdigit(*src))
{ {
if (!numberFound) if (!numberFound)
@ -1176,9 +1176,9 @@ bool toFloatMax(const std::string &src, float &dest)
return false; return false;
} }
} }
float addValue = 0.1f; float addValue = 0.1f;
while (::isdigit(*src)) while (::isdigit(*src))
{ {
result += addValue * (float) (*src - '0'); result += addValue * (float) (*src - '0');
addValue *= 0.1f; addValue *= 0.1f;
++ src; ++ src;
@ -1217,15 +1217,15 @@ std::string toStringMax(float value)
do do
{ {
value *= 10.f; value *= 10.f;
frac = (float) ::modf((double) value, &intPart); frac = (float) ::modf((double) value, &intPart);
result += toString((int) intPart % 10); result += toString((int) intPart % 10);
} }
while (frac != 0.f); while (frac != 0.f);
return positive ? result : "-" + result;*/ return positive ? result : "-" + result;*/
} }
///======================================================================= ///=======================================================================
std::string toStringMax(int value) std::string toStringMax(int value)
{ {
char result[256]; char result[256];
setDecimalSeparatorAsPoint(); setDecimalSeparatorAsPoint();
::sprintf(result, "%d", value); ::sprintf(result, "%d", value);
@ -1233,7 +1233,7 @@ std::string toStringMax(int value)
return result; return result;
/*char str[256]; /*char str[256];
::sprintf(str, "%d", value); ::sprintf(str, "%d", value);
return str;*/ return str;*/
} }
///======================================================================= ///=======================================================================

View file

@ -153,7 +153,7 @@ void drawVertexColorBox (float x0, float y0, float x1, float y1, CRGBA color, fl
{ {
// Draw a white frame behind // Draw a white frame behind
CDRU::drawQuad (x0, y0, x1, y1, driver, CRGBA (0x40, 0x40, 0x40), CViewport()); CDRU::drawQuad (x0, y0, x1, y1, driver, CRGBA (0x40, 0x40, 0x40), CViewport());
// Compute the colors with alpha to show the hardness // Compute the colors with alpha to show the hardness
CRGBA fullFull=color; CRGBA fullFull=color;
CRGBA full=color; CRGBA full=color;
@ -222,9 +222,9 @@ void drawInterface (TModeMouse select, TModePaint mode, PaintPatchMod *pobj, IDr
CDRU::drawBitmap ( (float)(t%MOD_WIDTH)/(float)MOD_WIDTH, (float)(t/MOD_WIDTH)/(float)MOD_HEIGHT, 1.f/(float)MOD_WIDTH, CDRU::drawBitmap ( (float)(t%MOD_WIDTH)/(float)MOD_WIDTH, (float)(t/MOD_WIDTH)/(float)MOD_HEIGHT, 1.f/(float)MOD_WIDTH,
1.f/(float)MOD_HEIGHT, *texture, driver, CViewport(), false); 1.f/(float)MOD_HEIGHT, *texture, driver, CViewport(), false);
else else
CDRU::drawQuad ( (float)(t%MOD_WIDTH)/(float)MOD_WIDTH, (float)(t/MOD_WIDTH)/(float)MOD_HEIGHT, CDRU::drawQuad ( (float)(t%MOD_WIDTH)/(float)MOD_WIDTH, (float)(t/MOD_WIDTH)/(float)MOD_HEIGHT,
(float)(t%MOD_WIDTH)/(float)MOD_WIDTH+1.f/(float)MOD_WIDTH, (float)(t%MOD_WIDTH)/(float)MOD_WIDTH+1.f/(float)MOD_WIDTH,
(float)(t/MOD_WIDTH)/(float)MOD_HEIGHT+1.f/(float)MOD_HEIGHT, driver, (float)(t/MOD_WIDTH)/(float)MOD_HEIGHT+1.f/(float)MOD_HEIGHT, driver,
CRGBA (128, 128, 128), CViewport()); CRGBA (128, 128, 128), CViewport());
} }
} }
@ -394,7 +394,7 @@ void drawInterface (TModeMouse select, TModePaint mode, PaintPatchMod *pobj, IDr
if ((pobj->CurrentTileSet!=-1)&&(mode==ModeTile)) if ((pobj->CurrentTileSet!=-1)&&(mode==ModeTile))
{ {
// *** Draw the current group // *** Draw the current group
ITexture* group[NL3D_CTILE_NUM_GROUP+1]={bankCont->allBitmap, bankCont->_0Bitmap, bankCont->_1Bitmap, bankCont->_2Bitmap, bankCont->_3Bitmap, ITexture* group[NL3D_CTILE_NUM_GROUP+1]={bankCont->allBitmap, bankCont->_0Bitmap, bankCont->_1Bitmap, bankCont->_2Bitmap, bankCont->_3Bitmap,
bankCont->_4Bitmap, bankCont->_5Bitmap, bankCont->_6Bitmap, bankCont->_7Bitmap, bankCont->_8Bitmap, bankCont->_9Bitmap, bankCont->_4Bitmap, bankCont->_5Bitmap, bankCont->_6Bitmap, bankCont->_7Bitmap, bankCont->_8Bitmap, bankCont->_9Bitmap,
bankCont->_10Bitmap, bankCont->_11Bitmap}; bankCont->_10Bitmap, bankCont->_11Bitmap};
@ -450,7 +450,7 @@ void makeVectMesh (std::vector<EPM_Mesh>& vectMesh, INodeTab& nodes, ModContextL
for (int i = 0; i < mcList.Count (); i++) for (int i = 0; i < mcList.Count (); i++)
{ {
// //
PaintPatchData *patchData = (PaintPatchData*)mcList[i]->localData; PaintPatchData *patchData = (PaintPatchData*)mcList[i]->localData;
if (!patchData) if (!patchData)
continue; continue;
@ -496,7 +496,7 @@ void transformDesc (tileDesc &desc, bool symmetry, uint rotate, uint mesh, uint
CTileBank::TTileType type; CTileBank::TTileType type;
bank.getTileXRef (tile, tileSet, number, type); bank.getTileXRef (tile, tileSet, number, type);
// Transform the transfo // Transform the transfo
CPatchInfo::getTileSymmetryRotate (bank, desc.getLayer(0).Tile, tileSymmetry, tileRotate); CPatchInfo::getTileSymmetryRotate (bank, desc.getLayer(0).Tile, tileSymmetry, tileRotate);
// Get the state of the layer 0 // Get the state of the layer 0
@ -579,7 +579,7 @@ void transformInvDesc (tileDesc &desc, bool symmetry, uint rotate, uint mesh, ui
transformDesc (desc, symmetry, 0, mesh, tile, vectMesh); transformDesc (desc, symmetry, 0, mesh, tile, vectMesh);
} }
void EPM_PaintMouseProc::SetTile (int mesh, int tile, const tileDesc& desc, std::vector<EPM_Mesh>& vectMesh, CLandscape* land, void EPM_PaintMouseProc::SetTile (int mesh, int tile, const tileDesc& desc, std::vector<EPM_Mesh>& vectMesh, CLandscape* land,
CNelPatchChanger& nelPatchChg, std::vector<CBackupValue>* backupStack, bool undo, bool updateDisplace) CNelPatchChanger& nelPatchChg, std::vector<CBackupValue>* backupStack, bool undo, bool updateDisplace)
{ {
// Undo: get old value // Undo: get old value
@ -600,7 +600,7 @@ void EPM_PaintMouseProc::SetTile (int mesh, int tile, const tileDesc& desc, std:
maxDesc.setDisplace (oldDesc.getDisplace()); maxDesc.setDisplace (oldDesc.getDisplace());
} }
// Transform tile // Transform tile
tileDesc copyDesc=maxDesc; tileDesc copyDesc=maxDesc;
transformInvDesc (maxDesc, vectMesh[mesh].Symmetry, 4-vectMesh[mesh].Rotate, mesh, tile, vectMesh); transformInvDesc (maxDesc, vectMesh[mesh].Symmetry, 4-vectMesh[mesh].Rotate, mesh, tile, vectMesh);
transformInvDesc (copyDesc, vectMesh[mesh].Symmetry, 0, mesh, tile, vectMesh); transformInvDesc (copyDesc, vectMesh[mesh].Symmetry, 0, mesh, tile, vectMesh);
@ -805,7 +805,7 @@ bool EPM_PaintMouseProc::isLocked256 (PaintPatchMod *pobj, EPM_PaintTile* pTile)
return false; return false;
} }
bool EPM_PaintMouseProc::ClearATile ( EPM_PaintTile* pTile, std::vector<EPM_Mesh>& vectMesh, bool EPM_PaintMouseProc::ClearATile ( EPM_PaintTile* pTile, std::vector<EPM_Mesh>& vectMesh,
CLandscape* land, CNelPatchChanger& nelPatchChg, bool _256, bool _force128) CLandscape* land, CNelPatchChanger& nelPatchChg, bool _256, bool _force128)
{ {
// ** 1) Backup of the tile // ** 1) Backup of the tile
@ -864,7 +864,7 @@ bool EPM_PaintMouseProc::ClearATile ( EPM_PaintTile* pTile, std::vector<EPM_Mesh
// Check locked // Check locked
if (isLocked (pobj, pTile)) if (isLocked (pobj, pTile))
return false; return false;
// Cleared descriptor // Cleared descriptor
tileDesc desc; tileDesc desc;
desc.setTile (0, 0, 0, tileIndex (0,0), tileIndex (0,0), tileIndex (0,0)); desc.setTile (0, 0, 0, tileIndex (0,0), tileIndex (0,0), tileIndex (0,0));
@ -882,8 +882,8 @@ bool EPM_PaintMouseProc::ClearATile ( EPM_PaintTile* pTile, std::vector<EPM_Mesh
return true; return true;
} }
bool EPM_PaintMouseProc::PutATile ( EPM_PaintTile* pTile, int tileSet, int curRotation, const CTileBank& bank, bool EPM_PaintMouseProc::PutATile ( EPM_PaintTile* pTile, int tileSet, int curRotation, const CTileBank& bank,
bool selectCycle, std::set<EPM_PaintTile*>& visited, std::vector<EPM_Mesh>& vectMesh, bool selectCycle, std::set<EPM_PaintTile*>& visited, std::vector<EPM_Mesh>& vectMesh,
CLandscape* land, CNelPatchChanger& nelPatchChg, bool _256) CLandscape* land, CNelPatchChanger& nelPatchChg, bool _256)
{ {
// If tile 256, must have delta pos aligned on 2x2 // If tile 256, must have delta pos aligned on 2x2
@ -912,7 +912,7 @@ bool EPM_PaintMouseProc::PutATile ( EPM_PaintTile* pTile, int tileSet, int curRo
int patch=pTile->tile/NUM_TILE_SEL; int patch=pTile->tile/NUM_TILE_SEL;
// Check if we are in patch subobject and if this patch is selected // Check if we are in patch subobject and if this patch is selected
if ((vectMesh[pTile->Mesh].PMesh->selLevel==EP_PATCH)&&(!vectMesh[pTile->Mesh].PMesh->patchSel[patch])) if ((vectMesh[pTile->Mesh].PMesh->selLevel==EP_PATCH)&&(!vectMesh[pTile->Mesh].PMesh->patchSel[patch]))
return false; return false;
@ -986,7 +986,7 @@ bool EPM_PaintMouseProc::PutATile ( EPM_PaintTile* pTile, int tileSet, int curRo
desc.setTile (1, 1+((-curRotation-1)&3), 0, tileIndex (nTile, (curRotation-nRot)&3), tileIndex (0,0), tileIndex (0,0)); desc.setTile (1, 1+((-curRotation-1)&3), 0, tileIndex (nTile, (curRotation-nRot)&3), tileIndex (0,0), tileIndex (0,0));
nlassert (other); nlassert (other);
SetTile (other->Mesh, other->tile, desc, vectMesh, land, nelPatchChg, &backupStack); SetTile (other->Mesh, other->tile, desc, vectMesh, land, nelPatchChg, &backupStack);
// Add to visited tile set // Add to visited tile set
visited.insert (other); visited.insert (other);
@ -995,7 +995,7 @@ bool EPM_PaintMouseProc::PutATile ( EPM_PaintTile* pTile, int tileSet, int curRo
desc.setTile (1, 1+((-curRotation+1)&3), 0, tileIndex (nTile, (curRotation-nRot)&3), tileIndex (0,0), tileIndex (0,0)); desc.setTile (1, 1+((-curRotation+1)&3), 0, tileIndex (nTile, (curRotation-nRot)&3), tileIndex (0,0), tileIndex (0,0));
nlassert (other); nlassert (other);
SetTile (other->Mesh, other->tile, desc, vectMesh, land, nelPatchChg, &backupStack); SetTile (other->Mesh, other->tile, desc, vectMesh, land, nelPatchChg, &backupStack);
// Add to visited tile set // Add to visited tile set
visited.insert (other); visited.insert (other);
@ -1005,7 +1005,7 @@ bool EPM_PaintMouseProc::PutATile ( EPM_PaintTile* pTile, int tileSet, int curRo
nlassert (other); nlassert (other);
nlassert (other==pTile->getBottomRight256 (0, nRot)); nlassert (other==pTile->getBottomRight256 (0, nRot));
SetTile (other->Mesh, other->tile, desc, vectMesh, land, nelPatchChg, &backupStack); SetTile (other->Mesh, other->tile, desc, vectMesh, land, nelPatchChg, &backupStack);
// Add to visited tile set // Add to visited tile set
visited.insert (other); visited.insert (other);
} }
@ -1037,14 +1037,14 @@ bool EPM_PaintMouseProc::PutATile ( EPM_PaintTile* pTile, int tileSet, int curRo
case 0: case 0:
// Main // Main
if (pTile->voisins[3]) if (pTile->voisins[3])
if (!PropagateBorder (pTile->voisins[3], (pTile->rotate[3]+curRotation)&3, tileSet, visited, bank, if (!PropagateBorder (pTile->voisins[3], (pTile->rotate[3]+curRotation)&3, tileSet, visited, bank,
vectMesh, land, nelPatchChg, backupStack)) vectMesh, land, nelPatchChg, backupStack))
{ {
bContinue=false; bContinue=false;
goto zap; goto zap;
} }
if (pTile->voisins[0]) if (pTile->voisins[0])
if (!PropagateBorder (pTile->voisins[0], (pTile->rotate[0]+curRotation)&3, tileSet, visited, bank, if (!PropagateBorder (pTile->voisins[0], (pTile->rotate[0]+curRotation)&3, tileSet, visited, bank,
vectMesh, land, nelPatchChg, backupStack)) vectMesh, land, nelPatchChg, backupStack))
{ {
bContinue=false; bContinue=false;
@ -1212,13 +1212,13 @@ zap:;
for (uint corner=0; corner<4; corner++) for (uint corner=0; corner<4; corner++)
{ {
finalCorner[corner].TileSet = -1; finalCorner[corner].TileSet = -1;
// All the same or empty ? // All the same or empty ?
for (uint layer=0; layer<4; layer++) for (uint layer=0; layer<4; layer++)
{ {
// Compatible ? // Compatible ?
if ( ( finalCorner[corner].TileSet == -1 ) if ( ( finalCorner[corner].TileSet == -1 )
|| ( tileSetCases[layer][corner].TileSet == -1 ) || ( tileSetCases[layer][corner].TileSet == -1 )
|| ( tileSetCases[layer][corner] == finalCorner[corner] ) ) || ( tileSetCases[layer][corner] == finalCorner[corner] ) )
{ {
// Copy the tile // Copy the tile
@ -1265,7 +1265,7 @@ zap:;
bFind=true; bFind=true;
} }
} }
// no, ok push it back. // no, ok push it back.
if (!bFind) if (!bFind)
setIndex.push_back (finalCorner[v]); setIndex.push_back (finalCorner[v]);
@ -1369,7 +1369,7 @@ zap:;
finalIndex[l].Tile=tileTrans->getTile(); finalIndex[l].Tile=tileTrans->getTile();
} }
} }
// Set the border desc // Set the border desc
tileDesc desc; tileDesc desc;
GetTile (pTile->Mesh, pTile->tile, desc, vectMesh, land); GetTile (pTile->Mesh, pTile->tile, desc, vectMesh, land);
@ -1403,8 +1403,8 @@ zap:;
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
void EPM_PaintMouseProc::PutADisplacetile ( EPM_PaintTile* pTile, const CTileBank& bank, void EPM_PaintMouseProc::PutADisplacetile ( EPM_PaintTile* pTile, const CTileBank& bank,
std::vector<EPM_Mesh>& vectMesh, std::vector<EPM_Mesh>& vectMesh,
CLandscape* land, CNelPatchChanger& nelPatchChg) CLandscape* land, CNelPatchChanger& nelPatchChg)
{ {
// Get tile description // Get tile description
@ -1431,8 +1431,8 @@ void EPM_PaintMouseProc::PutADisplacetile ( EPM_PaintTile* pTile, const CTileBan
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
bool EPM_PaintMouseProc::GetBorderDesc (EPM_PaintTile* tile, tileSetIndex *pVoisinCorner, CTileSet::TFlagBorder pBorder[4][3], bool EPM_PaintMouseProc::GetBorderDesc (EPM_PaintTile* tile, tileSetIndex *pVoisinCorner, CTileSet::TFlagBorder pBorder[4][3],
tileDesc *pVoisinIndex, const CTileBank& bank, std::vector<EPM_Mesh>& vectMesh, tileDesc *pVoisinIndex, const CTileBank& bank, std::vector<EPM_Mesh>& vectMesh,
CNelPatchChanger& nelPatchChg, CLandscape *land) CNelPatchChanger& nelPatchChg, CLandscape *land)
{ {
// Tile info // Tile info
@ -1445,7 +1445,7 @@ bool EPM_PaintMouseProc::GetBorderDesc (EPM_PaintTile* tile, tileSetIndex *pVois
tileIndex pIndexx[3]; tileIndex pIndexx[3];
for (int nL=0; nL<nLayer; nL++) for (int nL=0; nL<nLayer; nL++)
{ {
// GetTileIndex // GetTileIndex
tileIndex index=backup.getLayer (nL); tileIndex index=backup.getLayer (nL);
pIndexx[nL]=index; pIndexx[nL]=index;
@ -1515,7 +1515,7 @@ const CTileSetTransition* EPM_PaintMouseProc::FindTransition (int nTileSet, int
} }
// Look for good tile.. // Look for good tile..
CTileSet::TTransition nTransition=CTileSet::getTransitionTile CTileSet::TTransition nTransition=CTileSet::getTransitionTile
(pBorderConverted[3], pBorderConverted[1], pBorderConverted[0], pBorderConverted[2]); (pBorderConverted[3], pBorderConverted[1], pBorderConverted[0], pBorderConverted[2]);
//nlassert (nTransition!=CTileSet::notfound); //nlassert (nTransition!=CTileSet::notfound);
if (nTransition==CTileSet::notfound) if (nTransition==CTileSet::notfound)
@ -1537,7 +1537,7 @@ int EPM_PaintMouseProc::getLayer (EPM_PaintTile* tile, int border, int tileSet,
tileIndex index=desc.getLayer(o); tileIndex index=desc.getLayer(o);
index.Rotate-=tile->rotate[border]; index.Rotate-=tile->rotate[border];
index.Rotate&=3; index.Rotate&=3;
CTileBank::TTileType type; CTileBank::TTileType type;
int TileSet, number; int TileSet, number;
@ -1554,8 +1554,8 @@ int EPM_PaintMouseProc::getLayer (EPM_PaintTile* tile, int border, int tileSet,
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation, int curTileSet, std::set<EPM_PaintTile*>& visited, bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation, int curTileSet, std::set<EPM_PaintTile*>& visited,
const CTileBank& bank, std::vector<EPM_Mesh>& vectMesh, const CTileBank& bank, std::vector<EPM_Mesh>& vectMesh,
CLandscape* land, CNelPatchChanger& nelPatchChg, std::vector<CBackupValue>& backupStack, bool recurseNoDiff) CLandscape* land, CNelPatchChanger& nelPatchChg, std::vector<CBackupValue>& backupStack, bool recurseNoDiff)
{ {
// 1) Already visited // 1) Already visited
@ -1698,7 +1698,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
} }
extraOrdinary[v]++; extraOrdinary[v]++;
bDiff=true; bDiff=true;
} }
} }
else else
{ {
@ -1799,7 +1799,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
(desc1.isEmpty())|| (desc1.isEmpty())||
(desc1.getCase()!=(1+((nCase+3)&3)))|| (desc1.getCase()!=(1+((nCase+3)&3)))||
(desc1.getLayer(0).Tile!=backup.getLayer(0).Tile)|| (desc1.getLayer(0).Tile!=backup.getLayer(0).Tile)||
(desc1.getLayer(0).Rotate!=((backup.getLayer(0).Rotate-rot)&3)) (desc1.getLayer(0).Rotate!=((backup.getLayer(0).Rotate-rot)&3))
) )
bDiff=true; bDiff=true;
} }
@ -1868,7 +1868,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
bFind=true; bFind=true;
} }
} }
// no, ok push it back. // no, ok push it back.
if (!bFind) if (!bFind)
setIndex.push_back (nCorner[v]); setIndex.push_back (nCorner[v]);
@ -1877,7 +1877,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
std::sort (setIndex.begin(), setIndex.end()); std::sort (setIndex.begin(), setIndex.end());
// Check validity // Check validity
// A) Check for more than 3 materials // A) Check for more than 3 materials
if (setIndex.size()>3) if (setIndex.size()>3)
return false; return false;
@ -1981,18 +1981,18 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
// Last on the stack ? // Last on the stack ?
if (*ite<nCorner[c]) if (*ite<nCorner[c])
{ {
// no, // no,
wanted=CTileSet::_1000; wanted=CTileSet::_1000;
invWanted=CTileSet::_1110; invWanted=CTileSet::_1110;
} }
else else
{ {
// yes, // yes,
wanted=CTileSet::_1110; wanted=CTileSet::_1110;
invWanted=CTileSet::_1000; invWanted=CTileSet::_1000;
} }
border[c]=wanted; border[c]=wanted;
// If voisin already visited, force his transition to 3/4 // If voisin already visited, force his transition to 3/4
if (tile->voisins[c]) if (tile->voisins[c])
{ {
@ -2034,7 +2034,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
return false; return false;
// Set the tile.. // Set the tile..
SetTile (tile->voisins[c]->Mesh, tile->voisins[c]->tile, pVoisinIndex, vectMesh, SetTile (tile->voisins[c]->Mesh, tile->voisins[c]->tile, pVoisinIndex, vectMesh,
land, nelPatchChg, &backupStack); land, nelPatchChg, &backupStack);
} }
/*if (pBorder[edge][nLayer]==CTileSet::_0001) /*if (pBorder[edge][nLayer]==CTileSet::_0001)
@ -2045,11 +2045,11 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
} }
} }
} }
// Normal, // Normal,
else else
{ {
// Voisin visited or frozen ? // Voisin visited or frozen ?
if (tile->voisins[c]&&((visited.find (tile->voisins[c])!=visited.end()) /*|| if (tile->voisins[c]&&((visited.find (tile->voisins[c])!=visited.end()) /*||
(vectMesh[tile->voisins[c]->Mesh].Node->IsFrozen())*/ )) (vectMesh[tile->voisins[c]->Mesh].Node->IsFrozen())*/ ))
{ {
// Yes, visited. Copy the border // Yes, visited. Copy the border
@ -2057,7 +2057,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
CTileSet::TFlagBorder pBorder[4][3]; CTileSet::TFlagBorder pBorder[4][3];
tileDesc pVoisinIndex; tileDesc pVoisinIndex;
bool bOk=GetBorderDesc (tile->voisins[c], pVoisinCorner, pBorder, &pVoisinIndex, bank, vectMesh, nelPatchChg, land); bool bOk=GetBorderDesc (tile->voisins[c], pVoisinCorner, pBorder, &pVoisinIndex, bank, vectMesh, nelPatchChg, land);
// Should not be empty // Should not be empty
nlassert (bOk); nlassert (bOk);
int edge=(2+c+tile->rotate[c])&3; int edge=(2+c+tile->rotate[c])&3;
@ -2075,7 +2075,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
else else
{ {
// No, not yet visited // No, not yet visited
// Choose transition by random // Choose transition by random
bool bComputed=false; bool bComputed=false;
if ((bVisited[c]||!recurseNoDiff)&&bSameEdge[c]) if ((bVisited[c]||!recurseNoDiff)&&bSameEdge[c])
@ -2086,7 +2086,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
CTileSet::TFlagBorder pBorder[4][3]; CTileSet::TFlagBorder pBorder[4][3];
tileDesc pVoisinIndex; tileDesc pVoisinIndex;
bool bOk=GetBorderDesc (tile->voisins[c], pVoisinCorner, pBorder, &pVoisinIndex, bank, vectMesh, nelPatchChg, land); bool bOk=GetBorderDesc (tile->voisins[c], pVoisinCorner, pBorder, &pVoisinIndex, bank, vectMesh, nelPatchChg, land);
// ok voisin is here ? // ok voisin is here ?
if (bOk) if (bOk)
{ {
@ -2140,18 +2140,18 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
// Last on the stack ? // Last on the stack ?
if (*ite<nCorner[c]) if (*ite<nCorner[c])
{ {
// no, // no,
wanted=CTileSet::_0001; wanted=CTileSet::_0001;
invWanted=CTileSet::_0111; invWanted=CTileSet::_0111;
} }
else else
{ {
// yes, // yes,
wanted=CTileSet::_0111; wanted=CTileSet::_0111;
invWanted=CTileSet::_0001; invWanted=CTileSet::_0001;
} }
border[c]=wanted; border[c]=wanted;
// If voisin already visited, force his transition to 3/4 // If voisin already visited, force his transition to 3/4
if (tile->voisins[c])//&&visited.find (tile->voisins[c])!=visited.end()) if (tile->voisins[c])//&&visited.find (tile->voisins[c])!=visited.end())
{ {
@ -2193,7 +2193,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
return false; return false;
// Set the tile.. // Set the tile..
SetTile (tile->voisins[c]->Mesh, tile->voisins[c]->tile, pVoisinIndex, vectMesh, SetTile (tile->voisins[c]->Mesh, tile->voisins[c]->tile, pVoisinIndex, vectMesh,
land, nelPatchChg, &backupStack); land, nelPatchChg, &backupStack);
} }
/*if (pBorder[edge][nLayer]==CTileSet::_1000) /*if (pBorder[edge][nLayer]==CTileSet::_1000)
@ -2205,7 +2205,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
} }
} }
// Normal, // Normal,
else else
{ {
// Voisin visited ? // Voisin visited ?
@ -2216,7 +2216,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
CTileSet::TFlagBorder pBorder[4][3]; CTileSet::TFlagBorder pBorder[4][3];
tileDesc pVoisinIndex; tileDesc pVoisinIndex;
bool bOk=GetBorderDesc (tile->voisins[c], pVoisinCorner, pBorder, &pVoisinIndex, bank, vectMesh, nelPatchChg, land); bool bOk=GetBorderDesc (tile->voisins[c], pVoisinCorner, pBorder, &pVoisinIndex, bank, vectMesh, nelPatchChg, land);
// Should not be empty // Should not be empty
nlassert (bOk); nlassert (bOk);
int edge=(2+c+tile->rotate[c])&3; int edge=(2+c+tile->rotate[c])&3;
@ -2235,7 +2235,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
else else
{ {
// No, not yet visited // No, not yet visited
// Choose transition by random // Choose transition by random
bool bComputed=false; bool bComputed=false;
if ((bVisited[c]||!recurseNoDiff)&&bSameEdge[c]) if ((bVisited[c]||!recurseNoDiff)&&bSameEdge[c])
@ -2246,7 +2246,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
CTileSet::TFlagBorder pBorder[4][3]; CTileSet::TFlagBorder pBorder[4][3];
tileDesc pVoisinIndex; tileDesc pVoisinIndex;
bool bOk=GetBorderDesc (tile->voisins[c], pVoisinCorner, pBorder, &pVoisinIndex, bank, vectMesh, nelPatchChg, land); bool bOk=GetBorderDesc (tile->voisins[c], pVoisinCorner, pBorder, &pVoisinIndex, bank, vectMesh, nelPatchChg, land);
// ok voisin is here ? // ok voisin is here ?
if (bOk) if (bOk)
{ {
@ -2293,7 +2293,7 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
} }
ite++; ite++;
} }
// Set the border desc // Set the border desc
tileDesc desc; tileDesc desc;
GetTile (tile->Mesh, tile->tile, desc, vectMesh, land); GetTile (tile->Mesh, tile->tile, desc, vectMesh, land);
@ -2341,22 +2341,22 @@ bool EPM_PaintMouseProc::PropagateBorder (EPM_PaintTile* tile, int curRotation,
{ {
// Voisin not already visited and not frozen ? // Voisin not already visited and not frozen ?
if ((tile->voisins[v]) && (visited.find (tile->voisins[v])==visited.end()) /* && (vectMesh[tile->voisins[v]->Mesh].Node->IsFrozen()==0)*/) if ((tile->voisins[v]) && (visited.find (tile->voisins[v])==visited.end()) /* && (vectMesh[tile->voisins[v]->Mesh].Node->IsFrozen()==0)*/)
{ {
// ok.. not visited, border with modified corner ? // ok.. not visited, border with modified corner ?
if (bModified[v]||bModified[(v+1)&3]||(!bSameEdge[v])) if (bModified[v]||bModified[(v+1)&3]||(!bSameEdge[v]))
if (!PropagateBorder (tile->voisins[v], (tile->rotate[v]+curRotation)&3, curTileSet, visited, bank, vectMesh, land, nelPatchChg, if (!PropagateBorder (tile->voisins[v], (tile->rotate[v]+curRotation)&3, curTileSet, visited, bank, vectMesh, land, nelPatchChg,
backupStack, false)) backupStack, false))
{ {
bContinue=false; bContinue=false;
break; break;
} }
} }
} }
if (!bContinue) if (!bContinue)
{ {
return false; return false;
} }
return true; return true;
} }
@ -2413,8 +2413,8 @@ uint8 EPM_PaintMouseProc::CalcRotPath (EPM_PaintTile* from, EPM_PaintTile* to, i
static TModePaint nModeTexture=ModeTile; static TModePaint nModeTexture=ModeTile;
static TModeMouse modeSelect=ModePaint; static TModeMouse modeSelect=ModePaint;
void EPM_PaintMouseProc::RecursTile (EPM_PaintTile* pTile, const CTileBank& bank, int tileSet, std::vector<EPM_Mesh>& vectMesh, CLandscape* land, void EPM_PaintMouseProc::RecursTile (EPM_PaintTile* pTile, const CTileBank& bank, int tileSet, std::vector<EPM_Mesh>& vectMesh, CLandscape* land,
int recurs, std::set<EPM_PaintTile*>& alreadyRecursed, bool first, int rotation, int recurs, std::set<EPM_PaintTile*>& alreadyRecursed, bool first, int rotation,
CNelPatchChanger& nelPatchChg, bool _256) CNelPatchChanger& nelPatchChg, bool _256)
{ {
if (alreadyRecursed.find (pTile)==alreadyRecursed.end()) if (alreadyRecursed.find (pTile)==alreadyRecursed.end())
@ -2437,20 +2437,20 @@ void EPM_PaintMouseProc::RecursTile (EPM_PaintTile* pTile, const CTileBank& bank
if (_256) if (_256)
{ {
if (pTile->get2Voisin(i)) if (pTile->get2Voisin(i))
RecursTile (pTile->get2Voisin(i), bank, tileSet, vectMesh, land, recurs-2, alreadyRecursed, false, RecursTile (pTile->get2Voisin(i), bank, tileSet, vectMesh, land, recurs-2, alreadyRecursed, false,
(rotation+pTile->get2VoisinRotate(i))&3, nelPatchChg, true); (rotation+pTile->get2VoisinRotate(i))&3, nelPatchChg, true);
} }
else else
{ {
if (pTile->voisins[i]) if (pTile->voisins[i])
RecursTile (pTile->voisins[i], bank, tileSet, vectMesh, land, recurs-1, alreadyRecursed, false, (rotation+pTile->rotate[i])&3, RecursTile (pTile->voisins[i], bank, tileSet, vectMesh, land, recurs-1, alreadyRecursed, false, (rotation+pTile->rotate[i])&3,
nelPatchChg, false); nelPatchChg, false);
} }
} }
} }
} }
BOOL EPM_PaintMouseProc::PutDisplace (int tile, int mesh, const CTileBank& bank, std::vector<EPM_Mesh>& vectMesh, CLandscape* land, BOOL EPM_PaintMouseProc::PutDisplace (int tile, int mesh, const CTileBank& bank, std::vector<EPM_Mesh>& vectMesh, CLandscape* land,
int recurs, std::set<EPM_PaintTile*>& alreadyRecursed, CNelPatchChanger& nelPatchChg) int recurs, std::set<EPM_PaintTile*>& alreadyRecursed, CNelPatchChanger& nelPatchChg)
{ {
static sint32 MeshOld=-1; static sint32 MeshOld=-1;
@ -2460,7 +2460,7 @@ BOOL EPM_PaintMouseProc::PutDisplace (int tile, int mesh, const CTileBank& bank,
EPM_PaintTile* pTile=&metaTile[mesh][tile]; EPM_PaintTile* pTile=&metaTile[mesh][tile];
// Ok recurse tiles // Ok recurse tiles
RecursTile (pTile, bank, 0, vectMesh, land, brushValue[PaintPatchMod::brushSize], alreadyRecursed, true, RecursTile (pTile, bank, 0, vectMesh, land, brushValue[PaintPatchMod::brushSize], alreadyRecursed, true,
EPM_PaintMouseProc::Rotation, nelPatchChg, false); EPM_PaintMouseProc::Rotation, nelPatchChg, false);
MeshOld=mesh; MeshOld=mesh;
@ -2469,7 +2469,7 @@ BOOL EPM_PaintMouseProc::PutDisplace (int tile, int mesh, const CTileBank& bank,
return TRUE; return TRUE;
} }
BOOL EPM_PaintMouseProc::PutTile (int tile, int mesh, bool first, const CTileBank& bank, int tileSet, std::vector<EPM_Mesh>& vectMesh, CLandscape* land, BOOL EPM_PaintMouseProc::PutTile (int tile, int mesh, bool first, const CTileBank& bank, int tileSet, std::vector<EPM_Mesh>& vectMesh, CLandscape* land,
int recurs, std::set<EPM_PaintTile*>& alreadyRecursed, CNelPatchChanger& nelPatchChg, bool _256) int recurs, std::set<EPM_PaintTile*>& alreadyRecursed, CNelPatchChanger& nelPatchChg, bool _256)
{ {
static sint32 MeshOld=-1; static sint32 MeshOld=-1;
@ -2523,7 +2523,7 @@ BOOL EPM_PaintMouseProc::PutTile (int tile, int mesh, bool first, const CTileBan
std::set<EPM_PaintTile*> alreadyRecursed; std::set<EPM_PaintTile*> alreadyRecursed;
// Ok recurse tiles // Ok recurse tiles
RecursTile (pTile, bank, tileSet, vectMesh, land, brushValue[PaintPatchMod::brushSize], alreadyRecursed, first, RecursTile (pTile, bank, tileSet, vectMesh, land, brushValue[PaintPatchMod::brushSize], alreadyRecursed, first,
EPM_PaintMouseProc::Rotation, nelPatchChg, _256); EPM_PaintMouseProc::Rotation, nelPatchChg, _256);
} }
MeshOld=mesh; MeshOld=mesh;
@ -2815,7 +2815,7 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
if (AsyncListener.isKeyPushed ((TKey)PainterKeys[SelectColorBrush])) if (AsyncListener.isKeyPushed ((TKey)PainterKeys[SelectColorBrush]))
{ {
// Create a dialog filter // Create a dialog filter
static TCHAR szFilter[] = static TCHAR szFilter[] =
_T("Targa Files (*.tga)\0*.tga\0") _T("Targa Files (*.tga)\0*.tga\0")
_T("All Files (*.*)\0*.*\0\0"); _T("All Files (*.*)\0*.*\0\0");
@ -2837,7 +2837,7 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
// Open the dialog // Open the dialog
if (GetOpenFileName(&openFile)) if (GetOpenFileName(&openFile))
{ {
// Load the file // Load the file
paintColor.loadBrush (tStrToUtf8(buffer)); paintColor.loadBrush (tStrToUtf8(buffer));
paintColor.setBrushMode (true); paintColor.setBrushMode (true);
@ -2991,7 +2991,7 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
t0= t1; t0= t1;
} }
// Draw interface // Draw interface
drawInterface (modeSelect, nModeTexture, pData->pobj, driver, landscape, paintColor); drawInterface (modeSelect, nModeTexture, pData->pobj, driver, landscape, paintColor);
@ -3016,7 +3016,7 @@ public:
bool WindowActive; bool WindowActive;
CPaintColor PaintColor; CPaintColor PaintColor;
public: public:
MouseListener (IObjParam *ip, CCamera *camera, CViewport *viewport, PaintPatchMod *pobj, EPM_PaintMouseProc *eproc, CLandscape* land, MouseListener (IObjParam *ip, CCamera *camera, CViewport *viewport, PaintPatchMod *pobj, EPM_PaintMouseProc *eproc, CLandscape* land,
CEventListenerAsync* async, CEvent3dMouseListener* mouseList, std::vector<EPM_Mesh>& vectMesh, TimeValue t) CEventListenerAsync* async, CEvent3dMouseListener* mouseList, std::vector<EPM_Mesh>& vectMesh, TimeValue t)
: PaintColor (pobj, land, &bankCont->Undo, eproc), _FillTile (pobj, land, &bankCont->Undo, eproc), _VectMesh(vectMesh) : PaintColor (pobj, land, &bankCont->Undo, eproc), _FillTile (pobj, land, &bankCont->Undo, eproc), _VectMesh(vectMesh)
{ {
@ -3063,7 +3063,7 @@ private:
if (pressed&&((mouse->Button&rightButton)&&((mouse->Button&(ctrlButton|shiftButton|altButton))==0))) if (pressed&&((mouse->Button&rightButton)&&((mouse->Button&(ctrlButton|shiftButton|altButton))==0)))
{ {
pressed=false; pressed=false;
// Undo step // Undo step
bankCont->Undo.pushUndo (); bankCont->Undo.pushUndo ();
@ -3099,13 +3099,13 @@ private:
if (nModeTexture==ModeTile) if (nModeTexture==ModeTile)
{ {
// Put the tile // Put the tile
_Eproc->PutTile (tile1, mesh1, true, bank, _Pobj->CurrentTileSet, _VectMesh, _Land, brushValue[PaintPatchMod::brushSize], _Eproc->PutTile (tile1, mesh1, true, bank, _Pobj->CurrentTileSet, _VectMesh, _Land, brushValue[PaintPatchMod::brushSize],
alreadyRecursed, nelPatchChg, _Pobj->tileSize!=0); alreadyRecursed, nelPatchChg, _Pobj->tileSize!=0);
} }
else // (nModeTexture==ModeDisplace) else // (nModeTexture==ModeDisplace)
{ {
// Put the tile // Put the tile
_Eproc->PutDisplace (tile1, mesh1, bank, _VectMesh, _Land, brushValue[PaintPatchMod::brushSize], _Eproc->PutDisplace (tile1, mesh1, bank, _VectMesh, _Land, brushValue[PaintPatchMod::brushSize],
alreadyRecursed, nelPatchChg); alreadyRecursed, nelPatchChg);
} }
@ -3141,7 +3141,7 @@ private:
// Paint mode // Paint mode
if (nModeTexture==ModeTile) if (nModeTexture==ModeTile)
// Fill this patch with the current tile // Fill this patch with the current tile
_FillTile.fillTile (mesh1, patch, _VectMesh, _Pobj->CurrentTileSet, _Pobj->TileFillRotation, _Pobj->TileGroup, _Pobj->tileSize!=0, _FillTile.fillTile (mesh1, patch, _VectMesh, _Pobj->CurrentTileSet, _Pobj->TileFillRotation, _Pobj->TileGroup, _Pobj->tileSize!=0,
bank); bank);
else if (nModeTexture==ModeColor) else if (nModeTexture==ModeColor)
// Fill this patch with the current color // Fill this patch with the current color
@ -3188,7 +3188,7 @@ private:
{ {
pressed = false; pressed = false;
_Pobj->ShowCurrentState = false; _Pobj->ShowCurrentState = false;
// Undo step // Undo step
bankCont->Undo.pushUndo (); bankCont->Undo.pushUndo ();
} }
@ -3222,13 +3222,13 @@ private:
if (nModeTexture==ModeTile) if (nModeTexture==ModeTile)
{ {
// Put the tile // Put the tile
_Eproc->PutTile (tile2, mesh2, false, bank, _Pobj->CurrentTileSet, _VectMesh, _Land, _Eproc->PutTile (tile2, mesh2, false, bank, _Pobj->CurrentTileSet, _VectMesh, _Land,
brushValue[PaintPatchMod::brushSize], alreadyRecursed, nelPatchChg, _Pobj->tileSize!=0); brushValue[PaintPatchMod::brushSize], alreadyRecursed, nelPatchChg, _Pobj->tileSize!=0);
} }
else // (nModeTexture==ModeDisplace) else // (nModeTexture==ModeDisplace)
{ {
// Put the tile // Put the tile
_Eproc->PutDisplace (tile2, mesh2, bank, _VectMesh, _Land, brushValue[PaintPatchMod::brushSize], _Eproc->PutDisplace (tile2, mesh2, bank, _VectMesh, _Land, brushValue[PaintPatchMod::brushSize],
alreadyRecursed, nelPatchChg); alreadyRecursed, nelPatchChg);
} }
@ -3299,7 +3299,7 @@ private:
_Pobj->CurrentTileSet=tileSetSelector.getTileSet (tile-1); _Pobj->CurrentTileSet=tileSetSelector.getTileSet (tile-1);
_Pobj->DisplaceTileSet=_Pobj->CurrentTileSet; _Pobj->DisplaceTileSet=_Pobj->CurrentTileSet;
} }
} }
} }
// Mode displace ? // Mode displace ?
@ -3308,7 +3308,7 @@ private:
if ((tile>=0)&&(tile<CTileSet::CountDisplace)) if ((tile>=0)&&(tile<CTileSet::CountDisplace))
{ {
_Pobj->DisplaceTile=tile; _Pobj->DisplaceTile=tile;
} }
} }
} }
} }
@ -3345,7 +3345,7 @@ void MouseListener::pick (int mesh, int tile, const CVector& hit, TModePaint mod
// Pickup a displace ? // Pickup a displace ?
else else
{ {
// Get the displace tile index // Get the displace tile index
_Pobj->DisplaceTile=desc.getDisplace (); _Pobj->DisplaceTile=desc.getDisplace ();
_Pobj->DisplaceTileSet=tileSet; _Pobj->DisplaceTileSet=tileSet;
} }
@ -3577,7 +3577,7 @@ void EPM_PaintCMode::DoPaint ()
int nV=1<<rpatch->getUIPatch (p).NbTilesV; int nV=1<<rpatch->getUIPatch (p).NbTilesV;
for (int u=0; u<=nU; u++) for (int u=0; u<=nU; u++)
for (int v=0; v<=nV; v++) for (int v=0; v<=nV; v++)
{ {
Point3 pos=patch->patches[p].interp (patch, (float)u/(float)(nU), (float)v/(float)(nV)); Point3 pos=patch->patches[p].interp (patch, (float)u/(float)(nU), (float)v/(float)(nV));
pos=pos*(vectMesh[i].Node->GetObjectTM (t)); pos=pos*(vectMesh[i].Node->GetObjectTM (t));
if (fMaxX<pos.x) if (fMaxX<pos.x)
@ -3643,7 +3643,7 @@ void EPM_PaintCMode::DoPaint ()
pTile->rotate[2]=0; pTile->rotate[2]=0;
pTile->u=u; pTile->u=u;
pTile->v=v; pTile->v=v;
// Compute bouding box of the tile // Compute bouding box of the tile
fMinX=FLT_MAX; fMinX=FLT_MAX;
fMinY=FLT_MAX; fMinY=FLT_MAX;
@ -3665,7 +3665,7 @@ void EPM_PaintCMode::DoPaint ()
pTile->Center=(maxToNel (pos[0])+maxToNel (pos[1])+maxToNel (pos[2])+maxToNel (pos[3]))/4.f; pTile->Center=(maxToNel (pos[0])+maxToNel (pos[1])+maxToNel (pos[2])+maxToNel (pos[3]))/4.f;
// Store its radius // Store its radius
pTile->Radius=std::max pTile->Radius=std::max
( (
std::max ( (maxToNel (pos[0])-pTile->Center).norm(), (maxToNel (pos[1])-pTile->Center).norm() ), std::max ( (maxToNel (pos[0])-pTile->Center).norm(), (maxToNel (pos[1])-pTile->Center).norm() ),
std::max ( (maxToNel (pos[2])-pTile->Center).norm(), (maxToNel (pos[3])-pTile->Center).norm() ) std::max ( (maxToNel (pos[2])-pTile->Center).norm(), (maxToNel (pos[3])-pTile->Center).norm() )
@ -3958,7 +3958,7 @@ void EPM_PaintCMode::DoPaint ()
pTile->locked = 0; pTile->locked = 0;
// Check that neighbor tiles are not frozen // Check that neighbor tiles are not frozen
uint neighbor; uint neighbor;
for (neighbor=0; neighbor<4; neighbor++) for (neighbor=0; neighbor<4; neighbor++)
{ {
// Neighbor exist ? // Neighbor exist ?
@ -4009,7 +4009,7 @@ void EPM_PaintCMode::DoPaint ()
pData->pobj=pobj; pData->pobj=pobj;
pData->center=center; pData->center=center;
pData->T=t; pData->T=t;
myThread (pData); // Do it without thread myThread (pData); // Do it without thread
// Invalidate all objects // Invalidate all objects
@ -4082,9 +4082,9 @@ bool loadLigoConfigFile (CLigoConfig& config, Interface& it)
// Can't found the module // Can't found the module
return false; return false;
} }
DWORD WINAPI myThread (LPVOID vData) DWORD WINAPI myThread (LPVOID vData)
{ {
// Mega try // Mega try
try try
{ {
@ -4109,7 +4109,7 @@ DWORD WINAPI myThread (LPVOID vData)
} }
// The scene // The scene
// Loaf cfg files // Loaf cfg files
LoadKeyCfg (); LoadKeyCfg ();
LoadVarCfg (); LoadVarCfg ();
@ -4155,7 +4155,7 @@ DWORD WINAPI myThread (LPVOID vData)
{ {
// Build skined ? // Build skined ?
bool skined=false; bool skined=false;
// Export the shape // Export the shape
IShape *pShape; IShape *pShape;
pShape=export_.buildShape (*pNode, pData->T, NULL, true); pShape=export_.buildShape (*pNode, pData->T, NULL, true);
@ -4193,7 +4193,7 @@ DWORD WINAPI myThread (LPVOID vData)
CMatrix mat; CMatrix mat;
mat.identity(); mat.identity();
CVector I,J,K,P; CVector I,J,K,P;
Matrix3 matInvert; Matrix3 matInvert;
matInvert.SetRow (0, Point3(1.f, 0.f, 0.f)); matInvert.SetRow (0, Point3(1.f, 0.f, 0.f));
matInvert.SetRow (1, Point3(0.f, 0.f, 1.f)); matInvert.SetRow (1, Point3(0.f, 0.f, 1.f));
@ -4275,7 +4275,7 @@ DWORD WINAPI myThread (LPVOID vData)
// Go. // Go.
//======== //========
CEvent3dMouseListener mouseListener; CEvent3dMouseListener mouseListener;
MouseListener listener (pData->eproc->ip, CNELU::Camera, &viewport, pData->pobj, pData->eproc, &TheLand->Landscape, MouseListener listener (pData->eproc->ip, CNELU::Camera, &viewport, pData->pobj, pData->eproc, &TheLand->Landscape,
&CNELU::AsyncListener, &mouseListener, pData->VectMesh, pData->T); &CNELU::AsyncListener, &mouseListener, pData->VectMesh, pData->T);
// Mouse listener // Mouse listener
@ -4303,7 +4303,7 @@ DWORD WINAPI myThread (LPVOID vData)
{ {
// For all the tileset selected // For all the tileset selected
for (sint tss=0; tss<(sint)tileSetSelector.getTileCount (); tss++) for (sint tss=0; tss<(sint)tileSetSelector.getTileCount (); tss++)
{ {
// Get the tileset index // Get the tileset index
sint ts=tileSetSelector.getTileSet (tss); sint ts=tileSetSelector.getTileSet (tss);
@ -4434,7 +4434,7 @@ BOOL EPM_PaintMouseProc::HitATile(ViewExp *vpt, IPoint2 *p, int *tile, int *mesh
return FALSE; return FALSE;
} }
BOOL EPM_PaintMouseProc::HitATile(const CViewport& viewport, const CCamera& camera, float x, float y, int *tile, int *mesh, TimeValue t, BOOL EPM_PaintMouseProc::HitATile(const CViewport& viewport, const CCamera& camera, float x, float y, int *tile, int *mesh, TimeValue t,
std::vector<EPM_Mesh>& vectMesh, NLMISC::CVector& hit, NLMISC::CVector &topVector) std::vector<EPM_Mesh>& vectMesh, NLMISC::CVector& hit, NLMISC::CVector &topVector)
{ {
// Get a world ray with the mouse 2d point // Get a world ray with the mouse 2d point
@ -4581,10 +4581,10 @@ bool EPM_PaintTile::intersect (const Ray& ray, std::vector<EPM_Mesh>& vectMesh,
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
int EPM_PaintMouseProc::proc( int EPM_PaintMouseProc::proc(
HWND hwnd, HWND hwnd,
int msg, int msg,
int point, int point,
int flags, int flags,
IPoint2 m) IPoint2 m)
{ {
#if MAX_VERSION_MAJOR >= 19 #if MAX_VERSION_MAJOR >= 19
@ -4611,10 +4611,10 @@ int EPM_PaintMouseProc::proc(
case MOUSE_MOVE: case MOUSE_MOVE:
break; break;
case MOUSE_FREEMOVE: case MOUSE_FREEMOVE:
break; break;
case MOUSE_ABORT: case MOUSE_ABORT:
ip->SetStdCommandMode(CID_OBJMOVE); ip->SetStdCommandMode(CID_OBJMOVE);
break; break;