Fandom

武装突袭 Wiki

Terrain Processor SDK Manual

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 Share

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

Introduction 编辑

Terrain Processor has its own SDK which allows the creation of new tasks. Hereafter, you will find a quick introduction of the setup of the new project. All you need is the Visual Studio (an Express version is enough) and the SDK which is available in Arma 3 Samples.

Create New Project in Visual Studio编辑

Start Microsoft Visual Studio and create a new Project.

400px

Configure it to be an empty DLL.

400px

Add include and library directories编辑

Then, go to the configuration of the project and edit the debug configuration to include the library directory (VC++ Directories option group).

400px

Add lib to dependencies编辑

From the project configuration, go to Linker, Input and define the additional dependencies.

400px

Create plugin source files编辑

Create a new header called pluginTest.h with the following content:

#pragma once 
 
#include "TerrainProcessorPlugin.h"
 
using namespace TerrainProcessorSDK;
 
// Test plugin.
class PluginTest : public TerrainProcessorPlugin
{
public:
	// Sample parameter
	TerrainProcessorParameterDefinition _sampleParameter;
 
	// Constructor.
	PluginTest();
	// Process shape.
	virtual void ProcessShape(IRunContext& context, ShapeFiles::SHPShape* shape, const ShapeParameters& shapeParameters);
};

Then a code file called pluginTest.cpp with this content:

#include "PluginTest.h"
#include <algorithm>
#include <cmath>
 
// Constructor.
PluginTest::PluginTest()
	: TerrainProcessorPlugin(	
	"Test",
	"Test plugin.",
	GTPolyline,
	TPPFlagsShapeFile | TPPFlagsDEM)
{
	_sampleParameter = TerrainProcessorParameterDefinition(
	"Sample parameter",
	"Sample parameter. \r\n"
	"Default value is : 10",
	"10",
	TPPT_DOUBLE);
	_parameters.push_back(_sampleParameter);
}
 
// Process shape.
void PluginTest::ProcessShape(IRunContext& context, ShapeFiles::SHPShape* shape, const ShapeParameters& shapeParameters)
{
	_sampleParameter = _parameters[0];
}


Create Plugin.cpp and DllExport.def编辑

New code file named Plugin.cpp:

#include <vector>
#include <memory>
#include "TerrainProcessorPlugin.h"
#include "PluginTest.h"
 
using namespace TerrainProcessorSDK;
 
// Get plugins function.
__declspec(dllexport) bool __stdcall GetPlugins(std::reference_wrapper<std::vector<std::shared_ptr<TerrainProcessorPlugin>>> plugins)
{
	plugins.get().push_back(std::make_shared<PluginTest>());
 
	return true;
}

And finally a new module-definitions file:

LIBRARY PLUGIN_TEST
EXPORTS
	GetPlugins		@1

更多维基

随机维基