Terrain Processor SDK Manual: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "Category:Arma 3 Official Tools Manual" to "{{GameCategory|arma3|Official Tools Manual}}")
m (Text replacement - "[[Image:" to "[[File:")
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== 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 {{Link|link= http://store.steampowered.com/app/390500|text= Arma 3 Samples}}.
[[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 [http://store.steampowered.com/app/390500 Arma 3 Samples].


==Create New Project in Visual Studio==
== Create New Project in Visual Studio ==
Start Microsoft Visual Studio and create a new Project.
Start Microsoft Visual Studio and create a new Project.


[[Image:TerrainProcessor_SDK_newProject.png|400px]]
[[File:TerrainProcessor_SDK_newProject.png|400px]]


Configure it to be an empty DLL.
Configure it to be an empty DLL.


[[Image:TerrainProcessor_SDK_projectType.png|400px]]
[[File:TerrainProcessor_SDK_projectType.png|400px]]


==Add include and library directories==
== 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).
Then, go to the configuration of the project and edit the debug configuration to include the library directory (VC++ Directories option group).


[[Image:TerrainProcessor_SDK_configLibs.png|400px]]
[[File:TerrainProcessor_SDK_configLibs.png|400px]]


==Add lib to dependencies==
== Add lib to dependencies ==
From the project configuration, go to ''Linker'', ''Input'' and define the additional dependencies.
From the project configuration, go to ''Linker'', ''Input'' and define the additional dependencies.


[[Image:TerrainProcessor_SDK_configInput.png|400px]]
[[File:TerrainProcessor_SDK_configInput.png|400px]]


==Create plugin source files==
== Create plugin source files ==
Create a new header called '''pluginTest.h''' with the following content:
Create a new header called '''pluginTest.h''' with the following content:


Line 41: Line 40:
// Process shape.
// Process shape.
virtual void ProcessShape(IRunContext& context, ShapeFiles::SHPShape* shape, const ShapeParameters& shapeParameters);
virtual void ProcessShape(IRunContext& context, ShapeFiles::SHPShape* shape, const ShapeParameters& shapeParameters);
};</syntaxhighlight>
};
</syntaxhighlight>


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




==Create Plugin.cpp and DllExport.def==
== Create Plugin.cpp and DllExport.def ==
New code file named '''Plugin.cpp''':
New code file named '''Plugin.cpp''':



Latest revision as of 23:10, 20 November 2023

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.

TerrainProcessor SDK newProject.png

Configure it to be an empty DLL.

TerrainProcessor SDK projectType.png

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).

TerrainProcessor SDK configLibs.png

Add lib to dependencies

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

TerrainProcessor SDK configInput.png

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