53 Bind(mActiveFont->GetVertexBuffer());
54 Bind(mActiveFont->GetIndexBuffer());
55 Bind(mActiveFont->GetTextEffect()->GetTranslate());
56 Bind(mActiveFont->GetTextEffect()->GetColor());
57 Bind(mActiveFont->GetTextEffect()->GetVertexShader());
58 Bind(mActiveFont->GetTextEffect()->GetPixelShader());
74 if (vbuffer && ibuffer && effect)
86 uint64_t numPixelsDrawn = 0;
87 for (
auto const& visual : visuals)
89 numPixelsDrawn +=
Draw(visual);
91 return numPixelsDrawn;
96 return Draw(visual.get());
101 uint64_t numPixelsDrawn = 0;
102 for (
auto const& visual : visuals)
104 numPixelsDrawn +=
Draw(visual);
106 return numPixelsDrawn;
111 uint64_t numPixelsDrawn;
113 if (message.length() > 0)
117 mActiveFont->Typeset(vw, vh, x, y, color, message);
144 return numPixelsDrawn;
151 auto const& vbuffer = overlay->GetVertexBuffer();
152 auto const& ibuffer = overlay->GetIndexBuffer();
153 auto const& effect = overlay->GetEffect();
154 if (vbuffer && ibuffer && effect)
168 LogError(
"Attempt to bind a null object.");
173 std::shared_ptr<GEObject> geObject;
174 if (!
mGOMap.Get(gtObject, geObject))
188 LogAssert(geObject,
"Null object. Out of memory?");
190 mGOMap.Insert(gtObject, geObject);
191 #if defined(GTE_GRAPHICS_USE_NAMED_OBJECTS) 192 geObject->SetName(object->GetName());
195 return geObject.get();
201 std::shared_ptr<GEDrawTarget> geTarget;
202 if (!
mDTMap.Get(gtTarget, geTarget))
205 std::vector<GEObject*> rtTextures(numTargets);
206 for (
unsigned int i = 0; i < numTargets; ++i)
208 rtTextures[i] =
static_cast<GEObject*
>(
Bind(target->GetRTTexture(i)));
211 std::shared_ptr<TextureDS>
object = target->GetDSTexture();
223 mDTMap.Insert(gtTarget, geTarget);
225 return geTarget.get();
231 std::shared_ptr<GEObject> geObject;
232 if (
mGOMap.Get(gtObject, geObject))
234 return geObject.get();
242 std::shared_ptr<GEDrawTarget> geTarget;
243 if (!
mDTMap.Get(gtTarget, geTarget))
247 return geTarget.get();
254 std::vector<std::shared_ptr<GEObject>> objects;
255 mGOMap.GatherAll(objects);
256 for (
auto object : objects)
260 auto resource =
dynamic_cast<Resource*
>(
object->GetGraphicsObject());
293 if (
mGOMap.Get(
object, dxObject))
295 GraphicsObjectType
type =
object->GetType();
298 mILMap->Unbind(static_cast<VertexBuffer const*>(
object));
302 mILMap->Unbind(static_cast<Shader const*>(
object));
305 if (
mGOMap.Remove(
object, dxObject))
315 std::shared_ptr<GEDrawTarget> dxTarget =
nullptr;
316 if (
mDTMap.Remove(target, dxTarget))
std::shared_ptr< RasterizerState > mDefaultRasterizerState
ThreadSafeMap< GraphicsObject const *, std::shared_ptr< GEObject > > mGOMap
std::shared_ptr< Font > mActiveFont
std::array< CreateGEObject, GT_NUM_TYPES > mCreateGEObject
void GetTotalAllocation(size_t &numBytes, size_t &numObjects) const
virtual void SetDepthStencilState(std::shared_ptr< DepthStencilState > const &state)=0
CreateGEDrawTarget mCreateGEDrawTarget
#define LogAssert(condition, message)
DTListener(GraphicsEngine *engine)
GEObject * Get(std::shared_ptr< GraphicsObject > const &object) const
std::shared_ptr< VertexBuffer > const & GetVertexBuffer() const
std::unique_ptr< GEInputLayoutManager > mILMap
void SetDefaultDepthStencilState()
virtual void SetFont(std::shared_ptr< Font > const &font) override
std::shared_ptr< GOListener > mGOListener
bool Unbind(std::shared_ptr< GraphicsObject > const &object)
virtual bool Update(std::shared_ptr< Buffer > const &buffer)=0
virtual void DestroyDefaultGlobalState()
static void SubscribeForDestruction(std::shared_ptr< ListenerForDestruction > const &listener)
GLsizei const GLchar *const * string
#define LogError(message)
std::shared_ptr< IndexBuffer > const & GetIndexBuffer() const
std::shared_ptr< VisualEffect > const & GetEffect() const
unsigned int GetNumTargets() const
virtual void OnDestroy(DrawTarget const *target)
virtual ~GraphicsEngine()
ThreadSafeMap< DrawTarget const *, std::shared_ptr< GEDrawTarget > > mDTMap
virtual void SetBlendState(std::shared_ptr< BlendState > const &state)=0
GLuint GLsizei const GLchar * message
#define LogWarning(message)
unsigned int GetNumBytes() const
GOListener(GraphicsEngine *engine)
std::shared_ptr< BlendState > const & GetBlendState() const
GEObject * Bind(std::shared_ptr< GraphicsObject > const &object)
uint64_t Draw(Visual *visual)
std::shared_ptr< DepthStencilState > const & GetDepthStencilState() const
virtual void SetRasterizerState(std::shared_ptr< RasterizerState > const &state)=0
virtual void GetViewport(int &x, int &y, int &w, int &h) const =0
static void SubscribeForDestruction(std::shared_ptr< ListenerForDestruction > const &listener)
std::shared_ptr< GEObject >(* CreateGEObject)(void *, GraphicsObject const *)
std::shared_ptr< BlendState > mDefaultBlendState
virtual void OnDestroy(GraphicsObject const *object)
virtual void DestroyDefaultGlobalState()
std::shared_ptr< RasterizerState > const & GetRasterizerState() const
void SetDefaultBlendState()
bool mAllowOcclusionQuery
bool mWarnOnNonemptyBridges
std::shared_ptr< DepthStencilState > mDefaultDepthStencilState
std::shared_ptr< DTListener > mDTListener
void SetDefaultRasterizerState()
virtual uint64_t DrawPrimitive(std::shared_ptr< VertexBuffer > const &vbuffer, std::shared_ptr< IndexBuffer > const &ibuffer, std::shared_ptr< VisualEffect > const &effect)=0
GLint GLint GLsizei GLint GLenum GLenum type