Switching SceneItems to smarts

This commit is contained in:
2023-11-12 23:02:11 -06:00
parent e540efb726
commit ba185e9fe4
124 changed files with 185 additions and 775 deletions

View File

@ -14,7 +14,7 @@ std::shared_ptr<UICanvas> UICanvas::create(Scene *scene) {
return item->addComponent<UICanvas>();
}
UICanvas::UICanvas(SceneItem *item) :
UICanvas::UICanvas(std::weak_ptr<SceneItem> item) :
SceneItemComponent(item),
camera(nullptr)
{
@ -26,7 +26,7 @@ void UICanvas::rebufferShaderParameters() {
switch(this->drawType) {
case UI_DRAW_TYPE_WORLD_ABSOLUTE:
data.projection = camera->getProjection();
data.view = camera->item->getWorldTransform();
data.view = camera->item.lock()->getWorldTransform();
break;
case UI_DRAW_TYPE_WORLD_CAMERA_RELATIVE:
@ -91,7 +91,7 @@ void UICanvas::onStart() {
this->h = h / this->getScale();
this->rebufferShaderParameters();
auto comps = this->item->findChildren<UIComponent>();
auto comps = this->item.lock()->findChildren<UIComponent>();
auto itComps = comps.begin();
while(itComps != comps.end()) {
(*itComps)->alignmentNeedsUpdating = true;