OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::SceneCache Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/SceneCache.hpp>

Collaboration diagram for Slic3r::GUI::SceneCache:

Classes

struct  Key

Public Member Functions

void capture (Key key)
bool matches (const Key &key) const
void render (GLModel &quad)
void invalidate ()
void reset ()

Private Attributes

unsigned int m_texture_id { 0 }
std::array< unsigned int, 2 > m_texture_size { { 0, 0 } }
Key m_key
bool m_valid { false }

Detailed Description

Member Function Documentation

◆ capture()

void Slic3r::GUI::SceneCache::capture ( Key key)
18{
19 m_valid = false;
20
21 if (wxGetApp().get_shader("flat_texture") == nullptr)
22 return;
23
25
26 m_key = std::move(key);
27 m_valid = true;
28}
static void copy_from_framebuffer(unsigned int &tex_id, std::array< unsigned int, 2 > &tex_size, unsigned int width, unsigned int height, int filter)
Definition GLTexture.cpp:756
Key m_key
Definition SceneCache.hpp:51
std::array< unsigned int, 2 > m_texture_size
Definition SceneCache.hpp:50
unsigned int m_texture_id
Definition SceneCache.hpp:49
bool m_valid
Definition SceneCache.hpp:52
#define GL_NEAREST
Definition gl.h:1200

References Slic3r::GUI::GLTexture::copy_from_framebuffer(), GL_NEAREST, m_key, m_texture_id, m_texture_size, m_valid, and Slic3r::GUI::SceneCache::Key::size.

Here is the call graph for this function:

◆ invalidate()

void Slic3r::GUI::SceneCache::invalidate ( )
inline
44{ m_valid = false; }

References m_valid.

◆ matches()

bool Slic3r::GUI::SceneCache::matches ( const Key & key) const
inline
41{ return m_valid && m_key == key; }

References m_key, and m_valid.

◆ render()

void Slic3r::GUI::SceneCache::render ( GLModel & quad)
31{
32 GLShaderProgram* shader = wxGetApp().get_shader("flat_texture");
33
36
37 shader->start_using();
38 shader->set_uniform("view_model_matrix", Transform3d::Identity());
39 shader->set_uniform("projection_matrix", Transform3d::Identity());
40 shader->set_uniform("uniform_texture", 0);
41
44 quad.render();
46 shader->stop_using();
47
51}
#define glsafe(cmd)
Definition OpenGLUtils.hpp:25
#define GL_TEXTURE0
Definition gl.h:1705
#define glEnable
Definition gl.h:3667
#define GL_DEPTH_TEST
Definition gl.h:574
#define GL_SRC_ALPHA
Definition gl.h:1621
#define glBindTexture
Definition gl.h:3299
#define GL_BLEND
Definition gl.h:275
#define GL_ONE_MINUS_SRC_ALPHA
Definition gl.h:1239
#define GL_TEXTURE_2D
Definition gl.h:1739
#define glDisable
Definition gl.h:3607
#define glActiveTexture
Definition gl.h:3245
#define glBlendFunc
Definition gl.h:3325

References GL_BLEND, GL_DEPTH_TEST, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_TEXTURE0, GL_TEXTURE_2D, glActiveTexture, glBindTexture, glBlendFunc, glDisable, glEnable, glsafe, m_texture_id, Slic3r::GUI::GLModel::render(), Slic3r::GLShaderProgram::set_uniform(), Slic3r::GLShaderProgram::start_using(), and Slic3r::GLShaderProgram::stop_using().

Here is the call graph for this function:

◆ reset()

void Slic3r::GUI::SceneCache::reset ( )
54{
55 m_valid = false;
56 if (m_texture_id != 0) {
58 m_texture_id = 0;
59 }
60 m_texture_size = { { 0, 0 } };
61}
#define glDeleteTextures
Definition gl.h:3587

References glDeleteTextures, glsafe, m_texture_id, m_texture_size, and m_valid.

Member Data Documentation

◆ m_key

Key Slic3r::GUI::SceneCache::m_key
private

Referenced by capture(), and matches().

◆ m_texture_id

unsigned int Slic3r::GUI::SceneCache::m_texture_id { 0 }
private
49{ 0 };

Referenced by capture(), render(), and reset().

◆ m_texture_size

std::array<unsigned int, 2> Slic3r::GUI::SceneCache::m_texture_size { { 0, 0 } }
private
50{ { 0, 0 } };

Referenced by capture(), and reset().

◆ m_valid

bool Slic3r::GUI::SceneCache::m_valid { false }
private
52{ false };

Referenced by capture(), invalidate(), matches(), and reset().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/SceneCache.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/SceneCache.cpp