OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
libvgcode::ViewerImpl::TranslucentTargets Struct Reference
Collaboration diagram for libvgcode::ViewerImpl::TranslucentTargets:

Public Member Functions

bool update (int width, int height)
void release ()
size_t size_in_bytes () const

Public Attributes

unsigned int fbo { 0 }
unsigned int accum_tex { 0 }
unsigned int reveal_tex { 0 }
unsigned int front_tex { 0 }
unsigned int depth_tex { 0 }
unsigned int front_depth_tex { 0 }
unsigned int front_depth_fbo { 0 }
std::array< int, 2 > size { 0, 0 }
bool unsupported { false }

Detailed Description

Member Function Documentation

◆ release()

void libvgcode::ViewerImpl::TranslucentTargets::release ( )
2546{
2547 for (unsigned int* id : { &fbo, &front_depth_fbo }) {
2548 if (*id != 0) {
2550 *id = 0;
2551 }
2552 }
2558 size = { 0, 0 };
2559}
#define glsafe(cmd)
Definition OpenGLUtils.hpp:25
#define glDeleteFramebuffers
Definition gl.h:3565
static void delete_textures(unsigned int &id)
Definition ViewerImpl.cpp:285
unsigned int front_tex
Definition ViewerImpl.hpp:602
unsigned int depth_tex
Definition ViewerImpl.hpp:604
unsigned int front_depth_fbo
Definition ViewerImpl.hpp:607
unsigned int reveal_tex
Definition ViewerImpl.hpp:600
std::array< int, 2 > size
Definition ViewerImpl.hpp:608
unsigned int fbo
Definition ViewerImpl.hpp:598
unsigned int accum_tex
Definition ViewerImpl.hpp:599
unsigned int front_depth_tex
Definition ViewerImpl.hpp:606

References accum_tex, libvgcode::delete_textures(), depth_tex, fbo, front_depth_fbo, front_depth_tex, front_tex, glDeleteFramebuffers, glsafe, reveal_tex, and size.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size_in_bytes()

size_t libvgcode::ViewerImpl::TranslucentTargets::size_in_bytes ( ) const
2562{
2563 // RGBA16F, R16F, RGBA16F, a 24 bit depth and R32F
2564 return static_cast<size_t>(size[0]) * static_cast<size_t>(size[1]) * (8 + 2 + 8 + 4 + 4);
2565}

References size.

◆ update()

bool libvgcode::ViewerImpl::TranslucentTargets::update ( int width,
int height )
2490{
2491 if (unsupported || width <= 0 || height <= 0)
2492 return false;
2493 if (fbo != 0 && size[0] == width && size[1] == height)
2494 return true;
2495
2496 release();
2497 size = { width, height };
2498
2499 int curr_texture = 0;
2500 int curr_draw_fbo = 0;
2501 int curr_read_fbo = 0;
2505
2506 auto make_texture = [width, height](unsigned int& id, GLenum internal_format, GLenum format, GLenum type) {
2507 glsafe(glGenTextures(1, &id));
2512 glsafe(glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, type, nullptr));
2513 };
2515
2517 make_texture(accum_tex, GL_RGBA16F, GL_RGBA, GL_FLOAT);
2518 make_texture(reveal_tex, GL_R16F, GL_RED, GL_FLOAT);
2519 make_texture(front_tex, GL_RGBA16F, GL_RGBA, GL_FLOAT);
2520 make_texture(front_depth_tex, GL_R32F, GL_RED, GL_FLOAT);
2524 glsafe(glDrawBuffers(1, buffers));
2531 glsafe(glDrawBuffers(3, buffers));
2533
2534 glsafe(glBindTexture(GL_TEXTURE_2D, curr_texture));
2537
2538 if (!complete) {
2539 release();
2540 unsupported = true;
2541 }
2542 return complete;
2543}
#define GL_TEXTURE_MIN_FILTER
Definition gl.h:1828
#define glCheckFramebufferStatus
Definition gl.h:3349
#define GL_RGBA16F
Definition gl.h:1496
#define glFramebufferTexture2D
Definition gl.h:3755
#define GL_TEXTURE_MAX_LEVEL
Definition gl.h:1826
#define GL_COLOR_ATTACHMENT0
Definition gl.h:360
#define glTexParameteri
Definition gl.h:4911
#define GL_COLOR_ATTACHMENT2
Definition gl.h:380
#define GL_R32F
Definition gl.h:1395
#define GL_UNSIGNED_INT
Definition gl.h:1940
#define GL_FLOAT
Definition gl.h:660
#define GL_COLOR_ATTACHMENT1
Definition gl.h:362
#define glGetIntegerv
Definition gl.h:3873
#define GL_FRAMEBUFFER_COMPLETE
Definition gl.h:732
#define glTexImage2D
Definition gl.h:4895
#define glBindFramebuffer
Definition gl.h:3281
#define GL_RED
Definition gl.h:1414
#define GL_DRAW_FRAMEBUFFER
Definition gl.h:617
#define GL_NEAREST
Definition gl.h:1200
unsigned int GLenum
Definition gl.h:2054
#define glGenTextures
Definition gl.h:3787
#define GL_R16F
Definition gl.h:1391
#define glBindTexture
Definition gl.h:3299
#define GL_FRAMEBUFFER
Definition gl.h:708
#define GL_RGBA
Definition gl.h:1493
#define GL_DEPTH_COMPONENT
Definition gl.h:561
#define GL_DRAW_FRAMEBUFFER_BINDING
Definition gl.h:618
#define GL_READ_FRAMEBUFFER
Definition gl.h:1405
#define GL_TEXTURE_MAG_FILTER
Definition gl.h:1822
#define GL_TEXTURE_2D
Definition gl.h:1739
#define GL_DEPTH_COMPONENT24
Definition gl.h:563
#define glDrawBuffers
Definition gl.h:3631
#define GL_TEXTURE_BINDING_2D
Definition gl.h:1749
#define GL_READ_FRAMEBUFFER_BINDING
Definition gl.h:1406
#define glGenFramebuffers
Definition gl.h:3771
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:1184
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:1185
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:45
bool unsupported
Definition ViewerImpl.hpp:609
void release()
Definition ViewerImpl.cpp:2545

References accum_tex, depth_tex, fbo, front_depth_fbo, front_depth_tex, front_tex, GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT24, GL_DRAW_FRAMEBUFFER, GL_DRAW_FRAMEBUFFER_BINDING, GL_FLOAT, GL_FRAMEBUFFER, GL_FRAMEBUFFER_COMPLETE, GL_NEAREST, GL_R16F, GL_R32F, GL_READ_FRAMEBUFFER, GL_READ_FRAMEBUFFER_BINDING, GL_RED, GL_RGBA, GL_RGBA16F, GL_TEXTURE_2D, GL_TEXTURE_BINDING_2D, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MAX_LEVEL, GL_TEXTURE_MIN_FILTER, GL_UNSIGNED_INT, glBindFramebuffer, glBindTexture, glCheckFramebufferStatus, glDrawBuffers, glFramebufferTexture2D, glGenFramebuffers, glGenTextures, glGetIntegerv, glsafe, glTexImage2D, glTexParameteri, release(), reveal_tex, size, and unsupported.

Here is the call graph for this function:

Member Data Documentation

◆ accum_tex

unsigned int libvgcode::ViewerImpl::TranslucentTargets::accum_tex { 0 }

◆ depth_tex

unsigned int libvgcode::ViewerImpl::TranslucentTargets::depth_tex { 0 }

◆ fbo

unsigned int libvgcode::ViewerImpl::TranslucentTargets::fbo { 0 }

◆ front_depth_fbo

unsigned int libvgcode::ViewerImpl::TranslucentTargets::front_depth_fbo { 0 }

◆ front_depth_tex

unsigned int libvgcode::ViewerImpl::TranslucentTargets::front_depth_tex { 0 }

◆ front_tex

unsigned int libvgcode::ViewerImpl::TranslucentTargets::front_tex { 0 }

◆ reveal_tex

unsigned int libvgcode::ViewerImpl::TranslucentTargets::reveal_tex { 0 }

◆ size

std::array<int, 2> libvgcode::ViewerImpl::TranslucentTargets::size { 0, 0 }
608{ 0, 0 };

Referenced by release(), size_in_bytes(), and update().

◆ unsupported

bool libvgcode::ViewerImpl::TranslucentTargets::unsupported { false }
609{ false };

Referenced by update().


The documentation for this struct was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libvgcode/src/ViewerImpl.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libvgcode/src/ViewerImpl.cpp