Cogs.Core
RationalReducerComponent.h
1#pragma once
2
3#include "Components/Core/DynamicComponent.h"
4#include "Components/Core/MeshComponent.h"
5#include "Resources/Mesh.h"
6#include "Resources/Resources.h"
7
8#include "Foundation/ComponentModel/Component.h"
9
10using namespace Cogs::Core;
11
12namespace Cogs
13{
14 namespace RationalReducerExtension
15 {
20 {
21 static void registerType();
22 void initialize(Context * context);
23 void update();
24
25 Context * context;
26 std::vector<MeshHandle> originalMeshes;
27 std::vector<MeshHandle> reducedMeshes;
28 std::vector<Cogs::ComponentModel::ComponentHandle> meshComponents;
29 std::vector<MaterialInstanceHandle> materials;
30
31 //fields:
32 float reductionPercent = 0;
33 float reductionEpsilon = 0.1f;
34 bool enabled = false;
35 int loglevel = 0;
36 bool addNormals = true;
37
38 private:
39 float lastPercent = 0;
40 };
41
42 }
43}
44
45template<> inline Cogs::StringView getName<Cogs::RationalReducerExtension::RationalReducerComponent>() { return "RationalReducerComponent"; }
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base class for components implementing dynamic behavior.
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
Component to be added to an entity to provide mesh reduction using Rational Reducer.
float reductionPercent
The percentage of the triangles you want to remove.
bool addNormals
true if normals always to be generated, false = generate only if normals in input data.
float reductionEpsilon
A value telling RR to join all vertices where the distance between them are less than the given numbe...