pathfinder/demo/magicleap/src/landscape.h

120 lines
2.8 KiB
C
Raw Normal View History

2019-03-29 16:28:16 -04:00
// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
//
// Copyright (c) 2018 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Creator Agreement, located
// here: https://id.magicleap.com/creator-terms
//
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%
// %SRC_VERSION%: 1
#include <EGL/egl.h>
2019-03-29 16:28:16 -04:00
#include <lumin/LandscapeApp.h>
#include <lumin/Prism.h>
#include <lumin/event/ServerEvent.h>
#include <SceneDescriptor.h>
#include <PrismSceneManager.h>
/**
* PathfinderDemo Landscape Application
*/
class PathfinderDemo : public lumin::LandscapeApp {
public:
/**
* Constructs the Landscape Application.
*/
PathfinderDemo();
/**
* Destroys the Landscape Application.
*/
virtual ~PathfinderDemo();
/**
* Disallows the copy constructor.
*/
PathfinderDemo(const PathfinderDemo&) = delete;
/**
* Disallows the move constructor.
*/
PathfinderDemo(PathfinderDemo&&) = delete;
/**
* Disallows the copy assignment operator.
*/
PathfinderDemo& operator=(const PathfinderDemo&) = delete;
/**
* Disallows the move assignment operator.
*/
PathfinderDemo& operator=(PathfinderDemo&&) = delete;
protected:
/**
* Initializes the Landscape Application.
* @return - 0 on success, error code on failure.
*/
int init() override;
/**
* Deinitializes the Landscape Application.
* @return - 0 on success, error code on failure.
*/
int deInit() override;
/**
* Returns the initial size of the Prism
* Used in createPrism().
*/
const glm::vec3 getInitialPrismSize() const;
/**
* Creates the prism, updates the private variable prism_ with the created prism.
*/
void createInitialPrism();
/**
* Initializes and creates the scene of all scenes marked as initially instanced
*/
void spawnInitialScenes();
/**
2019-04-01 14:13:41 -04:00
* Respond to a click
2019-03-29 16:28:16 -04:00
*/
2019-04-01 14:13:41 -04:00
bool onClick();
2019-03-29 16:28:16 -04:00
2019-04-01 14:13:41 -04:00
/**
* Dispatch an SVG file to the immersive app
*/
void dispatch(char* svg_filename);
2019-03-29 16:28:16 -04:00
/**
* Run application login
*/
virtual bool updateLoop(float fDelta) override;
/**
* Handle events from the server
*/
virtual bool eventListener(lumin::ServerEvent* event) override;
private:
lumin::Prism* prism_ = nullptr; // represents the bounded space where the App renders.
PrismSceneManager* prismSceneManager_ = nullptr;
void* pathfinder_ = nullptr;
2019-03-29 16:28:16 -04:00
uint64_t svg_filecount_ = 0;
char** svg_filenames_ = nullptr;
2019-04-01 14:13:41 -04:00
lumin::NodeIDType focus_node_ = lumin::INVALID_NODE_ID;
2019-03-29 16:28:16 -04:00
};
extern "C" uint64_t magicleap_pathfinder_svg_filecount();
extern "C" char** magicleap_pathfinder_svg_filenames();
extern "C" void* magicleap_pathfinder_init();
extern "C" void magicleap_pathfinder_render(void*, EGLDisplay, EGLSurface, char*);
extern "C" void magicleap_pathfinder_deinit(void*);