MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / Bind

Method Bind

GTE/Graphics/GraphicsEngine.cpp:147–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147GEObject* GraphicsEngine::Bind(std::shared_ptr<GraphicsObject> const& object)
148{
149 LogAssert(object != nullptr, "Attempt to bind a null object.");
150
151 mGOMapMutex.lock();
152 GraphicsObject const* gtObject = object.get();
153 GEObject* geObjectPtr = nullptr;
154 auto iter = mGOMap.find(gtObject);
155 if (iter == mGOMap.end())
156 {
157 // The 'create' function is not null with the current engine design.
158 // If the assertion is triggered, someone changed the hierarchy of
159 // GraphicsObjectType but did not change msCreateFunctions[] to match.
160 CreateGEObject create = mCreateGEObject[object->GetType()];
161 if (create)
162 {
163 auto geObject = create(mGEObjectCreator, gtObject);
164 LogAssert(geObject != nullptr, "Unexpected condition.");
165
166 iter = mGOMap.insert(std::make_pair(gtObject, geObject)).first;
167#if defined(GTE_GRAPHICS_USE_NAMED_OBJECTS)
168 geObject->SetName(object->GetName());
169#endif
170 geObjectPtr = iter->second.get();
171 }
172 // else: No logger message is generated here because GL4 does not have
173 // shader creation functions.
174 }
175 else
176 {
177 geObjectPtr = iter->second.get();
178 }
179 mGOMapMutex.unlock();
180 return geObjectPtr;
181}
182
183GEDrawTarget* GraphicsEngine::Bind(std::shared_ptr<DrawTarget> const& target)
184{

Callers

nothing calls this directly

Calls 7

endMethod · 0.80
GetNameMethod · 0.80
GetTypeMethod · 0.45
SetNameMethod · 0.45
GetNumTargetsMethod · 0.45
GetRTTextureMethod · 0.45
GetDSTextureMethod · 0.45

Tested by

no test coverage detected