Program Listing for File SceneNode.h

Program Listing for File SceneNode.h#

Return to documentation for file (include/Karana/Scene/SceneNode.h)

/*
*Copyright(c)2024-2025KaranaDynamicsPtyLtd.Allrightsreserved.
*
*NOTICETOUSER:
*
*Thissourcecodeand/ordocumentation(the"LicensedMaterials")is
*theconfidentialandproprietaryinformationofKaranaDynamicsInc.
*UseoftheseLicensedMaterialsisgovernedbythetermsandconditions
*ofaseparatesoftwarelicenseagreementbetweenKaranaDynamicsandthe
*Licensee("LicenseAgreement").Unlessexpresslypermittedunderthat
*agreement,anyreproduction,modification,distribution,ordisclosure
*oftheLicensedMaterials,inwholeorinpart,toanythirdparty
*withoutthepriorwrittenconsentofKaranaDynamicsisstrictlyprohibited.
*
*THELICENSEDMATERIALSAREPROVIDED"ASIS"WITHOUTWARRANTYOFANYKIND.
*KARANADYNAMICSDISCLAIMSALLWARRANTIES,EXPRESSORIMPLIED,INCLUDING
*BUTNOTLIMITEDTOWARRANTIESOFMERCHANTABILITY,NON-INFRINGEMENT,AND
*FITNESSFORAPARTICULARPURPOSE.
*
*INNOEVENTSHALLKARANADYNAMICSBELIABLEFORANYDAMAGESWHATSOEVER,
*INCLUDINGBUTNOTLIMITEDTOLOSSOFPROFITS,DATA,ORUSE,EVENIF
*ADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGES,WHETHERINCONTRACT,TORT,
*OROTHERWISEARISINGOUTOFORINCONNECTIONWITHTHELICENSEDMATERIALS.
*
*U.S.GovernmentEndUsers:TheLicensedMaterialsarea"commercialitem"
*asdefinedat48C.F.R.2.101,andareprovidedtotheU.S.Government
*onlyasacommercialenditemunderthetermsofthislicense.
*
*AnyuseoftheLicensedMaterialsinindividualorcommercialsoftwaremust
*include,intheuserdocumentationandinternalsourcecodecomments,
*thisNotice,Disclaimer,andU.S.GovernmentUseProvision.
*/


#pragmaonce
#include"Karana/KCore/Base.h"
#include"Karana/KCore/DataCache.h"
#include"Karana/KCore/RegistryList.h"
#include"Karana/KCore/SharedPointer.h"
#include"Karana/Math/Defs.h"
#include"Karana/Math/SimTran.h"
#include"Karana/Math/UnitQuaternion.h"

namespaceKarana::Scene{
classScene;
classSceneNode:publicKarana::Core::Base{
protected:
SceneNode(std::string_viewname,constKarana::Core::ks_ptr<Scene>&scene);

public:
virtual~SceneNode();

staticKarana::Core::ks_ptr<SceneNode>create(std::string_viewname,
constKarana::Core::ks_ptr<Scene>&scene);

staticvoiddiscardNonRecursive(Karana::Core::ks_ptr<SceneNode>&node);

constKarana::Math::Vec3&getTranslation()const;

virtualvoidsetTranslation(constKarana::Math::Vec3&translation);

constKarana::Math::UnitQuaternion&getUnitQuaternion()const;

virtualvoidsetUnitQuaternion(constKarana::Math::UnitQuaternion&quaternion);

doublegetScale()const;

virtualvoidsetScale(doublescale);

constKarana::Math::SimTran&getTransform()const;

constKarana::Math::SimTran&getWorldTransform()const;

constKarana::Math::Vec3&getWorldTranslation()const;

constKarana::Math::UnitQuaternion&getWorldUnitQuaternion()const;

doublegetWorldScale()const;

constKarana::Core::ks_ptr<SceneNode>&parent()const;

virtualvoidattachTo(constKarana::Core::ks_ptr<SceneNode>&parent,
boolmaintain_world_transform=false);

virtualvoiddetach(boolmaintain_world_transform=false);

Karana::Core::RegistryList<SceneNode>children();

virtualvoidsetVisible(boolvisible);

boolgetVisible()const;

Karana::Core::ks_ptr<SceneNode>getManager()const;

voidsetManager(constKarana::Core::ks_ptr<SceneNode>&manager);

protected:
virtualvoid_computeWorldTransform(Karana::Math::SimTran&transform)const;

Karana::Core::ks_ptr<Karana::Core::DataCache<Karana::Math::SimTran>>_world_transform_cache;

void_discard(Karana::Core::ks_ptr<Base>&base)override;

std::weak_ptr<SceneNode>_manager;

private:
Karana::Math::SimTran_object_transform{};
Karana::Core::ks_ptr<SceneNode>_parent{};
Karana::Core::RegistryList<SceneNode>_children{};
bool_visible=true;

std::weak_ptr<Scene>_scene;
};
}//namespaceKarana::Scene