@@ -44,21 +44,23 @@ class AssetBootstrap : public es::EmptySystem
4444 // We are guaranteed that CoreBootstrap ran one frame prior. So we will
4545 // have access to all of the rendering subsystems.
4646
47- // Will need to replace this with a static entity in the future.
48- SRInterface* iface = core.getStaticComponent <StaticSRInterface >()->interface_ ;
49- ren::GeomMan* geomMan = core. getStaticComponent <ren::StaticGeomMan>()-> instance . get ();
50- ren::ShaderMan* shaderMan = core.getStaticComponent <ren::StaticShaderMan>()->instance . get () ;
47+ std::weak_ptr<ren::GeomMan> gm =
48+ core.getStaticComponent <ren::StaticGeomMan >()->instance_ ;
49+ std::weak_ptr <ren::ShaderMan> sm =
50+ core.getStaticComponent <ren::StaticShaderMan>()->instance_ ;
5151
5252 // A cached entity so that our VBOs and IBOs will not get garbage collected.
5353 uint64_t cachedEntity = 0 ;
5454 cachedEntity = gen::StaticObjRefID::getNewObjectID (core);
55-
56- // Load geometry and associated vertex and fragment shaders.
57- geomMan->loadGeometry (core, cachedEntity, " Assets/arrow.geom" );
58- geomMan->loadGeometry (core, cachedEntity, " Assets/sphere.geom" );
59-
60- // Load shader we will use with the coordinate axes.
61- shaderMan->loadVertexAndFragmentShader (core, cachedEntity, " Shaders/DirPhong" );
55+ if (std::shared_ptr<ren::GeomMan> geomMan = gm.lock ()) {
56+ // Load geometry and associated vertex and fragment shaders.
57+ geomMan->loadGeometry (core, cachedEntity, " Assets/arrow.geom" );
58+ geomMan->loadGeometry (core, cachedEntity, " Assets/sphere.geom" );
59+ }
60+ if (std::shared_ptr<ren::ShaderMan> shaderMan = sm.lock ()) {
61+ // Load shader we will use with the coordinate axes.
62+ shaderMan->loadVertexAndFragmentShader (core, cachedEntity, " Shaders/DirPhong" );
63+ }
6264
6365 // Note: We don't need to strictly store the coordinate axes entity.
6466 // We are really only after its VBO / IBO.
0 commit comments