1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-12-22 07:17:22 +01:00

Add GBS import/export plugins. Fix VC redist installation error in patcher.

This commit is contained in:
Nick Blakely 2020-10-17 23:40:57 -07:00
parent eb4f555606
commit eb04aed5ca
14 changed files with 998 additions and 4 deletions

View File

@ -42,7 +42,7 @@ SetCompressor /SOLID lzma
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Output\GPatch1_498_222_0.exe"
OutFile "Output\GPatch1_498_224_0.exe"
InstallDir "$PROGRAMFILES\Giants\"
InstallDirRegKey HKCU "SOFTWARE\PlanetMoon\Giants" "DestDir"
ShowInstDetails hide
@ -69,7 +69,8 @@ Section
ExecWait "$INSTDIR\Redist\VC_redist.x86.exe /install /passive /norestart" $0
${If} $0 != 0
MessageBox MB_OK "Setup failed to install the Visual C++ Runtime. Please visit www.microsoft.com and download the latest version of the Visual C++ redistributable."
${AndIf} $0 != 1638 ;0x666 - Newer version installed
MessageBox MB_OK "Setup failed to install the Visual C++ Runtime. Please visit www.microsoft.com and download the latest version of the Visual C++ 2019 redistributable."
${EndIf}
RMDir /r "$INSTDIR\Redist" ; Delete temporary files
@ -96,8 +97,6 @@ Section
Delete $INSTDIR\bin\worldlist5.bin
Delete $INSTDIR\bin\mappack1.gzp
Delete $INSTDIR\bin\A-GRM1.gzp
Delete $INSTDIR\bin\GData.gbt
Delete $INSTDIR\bin\GData.h
SectionEnd

BIN
Plugins/exp_gts/exp_gts.dle Normal file

Binary file not shown.

BIN
Plugins/gts2gbs/gts2gbs.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,43 @@
#include "Importer.h"
HINSTANCE hInstance;
int controlsInit = FALSE;
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
{
hInstance = hinstDLL; // Hang on to this DLL's instance handle.
if (!controlsInit) {
controlsInit = TRUE;
//InitCustomControls(hInstance); // Initialize MAX's custom controls
InitCommonControls(); // Initialize Win95 controls
}
return (TRUE);
}
__declspec( dllexport ) const TCHAR* LibDescription()
{
return _T("LibDescription");
}
//TODO: Must change this number when adding a new class
__declspec( dllexport ) int LibNumberClasses()
{
return 1;
}
ClassDesc *GetSceneImportDesc();
__declspec( dllexport ) ClassDesc* LibClassDesc(int i)
{
switch(i) {
case 0: return GetSceneImportDesc();
default: return 0;
}
}
__declspec( dllexport ) ULONG LibVersion()
{
return VERSION_3DSMAX;
}

143
Plugins/imp_gbs/GbsData.cpp Normal file
View File

@ -0,0 +1,143 @@
#include "Importer.h"
void GbsData::Read(FILE* file)
{
DWORD versionHeader;
fread(&versionHeader, 4, 1, file);
if (versionHeader != GBS_VERSION)
{
throw std::exception("File does not appear to be a GBS file.");
}
fread(&optionsflags, 4, 1, file);
fread(&naverts, 4, 1, file);
averts.resize(naverts);
for (int i = 0; i < naverts; i++)
{
fread(&averts.at(i).x, 4, 1, file);
fread(&averts.at(i).y, 4, 1, file);
fread(&averts.at(i).z, 4, 1, file);
}
if (FlagIsSet(optionsflags, GBSFlagNormals))
{
fread(&nndefs, 4, 1, file);
fread(&sizendefs, 4, 1, file);
ndefs.resize(sizendefs);
for (uint i = 0; i < sizendefs; i++)
fread(&ndefs.at(i), 2, 1, file);
}
fread(&nverts, 4, 1, file);
iverts.resize(nverts);
for (int i = 0; i < nverts; i++)
fread(&iverts.at(i), 2, 1, file);
if (FlagIsSet(optionsflags, GBSFlagNormals))
{
inorms.resize(nverts);
for (int i = 0; i < nverts; i++)
fread(&inorms.at(i), 2, 1, file);
}
if (FlagIsSet(optionsflags, GBSFlagUVs))
{
vertuv.resize(nverts);
for (int i = 0; i < nverts; i++)
{
fread(&vertuv.at(i).u, 4, 1, file);
fread(&vertuv.at(i).v, 4, 1, file);
vertuv.at(i).v = vertuv.at(i).v + 1.0f;
}
}
if (FlagIsSet(optionsflags, GBSFlagRGBs))
{
vertrgb.resize(nverts);
for (int i = 0; i < nverts; i++)
{
fread(&vertrgb.at(i).r, 1, 1, file);
fread(&vertrgb.at(i).g, 1, 1, file);
fread(&vertrgb.at(i).b, 1, 1, file);
}
}
// Get number of max objects
fread(&nmobjs, 4, 1, file);
MaxObjs.resize(nmobjs);
for (auto& maxObj : MaxObjs)
{
FileMaxObj fileMaxObj;
fread(&fileMaxObj, sizeof(FileMaxObj), 1, file);
maxObj.vstart = fileMaxObj.vstart;
maxObj.vcount = fileMaxObj.vcount;
maxObj.nstart = fileMaxObj.nstart;
maxObj.ncount = fileMaxObj.ncount;
maxObj.noffset = fileMaxObj.noffset;
maxObj.fstart = 0;
maxObj.fcount = 0;
maxObj.sostart = 0;
maxObj.socount = 0;
}
VerifyMaxObjs();
// Get number of subobjects
fread(&nsobjs, 4, 1, file);
SubObjs.resize(nsobjs);
for (int ns = 0; ns < nsobjs; ns++)
{
SubObject& object = SubObjs.at(ns);
fread(&object.objname, sizeof(object.objname), 1, file);
fread(&object.maxobjindex, 4, 1, file);
fread(&object.totaltris, 4, 1, file);
fread(&object.ntris, 4, 1, file);
assert((object.ntris - 1) / 3 == object.totaltris);
object.tridata.resize(object.ntris + 1);
fread(object.tridata.data(), sizeof(unsigned short) * object.ntris, 1, file);
fread(&object.vstart, 4, 1, file);
fread(&object.vcount, 4, 1, file);
if (FlagIsSet(optionsflags, GBSFlagUVs))
{
fread(&object.texname, 1, 32, file);
fread(&object.texname2, 1, 32, file);
}
fread(&object.falloff, 4, 1, file);
if (FlagIsSet(optionsflags, GBSFlagRGBs))
fread(&object.blend, 4, 1, file);
fread(&object.flags, 4, 1, file);
fread(&object.emissive, 1, 4, file);
fread(&object.ambient, 1, 4, file);
fread(&object.diffuse, 1, 4, file);
fread(&object.specular, 1, 4, file);
fread(&object.power, 4, 1, file);
MaxObj& maxobj = MaxObjs.at(object.maxobjindex);
maxobj.fcount += object.totaltris;
if (!maxobj.socount)
{
maxobj.sostart = ns;
}
maxobj.socount++;
}
}
bool GbsData::VerifyMaxObjs()
{
int nmcount = 0;
for (const auto& maxObj : MaxObjs)
{
nmcount += maxObj.vcount;
}
assert(nmcount == naverts);
return nmcount == naverts;
}

77
Plugins/imp_gbs/GbsData.h Normal file
View File

@ -0,0 +1,77 @@
#pragma once
#define GBS_VERSION 0xaa0100be
#define GBSFlagNormals 0x0001
#define GBSFlagUVs 0x0002
#define GBSFlagRGBs 0x0004
#define GBSFlagMaxLit (1 << 31)
struct FileMaxObj
{
int vstart;
int vcount;
int nstart;
int ncount;
int noffset;
};
struct MaxObj : FileMaxObj
{
int fstart;
int fcount;
int sostart;
int socount;
};
struct SubObject
{
char objname[32];
DWORD maxobjindex;
int ntris; // count of tridata (including preceding 'count' short)
int totaltris;
std::vector<unsigned short> tridata; // indexed tridata, value is pointer to iverts
int vstart;
int vcount;
char texname[32];
char texname2[32];
float falloff;
float blend;
DWORD flags;
DWORD emissive;
DWORD ambient;
DWORD diffuse;
DWORD specular;
float power;
};
enum TransType
{
TransNone,
TransAdd,
TransSub,
TransBlend
};
struct GbsData
{
public:
void Read(FILE* file);
DWORD optionsflags{};
DWORD nndefs{};
DWORD sizendefs{};
std::vector<WORD> ndefs;
std::vector<USHORT> inorms;
int naverts{};
std::vector<Point3> averts;
int nsobjs{};
int nmobjs{};
std::vector<USHORT> iverts;
std::vector<VertRGB> vertrgb;
int nverts{};
std::vector<UV> vertuv;
std::vector<MaxObj> MaxObjs;
std::vector<SubObject> SubObjs;
private:
bool VerifyMaxObjs();
};

View File

@ -0,0 +1,409 @@
// Importer.cpp : Defines the entry point for the DLL application.
//
#include "Importer.h"
#include "StdUtil.h"
class ImpGbsClassDesc :
public ClassDesc2
{
public:
int IsPublic() { return TRUE; }
VOID* Create(BOOL Loading) { return new GbsImporter; }
const MCHAR* ClassName() { return _M("ClassName"); }
SClass_ID SuperClassID() { return SCENE_IMPORT_CLASS_ID; }
Class_ID ClassID() { return GIANTSIMP_CLASSID; }
const MCHAR* Category() { return _M(""); }
const MCHAR* InternalName() { return _M("GiantsImp"); }
HINSTANCE HInstance() { return hInstance; }
};
static ImpGbsClassDesc g_ImportCD;
ClassDesc* GetSceneImportDesc()
{
return &g_ImportCD;
}
void DisplayMessage(const char* msg)
{
MessageBoxA(GetActiveWindow(), msg, "GBS Import Error", MB_OK);
}
int GbsImporter::ExtCount()
{
return 1;
}
const MCHAR* GbsImporter::Ext(int n)
{
switch (n)
{
case 0:
return _M("gbs");
default:
return (_M(""));
}
}
const MCHAR* GbsImporter::LongDesc()
{
return _M("Long Description");
}
const MCHAR* GbsImporter::ShortDesc()
{
return _M("Giants Model");
}
const MCHAR* GbsImporter::AuthorName()
{
return _M("Author");
}
const MCHAR* GbsImporter::CopyrightMessage()
{
return _M("Copyright");
}
const MCHAR* GbsImporter::OtherMessage1()
{
return _M("OtherMessage1");
}
const MCHAR* GbsImporter::OtherMessage2()
{
return _M("OtherMessage2");
}
UINT GbsImporter::Version()
{
return 100;
}
static BOOL CALLBACK AboutDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
return FALSE;
}
VOID GbsImporter::ShowAbout(HWND hWnd)
{
}
bool GbsImporter::EvaluateTriData(unsigned short** pTriData, unsigned short* pTriIdx, unsigned short* acount, int* pV1, int* pV2, int* pV3)
{
unsigned short* triData = *pTriData;
unsigned short triIdx = *pTriIdx;
unsigned short count = *acount;
if (!count)
{
if (!(count = *triData))
{
return false;
}
triIdx = 0;
}
*pV1 = triData[triIdx + 1];
*pV2 = triData[triIdx + 2];
*pV3 = triData[triIdx + 3];
triIdx += 3;
if (!--count)
{
triData += *triData * 3 + 1;
}
*pTriData = triData;
*pTriIdx = triIdx;
*acount = count;
return true;
}
int GbsImporter::DoImport(const MCHAR* Name, ImpInterface* EI, Interface* I, BOOL SupressPrompts)
{
try
{
m_gbsData = ReadGbsFile(Name);
}
catch (const std::exception& e)
{
DisplayMessage(e.what());
}
BuildMeshes(EI);
EI->RedrawViews();
return TRUE;
}
GbsData GbsImporter::ReadGbsFile(const MCHAR* Name)
{
FILE* file = nullptr;
try
{
errno_t err = _tfopen_s(&file, Name, (_T("rb")));
if (err != 0)
{
throw std::exception("Could not open input file.");
}
// Read object into memory
GbsData gbsFile;
gbsFile.Read(file);
fclose(file);
return gbsFile;
}
catch (const std::exception& e)
{
if (file)
fclose(file);
throw e;
}
}
int GbsImporter::GetLocalVertex(Point3* avert, const Mesh& mesh)
{
for (int i = 0; i < mesh.getNumVerts(); i++)
{
auto& vert = mesh.verts[i];
if (vert.x == avert->x && vert.y == avert->y && vert.z == avert->z)
{
return i;
}
}
assert(false && "Invalid vertex for object");
return -1;
}
void GbsImporter::BuildMeshes(ImpInterface* EI)
{
for (const auto& mobj : m_gbsData.MaxObjs)
{
assert(mobj.fcount > 0);
assert(mobj.vcount > 0);
Mesh mesh;
mesh.setNumVerts(mobj.vcount);
mesh.setNumTVerts(mobj.vcount);
mesh.setNumVertCol(mobj.vcount);
mesh.setNumFaces(mobj.fcount);
mesh.setNumTVFaces(mobj.fcount);
mesh.setNumVCFaces(mobj.fcount);
for (int i = 0; i < mobj.vcount; i++)
{
int vstart = mobj.vstart;
int index = i + vstart;
assert(index < m_gbsData.naverts);
UV* uvptr = (UV*)(m_gbsData.vertuv.data() + (mobj.vstart + i));
Point3 point(m_gbsData.averts[index].x, m_gbsData.averts[index].y, m_gbsData.averts[index].z);
mesh.setVert(i, point);
mesh.setTVert(i, UVVert(uvptr->u, uvptr->v, 0.0f));
//mesh.setTVert(i, UVVert(uvptr->u, -uvptr->v, 0.0f));
}
Mtl* topLevelMaterial = nullptr;
const char* objName = nullptr;
int materialLevel = 0;
int faceIndex = 0;
for (int subObjIndex = mobj.sostart; subObjIndex < mobj.sostart + mobj.socount; subObjIndex++)
{
SubObject& obj = m_gbsData.SubObjs.at(subObjIndex);
if (mobj.socount > 1)
{
// Max object consists of multiple sub objects
if (materialLevel == 0)
{
// Build parent material (either MixMat or multi-mtl):
topLevelMaterial = BuildParentMaterial(obj, mobj.socount);
objName = obj.objname;
}
// Add sub-material:
Mtl* subMtl = BuildMaterial(obj, topLevelMaterial);
topLevelMaterial->SetSubMtl(materialLevel, subMtl);
}
else
{
// Just one subobj, build the single material and be done with it:
topLevelMaterial = BuildMaterial(obj, nullptr);
objName = obj.objname;
}
int v1, v2, v3;
unsigned short tidx = -1;
unsigned short* tptr = obj.tridata.data();
unsigned short count = 0;
while (EvaluateTriData(&tptr, &tidx, &count, &v1, &v2, &v3))
{
assert(faceIndex < mesh.getNumFaces());
int vstart = mobj.vstart;
Face& face = mesh.faces[faceIndex];
// Map from display to animation vertices, then to a "local" index for this sub object, starting from zero:
int remappedV0 = GetLocalVertex(&m_gbsData.averts[m_gbsData.iverts.at(v1)], mesh);
int remappedV1 = GetLocalVertex(&m_gbsData.averts[m_gbsData.iverts.at(v2)], mesh);
int remappedV2 = GetLocalVertex(&m_gbsData.averts[m_gbsData.iverts.at(v3)], mesh);
VertColor v0Col = VertColor(m_gbsData.vertrgb.at(v1).r / 255.0f, m_gbsData.vertrgb.at(v1).g / 255.0f, m_gbsData.vertrgb.at(v1).b / 255.0f);
VertColor v1Col = VertColor(m_gbsData.vertrgb.at(v2).r / 255.0f, m_gbsData.vertrgb.at(v2).g / 255.0f, m_gbsData.vertrgb.at(v2).b / 255.0f);
VertColor v2Col = VertColor(m_gbsData.vertrgb.at(v3).r / 255.0f, m_gbsData.vertrgb.at(v3).g / 255.0f, m_gbsData.vertrgb.at(v3).b / 255.0f);
mesh.vertCol[remappedV0] = v0Col;
mesh.vertCol[remappedV1] = v1Col;
mesh.vertCol[remappedV2] = v2Col;
assert(remappedV0 >= 0 && remappedV1 >= 0 && remappedV2 >= 0);
assert(remappedV0 < mobj.vcount && remappedV1 < mobj.vcount && remappedV2 < mobj.vcount);
assert(remappedV0 < m_gbsData.naverts && remappedV1 < m_gbsData.naverts && remappedV2 < m_gbsData.naverts);
face.setVerts(remappedV0, remappedV1, remappedV2);
face.setEdgeVisFlags(EDGE_VIS, EDGE_VIS, EDGE_VIS);
face.setMatID(materialLevel);
TVFace& tvFace = mesh.tvFace[faceIndex];
tvFace.setTVerts(remappedV0, remappedV1, remappedV2);
TVFace& vcFace = mesh.vcFace[faceIndex];
vcFace.setTVerts(remappedV0, remappedV1, remappedV2);
faceIndex++;
}
materialLevel++;
}
mesh.buildNormals();
mesh.buildBoundingBox();
mesh.InvalidateEdgeList();
TriObject* tri = CreateNewTriObject();
tri->mesh = mesh;
Matrix3 tm;
tm.IdentityMatrix();
ImpNode* Node = EI->CreateNode();
if (!Node)
{
throw std::exception("Could not create Node");
}
Node->Reference(tri);
Node->SetTransform(0, tm);
EI->AddNodeToScene(Node);
INode* iNode = Node->GetINode();
iNode->SetMtl(topLevelMaterial);
Node->SetName(util::to_wstring(objName).c_str());
}
}
Mtl* GbsImporter::BuildParentMaterial(SubObject& obj, int numSubMaterials)
{
// Check if we need to create a MixMat blend material
// (this check is iffy, not fully certain how to identify MixMat exports but this seems close enough)
if (obj.blend > 0.50 && (obj.flags & 0x10 || obj.flags & 0x20))
{
//if (bitmapTex)
//{
// //bitmapTex->GetUVGen()->SetUVWSource(2);
//}
// Create custom MixMat material (from official 3dsmax plugin)
Mtl* mixMatMaterial = (Mtl*)CreateInstance(SClass_ID(MATERIAL_CLASS_ID), Class_ID(MIXMAT_CLASS_ID, 0));
mixMatMaterial->SetName(util::to_wstring(obj.objname).c_str());
int ns = mixMatMaterial->NumSubMtls();
// Set the blend value
IParamBlock2* parameterBlock = mixMatMaterial->GetParamBlock(0);
parameterBlock->SetValue(0, 0, obj.blend);
return mixMatMaterial;
}
else
{
// Standard multi-material
MultiMtl* multiMtl = NewDefaultMultiMtl();
multiMtl->SetName(util::to_wstring(obj.objname).c_str());
multiMtl->SetNumSubMtls(numSubMaterials);
return multiMtl;
}
}
Mtl* GbsImporter::BuildMaterial(SubObject& obj, Mtl* parentMaterial)
{
BitmapTex* bitmapTex = nullptr;
if (obj.texname && obj.texname[0])
{
std::wstring mapName = util::to_wstring(obj.texname).c_str();
mapName += L".tga"; // DDS partially supported but not in use, okay to hardcode for now
bitmapTex = NewDefaultBitmapTex();
bitmapTex->SetName(util::to_wstring(obj.texname).c_str());
bitmapTex->SetMapName(mapName.c_str());
}
StdMat2* stdMat = NewDefaultStdMat();
if (FlagIsSet(obj.flags, GBSFlagMaxLit) || parentMaterial)
{
// This isn't quite right, not all models with blend materials have this flag set. See ripper.gbs.
// Behavior is correct enough for now though.
stdMat->SetWireUnits(TRUE);
}
stdMat->EnableMap(ID_DI, true);
if (obj.flags & 0x10)
{
stdMat->SetTransparencyType(TRANSP_ADDITIVE);
}
else if (obj.flags & 0x20)
{
stdMat->SetTransparencyType(TRANSP_SUBTRACTIVE);
}
stdMat->SetShinStr(1.0f, 0);
stdMat->SetOpacFalloff(obj.falloff, 0);
if (obj.emissive != 0)
{
Color emissive(GetRValue(obj.emissive), GetGValue(obj.emissive), GetBValue(obj.emissive));
stdMat->SetSelfIllumColor(emissive, 0);
}
if (bitmapTex)
{
stdMat->SetSubTexmap(ID_DI, bitmapTex);
}
Color diffuse(GetRValue(obj.diffuse), GetGValue(obj.diffuse), GetBValue(obj.diffuse));
stdMat->SetDiffuse(diffuse, 0);
Color ambient(GetRValue(obj.ambient), GetGValue(obj.ambient), GetBValue(obj.ambient));
stdMat->SetAmbient(ambient, 0);
Color specular(GetRValue(obj.specular), GetGValue(obj.specular), GetBValue(obj.specular));
stdMat->SetSpecular(specular, 0);
stdMat->SetShininess(obj.power / 100.0f, 0);
stdMat->SetName(util::to_wstring(obj.objname).c_str());
return stdMat;
}
BOOL GbsImporter::SupportsOptions(int Ext, DWORD Options)
{
return FALSE;
}

View File

@ -0,0 +1,39 @@
#pragma once
#include "GbsData.h"
#define GIANTSIMP_CLASSID Class_ID(0x552cac79, 0x46f2d727)
class GbsImporter : public SceneImport
{
public:
static HWND hParams;
int ExtCount(); // Number of extensions supported
const MCHAR* Ext(int n); // Extension #n (i.e. "3DS")
const MCHAR* LongDesc(); // Long ASCII description (i.e. "Autodesk 3D Studio File")
const MCHAR* ShortDesc(); // Short ASCII description (i.e. "3D Studio")
const MCHAR* AuthorName(); // ASCII Author name
const MCHAR* CopyrightMessage(); // ASCII Copyright message
const MCHAR* OtherMessage1(); // Other message #1
const MCHAR* OtherMessage2(); // Other message #2
unsigned int Version(); // Version number * 100 (i.e. v3.01 = 301)
void ShowAbout(HWND hWnd); // Show DLL's "About..." box
int DoImport(const MCHAR *name,ImpInterface *i,Interface *gi, BOOL suppressPrompts=FALSE); // Import file
//Constructor/Destructor
BOOL SupportsOptions(int Ext,DWORD Options);
private:
GbsData ReadGbsFile(const MCHAR* Name);
Mtl* BuildParentMaterial(SubObject& obj, int numSubMaterials);
Mtl* BuildMaterial(SubObject& obj, Mtl* parentMaterial);
int GetLocalVertex(Point3* avert, const Mesh& mesh);
void BuildMeshes(ImpInterface* EI);
bool EvaluateTriData(unsigned short** pTriData, unsigned short* pTriIdx, unsigned short* acount, int* pV1, int* pV2, int* pV3);
FILE* m_OpenFile{};
GbsData m_gbsData;
};
extern HINSTANCE hInstance;

22
Plugins/imp_gbs/StdUtil.h Normal file
View File

@ -0,0 +1,22 @@
#pragma once
#include <codecvt>
namespace util
{
inline std::wstring to_wstring(const std::string_view& sourceString)
{
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.from_bytes(sourceString.data());
}
inline std::string to_string(const std::wstring_view& sourceString)
{
using convert_typeX = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_typeX, wchar_t> converterX;
return converterX.to_bytes(sourceString.data());
}
}

View File

@ -0,0 +1,8 @@
LIBRARY imp_gbs
EXPORTS
LibDescription @1
LibNumberClasses @2
LibClassDesc @3
LibVersion @4
SECTIONS
.data READ WRITE

View File

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Hybrid|x64">
<Configuration>Hybrid</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{448F061E-AE05-4E06-84A1-C95660FD048C}</ProjectGuid>
<RootNamespace>GiantsExp</RootNamespace>
<Keyword>Win32Proj</Keyword>
<ProjectName>imp_gbs</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>16.0.30427.251</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<AdditionalIncludeDirectories>$(ADSK_3DSMAX_SDK_2021)\include;$(GIANTS_SDK_PATH)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;GIANTSIMP_EXPORTS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<LanguageStandard>stdcpplatest</LanguageStandard>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
</ClCompile>
<ResourceCompile>
<Culture>0x0000</Culture>
<ResourceOutputFileName>
</ResourceOutputFileName>
</ResourceCompile>
<Link>
<AdditionalOptions>/def:imp_gbs.def %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;bmm.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;vfw32.lib;mnmath.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ADSK_3DSMAX_SDK_2021)\lib\x64\Release;\..\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>NotSet</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>$(OutDir)GiantsImp.lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>copy "$(TargetPath)" "$(ADSK_3DSMAX_x64_2021)\stdplugs\$(TargetName).dli</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<AdditionalIncludeDirectories>$(ADSK_3DSMAX_SDK_2021)\include;$(GIANTS_SDK_PATH)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;GIANTSIMP_EXPORTS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<LanguageStandard>stdcpplatest</LanguageStandard>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
</ClCompile>
<ResourceCompile>
<Culture>0x0000</Culture>
<ResourceOutputFileName>
</ResourceOutputFileName>
</ResourceCompile>
<Link>
<AdditionalOptions>/def:imp_gbs.def %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;bmm.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;vfw32.lib;mnmath.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ADSK_3DSMAX_SDK_2021)\lib\x64\Release;\..\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>NotSet</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
<PostBuildEvent>
<Command>copy "$(TargetPath)" "$(ADSK_3DSMAX_x64_2021)\stdplugs\$(TargetName).dli</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<AdditionalIncludeDirectories>$(ADSK_3DSMAX_SDK_2021)\include;$(GIANTS_SDK_PATH)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GIANTSIMP_EXPORTS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<LanguageStandard>stdcpplatest</LanguageStandard>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
</ClCompile>
<ResourceCompile>
<ResourceOutputFileName>
</ResourceOutputFileName>
</ResourceCompile>
<Link>
<AdditionalOptions>/def:imp_gbs.def %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;bmm.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;vfw32.lib;mnmath.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ADSK_3DSMAX_SDK_2021)\lib\x64\Release;\..\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>$(OutDir)GiantsImp.lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>copy "$(TargetPath)" "$(ADSK_3DSMAX_x64_2021)\stdplugs\$(TargetName).dli</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="DLLEntry.cpp" />
<ClCompile Include="GbsData.cpp" />
<ClCompile Include="Importer.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GbsData.h" />
<ClInclude Include="Importer.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="StdUtil.h" />
</ItemGroup>
<ItemGroup>
<None Include="imp_gbs.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="DLLEntry.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GbsData.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Importer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GbsData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Importer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="StdUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="imp_gbs.def">
<Filter>Source Files</Filter>
</None>
</ItemGroup>
</Project>

View File

17
Plugins/imp_gbs/stdafx.h Normal file
View File

@ -0,0 +1,17 @@
#pragma once
// Windows Header Files:
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
// 3dsmax headers
#include <max.h>
#include <iparamm2.h>
#include <stdmat.h>
// STL
#include <vector>
#include <string>
// Game SDK includes
#include <DataTypes.h>