mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Updated Servo2D to LRE v0.22.0
This commit is contained in:
parent
6775c69da1
commit
deb06ffcec
29 changed files with 791 additions and 174 deletions
74
support/magicleap/Servo2D/code/inc.gen/PrismSceneManager.h
Normal file
74
support/magicleap/Servo2D/code/inc.gen/PrismSceneManager.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
//
|
||||
// THE CONTENTS OF THIS FILE IS GENERATED BY CODE AND
|
||||
// ANY MODIFICATIONS WILL BE OVERWRITTEN
|
||||
//
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
|
||||
// %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
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lumin/Prism.h>
|
||||
#include <lumin/node/Node.h>
|
||||
|
||||
#include <SceneDescriptor.h>
|
||||
#include <SpawnedSceneBase.h>
|
||||
#include <SpawnedSceneUserData.h>
|
||||
#include <scenes.h>
|
||||
|
||||
class PrismSceneManager {
|
||||
public:
|
||||
|
||||
typedef std::function<SpawnedSceneUserData*(SpawnedSceneBase&)> (*CreateSpawnedSceneUserData);
|
||||
static void setUserDataCreator(const SceneDescriptor & sceneDescriptor, CreateSpawnedSceneUserData createSpawnedSceneUserData);
|
||||
|
||||
public:
|
||||
|
||||
PrismSceneManager(lumin::Prism* prism);
|
||||
|
||||
enum class SceneState {
|
||||
Unloaded,
|
||||
ResourceModelLoaded,
|
||||
ResourceAndObjectModelLoaded,
|
||||
};
|
||||
|
||||
void setSceneState(const SceneDescriptor & sceneDescriptor, SceneState sceneState);
|
||||
SceneState getSceneState(const SceneDescriptor & sceneDescriptor, SceneState sceneState) const;
|
||||
|
||||
SpawnedSceneBase* spawnScene(const SceneDescriptor & sceneDescriptor);
|
||||
lumin::Node* spawn(const SceneDescriptor & sceneDescriptor);
|
||||
|
||||
private:
|
||||
|
||||
typedef SpawnedSceneBase* (*CreateSpawnedScene)(const SceneDescriptor& sceneDescriptor, lumin::Node* root);
|
||||
static const CreateSpawnedScene createSpawnedScene[scenes::numberOfExternalScenes];
|
||||
|
||||
typedef SpawnedSceneHandlers* (*CreateSpawnedSceneHandlers)(SpawnedSceneBase& spawnedScene);
|
||||
static const CreateSpawnedSceneHandlers createSpawnedSceneHandlers[scenes::numberOfExternalScenes];
|
||||
|
||||
static CreateSpawnedSceneUserData createSpawnedSceneUserData[scenes::numberOfExternalScenes];
|
||||
|
||||
private:
|
||||
|
||||
lumin::Node* createNodeTree(const SceneDescriptor & sceneDescriptor);
|
||||
|
||||
private:
|
||||
|
||||
lumin::Prism* prism_;
|
||||
SceneState sceneStates_[scenes::numberOfExternalScenes];
|
||||
std::string objectModelNames_[scenes::numberOfExternalScenes];
|
||||
};
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
//
|
||||
// THE CONTENTS OF THIS FILE IS GENERATED BY CODE AND
|
||||
// ANY MODIFICATIONS WILL BE OVERWRITTEN
|
||||
//
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
|
||||
// %BANNER_BEGIN%
|
||||
// ---------------------------------------------------------------------
|
||||
|
@ -17,6 +17,8 @@
|
|||
// ---------------------------------------------------------------------
|
||||
// %BANNER_END%
|
||||
|
||||
// %SRC_VERSION%: 1
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
@ -26,23 +28,31 @@
|
|||
class SceneDescriptor {
|
||||
public:
|
||||
|
||||
typedef std::map<std::string /* exportedNodeName */, const std::string& /* exportedNodeId */> ExportedNodeReferences;
|
||||
typedef std::map<std::string /* externalNodeName */, const std::string& /* externalNodeId */> ExternalNodeReferences;
|
||||
|
||||
SceneDescriptor(const char* exportedName, const char* id, const char* sceneGraphFilePath, const char* resourceModelFilePath, const ExportedNodeReferences& exportedNodeReferences, bool initiallyInstanced);
|
||||
const std::string& getExportedName() const;
|
||||
SceneDescriptor(int index, const char* externalName, const char* id, const char* sceneGraphFilePath, const char* resourceModelFilePath, const ExternalNodeReferences& externalNodeReferences, bool initiallySpawned);
|
||||
const std::string& getExternalName() const;
|
||||
const std::string& getId() const;
|
||||
const std::string& getSceneGraphPath() const;
|
||||
const std::string& getResourceModelPath() const;
|
||||
const ExportedNodeReferences & getExportedNodeReferences() const;
|
||||
bool getInitiallyInstanced() const;
|
||||
const ExternalNodeReferences & getExternalNodeReferences() const;
|
||||
bool getInitiallySpawned() const;
|
||||
|
||||
private:
|
||||
std::string exportedName_;
|
||||
|
||||
friend class PrismSceneManager;
|
||||
int getIndex() const;
|
||||
|
||||
private:
|
||||
|
||||
int index_;
|
||||
std::string externalName_;
|
||||
std::string id_;
|
||||
std::string sceneGraphPath_;
|
||||
std::string resourceModelPath_;
|
||||
const ExportedNodeReferences& exportedNodeReferences_;
|
||||
bool initiallyInstanced_;
|
||||
const ExternalNodeReferences& externalNodeReferences_;
|
||||
bool initiallySpawned_;
|
||||
};
|
||||
|
||||
typedef std::map<std::string /* exportedName */, const SceneDescriptor&> SceneDescriptorReferences;
|
||||
bool operator<(const SceneDescriptor& a, const SceneDescriptor& b);
|
||||
|
||||
|
|
63
support/magicleap/Servo2D/code/inc.gen/Servo2D/Servo2D.h
Normal file
63
support/magicleap/Servo2D/code/inc.gen/Servo2D/Servo2D.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
//
|
||||
// THE CONTENTS OF THIS FILE IS GENERATED BY CODE AND
|
||||
// ANY MODIFICATIONS WILL BE OVERWRITTEN
|
||||
//
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
|
||||
// %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
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SpawnedSceneBase.h>
|
||||
#include <SpawnedSceneHandlers.h>
|
||||
|
||||
#include <lumin/node/LineNode.h>
|
||||
#include <lumin/node/QuadNode.h>
|
||||
#include <lumin/ui/node/UiButton.h>
|
||||
#include <lumin/ui/node/UiPanel.h>
|
||||
#include <lumin/ui/node/UiTextEdit.h>
|
||||
|
||||
namespace scenes {
|
||||
|
||||
namespace Servo2D {
|
||||
|
||||
namespace externalNodes {
|
||||
extern const std::string contentPanel;
|
||||
extern const std::string content;
|
||||
extern const std::string backButton;
|
||||
extern const std::string fwdButton;
|
||||
extern const std::string urlBar;
|
||||
extern const std::string laser;
|
||||
}
|
||||
|
||||
struct SpawnedScene : public SpawnedSceneBase {
|
||||
SpawnedScene(const SceneDescriptor& sceneDescriptor, lumin::Node* root);
|
||||
~SpawnedScene();
|
||||
lumin::ui::UiPanel* contentPanel;
|
||||
lumin::QuadNode* content;
|
||||
lumin::ui::UiButton* backButton;
|
||||
lumin::ui::UiButton* fwdButton;
|
||||
lumin::ui::UiTextEdit* urlBar;
|
||||
lumin::LineNode* laser;
|
||||
};
|
||||
|
||||
SpawnedSceneBase* createSpawnedScene(const SceneDescriptor& sceneDescriptor, lumin::Node* root);
|
||||
SpawnedSceneHandlers* createSpawnedSceneHandlers(SpawnedSceneBase& spawnedScene);
|
||||
|
||||
extern const SceneDescriptor descriptor;
|
||||
}
|
||||
}
|
||||
|
43
support/magicleap/Servo2D/code/inc.gen/SpawnedSceneBase.h
Normal file
43
support/magicleap/Servo2D/code/inc.gen/SpawnedSceneBase.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
//
|
||||
// THE CONTENTS OF THIS FILE IS GENERATED BY CODE AND
|
||||
// ANY MODIFICATIONS WILL BE OVERWRITTEN
|
||||
//
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
|
||||
// %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
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lumin/node/Node.h>
|
||||
|
||||
class SceneDescriptor;
|
||||
class SpawnedSceneHandlers;
|
||||
struct SpawnedSceneUserData;
|
||||
|
||||
struct SpawnedSceneBase {
|
||||
SpawnedSceneBase(const SceneDescriptor &sd, lumin::Node* rt);
|
||||
virtual ~SpawnedSceneBase();
|
||||
|
||||
SpawnedSceneBase() = delete;
|
||||
SpawnedSceneBase(const SpawnedSceneBase&) = delete;
|
||||
SpawnedSceneBase(const SpawnedSceneBase&&) = delete;
|
||||
|
||||
const SceneDescriptor& sceneDescriptor;
|
||||
lumin::Node* root = nullptr;
|
||||
SpawnedSceneHandlers* handlers = nullptr;
|
||||
SpawnedSceneUserData* userData = nullptr;
|
||||
};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
//
|
||||
// THE CONTENTS OF THIS FILE IS GENERATED BY CODE AND
|
||||
// ANY MODIFICATIONS WILL BE OVERWRITTEN
|
||||
//
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
|
||||
// %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
|
||||
|
||||
#pragma once
|
||||
|
||||
struct SpawnedSceneBase;
|
||||
|
||||
class SpawnedSceneHandlers {
|
||||
public:
|
||||
SpawnedSceneHandlers(SpawnedSceneBase& ssb);
|
||||
virtual ~SpawnedSceneHandlers();
|
||||
};
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
//
|
||||
// THE CONTENTS OF THIS FILE IS GENERATED BY CODE AND
|
||||
// ANY MODIFICATIONS WILL BE OVERWRITTEN
|
||||
//
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
|
||||
// %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
|
||||
|
||||
#pragma once
|
||||
|
||||
struct SpawnedSceneUserData {
|
||||
virtual ~SpawnedSceneUserData();
|
||||
};
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
//
|
||||
// THE CONTENTS OF THIS FILE IS GENERATED BY CODE AND
|
||||
// ANY MODIFICATIONS WILL BE OVERWRITTEN
|
||||
//
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
// -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING --
|
||||
|
||||
// %BANNER_BEGIN%
|
||||
// ---------------------------------------------------------------------
|
||||
|
@ -17,20 +17,17 @@
|
|||
// ---------------------------------------------------------------------
|
||||
// %BANNER_END%
|
||||
|
||||
// %SRC_VERSION%: 1
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SceneDescriptor.h>
|
||||
|
||||
namespace Servo2D_exportedNodes {
|
||||
extern const std::string contentPanel;
|
||||
extern const std::string content;
|
||||
extern const std::string backButton;
|
||||
extern const std::string fwdButton;
|
||||
extern const std::string urlBar;
|
||||
extern const std::string laser;
|
||||
}
|
||||
#include <map>
|
||||
|
||||
namespace scenes {
|
||||
extern const SceneDescriptor Servo2D;
|
||||
extern const SceneDescriptorReferences exportedScenes;
|
||||
const int numberOfExternalScenes = 1;
|
||||
|
||||
typedef std::map<std::string /* externalName */, const SceneDescriptor& /* sceneDescription */> SceneDescriptorReferences;
|
||||
extern const SceneDescriptorReferences externalScenes;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue