// // VROARScene.h // ViroKit // // Created by Andy Chu on 6/13/17. // Copyright © 2017 Viro Media. All rights reserved. // #ifndef VROARScene_h #define VROARScene_h #include #include "VROARSession.h" #include "VROScene.h" class VROARAnchor; class VROARDeclarativeSession; class VROARImperativeSession; class VROPointCloudEmitter; class VROARSceneDelegate { public: virtual void onTrackingInitialized() = 0; virtual void onAmbientLightUpdate(float ambientLightIntensity, float colorTemperature) = 0; }; class VROARScene : public VROScene { public: VROARScene() : _hasTrackingInitialized(false), _displayPointCloud(false), _pointCloudSurfaceScale(VROVector3f(.01, .01, 1)), _pointCloudMaxPoints(500) { _pointCloudNode = std::make_shared(); _detectionTypes = { VROAnchorDetection::PlanesHorizontal }; //default is horizontal }; virtual ~VROARScene(); void initDeclarativeSession(); void initImperativeSession(); std::shared_ptr getSessionDelegate(); void setARSession(std::shared_ptr arSession); void setDriver(std::shared_ptr driver); /* Add AR nodes. These are directly added to the root node. */ void addNode(std::shared_ptr node); /* The set of anchor detection types we want to enable for this scene. */ void setAnchorDetectionTypes(std::set detectionTypes); /* Set true to display/render the point cloud particles. */ void displayPointCloud(bool display); /* Reset the point cloud surface to the default. */ void resetPointCloudSurface(); /* Set the surface to use for the individual point cloud particles. */ void setPointCloudSurface(std::shared_ptr surface); /* Set the scale of the individual point cloud particles. */ void setPointCloudSurfaceScale(VROVector3f scale); /* Sets the max number of point cloud points to display/render at any one time. */ void setPointCloudMaxPoints(int maxPoints); void setDelegate(std::shared_ptr delegate); void trackingHasInitialized(); void updateAmbientLight(float intensity, float colorTemperature); void willAppear(); void willDisappear(); std::shared_ptr getDeclarativeSession() { return _declarativeSession; } std::shared_ptr getImperativeSession() { return _imperativeSession; } private: std::set _detectionTypes; std::weak_ptr _arSession; std::weak_ptr _driver; std::shared_ptr _declarativeSession; std::shared_ptr _imperativeSession; std::shared_ptr _pointCloudNode; std::shared_ptr _pointCloudEmitter; std::weak_ptr _delegate; bool _hasTrackingInitialized; /* Point Cloud Properties */ bool _displayPointCloud; std::shared_ptr _pointCloudSurface; VROVector3f _pointCloudSurfaceScale; int _pointCloudMaxPoints; /* Creates an instance of VROPointCloudEmitter if possible. */ std::shared_ptr createPointCloudEmitter(); }; #endif /* VROARScene_h */