4#include "EntityDefinition.h"
6#include "Rendering/TextureData.h"
8#include "Generators/ImageType.h"
10#include "ResourceBase.h"
11#include "ResourceFlags.h"
13#include "Services/PropertiesManager.h"
22 ParentIsName = 1 << 0,
38 static constexpr uint32_t NoIndex =
static_cast<uint32_t
>(-1);
77 uint32_t firstProperty;
78 uint32_t numProperties;
118 bool isTrivial()
const {
return !numFields && !numProperties && !numChildren; }
120 void setSequence() {
flags |= SceneEntityFlags::Sequence; }
121 bool isSequence()
const {
return flags & SceneEntityFlags::Sequence; }
122 bool isParentedByName()
const {
return flags & SceneEntityFlags::ParentIsName; }
124 void setEmpty() {
flags |= SceneEntityFlags::Empty; }
125 bool isEmpty()
const {
return flags & SceneEntityFlags::Empty; }
127 void setLodGroup() {
flags |= SceneEntityFlags::LodGroup; }
128 bool isLodGroup()
const {
return flags & SceneEntityFlags::LodGroup; }
130 void setAsset() {
flags |= SceneEntityFlags::Asset; }
131 bool isAsset()
const {
return flags & SceneEntityFlags::Asset; }
133 void setModel() {
flags |= SceneEntityFlags::Model; }
134 bool isModel()
const {
return flags & SceneEntityFlags::Model; }
136 bool isAssetModelOrLodGroup()
const {
return flags & (SceneEntityFlags::Asset | SceneEntityFlags::Model | SceneEntityFlags::LodGroup); }
138 void setChildren() {
flags |= SceneEntityFlags::Children; }
139 bool hasChildren()
const {
return flags & SceneEntityFlags::Children; }
141 void setError() {
flags |= SceneEntityFlags::Error; }
142 bool hasError()
const {
return flags & SceneEntityFlags::Error; }
144 StringView getTypeName()
const
146 if (isAsset())
return "Asset";
147 else if (isModel())
return "Model";
148 else if (isLodGroup())
return "LodGroup";
149 else return Strings::get(
type);
153 constexpr uint32_t NoParentEntity =
static_cast<uint32_t
>(-1);
158 entities(MemBlockType::AssetDefintion),
159 properties(MemBlockType::AssetProperties)
162 uint32_t createEntity(uint32_t parent)
164 const size_t index = entities.size();
167 .index =
static_cast<uint32_t
>(index),
169 .parentIndex = parent,
181 .nextSibling =
static_cast<uint32_t
>(-1),
182 .nextLodSibling =
static_cast<uint32_t
>(-1),
183 .objectId =
static_cast<uint32_t
>(-1),
192 range.store = &properties;
193 range.firstProperty = e.firstProperty;
194 range.numProperties = e.numProperties;
200 return entities[index];
205 return entities[index];
208 uint32_t getChild(uint32_t firstChild, uint32_t childIndex)
const
210 if (childIndex ==
static_cast<uint32_t
>(-1))
return static_cast<uint32_t
>(-1);
211 if (firstChild >= entities.size())
return static_cast<uint32_t
>(-1);
213 auto childDefinition = &entities[firstChild];
215 for (uint32_t i = 0; i < childIndex; ++i) {
216 if (childDefinition->nextSibling >= entities.size())
return static_cast<uint32_t
>(-1);
218 childDefinition = &entities[childDefinition->nextSibling];
221 return childDefinition->index;
224 uint32_t numTopLevelEntities = 0;
225 uint32_t numLodGroups = 0;
230 std::vector<FieldValue> fieldValues;
236 std::string reference;
241 std::string material;
242 std::string permutation;
243 std::unordered_map<std::string, std::string> options;
244 std::unordered_map<std::string, std::string> variants;
245 std::unordered_map<std::string, FieldValue> properties;
249 bool textureGenerator =
false;
257 using ResourcesDefinition = std::vector<ResourceDefinition>;
264 ResourcesDefinition resources;
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
ResourceTypes
Resource types.
TextureLoadFlags
Texture loading flags. May be combined with resource load flags.
Model resources define a template for a set of connected entities, with resources such as meshes,...
struct Cogs::Core::SceneEntityDefinition::@28::@31 model
SceneEntityFlags::Model is set.
uint32_t flags
Really enum of SceneEntityFlags.
uint32_t nextSibling
Next sibling in this or next lod-level.
struct Cogs::Core::SceneEntityDefinition::@28::@32 lod
SceneEntityFlags::LodGroup is set.
uint32_t nextLodSibling
Next sibling within this lod-level.
StringRef type
Neither SceneEntityFlags::Asset, SceneEntityFlags::Model, nor SceneEntityFlags::LodGroup is set.
struct Cogs::Core::SceneEntityDefinition::@28::@30 asset
SceneEntityFlags::Asset is set.