| 54 | NotebookScene::~NotebookScene() = default; |
| 55 | |
| 56 | bool NotebookScene::Load() |
| 57 | { |
| 58 | RString modelPath = FindShape(RString(kNotebookModel)); |
| 59 | if (modelPath.GetLength() == 0) |
| 60 | { |
| 61 | LOG_ERROR(Core, "NotebookScene: cannot find model {}", kNotebookModel); |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | _shape = Shapes.New(modelPath, false, false); |
| 66 | if (!_shape || _shape->NLevels() <= 0) |
| 67 | { |
| 68 | LOG_ERROR(Core, "NotebookScene: shape {} failed to load", (const char*)modelPath); |
| 69 | return false; |
| 70 | } |
| 71 | |
| 72 | // Match ControlObject + ControlObjectContainerAnim setup so the |
| 73 | // engine treats this exactly like the options menu notebook. |
| 74 | _shape->LevelOpaque(0)->MakeCockpit(); |
| 75 | _shape->OrSpecial(BestMipmap | NoDropdown | DisableSun); |
| 76 | _shape->SetAutoCenter(false); |
| 77 | _shape->CalculateBoundingSphere(); |
| 78 | _shape->AllowAnimation(); |
| 79 | |
| 80 | // Build skeleton + open animation. |
| 81 | _skeleton = new Skeleton(); |
| 82 | AnimationRTName name; |
| 83 | name.name = GetAnimationName(RString(kNotebookAnim)); |
| 84 | name.skeleton = _skeleton; |
| 85 | _animation = new AnimationRT(name, false); |
| 86 | _animation->Prepare(_shape, _skeleton, _weights, false); |
| 87 | |
| 88 | // Static frame transform — OptTplNotebook's direction/up vectors. |
| 89 | SetPosition(NotebookFarPosition()); |
| 90 | SetOrient(Vector3(0.0f, kSin30, kCos30), Vector3(0.0f, kCos30, -kSin30)); |
| 91 | SetScale(1.0f); |
| 92 | |
| 93 | _loaded = true; |
| 94 | LOG_INFO(Core, "NotebookScene: loaded {} + {}", kNotebookModel, kNotebookAnim); |
| 95 | return true; |
| 96 | } |
| 97 | |
| 98 | void NotebookScene::Tick(float deltaT) |
| 99 | { |
no test coverage detected