Cogs.Core
Extensions
RationalReducer
Source
MeshReductionManager.h
1
#pragma once
2
3
#include "Resources/Mesh.h"
4
#include "Resources/Resources.h"
5
6
#include "Foundation/Reflection/Name.h"
7
8
using namespace
Cogs::Core
;
9
10
namespace
Cogs
11
{
12
namespace
RationalReducerExtension
13
{
14
struct
TriangleData
15
{
16
int
meshIndex;
17
MaterialInstance
* material;
18
};
19
20
struct
MeshInfo
21
{
22
std::vector<glm::vec3> positions;
23
std::vector<glm::vec3> normals;
24
std::vector<glm::vec2> texcoords;
25
std::vector<unsigned int> indices;
26
int
count = 0;
27
};
28
29
33
class
MeshReductionManager
34
{
35
public
:
36
MeshReductionManager
(
Context
* context)
37
: context(context)
38
{
39
}
40
41
void
setLogging(
int
loglevel = 0)
42
{
43
this->loglevel = loglevel;
44
}
45
46
void
setAddNormals(
bool
addNormals =
true
)
47
{
48
this->addNormals = addNormals;
49
}
50
51
std::vector<MeshHandle> reduce(std::vector<Mesh *> meshes, std::vector<MaterialInstance *> materials,
float
percent,
float
epsilon = 0.1f);
52
MeshHandle
reduce(
Mesh
* mesh,
float
percent,
float
epsilon = 0.1f);
53
void
cleanup();
54
55
private
:
56
Context
* context;
57
int
loglevel = 0;
58
bool
addNormals =
true
;
59
};
60
61
}
62
}
63
64
//template<> inline Cogs::StringView getName<Cogs::RationalReducerExtension::MeshReductionManager>() { return "MeshReductionManager"; }
65
template
<>
66
inline
Cogs::StringView
getNameImpl(
Cogs::RationalReducerExtension::MeshReductionManager
*) {
return
"MeshReductionManager"
; }
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::RationalReducerExtension::MeshReductionManager
Interface to Rational Reducer for reducing meshes.
Definition:
MeshReductionManager.h:34
Cogs::StringView
Provides a weakly referenced view over the contents of a string.
Definition:
StringView.h:24
Cogs::Core
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Definition:
ComponentFunctions.h:10
Cogs
Contains all Cogs related functionality.
Definition:
FieldSetter.h:23
Cogs::Core::MaterialInstance
Material instances represent a specialized Material combined with state for all its buffers and prope...
Definition:
MaterialInstance.h:17
Cogs::Core::Mesh
Meshes contain streams of vertex data in addition to index data and options defining geometry used fo...
Definition:
Mesh.h:265
Cogs::Core::ResourceHandle_t< Mesh >
Cogs::RationalReducerExtension::MeshInfo
Definition:
MeshReductionManager.h:21
Cogs::RationalReducerExtension::TriangleData
Definition:
MeshReductionManager.h:15
Generated by
1.9.6