Skip to content

Commit 090db06

Browse files
committed
adjust to max 2027
1 parent d0fba82 commit 090db06

2 files changed

Lines changed: 61 additions & 90 deletions

File tree

src/tools/vrmlexp/vrml2.cpp

Lines changed: 59 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777

7878
#include "coreexp.h"
7979
#include "IDxMaterial.h"
80-
#include "RTMax.h"
8180

8281
#include <windows.h>
8382
#include <Winuser.h>
@@ -2947,93 +2946,65 @@ VRML2Export::OutputMaterial(INode *node, BOOL &isWire, BOOL &twoSided,
29472946
}
29482947
ShaderEffect se(fileName);
29492948

2950-
IParameterManager *pm = l_pIDxMaterial3->GetCurrentParameterManager();
2951-
if (pm)
2952-
{
2953-
2954-
TSTR paramValues;
2955-
for (int i = 0; i < pm->GetNumberOfParams(); i++)
2956-
{
2957-
int pt = pm->GetParamType(i);
2958-
const TCHAR *name = pm->GetParamName(i);
2959-
TCHAR buf[1000];
2960-
switch (pt)
2961-
{
2962-
case IParameterManager::kPType_Float:
2963-
{
2964-
float fval;
2965-
pm->GetParamData((void *)&fval, i);
2966-
_stprintf(buf, _T("%s=%s_"), name, floatVal(fval));
2967-
paramValues += buf;
2968-
//pEffect->SetFloat(pm->GetParamName(i), fval);
2969-
}
2970-
break;
2971-
case IParameterManager::kPType_Color:
2972-
case IParameterManager::kPType_Point4:
2973-
{
2974-
D3DCOLORVALUE cval;
2975-
pm->GetParamData((void *)&cval, i);
2976-
_stprintf(buf, _T("%s=%f_%f_%f_%f_"), name, cval.r, cval.g, cval.b, cval.a);
2977-
paramValues += buf;
2978-
//pEffect->SetVector(pm->GetParamName(i), (D3DXVECTOR4*)&cval);
2979-
}
2980-
break;
2981-
case IParameterManager::kPType_Bool:
2982-
{
2983-
BOOL bval;
2984-
pm->GetParamData((void *)&bval, i);
2985-
if (bval)
2986-
_stprintf(buf, _T("%s=true_"), name);
2987-
else
2988-
_stprintf(buf, _T("%s=false_"), name);
2989-
paramValues += buf;
2990-
//pEffect->SetBool(pm->GetParamName(i), bval);
2991-
}
2992-
break;
2993-
case IParameterManager::kPType_Int:
2994-
{
2995-
int ival;
2996-
pm->GetParamData((void *)&ival, i);
2997-
_stprintf(buf, _T("%s=%d_"), name, ival);
2998-
paramValues += buf;
2999-
//pEffect->SetInt(pm->GetParamName(i), ival);
3000-
}
3001-
break;
3002-
case IParameterManager::kPType_Matrix:
3003-
{
3004-
float mat[16];
3005-
pm->GetParamData((void *)&mat, i);
3006-
_stprintf(buf, _T("%s=%f_%f_%f_%f_%f_%f_%f_%f_%f_%f_%f_%f_%f_%f_%f_%f_"), name, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5], mat[6], mat[7], mat[8], mat[9], mat[10], mat[11], mat[12], mat[13], mat[14], mat[15]);
3007-
paramValues += buf;
3008-
//pEffect->SetInt(pm->GetParamName(i), ival);
3009-
}
3010-
break;
3011-
case IParameterManager::kPType_Struct:
3012-
{
3013-
char *buf;
3014-
int pSize = pm->GetParamSize(i);
3015-
buf = new char[pSize];
3016-
pm->GetParamData((void *)buf, i);
3017-
//pEffect->SetInt(pm->GetParamName(i), ival);
3018-
}
3019-
break;
3020-
case IParameterManager::kPType_Texture:
3021-
{
3022-
char *buf;
3023-
int pSize = pm->GetParamSize(i);
3024-
buf = new char[pSize];
3025-
pm->GetParamData((void *)buf, i);
3026-
//pEffect->SetInt(pm->GetParamName(i), ival);
3027-
}
3028-
3029-
break;
3030-
default:
3031-
{
3032-
_ftprintf(stderr, name);
3033-
}
3034-
break;
3035-
}
3036-
}
2949+
TSTR paramValues;
2950+
2951+
for (int pb = 0; pb < mtl->NumParamBlocks(); ++pb)
2952+
{
2953+
TCHAR buf[1000];
2954+
IParamBlock2 *pblock = mtl->GetParamBlock(pb);
2955+
if (!pblock)
2956+
continue;
2957+
2958+
for (int p = 0; p < pblock->NumParams(); ++p)
2959+
{
2960+
ParamID id = pblock->IndextoID(p);
2961+
ParamDef &def = pblock->GetParamDef(id);
2962+
2963+
TSTR name(def.int_name);
2964+
2965+
switch (def.type)
2966+
{
2967+
case TYPE_FLOAT:
2968+
{
2969+
float value;
2970+
pblock->GetValue(id, 0, value, FOREVER);
2971+
_stprintf(buf, _T("%s=%s_"), name, floatVal(value));
2972+
paramValues += buf;
2973+
break;
2974+
}
2975+
2976+
case TYPE_INT:
2977+
{
2978+
int value;
2979+
pblock->GetValue(id, 0, value, FOREVER);
2980+
_stprintf(buf, _T("%s=%d_"), name, value);
2981+
paramValues += buf;
2982+
break;
2983+
}
2984+
2985+
case TYPE_RGBA:
2986+
{
2987+
AColor value;
2988+
pblock->GetValue(id, 0, value, FOREVER);
2989+
_stprintf(buf, _T("%s=%f_%f_%f_%f_"), name, value.r, value.g, value.b, value.a);
2990+
paramValues += buf;
2991+
break;
2992+
}
2993+
2994+
case TYPE_BOOL:
2995+
{
2996+
BOOL value;
2997+
pblock->GetValue(id, 0, value, FOREVER);
2998+
if (value)
2999+
_stprintf(buf, _T("%s=true_"), name);
3000+
else
3001+
_stprintf(buf, _T("%s=false_"), name);
3002+
paramValues += buf;
3003+
break;
3004+
}
3005+
}
3006+
}
3007+
}
30373008

30383009
#if MAX_PRODUCT_VERSION_MAJOR > 14
30393010
paramValues.Replace(_T("="), _T("%"));
@@ -3056,7 +3027,6 @@ VRML2Export::OutputMaterial(INode *node, BOOL &isWire, BOOL &twoSided,
30563027
se.setParamValues(paramValues);
30573028
effect = (int)shaderEffects.size();
30583029
shaderEffects.push_back(se);
3059-
}
30603030
}
30613031

30623032
StdMat *sm = NULL;

src/tools/vrmlexp/vrmlexp.iss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ ShowLanguageDialog=yes
6666
[Files]
6767

6868
Source: {#COVISEDIR}\src\tools\vrmlexp\README.txt; DestDir: {app}; DestName: README.txt
69-
Source: {#COVISEDIR}\{#BUILDDIR}\{#ARCHSUFFIX}\src\tools\vrmlexp\{#BUILDTYPE}\vrmlexp.dle; DestDir: {app}; Flags: skipifsourcedoesntexist
69+
Source: {#COVISEDIR}\{#BUILDDIR}\{#ARCHSUFFIX}\src\tools\vrmlexp\{#BUILDTYPE}\vrmlexp.dle; DestDir: {app}; Flags: skipifsourcedoesntexist
70+
Source: {#COVISEDIR}\build\src\tools\vrmlexp\Release\vrmlexp.dle; DestDir: {app}; Flags: skipifsourcedoesntexist
7071
Source: {#MAXDIR}\stdplugs\vrmlexp.dle; DestDir: {app}; Flags: skipifsourcedoesntexist
7172
;C:\src\covise\src\tools\vrmlexp\build.2024\Release\Vrmlexp.dle
7273

0 commit comments

Comments
 (0)