Cogs.Core
Extensions
RationalReducer
Source
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
10
using namespace
Cogs::Core
;
11
12
namespace
Cogs
13
{
14
namespace
RationalReducerExtension
15
{
19
struct
RationalReducerComponent
:
DynamicComponent
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
45
template
<>
inline
Cogs::StringView
getName<Cogs::RationalReducerExtension::RationalReducerComponent>() {
return
"RationalReducerComponent"
; }
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Core::DynamicComponent
Base class for components implementing dynamic behavior.
Definition:
DynamicComponent.h:31
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::RationalReducerExtension::RationalReducerComponent
Component to be added to an entity to provide mesh reduction using Rational Reducer.
Definition:
RationalReducerComponent.h:20
Cogs::RationalReducerExtension::RationalReducerComponent::reductionPercent
float reductionPercent
The percentage of the triangles you want to remove.
Definition:
RationalReducerComponent.h:32
Cogs::RationalReducerExtension::RationalReducerComponent::loglevel
int loglevel
Logging level.
Definition:
RationalReducerComponent.h:35
Cogs::RationalReducerExtension::RationalReducerComponent::enabled
bool enabled
Set to true to enable reduction.
Definition:
RationalReducerComponent.h:34
Cogs::RationalReducerExtension::RationalReducerComponent::addNormals
bool addNormals
true if normals always to be generated, false = generate only if normals in input data.
Definition:
RationalReducerComponent.h:36
Cogs::RationalReducerExtension::RationalReducerComponent::reductionEpsilon
float reductionEpsilon
A value telling RR to join all vertices where the distance between them are less than the given numbe...
Definition:
RationalReducerComponent.h:33
Generated by
1.9.6