Cogs.Core
MeshReductionManager.h
1#pragma once
2
3#include "Resources/Mesh.h"
4#include "Resources/Resources.h"
5
6#include "Foundation/Reflection/Name.h"
7
8using namespace Cogs::Core;
9
10namespace Cogs
11{
12 namespace RationalReducerExtension
13 {
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
34 {
35 public:
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"; }
65template<>
66inline Cogs::StringView getNameImpl(Cogs::RationalReducerExtension::MeshReductionManager *) { return "MeshReductionManager"; }
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Interface to Rational Reducer for reducing meshes.
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Material instances represent a specialized Material combined with state for all its buffers and prope...
Meshes contain streams of vertex data in addition to index data and options defining geometry used fo...
Definition: Mesh.h:265