mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Add a draft for node for Entity Component System
This commit is contained in:
@@ -25,6 +25,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "rendering/lightarray.h"
|
||||
#include "world/TractionPower.h"
|
||||
#include "application/application.h"
|
||||
#include "entitysystem/ecs.h"
|
||||
#include "entitysystem/components/RenderComponents.h"
|
||||
#include "rendering/renderer.h"
|
||||
#include "utilities/Logs.h"
|
||||
|
||||
@@ -426,7 +428,27 @@ state_serializer::deserialize_node( cParser &Input, scene::scratch_data &Scratch
|
||||
>> nodedata.range_min
|
||||
>> nodedata.name
|
||||
>> nodedata.type;
|
||||
if( nodedata.name == "none" ) { nodedata.name.clear(); }
|
||||
|
||||
// Add node to ComponentSystem
|
||||
entt::entity CSEntity = CS.CreateObject();
|
||||
|
||||
auto nodeTransform = CS.GetComponent<ECSComponent::Transform>(CSEntity);
|
||||
nodeTransform.Position = Scratchpad.location.offset.empty() ? glm::dvec3(0.0) : Scratchpad.location.offset.top();
|
||||
nodeTransform.Rotation = Scratchpad.location.rotation;
|
||||
//nodeTransform.Scale = Scratchpad.location.scale;
|
||||
|
||||
auto lodController = CS.AddComponent<ECSComponent::LODController>(CSEntity);
|
||||
lodController.RangeMax = nodedata.range_max;
|
||||
lodController.RangeMin = nodedata.range_min;
|
||||
|
||||
if( nodedata.name == "none" )
|
||||
{
|
||||
nodedata.name.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
CS.GetComponent<ECSComponent::Identification>(CSEntity).Name = nodedata.name;
|
||||
}
|
||||
// type-based deserialization. not elegant but it'll do
|
||||
if( nodedata.type == "dynamic" ) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user