HDK
|
#include <drawTarget.h>
Classes | |
class | Attachment |
class | AttachmentsContainer |
Public Types | |
typedef GlfDrawTarget | This |
typedef TfDeclarePtrs< class Attachment >::RefPtr | AttachmentRefPtr |
typedef std::map< std::string, AttachmentRefPtr > | AttachmentsMap |
Public Types inherited from TfRefBase | |
typedef void(* | UniqueChangedFuncPtr )(TfRefBase const *, bool) |
Public Member Functions | |
GLF_API void | AddAttachment (std::string const &name, GLenum format, GLenum type, GLenum internalFormat) |
Add an attachment to the DrawTarget. More... | |
GLF_API void | DeleteAttachment (std::string const &name) |
Removes the named attachment from the DrawTarget. More... | |
GLF_API void | ClearAttachments () |
Clears all the attachments for this DrawTarget. More... | |
GLF_API void | CloneAttachments (GlfDrawTargetPtr const &drawtarget) |
Copies the list of attachments from DrawTarget. More... | |
GLF_API AttachmentsMap const & | GetAttachments () const |
Returns the list of Attachments for this DrawTarget. More... | |
GLF_API AttachmentRefPtr | GetAttachment (std::string const &name) |
Returns the attachment with a given name or TfNullPtr;. More... | |
GLF_API bool | WriteToFile (std::string const &name, std::string const &filename, GfMatrix4d const &viewMatrix=GfMatrix4d(1), GfMatrix4d const &projectionMatrix=GfMatrix4d(1)) |
Write the Attachment buffer to an image file (debugging). More... | |
GLF_API void | SetSize (GfVec2i) |
Resize the DrawTarget. More... | |
GfVec2i const & | GetSize () const |
Returns the size of the DrawTarget. More... | |
bool | HasMSAA () const |
Returns if the draw target uses msaa. More... | |
GLF_API GLuint | GetFramebufferId () const |
Returns the framebuffer object Id. More... | |
GLF_API GLuint | GetFramebufferMSId () const |
Returns the id of the framebuffer object with MSAA buffers. More... | |
GLF_API void | Bind () |
Binds the framebuffer. More... | |
GLF_API void | Unbind () |
Unbinds the framebuffer. More... | |
GLF_API bool | IsBound () const |
Returns whether the framebuffer is currently bound. More... | |
GLF_API void | Resolve () |
GLF_API void | TouchContents () |
GLF_API bool | IsValid (std::string *reason=NULL) |
Public Member Functions inherited from TfRefBase | |
TfRefBase () | |
TfRefBase (TfRefBase const &) | |
TfRefBase & | operator= (TfRefBase const &) |
size_t | GetCurrentCount () const |
Return the current reference count of this object. More... | |
bool | IsUnique () const |
Return true if only one TfRefPtr points to this object. More... | |
void | SetShouldInvokeUniqueChangedListener (bool shouldCall) |
Public Member Functions inherited from TfWeakBase | |
TfWeakBase () | |
TfWeakBase (const TfWeakBase &) | |
const TfWeakBase & | __GetTfWeakBase__ () const |
const TfWeakBase & | operator= (const TfWeakBase &) |
void | EnableNotification2 () const |
TF_API void const * | GetUniqueIdentifier () const |
Static Public Member Functions | |
static GLF_API GlfDrawTargetRefPtr | New (GfVec2i const &size, bool requestMSAA=false) |
Returns a new instance. More... | |
static GLF_API GlfDrawTargetRefPtr | New (GlfDrawTargetPtr const &drawtarget) |
static GLF_API void | Resolve (const std::vector< GlfDrawTarget * > &drawTargets) |
Static Public Member Functions inherited from TfRefBase | |
static TF_API void | SetUniqueChangedListener (UniqueChangedListener listener) |
Protected Member Functions | |
GLF_API | GlfDrawTarget (GfVec2i const &size, bool requestMSAA) |
GLF_API | GlfDrawTarget (GlfDrawTargetPtr const &drawtarget) |
virtual GLF_API | ~GlfDrawTarget () |
Protected Member Functions inherited from TfRefBase | |
virtual TF_API | ~TfRefBase () |
Protected Member Functions inherited from TfWeakBase | |
~TfWeakBase () | |
TfRefPtr< Tf_Remnant > | _Register () const |
template<class T > | |
TfRefPtr< Tf_Remnant > | _Register (T *tempRmnt) const |
bool | _HasRemnant () const |
A class representing a GL render target with mutliple image attachments.
A DrawTarget is essentially a custom render pass into which several arbitrary variables can be output into. These can later be used as texture samplers by GLSL shaders.
The DrawTarget maintains a map of named attachments that correspond to GL_TEXTURE_2D mages. By default, DrawTargets also create a depth component that is used both as a depth buffer during the draw pass, and can later be accessed as a regular GL_TEXTURE_2D data. Stencils are also available (by setting the format to GL_DEPTH_STENCIL and the internalFormat to GL_DEPTH24_STENCIL8)
Definition at line 67 of file drawTarget.h.
typedef TfDeclarePtrs<class Attachment>::RefPtr GlfDrawTarget::AttachmentRefPtr |
Definition at line 158 of file drawTarget.h.
typedef std::map<std::string, AttachmentRefPtr> GlfDrawTarget::AttachmentsMap |
Definition at line 160 of file drawTarget.h.
typedef GlfDrawTarget GlfDrawTarget::This |
Definition at line 69 of file drawTarget.h.
|
protected |
|
protectedvirtual |
GLF_API void GlfDrawTarget::AddAttachment | ( | std::string const & | name, |
GLenum | format, | ||
GLenum | type, | ||
GLenum | internalFormat | ||
) |
Add an attachment to the DrawTarget.
Copies the list of attachments from DrawTarget.
GLF_API void GlfDrawTarget::DeleteAttachment | ( | std::string const & | name | ) |
Removes the named attachment from the DrawTarget.
GLF_API AttachmentRefPtr GlfDrawTarget::GetAttachment | ( | std::string const & | name | ) |
Returns the attachment with a given name or TfNullPtr;.
GLF_API AttachmentsMap const& GlfDrawTarget::GetAttachments | ( | ) | const |
Returns the list of Attachments for this DrawTarget.
Returns the id of the framebuffer object with MSAA buffers.
|
inline |
Returns the size of the DrawTarget.
Definition at line 199 of file drawTarget.h.
|
inline |
Returns if the draw target uses msaa.
Definition at line 202 of file drawTarget.h.
GLF_API bool GlfDrawTarget::IsBound | ( | ) | const |
Returns whether the framebuffer is currently bound.
GLF_API bool GlfDrawTarget::IsValid | ( | std::string * | reason = NULL | ) |
Returns whether the enclosed framebuffer object is complete. If reason is non-NULL, and this framebuffer is not valid, sets reason to the reason why not.
|
static |
Returns a new instance.
|
static |
Returns a new instance. GL framebuffers cannot be shared across contexts, but texture attachments can. In order to reflect this, GlfDrawTargets hold onto their maps of attachments through a RefPtr that can be shared by multiple GlfDrawTargets, one for each of the active GL contexts (ex. one for each active QT viewer). This constructor creates a new framebuffer, but populates its map of attachments by sharing the RefPtr of the source GlfDrawTarget.
Resolve the MSAA framebuffer to a regular framebuffer. If there is no MSAA enabled, this function does nothing.
|
static |
Resolve several MSAA framebuffers at once. If any framebuffers don't have MSAA enabled, nothing happens to them.
Updates the contents signature for attached textures to allow downstream consumers to know that the texture image data may have changed.
GLF_API bool GlfDrawTarget::WriteToFile | ( | std::string const & | name, |
std::string const & | filename, | ||
GfMatrix4d const & | viewMatrix = GfMatrix4d(1) , |
||
GfMatrix4d const & | projectionMatrix = GfMatrix4d(1) |
||
) |
Write the Attachment buffer to an image file (debugging).