Cogs.Core
FogComponent.cpp
1#include "FogComponent.h"
2
3#include "Types.h"
4
5using namespace Cogs::Reflection;
6using namespace Cogs::ComponentModel;
7
9{
10 Field fields [] = {
12 Field::create(Name("distance"), &FogComponent::distance).setRange(0, 100000),
13 Field::create(Name("amount"), &FogComponent::amount).setRange(0, 1),
14 Field(Name("enabled"), &FogComponent::enabled),
15 };
16
17 TypeDatabase::createType<FogComponent>().setBase<Component>().setFields(fields);
18}
Base class for Component instances.
Definition: Component.h:143
static void registerType()
Register the type in the type system.
Definition: FogComponent.cpp:8
glm::vec4 color
Fog color.
Definition: FogComponent.h:23
float amount
Amount of fog to blend in.
Definition: FogComponent.h:29
float distance
Distance at which the fog is at its most dense.
Definition: FogComponent.h:26
bool enabled
If the fog should be enabled or disabled.
Definition: FogComponent.h:32
Field definition describing a single data member of a data structure.
Definition: Field.h:68
Field & add(T attribute)
Adds the given attribute.
Definition: Field.h:177
static FieldWrapper< Field, FieldType > create(const Name &name, FieldType ClassType::*field)
Creates a new field instance, returning a wrapper for type safe continuation style setup.
Definition: Field.inl:29
Contains code for composing and managing entities built from components.
Contains reflection support.
Definition: Component.h:11
Tags an object as being able to represent a color.
Definition: Attributes.h:122
Represents an unique name.
Definition: Name.h:70