11#include "ComponentFunctions.h"
14#include "Foundation/Reflection/Type.h"
16#include <glm/vec2.hpp>
17#include <glm/vec3.hpp>
18#include <glm/vec4.hpp>
19#include <glm/mat4x4.hpp>
20#include <glm/ext/quaternion_float.hpp>
25#include <unordered_map>
67 struct ResourceDefinition;
68 using MaterialInstanceDefinition = ResourceDefinition;
84 std::memcpy(storage, original.storage,
sizeof(storage));
86 value = original.value;
87 values = original.values;
88 intValues = original.intValues;
89 floatValues = original.floatValues;
90 vec3Values = original.vec3Values;
91 vec2Values = original.vec2Values;
92 vec4Values = original.vec4Values;
120 char storage[512+32] = { 0 };
122 char storage[512] = { 0 };
127 std::vector<std::string> values;
128 std::vector<int> intValues;
129 std::vector<float> floatValues;
130 std::vector<glm::vec3> vec3Values;
131 std::vector<glm::vec2> vec2Values;
132 std::vector<glm::vec4> vec4Values;
136 FieldValue& operator =(
const FieldValue& rhs) {
141 std::memcpy(storage, rhs.storage,
sizeof(storage));
145 intValues = rhs.intValues;
146 floatValues = rhs.floatValues;
147 vec3Values = rhs.vec3Values;
148 vec2Values = rhs.vec2Values;
149 vec4Values = rhs.vec4Values;
Container for components, providing composition of dynamic entities.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
void updateMaterialInstance(Context *context, MaterialInstance *materialInstance, const MaterialInstanceDefinition &materialInstanceValue)
Apply material instance values.
void applyFieldValues(class Context *context, std::span< FieldValue > entityDefinition, ComponentModel::Entity *entity)
Apply defaults from the given entityDefinition to the given entity.
DefaultValueType
Defines value types for default values.
uint16_t TypeId
Built in type used to uniquely identify a single type instance.
uint16_t FieldId
Type used to index fields.
constexpr FieldId NoField
No field id.
constexpr TypeId NoType
Definition of no type.
Contains all Cogs related functionality.
Defines how to construct entities of a certain type by a list of components to instantiate and defaul...
std::string description
Description of the entity. For in-line documentation.
std::vector< ComponentCreator * > creators
std::vector< std::string > components
Names of the component types to instantiate when creating an entity from this definition.
std::vector< FieldValue > defaultValues
Set of default values to apply after constructing entities from this definition.
Defines an extension to Cogs.Core and provides methods to override in order to initialize extension c...
Defines a value to apply to a field.
Reflection::TypeId componentId
Type id of the component the value should be applied to.
Reflection::FieldId fieldId
Field id of the field in the given component the value should be applied to.
DefaultValueType type
Type of the field.
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...
Model resources define a template for a set of connected entities, with resources such as meshes,...
Texture resources contain raster bitmap data to use for texturing.