Recast Navigation
Navigation-mesh Toolset for Games
Loading...
Searching...
No Matches
Tool_ConvexVolume.h
Go to the documentation of this file.
1//
2// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
3//
4// This software is provided 'as-is', without any express or implied
5// warranty. In no event will the authors be held liable for any damages
6// arising from the use of this software.
7// Permission is granted to anyone to use this software for any purpose,
8// including commercial applications, and to alter it and redistribute it
9// freely, subject to the following restrictions:
10// 1. The origin of this software must not be misrepresented; you must not
11// claim that you wrote the original software. If you use this software
12// in a product, an acknowledgment in the product documentation would be
13// appreciated but is not required.
14// 2. Altered source versions must be plainly marked as such, and must not be
15// misrepresented as being the original software.
16// 3. This notice may not be removed or altered from any source distribution.
17//
18
19#pragma once
20
21#include "Sample.h"
22
25{
26 Sample* sample = nullptr;
27
28 int areaType = SAMPLE_POLYAREA_GRASS;
29 float polyOffset = 0.0f;
30 float boxHeight = 6.0f;
31 float boxDescent = 1.0f;
32
33 static constexpr int MAX_PTS = 12;
34
35 int hull[MAX_PTS] {};
36 int numHull = 0;
37
38 std::vector<float> points;
39 [[nodiscard]] int numPoints() const { return static_cast<int>(points.size()) / 3; }
40
41public:
43 void init(Sample* sample) override { this->sample = sample; }
44 void reset() override
45 {
46 points.clear();
47 numHull = 0;
48 }
49
50 void singleStep() override {}
51 void update(const float) override {}
52 void render() override;
53
54 void onClick(const float* s, const float* p, bool shift) override;
55 void onToggle() override {}
56
57 void drawMenuUI() override;
58 void drawOverlayUI() override;
59};
@ SAMPLE_POLYAREA_GRASS
Definition Sample.h:58
SampleToolType
Tool types.
Definition Sample.h:33
Tool to create convex volumes for InputGeom.
Definition Tool_ConvexVolume.h:25
void onClick(const float *s, const float *p, bool shift) override
Definition Tool_ConvexVolume.cpp:152
void update(const float) override
Definition Tool_ConvexVolume.h:51
void init(Sample *sample) override
Definition Tool_ConvexVolume.h:43
void reset() override
Definition Tool_ConvexVolume.h:44
void drawMenuUI() override
Definition Tool_ConvexVolume.cpp:109
void onToggle() override
Definition Tool_ConvexVolume.h:55
void drawOverlayUI() override
Definition Tool_ConvexVolume.cpp:282
SampleToolType type() override
Definition Tool_ConvexVolume.h:42
void singleStep() override
Definition Tool_ConvexVolume.h:50
void render() override
Definition Tool_ConvexVolume.cpp:242
Definition Sample.h:116
Definition Sample.h:85