#ifndef _gpuCacheSubSceneOverride_h_
#define _gpuCacheSubSceneOverride_h_
#include "gpuCacheShapeNode.h"
#include "CacheReader.h"
#include <memory>
#include <time.h>
#include <maya/MDagPathArray.h>
#include <maya/MPxSubSceneOverride.h>
#include <maya/MCallbackIdArray.h>
#include <maya/MMessage.h>
namespace GPUCache {
class ShapeNode;
{
public:
static void clear();
SubSceneOverride(
const MObject&
object);
~SubSceneOverride() override;
MHWRender::DrawAPI supportedDrawAPIs() const override;
void dirtyEverything();
void dirtyRenderItems();
void dirtyVisibility();
void dirtyWorldMatrix();
void dirtyStreams();
void dirtyMaterials();
void resetDagPaths();
void registerNodeDirtyCallbacks();
void clearNodeDirtyCallbacks();
const SubNode::Ptr& getGeometry() const { return fGeometry; }
const MaterialGraphMap::Ptr& getMaterial() const { return fMaterial;}
double getTime() const { return fTimeInSeconds; }
bool castsShadows() const { return fCastsShadowsPlug.asBool(); }
bool receiveShadows() const { return fReceiveShadowsPlug.asBool(); }
class HardwareInstanceManager;
std::shared_ptr<HardwareInstanceManager>& hardwareInstanceManager()
{ return fHardwareInstanceManager; }
private:
class HierarchyStat;
class HierarchyStatVisitor;
const std::shared_ptr<const HierarchyStat>& getHierarchyStat() const
{ return fHierarchyStat; }
const ShapeNode* fShapeNode;
MPlug fReceiveShadowsPlug;
CacheFileEntry::BackgroundReadingState fReadingState{CacheFileEntry::kReadingDone};
SubNode::Ptr fGeometry;
MaterialGraphMap::Ptr fMaterial;
double fTimeInSeconds;
clock_t fUpdateTime;
MCallbackId fInstanceAddedCallback;
MCallbackId fInstanceRemovedCallback;
MCallbackId fWorldMatrixChangedCallback;
bool fUpdateRenderItemsRequired;
bool fUpdateVisibilityRequired;
bool fUpdateWorldMatrixRequired;
bool fUpdateStreamsRequired;
bool fUpdateMaterialsRequired;
bool fOutOfViewFrustum;
bool fOutOfViewFrustumUpdated;
DisplayPref::WireframeOnShadedMode fWireOnShadedMode;
class SubNodeRenderItems;
class UpdateRenderItemsVisitor;
template<typename DERIVED> class UpdateVisitorWithPrune;
class UpdateVisibilityVisitor;
class UpdateWorldMatrixVisitor;
class UpdateStreamsVisitor;
class UpdateDiffuseColorVisitor;
class InstanceRenderItems;
typedef std::vector<std::shared_ptr<InstanceRenderItems> > InstanceRenderItemList;
typedef std::vector<std::shared_ptr<SubNodeRenderItems> > SubNodeRenderItemList;
InstanceRenderItemList fInstanceRenderItems;
std::shared_ptr<const HierarchyStat> fHierarchyStat;
std::shared_ptr<HardwareInstanceManager> fHardwareInstanceManager;
};
}
#endif