Skip to content

Commit

Permalink
Traktor: Theater module re-implemented.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed Apr 17, 2024
1 parent 2192527 commit 2c0eaac
Show file tree
Hide file tree
Showing 66 changed files with 938 additions and 1,080 deletions.
22 changes: 1 addition & 21 deletions code/Ai/NavMeshEntityFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,19 @@
namespace traktor::ai
{

T_IMPLEMENT_RTTI_CLASS(L"traktor.ai.NavMeshEntityFactory", NavMeshEntityFactory, world::IEntityFactory)
T_IMPLEMENT_RTTI_CLASS(L"traktor.ai.NavMeshEntityFactory", NavMeshEntityFactory, world::AbstractEntityFactory)

NavMeshEntityFactory::NavMeshEntityFactory(resource::IResourceManager* resourceManager, bool suppress)
: m_resourceManager(resourceManager)
, m_suppress(suppress)
{
}

const TypeInfoSet NavMeshEntityFactory::getEntityTypes() const
{
return TypeInfoSet();
}

const TypeInfoSet NavMeshEntityFactory::getEntityEventTypes() const
{
return TypeInfoSet();
}

const TypeInfoSet NavMeshEntityFactory::getEntityComponentTypes() const
{
return makeTypeInfoSet< NavMeshComponentData >();
}

Ref< world::Entity > NavMeshEntityFactory::createEntity(const world::IEntityBuilder* builder, const world::EntityData& entityData) const
{
return nullptr;
}

Ref< world::IEntityEvent > NavMeshEntityFactory::createEntityEvent(const world::IEntityBuilder* builder, const world::IEntityEventData& entityEventData) const
{
return nullptr;
}

Ref< world::IEntityComponent > NavMeshEntityFactory::createEntityComponent(const world::IEntityBuilder* builder, const world::IEntityComponentData& entityComponentData) const
{
if (!m_suppress)
Expand Down
14 changes: 3 additions & 11 deletions code/Ai/NavMeshEntityFactory.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* TRAKTOR
* Copyright (c) 2022 Anders Pistol.
* Copyright (c) 2022-2024 Anders Pistol.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once

#include "World/IEntityFactory.h"
#include "World/AbstractEntityFactory.h"

// import/export mechanism.
#undef T_DLLCLASS
Expand All @@ -31,23 +31,15 @@ namespace traktor::ai
/*! Navigation mesh entity factory.
* \ingroup AI
*/
class T_DLLCLASS NavMeshEntityFactory : public world::IEntityFactory
class T_DLLCLASS NavMeshEntityFactory : public world::AbstractEntityFactory
{
T_RTTI_CLASS;

public:
explicit NavMeshEntityFactory(resource::IResourceManager* resourceManager, bool suppress);

virtual const TypeInfoSet getEntityTypes() const override final;

virtual const TypeInfoSet getEntityEventTypes() const override final;

virtual const TypeInfoSet getEntityComponentTypes() const override final;

virtual Ref< world::Entity > createEntity(const world::IEntityBuilder* builder, const world::EntityData& entityData) const override final;

virtual Ref< world::IEntityEvent > createEntityEvent(const world::IEntityBuilder* builder, const world::IEntityEventData& entityEventData) const override final;

virtual Ref< world::IEntityComponent > createEntityComponent(const world::IEntityBuilder* builder, const world::IEntityComponentData& entityComponentData) const override final;

private:
Expand Down
24 changes: 2 additions & 22 deletions code/Animation/AnimationEntityFactory.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* TRAKTOR
* Copyright (c) 2022 Anders Pistol.
* Copyright (c) 2022-2024 Anders Pistol.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down Expand Up @@ -29,7 +29,7 @@
namespace traktor::animation
{

T_IMPLEMENT_RTTI_CLASS(L"traktor.animation.AnimationEntityFactory", AnimationEntityFactory, world::IEntityFactory)
T_IMPLEMENT_RTTI_CLASS(L"traktor.animation.AnimationEntityFactory", AnimationEntityFactory, world::AbstractEntityFactory)

AnimationEntityFactory::AnimationEntityFactory(resource::IResourceManager* resourceManager, render::IRenderSystem* renderSystem, physics::PhysicsManager* physicsManager)
: m_resourceManager(resourceManager)
Expand All @@ -38,16 +38,6 @@ AnimationEntityFactory::AnimationEntityFactory(resource::IResourceManager* resou
{
}

const TypeInfoSet AnimationEntityFactory::getEntityTypes() const
{
return TypeInfoSet();
}

const TypeInfoSet AnimationEntityFactory::getEntityEventTypes() const
{
return TypeInfoSet();
}

const TypeInfoSet AnimationEntityFactory::getEntityComponentTypes() const
{
TypeInfoSet typeSet;
Expand All @@ -65,16 +55,6 @@ const TypeInfoSet AnimationEntityFactory::getEntityComponentTypes() const
return typeSet;
}

Ref< world::Entity > AnimationEntityFactory::createEntity(const world::IEntityBuilder* builder, const world::EntityData& entityData) const
{
return nullptr;
}

Ref< world::IEntityEvent > AnimationEntityFactory::createEntityEvent(const world::IEntityBuilder* builder, const world::IEntityEventData& entityEventData) const
{
return nullptr;
}

Ref< world::IEntityComponent > AnimationEntityFactory::createEntityComponent(const world::IEntityBuilder* builder, const world::IEntityComponentData& entityComponentData) const
{
if (auto animatedMeshComponentData = dynamic_type_cast< const AnimatedMeshComponentData* >(&entityComponentData))
Expand Down
16 changes: 4 additions & 12 deletions code/Animation/AnimationEntityFactory.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* TRAKTOR
* Copyright (c) 2022 Anders Pistol.
* Copyright (c) 2022-2024 Anders Pistol.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once

#include "World/IEntityFactory.h"
#include "World/AbstractEntityFactory.h"

// import/export mechanism.
#undef T_DLLCLASS
Expand Down Expand Up @@ -45,23 +45,15 @@ namespace traktor::animation
/*! Animation entity factory.
* \ingroup Animation
*/
class T_DLLCLASS AnimationEntityFactory : public world::IEntityFactory
class T_DLLCLASS AnimationEntityFactory : public world::AbstractEntityFactory
{
T_RTTI_CLASS;

public:
AnimationEntityFactory(resource::IResourceManager* resourceManager, render::IRenderSystem* renderSystem, physics::PhysicsManager* physicsManager);

virtual const TypeInfoSet getEntityTypes() const override final;

virtual const TypeInfoSet getEntityEventTypes() const override final;
explicit AnimationEntityFactory(resource::IResourceManager* resourceManager, render::IRenderSystem* renderSystem, physics::PhysicsManager* physicsManager);

virtual const TypeInfoSet getEntityComponentTypes() const override final;

virtual Ref< world::Entity > createEntity(const world::IEntityBuilder* builder, const world::EntityData& entityData) const override final;

virtual Ref< world::IEntityEvent > createEntityEvent(const world::IEntityBuilder* builder, const world::IEntityEventData& entityEventData) const override final;

virtual Ref< world::IEntityComponent > createEntityComponent(const world::IEntityBuilder* builder, const world::IEntityComponentData& entityComponentData) const override final;

private:
Expand Down
24 changes: 2 additions & 22 deletions code/Mesh/MeshEntityFactory.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* TRAKTOR
* Copyright (c) 2022 Anders Pistol.
* Copyright (c) 2022-2024 Anders Pistol.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -15,39 +15,19 @@
namespace traktor::mesh
{

T_IMPLEMENT_RTTI_CLASS(L"traktor.mesh.MeshEntityFactory", MeshEntityFactory, world::IEntityFactory)
T_IMPLEMENT_RTTI_CLASS(L"traktor.mesh.MeshEntityFactory", MeshEntityFactory, world::AbstractEntityFactory)

MeshEntityFactory::MeshEntityFactory(resource::IResourceManager* resourceManager, render::IRenderSystem* renderSystem)
: m_resourceManager(resourceManager)
, m_renderSystem(renderSystem)
{
}

const TypeInfoSet MeshEntityFactory::getEntityTypes() const
{
return TypeInfoSet();
}

const TypeInfoSet MeshEntityFactory::getEntityEventTypes() const
{
return TypeInfoSet();
}

const TypeInfoSet MeshEntityFactory::getEntityComponentTypes() const
{
return makeTypeInfoSet< MeshComponentData, MeshParameterComponentData >();
}

Ref< world::Entity > MeshEntityFactory::createEntity(const world::IEntityBuilder* builder, const world::EntityData& entityData) const
{
return nullptr;
}

Ref< world::IEntityEvent > MeshEntityFactory::createEntityEvent(const world::IEntityBuilder* builder, const world::IEntityEventData& entityEventData) const
{
return nullptr;
}

Ref< world::IEntityComponent > MeshEntityFactory::createEntityComponent(const world::IEntityBuilder* builder, const world::IEntityComponentData& entityComponentData) const
{
if (auto meshComponentData = dynamic_type_cast< const MeshComponentData* >(&entityComponentData))
Expand Down
14 changes: 3 additions & 11 deletions code/Mesh/MeshEntityFactory.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* TRAKTOR
* Copyright (c) 2022 Anders Pistol.
* Copyright (c) 2022-2024 Anders Pistol.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once

#include "World/IEntityFactory.h"
#include "World/AbstractEntityFactory.h"

// import/export mechanism.
#undef T_DLLCLASS
Expand Down Expand Up @@ -38,23 +38,15 @@ namespace traktor::mesh
/*! Mesh component factory.
* \ingroup Mesh
*/
class T_DLLCLASS MeshEntityFactory : public world::IEntityFactory
class T_DLLCLASS MeshEntityFactory : public world::AbstractEntityFactory
{
T_RTTI_CLASS;

public:
explicit MeshEntityFactory(resource::IResourceManager* resourceManager, render::IRenderSystem* renderSystem);

virtual const TypeInfoSet getEntityTypes() const override final;

virtual const TypeInfoSet getEntityEventTypes() const override final;

virtual const TypeInfoSet getEntityComponentTypes() const override final;

virtual Ref< world::Entity > createEntity(const world::IEntityBuilder* builder, const world::EntityData& entityData) const override final;

virtual Ref< world::IEntityEvent > createEntityEvent(const world::IEntityBuilder* builder, const world::IEntityEventData& entityEventData) const override final;

virtual Ref< world::IEntityComponent > createEntityComponent(const world::IEntityBuilder* builder, const world::IEntityComponentData& entityComponentData) const override final;

private:
Expand Down
27 changes: 2 additions & 25 deletions code/Physics/World/EntityFactory.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* TRAKTOR
* Copyright (c) 2022 Anders Pistol.
* Copyright (c) 2022-2024 Anders Pistol.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -19,7 +19,7 @@
namespace traktor::physics
{

T_IMPLEMENT_RTTI_CLASS(L"traktor.physics.EntityFactory", EntityFactory, world::IEntityFactory)
T_IMPLEMENT_RTTI_CLASS(L"traktor.physics.EntityFactory", EntityFactory, world::AbstractEntityFactory)

EntityFactory::EntityFactory(
resource::IResourceManager* resourceManager,
Expand All @@ -30,16 +30,6 @@ EntityFactory::EntityFactory(
{
}

const TypeInfoSet EntityFactory::getEntityTypes() const
{
return TypeInfoSet();
}

const TypeInfoSet EntityFactory::getEntityEventTypes() const
{
return TypeInfoSet();
}

const TypeInfoSet EntityFactory::getEntityComponentTypes() const
{
return makeTypeInfoSet<
Expand All @@ -50,19 +40,6 @@ const TypeInfoSet EntityFactory::getEntityComponentTypes() const
>();
}

Ref< world::Entity > EntityFactory::createEntity(
const world::IEntityBuilder* builder,
const world::EntityData& entityData
) const
{
return nullptr;
}

Ref< world::IEntityEvent > EntityFactory::createEntityEvent(const world::IEntityBuilder* builder, const world::IEntityEventData& entityEventData) const
{
return nullptr;
}

Ref< world::IEntityComponent > EntityFactory::createEntityComponent(const world::IEntityBuilder* builder, const world::IEntityComponentData& entityComponentData) const
{
if (auto characterComponentData = dynamic_type_cast< const CharacterComponentData* >(&entityComponentData))
Expand Down
12 changes: 2 additions & 10 deletions code/Physics/World/EntityFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
#pragma once

#include "World/IEntityFactory.h"
#include "World/AbstractEntityFactory.h"

#undef T_DLLCLASS
#if defined(T_PHYSICS_EXPORT)
Expand All @@ -32,7 +32,7 @@ class PhysicsManager;
/*! Physics entity factory.
* \ingroup Physics
*/
class T_DLLCLASS EntityFactory : public world::IEntityFactory
class T_DLLCLASS EntityFactory : public world::AbstractEntityFactory
{
T_RTTI_CLASS;

Expand All @@ -42,16 +42,8 @@ class T_DLLCLASS EntityFactory : public world::IEntityFactory
PhysicsManager* physicsManager
);

virtual const TypeInfoSet getEntityTypes() const override final;

virtual const TypeInfoSet getEntityEventTypes() const override final;

virtual const TypeInfoSet getEntityComponentTypes() const override final;

virtual Ref< world::Entity > createEntity(const world::IEntityBuilder* builder, const world::EntityData& entityData) const override final;

virtual Ref< world::IEntityEvent > createEntityEvent(const world::IEntityBuilder* builder, const world::IEntityEventData& entityEventData) const override final;

virtual Ref< world::IEntityComponent > createEntityComponent(const world::IEntityBuilder* builder, const world::IEntityComponentData& entityComponentData) const override final;

private:
Expand Down
6 changes: 6 additions & 0 deletions code/Scene/Editor/EntityAdapterBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Ref< world::Entity > EntityAdapterBuilder::create(const world::EntityData* entit
{
log::debug << L"Unable to create entity from \"" << type_name(entityData) << L"\"; using empty entity as placeholder." << Endl;
entity = new world::Entity(
entityData->getId(),
entityData->getName(),
entityData->getTransform(),
entityData->getState()
Expand Down Expand Up @@ -179,4 +180,9 @@ Ref< world::IEntityComponent > EntityAdapterBuilder::create(const world::IEntity
return entityComponent;
}

Ref< world::IWorldComponent > EntityAdapterBuilder::create(const world::IWorldComponentData* worldComponentData) const
{
return m_entityFactory->createWorldComponent(this, *worldComponentData);
}

}
2 changes: 2 additions & 0 deletions code/Scene/Editor/EntityAdapterBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class EntityAdapterBuilder : public world::IEntityBuilder

virtual Ref< world::IEntityComponent > create(const world::IEntityComponentData* entityComponentData) const override final;

virtual Ref< world::IWorldComponent > create(const world::IWorldComponentData* worldComponentData) const override final;

EntityAdapter* getRootAdapter() const { return m_rootAdapter; }

private:
Expand Down
Loading

0 comments on commit 2c0eaac

Please sign in to comment.