Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
#pragma once
|
|
// Scene files (.mrscene): which models, stages, motions and audio make up a scene, how they are
|
|
// placed and posed, and the editor's view settings. JSON, with file paths stored relative to the
|
|
// scene file so a project folder can be moved or shared as a whole.
|
|
#include "model/Poser.h"
|
|
#include "scene/LookSettings.h"
|
|
|
|
#include <osg/Vec3d>
|
|
#include <osg/Vec3f>
|
|
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace mr {
|
|
|
|
struct SceneModel {
|
|
std::string path; // absolute in memory
|
|
bool stage = false, visible = true;
|
|
osg::Vec3f position;
|
|
float rotationY = 0.f; // degrees
|
|
float scale = 1.f;
|
|
std::string motionPath;
|
|
std::vector<std::pair<std::string, BonePose>> bonePoses; // by bone name; non-rest poses only
|
|
std::vector<std::pair<std::string, float>> morphWeights; // by morph name; non-zero only
|
|
};
|
|
|
|
struct SceneView {
|
|
bool valid = false;
|
|
osg::Vec3d eye, center, up{0.0, 0.0, 1.0};
|
|
};
|
|
|
|
struct Scene {
|
|
std::vector<SceneModel> models;
|
|
int activeModel = -1;
|
|
std::string cameraMotionPath, audioPath;
|
|
float frame = 0.f;
|
|
bool loop = true, followCamera = true;
|
|
float volume = 1.f;
|
|
SceneView view;
|
|
|
|
bool showGrid = true, physics = true, ik = true, gpuSkinning = true;
|
|
bool skeleton = false, wireframe = false, backfaceCulling = true;
|
|
LookSettings look;
|
|
|
|
int renderWidth = 1920, renderHeight = 1080;
|
|
bool renderTransparent = false, renderMp4 = true, renderAudio = true;
|
|
};
|
|
|
|
constexpr int kSceneFormatVersion = 1;
|
|
|
|
bool saveScene(const Scene& scene, const std::string& path, std::string& error);
|
|
bool loadScene(const std::string& path, Scene& scene, std::string& error);
|
|
|
|
} // namespace mr
|