igame_test

changeset 0:01278d9b2d5e tip

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 18 Aug 2013 06:10:03 +0300
parents
children
files igame_test.sln igame_test.vcxproj igame_test.vcxproj.filters src/test.cc
diffstat 4 files changed, 456 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/igame_test.sln	Sun Aug 18 06:10:03 2013 +0300
     1.3 @@ -0,0 +1,26 @@
     1.4 +
     1.5 +Microsoft Visual Studio Solution File, Format Version 12.00
     1.6 +# Visual Studio 2012
     1.7 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "igame_test", "igame_test.vcxproj", "{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}"
     1.8 +EndProject
     1.9 +Global
    1.10 +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
    1.11 +		Debug|Win32 = Debug|Win32
    1.12 +		Debug|x64 = Debug|x64
    1.13 +		Release|Win32 = Release|Win32
    1.14 +		Release|x64 = Release|x64
    1.15 +	EndGlobalSection
    1.16 +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
    1.17 +		{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}.Debug|Win32.ActiveCfg = Debug|Win32
    1.18 +		{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}.Debug|Win32.Build.0 = Debug|Win32
    1.19 +		{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}.Debug|x64.ActiveCfg = Debug|x64
    1.20 +		{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}.Debug|x64.Build.0 = Debug|x64
    1.21 +		{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}.Release|Win32.ActiveCfg = Release|Win32
    1.22 +		{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}.Release|Win32.Build.0 = Release|Win32
    1.23 +		{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}.Release|x64.ActiveCfg = Release|x64
    1.24 +		{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}.Release|x64.Build.0 = Release|x64
    1.25 +	EndGlobalSection
    1.26 +	GlobalSection(SolutionProperties) = preSolution
    1.27 +		HideSolutionNode = FALSE
    1.28 +	EndGlobalSection
    1.29 +EndGlobal
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/igame_test.vcxproj	Sun Aug 18 06:10:03 2013 +0300
     2.3 @@ -0,0 +1,155 @@
     2.4 +<?xml version="1.0" encoding="utf-8"?>
     2.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     2.6 +  <ItemGroup Label="ProjectConfigurations">
     2.7 +    <ProjectConfiguration Include="Debug|Win32">
     2.8 +      <Configuration>Debug</Configuration>
     2.9 +      <Platform>Win32</Platform>
    2.10 +    </ProjectConfiguration>
    2.11 +    <ProjectConfiguration Include="Debug|x64">
    2.12 +      <Configuration>Debug</Configuration>
    2.13 +      <Platform>x64</Platform>
    2.14 +    </ProjectConfiguration>
    2.15 +    <ProjectConfiguration Include="Release|Win32">
    2.16 +      <Configuration>Release</Configuration>
    2.17 +      <Platform>Win32</Platform>
    2.18 +    </ProjectConfiguration>
    2.19 +    <ProjectConfiguration Include="Release|x64">
    2.20 +      <Configuration>Release</Configuration>
    2.21 +      <Platform>x64</Platform>
    2.22 +    </ProjectConfiguration>
    2.23 +  </ItemGroup>
    2.24 +  <PropertyGroup Label="Globals">
    2.25 +    <ProjectGuid>{D5C9D05D-65D0-4BBD-ABAB-BF2134DC3947}</ProjectGuid>
    2.26 +    <Keyword>Win32Proj</Keyword>
    2.27 +    <RootNamespace>igame_test</RootNamespace>
    2.28 +  </PropertyGroup>
    2.29 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
    2.30 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    2.31 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    2.32 +    <UseDebugLibraries>true</UseDebugLibraries>
    2.33 +    <CharacterSet>Unicode</CharacterSet>
    2.34 +    <PlatformToolset>v110</PlatformToolset>
    2.35 +  </PropertyGroup>
    2.36 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    2.37 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    2.38 +    <UseDebugLibraries>true</UseDebugLibraries>
    2.39 +    <CharacterSet>Unicode</CharacterSet>
    2.40 +    <PlatformToolset>v110</PlatformToolset>
    2.41 +  </PropertyGroup>
    2.42 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    2.43 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    2.44 +    <UseDebugLibraries>false</UseDebugLibraries>
    2.45 +    <WholeProgramOptimization>true</WholeProgramOptimization>
    2.46 +    <CharacterSet>Unicode</CharacterSet>
    2.47 +    <PlatformToolset>v110</PlatformToolset>
    2.48 +  </PropertyGroup>
    2.49 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    2.50 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    2.51 +    <UseDebugLibraries>false</UseDebugLibraries>
    2.52 +    <WholeProgramOptimization>true</WholeProgramOptimization>
    2.53 +    <CharacterSet>Unicode</CharacterSet>
    2.54 +    <PlatformToolset>v110</PlatformToolset>
    2.55 +  </PropertyGroup>
    2.56 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
    2.57 +  <ImportGroup Label="ExtensionSettings">
    2.58 +  </ImportGroup>
    2.59 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    2.60 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    2.61 +  </ImportGroup>
    2.62 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
    2.63 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    2.64 +  </ImportGroup>
    2.65 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    2.66 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    2.67 +  </ImportGroup>
    2.68 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
    2.69 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    2.70 +  </ImportGroup>
    2.71 +  <PropertyGroup Label="UserMacros" />
    2.72 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    2.73 +    <LinkIncremental>true</LinkIncremental>
    2.74 +  </PropertyGroup>
    2.75 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    2.76 +    <LinkIncremental>true</LinkIncremental>
    2.77 +  </PropertyGroup>
    2.78 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    2.79 +    <LinkIncremental>false</LinkIncremental>
    2.80 +  </PropertyGroup>
    2.81 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    2.82 +    <LinkIncremental>false</LinkIncremental>
    2.83 +  </PropertyGroup>
    2.84 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    2.85 +    <ClCompile>
    2.86 +      <PrecompiledHeader>
    2.87 +      </PrecompiledHeader>
    2.88 +      <WarningLevel>Level3</WarningLevel>
    2.89 +      <Optimization>Disabled</Optimization>
    2.90 +      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IGAME_TEST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    2.91 +    </ClCompile>
    2.92 +    <Link>
    2.93 +      <SubSystem>Windows</SubSystem>
    2.94 +      <GenerateDebugInformation>true</GenerateDebugInformation>
    2.95 +    </Link>
    2.96 +  </ItemDefinitionGroup>
    2.97 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    2.98 +    <ClCompile>
    2.99 +      <PrecompiledHeader>
   2.100 +      </PrecompiledHeader>
   2.101 +      <WarningLevel>Level3</WarningLevel>
   2.102 +      <Optimization>Disabled</Optimization>
   2.103 +      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IGAME_TEST_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   2.104 +    </ClCompile>
   2.105 +    <Link>
   2.106 +      <SubSystem>Windows</SubSystem>
   2.107 +      <GenerateDebugInformation>true</GenerateDebugInformation>
   2.108 +      <AdditionalDependencies>core.lib;maxutil.lib;IGame.lib;%(AdditionalDependencies)</AdditionalDependencies>
   2.109 +    </Link>
   2.110 +    <PostBuildEvent>
   2.111 +      <Command>copy /Y "$(TargetPath)" "$(ADSK_3DSMAX_x64_2014)\plugins\igame_test.dle"</Command>
   2.112 +    </PostBuildEvent>
   2.113 +  </ItemDefinitionGroup>
   2.114 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   2.115 +    <ClCompile>
   2.116 +      <WarningLevel>Level3</WarningLevel>
   2.117 +      <PrecompiledHeader>
   2.118 +      </PrecompiledHeader>
   2.119 +      <Optimization>MaxSpeed</Optimization>
   2.120 +      <FunctionLevelLinking>true</FunctionLevelLinking>
   2.121 +      <IntrinsicFunctions>true</IntrinsicFunctions>
   2.122 +      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;IGAME_TEST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   2.123 +    </ClCompile>
   2.124 +    <Link>
   2.125 +      <SubSystem>Windows</SubSystem>
   2.126 +      <GenerateDebugInformation>true</GenerateDebugInformation>
   2.127 +      <EnableCOMDATFolding>true</EnableCOMDATFolding>
   2.128 +      <OptimizeReferences>true</OptimizeReferences>
   2.129 +    </Link>
   2.130 +  </ItemDefinitionGroup>
   2.131 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   2.132 +    <ClCompile>
   2.133 +      <WarningLevel>Level3</WarningLevel>
   2.134 +      <PrecompiledHeader>
   2.135 +      </PrecompiledHeader>
   2.136 +      <Optimization>MaxSpeed</Optimization>
   2.137 +      <FunctionLevelLinking>true</FunctionLevelLinking>
   2.138 +      <IntrinsicFunctions>true</IntrinsicFunctions>
   2.139 +      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;IGAME_TEST_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   2.140 +    </ClCompile>
   2.141 +    <Link>
   2.142 +      <SubSystem>Windows</SubSystem>
   2.143 +      <GenerateDebugInformation>true</GenerateDebugInformation>
   2.144 +      <EnableCOMDATFolding>true</EnableCOMDATFolding>
   2.145 +      <OptimizeReferences>true</OptimizeReferences>
   2.146 +      <AdditionalDependencies>core.lib;maxutil.lib;IGame.lib;%(AdditionalDependencies)</AdditionalDependencies>
   2.147 +    </Link>
   2.148 +    <PostBuildEvent>
   2.149 +      <Command>copy /Y "$(TargetPath)" "$(ADSK_3DSMAX_x64_2014)\plugins\igame_test.dle"</Command>
   2.150 +    </PostBuildEvent>
   2.151 +  </ItemDefinitionGroup>
   2.152 +  <ItemGroup>
   2.153 +    <ClCompile Include="src\test.cc" />
   2.154 +  </ItemGroup>
   2.155 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   2.156 +  <ImportGroup Label="ExtensionTargets">
   2.157 +  </ImportGroup>
   2.158 +</Project>
   2.159 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/igame_test.vcxproj.filters	Sun Aug 18 06:10:03 2013 +0300
     3.3 @@ -0,0 +1,22 @@
     3.4 +<?xml version="1.0" encoding="utf-8"?>
     3.5 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     3.6 +  <ItemGroup>
     3.7 +    <Filter Include="Source Files">
     3.8 +      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
     3.9 +      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    3.10 +    </Filter>
    3.11 +    <Filter Include="Header Files">
    3.12 +      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
    3.13 +      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    3.14 +    </Filter>
    3.15 +    <Filter Include="Resource Files">
    3.16 +      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
    3.17 +      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
    3.18 +    </Filter>
    3.19 +  </ItemGroup>
    3.20 +  <ItemGroup>
    3.21 +    <ClCompile Include="src\test.cc">
    3.22 +      <Filter>Source Files</Filter>
    3.23 +    </ClCompile>
    3.24 +  </ItemGroup>
    3.25 +</Project>
    3.26 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/test.cc	Sun Aug 18 06:10:03 2013 +0300
     4.3 @@ -0,0 +1,253 @@
     4.4 +#include <stdio.h>
     4.5 +#include <string.h>
     4.6 +#include <errno.h>
     4.7 +#include <windows.h>
     4.8 +#include <shlobj.h>
     4.9 +#include "max.h"
    4.10 +#include "impexp.h"		// SceneExport
    4.11 +#include "iparamb2.h"	// ClassDesc2
    4.12 +#include "plugapi.h"
    4.13 +#include "IGame.h"
    4.14 +#include "IGameExport.h"
    4.15 +#include "IConversionmanager.h"
    4.16 +
    4.17 +
    4.18 +#pragma comment (lib, "core.lib")
    4.19 +#pragma comment (lib, "geom.lib")
    4.20 +#pragma comment (lib, "gfx.lib")
    4.21 +#pragma comment (lib, "mesh.lib")
    4.22 +#pragma comment (lib, "maxutil.lib")
    4.23 +#pragma comment (lib, "maxscrpt.lib")
    4.24 +#pragma comment (lib, "paramblk2.lib")
    4.25 +#pragma comment (lib, "msxml2.lib")
    4.26 +#pragma comment (lib, "igame.lib")
    4.27 +#pragma comment (lib, "comctl32.lib")
    4.28 +
    4.29 +
    4.30 +static FILE *logfile;
    4.31 +static HINSTANCE hinst;
    4.32 +
    4.33 +class TestExporter : public SceneExport {
    4.34 +public:
    4.35 +	IGameScene *igame;
    4.36 +
    4.37 +	int ExtCount();
    4.38 +	const TCHAR *Ext(int n);
    4.39 +	const TCHAR *LongDesc();
    4.40 +	const TCHAR *ShortDesc();
    4.41 +	const TCHAR *AuthorName();
    4.42 +	const TCHAR *CopyrightMessage();
    4.43 +	const TCHAR *OtherMessage1();
    4.44 +	const TCHAR *OtherMessage2();
    4.45 +	unsigned int Version();
    4.46 +	void ShowAbout(HWND win);
    4.47 +
    4.48 +	int DoExport(const MCHAR *name, ExpInterface *eiface, Interface *iface, BOOL silent = FALSE, DWORD opt = 0);
    4.49 +
    4.50 +	bool export_materials(FILE *fp);
    4.51 +};
    4.52 +
    4.53 +
    4.54 +int TestExporter::ExtCount()
    4.55 +{
    4.56 +	return 1;
    4.57 +}
    4.58 +
    4.59 +const TCHAR *TestExporter::Ext(int n)
    4.60 +{
    4.61 +	return L"txt";
    4.62 +}
    4.63 +
    4.64 +const TCHAR *TestExporter::LongDesc()
    4.65 +{
    4.66 +	return L"Test exporter file";
    4.67 +}
    4.68 +
    4.69 +const TCHAR *TestExporter::ShortDesc()
    4.70 +{
    4.71 +	return L"Test exporter";
    4.72 +}
    4.73 +
    4.74 +const TCHAR *TestExporter::AuthorName()
    4.75 +{
    4.76 +	return L"John Tsiombikas";
    4.77 +}
    4.78 +
    4.79 +const TCHAR *TestExporter::CopyrightMessage()
    4.80 +{
    4.81 +	return L"Public domain";
    4.82 +}
    4.83 +
    4.84 +const TCHAR *TestExporter::OtherMessage1()
    4.85 +{
    4.86 +	return L"other1";
    4.87 +}
    4.88 +
    4.89 +const TCHAR *TestExporter::OtherMessage2()
    4.90 +{
    4.91 +	return L"other2";
    4.92 +}
    4.93 +
    4.94 +unsigned int TestExporter::Version()
    4.95 +{
    4.96 +	return 10;
    4.97 +}
    4.98 +
    4.99 +void TestExporter::ShowAbout(HWND win)
   4.100 +{
   4.101 +	MessageBoxA(win, "TestExporter plugin", "About this plugin", 0);
   4.102 +}
   4.103 +
   4.104 +int TestExporter::DoExport(const MCHAR *name, ExpInterface *eiface, Interface *iface,
   4.105 +		BOOL non_interactive, DWORD opt)
   4.106 +{
   4.107 +	char fname[512];
   4.108 +	wcstombs(fname, name, sizeof fname - 1);
   4.109 +
   4.110 +	FILE *fp = fopen(fname, "wb");
   4.111 +	if(!fp) {
   4.112 +		fprintf(logfile, "failed to open %s for writting: %s", fname, strerror(errno));
   4.113 +		return IMPEXP_FAIL;
   4.114 +	}
   4.115 +
   4.116 +	if(!(igame = GetIGameInterface())) {
   4.117 +		fprintf(logfile, "failed to get the igame interface\n");
   4.118 +		fclose(fp);
   4.119 +		return IMPEXP_FAIL;
   4.120 +	}
   4.121 +	IGameConversionManager *cm = GetConversionManager();
   4.122 +	cm->SetCoordSystem(IGameConversionManager::IGAME_OGL);
   4.123 +	igame->InitialiseIGame();
   4.124 +	igame->SetStaticFrame(0);
   4.125 +
   4.126 +	export_materials(fp);
   4.127 +
   4.128 +	fclose(fp);
   4.129 +
   4.130 +	return IMPEXP_SUCCESS;
   4.131 +}
   4.132 +
   4.133 +bool TestExporter::export_materials(FILE *fp)
   4.134 +{
   4.135 +	IGameProperty *prop;
   4.136 +
   4.137 +	int num_mtl = igame->GetRootMaterialCount();
   4.138 +	fprintf(fp, "number of materials: %d\n", num_mtl);
   4.139 +
   4.140 +	for(int i=0; i<num_mtl; i++) {
   4.141 +		IGameMaterial *mtl = igame->GetRootMaterial(i);
   4.142 +		if(mtl) {
   4.143 +			Point3 diffuse(1, 1, 1);
   4.144 +			Point3 specular(0, 0, 0);
   4.145 +			float shin = 1.0, sstr = 1.0;
   4.146 +			char name[512] = "unnamed";
   4.147 +
   4.148 +			const MCHAR *wname = mtl->GetMaterialName();
   4.149 +			if(wname) {
   4.150 +				wcstombs(name, wname, sizeof name - 1);
   4.151 +			}
   4.152 +
   4.153 +			if((prop = mtl->GetDiffuseData())) {
   4.154 +				prop->GetPropertyValue(diffuse);
   4.155 +			}
   4.156 +			if((prop = mtl->GetSpecularData())) {
   4.157 +				prop->GetPropertyValue(specular);
   4.158 +			}
   4.159 +			if((prop = mtl->GetSpecularLevelData())) {
   4.160 +				prop->GetPropertyValue(sstr);
   4.161 +			}
   4.162 +			if((prop = mtl->GetGlossinessData())) {
   4.163 +				prop->GetPropertyValue(shin);
   4.164 +			}
   4.165 +
   4.166 +			fprintf(fp, "Material %d (%s):\n", i, name);
   4.167 +			fprintf(fp, "  diffuse: %f %f %f\n", diffuse[0], diffuse[1], diffuse[2]);
   4.168 +			fprintf(fp, "  specular: %f %f %f\n", specular[0] * sstr, specular[1] * sstr, specular[2] * sstr);
   4.169 +			fprintf(fp, "  shininess: %f\n", shin * 100.0);
   4.170 +
   4.171 +			for(int j=0; j<mtl->GetNumberOfTextureMaps(); j++) {
   4.172 +				IGameTextureMap *tex = mtl->GetIGameTextureMap(j);
   4.173 +				const MCHAR *wfname = tex->GetBitmapFileName();
   4.174 +				if(wfname) {
   4.175 +					char fname[512];
   4.176 +					wcstombs(fname, wfname, sizeof fname - 1);
   4.177 +					fprintf(fp, "  texture%d: %s\n", j, fname);
   4.178 +				}
   4.179 +			}
   4.180 +		}
   4.181 +	}
   4.182 +
   4.183 +	return true;
   4.184 +}
   4.185 +
   4.186 +// ------------------------------------------
   4.187 +
   4.188 +class TestClassDesc : public ClassDesc2 {
   4.189 +public:
   4.190 +	int IsPublic() { return TRUE; }
   4.191 +	void *Create(BOOL loading = FALSE) { return new TestExporter; }
   4.192 +	const TCHAR *ClassName() { return L"TestExporter"; }
   4.193 +	SClass_ID SuperClassID() { return SCENE_EXPORT_CLASS_ID; }
   4.194 +	Class_ID ClassID() { return Class_ID(0x77050f0d, 0x7d4c5ab5); }
   4.195 +	const TCHAR *Category() { return L"Mutant Stargoat"; }
   4.196 +
   4.197 +	const TCHAR *InternalName() { return L"TestExporter"; }
   4.198 +	HINSTANCE HInstance() { return hinst; }
   4.199 +};
   4.200 +
   4.201 +static TestClassDesc class_desc;
   4.202 +
   4.203 +BOOL WINAPI DllMain(HINSTANCE inst_handle, ULONG reason, void *reserved)
   4.204 +{
   4.205 +	if(reason == DLL_PROCESS_ATTACH) {
   4.206 +		hinst = inst_handle;
   4.207 +		DisableThreadLibraryCalls(hinst);
   4.208 +	}
   4.209 +	return TRUE;
   4.210 +}
   4.211 +
   4.212 +extern "C" {
   4.213 +
   4.214 +__declspec(dllexport) const TCHAR *LibDescription()
   4.215 +{
   4.216 +	return L"test exporter";
   4.217 +}
   4.218 +
   4.219 +__declspec(dllexport) int LibNumberClasses()
   4.220 +{
   4.221 +	return 1;
   4.222 +}
   4.223 +
   4.224 +__declspec(dllexport) ClassDesc *LibClassDesc(int i)
   4.225 +{
   4.226 +	return i == 0 ? &class_desc : 0;
   4.227 +}
   4.228 +
   4.229 +__declspec(dllexport) ULONG LibVersion()
   4.230 +{
   4.231 +	return Get3DSMAXVersion();
   4.232 +}
   4.233 +
   4.234 +__declspec(dllexport) int LibInitialize()
   4.235 +{
   4.236 +	static char path[1024];
   4.237 +
   4.238 +	SHGetFolderPathA(0, CSIDL_PERSONAL, 0, 0, path);
   4.239 +	strcat(path, "/testexp.log");
   4.240 +
   4.241 +	if((logfile = fopen(path, "w"))) {
   4.242 +		setvbuf(logfile, 0, _IONBF, 0);
   4.243 +	}
   4.244 +	return TRUE;
   4.245 +}
   4.246 +
   4.247 +__declspec(dllexport) int LibShutdown()
   4.248 +{
   4.249 +	if(logfile) {
   4.250 +		fclose(logfile);
   4.251 +		logfile = 0;
   4.252 +	}
   4.253 +	return TRUE;
   4.254 +}
   4.255 +
   4.256 +}	// extern "C"
   4.257 \ No newline at end of file