diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 85007f5f15..151e95900a 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -204,14 +204,13 @@ endif() # link required hifi libraries link_hifi_libraries( - shared task octree ktx gpu gl procedural graphics render + shared workload task octree ktx gpu gl procedural graphics render pointers recording fbx networking model-networking entities avatars trackers audio audio-client animation script-engine physics render-utils entities-renderer avatars-renderer ui qml auto-updater midi controllers plugins image trackers ui-plugins display-plugins input-plugins - workload ${PLATFORM_GL_BACKEND} ) diff --git a/libraries/workload/src/workload/ClassificationTracker.cpp b/libraries/workload/src/workload/ClassificationTracker.cpp new file mode 100644 index 0000000000..009549737f --- /dev/null +++ b/libraries/workload/src/workload/ClassificationTracker.cpp @@ -0,0 +1,24 @@ +// +// ClassificationTracker.cpp +// libraries/workload/src/workload +// +// Created by Andrew Meadows 2018.02.21 +// Copyright 2018 High Fidelity, Inc. +// +// Originally from lighthouse3d. Modified to utilize glm::vec3 and clean up to our coding standards +// Simple plane class. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "ClassificationTracker.h" + +using namespace workload; + +void ClassificationTracker::configure(const Config& config) { +} + +void ClassificationTracker::run(const workload::WorkloadContextPointer& renderContext, Outputs& outputs) { + +} + diff --git a/libraries/workload/src/workload/ClassificationTracker.h b/libraries/workload/src/workload/ClassificationTracker.h new file mode 100644 index 0000000000..ca7a919769 --- /dev/null +++ b/libraries/workload/src/workload/ClassificationTracker.h @@ -0,0 +1,45 @@ +// +// ClassificationTracker.h +// libraries/workload/src/workload +// +// Created by Andrew Meadows 2018.02.21 +// Copyright 2018 High Fidelity, Inc. +// +// Originally from lighthouse3d. Modified to utilize glm::vec3 and clean up to our coding standards +// Simple plane class. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_workload_ClassificationTracker_h +#define hifi_workload_ClassificationTracker_h + +#include "Space.h" +#include "Engine.h" + +namespace workload { + + class ClassificationTrackerConfig : public Job::Config { + Q_OBJECT + public: + ClassificationTrackerConfig() : Job::Config(true) {} + }; + + class ClassificationTracker { + public: + using Config = ClassificationTrackerConfig; + using Outputs = Classifications; + using JobModel = workload::Job::ModelO; + + ClassificationTracker() {} + + void configure(const Config& config); + void run(const workload::WorkloadContextPointer& renderContext, Outputs& outputs); + + protected: + }; + +} // namespace workload + +#endif // hifi_workload_ClassificationTracker_h diff --git a/libraries/workload/src/workload/Engine.cpp b/libraries/workload/src/workload/Engine.cpp index 3cf31bd879..70566fe704 100644 --- a/libraries/workload/src/workload/Engine.cpp +++ b/libraries/workload/src/workload/Engine.cpp @@ -16,37 +16,19 @@ #include -namespace workload { +#include "ClassificationTracker.h" - // the "real Job" - class HelloWorld { - QString _message; - bool _isEnabled { true }; - public: - using JobModel = Job::Model; - HelloWorld() {} - void configure(const HelloWorldConfig& configuration) { - _isEnabled = configuration.isEnabled(); - _message = configuration.getMessage(); - } - void run(const WorkloadContextPointer& context) { - if (_isEnabled) { - std::cout << _message.toStdString() << std::endl; - } - } - }; +namespace workload { WorkloadContext::WorkloadContext(const SpacePointer& space) : task::JobContext(trace_workload()), _space(space) {} - using EngineModel = Task::Model; + using EngineModel = Task::Model; - // the 'Builder' is the 'Data' on which the EngineModel templatizes. - // It must implement build() which is called by EngineModel::create(). - class HelloWorldBuilder { + class EngineBuilder { public: using JobModel = Task::Model; void build(EngineModel& model, const Varying& in, Varying& out) { - model.addJob("helloWorld"); + auto classifications = model.addJob("classificationTracker"); } }; diff --git a/libraries/workload/src/workload/Engine.h b/libraries/workload/src/workload/Engine.h index 08abe23e35..aa45b03a20 100644 --- a/libraries/workload/src/workload/Engine.h +++ b/libraries/workload/src/workload/Engine.h @@ -24,9 +24,6 @@ namespace workload { - // How to make an Engine under the task::Task paradigm... - - // (1) Derive class C from task::JobContext class WorkloadContext : public task::JobContext { public: WorkloadContext(const SpacePointer& space); @@ -34,40 +31,18 @@ namespace workload { SpacePointer _space; }; - using WorkloadContextPointer = std::shared_ptr; - // (2) Apply a macro which will create local aliases (via "using") for example: - // using Task = task::Task; + using WorkloadContextPointer = std::shared_ptr; Task_DeclareTypeAliases(WorkloadContext) - // (3) You'll need a 'real Job' but it will need a Config for exposing settings to JS, - // and you should do that here: - class HelloWorldConfig : public Job::Config { - Q_OBJECT - Q_PROPERTY(QString message READ getMessage WRITE setMessage) - QString _message {"Hello World."}; - public: - HelloWorldConfig() : Job::Config(true) {} - QString getMessage() const { return _message; } - void setMessage(const QString& msg) { _message = msg; } - }; - - // (4) In cpp file the 'real Job' will need a 'builder'. The 'builder' is the 'Data' argument - // for the Model template. - // Data must implement Data::build(). - // Data::build() is called when the Model is added (in Engine ctor) as the first child job of the Engine - - // (5) Engine derives from task::Task and will run all the Job's class Engine : public Task { public: - Engine(const WorkloadContextPointer& context = std::make_shared()); + Engine(const WorkloadContextPointer& context); ~Engine() = default; - // (6) The Engine's Context is passed to its Jobs when they are run() void run() { assert(_context); run(_context); } protected: - // (6) Again, the Engine's Context is passed to its Jobs when they are run() void run(const WorkloadContextPointer& context) override { assert(_context); Task::run(_context); } private: diff --git a/libraries/workload/src/workload/Space.h b/libraries/workload/src/workload/Space.h index a805d8bacd..ede074df4e 100644 --- a/libraries/workload/src/workload/Space.h +++ b/libraries/workload/src/workload/Space.h @@ -87,6 +87,7 @@ private: }; using SpacePointer = std::shared_ptr; +using Classifications = std::vector; } // namespace workload