2019-10-01 22:16:09 -07:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-09-08 10:08:58 -07:00
|
|
|
#include "animation/AnimationSystem.h"
|
2019-10-01 22:16:09 -07:00
|
|
|
#include "testcore/TestApp.h"
|
2019-11-29 12:56:52 -08:00
|
|
|
#include "animation/AnimationCache.h"
|
2019-11-21 23:54:29 -08:00
|
|
|
#include "animation/AnimationRenderer.h"
|
2019-10-01 22:16:09 -07:00
|
|
|
#include "attrib/ShadowAttributes.h"
|
|
|
|
#include "stock/StockDataProvider.h"
|
2019-11-30 01:10:47 -08:00
|
|
|
#include "stock/Stock.h"
|
2020-01-03 08:04:20 -08:00
|
|
|
#include "core/ArrayLength.h"
|
2019-10-01 22:16:09 -07:00
|
|
|
#include <vector>
|
2020-01-29 11:27:43 -08:00
|
|
|
#include "core/String.h"
|
2020-08-30 13:16:13 -07:00
|
|
|
#include "io/File.h"
|
2019-10-01 22:16:09 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Renders a character animation
|
|
|
|
*/
|
|
|
|
class TestAnimation: public TestApp {
|
|
|
|
private:
|
|
|
|
using Super = TestApp;
|
|
|
|
|
2019-12-11 04:57:19 -08:00
|
|
|
int _entityType = 0;
|
2019-11-29 12:56:52 -08:00
|
|
|
animation::AnimationCachePtr _animationCache;
|
2019-11-21 23:54:29 -08:00
|
|
|
animation::AnimationRenderer _renderer;
|
2020-09-08 10:08:58 -07:00
|
|
|
animation::AnimationSystem _animationSystem;
|
2019-10-01 22:16:09 -07:00
|
|
|
stock::StockDataProviderPtr _stockDataProvider;
|
2019-11-30 01:10:47 -08:00
|
|
|
stock::Stock _stock;
|
2019-10-01 22:16:09 -07:00
|
|
|
|
|
|
|
attrib::ShadowAttributes _attrib;
|
2020-01-29 23:47:07 -08:00
|
|
|
std::vector<core::String> _animations;
|
|
|
|
std::vector<core::String> _items;
|
2019-10-01 22:16:09 -07:00
|
|
|
int _itemIdx = 0;
|
|
|
|
int _animationIdx = 0;
|
|
|
|
|
|
|
|
io::FilePtr _luaFile;
|
|
|
|
|
2019-12-10 11:41:16 -08:00
|
|
|
int _currentAnimationEntityIndex = 0;
|
2020-08-23 12:16:40 -07:00
|
|
|
double _timeScale = 1.0;
|
2019-12-06 09:33:02 -08:00
|
|
|
bool loadAnimationEntity();
|
2019-10-01 22:16:09 -07:00
|
|
|
void doRender() override;
|
|
|
|
void onRenderUI() override;
|
|
|
|
bool addItem(stock::ItemId id);
|
2019-12-06 09:33:02 -08:00
|
|
|
|
2020-01-29 23:47:07 -08:00
|
|
|
const std::vector<core::String>& animationEntityTypes() const;
|
2019-12-06 09:33:02 -08:00
|
|
|
animation::AnimationEntity* animationEntity();
|
2019-10-01 22:16:09 -07:00
|
|
|
public:
|
|
|
|
TestAnimation(const metric::MetricPtr& metric, const stock::StockDataProviderPtr& stockDataProvider,
|
|
|
|
const io::FilesystemPtr& filesystem,
|
|
|
|
const core::EventBusPtr& eventBus, const core::TimeProviderPtr& timeProvider,
|
2019-11-29 12:56:52 -08:00
|
|
|
const animation::AnimationCachePtr& animationCache);
|
2019-10-01 22:16:09 -07:00
|
|
|
|
2020-08-30 13:46:21 -07:00
|
|
|
app::AppState onConstruct() override;
|
|
|
|
app::AppState onInit() override;
|
|
|
|
app::AppState onCleanup() override;
|
2019-10-01 22:16:09 -07:00
|
|
|
};
|